* [PATCH 02/10] net/nfp: fix malloc name problem in secondary process
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
@ 2024-10-10 9:17 ` Chaoyong He
2024-10-10 15:07 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 05/10] net/nfp: fix problem caused by configure function Chaoyong He
` (4 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-10 9:17 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, peng.zhang, stable, Long Wu
The original logic keeps using the same name parameter when malloc
memory in secondary process, which may cause error when using
multiple PF cards.
Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 64a06440f5..3732abc9fe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2669,7 +2669,8 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Allocate memory for the PF "device" */
- snprintf(name, sizeof(name), "nfp_pf%d", 0);
+ function_id = pci_dev->addr.function & 0x7;
+ snprintf(name, sizeof(name), "nfp_pf%d", function_id);
pf_dev = rte_zmalloc(name, sizeof(*pf_dev), 0);
if (pf_dev == NULL) {
PMD_INIT_LOG(ERR, "Can't allocate memory for the PF device");
@@ -2714,7 +2715,6 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Read the app ID of the firmware loaded */
- function_id = pci_dev->addr.function & 0x7;
snprintf(app_name, sizeof(app_name), "_pf%u_net_app_id", function_id);
app_fw_id = nfp_rtsym_read_le(sym_tbl, app_name, &ret);
if (ret != 0) {
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 05/10] net/nfp: fix problem caused by configure function
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
2024-10-10 9:17 ` [PATCH 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
@ 2024-10-10 9:17 ` Chaoyong He
2024-10-10 15:13 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
` (3 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-10 9:17 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang
The return value of 'nfp_eth_set_configured()' is three ways, the
original logic considered it as two ways wrongly.
Fixes: 61d4008fe6bb ("net/nfp: support setting link up/down")
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 405386e882..2fe6b1a292 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -527,26 +527,36 @@ nfp_net_start(struct rte_eth_dev *dev)
static int
nfp_net_set_link_up(struct rte_eth_dev *dev)
{
+ int ret;
struct nfp_net_hw *hw;
struct nfp_net_hw_priv *hw_priv;
hw = dev->data->dev_private;
hw_priv = dev->process_private;
- return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+ ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
/* Set the link down. */
static int
nfp_net_set_link_down(struct rte_eth_dev *dev)
{
+ int ret;
struct nfp_net_hw *hw;
struct nfp_net_hw_priv *hw_priv;
hw = dev->data->dev_private;
hw_priv = dev->process_private;
- return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+ ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
static void
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 07/10] net/nfp: fix problem caused by commit end function
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
2024-10-10 9:17 ` [PATCH 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
2024-10-10 9:17 ` [PATCH 05/10] net/nfp: fix problem caused by configure function Chaoyong He
@ 2024-10-10 9:17 ` Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
` (2 subsequent siblings)
5 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-10 9:17 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, zerun.fu, stable, Long Wu, Peng Zhang
The return value of 'nfp_eth_config_commit_end()' is three ways, the
original logic considered it as two ways wrongly.
Fixes: 68aa35373a94 ("net/nfp: support setting pause frame switch mode")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_net_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 80d60515d8..5c3a9a7ae7 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2520,7 +2520,7 @@ nfp_net_pause_frame_set(struct nfp_net_hw_priv *hw_priv,
}
err = nfp_eth_config_commit_end(nsp);
- if (err != 0) {
+ if (err < 0) {
PMD_DRV_LOG(ERR, "Failed to configure pause frame.");
return err;
}
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 08/10] net/nfp: fix problem caused by FEC set
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
` (2 preceding siblings ...)
2024-10-10 9:17 ` [PATCH 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
@ 2024-10-10 9:17 ` Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
5 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-10 9:17 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, zerun.fu, stable, Long Wu, Peng Zhang
The return value of 'nfp_eth_set_fec()' is three ways, the original
logic considered it as two ways wrongly.
Fixes: 37bd1b843a20 ("net/nfp: support setting FEC mode")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_net_common.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 5c3a9a7ae7..b986ed4622 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2692,6 +2692,7 @@ int
nfp_net_fec_set(struct rte_eth_dev *dev,
uint32_t fec_capa)
{
+ int ret;
uint8_t idx;
enum nfp_eth_fec fec;
uint32_t supported_fec;
@@ -2724,7 +2725,13 @@ nfp_net_fec_set(struct rte_eth_dev *dev,
return -EIO;
}
- return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
+ ret = nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
+ if (ret < 0) {
+ PMD_DRV_LOG(ERR, "NFP set FEC mode failed.");
+ return ret;
+ }
+
+ return 0;
}
uint32_t
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
` (3 preceding siblings ...)
2024-10-10 9:17 ` [PATCH 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
@ 2024-10-10 9:17 ` Chaoyong He
2024-10-10 15:19 ` Stephen Hemminger
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
5 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-10 9:17 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang
Fix one memory leak problem in the logic of VF initialization.
Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data")
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_ethdev_vf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index ab413a2c5a..0a25730bf1 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -327,7 +327,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
if (net_hw->eth_xstats_base == NULL) {
PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!",
pci_dev->device.name);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto hw_priv_free;
}
/* Work out where in the BAR the queues start. */
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 02/10] net/nfp: fix malloc name problem in secondary process
2024-10-10 9:17 ` [PATCH 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
@ 2024-10-10 15:07 ` Stephen Hemminger
2024-10-11 2:31 ` Chaoyong He
0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 15:07 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, peng.zhang, stable, Long Wu
On Thu, 10 Oct 2024 17:17:08 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> The original logic keeps using the same name parameter when malloc
> memory in secondary process, which may cause error when using
> multiple PF cards.
>
> Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
> Cc: peng.zhang@corigine.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Huh? the name is ignored by rte_malloc(), it only shows up in tracing.
in fact you could just always pass NULL.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 05/10] net/nfp: fix problem caused by configure function
2024-10-10 9:17 ` [PATCH 05/10] net/nfp: fix problem caused by configure function Chaoyong He
@ 2024-10-10 15:13 ` Stephen Hemminger
0 siblings, 0 replies; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 15:13 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, stable, Long Wu, Peng Zhang
On Thu, 10 Oct 2024 17:17:11 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> The return value of 'nfp_eth_set_configured()' is three ways, the
> original logic considered it as two ways wrongly.
>
> Fixes: 61d4008fe6bb ("net/nfp: support setting link up/down")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Maybe refering to the return values in nfp_nsp_eth.c would be clearer
but makes sense.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 07/10] net/nfp: fix problem caused by commit end function
2024-10-10 9:17 ` [PATCH 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
@ 2024-10-10 15:15 ` Stephen Hemminger
0 siblings, 0 replies; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 15:15 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, zerun.fu, stable, Long Wu, Peng Zhang
On Thu, 10 Oct 2024 17:17:13 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> The return value of 'nfp_eth_config_commit_end()' is three ways, the
> original logic considered it as two ways wrongly.
>
> Fixes: 68aa35373a94 ("net/nfp: support setting pause frame switch mode")
> Cc: zerun.fu@corigine.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> ---
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 08/10] net/nfp: fix problem caused by FEC set
2024-10-10 9:17 ` [PATCH 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
@ 2024-10-10 15:15 ` Stephen Hemminger
0 siblings, 0 replies; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 15:15 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, zerun.fu, stable, Long Wu, Peng Zhang
On Thu, 10 Oct 2024 17:17:14 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> The return value of 'nfp_eth_set_fec()' is three ways, the original
> logic considered it as two ways wrongly.
>
> Fixes: 37bd1b843a20 ("net/nfp: support setting FEC mode")
> Cc: zerun.fu@corigine.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic
2024-10-10 9:17 ` [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
@ 2024-10-10 15:19 ` Stephen Hemminger
2024-10-11 2:38 ` Chaoyong He
0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-10 15:19 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, stable, Long Wu, Peng Zhang
On Thu, 10 Oct 2024 17:17:16 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> Fix one memory leak problem in the logic of VF initialization.
>
> Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> ---
The code as is looks fine, but would have been better to use rte_calloc()
when allocating eth_xstats_base.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH 02/10] net/nfp: fix malloc name problem in secondary process
2024-10-10 15:07 ` Stephen Hemminger
@ 2024-10-11 2:31 ` Chaoyong He
0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11 2:31 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, oss-drivers, Nole Zhang, stable, Long Wu
> On Thu, 10 Oct 2024 17:17:08 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
>
> > The original logic keeps using the same name parameter when malloc
> > memory in secondary process, which may cause error when using multiple
> > PF cards.
> >
> > Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
> > Cc: peng.zhang@corigine.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
>
> Huh? the name is ignored by rte_malloc(), it only shows up in tracing.
> in fact you could just always pass NULL.
Yeah, I have learned this from some patch thread.
I will choose using 'NULL' in the newly added logic, treat this API as a 'white box'.
But for already exist logic like this one, I prefer to fix it, and treat it as a 'black box'.
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic
2024-10-10 15:19 ` Stephen Hemminger
@ 2024-10-11 2:38 ` Chaoyong He
0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-11 2:38 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, oss-drivers, stable, Long Wu, Nole Zhang
> On Thu, 10 Oct 2024 17:17:16 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
>
> > Fix one memory leak problem in the logic of VF initialization.
> >
> > Fixes: d81e2b514dc9 ("net/nfp: move device info into process private
> > data")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
> > ---
>
> The code as is looks fine, but would have been better to use rte_calloc() when
> allocating eth_xstats_base.
Yes, I think what you said is better.
Will do it in next version.
Thanks for your review.
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
@ 2024-10-12 2:40 ` Chaoyong He
2024-10-12 2:45 ` Stephen Hemminger
2024-10-12 2:41 ` [PATCH v2 05/10] net/nfp: fix problem caused by configure function Chaoyong He
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:40 UTC (permalink / raw)
To: dev; +Cc: oss-drivers, Chaoyong He, peng.zhang, stable, Long Wu
The original logic keeps using the same name parameter when malloc
memory in secondary process, which may cause error when using
multiple PF cards.
Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
Cc: peng.zhang@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 64a06440f5..3732abc9fe 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -2669,7 +2669,8 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Allocate memory for the PF "device" */
- snprintf(name, sizeof(name), "nfp_pf%d", 0);
+ function_id = pci_dev->addr.function & 0x7;
+ snprintf(name, sizeof(name), "nfp_pf%d", function_id);
pf_dev = rte_zmalloc(name, sizeof(*pf_dev), 0);
if (pf_dev == NULL) {
PMD_INIT_LOG(ERR, "Can't allocate memory for the PF device");
@@ -2714,7 +2715,6 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
}
/* Read the app ID of the firmware loaded */
- function_id = pci_dev->addr.function & 0x7;
snprintf(app_name, sizeof(app_name), "_pf%u_net_app_id", function_id);
app_fw_id = nfp_rtsym_read_le(sym_tbl, app_name, &ret);
if (ret != 0) {
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 05/10] net/nfp: fix problem caused by configure function
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
2024-10-12 2:40 ` [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
@ 2024-10-12 2:41 ` Chaoyong He
2024-10-12 2:41 ` [PATCH v2 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
` (2 subsequent siblings)
4 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:41 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang, Stephen Hemminger
The return value of 'nfp_eth_set_configured()' is three ways, the
original logic considered it as two ways wrongly.
Fixes: 61d4008fe6bb ("net/nfp: support setting link up/down")
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/nfp/nfp_ethdev.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 405386e882..2fe6b1a292 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -527,26 +527,36 @@ nfp_net_start(struct rte_eth_dev *dev)
static int
nfp_net_set_link_up(struct rte_eth_dev *dev)
{
+ int ret;
struct nfp_net_hw *hw;
struct nfp_net_hw_priv *hw_priv;
hw = dev->data->dev_private;
hw_priv = dev->process_private;
- return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+ ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
/* Set the link down. */
static int
nfp_net_set_link_down(struct rte_eth_dev *dev)
{
+ int ret;
struct nfp_net_hw *hw;
struct nfp_net_hw_priv *hw_priv;
hw = dev->data->dev_private;
hw_priv = dev->process_private;
- return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+ ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+ if (ret < 0)
+ return ret;
+
+ return 0;
}
static void
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 07/10] net/nfp: fix problem caused by commit end function
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
2024-10-12 2:40 ` [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
2024-10-12 2:41 ` [PATCH v2 05/10] net/nfp: fix problem caused by configure function Chaoyong He
@ 2024-10-12 2:41 ` Chaoyong He
2024-10-12 2:41 ` [PATCH v2 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
2024-10-12 2:41 ` [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
4 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:41 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Chaoyong He, zerun.fu, stable, Long Wu, Peng Zhang,
Stephen Hemminger
The return value of 'nfp_eth_config_commit_end()' is three ways, the
original logic considered it as two ways wrongly.
Fixes: 68aa35373a94 ("net/nfp: support setting pause frame switch mode")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/nfp/nfp_net_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 80d60515d8..5c3a9a7ae7 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2520,7 +2520,7 @@ nfp_net_pause_frame_set(struct nfp_net_hw_priv *hw_priv,
}
err = nfp_eth_config_commit_end(nsp);
- if (err != 0) {
+ if (err < 0) {
PMD_DRV_LOG(ERR, "Failed to configure pause frame.");
return err;
}
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 08/10] net/nfp: fix problem caused by FEC set
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
` (2 preceding siblings ...)
2024-10-12 2:41 ` [PATCH v2 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
@ 2024-10-12 2:41 ` Chaoyong He
2024-10-12 2:41 ` [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
4 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:41 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Chaoyong He, zerun.fu, stable, Long Wu, Peng Zhang,
Stephen Hemminger
The return value of 'nfp_eth_set_fec()' is three ways, the original
logic considered it as two ways wrongly.
Fixes: 37bd1b843a20 ("net/nfp: support setting FEC mode")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/nfp/nfp_net_common.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 5c3a9a7ae7..b986ed4622 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2692,6 +2692,7 @@ int
nfp_net_fec_set(struct rte_eth_dev *dev,
uint32_t fec_capa)
{
+ int ret;
uint8_t idx;
enum nfp_eth_fec fec;
uint32_t supported_fec;
@@ -2724,7 +2725,13 @@ nfp_net_fec_set(struct rte_eth_dev *dev,
return -EIO;
}
- return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
+ ret = nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
+ if (ret < 0) {
+ PMD_DRV_LOG(ERR, "NFP set FEC mode failed.");
+ return ret;
+ }
+
+ return 0;
}
uint32_t
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
` (3 preceding siblings ...)
2024-10-12 2:41 ` [PATCH v2 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
@ 2024-10-12 2:41 ` Chaoyong He
4 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:41 UTC (permalink / raw)
To: dev
Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang, Stephen Hemminger
Fix one memory leak problem in the logic of VF initialization.
Fixes: d81e2b514dc9 ("net/nfp: move device info into process private data")
Cc: stable@dpdk.org
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/net/nfp/nfp_ethdev_vf.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index ab413a2c5a..0aadca9010 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -322,12 +322,13 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- net_hw->eth_xstats_base = rte_malloc("rte_eth_xstat",
- sizeof(struct rte_eth_xstat) * nfp_net_xstats_size(eth_dev), 0);
+ net_hw->eth_xstats_base = rte_calloc("rte_eth_xstat",
+ nfp_net_xstats_size(eth_dev), sizeof(struct rte_eth_xstat), 0);
if (net_hw->eth_xstats_base == NULL) {
PMD_INIT_LOG(ERR, "No memory for xstats base values on device %s!",
pci_dev->device.name);
- return -ENOMEM;
+ err = -ENOMEM;
+ goto hw_priv_free;
}
/* Work out where in the BAR the queues start. */
--
2.39.1
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process
2024-10-12 2:40 ` [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
@ 2024-10-12 2:45 ` Stephen Hemminger
2024-10-12 2:47 ` Chaoyong He
0 siblings, 1 reply; 19+ messages in thread
From: Stephen Hemminger @ 2024-10-12 2:45 UTC (permalink / raw)
To: Chaoyong He; +Cc: dev, oss-drivers, peng.zhang, stable, Long Wu
On Sat, 12 Oct 2024 10:40:59 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:
> The original logic keeps using the same name parameter when malloc
> memory in secondary process, which may cause error when using
> multiple PF cards.
>
> Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
> Cc: peng.zhang@corigine.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Long Wu <long.wu@corigine.com>
> Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
How, the name is ignore mostly by malloc. Only used for tracing.
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process
2024-10-12 2:45 ` Stephen Hemminger
@ 2024-10-12 2:47 ` Chaoyong He
0 siblings, 0 replies; 19+ messages in thread
From: Chaoyong He @ 2024-10-12 2:47 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, oss-drivers, Nole Zhang, stable, Long Wu
> On Sat, 12 Oct 2024 10:40:59 +0800
> Chaoyong He <chaoyong.he@corigine.com> wrote:
>
> > The original logic keeps using the same name parameter when malloc
> > memory in secondary process, which may cause error when using multiple
> > PF cards.
> >
> > Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
> > Cc: peng.zhang@corigine.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> > Reviewed-by: Long Wu <long.wu@corigine.com>
> > Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
>
> How, the name is ignore mostly by malloc. Only used for tracing.
Okay, If you insist, we can abandon this one.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2024-10-12 2:47 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20241010091716.3631747-1-chaoyong.he@corigine.com>
2024-10-10 9:17 ` [PATCH 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
2024-10-10 15:07 ` Stephen Hemminger
2024-10-11 2:31 ` Chaoyong He
2024-10-10 9:17 ` [PATCH 05/10] net/nfp: fix problem caused by configure function Chaoyong He
2024-10-10 15:13 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
2024-10-10 15:15 ` Stephen Hemminger
2024-10-10 9:17 ` [PATCH 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
2024-10-10 15:19 ` Stephen Hemminger
2024-10-11 2:38 ` Chaoyong He
[not found] ` <20241012024107.3795935-1-chaoyong.he@corigine.com>
2024-10-12 2:40 ` [PATCH v2 02/10] net/nfp: fix malloc name problem in secondary process Chaoyong He
2024-10-12 2:45 ` Stephen Hemminger
2024-10-12 2:47 ` Chaoyong He
2024-10-12 2:41 ` [PATCH v2 05/10] net/nfp: fix problem caused by configure function Chaoyong He
2024-10-12 2:41 ` [PATCH v2 07/10] net/nfp: fix problem caused by commit end function Chaoyong He
2024-10-12 2:41 ` [PATCH v2 08/10] net/nfp: fix problem caused by FEC set Chaoyong He
2024-10-12 2:41 ` [PATCH v2 10/10] net/nfp: fix memory leak in VF initialization logic Chaoyong He
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).