Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Update max MTU value for Nodeport XDP on AWS #19593

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

qmonnet
Copy link
Member

@qmonnet qmonnet commented Apr 27, 2022

The documentation for setting up Nodeport XDP acceleration on AWS mentions that the MTU for the ena interface must be lower down so that XDP can work. It is indeed necessary; but the value which is provided as the maximal possible MTU is outdated, and not working.

After installing the latest kernel through the RPM package kernel-ng (as prescribed in the documentation), the EKS nodes currently end up with Linux 5.10:

$ uname -r
5.10.106-102.504.amzn2.x86_64

If we keep on following the docs and lower the MTU to 3818, the Cilium pods fail to get ready, and tell in their logs that the XDP program cannot be set due to the MTU. This is also confirmed from the dmesg of the nodes:

[ 3617.059219] ena 0000:00:05.0 eth0: Failed to set xdp program,
    the current MTU (3818) is larger than the maximum allowed MTU (3498) while xdp is on

The value 3818 comes from the legacy definition of ENA_XDP_MAX_MTU, in drivers/net/ethernet/amazon/ena/ena_netdev.h, which used to be defined as such:

#define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN - \
                         VLAN_HLEN - XDP_PACKET_HEADROOM)

Where ETH_LEN is 14, ETH_FCS_LEN and VLAN_HLEN are both 4, and XDP_PACKET_HEADROOM is 256.

But after Linux commit 08fc1cfd2d25 ("ena: Add XDP frame size to amazon NIC driver"), from Linux 5.8, the definition changed to:

#define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN -	\
                         VLAN_HLEN - XDP_PACKET_HEADROOM -		\
                         SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))

Where SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) is currently 320 (multiple of 64 bytes, for alignment on the L1 cache lines).

As a result, the maximum value for the MTU for kernels 5.8+ is 3498 bytes. This is indeed the maximum value that I could use when setting up XDP on an EKS cluster. Let's update the documentation accordingly.

The documentation for setting up Nodeport XDP acceleration on AWS
mentions that the MTU for the ena interface must be lower down so that
XDP can work. It is indeed necessary; but the value which is provided as
the maximal possible MTU is outdated, and not working.

After installing the latest kernel through the RPM package kernel-ng (as
prescribed in the documentation), the EKS nodes currently end up with
Linux 5.10:

    $ uname -r
    5.10.106-102.504.amzn2.x86_64

If we keep on following the docs and lower the MTU to 3818, the Cilium
pods fail to get ready, and tell in their logs that the XDP program
cannot be set due to the MTU. This is also confirmed from the dmesg of
the nodes:

    [ 3617.059219] ena 0000:00:05.0 eth0: Failed to set xdp program,
        the current MTU (3818) is larger than the maximum allowed MTU (3498) while xdp is on

The value 3818 comes from the legacy definition of ENA_XDP_MAX_MTU, in
drivers/net/ethernet/amazon/ena/ena_netdev.h, which used to be defined
as such:

    #define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN - \
                             VLAN_HLEN - XDP_PACKET_HEADROOM)

Where ETH_LEN is 14, ETH_FCS_LEN and VLAN_HLEN are both 4, and
XDP_PACKET_HEADROOM is 256.

But after Linux commit 08fc1cfd2d25 ("ena: Add XDP frame size to amazon
NIC driver"), from Linux 5.8, the definition changed to:

    #define ENA_XDP_MAX_MTU (ENA_PAGE_SIZE - ETH_HLEN - ETH_FCS_LEN -	\
                             VLAN_HLEN - XDP_PACKET_HEADROOM -		\
                             SKB_DATA_ALIGN(sizeof(struct skb_shared_info)))

As a result, the maximum value for the MTU for kernels 5.8+ is 3498
bytes. This is indeed the maximum value that I could use when setting up
XDP on an EKS cluster. Let's update the documentation accordingly.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
@qmonnet qmonnet added area/documentation Impacts the documentation, including textual changes, sphinx, or other doc generation code. release-note/misc This PR makes changes that have no direct user impact. labels Apr 27, 2022
@qmonnet qmonnet requested review from borkmann and a team April 27, 2022 13:37
@qmonnet qmonnet requested a review from a team as a code owner April 27, 2022 13:37
@qmonnet
Copy link
Member Author

qmonnet commented Apr 27, 2022

Checkpatch warns about an Unknown commit id '08fc1cfd2d25', expected given that this is a reference to a commit in Linux (not in Cilium).

@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.9.16 Apr 27, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.11.5 Apr 27, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot added this to Needs backport from master in 1.10.11 Apr 27, 2022
@joestringer joestringer merged commit 1db91ca into cilium:master Apr 27, 2022
@qmonnet qmonnet deleted the pr/doc-mtu-xdp-aws branch April 27, 2022 20:23
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.10 in 1.11.5 May 2, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.10 in 1.11.5 May 2, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.10 in 1.10.11 May 2, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Needs backport from master to Backport pending to v1.9 in 1.9.16 May 3, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.10 to Backport done to v1.10 in 1.10.11 May 3, 2022
@aditighag aditighag added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. and removed backport-pending/1.11 labels May 4, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.10 to Backport done to v1.11 in 1.11.5 May 4, 2022
@maintainer-s-little-helper maintainer-s-little-helper bot moved this from Backport pending to v1.9 to Backport done to v1.9 in 1.9.16 May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Impacts the documentation, including textual changes, sphinx, or other doc generation code. backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. release-note/misc This PR makes changes that have no direct user impact.
Projects
No open projects
1.10.11
Backport done to v1.10
1.11.5
Backport done to v1.11
1.9.16
Backport done to v1.9
Development

Successfully merging this pull request may close these issues.

None yet

4 participants