From: Sriharsha Basavapatna Date: Fri, 11 Sep 2020 01:55:59 +0000 (-0700) Subject: net/bnxt: provide switch info if VFR are configured X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9b842a93e21afb16226577c8bb2a7a5bca60c2e0;p=dpdk.git net/bnxt: provide switch info if VFR are configured Some applications need switch_info of the device to be returned as a part of eth_dev_info_get(). The offload logic in such applications could use this info. Pass this info to the when VF representors are configured. Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure") Cc: stable@dpdk.org Signed-off-by: Sriharsha Basavapatna Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 2a106fe7aa..7c27e2435a 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -908,6 +908,14 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->tx_desc_lim.nb_min = BNXT_MIN_RING_DESC; dev_info->tx_desc_lim.nb_max = BNXT_MAX_TX_RING_DESC; + if (BNXT_PF(bp) || BNXT_VF_IS_TRUSTED(bp)) { + dev_info->switch_info.name = eth_dev->device->name; + dev_info->switch_info.domain_id = bp->switch_domain_id; + dev_info->switch_info.port_id = + BNXT_PF(bp) ? BNXT_SWITCH_PORT_ID_PF : + BNXT_SWITCH_PORT_ID_TRUSTED_VF; + } + /* *INDENT-ON* */ /* diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index ef5bd06655..7350c09676 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -500,6 +500,11 @@ int bnxt_vf_rep_dev_info_get_op(struct rte_eth_dev *eth_dev, dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT; dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT; + dev_info->switch_info.name = eth_dev->device->name; + dev_info->switch_info.domain_id = rep_bp->switch_domain_id; + dev_info->switch_info.port_id = + rep_bp->vf_id & BNXT_SWITCH_PORT_ID_VF_MASK; + return 0; } diff --git a/drivers/net/bnxt/bnxt_reps.h b/drivers/net/bnxt/bnxt_reps.h index d877b08231..3239e03fc0 100644 --- a/drivers/net/bnxt/bnxt_reps.h +++ b/drivers/net/bnxt/bnxt_reps.h @@ -12,6 +12,13 @@ #define BNXT_MAX_CFA_CODE 65536 #define BNXT_VF_IDX_INVALID 0xffff +/* Switchdev Port ID Mapping (Per switch domain id). + * Lower 15 bits map the VFs (VF_ID). Upper bit maps the PF. + */ +#define BNXT_SWITCH_PORT_ID_PF 0x8000 +#define BNXT_SWITCH_PORT_ID_TRUSTED_VF 0x0 +#define BNXT_SWITCH_PORT_ID_VF_MASK 0x7FFF + uint16_t bnxt_vfr_recv(uint16_t port_id, uint16_t queue_id, struct rte_mbuf *mbuf); int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params);