net: add rte prefix to ether structures
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index 16f2c2c..59e75b0 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <rte_io.h>
 
-#define HWRM_CMD_TIMEOUT               10000
+#define HWRM_CMD_TIMEOUT               6000000
 #define HWRM_SPEC_CODE_1_8_3           0x10803
 #define HWRM_VERSION_1_9_1             0x10901
 
@@ -135,7 +135,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
                        if (*valid == HWRM_RESP_VALID_KEY)
                                break;
                }
-               rte_delay_us(600);
+               rte_delay_us(1);
        }
 
        if (i >= HWRM_CMD_TIMEOUT) {
@@ -383,6 +383,8 @@ int bnxt_hwrm_set_l2_filter(struct bnxt *bp,
        HWRM_PREP(req, CFA_L2_FILTER_ALLOC, BNXT_USE_CHIMP_MB);
 
        req.flags = rte_cpu_to_le_32(filter->flags);
+       req.flags |=
+       rte_cpu_to_le_32(HWRM_CFA_L2_FILTER_ALLOC_INPUT_FLAGS_OUTERMOST);
 
        enables = filter->enables |
              HWRM_CFA_L2_FILTER_ALLOC_INPUT_ENABLES_DST_ID;
@@ -589,7 +591,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
                bp->pf.total_vnics = rte_le_to_cpu_16(resp->max_vnics);
                if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_PTP_SUPPORTED) {
                        bp->flags |= BNXT_FLAG_PTP_SUPPORTED;
-                       PMD_DRV_LOG(INFO, "PTP SUPPORTED\n");
+                       PMD_DRV_LOG(DEBUG, "PTP SUPPORTED\n");
                        HWRM_UNLOCK();
                        bnxt_hwrm_ptp_qcfg(bp);
                }
@@ -787,7 +789,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
        int rc = 0;
        struct hwrm_ver_get_input req = {.req_type = 0 };
        struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
-       uint32_t my_version;
        uint32_t fw_version;
        uint16_t max_resp_len;
        char type[RTE_MEMZONE_NAMESIZE];
@@ -815,10 +816,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
        PMD_DRV_LOG(INFO, "Driver HWRM version: %d.%d.%d\n",
                HWRM_VERSION_MAJOR, HWRM_VERSION_MINOR, HWRM_VERSION_UPDATE);
 
-       my_version = HWRM_VERSION_MAJOR << 16;
-       my_version |= HWRM_VERSION_MINOR << 8;
-       my_version |= HWRM_VERSION_UPDATE;
-
        fw_version = resp->hwrm_intf_maj_8b << 16;
        fw_version |= resp->hwrm_intf_min_8b << 8;
        fw_version |= resp->hwrm_intf_upd_8b;
@@ -830,21 +827,6 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
                goto error;
        }
 
-       if (my_version != fw_version) {
-               PMD_DRV_LOG(INFO, "BNXT Driver/HWRM API mismatch.\n");
-               if (my_version < fw_version) {
-                       PMD_DRV_LOG(INFO,
-                               "Firmware API version is newer than driver.\n");
-                       PMD_DRV_LOG(INFO,
-                               "The driver may be missing features.\n");
-               } else {
-                       PMD_DRV_LOG(INFO,
-                               "Firmware API version is older than driver.\n");
-                       PMD_DRV_LOG(INFO,
-                               "Not all driver features may be functional.\n");
-               }
-       }
-
        if (bp->max_req_len > resp->max_req_win_len) {
                PMD_DRV_LOG(ERR, "Unsupported request length\n");
                rc = -EINVAL;
@@ -909,6 +891,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();
@@ -1455,9 +1440,12 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        req.cos_rule = rte_cpu_to_le_16(vnic->cos_rule);
        req.lb_rule = rte_cpu_to_le_16(vnic->lb_rule);
        req.mru = rte_cpu_to_le_16(vnic->mru);
-       if (vnic->func_default)
+       /* Configure default VNIC only once. */
+       if (vnic->func_default && !(bp->flags & BNXT_FLAG_DFLT_VNIC_SET)) {
                req.flags |=
                    rte_cpu_to_le_32(HWRM_VNIC_CFG_INPUT_FLAGS_DEFAULT);
+               bp->flags |= BNXT_FLAG_DFLT_VNIC_SET;
+       }
        if (vnic->vlan_strip)
                req.flags |=
                    rte_cpu_to_le_32(HWRM_VNIC_CFG_INPUT_FLAGS_VLAN_STRIP_MODE);
@@ -1595,6 +1583,10 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        HWRM_UNLOCK();
 
        vnic->fw_vnic_id = INVALID_HW_RING_ID;
+       /* Configure default VNIC again if necessary. */
+       if (vnic->func_default && (bp->flags & BNXT_FLAG_DFLT_VNIC_SET))
+               bp->flags &= ~BNXT_FLAG_DFLT_VNIC_SET;
+
        return rc;
 }
 
@@ -2458,6 +2450,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:
@@ -2581,7 +2578,7 @@ static void add_random_mac_if_needed(struct bnxt *bp,
                                     struct hwrm_func_cfg_input *cfg_req,
                                     int vf)
 {
-       struct ether_addr mac;
+       struct rte_ether_addr mac;
 
        if (bnxt_hwrm_func_qcfg_vf_default_mac(bp, vf, &mac))
                return;
@@ -2993,7 +2990,7 @@ int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp)
        HWRM_PREP(req, FUNC_VF_CFG, BNXT_USE_CHIMP_MB);
 
        req.enables = rte_cpu_to_le_32(
-                       HWRM_FUNC_CFG_INPUT_ENABLES_ASYNC_EVENT_CR);
+                       HWRM_FUNC_VF_CFG_INPUT_ENABLES_ASYNC_EVENT_CR);
        req.async_event_cr = rte_cpu_to_le_16(
                        bp->def_cp_ring->cp_ring_struct->fw_ring_id);
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
@@ -3115,7 +3112,7 @@ int bnxt_hwrm_reject_fwd_resp(struct bnxt *bp, uint16_t target_id,
 }
 
 int bnxt_hwrm_func_qcfg_vf_default_mac(struct bnxt *bp, uint16_t vf,
-                                      struct ether_addr *mac)
+                                      struct rte_ether_addr *mac)
 {
        struct hwrm_func_qcfg_input req = {0};
        struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;