Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp797588pxf; Thu, 18 Mar 2021 11:46:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQTT0/xqNg4C8WSObquRW06ZJcxzfwMwjIL5y7BfoZ3lioyzoFLH1gyPK8Gpg3AgoJ3J4g X-Received: by 2002:aa7:ca04:: with SMTP id y4mr5349827eds.339.1616093190861; Thu, 18 Mar 2021 11:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616093190; cv=none; d=google.com; s=arc-20160816; b=WqDhLC184YMqDXL4mwRW6jVBigqEJnjI2/vJbNkzyhbhgsUJI98j7LyWBx0RHnqvNm 6Q9NjgF2u1h7esoRfqieskZuxtmwEgZLSeI8DoPz7XgBpCMjoftkCSwuYBF0Zr+a5i7y 8rbPm0LKsWr6zUIPYt0AKihjwZJwA9uJCwI2OArTpvW3kG1Mo+Wfhr+kBIrQbCK7ZmZu a+NWCOX+ejyzcgH8uQOthlUn/CNwHPTIJcATsSfIjXdiTq9mEWNTxm4V6VhqamgdSqCc a9pa+lS12xGx7n1uAFCYgRIYvo7+UrBQSQR19eBbTvxD6rgxyuF9eHthefjFFuY9AJ1g B2PA== 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=X+A01bVgCW9C0LcweX802pafQYX/MaNpf8hWlmvRiLI=; b=duNYEJofiqlenzPUv97kxoxJH1HRaVX5jcUuiXuDYXTcsChNgkwOGbxeKaC/WlXoTD TXPkWbBQIBJheFsBR2VnJmH5BFyBbMQ7EsfNeDO2xnRD0W2WuFLl5008Lk0vVf3sUehC 3pYDschiq1jvDGc70nADLwmkWdTxYyg2DoWaDK3cwkRiFZCQd6sVSZaHFt5vzvfvAosu 8irSn/Rn8LQz+Rondpittm4NeCMM1Yq+t8Tdk5zMzr/SivwJmhn0ceGrDULAlKaG3ov4 fUJvXxYXYkrYSTKxAZBonS2EkzBHQ5ai0meN9X4pkpK1aVlQoLiwIwXp932FK1JXtWdX XtkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=ihdVBEmj; 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 ka24si2320994ejc.64.2021.03.18.11.46.08; Thu, 18 Mar 2021 11:46:30 -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=ihdVBEmj; 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 S232773AbhCRSnP (ORCPT + 99 others); Thu, 18 Mar 2021 14:43:15 -0400 Received: from mail-40134.protonmail.ch ([185.70.40.134]:23574 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232710AbhCRSmp (ORCPT ); Thu, 18 Mar 2021 14:42:45 -0400 Date: Thu, 18 Mar 2021 18:42:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1616092962; bh=X+A01bVgCW9C0LcweX802pafQYX/MaNpf8hWlmvRiLI=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ihdVBEmjgnxfyRPkNRf6p8/oxzuoUGhnrp6NznWS9bSE5WC/C6TJe4eq3wNehnTwo XSxncp9rTywDwaLZ1VkljA4hoViA1ArxFmrMPpObCe9IXTCR8pJ6iXi5qtE3ukYhGJ c9vnxFBFBMryQwg3N4vEJvCrXTojaMWwR5YX8YYC5U56dZFTcp7bP8/g50FB41MAWE Oaam0BjnCsS/z9LFNcGyfN2TSSVDHn1RKB3nxpXu/Rx6rjR/kwhZsVLlTvIVVH7127 /kAoc0UH3ivKn2fmFvTK7TpJugrpOKwtL16iEbx62f50ZKAJ1imdN8d8dCaXmfJXaE j1OdCDOS/OFtQ== 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 3/4] vlan/8021q: avoid retpoline overhead on GRO Message-ID: <20210318184157.700604-4-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 VLAN 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 VLAN GRO receive code to reduce the penalty on receiving tagged frames (when hardware stripping is off or not available). Signed-off-by: Alexander Lobakin --- net/8021q/vlan_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 78ec2e1b14d1..59bc13b5f14f 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "vlan.h" bool vlan_do_receive(struct sk_buff **skbp) @@ -495,7 +496,10 @@ static struct sk_buff *vlan_gro_receive(struct list_he= ad *head, =09skb_gro_pull(skb, sizeof(*vhdr)); =09skb_gro_postpull_rcsum(skb, vhdr, sizeof(*vhdr)); -=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(); @@ -515,7 +519,9 @@ static int vlan_gro_complete(struct sk_buff *skb, int n= hoff) =09rcu_read_lock(); =09ptype =3D gro_find_complete_by_type(type); =09if (ptype) -=09=09err =3D ptype->callbacks.gro_complete(skb, nhoff + sizeof(*vhdr)); +=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(*vhdr)); =09rcu_read_unlock(); =09return err; -- 2.31.0