From: Ajit Khaparde Date: Sat, 29 Sep 2018 02:00:00 +0000 (-0700) Subject: net/bnxt: support trusted VF X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=b42c15c83e882621aea730a71c7fab1481e14051;p=dpdk.git net/bnxt: support trusted VF In the current model, VFs are not trusted. So it is not allowed to send many HWRM commands. Newer firmware has added support to allow VF to be trusted. Now the VF queries if it is a trusted entity and based on that it can send HWRM commands to the firmware. Signed-off-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 6a5b4ded6c..75b7215ce4 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -260,6 +260,7 @@ struct bnxt { #define BNXT_FLAG_EXT_RX_PORT_STATS (1 << 8) #define BNXT_FLAG_EXT_TX_PORT_STATS (1 << 9) #define BNXT_FLAG_KONG_MB_EN (1 << 10) +#define BNXT_FLAG_TRUSTED_VF_EN (1 << 11) #define BNXT_FLAG_NEW_RM (1 << 30) #define BNXT_FLAG_INIT_DONE (1 << 31) #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) @@ -269,6 +270,7 @@ struct bnxt { #define BNXT_SINGLE_PF(bp) (BNXT_PF(bp) && !BNXT_NPAR(bp) && !BNXT_MH(bp)) #define BNXT_USE_CHIMP_MB 0 //For non-CFA commands, everything uses Chimp. #define BNXT_USE_KONG(bp) ((bp)->flags & BNXT_FLAG_KONG_MB_EN) +#define BNXT_VF_IS_TRUSTED(bp) ((bp)->flags & BNXT_FLAG_TRUSTED_VF_EN) unsigned int rx_nr_rings; unsigned int rx_cp_nr_rings; diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index ff20b6fdfa..0fd6e51e51 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -35,6 +35,7 @@ void bnxt_handle_async_event(struct bnxt *bp, break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_VF_CFG_CHANGE: PMD_DRV_LOG(INFO, "Async event: VF config changed\n"); + bnxt_hwrm_func_qcfg(bp); break; case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_PORT_CONN_NOT_ALLOWED: PMD_DRV_LOG(INFO, "Port conn async event\n"); diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 07f55025b1..0bc8c50049 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -755,7 +755,7 @@ static int bnxt_mac_addr_add_op(struct rte_eth_dev *eth_dev, struct bnxt_vnic_info *vnic = &bp->vnic_info[pool]; struct bnxt_filter_info *filter; - if (BNXT_VF(bp)) { + if (BNXT_VF(bp) & !BNXT_VF_IS_TRUSTED(bp)) { PMD_DRV_LOG(ERR, "Cannot add MAC address to a VF interface\n"); return -ENOTSUP; } @@ -1447,7 +1447,7 @@ bnxt_set_default_mac_addr_op(struct rte_eth_dev *dev, struct ether_addr *addr) struct bnxt_filter_info *filter; int rc; - if (BNXT_VF(bp)) + if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) return -EPERM; memcpy(bp->mac_addr, addr, sizeof(bp->mac_addr)); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 16f2c2ccc9..62da254b9e 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -909,6 +909,9 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) bp->flags |= BNXT_FLAG_KONG_MB_EN; PMD_DRV_LOG(DEBUG, "Kong mailbox channel enabled\n"); } + if (dev_caps_cfg & + HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_TRUSTED_VF_SUPPORTED) + PMD_DRV_LOG(DEBUG, "FW supports Trusted VFs\n"); error: HWRM_UNLOCK(); @@ -2458,6 +2461,11 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp) if (BNXT_PF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_MULTI_HOST)) bp->flags |= BNXT_FLAG_MULTI_HOST; + if (BNXT_VF(bp) && (flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) { + bp->flags |= BNXT_FLAG_TRUSTED_VF_EN; + PMD_DRV_LOG(INFO, "Trusted VF cap enabled\n"); + } + switch (resp->port_partition_type) { case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0: case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_5: