Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9790794imu; Wed, 5 Dec 2018 10:16:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/UpQzXFq5TKrhHTpGQcOWCbd2rj/6WgG52ZSlwSYBlGC9wFyZcT0SvmbWkfMpYjIAZ5TNzj X-Received: by 2002:a17:902:2ac3:: with SMTP id j61mr25209506plb.185.1544033776626; Wed, 05 Dec 2018 10:16:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544033776; cv=none; d=google.com; s=arc-20160816; b=V5D5RZ9Vq4JCiM6uX7iHq8T3smbknRDajk9FSk/MdAHw4tQLRrsmaw0+bA1Ebdlw9c umAGnugwJJluJP0+sAqJGF6qsUszaxAuerpAMUqNiYAv0BOv84XT5x/lZDgYaY1UQfau Ei8WRxkfUvZwWR4+K934mTV9rsBygC/VawsKEvq5I+aNHisnf/kk+37wJN8yNDvxInIi 2QtCvUB0sT0RhRCtPP4DvBtiJvIKzNZkZq9gqaDZTlm6mCqNHA+8haRBKFQt0l32xVJD boZhTUswhBFT8TyiPTATJYQexy4zIdb9vFtJ1SP5T/WUbkNr8YdlhPEoZwZdgVGgjdOT mOEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fiMShDbX3DnaAbvnykiYJZoRkehc4j5P02iWbFcrxKA=; b=G/GzInKc/daD+IYRpdjmGHJ7NjdDNOHvUUkxF8hN1N74s0CD2ADGZo195IFZDBlx06 Nl5QrrSz/IMnACsksXYBCyJtIJyvEq45QeHFXRiPox5OF9x2pa4OoXyNq9xzJK78sSAr iyg62ZuaaMVeBhrCTp7ysm80jLj1oF0VkGUpstLP7lRUxleg4pTvzBU/H/Wl/eaDARgN xhgtk5ia7krgbEad3Xx3N6lP6F+sDCBy8aea1orzL14IiJ69g0ngYItPGlDKMfYN6JNJ MznwcMDXjKUSc025SwalPDykB87qP9jUzYNUcFL783AhywRTF8b9VApD35htTNE3FLG7 sjLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s4si20101635plr.306.2018.12.05.10.16.01; Wed, 05 Dec 2018 10:16:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728373AbeLESOv (ORCPT + 99 others); Wed, 5 Dec 2018 13:14:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52306 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728102AbeLESO3 (ORCPT ); Wed, 5 Dec 2018 13:14:29 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1670D8BD23; Wed, 5 Dec 2018 18:14:29 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.32.181.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1C851001F54; Wed, 5 Dec 2018 18:14:27 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Paul Turner , linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 2/4] net: use indirect call wrappers at GRO network layer Date: Wed, 5 Dec 2018 19:13:40 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 05 Dec 2018 18:14:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This avoids an indirect calls for L3 GRO receive path, both for ipv4 and ipv6, if the latter is not compiled as a module. Note that when IPv6 is compiled as builtin, it will be checked first, so we have a single additional compare for the more common path. v1 -> v2: - adapted to INDIRECT_CALL_ changes Signed-off-by: Paolo Abeni --- include/net/inet_common.h | 2 ++ net/core/dev.c | 15 +++++++++++++-- net/ipv6/ip6_offload.c | 6 +++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 3ca969cbd161..56e7592811ea 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -2,6 +2,8 @@ #ifndef _INET_COMMON_H #define _INET_COMMON_H +#include + extern const struct proto_ops inet_stream_ops; extern const struct proto_ops inet_dgram_ops; diff --git a/net/core/dev.c b/net/core/dev.c index 04a6b7100aac..97c5ae41fd65 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -145,6 +145,7 @@ #include #include #include +#include #include "net-sysfs.h" @@ -5320,6 +5321,8 @@ static void flush_all_backlogs(void) put_online_cpus(); } +INDIRECT_CALLABLE_DECLARE(int inet_gro_complete(struct sk_buff *, int)); +INDIRECT_CALLABLE_DECLARE(int ipv6_gro_complete(struct sk_buff *, int)); static int napi_gro_complete(struct sk_buff *skb) { struct packet_offload *ptype; @@ -5339,7 +5342,9 @@ static int napi_gro_complete(struct sk_buff *skb) if (ptype->type != type || !ptype->callbacks.gro_complete) continue; - err = ptype->callbacks.gro_complete(skb, 0); + err = INDIRECT_CALL_INET(ptype->callbacks.gro_complete, + ipv6_gro_complete, inet_gro_complete, + skb, 0); break; } rcu_read_unlock(); @@ -5486,6 +5491,10 @@ static void gro_flush_oldest(struct list_head *head) napi_gro_complete(oldest); } +INDIRECT_CALLABLE_DECLARE(struct sk_buff *inet_gro_receive(struct list_head *, + struct sk_buff *)); +INDIRECT_CALLABLE_DECLARE(struct sk_buff *ipv6_gro_receive(struct list_head *, + struct sk_buff *)); static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb) { u32 hash = skb_get_hash_raw(skb) & (GRO_HASH_BUCKETS - 1); @@ -5535,7 +5544,9 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff NAPI_GRO_CB(skb)->csum_valid = 0; } - pp = ptype->callbacks.gro_receive(gro_head, skb); + pp = INDIRECT_CALL_INET(ptype->callbacks.gro_receive, + ipv6_gro_receive, inet_gro_receive, + gro_head, skb); break; } rcu_read_unlock(); diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 70f525c33cb6..ff8b484d2258 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -164,8 +164,8 @@ static int ipv6_exthdrs_len(struct ipv6hdr *iph, return len; } -static struct sk_buff *ipv6_gro_receive(struct list_head *head, - struct sk_buff *skb) +INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head, + struct sk_buff *skb) { const struct net_offload *ops; struct sk_buff *pp = NULL; @@ -301,7 +301,7 @@ static struct sk_buff *ip4ip6_gro_receive(struct list_head *head, return inet_gro_receive(head, skb); } -static int ipv6_gro_complete(struct sk_buff *skb, int nhoff) +INDIRECT_CALLABLE_SCOPE int ipv6_gro_complete(struct sk_buff *skb, int nhoff) { const struct net_offload *ops; struct ipv6hdr *iph = (struct ipv6hdr *)(skb->data + nhoff); -- 2.19.2