net/bnxt: get default HWRM command timeout from FW
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index 1e65c3b..5e3117f 100644 (file)
@@ -13,7 +13,6 @@
 #include <rte_version.h>
 
 #include "bnxt.h"
-#include "bnxt_cpr.h"
 #include "bnxt_filter.h"
 #include "bnxt_hwrm.h"
 #include "bnxt_rxq.h"
@@ -26,8 +25,6 @@
 
 #include <rte_io.h>
 
-#define HWRM_CMD_TIMEOUT               6000000
-#define HWRM_SHORT_CMD_TIMEOUT         50000
 #define HWRM_SPEC_CODE_1_8_3           0x10803
 #define HWRM_VERSION_1_9_1             0x10901
 #define HWRM_VERSION_1_9_2             0x10903
@@ -106,9 +103,9 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 
        /* For VER_GET command, set timeout as 50ms */
        if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)
-               timeout = HWRM_SHORT_CMD_TIMEOUT;
-       else
                timeout = HWRM_CMD_TIMEOUT;
+       else
+               timeout = bp->hwrm_cmd_timeout;
 
        if (bp->flags & BNXT_FLAG_SHORT_CMD ||
            msg_len > bp->max_req_len) {
@@ -970,6 +967,13 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
        fw_version |= resp->hwrm_intf_upd_8b;
        bp->hwrm_spec_code = fw_version;
 
+       /* def_req_timeout value is in milliseconds */
+       bp->hwrm_cmd_timeout = rte_le_to_cpu_16(resp->def_req_timeout);
+       /* convert timeout to usec */
+       bp->hwrm_cmd_timeout *= 1000;
+       if (!bp->hwrm_cmd_timeout)
+               bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT;
+
        if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) {
                PMD_DRV_LOG(ERR, "Unsupported firmware API version\n");
                rc = -EINVAL;
@@ -1692,7 +1696,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        HWRM_PREP(req, VNIC_CFG, BNXT_USE_CHIMP_MB);
 
        if (BNXT_CHIP_THOR(bp)) {
-               struct bnxt_rx_queue *rxq = bp->eth_dev->data->rx_queues[0];
+               struct bnxt_rx_queue *rxq =
+                       bp->eth_dev->data->rx_queues[vnic->start_grp_id];
                struct bnxt_rx_ring_info *rxr = rxq->rx_ring;
                struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
@@ -2873,10 +2878,13 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
        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)) {
+       if (BNXT_VF(bp) &&
+           !BNXT_VF_IS_TRUSTED(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");
        } else if (BNXT_VF(bp) &&
+                  BNXT_VF_IS_TRUSTED(bp) &&
                   !(flags & HWRM_FUNC_QCFG_OUTPUT_FLAGS_TRUSTED_VF)) {
                bp->flags &= ~BNXT_FLAG_TRUSTED_VF_EN;
                PMD_DRV_LOG(INFO, "Trusted VF cap disabled\n");