126a81453SMaor Gottlieb /* 226a81453SMaor Gottlieb * Copyright (c) 2015, Mellanox Technologies. All rights reserved. 326a81453SMaor Gottlieb * 426a81453SMaor Gottlieb * This software is available to you under a choice of one of two 526a81453SMaor Gottlieb * licenses. You may choose to be licensed under the terms of the GNU 626a81453SMaor Gottlieb * General Public License (GPL) Version 2, available from the file 726a81453SMaor Gottlieb * COPYING in the main directory of this source tree, or the 826a81453SMaor Gottlieb * OpenIB.org BSD license below: 926a81453SMaor Gottlieb * 1026a81453SMaor Gottlieb * Redistribution and use in source and binary forms, with or 1126a81453SMaor Gottlieb * without modification, are permitted provided that the following 1226a81453SMaor Gottlieb * conditions are met: 1326a81453SMaor Gottlieb * 1426a81453SMaor Gottlieb * - Redistributions of source code must retain the above 1526a81453SMaor Gottlieb * copyright notice, this list of conditions and the following 1626a81453SMaor Gottlieb * disclaimer. 1726a81453SMaor Gottlieb * 1826a81453SMaor Gottlieb * - Redistributions in binary form must reproduce the above 1926a81453SMaor Gottlieb * copyright notice, this list of conditions and the following 2026a81453SMaor Gottlieb * disclaimer in the documentation and/or other materials 2126a81453SMaor Gottlieb * provided with the distribution. 2226a81453SMaor Gottlieb * 2326a81453SMaor Gottlieb * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2426a81453SMaor Gottlieb * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2526a81453SMaor Gottlieb * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2626a81453SMaor Gottlieb * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 2726a81453SMaor Gottlieb * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 2826a81453SMaor Gottlieb * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 2926a81453SMaor Gottlieb * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 3026a81453SMaor Gottlieb * SOFTWARE. 3126a81453SMaor Gottlieb */ 3226a81453SMaor Gottlieb 3326a81453SMaor Gottlieb #ifndef _MLX5_FS_CMD_ 3426a81453SMaor Gottlieb #define _MLX5_FS_CMD_ 3526a81453SMaor Gottlieb 36af76c501SMatan Barak #include "fs_core.h" 37af76c501SMatan Barak 38af76c501SMatan Barak struct mlx5_flow_cmds { 39ae288a48SMaor Gottlieb int (*create_flow_table)(struct mlx5_flow_root_namespace *ns, 40ae288a48SMaor Gottlieb struct mlx5_flow_table *ft, 41b0bb369eSMark Bloch struct mlx5_flow_table_attr *ft_attr, 42ae288a48SMaor Gottlieb struct mlx5_flow_table *next_ft); 43ae288a48SMaor Gottlieb int (*destroy_flow_table)(struct mlx5_flow_root_namespace *ns, 4426a81453SMaor Gottlieb struct mlx5_flow_table *ft); 4526a81453SMaor Gottlieb 46ae288a48SMaor Gottlieb int (*modify_flow_table)(struct mlx5_flow_root_namespace *ns, 4734a40e68SMaor Gottlieb struct mlx5_flow_table *ft, 4834a40e68SMaor Gottlieb struct mlx5_flow_table *next_ft); 4934a40e68SMaor Gottlieb 50ae288a48SMaor Gottlieb int (*create_flow_group)(struct mlx5_flow_root_namespace *ns, 5126a81453SMaor Gottlieb struct mlx5_flow_table *ft, 52af76c501SMatan Barak u32 *in, 53ae288a48SMaor Gottlieb struct mlx5_flow_group *fg); 5426a81453SMaor Gottlieb 55ae288a48SMaor Gottlieb int (*destroy_flow_group)(struct mlx5_flow_root_namespace *ns, 5626a81453SMaor Gottlieb struct mlx5_flow_table *ft, 57ae288a48SMaor Gottlieb struct mlx5_flow_group *fg); 5826a81453SMaor Gottlieb 59ae288a48SMaor Gottlieb int (*create_fte)(struct mlx5_flow_root_namespace *ns, 6026a81453SMaor Gottlieb struct mlx5_flow_table *ft, 61af76c501SMatan Barak struct mlx5_flow_group *fg, 6226a81453SMaor Gottlieb struct fs_fte *fte); 6326a81453SMaor Gottlieb 64ae288a48SMaor Gottlieb int (*update_fte)(struct mlx5_flow_root_namespace *ns, 6526a81453SMaor Gottlieb struct mlx5_flow_table *ft, 66ae288a48SMaor Gottlieb struct mlx5_flow_group *fg, 67bd5251dbSAmir Vadai int modify_mask, 6826a81453SMaor Gottlieb struct fs_fte *fte); 6926a81453SMaor Gottlieb 70ae288a48SMaor Gottlieb int (*delete_fte)(struct mlx5_flow_root_namespace *ns, 7126a81453SMaor Gottlieb struct mlx5_flow_table *ft, 72e810bf5eSAviad Yehezkel struct fs_fte *fte); 7326a81453SMaor Gottlieb 74ae288a48SMaor Gottlieb int (*update_root_ft)(struct mlx5_flow_root_namespace *ns, 75af76c501SMatan Barak struct mlx5_flow_table *ft, 76af76c501SMatan Barak u32 underlay_qpn, 77dae37456SAlex Vesker bool disconnect); 782b688ea5SMaor Gottlieb 792b688ea5SMaor Gottlieb int (*packet_reformat_alloc)(struct mlx5_flow_root_namespace *ns, 803f3f05abSYevgeny Kliteynik struct mlx5_pkt_reformat_params *params, 812b688ea5SMaor Gottlieb enum mlx5_flow_namespace_type namespace, 822b688ea5SMaor Gottlieb struct mlx5_pkt_reformat *pkt_reformat); 832b688ea5SMaor Gottlieb 842b688ea5SMaor Gottlieb void (*packet_reformat_dealloc)(struct mlx5_flow_root_namespace *ns, 852b688ea5SMaor Gottlieb struct mlx5_pkt_reformat *pkt_reformat); 862b688ea5SMaor Gottlieb 872b688ea5SMaor Gottlieb int (*modify_header_alloc)(struct mlx5_flow_root_namespace *ns, 882b688ea5SMaor Gottlieb u8 namespace, u8 num_actions, 892b688ea5SMaor Gottlieb void *modify_actions, 902b688ea5SMaor Gottlieb struct mlx5_modify_hdr *modify_hdr); 912b688ea5SMaor Gottlieb 922b688ea5SMaor Gottlieb void (*modify_header_dealloc)(struct mlx5_flow_root_namespace *ns, 932b688ea5SMaor Gottlieb struct mlx5_modify_hdr *modify_hdr); 946a48faeeSMaor Gottlieb 956a48faeeSMaor Gottlieb int (*set_peer)(struct mlx5_flow_root_namespace *ns, 966d5b7321SShay Drory struct mlx5_flow_root_namespace *peer_ns, 97*62752c0bSShay Drory u16 peer_vhca_id); 986a48faeeSMaor Gottlieb 996a48faeeSMaor Gottlieb int (*create_ns)(struct mlx5_flow_root_namespace *ns); 1006a48faeeSMaor Gottlieb int (*destroy_ns)(struct mlx5_flow_root_namespace *ns); 101e7e2519eSMaor Gottlieb int (*create_match_definer)(struct mlx5_flow_root_namespace *ns, 102e7e2519eSMaor Gottlieb u16 format_id, u32 *match_mask); 103e7e2519eSMaor Gottlieb int (*destroy_match_definer)(struct mlx5_flow_root_namespace *ns, 104e7e2519eSMaor Gottlieb int definer_id); 1058348b71cSDima Chumak 1068348b71cSDima Chumak u32 (*get_capabilities)(struct mlx5_flow_root_namespace *ns, 1078348b71cSDima Chumak enum fs_flow_table_type ft_type); 108af76c501SMatan Barak }; 1099dc0b289SAmir Vadai 110a8ffcc74SRabie Loulou int mlx5_cmd_fc_alloc(struct mlx5_core_dev *dev, u32 *id); 1118536a6bfSGavi Teitz int mlx5_cmd_fc_bulk_alloc(struct mlx5_core_dev *dev, 1128536a6bfSGavi Teitz enum mlx5_fc_bulk_alloc_bitmask alloc_bitmask, 1138536a6bfSGavi Teitz u32 *id); 114a8ffcc74SRabie Loulou int mlx5_cmd_fc_free(struct mlx5_core_dev *dev, u32 id); 115a8ffcc74SRabie Loulou int mlx5_cmd_fc_query(struct mlx5_core_dev *dev, u32 id, 1169dc0b289SAmir Vadai u64 *packets, u64 *bytes); 117a351a1b0SAmir Vadai 1186f06e04bSGavi Teitz int mlx5_cmd_fc_get_bulk_query_out_len(int bulk_len); 1196f06e04bSGavi Teitz int mlx5_cmd_fc_bulk_query(struct mlx5_core_dev *dev, u32 base_id, int bulk_len, 1206f06e04bSGavi Teitz u32 *out); 121a351a1b0SAmir Vadai 122af76c501SMatan Barak const struct mlx5_flow_cmds *mlx5_fs_cmd_get_default(enum fs_flow_table_type type); 1236a48faeeSMaor Gottlieb const struct mlx5_flow_cmds *mlx5_fs_cmd_get_fw_cmds(void); 124af76c501SMatan Barak 12526a81453SMaor Gottlieb #endif 126