DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>, stable@dpdk.org
Subject: [PATCH 7/9] net/ngbe: fix max frame size
Date: Fri,  2 Sep 2022 11:00:09 +0800	[thread overview]
Message-ID: <20220902030011.377523-8-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20220902030011.377523-1-jiawenwu@trustnetic.com>

Remain the same max frame size after the device restarts.

Fixes: 07baabb6a51a ("net/ngbe: support MTU set")
Cc: stable@dpdk.org

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ngbe/base/ngbe_regs.h |  2 +-
 drivers/net/ngbe/base/ngbe_type.h |  2 +-
 drivers/net/ngbe/ngbe_ethdev.c    | 10 +++-------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ngbe/base/ngbe_regs.h b/drivers/net/ngbe/base/ngbe_regs.h
index 640e385990..c0e79a2ba7 100644
--- a/drivers/net/ngbe/base/ngbe_regs.h
+++ b/drivers/net/ngbe/base/ngbe_regs.h
@@ -525,7 +525,7 @@ enum ngbe_5tuple_protocol {
 #define   NGBE_PSRCTL_LBENA	       MS(18, 0x1)
 #define NGBE_FRMSZ		       0x015020
 #define   NGBE_FRMSZ_MAX_MASK	       MS(0, 0xFFFF)
-#define   NGBE_FRMSZ_MAX(v)	       LS(v, 0, 0xFFFF)
+#define   NGBE_FRMSZ_MAX(v)	       LS((v) + 4, 0, 0xFFFF)
 #define NGBE_VLANCTL		       0x015088
 #define   NGBE_VLANCTL_TPID_MASK       MS(0, 0xFFFF)
 #define   NGBE_VLANCTL_TPID(v)	       LS(v, 0, 0xFFFF)
diff --git a/drivers/net/ngbe/base/ngbe_type.h b/drivers/net/ngbe/base/ngbe_type.h
index 73111f7950..aa5c41146c 100644
--- a/drivers/net/ngbe/base/ngbe_type.h
+++ b/drivers/net/ngbe/base/ngbe_type.h
@@ -9,7 +9,7 @@
 #define NGBE_LINK_UP_TIME	90 /* 9.0 Seconds */
 
 #define NGBE_FRAME_SIZE_MAX       (9728) /* Maximum frame size, +FCS */
-#define NGBE_FRAME_SIZE_DFT       (1522) /* Default frame size, +FCS */
+#define NGBE_FRAME_SIZE_DFT       (1518) /* Default frame size, +FCS */
 #define NGBE_NUM_POOL             (32)
 #define NGBE_PBRXSIZE_MAX         0x00080000 /* 512KB Packet Buffer */
 #define NGBE_PBTXSIZE_MAX         0x00005000 /* 20KB Packet Buffer */
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index df32bf64ff..1090ba9a11 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -2473,7 +2473,7 @@ static int
 ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct ngbe_hw *hw = ngbe_dev_hw(dev);
-	uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + 4;
+	uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
 	struct rte_eth_dev_data *dev_data = dev->data;
 
 	/* If device is started, refuse mtu that requires the support of
@@ -2486,12 +2486,8 @@ ngbe_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EINVAL;
 	}
 
-	if (hw->mode)
-		wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
-			NGBE_FRAME_SIZE_MAX);
-	else
-		wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
-			NGBE_FRMSZ_MAX(frame_size));
+	wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
+		NGBE_FRMSZ_MAX(frame_size));
 
 	return 0;
 }
-- 
2.27.0


  parent reply	other threads:[~2022-09-02  3:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02  3:00 [PATCH 0/9] Wangxun fixes and supports Jiawen Wu
2022-09-02  3:00 ` [PATCH 1/9] net/txgbe: fix IPv6 rule in flow director Jiawen Wu
2022-09-02  3:00 ` [PATCH 2/9] net/txgbe: fix OEM customized LED Jiawen Wu
2022-09-02  3:00 ` [PATCH 3/9] net/txgbe: remove semaphore between SW/FW Jiawen Wu
2022-09-02  3:00 ` [PATCH 4/9] net/txgbe: rename some extended statistic Jiawen Wu
2022-09-02  3:00 ` [PATCH 5/9] net/ngbe: " Jiawen Wu
2022-09-02  3:00 ` [PATCH 6/9] net/ngbe: remove semaphore between SW/FW Jiawen Wu
2022-09-02  3:00 ` Jiawen Wu [this message]
2022-09-02  3:00 ` [PATCH 8/9] net/ngbe: fix YT PHY mixed mode occasionally failing link Jiawen Wu
2022-09-02  3:00 ` [PATCH 9/9] net/ngbe: support to set link down/up Jiawen Wu
2022-09-21 11:46   ` Ferruh Yigit
2022-09-13  1:55 ` [PATCH 0/9] Wangxun fixes and supports Jiawen Wu
2022-09-21 11:48 ` 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=20220902030011.377523-8-jiawenwu@trustnetic.com \
    --to=jiawenwu@trustnetic.com \
    --cc=dev@dpdk.org \
    --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).