From patchwork Tue Aug 18 12:14:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 508284 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D0035140293 for ; Tue, 18 Aug 2015 22:14:59 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752884AbbHRMOp (ORCPT ); Tue, 18 Aug 2015 08:14:45 -0400 Received: from 2.236.17.93.rev.sfr.net ([93.17.236.2]:17157 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751165AbbHRMOn (ORCPT ); Tue, 18 Aug 2015 08:14:43 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id DDF461C85C6; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SbExZzdUDFO4; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id C34621C8539; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A0540C73C4; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id WgWpspd0y895; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) Received: from PO10863.localdomain (unknown [172.25.231.4]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 61B57C73C5; Tue, 18 Aug 2015 14:14:40 +0200 (CEST) Received: by localhost.localdomain (Postfix, from userid 0) id 3E5621A241A; Tue, 18 Aug 2015 14:14:39 +0200 (CEST) From: Christophe Leroy To: "David S. Miller" , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy CC: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ipv4: inlining ip_send_check() Message-Id: <20150818121439.3E5621A241A@localhost.localdomain> Date: Tue, 18 Aug 2015 14:14:39 +0200 (CEST) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ip_send_check() is a function that does nothing but calling ip_fast_csum() after having zeroed iph->check We get (on PPC) a quite long function for just that, as it requires setting the stack frame, saving volatile regs, restoring them after the call, etc ... c02d3e3c : c02d3e3c: 7c 08 02 a6 mflr r0 c02d3e40: 94 21 ff f0 stwu r1,-16(r1) c02d3e44: 39 20 00 00 li r9,0 c02d3e48: 93 e1 00 0c stw r31,12(r1) c02d3e4c: 90 01 00 14 stw r0,20(r1) c02d3e50: b1 23 00 0a sth r9,10(r3) c02d3e54: 88 83 00 00 lbz r4,0(r3) c02d3e58: 7c 7f 1b 78 mr r31,r3 c02d3e5c: 54 84 07 3e clrlwi r4,r4,28 c02d3e60: 4b d3 ab 7d bl c000e9dc c02d3e64: b0 7f 00 0a sth r3,10(r31) c02d3e68: 80 01 00 14 lwz r0,20(r1) c02d3e6c: 83 e1 00 0c lwz r31,12(r1) c02d3e70: 7c 08 03 a6 mtlr r0 c02d3e74: 38 21 00 10 addi r1,r1,16 c02d3e78: 4e 80 00 20 blr Signed-off-by: Christophe Leroy --- include/net/ip.h | 9 ++++++++- net/ipv4/ip_output.c | 8 -------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/net/ip.h b/include/net/ip.h index c0c26c3..b88d592 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -32,6 +32,7 @@ #include #include #include +#include struct sock; @@ -110,7 +111,13 @@ int ip_output(struct sock *sk, struct sk_buff *skb); int ip_mc_output(struct sock *sk, struct sk_buff *skb); int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); int ip_do_nat(struct sk_buff *skb); -void ip_send_check(struct iphdr *ip); +/* Generate a checksum for an outgoing IP datagram. */ +static inline void ip_send_check(struct iphdr *iph) +{ + iph->check = 0; + iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); +} + int __ip_local_out(struct sk_buff *skb); int ip_local_out_sk(struct sock *sk, struct sk_buff *skb); static inline int ip_local_out(struct sk_buff *skb) diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 357c2a9..fa054cf 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -83,14 +83,6 @@ int sysctl_ip_default_ttl __read_mostly = IPDEFTTL; EXPORT_SYMBOL(sysctl_ip_default_ttl); -/* Generate a checksum for an outgoing IP datagram. */ -void ip_send_check(struct iphdr *iph) -{ - iph->check = 0; - iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); -} -EXPORT_SYMBOL(ip_send_check); - int __ip_local_out(struct sk_buff *skb) { struct iphdr *iph = ip_hdr(skb);