net/bnxt: support trusted VF
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Sat, 29 Sep 2018 02:00:00 +0000 (19:00 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:48 +0000 (18:53 +0200)
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 <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_cpr.c
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_hwrm.c

index 6a5b4de..75b7215 100644 (file)
@@ -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;
index ff20b6f..0fd6e51 100644 (file)
@@ -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");
index 07f5502..0bc8c50 100644 (file)
@@ -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));
index 16f2c2c..62da254 100644 (file)
@@ -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: