Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'net-mlx5-hws-set-of-fixes-and-adjustments'

Tariq Toukan says:

====================
net/mlx5: HWS, set of fixes and adjustments

This patch series by Yevgeny and Vlad introduces a set of steering fixes
and adjustments.
====================

Link: https://patch.msgid.link/1747766802-958178-1-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+230 -97
+12 -14
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 527 527 struct mlx5_flow_rule *dst; 528 528 void *in_flow_context, *vlan; 529 529 void *in_match_value; 530 - int reformat_id = 0; 530 + u32 reformat_id = 0; 531 531 unsigned int inlen; 532 532 int dst_cnt_size; 533 533 u32 *in, action; ··· 580 580 MLX5_SET(flow_context, in_flow_context, action, action); 581 581 582 582 if (!extended_dest && fte->act_dests.action.pkt_reformat) { 583 - struct mlx5_pkt_reformat *pkt_reformat = fte->act_dests.action.pkt_reformat; 583 + struct mlx5_pkt_reformat *pkt_reformat = 584 + fte->act_dests.action.pkt_reformat; 584 585 585 - if (pkt_reformat->owner == MLX5_FLOW_RESOURCE_OWNER_SW) { 586 - reformat_id = mlx5_fs_dr_action_get_pkt_reformat_id(pkt_reformat); 587 - if (reformat_id < 0) { 588 - mlx5_core_err(dev, 589 - "Unsupported SW-owned pkt_reformat type (%d) in FW-owned table\n", 590 - pkt_reformat->reformat_type); 591 - err = reformat_id; 592 - goto err_out; 593 - } 594 - } else { 595 - reformat_id = fte->act_dests.action.pkt_reformat->id; 586 + err = mlx5_fs_get_packet_reformat_id(pkt_reformat, 587 + &reformat_id); 588 + if (err) { 589 + mlx5_core_err(dev, 590 + "Unsupported pkt_reformat type (%d)\n", 591 + pkt_reformat->reformat_type); 592 + goto err_out; 596 593 } 597 594 } 598 595 599 - MLX5_SET(flow_context, in_flow_context, packet_reformat_id, (u32)reformat_id); 596 + MLX5_SET(flow_context, in_flow_context, packet_reformat_id, 597 + reformat_id); 600 598 601 599 if (fte->act_dests.action.modify_hdr) { 602 600 if (fte->act_dests.action.modify_hdr->owner == MLX5_FLOW_RESOURCE_OWNER_SW) {
+26 -5
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 1830 1830 return err; 1831 1831 } 1832 1832 1833 + int mlx5_fs_get_packet_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 1834 + u32 *id) 1835 + { 1836 + switch (pkt_reformat->owner) { 1837 + case MLX5_FLOW_RESOURCE_OWNER_FW: 1838 + *id = pkt_reformat->id; 1839 + return 0; 1840 + case MLX5_FLOW_RESOURCE_OWNER_SW: 1841 + return mlx5_fs_dr_action_get_pkt_reformat_id(pkt_reformat, id); 1842 + case MLX5_FLOW_RESOURCE_OWNER_HWS: 1843 + return mlx5_fs_hws_action_get_pkt_reformat_id(pkt_reformat, id); 1844 + default: 1845 + return -EINVAL; 1846 + } 1847 + } 1848 + 1833 1849 static bool mlx5_pkt_reformat_cmp(struct mlx5_pkt_reformat *p1, 1834 1850 struct mlx5_pkt_reformat *p2) 1835 1851 { 1836 - return p1->owner == p2->owner && 1837 - (p1->owner == MLX5_FLOW_RESOURCE_OWNER_FW ? 1838 - p1->id == p2->id : 1839 - mlx5_fs_dr_action_get_pkt_reformat_id(p1) == 1840 - mlx5_fs_dr_action_get_pkt_reformat_id(p2)); 1852 + int err1, err2; 1853 + u32 id1, id2; 1854 + 1855 + if (p1->owner != p2->owner) 1856 + return false; 1857 + 1858 + err1 = mlx5_fs_get_packet_reformat_id(p1, &id1); 1859 + err2 = mlx5_fs_get_packet_reformat_id(p2, &id2); 1860 + 1861 + return !err1 && !err2 && id1 == id2; 1841 1862 } 1842 1863 1843 1864 static bool mlx5_flow_dests_cmp(struct mlx5_flow_destination *d1,
+4
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
··· 58 58 enum mlx5_flow_resource_owner { 59 59 MLX5_FLOW_RESOURCE_OWNER_FW, 60 60 MLX5_FLOW_RESOURCE_OWNER_SW, 61 + MLX5_FLOW_RESOURCE_OWNER_HWS, 61 62 }; 62 63 63 64 struct mlx5_modify_hdr { ··· 386 385 u32 mlx5_fs_get_capabilities(struct mlx5_core_dev *dev, enum mlx5_flow_namespace_type type); 387 386 388 387 struct mlx5_flow_root_namespace *find_root(struct fs_node *node); 388 + 389 + int mlx5_fs_get_packet_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 390 + u32 *id); 389 391 390 392 #define fs_get_obj(v, _node) {v = container_of((_node), typeof(*v), node); } 391 393
+41 -26
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.c
··· 72 72 return action->type; 73 73 } 74 74 75 + struct mlx5_core_dev *mlx5hws_action_get_dev(struct mlx5hws_action *action) 76 + { 77 + return action->ctx->mdev; 78 + } 79 + 75 80 static int hws_action_get_shared_stc_nic(struct mlx5hws_context *ctx, 76 81 enum mlx5hws_context_shared_stc_type stc_type, 77 82 u8 tbl_type) ··· 1190 1185 struct mlx5hws_action_mh_pattern *pattern, 1191 1186 u32 log_bulk_size) 1192 1187 { 1188 + u16 num_actions, max_mh_actions = 0, hw_max_actions; 1193 1189 struct mlx5hws_context *ctx = action->ctx; 1194 - u16 num_actions, max_mh_actions = 0; 1195 1190 int i, ret, size_in_bytes; 1196 1191 u32 pat_id, arg_id = 0; 1197 1192 __be64 *new_pattern; 1198 1193 size_t pat_max_sz; 1199 1194 1200 1195 pat_max_sz = MLX5HWS_ARG_CHUNK_SIZE_MAX * MLX5HWS_ARG_DATA_SIZE; 1196 + hw_max_actions = pat_max_sz / MLX5HWS_MODIFY_ACTION_SIZE; 1201 1197 size_in_bytes = pat_max_sz * sizeof(__be64); 1202 1198 new_pattern = kcalloc(num_of_patterns, size_in_bytes, GFP_KERNEL); 1203 1199 if (!new_pattern) ··· 1208 1202 for (i = 0; i < num_of_patterns; i++) { 1209 1203 size_t new_num_actions; 1210 1204 size_t cur_num_actions; 1211 - u32 nope_location; 1205 + u32 nop_locations; 1212 1206 1213 1207 cur_num_actions = pattern[i].sz / MLX5HWS_MODIFY_ACTION_SIZE; 1214 1208 1215 - mlx5hws_pat_calc_nope(pattern[i].data, cur_num_actions, 1216 - pat_max_sz / MLX5HWS_MODIFY_ACTION_SIZE, 1217 - &new_num_actions, &nope_location, 1218 - &new_pattern[i * pat_max_sz]); 1209 + ret = mlx5hws_pat_calc_nop(pattern[i].data, cur_num_actions, 1210 + hw_max_actions, &new_num_actions, 1211 + &nop_locations, 1212 + &new_pattern[i * pat_max_sz]); 1213 + if (ret) { 1214 + mlx5hws_err(ctx, "Too many actions after nop insertion\n"); 1215 + goto free_new_pat; 1216 + } 1219 1217 1220 - action[i].modify_header.nope_locations = nope_location; 1218 + action[i].modify_header.nop_locations = nop_locations; 1221 1219 action[i].modify_header.num_of_actions = new_num_actions; 1222 1220 1223 1221 max_mh_actions = max(max_mh_actions, new_num_actions); ··· 1268 1258 MLX5_GET(set_action_in, pattern[i].data, action_type); 1269 1259 } else { 1270 1260 /* Multiple modify actions require a pattern */ 1271 - if (unlikely(action[i].modify_header.nope_locations)) { 1261 + if (unlikely(action[i].modify_header.nop_locations)) { 1272 1262 size_t pattern_sz; 1273 1263 1274 1264 pattern_sz = action[i].modify_header.num_of_actions * ··· 2110 2100 u32 arg_idx, 2111 2101 u8 *arg_data, 2112 2102 u16 num_of_actions, 2113 - u32 nope_locations) 2103 + u32 nop_locations) 2114 2104 { 2115 2105 u8 *new_arg_data = NULL; 2116 2106 int i, j; 2117 2107 2118 - if (unlikely(nope_locations)) { 2108 + if (unlikely(nop_locations)) { 2119 2109 new_arg_data = kcalloc(num_of_actions, 2120 2110 MLX5HWS_MODIFY_ACTION_SIZE, GFP_KERNEL); 2121 2111 if (unlikely(!new_arg_data)) 2122 2112 return; 2123 2113 2124 - for (i = 0, j = 0; i < num_of_actions; i++, j++) { 2125 - memcpy(&new_arg_data[j], arg_data, MLX5HWS_MODIFY_ACTION_SIZE); 2126 - if (BIT(i) & nope_locations) 2114 + for (i = 0, j = 0; j < num_of_actions; i++, j++) { 2115 + if (BIT(i) & nop_locations) 2127 2116 j++; 2117 + memcpy(&new_arg_data[j * MLX5HWS_MODIFY_ACTION_SIZE], 2118 + &arg_data[i * MLX5HWS_MODIFY_ACTION_SIZE], 2119 + MLX5HWS_MODIFY_ACTION_SIZE); 2128 2120 } 2129 2121 } 2130 2122 ··· 2222 2210 struct mlx5hws_action *action; 2223 2211 u32 arg_sz, arg_idx; 2224 2212 u8 *single_action; 2213 + u8 max_actions; 2225 2214 __be32 stc_idx; 2226 2215 2227 2216 rule_action = &apply->rule_action[setter->idx_double]; ··· 2250 2237 2251 2238 apply->wqe_data[MLX5HWS_ACTION_OFFSET_DW7] = 2252 2239 *(__be32 *)MLX5_ADDR_OF(set_action_in, single_action, data); 2253 - } else { 2254 - /* Argument offset multiple with number of args per these actions */ 2255 - arg_sz = mlx5hws_arg_get_arg_size(action->modify_header.max_num_of_actions); 2256 - arg_idx = rule_action->modify_header.offset * arg_sz; 2240 + return; 2241 + } 2257 2242 2258 - apply->wqe_data[MLX5HWS_ACTION_OFFSET_DW7] = htonl(arg_idx); 2243 + /* Argument offset multiple with number of args per these actions */ 2244 + max_actions = action->modify_header.max_num_of_actions; 2245 + arg_sz = mlx5hws_arg_get_arg_size(max_actions); 2246 + arg_idx = rule_action->modify_header.offset * arg_sz; 2259 2247 2260 - if (!(action->flags & MLX5HWS_ACTION_FLAG_SHARED)) { 2261 - apply->require_dep = 1; 2262 - hws_action_modify_write(apply->queue, 2263 - action->modify_header.arg_id + arg_idx, 2264 - rule_action->modify_header.data, 2265 - action->modify_header.num_of_actions, 2266 - action->modify_header.nope_locations); 2267 - } 2248 + apply->wqe_data[MLX5HWS_ACTION_OFFSET_DW7] = htonl(arg_idx); 2249 + 2250 + if (!(action->flags & MLX5HWS_ACTION_FLAG_SHARED)) { 2251 + apply->require_dep = 1; 2252 + hws_action_modify_write(apply->queue, 2253 + action->modify_header.arg_id + arg_idx, 2254 + rule_action->modify_header.data, 2255 + action->modify_header.num_of_actions, 2256 + action->modify_header.nop_locations); 2268 2257 } 2269 2258 } 2270 2259
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/action.h
··· 136 136 u32 pat_id; 137 137 u32 arg_id; 138 138 __be64 single_action; 139 - u32 nope_locations; 139 + u32 nop_locations; 140 140 u8 num_of_patterns; 141 141 u8 single_action_type; 142 142 u8 num_of_actions;
+64 -7
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.c
··· 1081 1081 struct mlx5hws_bwc_rule *rule; 1082 1082 int err = 0; 1083 1083 1084 - if (mlx5_fs_cmd_is_fw_term_table(ft)) { 1085 - /* Packet reformat on terminamtion table not supported yet */ 1086 - if (fte->act_dests.action.action & 1087 - MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT) 1088 - return -EOPNOTSUPP; 1084 + if (mlx5_fs_cmd_is_fw_term_table(ft)) 1089 1085 return mlx5_fs_cmd_get_fw_cmds()->create_fte(ns, ft, group, fte); 1090 - } 1091 1086 1092 1087 err = mlx5_fs_fte_get_hws_actions(ns, ft, group, fte, &ractions); 1093 1088 if (err) ··· 1357 1362 pkt_reformat->fs_hws_action.pr_data = pr_data; 1358 1363 } 1359 1364 1360 - pkt_reformat->owner = MLX5_FLOW_RESOURCE_OWNER_SW; 1365 + pkt_reformat->owner = MLX5_FLOW_RESOURCE_OWNER_HWS; 1361 1366 pkt_reformat->fs_hws_action.hws_action = hws_action; 1362 1367 return 0; 1363 1368 ··· 1374 1379 struct mlx5_core_dev *dev = ns->dev; 1375 1380 struct mlx5_fs_hws_pr *pr_data; 1376 1381 struct mlx5_fs_pool *pr_pool; 1382 + 1383 + if (pkt_reformat->fs_hws_action.fw_reformat_id != 0) { 1384 + struct mlx5_pkt_reformat fw_pkt_reformat = { 0 }; 1385 + 1386 + fw_pkt_reformat.id = pkt_reformat->fs_hws_action.fw_reformat_id; 1387 + mlx5_fs_cmd_get_fw_cmds()-> 1388 + packet_reformat_dealloc(ns, &fw_pkt_reformat); 1389 + pkt_reformat->fs_hws_action.fw_reformat_id = 0; 1390 + } 1377 1391 1378 1392 if (pkt_reformat->reformat_type == MLX5_REFORMAT_TYPE_REMOVE_HDR) 1379 1393 return; ··· 1503 1499 err = -ENOMEM; 1504 1500 goto release_mh; 1505 1501 } 1502 + mutex_init(&modify_hdr->fs_hws_action.lock); 1506 1503 modify_hdr->fs_hws_action.mh_data = mh_data; 1507 1504 modify_hdr->fs_hws_action.fs_pool = pool; 1508 1505 modify_hdr->owner = MLX5_FLOW_RESOURCE_OWNER_SW; ··· 1535 1530 pool = modify_hdr->fs_hws_action.fs_pool; 1536 1531 mlx5_fs_hws_mh_pool_release_mh(pool, mh_data); 1537 1532 modify_hdr->fs_hws_action.mh_data = NULL; 1533 + } 1534 + 1535 + int 1536 + mlx5_fs_hws_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 1537 + u32 *reformat_id) 1538 + { 1539 + enum mlx5_flow_namespace_type ns_type = pkt_reformat->ns_type; 1540 + struct mutex *lock = &pkt_reformat->fs_hws_action.lock; 1541 + u32 *id = &pkt_reformat->fs_hws_action.fw_reformat_id; 1542 + struct mlx5_pkt_reformat fw_pkt_reformat = { 0 }; 1543 + struct mlx5_pkt_reformat_params params = { 0 }; 1544 + struct mlx5_flow_root_namespace *ns; 1545 + struct mlx5_core_dev *dev; 1546 + int ret; 1547 + 1548 + mutex_lock(lock); 1549 + 1550 + if (*id != 0) { 1551 + *reformat_id = *id; 1552 + ret = 0; 1553 + goto unlock; 1554 + } 1555 + 1556 + dev = mlx5hws_action_get_dev(pkt_reformat->fs_hws_action.hws_action); 1557 + if (!dev) { 1558 + ret = -EINVAL; 1559 + goto unlock; 1560 + } 1561 + 1562 + ns = mlx5_get_root_namespace(dev, ns_type); 1563 + if (!ns) { 1564 + ret = -EINVAL; 1565 + goto unlock; 1566 + } 1567 + 1568 + params.type = pkt_reformat->reformat_type; 1569 + params.size = pkt_reformat->fs_hws_action.pr_data->data_size; 1570 + params.data = pkt_reformat->fs_hws_action.pr_data->data; 1571 + 1572 + ret = mlx5_fs_cmd_get_fw_cmds()-> 1573 + packet_reformat_alloc(ns, &params, ns_type, &fw_pkt_reformat); 1574 + if (ret) 1575 + goto unlock; 1576 + 1577 + *id = fw_pkt_reformat.id; 1578 + *reformat_id = *id; 1579 + ret = 0; 1580 + 1581 + unlock: 1582 + mutex_unlock(lock); 1583 + 1584 + return ret; 1538 1585 } 1539 1586 1540 1587 static int mlx5_cmd_hws_create_match_definer(struct mlx5_flow_root_namespace *ns,
+16
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
··· 41 41 struct mlx5_fs_pool *fs_pool; 42 42 struct mlx5_fs_hws_pr *pr_data; 43 43 struct mlx5_fs_hws_mh *mh_data; 44 + u32 fw_reformat_id; 45 + /* Protect `fw_reformat_id` against being initialized from multiple 46 + * threads. 47 + */ 48 + struct mutex lock; 44 49 }; 45 50 46 51 struct mlx5_fs_hws_matcher { ··· 89 84 90 85 #ifdef CONFIG_MLX5_HW_STEERING 91 86 87 + int 88 + mlx5_fs_hws_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 89 + u32 *reformat_id); 90 + 92 91 bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev); 93 92 94 93 const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds(void); 95 94 96 95 #else 96 + 97 + static inline int 98 + mlx5_fs_hws_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 99 + u32 *reformat_id) 100 + { 101 + return -EOPNOTSUPP; 102 + } 97 103 98 104 static inline bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev) 99 105 {
+9
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws.h
··· 504 504 mlx5hws_action_get_type(struct mlx5hws_action *action); 505 505 506 506 /** 507 + * mlx5hws_action_get_dev - Get mlx5 core device. 508 + * 509 + * @action: The action to get the device from. 510 + * 511 + * Return: mlx5 core device. 512 + */ 513 + struct mlx5_core_dev *mlx5hws_action_get_dev(struct mlx5hws_action *action); 514 + 515 + /** 507 516 * mlx5hws_action_create_dest_drop - Create a direct rule drop action. 508 517 * 509 518 * @ctx: The context in which the new action will be created.
+39 -37
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.c
··· 490 490 switch (action_type) { 491 491 case MLX5_ACTION_TYPE_SET: 492 492 case MLX5_ACTION_TYPE_ADD: 493 - *src_field = MLX5_GET(set_action_in, pattern, field); 494 - *dst_field = INVALID_FIELD; 493 + *src_field = INVALID_FIELD; 494 + *dst_field = MLX5_GET(set_action_in, pattern, field); 495 495 break; 496 496 case MLX5_ACTION_TYPE_COPY: 497 497 *src_field = MLX5_GET(copy_action_in, pattern, src_field); ··· 522 522 return true; 523 523 } 524 524 525 - void mlx5hws_pat_calc_nope(__be64 *pattern, size_t num_actions, 526 - size_t max_actions, size_t *new_size, 527 - u32 *nope_location, __be64 *new_pat) 525 + int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions, 526 + size_t max_actions, size_t *new_size, 527 + u32 *nop_locations, __be64 *new_pat) 528 528 { 529 - u16 prev_src_field = 0, prev_dst_field = 0; 529 + u16 prev_src_field = INVALID_FIELD, prev_dst_field = INVALID_FIELD; 530 530 u16 src_field, dst_field; 531 531 u8 action_type; 532 + bool dependent; 532 533 size_t i, j; 533 534 534 535 *new_size = num_actions; 535 - *nope_location = 0; 536 + *nop_locations = 0; 536 537 537 538 if (num_actions == 1) 538 - return; 539 + return 0; 539 540 540 541 for (i = 0, j = 0; i < num_actions; i++, j++) { 541 - action_type = MLX5_GET(set_action_in, &pattern[i], action_type); 542 + if (j >= max_actions) 543 + return -EINVAL; 542 544 545 + action_type = MLX5_GET(set_action_in, &pattern[i], action_type); 543 546 hws_action_modify_get_target_fields(action_type, &pattern[i], 544 547 &src_field, &dst_field); 545 - if (i % 2) { 546 - if (action_type == MLX5_ACTION_TYPE_COPY && 547 - (prev_src_field == src_field || 548 - prev_dst_field == dst_field)) { 549 - /* need Nope */ 550 - *new_size += 1; 551 - *nope_location |= BIT(i); 552 - memset(&new_pat[j], 0, MLX5HWS_MODIFY_ACTION_SIZE); 553 - MLX5_SET(set_action_in, &new_pat[j], 554 - action_type, 555 - MLX5_MODIFICATION_TYPE_NOP); 556 - j++; 557 - } else if (prev_src_field == src_field) { 558 - /* need Nope*/ 559 - *new_size += 1; 560 - *nope_location |= BIT(i); 561 - MLX5_SET(set_action_in, &new_pat[j], 562 - action_type, 563 - MLX5_MODIFICATION_TYPE_NOP); 564 - j++; 565 - } 566 - } 567 - memcpy(&new_pat[j], &pattern[i], MLX5HWS_MODIFY_ACTION_SIZE); 568 - /* check if no more space */ 569 - if (j > max_actions) { 570 - *new_size = num_actions; 571 - *nope_location = 0; 572 - return; 548 + 549 + /* For every action, look at it and the previous one. The two 550 + * actions are dependent if: 551 + */ 552 + dependent = 553 + (i > 0) && 554 + /* At least one of the actions is a write and */ 555 + (dst_field != INVALID_FIELD || 556 + prev_dst_field != INVALID_FIELD) && 557 + /* One reads from the other's source */ 558 + (dst_field == prev_src_field || 559 + src_field == prev_dst_field || 560 + /* Or both write to the same destination */ 561 + dst_field == prev_dst_field); 562 + 563 + if (dependent) { 564 + *new_size += 1; 565 + *nop_locations |= BIT(i); 566 + memset(&new_pat[j], 0, MLX5HWS_MODIFY_ACTION_SIZE); 567 + MLX5_SET(set_action_in, &new_pat[j], action_type, 568 + MLX5_MODIFICATION_TYPE_NOP); 569 + j++; 570 + if (j >= max_actions) 571 + return -EINVAL; 573 572 } 574 573 574 + memcpy(&new_pat[j], &pattern[i], MLX5HWS_MODIFY_ACTION_SIZE); 575 575 prev_src_field = src_field; 576 576 prev_dst_field = dst_field; 577 577 } 578 + 579 + return 0; 578 580 }
+3 -2
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/pat_arg.h
··· 96 96 u8 *arg_data, 97 97 size_t data_size); 98 98 99 - void mlx5hws_pat_calc_nope(__be64 *pattern, size_t num_actions, size_t max_actions, 100 - size_t *new_size, u32 *nope_location, __be64 *new_pat); 99 + int mlx5hws_pat_calc_nop(__be64 *pattern, size_t num_actions, 100 + size_t max_actions, size_t *new_size, 101 + u32 *nop_locations, __be64 *new_pat); 101 102 #endif /* MLX5HWS_PAT_ARG_H_ */
+8 -2
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/fs_dr.c
··· 833 833 return steering_caps; 834 834 } 835 835 836 - int mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat) 836 + int 837 + mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 838 + u32 *reformat_id) 837 839 { 840 + struct mlx5dr_action *dr_action; 841 + 838 842 switch (pkt_reformat->reformat_type) { 839 843 case MLX5_REFORMAT_TYPE_L2_TO_VXLAN: 840 844 case MLX5_REFORMAT_TYPE_L2_TO_NVGRE: 841 845 case MLX5_REFORMAT_TYPE_L2_TO_L2_TUNNEL: 842 846 case MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL: 843 847 case MLX5_REFORMAT_TYPE_INSERT_HDR: 844 - return mlx5dr_action_get_pkt_reformat_id(pkt_reformat->fs_dr_action.dr_action); 848 + dr_action = pkt_reformat->fs_dr_action.dr_action; 849 + *reformat_id = mlx5dr_action_get_pkt_reformat_id(dr_action); 850 + return 0; 845 851 } 846 852 return -EOPNOTSUPP; 847 853 }
+7 -3
drivers/net/ethernet/mellanox/mlx5/core/steering/sws/fs_dr.h
··· 38 38 39 39 bool mlx5_fs_dr_is_supported(struct mlx5_core_dev *dev); 40 40 41 - int mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat); 41 + int 42 + mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 43 + u32 *reformat_id); 42 44 43 45 const struct mlx5_flow_cmds *mlx5_fs_cmd_get_dr_cmds(void); 44 46 ··· 51 49 return NULL; 52 50 } 53 51 54 - static inline u32 mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat) 52 + static inline int 53 + mlx5_fs_dr_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 54 + u32 *reformat_id) 55 55 { 56 - return 0; 56 + return -EOPNOTSUPP; 57 57 } 58 58 59 59 static inline bool mlx5_fs_dr_is_supported(struct mlx5_core_dev *dev)