From: Guoyang Zhou <zhouguoyang@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <bluca@debian.org>,
<cloud.wangxiaoyun@huawei.com>, <luoxianjun@huawei.com>,
<yin.yinshi@huawei.com>, <luojiachen@huawei.com>,
<zhouguoyang@huawei.com>, <chenlizhong@huawei.com>,
<zhaohui8@huawei.com>, <chenchanghu@huawei.com>,
<stevex.yang@intel.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v1 3/3] net/hinic: fix the problem of MTU inconsistent
Date: Fri, 16 Jul 2021 17:54:30 +0800 [thread overview]
Message-ID: <bc6ea5994135fc1d207b6e29239f77b12371999d.1626429126.git.zhouguoyang@huawei.com> (raw)
In-Reply-To: <cover.1626429126.git.zhouguoyang@huawei.com>
The configuration of mtu is inconsistent in the driver and
firmware when the port is stopped, started and reconfigured.
Before, HINIC_MAX_JUMBO_FRAME_SIZE include vlan tag, but when
frame and pktlen are converted to each other do not include
vlan tag. And port_mtu_set function will use HINIC_MAX_JUMBO_FRAME_SIZE
to calculate eth_overhead, so mtu will be inconsistent in the driver and
firmware.
Fixes: e542ab51ab27 ("net/hinic: fix jumbo frame flag condition for MTU set")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
---
drivers/net/hinic/base/hinic_pmd_niccfg.h | 9 ---------
drivers/net/hinic/hinic_pmd_ethdev.c | 9 ---------
drivers/net/hinic/hinic_pmd_ethdev.h | 17 +++++++++++++++++
3 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.h b/drivers/net/hinic/base/hinic_pmd_niccfg.h
index 04cd374..0d0a670 100644
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.h
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.h
@@ -116,15 +116,6 @@ enum hinic_link_mode {
#define HINIC_DEFAULT_RX_MODE (HINIC_RX_MODE_UC | HINIC_RX_MODE_MC | \
HINIC_RX_MODE_BC)
-#define HINIC_MAX_MTU_SIZE (9600)
-#define HINIC_MIN_MTU_SIZE (256)
-
-/* MIN_MTU + ETH_HLEN + CRC (256+14+4) */
-#define HINIC_MIN_FRAME_SIZE 274
-
-/* MAX_MTU + ETH_HLEN + CRC + VLAN(9600+14+4+4) */
-#define HINIC_MAX_JUMBO_FRAME_SIZE (9622)
-
#define HINIC_PORT_DISABLE 0x0
#define HINIC_PORT_ENABLE 0x3
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 75849f2..1a72401 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -69,15 +69,6 @@
#define HINIC_VLAN_FILTER_EN (1U << 0)
-#define HINIC_MTU_TO_PKTLEN(mtu) \
- ((mtu) + ETH_HLEN + ETH_CRC_LEN)
-
-#define HINIC_PKTLEN_TO_MTU(pktlen) \
- ((pktlen) - (ETH_HLEN + ETH_CRC_LEN))
-
-/* The max frame size with default MTU */
-#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + ETH_HLEN + ETH_CRC_LEN)
-
/* lro numer limit for one packet */
#define HINIC_LRO_WQE_NUM_DEFAULT 8
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h
index 70b4d32..8f1b3d5 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.h
+++ b/drivers/net/hinic/hinic_pmd_ethdev.h
@@ -32,6 +32,23 @@
#define HINIC_UINT32_BIT_SIZE (CHAR_BIT * sizeof(uint32_t))
#define HINIC_VFTA_SIZE (4096 / HINIC_UINT32_BIT_SIZE)
+#define HINIC_MAX_MTU_SIZE 9600
+#define HINIC_MIN_MTU_SIZE 256
+
+#define HINIC_VLAN_TAG_SIZE 4
+#define HINIC_ETH_OVERHEAD \
+ (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + HINIC_VLAN_TAG_SIZE * 2)
+
+#define HINIC_MIN_FRAME_SIZE (HINIC_MIN_MTU_SIZE + HINIC_ETH_OVERHEAD)
+#define HINIC_MAX_JUMBO_FRAME_SIZE (HINIC_MAX_MTU_SIZE + HINIC_ETH_OVERHEAD)
+
+#define HINIC_MTU_TO_PKTLEN(mtu) ((mtu) + HINIC_ETH_OVERHEAD)
+
+#define HINIC_PKTLEN_TO_MTU(pktlen) ((pktlen) - HINIC_ETH_OVERHEAD)
+
+/* The max frame size with default MTU */
+#define HINIC_ETH_MAX_LEN (RTE_ETHER_MTU + HINIC_ETH_OVERHEAD)
+
enum hinic_dev_status {
HINIC_DEV_INIT,
HINIC_DEV_CLOSE,
--
1.8.3.1
next prev parent reply other threads:[~2021-07-16 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 9:54 [dpdk-dev] [PATCH v1 0/3] fix some problems of mtu, vlan, lro Guoyang Zhou
2021-07-16 9:54 ` [dpdk-dev] [PATCH v1 1/3] net/hinic: increase the protection of the VLAN Guoyang Zhou
2021-07-16 9:54 ` [dpdk-dev] [PATCH v1 2/3] net/hinic/base: fix the problem of LRO Guoyang Zhou
2021-07-16 9:54 ` Guoyang Zhou [this message]
2021-07-23 13:39 ` [dpdk-dev] [PATCH v1 0/3] fix some problems of mtu, vlan, lro Thomas Monjalon
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=bc6ea5994135fc1d207b6e29239f77b12371999d.1626429126.git.zhouguoyang@huawei.com \
--to=zhouguoyang@huawei.com \
--cc=bluca@debian.org \
--cc=chenchanghu@huawei.com \
--cc=chenlizhong@huawei.com \
--cc=cloud.wangxiaoyun@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=luojiachen@huawei.com \
--cc=luoxianjun@huawei.com \
--cc=stable@dpdk.org \
--cc=stevex.yang@intel.com \
--cc=yin.yinshi@huawei.com \
--cc=zhaohui8@huawei.com \
/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).