* [dpdk-dev] [PATCH 1/5] net/bnxt: fix to remove element from the vnic's filter list
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
@ 2018-07-26 1:15 ` Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 2/5] net/bnxt: fix to free allocated memory Ajit Khaparde
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26 1:15 UTC (permalink / raw)
To: dev; +Cc: Somnath Kotur, stable
From: Somnath Kotur <somnath.kotur@broadcom.com>
bnxt_clear_hwrm_vnic_filters() was removing the created filter from HW,
but not clearing the internal data structures by removing it from the
struct bnxt_vnic_info->filter list.
Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")
Cc: stable@dpdk.com
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 02562f78c..69c83cdab 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2020,6 +2020,7 @@ int bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic)
rc = bnxt_hwrm_clear_ntuple_filter(bp, filter);
else
rc = bnxt_hwrm_clear_l2_filter(bp, filter);
+ STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next);
//if (rc)
//break;
}
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 2/5] net/bnxt: fix to free allocated memory
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 1/5] net/bnxt: fix to remove element from the vnic's filter list Ajit Khaparde
@ 2018-07-26 1:15 ` Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 3/5] net/bnxt: fix to release lock when alloc fails in NVM write Ajit Khaparde
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26 1:15 UTC (permalink / raw)
To: dev; +Cc: stable
In some cases we may not be freeing up memory allocated for certain
NVM commands because the code might have bailed out before reaching
rte_free(). This patch moves some code around to ensure the allocated
memory is freed before exiting the function.
Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM")
Cc: stable@dpdk.org
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Michael Wildt <michael.wildt@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 69c83cdab..3f8e26ca3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3353,13 +3353,12 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
req.host_dest_addr = rte_cpu_to_le_64(dma_handle);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
- HWRM_CHECK_RESULT();
- HWRM_UNLOCK();
-
if (rc == 0)
memcpy(data, buf, len > buflen ? buflen : len);
rte_free(buf);
+ HWRM_CHECK_RESULT();
+ HWRM_UNLOCK();
return rc;
}
@@ -3391,12 +3390,13 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index,
req.offset = rte_cpu_to_le_32(offset);
req.len = rte_cpu_to_le_32(length);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
- HWRM_CHECK_RESULT();
- HWRM_UNLOCK();
if (rc == 0)
memcpy(data, buf, length);
rte_free(buf);
+ HWRM_CHECK_RESULT();
+ HWRM_UNLOCK();
+
return rc;
}
@@ -3451,10 +3451,10 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
+ rte_free(buf);
HWRM_CHECK_RESULT();
HWRM_UNLOCK();
- rte_free(buf);
return rc;
}
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 3/5] net/bnxt: fix to release lock when alloc fails in NVM write
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 1/5] net/bnxt: fix to remove element from the vnic's filter list Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 2/5] net/bnxt: fix to free allocated memory Ajit Khaparde
@ 2018-07-26 1:15 ` Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 4/5] net/bnxt: check access denied error for HWRM commands Ajit Khaparde
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26 1:15 UTC (permalink / raw)
To: dev; +Cc: stable
In bnxt_hwrm_flash_nvram, before attempting to allocate a buffer
we are grabbing the rte_spinlock. And if the allocation fails we
are returning before releasing the spinlock. We avoid the situation
by calling HWRM_PREP which grabs the lock after the buffer is
allocated successfully.
Fixes: 19e6af01bb36 ("net/bnxt: support get/set EEPROM")
Cc: stable@dpdk.org
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 3f8e26ca3..5e8970ac3 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3427,14 +3427,6 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
rte_iova_t dma_handle;
uint8_t *buf;
- HWRM_PREP(req, NVM_WRITE);
-
- req.dir_type = rte_cpu_to_le_16(dir_type);
- req.dir_ordinal = rte_cpu_to_le_16(dir_ordinal);
- req.dir_ext = rte_cpu_to_le_16(dir_ext);
- req.dir_attr = rte_cpu_to_le_16(dir_attr);
- req.dir_data_length = rte_cpu_to_le_32(data_len);
-
buf = rte_malloc("nvm_write", data_len, 0);
rte_mem_lock_page(buf);
if (!buf)
@@ -3447,6 +3439,14 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
return -ENOMEM;
}
memcpy(buf, data, data_len);
+
+ HWRM_PREP(req, NVM_WRITE);
+
+ req.dir_type = rte_cpu_to_le_16(dir_type);
+ req.dir_ordinal = rte_cpu_to_le_16(dir_ordinal);
+ req.dir_ext = rte_cpu_to_le_16(dir_ext);
+ req.dir_attr = rte_cpu_to_le_16(dir_attr);
+ req.dir_data_length = rte_cpu_to_le_32(data_len);
req.host_src_addr = rte_cpu_to_le_64(dma_handle);
rc = bnxt_hwrm_send_message(bp, &req, sizeof(req));
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 4/5] net/bnxt: check access denied error for HWRM commands
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
` (2 preceding siblings ...)
2018-07-26 1:15 ` [dpdk-dev] [PATCH 3/5] net/bnxt: fix to release lock when alloc fails in NVM write Ajit Khaparde
@ 2018-07-26 1:15 ` Ajit Khaparde
2018-07-26 1:15 ` [dpdk-dev] [PATCH 5/5] net/bnxt: fix to set proper reta size Ajit Khaparde
2018-08-02 10:16 ` [dpdk-dev] [PATCH 0/5] bnxt patchset Thomas Monjalon
5 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26 1:15 UTC (permalink / raw)
To: dev; +Cc: stable
Firmware can restrict access to certain resources in the hardware
depending on various factors. In such cases when the PMD tries to
configure these resources the firmware will return
HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED error. Parse this and return
the standard EACCES error to the applications.
Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_hwrm.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 5e8970ac3..c682488ae 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -182,6 +182,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
if (rc) { \
PMD_DRV_LOG(ERR, "failed rc:%d\n", rc); \
rte_spinlock_unlock(&bp->hwrm_lock); \
+ if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
+ rc = -EACCES; \
+ else if (rc > 0) \
+ rc = -EINVAL; \
return rc; \
} \
if (resp->error_code) { \
@@ -200,6 +204,10 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
PMD_DRV_LOG(ERR, "error %d\n", rc); \
} \
rte_spinlock_unlock(&bp->hwrm_lock); \
+ if (rc == HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED) \
+ rc = -EACCES; \
+ else if (rc > 0) \
+ rc = -EINVAL; \
return rc; \
} \
} while (0)
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH 5/5] net/bnxt: fix to set proper reta size
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
` (3 preceding siblings ...)
2018-07-26 1:15 ` [dpdk-dev] [PATCH 4/5] net/bnxt: check access denied error for HWRM commands Ajit Khaparde
@ 2018-07-26 1:15 ` Ajit Khaparde
2018-08-02 10:16 ` [dpdk-dev] [PATCH 0/5] bnxt patchset Thomas Monjalon
5 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26 1:15 UTC (permalink / raw)
To: dev; +Cc: stable
The reta_size being indicated in the bnxt_dev_info_get_op was incorrect.
Set it to the value supported by the hardware.
Fixes: 0a6d2a720078 ("net/bnxt: get device infos")
Cc: stable@dpdk.org
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Tested-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 9508d6bcb..cc7e4391c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -438,7 +438,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
/* For the sake of symmetry, max_rx_queues = max_tx_queues */
dev_info->max_rx_queues = max_rx_rings;
dev_info->max_tx_queues = max_rx_rings;
- dev_info->reta_size = bp->max_rsscos_ctx;
+ dev_info->reta_size = HW_HASH_INDEX_SIZE;
dev_info->hash_key_size = 40;
max_vnics = bp->max_vnics;
--
2.15.2 (Apple Git-101.1)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] bnxt patchset
2018-07-26 1:15 [dpdk-dev] [PATCH 0/5] bnxt patchset Ajit Khaparde
` (4 preceding siblings ...)
2018-07-26 1:15 ` [dpdk-dev] [PATCH 5/5] net/bnxt: fix to set proper reta size Ajit Khaparde
@ 2018-08-02 10:16 ` Thomas Monjalon
5 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2018-08-02 10:16 UTC (permalink / raw)
To: Ajit Khaparde; +Cc: dev
26/07/2018 03:15, Ajit Khaparde:
> This patchset against next-net fixes issues identified during QA testing.
> Please apply.
>
> Ajit Khaparde (4):
> net/bnxt: fix to free allocated memory
> net/bnxt: fix to release lock when alloc fails in NVM write
> net/bnxt: check access denied error for HWRM commands
> net/bnxt: fix to set proper reta size
>
> Somnath Kotur (1):
> net/bnxt: fix to remove element from the vnic's filter list
Applied with following titles (hopefully easier to read):
net/bnxt: fix filter freeing
net/bnxt: fix memory leaks in NVM commands
net/bnxt: fix lock release on NVM write failure
net/bnxt: check access denied for HWRM commands
net/bnxt: fix RETA size
The Signed-off-by is also moved before Reviewed-by
in order to reflect the chronological order.
^ permalink raw reply [flat|nested] 9+ messages in thread