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

Merge tag 'mlx5-updates-2022-05-02' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5-updates-2022-05-02

1) Trivial Misc updates to mlx5 driver

2) From Mark Bloch: Flow steering, general steering refactoring/cleaning

An issue with flow steering deletion flow (when creating a rule without
dests) turned out to be easy to fix but during the fix some issue
with the flow steering creation/deletion flows have been found.

The following patch series tries to fix long standing issues with flow
steering code and hopefully preventing silly future bugs.

A) Fix an issue where a proper dest type wasn't assigned.
B) Refactor and fix dests enums values, refactor deletion
function and do proper bookkeeping of dests.
C) Change mlx5_del_flow_rules() to delete rules when there are no
no more rules attached associated with an FTE.
D) Don't call hard coded deletion function but use the node's
defined one.
E) Add a WARN_ON() to catch future bugs when an FTE with dests
is deleted.

* tag 'mlx5-updates-2022-05-02' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
net/mlx5: fs, an FTE should have no dests when deleted
net/mlx5: fs, call the deletion function of the node
net/mlx5: fs, delete the FTE when there are no rules attached to it
net/mlx5: fs, do proper bookkeeping for forward destinations
net/mlx5: fs, add unused destination type
net/mlx5: fs, jump to exit point and don't fall through
net/mlx5: fs, refactor software deletion rule
net/mlx5: fs, split software and IFC flow destination definitions
net/mlx5e: TC, set proper dest type
net/mlx5e: Remove unused mlx5e_dcbnl_build_rep_netdev function
net/mlx5e: Drop error CQE handling from the XSK RX handler
net/mlx5: Print initializing field in case of timeout
net/mlx5: Delete redundant default assignment of runtime devlink params
net/mlx5: Remove useless kfree
net/mlx5: use kvfree() for kvzalloc() in mlx5_ct_fs_smfs_matcher_create
====================

Link: https://lore.kernel.org/r/
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

+109 -90
-20
drivers/net/ethernet/mellanox/mlx5/core/devlink.c
··· 584 584 struct mlx5_core_dev *dev = devlink_priv(devlink); 585 585 union devlink_param_value value; 586 586 587 - if (dev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_DMFS) 588 - strcpy(value.vstr, "dmfs"); 589 - else 590 - strcpy(value.vstr, "smfs"); 591 - devlink_param_driverinit_value_set(devlink, 592 - MLX5_DEVLINK_PARAM_ID_FLOW_STEERING_MODE, 593 - value); 594 - 595 587 value.vbool = MLX5_CAP_GEN(dev, roce); 596 588 devlink_param_driverinit_value_set(devlink, 597 589 DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE, ··· 594 602 devlink_param_driverinit_value_set(devlink, 595 603 MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM, 596 604 value); 597 - 598 - if (MLX5_ESWITCH_MANAGER(dev)) { 599 - if (mlx5_esw_vport_match_metadata_supported(dev->priv.eswitch)) { 600 - dev->priv.eswitch->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA; 601 - value.vbool = true; 602 - } else { 603 - value.vbool = false; 604 - } 605 - devlink_param_driverinit_value_set(devlink, 606 - MLX5_DEVLINK_PARAM_ID_ESW_PORT_METADATA, 607 - value); 608 - } 609 605 #endif 610 606 611 607 value.vu32 = MLX5_COMP_EQ_SIZE;
+3
drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c
··· 259 259 case MLX5_FLOW_DESTINATION_TYPE_PORT: 260 260 trace_seq_printf(p, "port\n"); 261 261 break; 262 + case MLX5_FLOW_DESTINATION_TYPE_NONE: 263 + trace_seq_printf(p, "none\n"); 264 + break; 262 265 } 263 266 264 267 trace_seq_putc(p, 0);
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 648 648 (*mlx5e_fp_skb_from_cqe_mpwrq)(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi, 649 649 u16 cqe_bcnt, u32 head_offset, u32 page_idx); 650 650 typedef struct sk_buff * 651 - (*mlx5e_fp_skb_from_cqe)(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, 652 - struct mlx5e_wqe_frag_info *wi, u32 cqe_bcnt); 651 + (*mlx5e_fp_skb_from_cqe)(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi, 652 + u32 cqe_bcnt); 653 653 typedef bool (*mlx5e_fp_post_rx_wqes)(struct mlx5e_rq *rq); 654 654 typedef void (*mlx5e_fp_dealloc_wqe)(struct mlx5e_rq*, u16); 655 655 typedef void (*mlx5e_fp_shampo_dealloc_hd)(struct mlx5e_rq*, u16, u16, bool);
-2
drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h
··· 40 40 }; 41 41 42 42 void mlx5e_dcbnl_build_netdev(struct net_device *netdev); 43 - void mlx5e_dcbnl_build_rep_netdev(struct net_device *netdev); 44 43 void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv); 45 44 void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv); 46 45 void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv); 47 46 #else 48 47 static inline void mlx5e_dcbnl_build_netdev(struct net_device *netdev) {} 49 - static inline void mlx5e_dcbnl_build_rep_netdev(struct net_device *netdev) {} 50 48 static inline void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv) {} 51 49 static inline void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv) {} 52 50 static inline void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv) {}
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c
··· 100 100 spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS_2 | MLX5_MATCH_OUTER_HEADERS; 101 101 102 102 dr_matcher = mlx5_smfs_matcher_create(tbl, priority, spec); 103 - kfree(spec); 103 + kvfree(spec); 104 104 if (!dr_matcher) 105 105 return ERR_PTR(-EINVAL); 106 106
+1
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c
··· 93 93 94 94 act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 95 95 dest.vport.num = esw->manager_vport; 96 + dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT; 96 97 tc_psample->termtbl_rule = mlx5_add_flow_rules(tc_psample->termtbl, NULL, &act, &dest, 1); 97 98 if (IS_ERR(tc_psample->termtbl_rule)) { 98 99 err = PTR_ERR(tc_psample->termtbl_rule);
-1
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
··· 1812 1812 1813 1813 ct_flow = kzalloc(sizeof(*ct_flow), GFP_KERNEL); 1814 1814 if (!ct_flow) { 1815 - kfree(ct_flow); 1816 1815 return ERR_PTR(-ENOMEM); 1817 1816 } 1818 1817
-6
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
··· 80 80 } 81 81 82 82 struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, 83 - struct mlx5_cqe64 *cqe, 84 83 struct mlx5e_wqe_frag_info *wi, 85 84 u32 cqe_bcnt) 86 85 { ··· 97 98 xdp_set_data_meta_invalid(xdp); 98 99 xsk_buff_dma_sync_for_cpu(xdp, rq->xsk_pool); 99 100 net_prefetch(xdp->data); 100 - 101 - if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)) { 102 - rq->stats->wqe_err++; 103 - return NULL; 104 - } 105 101 106 102 prog = rcu_dereference(rq->xdp_prog); 107 103 if (likely(prog && mlx5e_xdp_handle(rq, NULL, prog, xdp)))
-1
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h
··· 15 15 u32 head_offset, 16 16 u32 page_idx); 17 17 struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, 18 - struct mlx5_cqe64 *cqe, 19 18 struct mlx5e_wqe_frag_info *wi, 20 19 u32 cqe_bcnt); 21 20
-9
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
··· 1026 1026 netdev->dcbnl_ops = &mlx5e_dcbnl_ops; 1027 1027 } 1028 1028 1029 - void mlx5e_dcbnl_build_rep_netdev(struct net_device *netdev) 1030 - { 1031 - struct mlx5e_priv *priv = netdev_priv(netdev); 1032 - struct mlx5_core_dev *mdev = priv->mdev; 1033 - 1034 - if (MLX5_CAP_GEN(mdev, qos)) 1035 - netdev->dcbnl_ops = &mlx5e_dcbnl_ops; 1036 - } 1037 - 1038 1029 static void mlx5e_dcbnl_query_dcbx_mode(struct mlx5e_priv *priv, 1039 1030 enum mlx5_dcbx_oper_mode *mode) 1040 1031 {
+8 -8
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
··· 1521 1521 } 1522 1522 1523 1523 static struct sk_buff * 1524 - mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, 1525 - struct mlx5e_wqe_frag_info *wi, u32 cqe_bcnt) 1524 + mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi, 1525 + u32 cqe_bcnt) 1526 1526 { 1527 1527 struct mlx5e_dma_info *di = wi->di; 1528 1528 u16 rx_headroom = rq->buff.headroom; ··· 1565 1565 } 1566 1566 1567 1567 static struct sk_buff * 1568 - mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, 1569 - struct mlx5e_wqe_frag_info *wi, u32 cqe_bcnt) 1568 + mlx5e_skb_from_cqe_nonlinear(struct mlx5e_rq *rq, struct mlx5e_wqe_frag_info *wi, 1569 + u32 cqe_bcnt) 1570 1570 { 1571 1571 struct mlx5e_rq_frag_info *frag_info = &rq->wqe.info.arr[0]; 1572 1572 struct mlx5e_wqe_frag_info *head_wi = wi; ··· 1709 1709 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe, 1710 1710 mlx5e_skb_from_cqe_linear, 1711 1711 mlx5e_skb_from_cqe_nonlinear, 1712 - rq, cqe, wi, cqe_bcnt); 1712 + rq, wi, cqe_bcnt); 1713 1713 if (!skb) { 1714 1714 /* probably for XDP */ 1715 1715 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) { ··· 1762 1762 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe, 1763 1763 mlx5e_skb_from_cqe_linear, 1764 1764 mlx5e_skb_from_cqe_nonlinear, 1765 - rq, cqe, wi, cqe_bcnt); 1765 + rq, wi, cqe_bcnt); 1766 1766 if (!skb) { 1767 1767 /* probably for XDP */ 1768 1768 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) { ··· 2361 2361 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe, 2362 2362 mlx5e_skb_from_cqe_linear, 2363 2363 mlx5e_skb_from_cqe_nonlinear, 2364 - rq, cqe, wi, cqe_bcnt); 2364 + rq, wi, cqe_bcnt); 2365 2365 if (!skb) 2366 2366 goto wq_free_wqe; 2367 2367 ··· 2453 2453 goto free_wqe; 2454 2454 } 2455 2455 2456 - skb = mlx5e_skb_from_cqe_nonlinear(rq, cqe, wi, cqe_bcnt); 2456 + skb = mlx5e_skb_from_cqe_nonlinear(rq, wi, cqe_bcnt); 2457 2457 if (!skb) 2458 2458 goto free_wqe; 2459 2459
+3
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 1582 1582 esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC; 1583 1583 else 1584 1584 esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; 1585 + if (MLX5_ESWITCH_MANAGER(dev) && 1586 + mlx5_esw_vport_match_metadata_supported(esw)) 1587 + esw->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA; 1585 1588 1586 1589 dev->priv.eswitch = esw; 1587 1590 BLOCKING_INIT_NOTIFIER_HEAD(&esw->n_head);
+14 -4
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c
··· 455 455 return 0; 456 456 457 457 list_for_each_entry(dst, &fte->node.children, node.list) { 458 - if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) 458 + if (dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER || 459 + dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_NONE) 459 460 continue; 460 461 if ((dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT || 461 462 dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) && ··· 572 571 int list_size = 0; 573 572 574 573 list_for_each_entry(dst, &fte->node.children, node.list) { 575 - unsigned int id, type = dst->dest_attr.type; 574 + enum mlx5_flow_destination_type type = dst->dest_attr.type; 575 + enum mlx5_ifc_flow_destination_type ifc_type; 576 + unsigned int id; 576 577 577 578 if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) 578 579 continue; 579 580 580 581 switch (type) { 582 + case MLX5_FLOW_DESTINATION_TYPE_NONE: 583 + continue; 581 584 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: 582 585 id = dst->dest_attr.ft_num; 583 - type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; 586 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; 584 587 break; 585 588 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: 586 589 id = dst->dest_attr.ft->id; 590 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; 587 591 break; 588 592 case MLX5_FLOW_DESTINATION_TYPE_UPLINK: 589 593 case MLX5_FLOW_DESTINATION_TYPE_VPORT: ··· 602 596 if (type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) { 603 597 /* destination_id is reserved */ 604 598 id = 0; 599 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK; 605 600 break; 606 601 } 602 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT; 607 603 id = dst->dest_attr.vport.num; 608 604 if (extended_dest && 609 605 dst->dest_attr.vport.pkt_reformat) { ··· 620 612 break; 621 613 case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER: 622 614 id = dst->dest_attr.sampler_id; 615 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER; 623 616 break; 624 617 default: 625 618 id = dst->dest_attr.tir_num; 619 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR; 626 620 } 627 621 628 622 MLX5_SET(dest_format_struct, in_dests, destination_type, 629 - type); 623 + ifc_type); 630 624 MLX5_SET(dest_format_struct, in_dests, destination_id, id); 631 625 in_dests += dst_cnt_size; 632 626 list_size++;
+34 -12
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
··· 424 424 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS); 425 425 } 426 426 427 + static bool is_fwd_dest_type(enum mlx5_flow_destination_type type) 428 + { 429 + return type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM || 430 + type == MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE || 431 + type == MLX5_FLOW_DESTINATION_TYPE_UPLINK || 432 + type == MLX5_FLOW_DESTINATION_TYPE_VPORT || 433 + type == MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER || 434 + type == MLX5_FLOW_DESTINATION_TYPE_TIR; 435 + } 436 + 427 437 static bool check_valid_spec(const struct mlx5_flow_spec *spec) 428 438 { 429 439 int i; ··· 560 550 mutex_unlock(&rule->dest_attr.ft->lock); 561 551 } 562 552 563 - if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER && 564 - --fte->dests_size) { 553 + if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) { 554 + --fte->dests_size; 565 555 fte->modify_mask |= 566 556 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) | 567 557 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS); ··· 569 559 goto out; 570 560 } 571 561 572 - if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT && 573 - --fte->dests_size) { 562 + if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT) { 563 + --fte->dests_size; 574 564 fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION); 575 565 fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW; 576 566 goto out; 577 567 } 578 568 579 - if ((fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) && 580 - --fte->dests_size) { 569 + if (is_fwd_dest_type(rule->dest_attr.type)) { 570 + --fte->dests_size; 571 + --fte->fwd_dests; 572 + 573 + if (!fte->fwd_dests) 574 + fte->action.action &= 575 + ~MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; 581 576 fte->modify_mask |= 582 577 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST); 578 + goto out; 583 579 } 584 580 out: 585 581 kfree(rule); ··· 605 589 fs_get_obj(ft, fg->node.parent); 606 590 607 591 trace_mlx5_fs_del_fte(fte); 592 + WARN_ON(fte->dests_size); 608 593 dev = get_dev(&ft->node); 609 594 root = find_root(&ft->node); 610 595 if (node->active) { ··· 1305 1288 rule->node.type = FS_TYPE_FLOW_DEST; 1306 1289 if (dest) 1307 1290 memcpy(&rule->dest_attr, dest, sizeof(*dest)); 1291 + else 1292 + rule->dest_attr.type = MLX5_FLOW_DESTINATION_TYPE_NONE; 1308 1293 1309 1294 return rule; 1310 1295 } ··· 1382 1363 list_add_tail(&rule->node.list, &fte->node.children); 1383 1364 if (dest) { 1384 1365 fte->dests_size++; 1366 + 1367 + if (is_fwd_dest_type(dest[i].type)) 1368 + fte->fwd_dests++; 1385 1369 1386 1370 type = dest[i].type == 1387 1371 MLX5_FLOW_DESTINATION_TYPE_COUNTER; ··· 2085 2063 down_write_ref_node(&fte->node, false); 2086 2064 for (i = handle->num_rules - 1; i >= 0; i--) 2087 2065 tree_remove_node(&handle->rule[i]->node, true); 2088 - if (fte->dests_size) { 2089 - if (fte->modify_mask) 2090 - modify_fte(fte); 2091 - up_write_ref_node(&fte->node, false); 2092 - } else if (list_empty(&fte->node.children)) { 2093 - del_hw_fte(&fte->node); 2066 + if (list_empty(&fte->node.children)) { 2067 + fte->node.del_hw_func(&fte->node); 2094 2068 /* Avoid double call to del_hw_fte */ 2095 2069 fte->node.del_hw_func = NULL; 2096 2070 up_write_ref_node(&fte->node, false); 2097 2071 tree_put_node(&fte->node, false); 2072 + } else if (fte->dests_size) { 2073 + if (fte->modify_mask) 2074 + modify_fte(fte); 2075 + up_write_ref_node(&fte->node, false); 2098 2076 } else { 2099 2077 up_write_ref_node(&fte->node, false); 2100 2078 }
+1
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h
··· 226 226 struct mlx5_fs_dr_rule fs_dr_rule; 227 227 u32 val[MLX5_ST_SZ_DW_MATCH_PARAM]; 228 228 u32 dests_size; 229 + u32 fwd_dests; 229 230 u32 index; 230 231 struct mlx5_flow_context flow_context; 231 232 struct mlx5_flow_act action;
+8 -9
drivers/net/ethernet/mellanox/mlx5/core/main.c
··· 177 177 }, 178 178 }; 179 179 180 - static int fw_initializing(struct mlx5_core_dev *dev) 181 - { 182 - return ioread32be(&dev->iseg->initializing) >> 31; 183 - } 184 - 185 180 static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili, 186 181 u32 warn_time_mili) 187 182 { 188 183 unsigned long warn = jiffies + msecs_to_jiffies(warn_time_mili); 189 184 unsigned long end = jiffies + msecs_to_jiffies(max_wait_mili); 185 + u32 fw_initializing; 190 186 int err = 0; 191 187 192 - while (fw_initializing(dev)) { 188 + do { 189 + fw_initializing = ioread32be(&dev->iseg->initializing); 190 + if (!(fw_initializing >> 31)) 191 + break; 193 192 if (time_after(jiffies, end)) { 194 193 err = -EBUSY; 195 194 break; 196 195 } 197 196 if (warn_time_mili && time_after(jiffies, warn)) { 198 - mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %ds\n", 199 - jiffies_to_msecs(end - warn) / 1000); 197 + mlx5_core_warn(dev, "Waiting for FW initialization, timeout abort in %ds (0x%x)\n", 198 + jiffies_to_msecs(end - warn) / 1000, fw_initializing); 200 199 warn = jiffies + msecs_to_jiffies(warn_time_mili); 201 200 } 202 201 msleep(mlx5_tout_ms(dev, FW_PRE_INIT_WAIT)); 203 - } 202 + } while (true); 204 203 205 204 return err; 206 205 }
+16 -5
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c
··· 311 311 312 312 in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination); 313 313 MLX5_SET(dest_format_struct, in_dests, destination_type, 314 - MLX5_FLOW_DESTINATION_TYPE_VPORT); 314 + MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT); 315 315 MLX5_SET(dest_format_struct, in_dests, destination_id, vport); 316 316 317 317 err = mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out)); ··· 604 604 if (!(fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST)) 605 605 return 0; 606 606 for (i = 0; i < fte->dests_size; i++) { 607 - if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) 607 + if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_COUNTER || 608 + fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_NONE) 608 609 continue; 609 610 if ((fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_VPORT || 610 611 fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) && ··· 720 719 int list_size = 0; 721 720 722 721 for (i = 0; i < fte->dests_size; i++) { 723 - unsigned int id, type = fte->dest_arr[i].type; 722 + enum mlx5_flow_destination_type type = fte->dest_arr[i].type; 723 + enum mlx5_ifc_flow_destination_type ifc_type; 724 + unsigned int id; 724 725 725 726 if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) 726 727 continue; 727 728 728 729 switch (type) { 730 + case MLX5_FLOW_DESTINATION_TYPE_NONE: 731 + continue; 729 732 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: 730 733 id = fte->dest_arr[i].ft_num; 731 - type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; 734 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; 732 735 break; 733 736 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: 734 737 id = fte->dest_arr[i].ft_id; 738 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; 739 + 735 740 break; 736 741 case MLX5_FLOW_DESTINATION_TYPE_UPLINK: 737 742 case MLX5_FLOW_DESTINATION_TYPE_VPORT: ··· 747 740 destination_eswitch_owner_vhca_id_valid, 748 741 !!(fte->dest_arr[i].vport.flags & 749 742 MLX5_FLOW_DEST_VPORT_VHCA_ID)); 743 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT; 750 744 } else { 751 745 id = 0; 746 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK; 752 747 MLX5_SET(dest_format_struct, in_dests, 753 748 destination_eswitch_owner_vhca_id_valid, 1); 754 749 } ··· 770 761 break; 771 762 case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER: 772 763 id = fte->dest_arr[i].sampler_id; 764 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER; 773 765 break; 774 766 default: 775 767 id = fte->dest_arr[i].tir_num; 768 + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR; 776 769 } 777 770 778 771 MLX5_SET(dest_format_struct, in_dests, destination_type, 779 - type); 772 + ifc_type); 780 773 MLX5_SET(dest_format_struct, in_dests, destination_id, id); 781 774 in_dests += dst_cnt_size; 782 775 list_size++;
+12
include/linux/mlx5/fs.h
··· 40 40 41 41 #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v) 42 42 43 + enum mlx5_flow_destination_type { 44 + MLX5_FLOW_DESTINATION_TYPE_NONE, 45 + MLX5_FLOW_DESTINATION_TYPE_VPORT, 46 + MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE, 47 + MLX5_FLOW_DESTINATION_TYPE_TIR, 48 + MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER, 49 + MLX5_FLOW_DESTINATION_TYPE_UPLINK, 50 + MLX5_FLOW_DESTINATION_TYPE_PORT, 51 + MLX5_FLOW_DESTINATION_TYPE_COUNTER, 52 + MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM, 53 + }; 54 + 43 55 enum { 44 56 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16, 45 57 MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17,
+6 -10
include/linux/mlx5/mlx5_ifc.h
··· 1806 1806 u8 reserved_at_c0[0x740]; 1807 1807 }; 1808 1808 1809 - enum mlx5_flow_destination_type { 1810 - MLX5_FLOW_DESTINATION_TYPE_VPORT = 0x0, 1811 - MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE = 0x1, 1812 - MLX5_FLOW_DESTINATION_TYPE_TIR = 0x2, 1813 - MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER = 0x6, 1814 - MLX5_FLOW_DESTINATION_TYPE_UPLINK = 0x8, 1815 - 1816 - MLX5_FLOW_DESTINATION_TYPE_PORT = 0x99, 1817 - MLX5_FLOW_DESTINATION_TYPE_COUNTER = 0x100, 1818 - MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM = 0x101, 1809 + enum mlx5_ifc_flow_destination_type { 1810 + MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT = 0x0, 1811 + MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE = 0x1, 1812 + MLX5_IFC_FLOW_DESTINATION_TYPE_TIR = 0x2, 1813 + MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER = 0x6, 1814 + MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK = 0x8, 1819 1815 }; 1820 1816 1821 1817 enum mlx5_flow_table_miss_action {