16a48faeeSMaor Gottlieb // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB 26a48faeeSMaor Gottlieb /* Copyright (c) 2019 Mellanox Technologies */ 36a48faeeSMaor Gottlieb 46a48faeeSMaor Gottlieb #include "mlx5_core.h" 56a48faeeSMaor Gottlieb #include "fs_core.h" 66a48faeeSMaor Gottlieb #include "fs_cmd.h" 76a48faeeSMaor Gottlieb #include "mlx5dr.h" 86a48faeeSMaor Gottlieb #include "fs_dr.h" 96a48faeeSMaor Gottlieb 106a48faeeSMaor Gottlieb static bool mlx5_dr_is_fw_table(u32 flags) 116a48faeeSMaor Gottlieb { 126a48faeeSMaor Gottlieb if (flags & MLX5_FLOW_TABLE_TERMINATION) 136a48faeeSMaor Gottlieb return true; 146a48faeeSMaor Gottlieb 156a48faeeSMaor Gottlieb return false; 166a48faeeSMaor Gottlieb } 176a48faeeSMaor Gottlieb 186a48faeeSMaor Gottlieb static int mlx5_cmd_dr_update_root_ft(struct mlx5_flow_root_namespace *ns, 196a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 206a48faeeSMaor Gottlieb u32 underlay_qpn, 216a48faeeSMaor Gottlieb bool disconnect) 226a48faeeSMaor Gottlieb { 236a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->update_root_ft(ns, ft, underlay_qpn, 246a48faeeSMaor Gottlieb disconnect); 256a48faeeSMaor Gottlieb } 266a48faeeSMaor Gottlieb 276a48faeeSMaor Gottlieb static int set_miss_action(struct mlx5_flow_root_namespace *ns, 286a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 296a48faeeSMaor Gottlieb struct mlx5_flow_table *next_ft) 306a48faeeSMaor Gottlieb { 316a48faeeSMaor Gottlieb struct mlx5dr_action *old_miss_action; 326a48faeeSMaor Gottlieb struct mlx5dr_action *action = NULL; 336a48faeeSMaor Gottlieb struct mlx5dr_table *next_tbl; 346a48faeeSMaor Gottlieb int err; 356a48faeeSMaor Gottlieb 366a48faeeSMaor Gottlieb next_tbl = next_ft ? next_ft->fs_dr_table.dr_table : NULL; 376a48faeeSMaor Gottlieb if (next_tbl) { 386a48faeeSMaor Gottlieb action = mlx5dr_action_create_dest_table(next_tbl); 396a48faeeSMaor Gottlieb if (!action) 406a48faeeSMaor Gottlieb return -EINVAL; 416a48faeeSMaor Gottlieb } 426a48faeeSMaor Gottlieb old_miss_action = ft->fs_dr_table.miss_action; 436a48faeeSMaor Gottlieb err = mlx5dr_table_set_miss_action(ft->fs_dr_table.dr_table, action); 446a48faeeSMaor Gottlieb if (err && action) { 456a48faeeSMaor Gottlieb err = mlx5dr_action_destroy(action); 466a48faeeSMaor Gottlieb if (err) { 476a48faeeSMaor Gottlieb action = NULL; 486a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed to destroy action (%d)\n", 496a48faeeSMaor Gottlieb err); 506a48faeeSMaor Gottlieb } 516a48faeeSMaor Gottlieb } 526a48faeeSMaor Gottlieb ft->fs_dr_table.miss_action = action; 536a48faeeSMaor Gottlieb if (old_miss_action) { 546a48faeeSMaor Gottlieb err = mlx5dr_action_destroy(old_miss_action); 556a48faeeSMaor Gottlieb if (err) 566a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed to destroy action (%d)\n", 576a48faeeSMaor Gottlieb err); 586a48faeeSMaor Gottlieb } 596a48faeeSMaor Gottlieb 606a48faeeSMaor Gottlieb return err; 616a48faeeSMaor Gottlieb } 626a48faeeSMaor Gottlieb 636a48faeeSMaor Gottlieb static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns, 646a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 6504745afbSPaul Blakey unsigned int size, 666a48faeeSMaor Gottlieb struct mlx5_flow_table *next_ft) 676a48faeeSMaor Gottlieb { 686a48faeeSMaor Gottlieb struct mlx5dr_table *tbl; 6913a7e459SErez Shitrit u32 flags; 706a48faeeSMaor Gottlieb int err; 716a48faeeSMaor Gottlieb 726a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 736a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->create_flow_table(ns, ft, 7404745afbSPaul Blakey size, 756a48faeeSMaor Gottlieb next_ft); 7613a7e459SErez Shitrit flags = ft->flags; 7713a7e459SErez Shitrit /* turn off encap/decap if not supported for sw-str by fw */ 7813a7e459SErez Shitrit if (!MLX5_CAP_FLOWTABLE(ns->dev, sw_owner_reformat_supported)) 7913a7e459SErez Shitrit flags = ft->flags & ~(MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT | 8013a7e459SErez Shitrit MLX5_FLOW_TABLE_TUNNEL_EN_DECAP); 816a48faeeSMaor Gottlieb 8213a7e459SErez Shitrit tbl = mlx5dr_table_create(ns->fs_dr_domain.dr_domain, ft->level, flags); 836a48faeeSMaor Gottlieb if (!tbl) { 846a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed creating dr flow_table\n"); 856a48faeeSMaor Gottlieb return -EINVAL; 866a48faeeSMaor Gottlieb } 876a48faeeSMaor Gottlieb 886a48faeeSMaor Gottlieb ft->fs_dr_table.dr_table = tbl; 896a48faeeSMaor Gottlieb ft->id = mlx5dr_table_get_id(tbl); 906a48faeeSMaor Gottlieb 916a48faeeSMaor Gottlieb if (next_ft) { 926a48faeeSMaor Gottlieb err = set_miss_action(ns, ft, next_ft); 936a48faeeSMaor Gottlieb if (err) { 946a48faeeSMaor Gottlieb mlx5dr_table_destroy(tbl); 956a48faeeSMaor Gottlieb ft->fs_dr_table.dr_table = NULL; 966a48faeeSMaor Gottlieb return err; 976a48faeeSMaor Gottlieb } 986a48faeeSMaor Gottlieb } 996a48faeeSMaor Gottlieb 1009e117998SPaul Blakey ft->max_fte = INT_MAX; 10104745afbSPaul Blakey 1026a48faeeSMaor Gottlieb return 0; 1036a48faeeSMaor Gottlieb } 1046a48faeeSMaor Gottlieb 1056a48faeeSMaor Gottlieb static int mlx5_cmd_dr_destroy_flow_table(struct mlx5_flow_root_namespace *ns, 1066a48faeeSMaor Gottlieb struct mlx5_flow_table *ft) 1076a48faeeSMaor Gottlieb { 1086a48faeeSMaor Gottlieb struct mlx5dr_action *action = ft->fs_dr_table.miss_action; 1096a48faeeSMaor Gottlieb int err; 1106a48faeeSMaor Gottlieb 1116a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 1126a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_table(ns, ft); 1136a48faeeSMaor Gottlieb 1146a48faeeSMaor Gottlieb err = mlx5dr_table_destroy(ft->fs_dr_table.dr_table); 1156a48faeeSMaor Gottlieb if (err) { 1166a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed to destroy flow_table (%d)\n", 1176a48faeeSMaor Gottlieb err); 1186a48faeeSMaor Gottlieb return err; 1196a48faeeSMaor Gottlieb } 1206a48faeeSMaor Gottlieb if (action) { 1216a48faeeSMaor Gottlieb err = mlx5dr_action_destroy(action); 1226a48faeeSMaor Gottlieb if (err) { 1236a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed to destroy action(%d)\n", 1246a48faeeSMaor Gottlieb err); 1256a48faeeSMaor Gottlieb return err; 1266a48faeeSMaor Gottlieb } 1276a48faeeSMaor Gottlieb } 1286a48faeeSMaor Gottlieb 1296a48faeeSMaor Gottlieb return err; 1306a48faeeSMaor Gottlieb } 1316a48faeeSMaor Gottlieb 1326a48faeeSMaor Gottlieb static int mlx5_cmd_dr_modify_flow_table(struct mlx5_flow_root_namespace *ns, 1336a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 1346a48faeeSMaor Gottlieb struct mlx5_flow_table *next_ft) 1356a48faeeSMaor Gottlieb { 1366a48faeeSMaor Gottlieb return set_miss_action(ns, ft, next_ft); 1376a48faeeSMaor Gottlieb } 1386a48faeeSMaor Gottlieb 1396a48faeeSMaor Gottlieb static int mlx5_cmd_dr_create_flow_group(struct mlx5_flow_root_namespace *ns, 1406a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 1416a48faeeSMaor Gottlieb u32 *in, 1426a48faeeSMaor Gottlieb struct mlx5_flow_group *fg) 1436a48faeeSMaor Gottlieb { 1446a48faeeSMaor Gottlieb struct mlx5dr_matcher *matcher; 145f6409299SHamdan Igbaria u32 priority = MLX5_GET(create_flow_group_in, in, 1466a48faeeSMaor Gottlieb start_flow_index); 1476a48faeeSMaor Gottlieb u8 match_criteria_enable = MLX5_GET(create_flow_group_in, 1486a48faeeSMaor Gottlieb in, 1496a48faeeSMaor Gottlieb match_criteria_enable); 1506a48faeeSMaor Gottlieb struct mlx5dr_match_parameters mask; 1516a48faeeSMaor Gottlieb 1526a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 1536a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->create_flow_group(ns, ft, in, 1546a48faeeSMaor Gottlieb fg); 1556a48faeeSMaor Gottlieb 1566a48faeeSMaor Gottlieb mask.match_buf = MLX5_ADDR_OF(create_flow_group_in, 1576a48faeeSMaor Gottlieb in, match_criteria); 1586a48faeeSMaor Gottlieb mask.match_sz = sizeof(fg->mask.match_criteria); 1596a48faeeSMaor Gottlieb 1606a48faeeSMaor Gottlieb matcher = mlx5dr_matcher_create(ft->fs_dr_table.dr_table, 1616a48faeeSMaor Gottlieb priority, 1626a48faeeSMaor Gottlieb match_criteria_enable, 1636a48faeeSMaor Gottlieb &mask); 1646a48faeeSMaor Gottlieb if (!matcher) { 1656a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed creating matcher\n"); 1666a48faeeSMaor Gottlieb return -EINVAL; 1676a48faeeSMaor Gottlieb } 1686a48faeeSMaor Gottlieb 1696a48faeeSMaor Gottlieb fg->fs_dr_matcher.dr_matcher = matcher; 1706a48faeeSMaor Gottlieb return 0; 1716a48faeeSMaor Gottlieb } 1726a48faeeSMaor Gottlieb 1736a48faeeSMaor Gottlieb static int mlx5_cmd_dr_destroy_flow_group(struct mlx5_flow_root_namespace *ns, 1746a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 1756a48faeeSMaor Gottlieb struct mlx5_flow_group *fg) 1766a48faeeSMaor Gottlieb { 1776a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 1786a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->destroy_flow_group(ns, ft, fg); 1796a48faeeSMaor Gottlieb 1806a48faeeSMaor Gottlieb return mlx5dr_matcher_destroy(fg->fs_dr_matcher.dr_matcher); 1816a48faeeSMaor Gottlieb } 1826a48faeeSMaor Gottlieb 1836a48faeeSMaor Gottlieb static struct mlx5dr_action *create_vport_action(struct mlx5dr_domain *domain, 1846a48faeeSMaor Gottlieb struct mlx5_flow_rule *dst) 1856a48faeeSMaor Gottlieb { 1866a48faeeSMaor Gottlieb struct mlx5_flow_destination *dest_attr = &dst->dest_attr; 1876a48faeeSMaor Gottlieb 1886a48faeeSMaor Gottlieb return mlx5dr_action_create_dest_vport(domain, dest_attr->vport.num, 1896a48faeeSMaor Gottlieb dest_attr->vport.flags & 1906a48faeeSMaor Gottlieb MLX5_FLOW_DEST_VPORT_VHCA_ID, 1916a48faeeSMaor Gottlieb dest_attr->vport.vhca_id); 1926a48faeeSMaor Gottlieb } 1936a48faeeSMaor Gottlieb 194aec292eeSAlex Vesker static struct mlx5dr_action *create_ft_action(struct mlx5dr_domain *domain, 1956a48faeeSMaor Gottlieb struct mlx5_flow_rule *dst) 1966a48faeeSMaor Gottlieb { 1976a48faeeSMaor Gottlieb struct mlx5_flow_table *dest_ft = dst->dest_attr.ft; 1986a48faeeSMaor Gottlieb 1996a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(dest_ft->flags)) 200aec292eeSAlex Vesker return mlx5dr_action_create_dest_flow_fw_table(domain, dest_ft); 2016a48faeeSMaor Gottlieb return mlx5dr_action_create_dest_table(dest_ft->fs_dr_table.dr_table); 2026a48faeeSMaor Gottlieb } 2036a48faeeSMaor Gottlieb 2046a48faeeSMaor Gottlieb static struct mlx5dr_action *create_action_push_vlan(struct mlx5dr_domain *domain, 2056a48faeeSMaor Gottlieb struct mlx5_fs_vlan *vlan) 2066a48faeeSMaor Gottlieb { 2076a48faeeSMaor Gottlieb u16 n_ethtype = vlan->ethtype; 2086a48faeeSMaor Gottlieb u8 prio = vlan->prio; 2096a48faeeSMaor Gottlieb u16 vid = vlan->vid; 2106a48faeeSMaor Gottlieb u32 vlan_hdr; 2116a48faeeSMaor Gottlieb 2126a48faeeSMaor Gottlieb vlan_hdr = (u32)n_ethtype << 16 | (u32)(prio) << 12 | (u32)vid; 2136a48faeeSMaor Gottlieb return mlx5dr_action_create_push_vlan(domain, htonl(vlan_hdr)); 2146a48faeeSMaor Gottlieb } 2156a48faeeSMaor Gottlieb 2167ee3f6d2SAlex Vesker static bool contain_vport_reformat_action(struct mlx5_flow_rule *dst) 2177ee3f6d2SAlex Vesker { 2187ee3f6d2SAlex Vesker return dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT && 2197ee3f6d2SAlex Vesker dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID; 2207ee3f6d2SAlex Vesker } 2217ee3f6d2SAlex Vesker 2226a48faeeSMaor Gottlieb #define MLX5_FLOW_CONTEXT_ACTION_MAX 20 2236a48faeeSMaor Gottlieb static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, 2246a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 2256a48faeeSMaor Gottlieb struct mlx5_flow_group *group, 2266a48faeeSMaor Gottlieb struct fs_fte *fte) 2276a48faeeSMaor Gottlieb { 2286a48faeeSMaor Gottlieb struct mlx5dr_domain *domain = ns->fs_dr_domain.dr_domain; 2297ee3f6d2SAlex Vesker struct mlx5dr_action_dest *term_actions; 2306a48faeeSMaor Gottlieb struct mlx5dr_match_parameters params; 2316a48faeeSMaor Gottlieb struct mlx5_core_dev *dev = ns->dev; 2326a48faeeSMaor Gottlieb struct mlx5dr_action **fs_dr_actions; 2336a48faeeSMaor Gottlieb struct mlx5dr_action *tmp_action; 2346a48faeeSMaor Gottlieb struct mlx5dr_action **actions; 2356a48faeeSMaor Gottlieb bool delay_encap_set = false; 2366a48faeeSMaor Gottlieb struct mlx5dr_rule *rule; 2376a48faeeSMaor Gottlieb struct mlx5_flow_rule *dst; 2386a48faeeSMaor Gottlieb int fs_dr_num_actions = 0; 2397ee3f6d2SAlex Vesker int num_term_actions = 0; 2406a48faeeSMaor Gottlieb int num_actions = 0; 2416a48faeeSMaor Gottlieb size_t match_sz; 2426a48faeeSMaor Gottlieb int err = 0; 2436a48faeeSMaor Gottlieb int i; 2446a48faeeSMaor Gottlieb 2456a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 2466a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->create_fte(ns, ft, group, fte); 2476a48faeeSMaor Gottlieb 2486a48faeeSMaor Gottlieb actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, sizeof(*actions), 2496a48faeeSMaor Gottlieb GFP_KERNEL); 2507ee3f6d2SAlex Vesker if (!actions) { 2517ee3f6d2SAlex Vesker err = -ENOMEM; 2527ee3f6d2SAlex Vesker goto out_err; 2537ee3f6d2SAlex Vesker } 2546a48faeeSMaor Gottlieb 2556a48faeeSMaor Gottlieb fs_dr_actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, 2566a48faeeSMaor Gottlieb sizeof(*fs_dr_actions), GFP_KERNEL); 2576a48faeeSMaor Gottlieb if (!fs_dr_actions) { 2587ee3f6d2SAlex Vesker err = -ENOMEM; 2597ee3f6d2SAlex Vesker goto free_actions_alloc; 2607ee3f6d2SAlex Vesker } 2617ee3f6d2SAlex Vesker 2627ee3f6d2SAlex Vesker term_actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, 2637ee3f6d2SAlex Vesker sizeof(*term_actions), GFP_KERNEL); 2647ee3f6d2SAlex Vesker if (!term_actions) { 2657ee3f6d2SAlex Vesker err = -ENOMEM; 2667ee3f6d2SAlex Vesker goto free_fs_dr_actions_alloc; 2676a48faeeSMaor Gottlieb } 2686a48faeeSMaor Gottlieb 2696a48faeeSMaor Gottlieb match_sz = sizeof(fte->val); 2706a48faeeSMaor Gottlieb 2717ee3f6d2SAlex Vesker /* Drop reformat action bit if destination vport set with reformat */ 2727ee3f6d2SAlex Vesker if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { 2737ee3f6d2SAlex Vesker list_for_each_entry(dst, &fte->node.children, node.list) { 2747ee3f6d2SAlex Vesker if (!contain_vport_reformat_action(dst)) 2757ee3f6d2SAlex Vesker continue; 2767ee3f6d2SAlex Vesker 2777ee3f6d2SAlex Vesker fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; 2787ee3f6d2SAlex Vesker break; 2797ee3f6d2SAlex Vesker } 2807ee3f6d2SAlex Vesker } 2817ee3f6d2SAlex Vesker 2826a48faeeSMaor Gottlieb /* The order of the actions are must to be keep, only the following 2836a48faeeSMaor Gottlieb * order is supported by SW steering: 284b2064909SAlex Vesker * TX: modify header -> push vlan -> encap 2856a48faeeSMaor Gottlieb * RX: decap -> pop vlan -> modify header 2866a48faeeSMaor Gottlieb */ 2876a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_DECAP) { 2886a48faeeSMaor Gottlieb enum mlx5dr_action_reformat_type decap_type = 2896a48faeeSMaor Gottlieb DR_ACTION_REFORMAT_TYP_TNL_L2_TO_L2; 2906a48faeeSMaor Gottlieb 2916a48faeeSMaor Gottlieb tmp_action = mlx5dr_action_create_packet_reformat(domain, 292*3f3f05abSYevgeny Kliteynik decap_type, 293*3f3f05abSYevgeny Kliteynik 0, 0, 0, 2946a48faeeSMaor Gottlieb NULL); 2956a48faeeSMaor Gottlieb if (!tmp_action) { 2966a48faeeSMaor Gottlieb err = -ENOMEM; 2976a48faeeSMaor Gottlieb goto free_actions; 2986a48faeeSMaor Gottlieb } 2996a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 3006a48faeeSMaor Gottlieb actions[num_actions++] = tmp_action; 3016a48faeeSMaor Gottlieb } 3026a48faeeSMaor Gottlieb 3036a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) { 3046a48faeeSMaor Gottlieb bool is_decap = fte->action.pkt_reformat->reformat_type == 3056a48faeeSMaor Gottlieb MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2; 3066a48faeeSMaor Gottlieb 3076a48faeeSMaor Gottlieb if (is_decap) 3086a48faeeSMaor Gottlieb actions[num_actions++] = 3096a48faeeSMaor Gottlieb fte->action.pkt_reformat->action.dr_action; 3106a48faeeSMaor Gottlieb else 3116a48faeeSMaor Gottlieb delay_encap_set = true; 3126a48faeeSMaor Gottlieb } 3136a48faeeSMaor Gottlieb 3146a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP) { 3156a48faeeSMaor Gottlieb tmp_action = 3166a48faeeSMaor Gottlieb mlx5dr_action_create_pop_vlan(); 3176a48faeeSMaor Gottlieb if (!tmp_action) { 3186a48faeeSMaor Gottlieb err = -ENOMEM; 3196a48faeeSMaor Gottlieb goto free_actions; 3206a48faeeSMaor Gottlieb } 3216a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 3226a48faeeSMaor Gottlieb actions[num_actions++] = tmp_action; 3236a48faeeSMaor Gottlieb } 3246a48faeeSMaor Gottlieb 3256a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2) { 3266a48faeeSMaor Gottlieb tmp_action = 3276a48faeeSMaor Gottlieb mlx5dr_action_create_pop_vlan(); 3286a48faeeSMaor Gottlieb if (!tmp_action) { 3296a48faeeSMaor Gottlieb err = -ENOMEM; 3306a48faeeSMaor Gottlieb goto free_actions; 3316a48faeeSMaor Gottlieb } 3326a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 3336a48faeeSMaor Gottlieb actions[num_actions++] = tmp_action; 3346a48faeeSMaor Gottlieb } 3356a48faeeSMaor Gottlieb 3366a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR) 3376a48faeeSMaor Gottlieb actions[num_actions++] = 3386a48faeeSMaor Gottlieb fte->action.modify_hdr->action.dr_action; 3396a48faeeSMaor Gottlieb 340b2064909SAlex Vesker if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH) { 341b2064909SAlex Vesker tmp_action = create_action_push_vlan(domain, &fte->action.vlan[0]); 342b2064909SAlex Vesker if (!tmp_action) { 343b2064909SAlex Vesker err = -ENOMEM; 344b2064909SAlex Vesker goto free_actions; 345b2064909SAlex Vesker } 346b2064909SAlex Vesker fs_dr_actions[fs_dr_num_actions++] = tmp_action; 347b2064909SAlex Vesker actions[num_actions++] = tmp_action; 348b2064909SAlex Vesker } 349b2064909SAlex Vesker 350b2064909SAlex Vesker if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2) { 351b2064909SAlex Vesker tmp_action = create_action_push_vlan(domain, &fte->action.vlan[1]); 352b2064909SAlex Vesker if (!tmp_action) { 353b2064909SAlex Vesker err = -ENOMEM; 354b2064909SAlex Vesker goto free_actions; 355b2064909SAlex Vesker } 356b2064909SAlex Vesker fs_dr_actions[fs_dr_num_actions++] = tmp_action; 357b2064909SAlex Vesker actions[num_actions++] = tmp_action; 358b2064909SAlex Vesker } 359b2064909SAlex Vesker 3606a48faeeSMaor Gottlieb if (delay_encap_set) 3616a48faeeSMaor Gottlieb actions[num_actions++] = 3626a48faeeSMaor Gottlieb fte->action.pkt_reformat->action.dr_action; 3636a48faeeSMaor Gottlieb 3646a48faeeSMaor Gottlieb /* The order of the actions below is not important */ 3656a48faeeSMaor Gottlieb 3666a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_DROP) { 3676a48faeeSMaor Gottlieb tmp_action = mlx5dr_action_create_drop(); 3686a48faeeSMaor Gottlieb if (!tmp_action) { 3696a48faeeSMaor Gottlieb err = -ENOMEM; 3706a48faeeSMaor Gottlieb goto free_actions; 3716a48faeeSMaor Gottlieb } 3726a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 3737ee3f6d2SAlex Vesker term_actions[num_term_actions++].dest = tmp_action; 3746a48faeeSMaor Gottlieb } 3756a48faeeSMaor Gottlieb 3766a48faeeSMaor Gottlieb if (fte->flow_context.flow_tag) { 3776a48faeeSMaor Gottlieb tmp_action = 3786a48faeeSMaor Gottlieb mlx5dr_action_create_tag(fte->flow_context.flow_tag); 3796a48faeeSMaor Gottlieb if (!tmp_action) { 3806a48faeeSMaor Gottlieb err = -ENOMEM; 3816a48faeeSMaor Gottlieb goto free_actions; 3826a48faeeSMaor Gottlieb } 3836a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 3846a48faeeSMaor Gottlieb actions[num_actions++] = tmp_action; 3856a48faeeSMaor Gottlieb } 3866a48faeeSMaor Gottlieb 3876a48faeeSMaor Gottlieb if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { 3886a48faeeSMaor Gottlieb list_for_each_entry(dst, &fte->node.children, node.list) { 3896a48faeeSMaor Gottlieb enum mlx5_flow_destination_type type = dst->dest_attr.type; 390de346f40SAlex Vesker u32 ft_id; 3916a48faeeSMaor Gottlieb 3927ee3f6d2SAlex Vesker if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || 3937ee3f6d2SAlex Vesker num_term_actions >= MLX5_FLOW_CONTEXT_ACTION_MAX) { 3946a48faeeSMaor Gottlieb err = -ENOSPC; 3956a48faeeSMaor Gottlieb goto free_actions; 3966a48faeeSMaor Gottlieb } 3976a48faeeSMaor Gottlieb 398b850a821SErez Shitrit if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) 399b850a821SErez Shitrit continue; 4006a48faeeSMaor Gottlieb 401b850a821SErez Shitrit switch (type) { 4026a48faeeSMaor Gottlieb case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: 403aec292eeSAlex Vesker tmp_action = create_ft_action(domain, dst); 4046a48faeeSMaor Gottlieb if (!tmp_action) { 4056a48faeeSMaor Gottlieb err = -ENOMEM; 4066a48faeeSMaor Gottlieb goto free_actions; 4076a48faeeSMaor Gottlieb } 4086a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 4097ee3f6d2SAlex Vesker term_actions[num_term_actions++].dest = tmp_action; 4106a48faeeSMaor Gottlieb break; 4116a48faeeSMaor Gottlieb case MLX5_FLOW_DESTINATION_TYPE_VPORT: 4126a48faeeSMaor Gottlieb tmp_action = create_vport_action(domain, dst); 4136a48faeeSMaor Gottlieb if (!tmp_action) { 4146a48faeeSMaor Gottlieb err = -ENOMEM; 4156a48faeeSMaor Gottlieb goto free_actions; 4166a48faeeSMaor Gottlieb } 4176a48faeeSMaor Gottlieb fs_dr_actions[fs_dr_num_actions++] = tmp_action; 4187ee3f6d2SAlex Vesker term_actions[num_term_actions].dest = tmp_action; 4197ee3f6d2SAlex Vesker 4207ee3f6d2SAlex Vesker if (dst->dest_attr.vport.flags & 4217ee3f6d2SAlex Vesker MLX5_FLOW_DEST_VPORT_REFORMAT_ID) 4227ee3f6d2SAlex Vesker term_actions[num_term_actions].reformat = 4237ee3f6d2SAlex Vesker dst->dest_attr.vport.pkt_reformat->action.dr_action; 4247ee3f6d2SAlex Vesker 4257ee3f6d2SAlex Vesker num_term_actions++; 4266a48faeeSMaor Gottlieb break; 427de346f40SAlex Vesker case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: 428de346f40SAlex Vesker ft_id = dst->dest_attr.ft_num; 429de346f40SAlex Vesker tmp_action = mlx5dr_action_create_dest_table_num(domain, 430de346f40SAlex Vesker ft_id); 431de346f40SAlex Vesker if (!tmp_action) { 432de346f40SAlex Vesker err = -ENOMEM; 433de346f40SAlex Vesker goto free_actions; 434de346f40SAlex Vesker } 435de346f40SAlex Vesker fs_dr_actions[fs_dr_num_actions++] = tmp_action; 436de346f40SAlex Vesker term_actions[num_term_actions++].dest = tmp_action; 437de346f40SAlex Vesker break; 4386a48faeeSMaor Gottlieb default: 4396a48faeeSMaor Gottlieb err = -EOPNOTSUPP; 4406a48faeeSMaor Gottlieb goto free_actions; 4416a48faeeSMaor Gottlieb } 4426a48faeeSMaor Gottlieb } 4436a48faeeSMaor Gottlieb } 4446a48faeeSMaor Gottlieb 445b850a821SErez Shitrit if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { 446b850a821SErez Shitrit list_for_each_entry(dst, &fte->node.children, node.list) { 447b850a821SErez Shitrit u32 id; 448b850a821SErez Shitrit 449b850a821SErez Shitrit if (dst->dest_attr.type != 450b850a821SErez Shitrit MLX5_FLOW_DESTINATION_TYPE_COUNTER) 451b850a821SErez Shitrit continue; 452b850a821SErez Shitrit 453b850a821SErez Shitrit if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { 454b850a821SErez Shitrit err = -ENOSPC; 455b850a821SErez Shitrit goto free_actions; 456b850a821SErez Shitrit } 457b850a821SErez Shitrit 458b850a821SErez Shitrit id = dst->dest_attr.counter_id; 459b850a821SErez Shitrit tmp_action = 460b850a821SErez Shitrit mlx5dr_action_create_flow_counter(id); 461b850a821SErez Shitrit if (!tmp_action) { 462b850a821SErez Shitrit err = -ENOMEM; 463b850a821SErez Shitrit goto free_actions; 464b850a821SErez Shitrit } 465b850a821SErez Shitrit 466b850a821SErez Shitrit fs_dr_actions[fs_dr_num_actions++] = tmp_action; 467b850a821SErez Shitrit actions[num_actions++] = tmp_action; 468b850a821SErez Shitrit } 469b850a821SErez Shitrit } 470b850a821SErez Shitrit 4716a48faeeSMaor Gottlieb params.match_sz = match_sz; 4726a48faeeSMaor Gottlieb params.match_buf = (u64 *)fte->val; 4737ee3f6d2SAlex Vesker if (num_term_actions == 1) { 4747ee3f6d2SAlex Vesker if (term_actions->reformat) 4757ee3f6d2SAlex Vesker actions[num_actions++] = term_actions->reformat; 4766a48faeeSMaor Gottlieb 4777ee3f6d2SAlex Vesker actions[num_actions++] = term_actions->dest; 4787ee3f6d2SAlex Vesker } else if (num_term_actions > 1) { 4797ee3f6d2SAlex Vesker tmp_action = mlx5dr_action_create_mult_dest_tbl(domain, 4807ee3f6d2SAlex Vesker term_actions, 4817ee3f6d2SAlex Vesker num_term_actions); 4827ee3f6d2SAlex Vesker if (!tmp_action) { 4837ee3f6d2SAlex Vesker err = -EOPNOTSUPP; 4847ee3f6d2SAlex Vesker goto free_actions; 4857ee3f6d2SAlex Vesker } 4867ee3f6d2SAlex Vesker fs_dr_actions[fs_dr_num_actions++] = tmp_action; 4877ee3f6d2SAlex Vesker actions[num_actions++] = tmp_action; 4887ee3f6d2SAlex Vesker } 4896a48faeeSMaor Gottlieb 4906a48faeeSMaor Gottlieb rule = mlx5dr_rule_create(group->fs_dr_matcher.dr_matcher, 4916a48faeeSMaor Gottlieb ¶ms, 4926a48faeeSMaor Gottlieb num_actions, 49301723919SHamdan Igbaria actions, 49401723919SHamdan Igbaria fte->flow_context.flow_source); 4956a48faeeSMaor Gottlieb if (!rule) { 4966a48faeeSMaor Gottlieb err = -EINVAL; 4976a48faeeSMaor Gottlieb goto free_actions; 4986a48faeeSMaor Gottlieb } 4996a48faeeSMaor Gottlieb 5007ee3f6d2SAlex Vesker kfree(term_actions); 5016a48faeeSMaor Gottlieb kfree(actions); 5027ee3f6d2SAlex Vesker 5036a48faeeSMaor Gottlieb fte->fs_dr_rule.dr_rule = rule; 5046a48faeeSMaor Gottlieb fte->fs_dr_rule.num_actions = fs_dr_num_actions; 5056a48faeeSMaor Gottlieb fte->fs_dr_rule.dr_actions = fs_dr_actions; 5066a48faeeSMaor Gottlieb 5076a48faeeSMaor Gottlieb return 0; 5086a48faeeSMaor Gottlieb 5096a48faeeSMaor Gottlieb free_actions: 5107ee3f6d2SAlex Vesker /* Free in reverse order to handle action dependencies */ 5117ee3f6d2SAlex Vesker for (i = fs_dr_num_actions - 1; i >= 0; i--) 5126a48faeeSMaor Gottlieb if (!IS_ERR_OR_NULL(fs_dr_actions[i])) 5136a48faeeSMaor Gottlieb mlx5dr_action_destroy(fs_dr_actions[i]); 5146a48faeeSMaor Gottlieb 5157ee3f6d2SAlex Vesker kfree(term_actions); 5167ee3f6d2SAlex Vesker free_fs_dr_actions_alloc: 5176a48faeeSMaor Gottlieb kfree(fs_dr_actions); 5187ee3f6d2SAlex Vesker free_actions_alloc: 5197ee3f6d2SAlex Vesker kfree(actions); 5207ee3f6d2SAlex Vesker out_err: 5217ee3f6d2SAlex Vesker mlx5_core_err(dev, "Failed to create dr rule err(%d)\n", err); 5226a48faeeSMaor Gottlieb return err; 5236a48faeeSMaor Gottlieb } 5246a48faeeSMaor Gottlieb 5256a48faeeSMaor Gottlieb static int mlx5_cmd_dr_packet_reformat_alloc(struct mlx5_flow_root_namespace *ns, 526*3f3f05abSYevgeny Kliteynik struct mlx5_pkt_reformat_params *params, 5276a48faeeSMaor Gottlieb enum mlx5_flow_namespace_type namespace, 5286a48faeeSMaor Gottlieb struct mlx5_pkt_reformat *pkt_reformat) 5296a48faeeSMaor Gottlieb { 5306a48faeeSMaor Gottlieb struct mlx5dr_domain *dr_domain = ns->fs_dr_domain.dr_domain; 5316a48faeeSMaor Gottlieb struct mlx5dr_action *action; 5326a48faeeSMaor Gottlieb int dr_reformat; 5336a48faeeSMaor Gottlieb 534*3f3f05abSYevgeny Kliteynik switch (params->type) { 5356a48faeeSMaor Gottlieb case MLX5_REFORMAT_TYPE_L2_TO_VXLAN: 5366a48faeeSMaor Gottlieb case MLX5_REFORMAT_TYPE_L2_TO_NVGRE: 5376a48faeeSMaor Gottlieb case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL: 5386a48faeeSMaor Gottlieb dr_reformat = DR_ACTION_REFORMAT_TYP_L2_TO_TNL_L2; 5396a48faeeSMaor Gottlieb break; 5406a48faeeSMaor Gottlieb case MLX5_REFORMAT_TYPE_L3_TUNNEL_TO_L2: 5416a48faeeSMaor Gottlieb dr_reformat = DR_ACTION_REFORMAT_TYP_TNL_L3_TO_L2; 5426a48faeeSMaor Gottlieb break; 5436a48faeeSMaor Gottlieb case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL: 5446a48faeeSMaor Gottlieb dr_reformat = DR_ACTION_REFORMAT_TYP_L2_TO_TNL_L3; 5456a48faeeSMaor Gottlieb break; 5466a48faeeSMaor Gottlieb default: 5476a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Packet-reformat not supported(%d)\n", 548*3f3f05abSYevgeny Kliteynik params->type); 5496a48faeeSMaor Gottlieb return -EOPNOTSUPP; 5506a48faeeSMaor Gottlieb } 5516a48faeeSMaor Gottlieb 5526a48faeeSMaor Gottlieb action = mlx5dr_action_create_packet_reformat(dr_domain, 5536a48faeeSMaor Gottlieb dr_reformat, 554*3f3f05abSYevgeny Kliteynik params->param_0, 555*3f3f05abSYevgeny Kliteynik params->param_1, 556*3f3f05abSYevgeny Kliteynik params->size, 557*3f3f05abSYevgeny Kliteynik params->data); 5586a48faeeSMaor Gottlieb if (!action) { 5596a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed allocating packet-reformat action\n"); 5606a48faeeSMaor Gottlieb return -EINVAL; 5616a48faeeSMaor Gottlieb } 5626a48faeeSMaor Gottlieb 5636a48faeeSMaor Gottlieb pkt_reformat->action.dr_action = action; 5646a48faeeSMaor Gottlieb 5656a48faeeSMaor Gottlieb return 0; 5666a48faeeSMaor Gottlieb } 5676a48faeeSMaor Gottlieb 5686a48faeeSMaor Gottlieb static void mlx5_cmd_dr_packet_reformat_dealloc(struct mlx5_flow_root_namespace *ns, 5696a48faeeSMaor Gottlieb struct mlx5_pkt_reformat *pkt_reformat) 5706a48faeeSMaor Gottlieb { 5716a48faeeSMaor Gottlieb mlx5dr_action_destroy(pkt_reformat->action.dr_action); 5726a48faeeSMaor Gottlieb } 5736a48faeeSMaor Gottlieb 5746a48faeeSMaor Gottlieb static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns, 5756a48faeeSMaor Gottlieb u8 namespace, u8 num_actions, 5766a48faeeSMaor Gottlieb void *modify_actions, 5776a48faeeSMaor Gottlieb struct mlx5_modify_hdr *modify_hdr) 5786a48faeeSMaor Gottlieb { 5796a48faeeSMaor Gottlieb struct mlx5dr_domain *dr_domain = ns->fs_dr_domain.dr_domain; 5806a48faeeSMaor Gottlieb struct mlx5dr_action *action; 5816a48faeeSMaor Gottlieb size_t actions_sz; 5826a48faeeSMaor Gottlieb 583d65dbedfSHuy Nguyen actions_sz = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto) * 5846a48faeeSMaor Gottlieb num_actions; 5856a48faeeSMaor Gottlieb action = mlx5dr_action_create_modify_header(dr_domain, 0, 5866a48faeeSMaor Gottlieb actions_sz, 5876a48faeeSMaor Gottlieb modify_actions); 5886a48faeeSMaor Gottlieb if (!action) { 5896a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed allocating modify-header action\n"); 5906a48faeeSMaor Gottlieb return -EINVAL; 5916a48faeeSMaor Gottlieb } 5926a48faeeSMaor Gottlieb 5936a48faeeSMaor Gottlieb modify_hdr->action.dr_action = action; 5946a48faeeSMaor Gottlieb 5956a48faeeSMaor Gottlieb return 0; 5966a48faeeSMaor Gottlieb } 5976a48faeeSMaor Gottlieb 5986a48faeeSMaor Gottlieb static void mlx5_cmd_dr_modify_header_dealloc(struct mlx5_flow_root_namespace *ns, 5996a48faeeSMaor Gottlieb struct mlx5_modify_hdr *modify_hdr) 6006a48faeeSMaor Gottlieb { 6016a48faeeSMaor Gottlieb mlx5dr_action_destroy(modify_hdr->action.dr_action); 6026a48faeeSMaor Gottlieb } 6036a48faeeSMaor Gottlieb 6046a48faeeSMaor Gottlieb static int mlx5_cmd_dr_update_fte(struct mlx5_flow_root_namespace *ns, 6056a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 6066a48faeeSMaor Gottlieb struct mlx5_flow_group *group, 6076a48faeeSMaor Gottlieb int modify_mask, 6086a48faeeSMaor Gottlieb struct fs_fte *fte) 6096a48faeeSMaor Gottlieb { 6106a48faeeSMaor Gottlieb return -EOPNOTSUPP; 6116a48faeeSMaor Gottlieb } 6126a48faeeSMaor Gottlieb 6136a48faeeSMaor Gottlieb static int mlx5_cmd_dr_delete_fte(struct mlx5_flow_root_namespace *ns, 6146a48faeeSMaor Gottlieb struct mlx5_flow_table *ft, 6156a48faeeSMaor Gottlieb struct fs_fte *fte) 6166a48faeeSMaor Gottlieb { 6176a48faeeSMaor Gottlieb struct mlx5_fs_dr_rule *rule = &fte->fs_dr_rule; 6186a48faeeSMaor Gottlieb int err; 6196a48faeeSMaor Gottlieb int i; 6206a48faeeSMaor Gottlieb 6216a48faeeSMaor Gottlieb if (mlx5_dr_is_fw_table(ft->flags)) 6226a48faeeSMaor Gottlieb return mlx5_fs_cmd_get_fw_cmds()->delete_fte(ns, ft, fte); 6236a48faeeSMaor Gottlieb 6246a48faeeSMaor Gottlieb err = mlx5dr_rule_destroy(rule->dr_rule); 6256a48faeeSMaor Gottlieb if (err) 6266a48faeeSMaor Gottlieb return err; 6276a48faeeSMaor Gottlieb 6287ee3f6d2SAlex Vesker /* Free in reverse order to handle action dependencies */ 6297ee3f6d2SAlex Vesker for (i = rule->num_actions - 1; i >= 0; i--) 6306a48faeeSMaor Gottlieb if (!IS_ERR_OR_NULL(rule->dr_actions[i])) 6316a48faeeSMaor Gottlieb mlx5dr_action_destroy(rule->dr_actions[i]); 6326a48faeeSMaor Gottlieb 6336a48faeeSMaor Gottlieb kfree(rule->dr_actions); 6346a48faeeSMaor Gottlieb return 0; 6356a48faeeSMaor Gottlieb } 6366a48faeeSMaor Gottlieb 6376a48faeeSMaor Gottlieb static int mlx5_cmd_dr_set_peer(struct mlx5_flow_root_namespace *ns, 6386a48faeeSMaor Gottlieb struct mlx5_flow_root_namespace *peer_ns) 6396a48faeeSMaor Gottlieb { 6406a48faeeSMaor Gottlieb struct mlx5dr_domain *peer_domain = NULL; 6416a48faeeSMaor Gottlieb 6426a48faeeSMaor Gottlieb if (peer_ns) 6436a48faeeSMaor Gottlieb peer_domain = peer_ns->fs_dr_domain.dr_domain; 6446a48faeeSMaor Gottlieb mlx5dr_domain_set_peer(ns->fs_dr_domain.dr_domain, 6456a48faeeSMaor Gottlieb peer_domain); 6466a48faeeSMaor Gottlieb return 0; 6476a48faeeSMaor Gottlieb } 6486a48faeeSMaor Gottlieb 6496a48faeeSMaor Gottlieb static int mlx5_cmd_dr_create_ns(struct mlx5_flow_root_namespace *ns) 6506a48faeeSMaor Gottlieb { 6516a48faeeSMaor Gottlieb ns->fs_dr_domain.dr_domain = 6526a48faeeSMaor Gottlieb mlx5dr_domain_create(ns->dev, 6536a48faeeSMaor Gottlieb MLX5DR_DOMAIN_TYPE_FDB); 6546a48faeeSMaor Gottlieb if (!ns->fs_dr_domain.dr_domain) { 6556a48faeeSMaor Gottlieb mlx5_core_err(ns->dev, "Failed to create dr flow namespace\n"); 6566a48faeeSMaor Gottlieb return -EOPNOTSUPP; 6576a48faeeSMaor Gottlieb } 6586a48faeeSMaor Gottlieb return 0; 6596a48faeeSMaor Gottlieb } 6606a48faeeSMaor Gottlieb 6616a48faeeSMaor Gottlieb static int mlx5_cmd_dr_destroy_ns(struct mlx5_flow_root_namespace *ns) 6626a48faeeSMaor Gottlieb { 6636a48faeeSMaor Gottlieb return mlx5dr_domain_destroy(ns->fs_dr_domain.dr_domain); 6646a48faeeSMaor Gottlieb } 6656a48faeeSMaor Gottlieb 6666a48faeeSMaor Gottlieb bool mlx5_fs_dr_is_supported(struct mlx5_core_dev *dev) 6676a48faeeSMaor Gottlieb { 6686a48faeeSMaor Gottlieb return mlx5dr_is_supported(dev); 6696a48faeeSMaor Gottlieb } 6706a48faeeSMaor Gottlieb 6716a48faeeSMaor Gottlieb static const struct mlx5_flow_cmds mlx5_flow_cmds_dr = { 6726a48faeeSMaor Gottlieb .create_flow_table = mlx5_cmd_dr_create_flow_table, 6736a48faeeSMaor Gottlieb .destroy_flow_table = mlx5_cmd_dr_destroy_flow_table, 6746a48faeeSMaor Gottlieb .modify_flow_table = mlx5_cmd_dr_modify_flow_table, 6756a48faeeSMaor Gottlieb .create_flow_group = mlx5_cmd_dr_create_flow_group, 6766a48faeeSMaor Gottlieb .destroy_flow_group = mlx5_cmd_dr_destroy_flow_group, 6776a48faeeSMaor Gottlieb .create_fte = mlx5_cmd_dr_create_fte, 6786a48faeeSMaor Gottlieb .update_fte = mlx5_cmd_dr_update_fte, 6796a48faeeSMaor Gottlieb .delete_fte = mlx5_cmd_dr_delete_fte, 6806a48faeeSMaor Gottlieb .update_root_ft = mlx5_cmd_dr_update_root_ft, 6816a48faeeSMaor Gottlieb .packet_reformat_alloc = mlx5_cmd_dr_packet_reformat_alloc, 6826a48faeeSMaor Gottlieb .packet_reformat_dealloc = mlx5_cmd_dr_packet_reformat_dealloc, 6836a48faeeSMaor Gottlieb .modify_header_alloc = mlx5_cmd_dr_modify_header_alloc, 6846a48faeeSMaor Gottlieb .modify_header_dealloc = mlx5_cmd_dr_modify_header_dealloc, 6856a48faeeSMaor Gottlieb .set_peer = mlx5_cmd_dr_set_peer, 6866a48faeeSMaor Gottlieb .create_ns = mlx5_cmd_dr_create_ns, 6876a48faeeSMaor Gottlieb .destroy_ns = mlx5_cmd_dr_destroy_ns, 6886a48faeeSMaor Gottlieb }; 6896a48faeeSMaor Gottlieb 6906a48faeeSMaor Gottlieb const struct mlx5_flow_cmds *mlx5_fs_cmd_get_dr_cmds(void) 6916a48faeeSMaor Gottlieb { 6926a48faeeSMaor Gottlieb return &mlx5_flow_cmds_dr; 6936a48faeeSMaor Gottlieb } 694