* [dpdk-stable] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros
[not found] <20190602174247.32368-1-lance.richardson@broadcom.com>
@ 2019-06-02 17:42 ` Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 02/11] net/bnxt: fix ring type macro name usage Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion Lance Richardson
2 siblings, 0 replies; 3+ messages in thread
From: Lance Richardson @ 2019-06-02 17:42 UTC (permalink / raw)
To: dev; +Cc: ajit.khaparde, ferruh.yigit, Lance Richardson, stable
Descriptor fields in CP ring are in little-endian form, convert
to CPU endian before performing arithmetic operations.
Also use more general comparison when checking for ring
index wrap.
Fixes: f2a768d4d186 ("net/bnxt: add completion ring")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_cpr.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_cpr.h b/drivers/net/bnxt/bnxt_cpr.h
index c7af56983..ee5ca820e 100644
--- a/drivers/net/bnxt/bnxt_cpr.h
+++ b/drivers/net/bnxt/bnxt_cpr.h
@@ -10,11 +10,12 @@
#include <rte_io.h>
#define CMP_VALID(cmp, raw_cons, ring) \
- (!!(((struct cmpl_base *)(cmp))->info3_v & CMPL_BASE_V) == \
- !((raw_cons) & ((ring)->ring_size)))
+ (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \
+ CMPL_BASE_V) == !((raw_cons) & ((ring)->ring_size)))
#define CMPL_VALID(cmp, v) \
- (!!(((struct cmpl_base *)(cmp))->info3_v & CMPL_BASE_V) == !(v))
+ (!!(rte_le_to_cpu_32(((struct cmpl_base *)(cmp))->info3_v) & \
+ CMPL_BASE_V) == !(v))
#define CMP_TYPE(cmp) \
(((struct cmpl_base *)cmp)->type & CMPL_BASE_TYPE_MASK)
@@ -31,7 +32,7 @@
#define NEXT_CMPL(cpr, idx, v, inc) do { \
(idx) += (inc); \
- if (unlikely((idx) == (cpr)->cp_ring_struct->ring_size)) { \
+ if (unlikely((idx) >= (cpr)->cp_ring_struct->ring_size)) { \
(v) = !(v); \
(idx) = 0; \
} \
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH 02/11] net/bnxt: fix ring type macro name usage
[not found] <20190602174247.32368-1-lance.richardson@broadcom.com>
2019-06-02 17:42 ` [dpdk-stable] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros Lance Richardson
@ 2019-06-02 17:42 ` Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion Lance Richardson
2 siblings, 0 replies; 3+ messages in thread
From: Lance Richardson @ 2019-06-02 17:42 UTC (permalink / raw)
To: dev; +Cc: ajit.khaparde, ferruh.yigit, Lance Richardson, stable
Use consistent macro names for ring type values. (There is no
functional change, the "alloc" and "free" values are identical.)
Fixes: 6371b91fb66d ("net/bnxt: add ring alloc/free")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 0c6af1622..8db18ea61 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1136,17 +1136,17 @@ int bnxt_hwrm_ring_alloc(struct bnxt *bp,
if (rc == 0 && resp->error_code)
rc = rte_le_to_cpu_16(resp->error_code);
switch (ring_type) {
- case HWRM_RING_FREE_INPUT_RING_TYPE_L2_CMPL:
+ case HWRM_RING_ALLOC_INPUT_RING_TYPE_L2_CMPL:
PMD_DRV_LOG(ERR,
"hwrm_ring_alloc cp failed. rc:%d\n", rc);
HWRM_UNLOCK();
return rc;
- case HWRM_RING_FREE_INPUT_RING_TYPE_RX:
+ case HWRM_RING_ALLOC_INPUT_RING_TYPE_RX:
PMD_DRV_LOG(ERR,
"hwrm_ring_alloc rx failed. rc:%d\n", rc);
HWRM_UNLOCK();
return rc;
- case HWRM_RING_FREE_INPUT_RING_TYPE_TX:
+ case HWRM_RING_ALLOC_INPUT_RING_TYPE_TX:
PMD_DRV_LOG(ERR,
"hwrm_ring_alloc tx failed. rc:%d\n", rc);
HWRM_UNLOCK();
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-stable] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion
[not found] <20190602174247.32368-1-lance.richardson@broadcom.com>
2019-06-02 17:42 ` [dpdk-stable] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 02/11] net/bnxt: fix ring type macro name usage Lance Richardson
@ 2019-06-02 17:42 ` Lance Richardson
2 siblings, 0 replies; 3+ messages in thread
From: Lance Richardson @ 2019-06-02 17:42 UTC (permalink / raw)
To: dev; +Cc: ajit.khaparde, ferruh.yigit, Lance Richardson, stable
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 Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 8db18ea61..e88719d06 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -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);
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-02 17:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190602174247.32368-1-lance.richardson@broadcom.com>
2019-06-02 17:42 ` [dpdk-stable] [PATCH 01/11] net/bnxt: endianness conversions in cp ring macros Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 02/11] net/bnxt: fix ring type macro name usage Lance Richardson
2019-06-02 17:42 ` [dpdk-stable] [PATCH 03/11] net/bnxt: fix width in stats ctx endian conversion Lance Richardson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).