History

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 ====================

Paolo Abeni committed 4 years ago

Commit 2b68abf2 parents f4f1fd7 3a09fae19 files · +109 −90Browse files

Unified · Split

19 files
  1. drivers/net/ethernet/mellanox/mlx5/core/devlink.c +0 −20
  2. drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c +3 −0
  3. drivers/net/ethernet/mellanox/mlx5/core/en.h +2 −2
  4. drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h +0 −2
  5. drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c +1 −1
  6. drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c +1 −0
  7. drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +0 −1
  8. drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c +0 −6
  9. drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h +0 −1
  10. drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c +0 −9
  11. drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +8 −8
  12. drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +3 −0
  13. drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c +14 −4
  14. drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +34 −12
  15. drivers/net/ethernet/mellanox/mlx5/core/fs_core.h +1 −0
  16. drivers/net/ethernet/mellanox/mlx5/core/main.c +8 −9
  17. drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +16 −5
  18. include/linux/mlx5/fs.h +12 −0
  19. include/linux/mlx5/mlx5_ifc.h +6 −10
drivers/net/ethernet/mellanox/mlx5/core/devlink.c+0−20
@@ -584,14 +584,6 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) · 583 unmodified lines
584584 struct mlx5_core_dev *dev = devlink_priv(devlink);
585585 union devlink_param_value value;
586586
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−
595587 value.vbool = MLX5_CAP_GEN(dev, roce);
596588 devlink_param_driverinit_value_set(devlink,
597589 DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
@@ -602,18 +594,6 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) · 4 unmodified lines
602594 devlink_param_driverinit_value_set(devlink,
603595 MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM,
604596 value);
605−
606− if (MLX5_ESWITCH_MANAGER(dev)) {
607− if (mlx5_esw_vport_match_metadata_supported(dev->priv.eswitch)) {
608− dev->priv.eswitch->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA;
609− value.vbool = true;
610− } else {
611− value.vbool = false;
612− }
613− devlink_param_driverinit_value_set(devlink,
614− MLX5_DEVLINK_PARAM_ID_ESW_PORT_METADATA,
615− value);
616− }
617597 #endif
618598
619599 value.vu32 = MLX5_COMP_EQ_SIZE;
drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.c+3−0
@@ -259,6 +259,9 @@ const char *parse_fs_dst(struct trace_seq *p, · 258 unmodified lines
259259 case MLX5_FLOW_DESTINATION_TYPE_PORT:
260260 trace_seq_printf(p, "port\n");
261261 break;
262+ case MLX5_FLOW_DESTINATION_TYPE_NONE:
263+ trace_seq_printf(p, "none\n");
264+ break;
262265 }
263266
264267 trace_seq_putc(p, 0);
drivers/net/ethernet/mellanox/mlx5/core/en.h+2−2
@@ -648,8 +648,8 @@ typedef struct sk_buff * · 647 unmodified lines
648648 (*mlx5e_fp_skb_from_cqe_mpwrq)(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
649649 u16 cqe_bcnt, u32 head_offset, u32 page_idx);
650650 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);
653653 typedef bool (*mlx5e_fp_post_rx_wqes)(struct mlx5e_rq *rq);
654654 typedef void (*mlx5e_fp_dealloc_wqe)(struct mlx5e_rq*, u16);
655655 typedef void (*mlx5e_fp_shampo_dealloc_hd)(struct mlx5e_rq*, u16, u16, bool);
drivers/net/ethernet/mellanox/mlx5/core/en/dcbnl.h+0−2
@@ -40,13 +40,11 @@ struct mlx5e_dcbx_dp { · 39 unmodified lines
4040 };
4141
4242 void mlx5e_dcbnl_build_netdev(struct net_device *netdev);
43−void mlx5e_dcbnl_build_rep_netdev(struct net_device *netdev);
4443 void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv);
4544 void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv);
4645 void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv);
4746 #else
4847 static inline void mlx5e_dcbnl_build_netdev(struct net_device *netdev) {}
49−static inline void mlx5e_dcbnl_build_rep_netdev(struct net_device *netdev) {}
5048 static inline void mlx5e_dcbnl_initialize(struct mlx5e_priv *priv) {}
5149 static inline void mlx5e_dcbnl_init_app(struct mlx5e_priv *priv) {}
5250 static inline void mlx5e_dcbnl_delete_app(struct mlx5e_priv *priv) {}
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c+1−1
@@ -100,7 +100,7 @@ mlx5_ct_fs_smfs_matcher_create(struct mlx5_ct_fs *fs, struct mlx5dr_table *tbl, · 99 unmodified lines
100100 spec->match_criteria_enable = MLX5_MATCH_MISC_PARAMETERS_2 | MLX5_MATCH_OUTER_HEADERS;
101101
102102 dr_matcher = mlx5_smfs_matcher_create(tbl, priority, spec);
103− kfree(spec);
103+ kvfree(spec);
104104 if (!dr_matcher)
105105 return ERR_PTR(-EINVAL);
106106
drivers/net/ethernet/mellanox/mlx5/core/en/tc/sample.c+1−0
@@ -93,6 +93,7 @@ sampler_termtbl_create(struct mlx5e_tc_psample *tc_psample) · 92 unmodified lines
9393
9494 act.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
9595 dest.vport.num = esw->manager_vport;
96+ dest.type = MLX5_FLOW_DESTINATION_TYPE_VPORT;
9697 tc_psample->termtbl_rule = mlx5_add_flow_rules(tc_psample->termtbl, NULL, &act, &dest, 1);
9798 if (IS_ERR(tc_psample->termtbl_rule)) {
9899 err = PTR_ERR(tc_psample->termtbl_rule);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c+0−1
@@ -1812,7 +1812,6 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv, · 1811 unmodified lines
18121812
18131813 ct_flow = kzalloc(sizeof(*ct_flow), GFP_KERNEL);
18141814 if (!ct_flow) {
1815− kfree(ct_flow);
18161815 return ERR_PTR(-ENOMEM);
18171816 }
18181817
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c+0−6
@@ -80,7 +80,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 79 unmodified lines
8080 }
8181
8282 struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
83− struct mlx5_cqe64 *cqe,
8483 struct mlx5e_wqe_frag_info *wi,
8584 u32 cqe_bcnt)
8685 {
@@ -99,11 +98,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 12 unmodified lines
9998 xsk_buff_dma_sync_for_cpu(xdp, rq->xsk_pool);
10099 net_prefetch(xdp->data);
101100
102− if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)) {
103− rq->stats->wqe_err++;
104− return NULL;
105− }
106−
107101 prog = rcu_dereference(rq->xdp_prog);
108102 if (likely(prog && mlx5e_xdp_handle(rq, NULL, prog, xdp)))
109103 return NULL; /* page/packet was consumed by XDP */
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h+0−1
@@ -15,7 +15,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 14 unmodified lines
1515 u32 head_offset,
1616 u32 page_idx);
1717 struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
18− struct mlx5_cqe64 *cqe,
1918 struct mlx5e_wqe_frag_info *wi,
2019 u32 cqe_bcnt);
2120
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c+0−9
@@ -1026,15 +1026,6 @@ void mlx5e_dcbnl_build_netdev(struct net_device *netdev) · 1025 unmodified lines
10261026 netdev->dcbnl_ops = &mlx5e_dcbnl_ops;
10271027 }
10281028
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−
10381029 static void mlx5e_dcbnl_query_dcbx_mode(struct mlx5e_priv *priv,
10391030 enum mlx5_dcbx_oper_mode *mode)
10401031 {
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c+8−8
@@ -1521,8 +1521,8 @@ static void mlx5e_fill_xdp_buff(struct mlx5e_rq *rq, void *va, u16 headroom, · 1520 unmodified lines
15211521 }
15221522
15231523 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)
15261526 {
15271527 struct mlx5e_dma_info *di = wi->di;
15281528 u16 rx_headroom = rq->buff.headroom;
@@ -1565,8 +1565,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 36 unmodified lines
15651565 }
15661566
15671567 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)
15701570 {
15711571 struct mlx5e_rq_frag_info *frag_info = &rq->wqe.info.arr[0];
15721572 struct mlx5e_wqe_frag_info *head_wi = wi;
@@ -1709,7 +1709,7 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 136 unmodified lines
17091709 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe,
17101710 mlx5e_skb_from_cqe_linear,
17111711 mlx5e_skb_from_cqe_nonlinear,
1712− rq, cqe, wi, cqe_bcnt);
1712+ rq, wi, cqe_bcnt);
17131713 if (!skb) {
17141714 /* probably for XDP */
17151715 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) {
@@ -1762,7 +1762,7 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 46 unmodified lines
17621762 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe,
17631763 mlx5e_skb_from_cqe_linear,
17641764 mlx5e_skb_from_cqe_nonlinear,
1765− rq, cqe, wi, cqe_bcnt);
1765+ rq, wi, cqe_bcnt);
17661766 if (!skb) {
17671767 /* probably for XDP */
17681768 if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)) {
@@ -2361,7 +2361,7 @@ static void mlx5i_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 592 unmodified lines
23612361 skb = INDIRECT_CALL_2(rq->wqe.skb_from_cqe,
23622362 mlx5e_skb_from_cqe_linear,
23632363 mlx5e_skb_from_cqe_nonlinear,
2364− rq, cqe, wi, cqe_bcnt);
2364+ rq, wi, cqe_bcnt);
23652365 if (!skb)
23662366 goto wq_free_wqe;
23672367
@@ -2453,7 +2453,7 @@ static void mlx5e_trap_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe · 85 unmodified lines
24532453 goto free_wqe;
24542454 }
24552455
2456− skb = mlx5e_skb_from_cqe_nonlinear(rq, cqe, wi, cqe_bcnt);
2456+ skb = mlx5e_skb_from_cqe_nonlinear(rq, wi, cqe_bcnt);
24572457 if (!skb)
24582458 goto free_wqe;
24592459
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c+3−0
@@ -1582,6 +1582,9 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) · 1581 unmodified lines
15821582 esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_BASIC;
15831583 else
15841584 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;
15851588
15861589 dev->priv.eswitch = esw;
15871590 BLOCKING_INIT_NOTIFIER_HEAD(&esw->n_head);
drivers/net/ethernet/mellanox/mlx5/core/fs_cmd.c+14−4
@@ -455,7 +455,8 @@ static int mlx5_set_extended_dest(struct mlx5_core_dev *dev, · 454 unmodified lines
455455 return 0;
456456
457457 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)
459460 continue;
460461 if ((dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
461462 dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
@@ -571,18 +572,23 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 109 unmodified lines
571572 int list_size = 0;
572573
573574 list_for_each_entry(dst, &fte->node.children, node.list) {
574− unsigned int id, type = dst->dest_attr.type;
575+ enum mlx5_flow_destination_type type = dst->dest_attr.type;
576+ enum mlx5_ifc_flow_destination_type ifc_type;
577+ unsigned int id;
575578
576579 if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
577580 continue;
578581
579582 switch (type) {
583+ case MLX5_FLOW_DESTINATION_TYPE_NONE:
584+ continue;
580585 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
581586 id = dst->dest_attr.ft_num;
582− type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
587+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE;
583588 break;
584589 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
585590 id = dst->dest_attr.ft->id;
591+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE;
586592 break;
587593 case MLX5_FLOW_DESTINATION_TYPE_UPLINK:
588594 case MLX5_FLOW_DESTINATION_TYPE_VPORT:
@@ -596,8 +602,10 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 7 unmodified lines
596602 if (type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) {
597603 /* destination_id is reserved */
598604 id = 0;
605+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK;
599606 break;
600607 }
608+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT;
601609 id = dst->dest_attr.vport.num;
602610 if (extended_dest &&
603611 dst->dest_attr.vport.pkt_reformat) {
@@ -612,13 +620,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 8 unmodified lines
612620 break;
613621 case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER:
614622 id = dst->dest_attr.sampler_id;
623+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER;
615624 break;
616625 default:
617626 id = dst->dest_attr.tir_num;
627+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR;
618628 }
619629
620630 MLX5_SET(dest_format_struct, in_dests, destination_type,
621− type);
631+ ifc_type);
622632 MLX5_SET(dest_format_struct, in_dests, destination_id, id);
623633 in_dests += dst_cnt_size;
624634 list_size++;
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c+34−12
@@ -424,6 +424,16 @@ static bool is_fwd_next_action(u32 action) · 423 unmodified lines
424424 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS);
425425 }
426426
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+
427437 static bool check_valid_spec(const struct mlx5_flow_spec *spec)
428438 {
429439 int i;
@@ -550,8 +560,8 @@ static void del_sw_hw_rule(struct fs_node *node) · 120 unmodified lines
550560 mutex_unlock(&rule->dest_attr.ft->lock);
551561 }
552562
553− if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER &&
554− --fte->dests_size) {
563+ if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) {
564+ --fte->dests_size;
555565 fte->modify_mask |=
556566 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) |
557567 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_FLOW_COUNTERS);
@@ -559,17 +569,23 @@ static void del_sw_hw_rule(struct fs_node *node) · 1 unmodified line
559569 goto out;
560570 }
561571
562− if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT &&
563− --fte->dests_size) {
572+ if (rule->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_PORT) {
573+ --fte->dests_size;
564574 fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION);
565575 fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW;
566576 goto out;
567577 }
568578
569− if ((fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) &&
570− --fte->dests_size) {
579+ if (is_fwd_dest_type(rule->dest_attr.type)) {
580+ --fte->dests_size;
581+ --fte->fwd_dests;
582+
583+ if (!fte->fwd_dests)
584+ fte->action.action &=
585+ ~MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
571586 fte->modify_mask |=
572587 BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST);
588+ goto out;
573589 }
574590 out:
575591 kfree(rule);
@@ -589,6 +605,7 @@ static void del_hw_fte(struct fs_node *node) · 13 unmodified lines
589605 fs_get_obj(ft, fg->node.parent);
590606
591607 trace_mlx5_fs_del_fte(fte);
608+ WARN_ON(fte->dests_size);
592609 dev = get_dev(&ft->node);
593610 root = find_root(&ft->node);
594611 if (node->active) {
@@ -1288,6 +1305,8 @@ static struct mlx5_flow_rule *alloc_rule(struct mlx5_flow_destination *dest) · 693 unmodified lines
12881305 rule->node.type = FS_TYPE_FLOW_DEST;
12891306 if (dest)
12901307 memcpy(&rule->dest_attr, dest, sizeof(*dest));
1308+ else
1309+ rule->dest_attr.type = MLX5_FLOW_DESTINATION_TYPE_NONE;
12911310
12921311 return rule;
12931312 }
@@ -1364,6 +1383,9 @@ create_flow_handle(struct fs_fte *fte, · 70 unmodified lines
13641383 if (dest) {
13651384 fte->dests_size++;
13661385
1386+ if (is_fwd_dest_type(dest[i].type))
1387+ fte->fwd_dests++;
1388+
13671389 type = dest[i].type ==
13681390 MLX5_FLOW_DESTINATION_TYPE_COUNTER;
13691391 *modify_mask |= type ? count : dst;
@@ -2063,16 +2085,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 693 unmodified lines
20632085 down_write_ref_node(&fte->node, false);
20642086 for (i = handle->num_rules - 1; i >= 0; i--)
20652087 tree_remove_node(&handle->rule[i]->node, true);
2066− if (fte->dests_size) {
2067− if (fte->modify_mask)
2068− modify_fte(fte);
2069− up_write_ref_node(&fte->node, false);
2070− } else if (list_empty(&fte->node.children)) {
2071− del_hw_fte(&fte->node);
2088+ if (list_empty(&fte->node.children)) {
2089+ fte->node.del_hw_func(&fte->node);
20722090 /* Avoid double call to del_hw_fte */
20732091 fte->node.del_hw_func = NULL;
20742092 up_write_ref_node(&fte->node, false);
20752093 tree_put_node(&fte->node, false);
2094+ } else if (fte->dests_size) {
2095+ if (fte->modify_mask)
2096+ modify_fte(fte);
2097+ up_write_ref_node(&fte->node, false);
20762098 } else {
20772099 up_write_ref_node(&fte->node, false);
20782100 }
drivers/net/ethernet/mellanox/mlx5/core/fs_core.h+1−0
@@ -226,6 +226,7 @@ struct fs_fte { · 225 unmodified lines
226226 struct mlx5_fs_dr_rule fs_dr_rule;
227227 u32 val[MLX5_ST_SZ_DW_MATCH_PARAM];
228228 u32 dests_size;
229+ u32 fwd_dests;
229230 u32 index;
230231 struct mlx5_flow_context flow_context;
231232 struct mlx5_flow_act action;
drivers/net/ethernet/mellanox/mlx5/core/main.c+8−9
@@ -177,30 +177,29 @@ static struct mlx5_profile profile[] = { · 176 unmodified lines
177177 },
178178 };
179179
180−static int fw_initializing(struct mlx5_core_dev *dev)
181−{
182− return ioread32be(&dev->iseg->initializing) >> 31;
183−}
184−
185180 static int wait_fw_init(struct mlx5_core_dev *dev, u32 max_wait_mili,
186181 u32 warn_time_mili)
187182 {
188183 unsigned long warn = jiffies + msecs_to_jiffies(warn_time_mili);
189184 unsigned long end = jiffies + msecs_to_jiffies(max_wait_mili);
185+ u32 fw_initializing;
190186 int err = 0;
191187
192− while (fw_initializing(dev)) {
188+ do {
189+ fw_initializing = ioread32be(&dev->iseg->initializing);
190+ if (!(fw_initializing >> 31))
191+ break;
193192 if (time_after(jiffies, end)) {
194193 err = -EBUSY;
195194 break;
196195 }
197196 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);
200199 warn = jiffies + msecs_to_jiffies(warn_time_mili);
201200 }
202201 msleep(mlx5_tout_ms(dev, FW_PRE_INIT_WAIT));
203− }
202+ } while (true);
204203
205204 return err;
206205 }
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c+16−5
@@ -311,7 +311,7 @@ int mlx5dr_cmd_set_fte_modify_and_vport(struct mlx5_core_dev *mdev, · 310 unmodified lines
311311
312312 in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination);
313313 MLX5_SET(dest_format_struct, in_dests, destination_type,
314− MLX5_FLOW_DESTINATION_TYPE_VPORT);
314+ MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT);
315315 MLX5_SET(dest_format_struct, in_dests, destination_id, vport);
316316
317317 err = mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out));
@@ -604,7 +604,8 @@ static int mlx5dr_cmd_set_extended_dest(struct mlx5_core_dev *dev, · 286 unmodified lines
604604 if (!(fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST))
605605 return 0;
606606 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)
608609 continue;
609610 if ((fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_VPORT ||
610611 fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) &&
@@ -719,18 +720,24 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 108 unmodified lines
719720 int list_size = 0;
720721
721722 for (i = 0; i < fte->dests_size; i++) {
722− unsigned int id, type = fte->dest_arr[i].type;
723+ enum mlx5_flow_destination_type type = fte->dest_arr[i].type;
724+ enum mlx5_ifc_flow_destination_type ifc_type;
725+ unsigned int id;
723726
724727 if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER)
725728 continue;
726729
727730 switch (type) {
731+ case MLX5_FLOW_DESTINATION_TYPE_NONE:
732+ continue;
728733 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM:
729734 id = fte->dest_arr[i].ft_num;
730− type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
735+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE;
731736 break;
732737 case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE:
733738 id = fte->dest_arr[i].ft_id;
739+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE;
740+
734741 break;
735742 case MLX5_FLOW_DESTINATION_TYPE_UPLINK:
736743 case MLX5_FLOW_DESTINATION_TYPE_VPORT:
@@ -740,8 +747,10 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 3 unmodified lines
740747 destination_eswitch_owner_vhca_id_valid,
741748 !!(fte->dest_arr[i].vport.flags &
742749 MLX5_FLOW_DEST_VPORT_VHCA_ID));
750+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT;
743751 } else {
744752 id = 0;
753+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK;
745754 MLX5_SET(dest_format_struct, in_dests,
746755 destination_eswitch_owner_vhca_id_valid, 1);
747756 }
@@ -761,13 +770,15 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 13 unmodified lines
761770 break;
762771 case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER:
763772 id = fte->dest_arr[i].sampler_id;
773+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER;
764774 break;
765775 default:
766776 id = fte->dest_arr[i].tir_num;
777+ ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR;
767778 }
768779
769780 MLX5_SET(dest_format_struct, in_dests, destination_type,
770− type);
781+ ifc_type);
771782 MLX5_SET(dest_format_struct, in_dests, destination_id, id);
772783 in_dests += dst_cnt_size;
773784 list_size++;
include/linux/mlx5/fs.h+12−0
@@ -40,6 +40,18 @@ · 39 unmodified lines
4040
4141 #define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
4242
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+
4355 enum {
4456 MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16,
4557 MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17,
include/linux/mlx5/mlx5_ifc.h+6−10
@@ -1806,16 +1806,12 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { · 1805 unmodified lines
18061806 u8 reserved_at_c0[0x740];
18071807 };
18081808
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,
18191815 };
18201816
18211817 enum mlx5_flow_table_miss_action {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t