From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com,
Peng Zhang <peng.zhang@corigine.com>,
stable@dpdk.org
Subject: [PATCH v2] net/nfp: ensure the MTU can work
Date: Fri, 21 Oct 2022 14:27:46 +0800 [thread overview]
Message-ID: <1666333666-38183-1-git-send-email-chaoyong.he@corigine.com> (raw)
In-Reply-To: <1665384495-24990-1-git-send-email-chaoyong.he@corigine.com>
From: Peng Zhang <peng.zhang@corigine.com>
When MTU is bigger than hw->flbufsz, it can't work. hw->flbufsz is set in
the nfp_net_rx_queue_setup().
At first, in the nfp_net_configure(), the hw->flbufsz isn't set the value,
it just judge the initialized value and MTU, it is unreasonable.
Now, it just check the MTU can't be more than the NFP_FRAME_SIZE_MAX in
the nfp_net_configure(), when hw->flbufsz is set the value, in the
nfp_net_start(), judge the hw->flbufsz and MTU.
Fixes: 5c305e218f15 ("net/nfp: fix initialization")
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>
* Changes since v1
- Remove the assignment in init() and move the check to nfp_net_start().
---
drivers/net/nfp/nfp_common.c | 6 +++---
drivers/net/nfp/nfp_ethdev.c | 8 +++++++-
drivers/net/nfp/nfp_ethdev_vf.c | 1 -
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 0e55f0c..289c70f 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -177,9 +177,9 @@
}
/* Checking MTU set */
- if (rxmode->mtu > hw->flbufsz) {
- PMD_INIT_LOG(INFO, "MTU (%u) larger then current mbufsize (%u) not supported",
- rxmode->mtu, hw->flbufsz);
+ if (rxmode->mtu > NFP_FRAME_SIZE_MAX) {
+ PMD_INIT_LOG(ERR, "MTU (%u) larger than NFP_FRAME_SIZE_MAX (%u) not supported",
+ rxmode->mtu, NFP_FRAME_SIZE_MAX);
return -ERANGE;
}
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 5cdd34e..3b952fa 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -110,6 +110,13 @@
update = NFP_NET_CFG_UPDATE_MSIX;
}
+ /* Checking MTU set */
+ if (dev->data->mtu > hw->flbufsz) {
+ PMD_INIT_LOG(ERR, "MTU (%u) can't be larger than the current NFP_FRAME_SIZE (%u)",
+ dev->data->mtu, hw->flbufsz);
+ return -ERANGE;
+ }
+
rte_intr_enable(intr_handle);
new_ctrl = nfp_check_offloads(dev);
@@ -517,7 +524,6 @@
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 = RTE_ETHER_MTU;
/* 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 d304d78..3f4ad3e 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -396,7 +396,6 @@
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 = RTE_ETHER_MTU;
/* VLAN insertion is incompatible with LSOv2 */
if (hw->cap & NFP_NET_CFG_CTRL_LSO2)
--
1.8.3.1
next prev parent reply other threads:[~2022-10-21 6:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-10 6:48 [PATCH] net/nfp: set the appropriate initialized value of flbufsz Chaoyong He
2022-10-13 12:00 ` Ferruh Yigit
2022-10-15 7:38 ` Nole Zhang
2022-10-17 12:11 ` Ferruh Yigit
2022-10-18 1:41 ` Nole Zhang
2022-10-18 7:51 ` Ferruh Yigit
2022-10-18 8:51 ` Nole Zhang
2022-10-18 9:36 ` Ferruh Yigit
2022-10-18 9:50 ` Nole Zhang
2022-10-18 10:42 ` Ferruh Yigit
2022-10-21 6:27 ` Chaoyong He [this message]
2022-10-21 9:59 ` [PATCH v2] net/nfp: ensure the MTU can work Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1666333666-38183-1-git-send-email-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=niklas.soderlund@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).