net/bnxt: fix variable width in endian conversion
authorLance Richardson <lance.richardson@broadcom.com>
Sun, 2 Jun 2019 17:42:38 +0000 (13:42 -0400)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 13 Jun 2019 14:54:29 +0000 (23:54 +0900)
Use 32-bit conversion width when converting to 32-bit values.

Fixes: 6371b91fb66d ("net/bnxt: add ring alloc/free")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c

index 8db18ea..e88719d 100644 (file)
@@ -1109,7 +1109,7 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
        case HWRM_RING_ALLOC_INPUT_RING_TYPE_RX:
                req.ring_type = ring_type;
                req.cmpl_ring_id = rte_cpu_to_le_16(cmpl_ring_id);
-               req.stat_ctx_id = rte_cpu_to_le_16(stats_ctx_id);
+               req.stat_ctx_id = rte_cpu_to_le_32(stats_ctx_id);
                if (stats_ctx_id != INVALID_STATS_CTX_ID)
                        enables |=
                        HWRM_RING_ALLOC_INPUT_ENABLES_STAT_CTX_ID_VALID;
@@ -1259,7 +1259,7 @@ int bnxt_hwrm_stat_clear(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
 
        HWRM_PREP(req, STAT_CTX_CLR_STATS, BNXT_USE_CHIMP_MB);
 
-       req.stat_ctx_id = rte_cpu_to_le_16(cpr->hw_stats_ctx_id);
+       req.stat_ctx_id = rte_cpu_to_le_32(cpr->hw_stats_ctx_id);
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
@@ -1287,7 +1287,7 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
 
        HWRM_CHECK_RESULT();
 
-       cpr->hw_stats_ctx_id = rte_le_to_cpu_16(resp->stat_ctx_id);
+       cpr->hw_stats_ctx_id = rte_le_to_cpu_32(resp->stat_ctx_id);
 
        HWRM_UNLOCK();
 
@@ -1303,7 +1303,7 @@ int bnxt_hwrm_stat_ctx_free(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
 
        HWRM_PREP(req, STAT_CTX_FREE, BNXT_USE_CHIMP_MB);
 
-       req.stat_ctx_id = rte_cpu_to_le_16(cpr->hw_stats_ctx_id);
+       req.stat_ctx_id = rte_cpu_to_le_32(cpr->hw_stats_ctx_id);
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);