DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/5] bnxt patchset
@ 2018-07-26  1:15 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
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-07-26  1:15 UTC (permalink / raw)
  To: dev

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

 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 37 +++++++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 15 deletions(-)

-- 
2.15.2 (Apple Git-101.1)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [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

* [dpdk-dev] [PATCH 0/5] bnxt patchset
@ 2018-01-22  6:20 Ajit Khaparde
  0 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2018-01-22  6:20 UTC (permalink / raw)
  To: dev

Please consider applying this patchset.

Ajit Khaparde (4):
  net/bnxt: fix size of tx ring in HW
  net/bnxt: use driver specific dynamic log type
  net/bnxt: register for more async events
  net/bnxt: check if MAC address is all zeros

Somnath Kotur (1):
  net/bnxt: Support for rx/tx_queue_start/stop ops

 drivers/net/bnxt/bnxt.h         |   8 +
 drivers/net/bnxt/bnxt_cpr.c     |  19 ++-
 drivers/net/bnxt/bnxt_ethdev.c  | 356 ++++++++++++++++++++++++----------------
 drivers/net/bnxt/bnxt_filter.c  |  44 ++---
 drivers/net/bnxt/bnxt_filter.h  |   1 +
 drivers/net/bnxt/bnxt_hwrm.c    | 151 ++++++++---------
 drivers/net/bnxt/bnxt_hwrm.h    |  11 ++
 drivers/net/bnxt/bnxt_irq.c     |   4 +-
 drivers/net/bnxt/bnxt_ring.c    |  12 +-
 drivers/net/bnxt/bnxt_rxq.c     |  22 +--
 drivers/net/bnxt/bnxt_rxq.h     |   2 +-
 drivers/net/bnxt/bnxt_rxr.c     |  23 +--
 drivers/net/bnxt/bnxt_rxr.h     |   3 +-
 drivers/net/bnxt/bnxt_stats.c   |  16 +-
 drivers/net/bnxt/bnxt_txq.c     |  10 +-
 drivers/net/bnxt/bnxt_txq.h     |   1 -
 drivers/net/bnxt/bnxt_txr.c     |  34 +++-
 drivers/net/bnxt/bnxt_txr.h     |   2 +
 drivers/net/bnxt/bnxt_vnic.c    |  14 +-
 drivers/net/bnxt/rte_pmd_bnxt.c |  48 +++---
 20 files changed, 464 insertions(+), 317 deletions(-)

-- 
2.14.3 (Apple Git-98)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH 0/5] bnxt patchset
@ 2016-08-15 23:06 Ajit Khaparde
  0 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2016-08-15 23:06 UTC (permalink / raw)
  To: dev

Please consider applying the following patches:
  bnxt: Add support for Broadcom StrataGX Communication Processors
  bnxt: Enable support for NPAR 1.0 feature
  bnxt: Add support for new HWRM version
  bnxt: Add support for new DIDs
  bnxt: Update Broadcom PMD driver documentation

 doc/guides/nics/bnxt.rst               |   23 +-
 drivers/net/bnxt/bnxt.h                |    4 +
 drivers/net/bnxt/bnxt_cpr.h            |    1 +
 drivers/net/bnxt/bnxt_ethdev.c         |   61 +-
 drivers/net/bnxt/bnxt_hwrm.c           |   38 +
 drivers/net/bnxt/bnxt_hwrm.h           |    1 +
 drivers/net/bnxt/bnxt_txr.h            |    1 +
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 4616 +++++++++++++++++---------------
 8 files changed, 2606 insertions(+), 2139 deletions(-)

-- 
2.7.4 (Apple Git-66)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-08-02 10:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-dev] [PATCH 3/5] net/bnxt: fix to release lock when alloc fails in NVM write Ajit Khaparde
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 ` [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
  -- strict thread matches above, loose matches on Subject: below --
2018-01-22  6:20 Ajit Khaparde
2016-08-15 23:06 Ajit Khaparde

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).