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 ====================
Unified · Split
| @@ -584,14 +584,6 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) · 583 unmodified lines | ||
| 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, |
| @@ -602,18 +594,6 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink) · 4 unmodified lines | ||
| 602 | 594 | devlink_param_driverinit_value_set(devlink, |
| 603 | 595 | MLX5_DEVLINK_PARAM_ID_ESW_LARGE_GROUP_NUM, |
| 604 | 596 | 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 | − } | |
| 617 | 597 | #endif |
| 618 | 598 | |
| 619 | 599 | value.vu32 = MLX5_COMP_EQ_SIZE; |
| @@ -259,6 +259,9 @@ const char *parse_fs_dst(struct trace_seq *p, · 258 unmodified lines | ||
| 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); |
| @@ -648,8 +648,8 @@ typedef struct sk_buff * · 647 unmodified lines | ||
| 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); |
| @@ -40,13 +40,11 @@ struct mlx5e_dcbx_dp { · 39 unmodified lines | ||
| 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) {} |
| @@ -100,7 +100,7 @@ mlx5_ct_fs_smfs_matcher_create(struct mlx5_ct_fs *fs, struct mlx5dr_table *tbl, · 99 unmodified lines | ||
| 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 | |
| @@ -93,6 +93,7 @@ sampler_termtbl_create(struct mlx5e_tc_psample *tc_psample) · 92 unmodified lines | ||
| 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); |
| @@ -1812,7 +1812,6 @@ __mlx5_tc_ct_flow_offload(struct mlx5_tc_ct_priv *ct_priv, · 1811 unmodified lines | ||
| 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 | |
| @@ -80,7 +80,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 79 unmodified lines | ||
| 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 | { |
| @@ -99,11 +98,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq, · 12 unmodified lines | ||
| 99 | 98 | xsk_buff_dma_sync_for_cpu(xdp, rq->xsk_pool); |
| 100 | 99 | net_prefetch(xdp->data); |
| 101 | 100 | |
| 102 | − if (unlikely(get_cqe_opcode(cqe) != MLX5_CQE_RESP_SEND)) { | |
| 103 | − rq->stats->wqe_err++; | |
| 104 | − return NULL; | |
| 105 | − } | |
| 106 | − | |
| 107 | 101 | prog = rcu_dereference(rq->xdp_prog); |
| 108 | 102 | if (likely(prog && mlx5e_xdp_handle(rq, NULL, prog, xdp))) |
| 109 | 103 | return NULL; /* page/packet was consumed by XDP */ |
| @@ -15,7 +15,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, · 14 unmodified lines | ||
| 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 | |
| @@ -1026,15 +1026,6 @@ void mlx5e_dcbnl_build_netdev(struct net_device *netdev) · 1025 unmodified lines | ||
| 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 | { |
| @@ -1521,8 +1521,8 @@ static void mlx5e_fill_xdp_buff(struct mlx5e_rq *rq, void *va, u16 headroom, · 1520 unmodified lines | ||
| 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,8 +1565,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, · 36 unmodified lines | ||
| 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,7 +1709,7 @@ static void mlx5e_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 136 unmodified lines | ||
| 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,7 +1762,7 @@ static void mlx5e_handle_rx_cqe_rep(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 46 unmodified lines | ||
| 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,7 +2361,7 @@ static void mlx5i_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe) · 592 unmodified lines | ||
| 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,7 +2453,7 @@ static void mlx5e_trap_handle_rx_cqe(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe · 85 unmodified lines | ||
| 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 | |
| @@ -1582,6 +1582,9 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) · 1581 unmodified lines | ||
| 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); |
| @@ -455,7 +455,8 @@ static int mlx5_set_extended_dest(struct mlx5_core_dev *dev, · 454 unmodified lines | ||
| 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) && |
| @@ -571,18 +572,23 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 109 unmodified lines | ||
| 571 | 572 | int list_size = 0; |
| 572 | 573 | |
| 573 | 574 | 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; | |
| 575 | 578 | |
| 576 | 579 | if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) |
| 577 | 580 | continue; |
| 578 | 581 | |
| 579 | 582 | switch (type) { |
| 583 | + case MLX5_FLOW_DESTINATION_TYPE_NONE: | |
| 584 | + continue; | |
| 580 | 585 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: |
| 581 | 586 | id = dst->dest_attr.ft_num; |
| 582 | − type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; | |
| 587 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; | |
| 583 | 588 | break; |
| 584 | 589 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: |
| 585 | 590 | id = dst->dest_attr.ft->id; |
| 591 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; | |
| 586 | 592 | break; |
| 587 | 593 | case MLX5_FLOW_DESTINATION_TYPE_UPLINK: |
| 588 | 594 | case MLX5_FLOW_DESTINATION_TYPE_VPORT: |
| @@ -596,8 +602,10 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 7 unmodified lines | ||
| 596 | 602 | if (type == MLX5_FLOW_DESTINATION_TYPE_UPLINK) { |
| 597 | 603 | /* destination_id is reserved */ |
| 598 | 604 | id = 0; |
| 605 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK; | |
| 599 | 606 | break; |
| 600 | 607 | } |
| 608 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT; | |
| 601 | 609 | id = dst->dest_attr.vport.num; |
| 602 | 610 | if (extended_dest && |
| 603 | 611 | dst->dest_attr.vport.pkt_reformat) { |
| @@ -612,13 +620,15 @@ static int mlx5_cmd_set_fte(struct mlx5_core_dev *dev, · 8 unmodified lines | ||
| 612 | 620 | break; |
| 613 | 621 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER: |
| 614 | 622 | id = dst->dest_attr.sampler_id; |
| 623 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER; | |
| 615 | 624 | break; |
| 616 | 625 | default: |
| 617 | 626 | id = dst->dest_attr.tir_num; |
| 627 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR; | |
| 618 | 628 | } |
| 619 | 629 | |
| 620 | 630 | MLX5_SET(dest_format_struct, in_dests, destination_type, |
| 621 | − type); | |
| 631 | + ifc_type); | |
| 622 | 632 | MLX5_SET(dest_format_struct, in_dests, destination_id, id); |
| 623 | 633 | in_dests += dst_cnt_size; |
| 624 | 634 | list_size++; |
| @@ -424,6 +424,16 @@ static bool is_fwd_next_action(u32 action) · 423 unmodified lines | ||
| 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; |
| @@ -550,8 +560,8 @@ static void del_sw_hw_rule(struct fs_node *node) · 120 unmodified lines | ||
| 550 | 560 | mutex_unlock(&rule->dest_attr.ft->lock); |
| 551 | 561 | } |
| 552 | 562 | |
| 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; | |
| 555 | 565 | fte->modify_mask |= |
| 556 | 566 | BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION) | |
| 557 | 567 | 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 | ||
| 559 | 569 | goto out; |
| 560 | 570 | } |
| 561 | 571 | |
| 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; | |
| 564 | 574 | fte->modify_mask |= BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_ACTION); |
| 565 | 575 | fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_ALLOW; |
| 566 | 576 | goto out; |
| 567 | 577 | } |
| 568 | 578 | |
| 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; | |
| 571 | 586 | fte->modify_mask |= |
| 572 | 587 | BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST); |
| 588 | + goto out; | |
| 573 | 589 | } |
| 574 | 590 | out: |
| 575 | 591 | kfree(rule); |
| @@ -589,6 +605,7 @@ static void del_hw_fte(struct fs_node *node) · 13 unmodified lines | ||
| 589 | 605 | fs_get_obj(ft, fg->node.parent); |
| 590 | 606 | |
| 591 | 607 | trace_mlx5_fs_del_fte(fte); |
| 608 | + WARN_ON(fte->dests_size); | |
| 592 | 609 | dev = get_dev(&ft->node); |
| 593 | 610 | root = find_root(&ft->node); |
| 594 | 611 | if (node->active) { |
| @@ -1288,6 +1305,8 @@ static struct mlx5_flow_rule *alloc_rule(struct mlx5_flow_destination *dest) · 693 unmodified lines | ||
| 1288 | 1305 | rule->node.type = FS_TYPE_FLOW_DEST; |
| 1289 | 1306 | if (dest) |
| 1290 | 1307 | memcpy(&rule->dest_attr, dest, sizeof(*dest)); |
| 1308 | + else | |
| 1309 | + rule->dest_attr.type = MLX5_FLOW_DESTINATION_TYPE_NONE; | |
| 1291 | 1310 | |
| 1292 | 1311 | return rule; |
| 1293 | 1312 | } |
| @@ -1364,6 +1383,9 @@ create_flow_handle(struct fs_fte *fte, · 70 unmodified lines | ||
| 1364 | 1383 | if (dest) { |
| 1365 | 1384 | fte->dests_size++; |
| 1366 | 1385 | |
| 1386 | + if (is_fwd_dest_type(dest[i].type)) | |
| 1387 | + fte->fwd_dests++; | |
| 1388 | + | |
| 1367 | 1389 | type = dest[i].type == |
| 1368 | 1390 | MLX5_FLOW_DESTINATION_TYPE_COUNTER; |
| 1369 | 1391 | *modify_mask |= type ? count : dst; |
| @@ -2063,16 +2085,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) · 693 unmodified lines | ||
| 2063 | 2085 | down_write_ref_node(&fte->node, false); |
| 2064 | 2086 | for (i = handle->num_rules - 1; i >= 0; i--) |
| 2065 | 2087 | 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); | |
| 2072 | 2090 | /* Avoid double call to del_hw_fte */ |
| 2073 | 2091 | fte->node.del_hw_func = NULL; |
| 2074 | 2092 | up_write_ref_node(&fte->node, false); |
| 2075 | 2093 | 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); | |
| 2076 | 2098 | } else { |
| 2077 | 2099 | up_write_ref_node(&fte->node, false); |
| 2078 | 2100 | } |
| @@ -226,6 +226,7 @@ struct fs_fte { · 225 unmodified lines | ||
| 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; |
| @@ -177,30 +177,29 @@ static struct mlx5_profile profile[] = { · 176 unmodified lines | ||
| 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 | } |
| @@ -311,7 +311,7 @@ int mlx5dr_cmd_set_fte_modify_and_vport(struct mlx5_core_dev *mdev, · 310 unmodified lines | ||
| 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,7 +604,8 @@ static int mlx5dr_cmd_set_extended_dest(struct mlx5_core_dev *dev, · 286 unmodified lines | ||
| 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) && |
| @@ -719,18 +720,24 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 108 unmodified lines | ||
| 719 | 720 | int list_size = 0; |
| 720 | 721 | |
| 721 | 722 | 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; | |
| 723 | 726 | |
| 724 | 727 | if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) |
| 725 | 728 | continue; |
| 726 | 729 | |
| 727 | 730 | switch (type) { |
| 731 | + case MLX5_FLOW_DESTINATION_TYPE_NONE: | |
| 732 | + continue; | |
| 728 | 733 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: |
| 729 | 734 | 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; | |
| 731 | 736 | break; |
| 732 | 737 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: |
| 733 | 738 | id = fte->dest_arr[i].ft_id; |
| 739 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_TABLE; | |
| 740 | + | |
| 734 | 741 | break; |
| 735 | 742 | case MLX5_FLOW_DESTINATION_TYPE_UPLINK: |
| 736 | 743 | case MLX5_FLOW_DESTINATION_TYPE_VPORT: |
| @@ -740,8 +747,10 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 3 unmodified lines | ||
| 740 | 747 | destination_eswitch_owner_vhca_id_valid, |
| 741 | 748 | !!(fte->dest_arr[i].vport.flags & |
| 742 | 749 | MLX5_FLOW_DEST_VPORT_VHCA_ID)); |
| 750 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_VPORT; | |
| 743 | 751 | } else { |
| 744 | 752 | id = 0; |
| 753 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_UPLINK; | |
| 745 | 754 | MLX5_SET(dest_format_struct, in_dests, |
| 746 | 755 | destination_eswitch_owner_vhca_id_valid, 1); |
| 747 | 756 | } |
| @@ -761,13 +770,15 @@ int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, · 13 unmodified lines | ||
| 761 | 770 | break; |
| 762 | 771 | case MLX5_FLOW_DESTINATION_TYPE_FLOW_SAMPLER: |
| 763 | 772 | id = fte->dest_arr[i].sampler_id; |
| 773 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_FLOW_SAMPLER; | |
| 764 | 774 | break; |
| 765 | 775 | default: |
| 766 | 776 | id = fte->dest_arr[i].tir_num; |
| 777 | + ifc_type = MLX5_IFC_FLOW_DESTINATION_TYPE_TIR; | |
| 767 | 778 | } |
| 768 | 779 | |
| 769 | 780 | MLX5_SET(dest_format_struct, in_dests, destination_type, |
| 770 | − type); | |
| 781 | + ifc_type); | |
| 771 | 782 | MLX5_SET(dest_format_struct, in_dests, destination_id, id); |
| 772 | 783 | in_dests += dst_cnt_size; |
| 773 | 784 | list_size++; |
| @@ -40,6 +40,18 @@ · 39 unmodified lines | ||
| 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, |
| @@ -1806,16 +1806,12 @@ struct mlx5_ifc_cmd_hca_cap_2_bits { · 1805 unmodified lines | ||
| 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 { |