diff mbox series

[v2,07/26] net/ngbe: support jumbo frame

Message ID 20211021095023.18288-8-jiawenwu@trustnetic.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series net/ngbe: add many features | expand

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Jiawen Wu Oct. 21, 2021, 9:50 a.m. UTC
Add to support Rx jumbo frames.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 doc/guides/nics/features/ngbe.ini | 1 +
 doc/guides/nics/ngbe.rst          | 1 +
 drivers/net/ngbe/ngbe_ethdev.h    | 3 +++
 drivers/net/ngbe/ngbe_rxtx.c      | 5 ++++-
 4 files changed, 9 insertions(+), 1 deletion(-)

Comments

Ferruh Yigit Oct. 29, 2021, 10:17 p.m. UTC | #1
On 10/21/2021 10:50 AM, Jiawen Wu wrote:
> diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
> index 053dff3a2f..9785820ea0 100644
> --- a/doc/guides/nics/features/ngbe.ini
> +++ b/doc/guides/nics/features/ngbe.ini
> @@ -9,6 +9,7 @@ Link status          = Y
>   Link status event    = Y
>   Queue start/stop     = Y
>   Burst mode info      = Y
> +Jumbo frame          = Y
>   Scattered Rx         = Y
>   TSO                  = Y

This feature is removed, will clean it in next-net.
diff mbox series

Patch

diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
index 053dff3a2f..9785820ea0 100644
--- a/doc/guides/nics/features/ngbe.ini
+++ b/doc/guides/nics/features/ngbe.ini
@@ -9,6 +9,7 @@  Link status          = Y
 Link status event    = Y
 Queue start/stop     = Y
 Burst mode info      = Y
+Jumbo frame          = Y
 Scattered Rx         = Y
 TSO                  = Y
 CRC offload          = Y
diff --git a/doc/guides/nics/ngbe.rst b/doc/guides/nics/ngbe.rst
index 6a6ae39243..702a455041 100644
--- a/doc/guides/nics/ngbe.rst
+++ b/doc/guides/nics/ngbe.rst
@@ -14,6 +14,7 @@  Features
 - Packet type information
 - Checksum offload
 - TSO offload
+- Jumbo frames
 - Link state information
 - Scattered and gather for TX and RX
 
diff --git a/drivers/net/ngbe/ngbe_ethdev.h b/drivers/net/ngbe/ngbe_ethdev.h
index 286cb893d6..b270343a3e 100644
--- a/drivers/net/ngbe/ngbe_ethdev.h
+++ b/drivers/net/ngbe/ngbe_ethdev.h
@@ -17,6 +17,9 @@ 
 
 #define NGBE_QUEUE_ITR_INTERVAL_DEFAULT	500 /* 500us */
 
+/* The overhead from MTU to max frame size. */
+#define NGBE_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN)
+
 #define NGBE_MISC_VEC_ID               RTE_INTR_VEC_ZERO_OFFSET
 #define NGBE_RX_VEC_START              RTE_INTR_VEC_RXTX_OFFSET
 
diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index df265bd447..b49303094e 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -2364,8 +2364,11 @@  ngbe_dev_rx_init(struct rte_eth_dev *dev)
 	hlreg0 &= ~NGBE_SECRXCTL_XDSA;
 	wr32(hw, NGBE_SECRXCTL, hlreg0);
 
+	/*
+	 * Configure jumbo frame support, if any.
+	 */
 	wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
-			NGBE_FRMSZ_MAX(NGBE_FRAME_SIZE_DFT));
+		NGBE_FRMSZ_MAX(dev->data->mtu + NGBE_ETH_OVERHEAD));
 
 	/* Setup Rx queues */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {