DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH 0/2] fixes for bnxt driver
@ 2020-07-31 12:08 wangyunjian
  2020-07-31 12:08 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix memory leak when freeing vf_info wangyunjian
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: wangyunjian @ 2020-07-31 12:08 UTC (permalink / raw)
  To: dev; +Cc: ajit.khaparde, somnath.kotur, jerry.lilijun, xudingke, Yunjian Wang

From: Yunjian Wang <wangyunjian@huawei.com>

This series include two fixes patches for bnxt driver.

Yunjian Wang (2):
  net/bnxt: fix memory leak when freeing vf_info
  net/bnxt: add memory allocation check in vf_info init

 drivers/net/bnxt/bnxt_ethdev.c |  3 +--
 drivers/net/bnxt/bnxt_hwrm.c   | 22 ++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 3 files changed, 22 insertions(+), 4 deletions(-)

-- 
2.23.0



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

* [dpdk-dev] [PATCH 1/2] net/bnxt: fix memory leak when freeing vf_info
  2020-07-31 12:08 [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
@ 2020-07-31 12:08 ` wangyunjian
  2020-07-31 12:09 ` [dpdk-dev] [PATCH 2/2] net/bnxt: add memory allocation check in vf_info init wangyunjian
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: wangyunjian @ 2020-07-31 12:08 UTC (permalink / raw)
  To: dev
  Cc: ajit.khaparde, somnath.kotur, jerry.lilijun, xudingke,
	Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

When freeing a vf_info, we should free the 'vlan_as_table'
and 'vlan_table' for the vf_info.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  3 +--
 drivers/net/bnxt/bnxt_hwrm.c   | 16 +++++++++++++++-
 drivers/net/bnxt/bnxt_hwrm.h   |  1 +
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 510a0d9e0..e64c147be 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1360,8 +1360,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	rte_memzone_free((const struct rte_memzone *)bp->rx_mem_zone);
 	bp->rx_mem_zone = NULL;
 
-	rte_free(bp->pf->vf_info);
-	bp->pf->vf_info = NULL;
+	bnxt_hwrm_free_vf_info(bp);
 
 	rte_free(bp->grp_info);
 	bp->grp_info = NULL;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 8296d1d44..643dd9897 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -670,6 +670,20 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 	return 0;
 }
 
+void bnxt_hwrm_free_vf_info(struct bnxt *bp)
+{
+	int i;
+
+	for (i = 0; i < bp->pf->max_vfs; i++) {
+		rte_free(bp->pf->vf_info[i].vlan_table);
+		bp->pf->vf_info[i].vlan_table = NULL;
+		rte_free(bp->pf->vf_info[i].vlan_as_table);
+		bp->pf->vf_info[i].vlan_as_table = NULL;
+	}
+	rte_free(bp->pf->vf_info);
+	bp->pf->vf_info = NULL;
+}
+
 static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 {
 	int rc = 0;
@@ -696,7 +710,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		new_max_vfs = bp->pdev->max_vfs;
 		if (new_max_vfs != bp->pf->max_vfs) {
 			if (bp->pf->vf_info)
-				rte_free(bp->pf->vf_info);
+				bnxt_hwrm_free_vf_info(bp);
 			bp->pf->vf_info = rte_malloc("bnxt_vf_info",
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
 			bp->pf->max_vfs = new_max_vfs;
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index 4a2af13c9..eaabe1ffc 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -280,4 +280,5 @@ int bnxt_clear_one_vnic_filter(struct bnxt *bp,
 			       struct bnxt_filter_info *filter);
 int bnxt_hwrm_cfa_vfr_alloc(struct bnxt *bp, uint16_t vf_idx);
 int bnxt_hwrm_cfa_vfr_free(struct bnxt *bp, uint16_t vf_idx);
+void bnxt_hwrm_free_vf_info(struct bnxt *bp);
 #endif
-- 
2.23.0



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

* [dpdk-dev] [PATCH 2/2] net/bnxt: add memory allocation check in vf_info init
  2020-07-31 12:08 [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
  2020-07-31 12:08 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix memory leak when freeing vf_info wangyunjian
@ 2020-07-31 12:09 ` wangyunjian
  2020-09-01  0:57 ` [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
  2020-09-02  3:38 ` Ajit Khaparde
  3 siblings, 0 replies; 8+ messages in thread
From: wangyunjian @ 2020-07-31 12:09 UTC (permalink / raw)
  To: dev
  Cc: ajit.khaparde, somnath.kotur, jerry.lilijun, xudingke,
	Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The function rte_malloc() could return NULL, the return
value need to be checked.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 643dd9897..43e3e2753 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -711,8 +711,12 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 		if (new_max_vfs != bp->pf->max_vfs) {
 			if (bp->pf->vf_info)
 				bnxt_hwrm_free_vf_info(bp);
-			bp->pf->vf_info = rte_malloc("bnxt_vf_info",
+			bp->pf->vf_info = rte_zmalloc("bnxt_vf_info",
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
+			if (bp->pf->vf_info == NULL) {
+				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				return -ENOMEM;
+			}
 			bp->pf->max_vfs = new_max_vfs;
 			for (i = 0; i < new_max_vfs; i++) {
 				bp->pf->vf_info[i].fid =
-- 
2.23.0



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

* Re: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
  2020-07-31 12:08 [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
  2020-07-31 12:08 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix memory leak when freeing vf_info wangyunjian
  2020-07-31 12:09 ` [dpdk-dev] [PATCH 2/2] net/bnxt: add memory allocation check in vf_info init wangyunjian
@ 2020-09-01  0:57 ` wangyunjian
  2020-09-01  1:00   ` Ajit Khaparde
  2020-09-02  3:38 ` Ajit Khaparde
  3 siblings, 1 reply; 8+ messages in thread
From: wangyunjian @ 2020-09-01  0:57 UTC (permalink / raw)
  To: dev, ajit.khaparde, somnath.kotur; +Cc: Lilijun (Jerry), xudingke


Ping for review, please.

> -----Original Message-----
> From: wangyunjian
> Sent: Friday, July 31, 2020 8:09 PM
> To: dev@dpdk.org
> Cc: ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Lilijun
> (Jerry) <jerry.lilijun@huawei.com>; xudingke <xudingke@huawei.com>;
> wangyunjian <wangyunjian@huawei.com>
> Subject: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> This series include two fixes patches for bnxt driver.
> 
> Yunjian Wang (2):
>   net/bnxt: fix memory leak when freeing vf_info
>   net/bnxt: add memory allocation check in vf_info init
> 
>  drivers/net/bnxt/bnxt_ethdev.c |  3 +--
>  drivers/net/bnxt/bnxt_hwrm.c   | 22 ++++++++++++++++++++--
>  drivers/net/bnxt/bnxt_hwrm.h   |  1 +
>  3 files changed, 22 insertions(+), 4 deletions(-)
> 
> --
> 2.23.0
> 


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

* Re: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
  2020-09-01  0:57 ` [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
@ 2020-09-01  1:00   ` Ajit Khaparde
  0 siblings, 0 replies; 8+ messages in thread
From: Ajit Khaparde @ 2020-09-01  1:00 UTC (permalink / raw)
  To: wangyunjian; +Cc: Lilijun (Jerry), dev, somnath.kotur, xudingke

On Mon, Aug 31, 2020 at 5:58 PM wangyunjian <wangyunjian@huawei.com> wrote:

>
>
> Ping for review, please.

yes. It’s in the pipeline and will be applied in a day or two.

Thanks
Ajit


>
>
>
> > -----Original Message-----
>
> > From: wangyunjian
>
> > Sent: Friday, July 31, 2020 8:09 PM
>
> > To: dev@dpdk.org
>
> > Cc: ajit.khaparde@broadcom.com; somnath.kotur@broadcom.com; Lilijun
>
> > (Jerry) <jerry.lilijun@huawei.com>; xudingke <xudingke@huawei.com>;
>
> > wangyunjian <wangyunjian@huawei.com>
>
> > Subject: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
>
> >
>
> > From: Yunjian Wang <wangyunjian@huawei.com>
>
> >
>
> > This series include two fixes patches for bnxt driver.
>
> >
>
> > Yunjian Wang (2):
>
> >   net/bnxt: fix memory leak when freeing vf_info
>
> >   net/bnxt: add memory allocation check in vf_info init
>
> >
>
> >  drivers/net/bnxt/bnxt_ethdev.c |  3 +--
>
> >  drivers/net/bnxt/bnxt_hwrm.c   | 22 ++++++++++++++++++++--
>
> >  drivers/net/bnxt/bnxt_hwrm.h   |  1 +
>
> >  3 files changed, 22 insertions(+), 4 deletions(-)
>
> >
>
> > --
>
> > 2.23.0
>
> >
>
>
>
>

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

* Re: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
  2020-07-31 12:08 [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
                   ` (2 preceding siblings ...)
  2020-09-01  0:57 ` [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
@ 2020-09-02  3:38 ` Ajit Khaparde
  3 siblings, 0 replies; 8+ messages in thread
From: Ajit Khaparde @ 2020-09-02  3:38 UTC (permalink / raw)
  To: wangyunjian; +Cc: dpdk-dev, Somnath Kotur, Lilijun (Jerry), xudingke

On Fri, Jul 31, 2020 at 5:09 AM wangyunjian <wangyunjian@huawei.com> wrote:

> From: Yunjian Wang <wangyunjian@huawei.com>
>
> This series include two fixes patches for bnxt driver.
>
> Yunjian Wang (2):
>   net/bnxt: fix memory leak when freeing vf_info
>   net/bnxt: add memory allocation check in vf_info init
>
Patchset applied to dpdk-next-net-brcm. Thanks


>
>  drivers/net/bnxt/bnxt_ethdev.c |  3 +--
>  drivers/net/bnxt/bnxt_hwrm.c   | 22 ++++++++++++++++++++--
>  drivers/net/bnxt/bnxt_hwrm.h   |  1 +
>  3 files changed, 22 insertions(+), 4 deletions(-)
>
> --
> 2.23.0
>
>
>

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

* Re: [dpdk-dev] [PATCH 0/2] fixes for bnxt driver
  2020-09-05  9:36 wangyunjian
@ 2020-09-11  3:22 ` Ajit Khaparde
  0 siblings, 0 replies; 8+ messages in thread
From: Ajit Khaparde @ 2020-09-11  3:22 UTC (permalink / raw)
  To: wangyunjian; +Cc: dpdk-dev, Lilijun (Jerry), xudingke

On Sat, Sep 5, 2020 at 2:37 AM wangyunjian <wangyunjian@huawei.com> wrote:

> From: Yunjian Wang <wangyunjian@huawei.com>
>
> This series include two fixes patches for bnxt driver.
>
Patchset applied to dpdk-next-net-brcm. Thanks


>
> Yunjian Wang (2):
>   net/bnxt: remove logically dead code
>   net/bnxt: fix a wrong use of rte_free when freeing mbuf
>
>  drivers/net/bnxt/bnxt_reps.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> --
> 2.18.1
>
>
>

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

* [dpdk-dev]  [PATCH 0/2] fixes for bnxt driver
@ 2020-09-05  9:36 wangyunjian
  2020-09-11  3:22 ` Ajit Khaparde
  0 siblings, 1 reply; 8+ messages in thread
From: wangyunjian @ 2020-09-05  9:36 UTC (permalink / raw)
  To: dev; +Cc: ajit.khaparde, somnath.kotur, jerry.lilijun, xudingke, Yunjian Wang

From: Yunjian Wang <wangyunjian@huawei.com>

This series include two fixes patches for bnxt driver.

Yunjian Wang (2):
  net/bnxt: remove logically dead code
  net/bnxt: fix a wrong use of rte_free when freeing mbuf

 drivers/net/bnxt/bnxt_reps.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

-- 
2.18.1



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

end of thread, other threads:[~2020-09-11  3:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31 12:08 [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
2020-07-31 12:08 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix memory leak when freeing vf_info wangyunjian
2020-07-31 12:09 ` [dpdk-dev] [PATCH 2/2] net/bnxt: add memory allocation check in vf_info init wangyunjian
2020-09-01  0:57 ` [dpdk-dev] [PATCH 0/2] fixes for bnxt driver wangyunjian
2020-09-01  1:00   ` Ajit Khaparde
2020-09-02  3:38 ` Ajit Khaparde
2020-09-05  9:36 wangyunjian
2020-09-11  3:22 ` Ajit Khaparde

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git