patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 21.11] net/nfp: fix MTU configuration order
@ 2023-03-22 15:48 Niklas Söderlund
  2023-03-23 15:18 ` Kevin Traynor
  2023-03-30  8:54 ` Kevin Traynor
  0 siblings, 2 replies; 3+ messages in thread
From: Niklas Söderlund @ 2023-03-22 15:48 UTC (permalink / raw)
  To: stable; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Niklas Söderlund

From: Peng Zhang <peng.zhang@corigine.com>

[ upstream commit 4352a3bcee3a4cc20c8accb71d683d5add3c6f80 ]

If rte_eth_dev_set_mtu() is called before rte_eth_rx_queue_setup() the
NFP driver setup fails. This is because the default values evaluated
when setting the MTU are initialized in the rte_eth_rx_queue_setup()
code path. Fix this by instead initializing the MTU default values in
the device initialization, in nfp_net_init() and the check also is
conducted in nfp_net_start(), so it doesn't influence the result.

This was found by using DPDK with OVS.

Fixes: dbad6f64f921 ("net/nfp: fix internal buffer size and MTU check")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
 drivers/net/nfp/nfp_common.c    | 4 ++--
 drivers/net/nfp/nfp_common.h    | 1 +
 drivers/net/nfp/nfp_ethdev.c    | 1 +
 drivers/net/nfp/nfp_ethdev_vf.c | 1 +
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index ae087d0153d8..279c3446669c 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -969,9 +969,9 @@ nfp_net_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	/* MTU larger then current mbufsize not supported */
+	/* MTU larger than current mbufsize not supported */
 	if (mtu > hw->flbufsz) {
-		PMD_DRV_LOG(ERR, "MTU (%u) larger then current mbufsize (%u) not supported",
+		PMD_DRV_LOG(ERR, "MTU (%u) larger than current mbufsize (%u) not supported",
 			    mtu, hw->flbufsz);
 		return -ERANGE;
 	}
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8db5ec23f8fd..466e5a79322d 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -100,6 +100,7 @@ struct nfp_net_adapter;
 
 /* Maximum supported NFP frame size (MTU + layer 2 headers) */
 #define NFP_FRAME_SIZE_MAX	10048
+#define DEFAULT_FLBUF_SIZE	9216
 
 #include <linux/types.h>
 #include <rte_io.h>
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 8f922e446540..748bacff0796 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -509,6 +509,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
 	hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
 	hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
 	hw->mtu = RTE_ETHER_MTU;
+	hw->flbufsz = DEFAULT_FLBUF_SIZE;
 
 	/* VLAN insertion is incompatible with LSOv2 */
 	if (hw->cap & NFP_NET_CFG_CTRL_LSO2)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0034d68ea63f..14d4864c1eb8 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -369,6 +369,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
 	hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
 	hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
 	hw->mtu = RTE_ETHER_MTU;
+	hw->flbufsz = DEFAULT_FLBUF_SIZE;
 
 	/* VLAN insertion is incompatible with LSOv2 */
 	if (hw->cap & NFP_NET_CFG_CTRL_LSO2)
-- 
2.40.0


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

* Re: [PATCH 21.11] net/nfp: fix MTU configuration order
  2023-03-22 15:48 [PATCH 21.11] net/nfp: fix MTU configuration order Niklas Söderlund
@ 2023-03-23 15:18 ` Kevin Traynor
  2023-03-30  8:54 ` Kevin Traynor
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Traynor @ 2023-03-23 15:18 UTC (permalink / raw)
  To: Niklas Söderlund, stable; +Cc: oss-drivers, Peng Zhang, Chaoyong He

On 22/03/2023 15:48, Niklas Söderlund wrote:
> From: Peng Zhang <peng.zhang@corigine.com>
> 
> [ upstream commit 4352a3bcee3a4cc20c8accb71d683d5add3c6f80 ]
> 
> If rte_eth_dev_set_mtu() is called before rte_eth_rx_queue_setup() the
> NFP driver setup fails. This is because the default values evaluated
> when setting the MTU are initialized in the rte_eth_rx_queue_setup()
> code path. Fix this by instead initializing the MTU default values in
> the device initialization, in nfp_net_init() and the check also is
> conducted in nfp_net_start(), so it doesn't influence the result.
> 
> This was found by using DPDK with OVS.
> 
> Fixes: dbad6f64f921 ("net/nfp: fix internal buffer size and MTU check")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
>   drivers/net/nfp/nfp_common.c    | 4 ++--
>   drivers/net/nfp/nfp_common.h    | 1 +
>   drivers/net/nfp/nfp_ethdev.c    | 1 +
>   drivers/net/nfp/nfp_ethdev_vf.c | 1 +
>   4 files changed, 5 insertions(+), 2 deletions(-)
> 

Thanks Niklas. I have added to the queue and will push to the branch 
with the next batch tomorrow.

Kevin.


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

* Re: [PATCH 21.11] net/nfp: fix MTU configuration order
  2023-03-22 15:48 [PATCH 21.11] net/nfp: fix MTU configuration order Niklas Söderlund
  2023-03-23 15:18 ` Kevin Traynor
@ 2023-03-30  8:54 ` Kevin Traynor
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Traynor @ 2023-03-30  8:54 UTC (permalink / raw)
  To: Niklas Söderlund, stable; +Cc: oss-drivers, Peng Zhang, Chaoyong He

On 22/03/2023 15:48, Niklas Söderlund wrote:
> From: Peng Zhang <peng.zhang@corigine.com>
> 
> [ upstream commit 4352a3bcee3a4cc20c8accb71d683d5add3c6f80 ]
> 
> If rte_eth_dev_set_mtu() is called before rte_eth_rx_queue_setup() the
> NFP driver setup fails. This is because the default values evaluated
> when setting the MTU are initialized in the rte_eth_rx_queue_setup()
> code path. Fix this by instead initializing the MTU default values in
> the device initialization, in nfp_net_init() and the check also is
> conducted in nfp_net_start(), so it doesn't influence the result.
> 
> This was found by using DPDK with OVS.
> 
> Fixes: dbad6f64f921 ("net/nfp: fix internal buffer size and MTU check")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
>   drivers/net/nfp/nfp_common.c    | 4 ++--
>   drivers/net/nfp/nfp_common.h    | 1 +
>   drivers/net/nfp/nfp_ethdev.c    | 1 +
>   drivers/net/nfp/nfp_ethdev_vf.c | 1 +
>   4 files changed, 5 insertions(+), 2 deletions(-)
> 

Thanks Niklas. Applied and pushed to 21.11 branch.
Kevin.


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

end of thread, other threads:[~2023-03-30  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 15:48 [PATCH 21.11] net/nfp: fix MTU configuration order Niklas Söderlund
2023-03-23 15:18 ` Kevin Traynor
2023-03-30  8:54 ` Kevin Traynor

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