From patchwork Fri Dec 11 23:33:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Vazquez X-Patchwork-Id: 11969715 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 305EAC4361B for ; Fri, 11 Dec 2020 23:52:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBE8D2336E for ; Fri, 11 Dec 2020 23:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437350AbgLKXev (ORCPT ); Fri, 11 Dec 2020 18:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390493AbgLKXe0 (ORCPT ); Fri, 11 Dec 2020 18:34:26 -0500 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2973C061793 for ; Fri, 11 Dec 2020 15:33:45 -0800 (PST) Received: by mail-pf1-x449.google.com with SMTP id v138so7280184pfc.10 for ; Fri, 11 Dec 2020 15:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=Iu352o38cH38gPmg4WLLZRhgJxjvxf30w/1vSczLt9o=; b=ZqeVMFcucNwA/18frxZWmorIH7IpIJqIFs1kUdtDd2c1o/05p+P/F07P9Mms6Y5Mrh U8j7TY+LKlWAIzaCyAkyFm+lRRU8exknvw/w7dcxCIZD5AbzxeEDkFcX7zTZfFpm2o+g NYA3eBlRI+//e58fPiZx8J0vVptjUDFK26+Nx0tRVktZogDPaSDHkYLKoe9SF79vjVOP YkPYVre6yPcBcNtfJGSVGVyY0W+J4uzdtTby2G3wGhQuJT8SRlZzHIoxAcehtmYtPmqT L9gwgXpAly+8k+P8YUsKvz9ic+Ks6Ef6RiTjHnohAlJCSVCB1K0s/Yee1ZwTNmAZeLcH 0YEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Iu352o38cH38gPmg4WLLZRhgJxjvxf30w/1vSczLt9o=; b=tk6j3towCAM6dBu37to8Kxjnc+tVxCEmkDJecHFxQPFyre2+6Val9pMdKS6e4hUZIO I9H49Si7zA2x8+c6TpZAL1FOto6YoIyOvGaTHAFr0Q2nw/sCACkV9DUeO/0Kh7OIrIwA n5bVVQVzsSjgJ7OjycRpWzFj/0Arc3c0fssiWzb5eNcvmf5q7IBIY5MfDMRptRuanU+k Ts1ODf/dfUa9CqlK9M3bFLC926BlP/UiZqf8I2XTJ/wpjAqEFIwGb2YM/aquysWq5te6 bJGhaaIgJCsNslbbad9pKa3KCakuoTd83C5wtNjoogEplt84NciX1mKq5jfgI8Ge2rF7 1RHw== X-Gm-Message-State: AOAM530YUwum469hRx9qGaGij0zDDDjdTRkfwm7wZ6tX4hwxwGQ3yP9h bIAWFXsxCit709/ZUjx+ZgByQI+btJZe X-Google-Smtp-Source: ABdhPJxuuiHUKuvUPeFysBTT6sPHLW5xDIymKoiDTgbWM+xZzuHcMxdZ2etEf3M6DNpwvFjzorP6I4Dq22jh Sender: "brianvv via sendgmr" X-Received: from brianvv.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:348]) (user=brianvv job=sendgmr) by 2002:a17:90a:17a4:: with SMTP id q33mr1469702pja.0.1607729624998; Fri, 11 Dec 2020 15:33:44 -0800 (PST) Date: Fri, 11 Dec 2020 23:33:37 +0000 In-Reply-To: <20201211233340.1503242-1-brianvv@google.com> Message-Id: <20201211233340.1503242-2-brianvv@google.com> Mime-Version: 1.0 References: <20201211233340.1503242-1-brianvv@google.com> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH net-next v2 1/4] net: use indirect call helpers for dst_input From: Brian Vazquez To: Brian Vazquez , Brian Vazquez , Eric Dumazet , "David S . Miller" Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: brianvv This patch avoids the indirect call for the common case: ip_local_deliver and ip6_input Signed-off-by: brianvv --- include/net/dst.h | 6 +++++- net/ipv4/ip_input.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/net/dst.h b/include/net/dst.h index 10f0a8399867..98cf6e8c06c4 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -18,6 +18,7 @@ #include #include #include +#include struct sk_buff; @@ -441,10 +442,13 @@ static inline int dst_output(struct net *net, struct sock *sk, struct sk_buff *s return skb_dst(skb)->output(net, sk, skb); } +INDIRECT_CALLABLE_DECLARE(int ip6_input(struct sk_buff *)); +INDIRECT_CALLABLE_DECLARE(int ip_local_deliver(struct sk_buff *)); /* Input packet from network to transport. */ static inline int dst_input(struct sk_buff *skb) { - return skb_dst(skb)->input(skb); + return INDIRECT_CALL_INET(skb_dst(skb)->input, + ip6_input, ip_local_deliver, skb); } static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index b0c244af1e4d..3a025c011971 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -253,6 +253,7 @@ int ip_local_deliver(struct sk_buff *skb) net, NULL, skb, skb->dev, NULL, ip_local_deliver_finish); } +EXPORT_SYMBOL(ip_local_deliver); static inline bool ip_rcv_options(struct sk_buff *skb, struct net_device *dev) {