[06/32] net/ngbe: support jumbo frame

Message ID 20210908083758.312055-7-jiawenwu@trustnetic.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series net/ngbe: add many features |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jiawen Wu Sept. 8, 2021, 8:37 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_rxtx.c      | 11 ++++++++++-
 3 files changed, 12 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Sept. 15, 2021, 4:48 p.m. UTC | #1
On 9/8/2021 9:37 AM, Jiawen Wu wrote:
> 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_rxtx.c      | 11 ++++++++++-
>  3 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
> index 2a472d9434..30fdfe62c7 100644
> --- a/doc/guides/nics/features/ngbe.ini
> +++ b/doc/guides/nics/features/ngbe.ini
> @@ -8,6 +8,7 @@ Speed capabilities   = Y
>  Link status          = Y
>  Link status event    = Y
>  Queue start/stop     = Y
> +Jumbo frame          = Y
>  Scattered Rx         = Y
>  TSO                  = Y
>  CRC offload          = P
> 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_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
> index f9d8cf9d19..4238fbe3b8 100644
> --- a/drivers/net/ngbe/ngbe_rxtx.c
> +++ b/drivers/net/ngbe/ngbe_rxtx.c
> @@ -2008,6 +2008,7 @@ ngbe_get_rx_port_offloads(struct rte_eth_dev *dev __rte_unused)
>  		   DEV_RX_OFFLOAD_UDP_CKSUM   |
>  		   DEV_RX_OFFLOAD_TCP_CKSUM   |
>  		   DEV_RX_OFFLOAD_KEEP_CRC    |
> +		   DEV_RX_OFFLOAD_JUMBO_FRAME |

There is a patch to remove this offload flag [1], would you be OK to postpone
this patch?

[1]
https://patches.dpdk.org/project/dpdk/list/?series=17956
  

Patch

diff --git a/doc/guides/nics/features/ngbe.ini b/doc/guides/nics/features/ngbe.ini
index 2a472d9434..30fdfe62c7 100644
--- a/doc/guides/nics/features/ngbe.ini
+++ b/doc/guides/nics/features/ngbe.ini
@@ -8,6 +8,7 @@  Speed capabilities   = Y
 Link status          = Y
 Link status event    = Y
 Queue start/stop     = Y
+Jumbo frame          = Y
 Scattered Rx         = Y
 TSO                  = Y
 CRC offload          = P
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_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index f9d8cf9d19..4238fbe3b8 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -2008,6 +2008,7 @@  ngbe_get_rx_port_offloads(struct rte_eth_dev *dev __rte_unused)
 		   DEV_RX_OFFLOAD_UDP_CKSUM   |
 		   DEV_RX_OFFLOAD_TCP_CKSUM   |
 		   DEV_RX_OFFLOAD_KEEP_CRC    |
+		   DEV_RX_OFFLOAD_JUMBO_FRAME |
 		   DEV_RX_OFFLOAD_SCATTER;
 
 	return offloads;
@@ -2314,8 +2315,16 @@  ngbe_dev_rx_init(struct rte_eth_dev *dev)
 	hlreg0 &= ~NGBE_SECRXCTL_XDSA;
 	wr32(hw, NGBE_SECRXCTL, hlreg0);
 
-	wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
+	/*
+	 * Configure jumbo frame support, if any.
+	 */
+	if (rx_conf->offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
+		wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
+			NGBE_FRMSZ_MAX(rx_conf->max_rx_pkt_len));
+	} else {
+		wr32m(hw, NGBE_FRMSZ, NGBE_FRMSZ_MAX_MASK,
 			NGBE_FRMSZ_MAX(NGBE_FRAME_SIZE_DFT));
+	}
 
 	/* Setup Rx queues */
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {