Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp797851pxf; Thu, 18 Mar 2021 11:47:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycD5KPLw8bxuB79orV7AqepC8KMYw7Mj/3O+L25ARQcyTXI4+Dds4bZb6RGqb46Z1LbbZe X-Received: by 2002:a17:906:684b:: with SMTP id a11mr41380840ejs.329.1616093221793; Thu, 18 Mar 2021 11:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616093221; cv=none; d=google.com; s=arc-20160816; b=XcQRQyM7GRLPgMlfHLSmkYgR53JzNasm7BdWbQLw8pOlgA6aHdvGHQ4FLK8p9Hi7Id hBoh+t1mvPj/YfeiULWII/l79BGHUAPZubfnkzGcHtYfGISjoEtHlZnpg9nFfXI761zs JVe2jwOLPMyvnJlhN6Bn/d/37EYvTmmwCyngz3BjmZvX7wenhHUn1kMaptgd70YarKy8 h+iXj2DlW40JjdF1H9/Dvf7bYBwNXW/hjOwRlgeXV7OG/UsUiRUixS99fwjff+hqVwvV Gyd9S6ZO82LZ6zh8IZICzQvpCIHnv4xIjnuYLnWfeHb1eKpqC7oyn476joH9o+wYmKHE +qcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=lRsfcB6MOCDLr07XVaSyak4dBxm5+WyXdc1BMSXra2g=; b=qpYhsikaspSDZ5tAzm4+02sYLyes28sioGx48e7hEomPtFJooMvIU4hARG4PQzzfdO P31TRULvaTHAVyYOdr7vKP8SMFCeHlvPy/RSrUoCC4irn15u8hl5NqFSrNTB1AZf0EbS qWa7e604jdbeKx8mQZWXxF/q/S3rLjSL19mjxaPYM90Zxy7e9TnST2eTjucSGI8n9pfH aM8gUGyO55UmUrXZoPhm3M1/J1BRjdmJmFkSHlSMn7v6tnDUOOsVfJnwLKxpw+aw4J8W K9nH6sq/UpZp/IIWTmqhQ9p30CNmPH19MvuKUV8frqkyErTEDHrjH3+d5oq62qDrLGXO bBAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="pKCNFQL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i13si2053804edq.522.2021.03.18.11.46.39; Thu, 18 Mar 2021 11:47:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b="pKCNFQL/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232730AbhCRSnM (ORCPT + 99 others); Thu, 18 Mar 2021 14:43:12 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:41681 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232671AbhCRSmm (ORCPT ); Thu, 18 Mar 2021 14:42:42 -0400 Date: Thu, 18 Mar 2021 18:42:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1616092960; bh=lRsfcB6MOCDLr07XVaSyak4dBxm5+WyXdc1BMSXra2g=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=pKCNFQL/xr/CXt9HvoPgr9+uy4yPhiw//L6nBrmR539JfzGk91q/hhycZHWlBhKe0 pEqihAX8BbLHii5g2NL91Rq+QVzslf02BZD6x6w8p31NMh+R7VxdhY/WT8qByzmqFa vGXL+j+v9MZmhur5h1LOMiKOB4isYNyyQedMOyiHHxaq+l3Oi66aiDrV2xb2tsHjgU OyJuHv8AMcALbcG6cJ+uMNaRJ0OqH4y9iz1mBtXCV8DF4r1LX2zHxi9TE9I6XMkk6i rrQomPXgnCtRRWaYr182NwLOSEjaMDHDR8lYDnn+6rUTw7PweuQS2ik0rCDEUF41V7 exGiYWEwFqVJQ== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: Alexander Lobakin , Mauro Carvalho Chehab , Kirill Tkhai , Bartosz Golaszewski , Leon Romanovsky , Eric Dumazet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH net-next 4/4] ethernet: avoid retpoline overhead on TEB (GENEVE, NvGRE, VxLAN) GRO Message-ID: <20210318184157.700604-5-alobakin@pm.me> In-Reply-To: <20210318184157.700604-1-alobakin@pm.me> References: <20210318184157.700604-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The two most popular headers going after Ethernet are IPv4 and IPv6. Retpoline overhead for them is addressed only in dev_gro_receive(), when they lie right after the outermost Ethernet header. Use the indirect call wrappers in TEB (Transparent Ethernet Bridging, such as GENEVE, NvGRE, VxLAN etc.) GRO receive code to reduce the penalty when processing the inner headers. Signed-off-by: Alexander Lobakin --- net/ethernet/eth.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index e01cf766d2c5..933b427122be 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include @@ -449,7 +450,10 @@ struct sk_buff *eth_gro_receive(struct list_head *head= , struct sk_buff *skb) =09skb_gro_pull(skb, sizeof(*eh)); =09skb_gro_postpull_rcsum(skb, eh, sizeof(*eh)); -=09pp =3D call_gro_receive(ptype->callbacks.gro_receive, head, skb); + +=09pp =3D indirect_call_gro_receive_inet(ptype->callbacks.gro_receive, +=09=09=09=09=09 ipv6_gro_receive, inet_gro_receive, +=09=09=09=09=09 head, skb); out_unlock: =09rcu_read_unlock(); @@ -473,8 +477,9 @@ int eth_gro_complete(struct sk_buff *skb, int nhoff) =09rcu_read_lock(); =09ptype =3D gro_find_complete_by_type(type); =09if (ptype !=3D NULL) -=09=09err =3D ptype->callbacks.gro_complete(skb, nhoff + -=09=09=09=09=09=09 sizeof(struct ethhdr)); +=09=09err =3D INDIRECT_CALL_INET(ptype->callbacks.gro_complete, +=09=09=09=09=09 ipv6_gro_complete, inet_gro_complete, +=09=09=09=09=09 skb, nhoff + sizeof(*eh)); =09rcu_read_unlock(); =09return err; -- 2.31.0