diff mbox series

[net,3/3] ixgbe: add double of VLAN header when computing the max MTU

Message ID 20230204133535.99921-4-kerneljasonxing@gmail.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series Fix MTU related issues | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 1 this patch: 1
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 1 this patch: 1
netdev/source_inline success Was 0 now: 0

Commit Message

Jason Xing Feb. 4, 2023, 1:35 p.m. UTC
From: Jason Xing <kernelxing@tencent.com>

Include the second VLAN HLEN into account when computing the maximum
MTU size as other drivers do.

Fixes: fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP")
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      | 2 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Jason Xing Feb. 9, 2023, 12:47 a.m. UTC | #1
CC Alexander Duyck

Hello Alexander, thanks for reviewing the other two patches of this
patchset last night. Would you mind reviewing the last one? :)

Thanks,
Jason

On Sat, Feb 4, 2023 at 9:36 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> From: Jason Xing <kernelxing@tencent.com>
>
> Include the second VLAN HLEN into account when computing the maximum
> MTU size as other drivers do.
>
> Fixes: fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP")
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe.h      | 2 ++
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +--
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> index bc68b8f2176d..8736ca4b2628 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
> @@ -73,6 +73,8 @@
>  #define IXGBE_RXBUFFER_4K    4096
>  #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
>
> +#define IXGBE_PKT_HDR_PAD   (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))
> +
>  /* Attempt to maximize the headroom available for incoming frames.  We
>   * use a 2K buffer for receives and need 1536/1534 to store the data for
>   * the frame.  This leaves us with 512 bytes of room.  From that we need
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index 2c1b6eb60436..149f7baf40fe 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -6801,8 +6801,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
>         struct ixgbe_adapter *adapter = netdev_priv(netdev);
>
>         if (ixgbe_enabled_xdp_adapter(adapter)) {
> -               int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
> -                                    VLAN_HLEN;
> +               int new_frame_size = new_mtu + IXGBE_PKT_HDR_PAD;
>
>                 if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) {
>                         e_warn(probe, "Requested MTU size is not supported with XDP\n");
> --
> 2.37.3
>
Alexander Duyck Feb. 9, 2023, 1:08 a.m. UTC | #2
On Wed, Feb 8, 2023 at 4:47 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> CC Alexander Duyck
>
> Hello Alexander, thanks for reviewing the other two patches of this
> patchset last night. Would you mind reviewing the last one? :)
>
> Thanks,
> Jason

It looks like this patch isn't in the patch queue at:
https://patchwork.kernel.org/project/netdevbpf/list/

I believe you will need to resubmit it to get it accepted upstream.

The patch itself looks fine. Feel free to add my reviewed by when you submit it.

Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Jason Xing Feb. 9, 2023, 2:22 a.m. UTC | #3
On Thu, Feb 9, 2023 at 9:08 AM Alexander Duyck
<alexander.duyck@gmail.com> wrote:
>
> On Wed, Feb 8, 2023 at 4:47 PM Jason Xing <kerneljasonxing@gmail.com> wrote:
> >
> > CC Alexander Duyck
> >
> > Hello Alexander, thanks for reviewing the other two patches of this
> > patchset last night. Would you mind reviewing the last one? :)
> >
> > Thanks,
> > Jason
>
> It looks like this patch isn't in the patch queue at:
> https://patchwork.kernel.org/project/netdevbpf/list/
>

I got it.

I have no clue on how patchwork works, I searched the current email,
see https://patchwork.kernel.org/project/netdevbpf/patch/20230204133535.99921-4-kerneljasonxing@gmail.com/.

> I believe you will need to resubmit it to get it accepted upstream.
>
> The patch itself looks fine. Feel free to add my reviewed by when you submit it.
>
> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>

Anyway, I'm going to send a v2 version with your reviewed-by label.

Thank you, Alexander :)

Jason
Jakub Kicinski Feb. 9, 2023, 2:57 a.m. UTC | #4
On Thu, 9 Feb 2023 10:22:19 +0800 Jason Xing wrote:
> > It looks like this patch isn't in the patch queue at:
> > https://patchwork.kernel.org/project/netdevbpf/list/
> 
> I got it.
> 
> I have no clue on how patchwork works, I searched the current email,
> see https://patchwork.kernel.org/project/netdevbpf/patch/20230204133535.99921-4-kerneljasonxing@gmail.com/.
> 
> > I believe you will need to resubmit it to get it accepted upstream.

The patches are marked as Awaiting Upstream, that's why they don't show
up. We usually let Tony pick up patches for Intel's drivers rather than
applying directly.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index bc68b8f2176d..8736ca4b2628 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -73,6 +73,8 @@ 
 #define IXGBE_RXBUFFER_4K    4096
 #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
 
+#define IXGBE_PKT_HDR_PAD   (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))
+
 /* Attempt to maximize the headroom available for incoming frames.  We
  * use a 2K buffer for receives and need 1536/1534 to store the data for
  * the frame.  This leaves us with 512 bytes of room.  From that we need
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 2c1b6eb60436..149f7baf40fe 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6801,8 +6801,7 @@  static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
 	struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
 	if (ixgbe_enabled_xdp_adapter(adapter)) {
-		int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
-				     VLAN_HLEN;
+		int new_frame_size = new_mtu + IXGBE_PKT_HDR_PAD;
 
 		if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) {
 			e_warn(probe, "Requested MTU size is not supported with XDP\n");