mpls: Reduce skb re-allocations due to skb_cow()

JIRA: https://issues.redhat.com/browse/RHEL-55145
Upstream Status: net-next.git

commit f4ae8420f6ebdabf97e0c4f5f99412768687985f
Author: Christoph Paasch <cpaasch@apple.com>
Date:   Thu Aug 15 09:12:01 2024 -0700

    mpls: Reduce skb re-allocations due to skb_cow()

    mpls_xmit() needs to prepend the MPLS-labels to the packet. That implies
    one needs to make sure there is enough space for it in the headers.

    Calling skb_cow() implies however that one wants to change even the
    playload part of the packet (which is not true for MPLS). Thus, call
    skb_cow_head() instead, which is what other tunnelling protocols do.

    Running a server with this comm it entirely removed the calls to
    pskb_expand_head() from the callstack in mpls_xmit() thus having
    significant CPU-reduction, especially at peak times.

    Cc: Roopa Prabhu <roopa@nvidia.com>
    Reported-by: Craig Taylor <cmtaylor@apple.com>
    Signed-off-by: Christoph Paasch <cpaasch@apple.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://patch.msgid.link/20240815161201.22021-1-cpaasch@apple.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Signed-off-by: Guillaume Nault <gnault@redhat.com>
This commit is contained in:
Guillaume Nault 2024-09-02 11:42:01 +02:00
parent 2aee3af88f
commit fe6c6fb23a
1 changed files with 1 additions and 1 deletions

View File

@ -106,7 +106,7 @@ static int mpls_xmit(struct sk_buff *skb)
hh_len = 0;
/* Ensure there is enough space for the headers in the skb */
if (skb_cow(skb, hh_len + new_header_size))
if (skb_cow_head(skb, hh_len + new_header_size))
goto drop;
skb_set_inner_protocol(skb, skb->protocol);