net/bnxt: fix HWRM messages for thor RSS config
authorLance Richardson <lance.richardson@broadcom.com>
Thu, 18 Jul 2019 03:36:10 +0000 (09:06 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 23 Jul 2019 12:31:35 +0000 (14:31 +0200)
Fully initialize hwrm messages for thor RSS configuration
to avoid hwrm duplicate sequence numbers.

Fixes: 38412304b50a ("net/bnxt: enable RSS for thor-based controllers")

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c

index b412d4d..6f3a045 100644 (file)
@@ -1737,16 +1737,16 @@ bnxt_hwrm_vnic_rss_cfg_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        struct hwrm_vnic_rss_cfg_input req = {.req_type = 0 };
        struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 
-       HWRM_PREP(req, VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
+       for (i = 0; i < nr_ctxs; i++) {
+               HWRM_PREP(req, VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
 
-       req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
-       req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
-       req.hash_mode_flags = vnic->hash_mode;
+               req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
+               req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
+               req.hash_mode_flags = vnic->hash_mode;
 
-       req.hash_key_tbl_addr =
-           rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
+               req.hash_key_tbl_addr =
+                       rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
 
-       for (i = 0; i < nr_ctxs; i++) {
                req.ring_grp_tbl_addr =
                        rte_cpu_to_le_64(vnic->rss_table_dma_addr +
                                         i * HW_HASH_INDEX_SIZE);
@@ -1757,10 +1757,9 @@ bnxt_hwrm_vnic_rss_cfg_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
                                            BNXT_USE_CHIMP_MB);
 
                HWRM_CHECK_RESULT();
+               HWRM_UNLOCK();
        }
 
-       HWRM_UNLOCK();
-
        return rc;
 }
 
@@ -4124,21 +4123,21 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        int i, j, k, cnt;
        int rc = 0;
 
-       HWRM_PREP(req, VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
-
-       req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
-       req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
-       req.hash_mode_flags = vnic->hash_mode;
-
-       req.ring_grp_tbl_addr =
-           rte_cpu_to_le_64(vnic->rss_table_dma_addr);
-       req.hash_key_tbl_addr =
-           rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
-
        for (i = 0, k = 0; i < nr_ctxs; i++) {
                struct bnxt_rx_ring_info *rxr;
                struct bnxt_cp_ring_info *cpr;
 
+               HWRM_PREP(req, VNIC_RSS_CFG, BNXT_USE_CHIMP_MB);
+
+               req.vnic_id = rte_cpu_to_le_16(vnic->fw_vnic_id);
+               req.hash_type = rte_cpu_to_le_32(vnic->hash_type);
+               req.hash_mode_flags = vnic->hash_mode;
+
+               req.ring_grp_tbl_addr =
+                   rte_cpu_to_le_64(vnic->rss_table_dma_addr);
+               req.hash_key_tbl_addr =
+                   rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);
+
                req.ring_table_pair_index = i;
                req.rss_ctx_idx = rte_cpu_to_le_16(vnic->fw_grp_ids[i]);
 
@@ -4174,10 +4173,9 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
                                            BNXT_USE_CHIMP_MB);
 
                HWRM_CHECK_RESULT();
+               HWRM_UNLOCK();
        }
 
-       HWRM_UNLOCK();
-
        return rc;
 }