Save VHCA ID (if available) of each mlx5 port and of E-Switch Manager, and update port info cache (mlx5_flow_hw_port_infos array) used for translating DPDK port ID into HW matching value and mask, when matching on source vport.
This data will be later used to implement source vport matching without E-Switch vport metadata enabled. Signed-off-by: Dariusz Sosnowski <[email protected]> --- drivers/net/mlx5/linux/mlx5_os.c | 3 +++ drivers/net/mlx5/mlx5.h | 2 ++ drivers/net/mlx5/mlx5_flow_hw.c | 5 ++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index a717191002..3a9b019601 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -377,6 +377,7 @@ mlx5_os_capabilities_prepare(struct mlx5_dev_ctx_shared *sh) hca_attr->scatter_fcs_w_decap_disable; sh->dev_cap.rq_delay_drop_en = hca_attr->rq_delay_drop; mlx5_rt_timestamp_config(sh, hca_attr); + sh->dev_cap.esw_info.vhca_id = hca_attr->vhca_id; #ifdef HAVE_IBV_DEVICE_ATTR_ESW_MGR_REG_C0 if (dv_attr.comp_mask & MLX5DV_CONTEXT_MASK_REG_C0) { sh->dev_cap.esw_info.regc_value = dv_attr.reg_c0.value; @@ -1524,6 +1525,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, goto error; } } + if (vport_info.query_flags & MLX5_PORT_QUERY_VPORT_VHCA_ID) + priv->vport_vhca_id = vport_info.vport_vhca_id; if (vport_info.query_flags & MLX5_PORT_QUERY_VPORT) { priv->vport_id = vport_info.vport_id; } else if (spawn->pf_bond >= 0 && sh->esw_mode) { diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 4da184eb47..7ae9129e46 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -152,6 +152,7 @@ struct mlx5_flow_cb_ctx { struct flow_hw_port_info { uint32_t regc_mask; uint32_t regc_value; + uint32_t vhca_id; uint32_t is_wire:1; uint32_t direction:2; }; @@ -2003,6 +2004,7 @@ struct mlx5_priv { uint32_t jump_fdb_rx_en:1; /* Jump from FDB Tx to FDB Rx flag per port. */ uint16_t domain_id; /* Switch domain identifier. */ uint16_t vport_id; /* Associated VF vport index (if any). */ + uint16_t vport_vhca_id; /* VHCA ID of the associated vport (if any). */ uint32_t vport_meta_tag; /* Used for vport index match ove VF LAG. */ uint32_t vport_meta_mask; /* Used for vport index field match mask. */ uint16_t representor_id; /* UINT16_MAX if not a representor. */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index bca5b2769e..adbd4f33b0 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -12305,6 +12305,7 @@ mlx5_flow_hw_set_port_info(struct rte_eth_dev *dev) info = &mlx5_flow_hw_port_infos[port_id]; info->regc_mask = priv->vport_meta_mask; info->regc_value = priv->vport_meta_tag; + info->vhca_id = priv->vport_vhca_id; info->is_wire = mlx5_is_port_on_mpesw_device(priv) ? priv->mpesw_uplink : priv->master; } @@ -12317,9 +12318,7 @@ mlx5_flow_hw_clear_port_info(struct rte_eth_dev *dev) MLX5_ASSERT(port_id < RTE_MAX_ETHPORTS); info = &mlx5_flow_hw_port_infos[port_id]; - info->regc_mask = 0; - info->regc_value = 0; - info->is_wire = 0; + memset(info, 0, sizeof(*info)); } static int -- 2.47.3

