From 586e6028371764452b7dbae3b1f50adde87be80e Mon Sep 17 00:00:00 2001 From: Jiawen Wu Date: Thu, 21 Oct 2021 17:50:04 +0800 Subject: [PATCH] net/ngbe: support jumbo frame Add to support Rx jumbo frames. Signed-off-by: Jiawen Wu --- doc/guides/nics/ngbe.rst | 1 + drivers/net/ngbe/ngbe_ethdev.h | 3 +++ drivers/net/ngbe/ngbe_rxtx.c | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/guides/nics/ngbe.rst b/doc/guides/nics/ngbe.rst index 6a6ae392438..702a4550418 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 286cb893d69..b270343a3ee 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 6687d58e6a3..48983fedbdc 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++) {