Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp847010imm; Tue, 5 Jun 2018 05:31:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLnDVOfsKs8QLzAucLq4nVlgk8RDnEa0FRQ7R8J02n36Xuq5jb3nf0yKxMR4KDJSO3F/zMR X-Received: by 2002:a17:902:aa01:: with SMTP id be1-v6mr10273086plb.296.1528201900092; Tue, 05 Jun 2018 05:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528201900; cv=none; d=google.com; s=arc-20160816; b=q2gxA/ISzpV8HVNSe5X798OqSMzwhFYB3J9lUXsEcsjeo3zfTFzOTom6G5aNQfyC6m L0TJ/+3G9asB16dNEMnB52do92LUO8JOf5uzHyUGV8G73+1/1eATqDGY1/HQ0J60/WNk jYGuBwA+PHIMtnVeznW2TVd57fNWCKg1kaGjsz9S0vzYk1YB51BrcJ3kIXoUcV07rO7K 6ITNegn3ugfdGb+mhuKeIAc9p/Ip0mmM6aj4jEQQ7DwIMVCdCj8oWuL03dCKUusjy3n6 i9lKXbMST3XJRXfL7oEuLQ5DHkIAo7I7+HleQJaYQVzPyqFrFN0zC9gBZDQOC3pkPZu4 IyVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=aULzRgjTs7r/EXPVlvx0vgm9a6qIFeJnDDSX4rnPcS8=; b=pkBQWVLxTlR1RaHw59zU0mTuIZybqP9YgVpZ/7uNidEptgkdrLIiZJ+PEOz5gZxggF MJvaWXoVrNCjsxvFeTvIxi4zZ0h+DDOqpfPTnMd/O4X7scGGiBSv/j5Fnw3FAWJSwDY3 SRLaIz4U3opWyZITFS9zBosSVMtYPjwsaJb+GtN/I3mvf/OtkGtfL2Qskv0P2/M2nrK5 WG2lsqpiu5PBPwGR5CC5wtCAKwoIFTZwlUUDPropJ8ZPHa+ffMJGapY5HwpElrKO9cQa IfwKcUxqWGUuONYi7l38fffRRSdcJMs0N30fTMV7GhEOj+PuTT/gVKbWV+94oXUQVkda cSWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M+h26kdu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k124-v6si5964884pgc.519.2018.06.05.05.31.25; Tue, 05 Jun 2018 05:31:40 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=M+h26kdu; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948AbeFEM3s (ORCPT + 99 others); Tue, 5 Jun 2018 08:29:48 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:35109 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbeFEM3r (ORCPT ); Tue, 5 Jun 2018 08:29:47 -0400 Received: by mail-io0-f195.google.com with SMTP id u4-v6so3111161iof.2; Tue, 05 Jun 2018 05:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aULzRgjTs7r/EXPVlvx0vgm9a6qIFeJnDDSX4rnPcS8=; b=M+h26kduyPWSYJPscOW1aeuyhjJZh3eulMHQbt+SXwI+d/kCoEHITUJQmZAH1gLt31 YHwO5Gcxu+1FrNra2jzVQ9Yiaw2FO9TlqYUOh0LFAC4Wkn65ebpT1P6sMKuv1jgdYFAG fk6qXAaMHE+vf4XCUklkp3y+nmTajHbYQ/ZqBbRK8Dqu2qdjvxWXF96S48aMgBtRGFV8 O2VTEmd5kCov3yU8rxzTLVtHZ7nGQICDrqd1bfx37VbFpRXHSTDHFs6o7hMDJMZz2Mz0 QVbLu/3ZdvGLL0tS6r9ug4DhV2bw+DHFgBeBlxzIBF6x48WyoEMEuqfFOWU/AXATtM8f 3dzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aULzRgjTs7r/EXPVlvx0vgm9a6qIFeJnDDSX4rnPcS8=; b=Nc72XBk3/fhpiNjSAO7pBHUi4oH8c1FUqbhcs9PPU8n/2z5VaayDvySlvxO6SMFpix VCsA/Rcel7pp7ubao27DqLW5LCuADV5rkCBWhJI8of+lxSlePf0OvARVhmmisCn+rCxK OMAL7BIREJJPsHuAwClDJdnsl6gYFefrZg7qf7yfwJaJmE+HpjcJLxxjlw5sBTKQn/g+ tRG/or/fV6B+SCrG3Sz+yvm9e74rwZxb1xb1N1xi3uiwkv+5YnE/+gabsYCBDq/k3zGR pHHCRz9j/x02y/TCG5OrO38N6EqMrhD9CQmfqspJZP0x/y4tWjGFSByromT5LkUdsqG/ M5Zg== X-Gm-Message-State: APt69E3mJ1+TSS9gKr6HYOhzD6sVO++sbWGJ1nSxi4b0inOYPLWJErhl aGp1uaiqnyZYUaMBvdFJ1PNwIduf3mXBkbHIHK4= X-Received: by 2002:a6b:9a05:: with SMTP id c5-v6mr23822968ioe.142.1528201786731; Tue, 05 Jun 2018 05:29:46 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:ef03:0:0:0:0:0 with HTTP; Tue, 5 Jun 2018 05:29:05 -0700 (PDT) In-Reply-To: <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com> References: <1528200262-11834-1-git-send-email-laoar.shao@gmail.com> <9ce783dc628699f02c45650c942f6735e93a18c4.camel@redhat.com> From: Yafang Shao Date: Tue, 5 Jun 2018 20:29:05 +0800 Message-ID: Subject: Re: [PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization To: Paolo Abeni Cc: Eric Dumazet , David Miller , netdev , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 5, 2018 at 8:20 PM, Paolo Abeni wrote: > On Tue, 2018-06-05 at 08:04 -0400, Yafang Shao wrote: >> In ip receive path, when ip header hasn't been pulled yet, ip_hdr() and >> skb->data are pointing to the same byte. >> >> In ip output path, when ip header is just pushed, ip_hdr() and skb->data >> are pointing to the same byte. >> >> As ip_hdr() is more expensive than using skb->data, so replace ip_hdr() >> with skb->data in these situations for optimization. > > IMHO this makes the code less readable and more error prone. Which kind > of performance improvement do you measure here? > Correct the cc list. Hi Paolo, There's a "+" opertaion in ip_hdr(), using skb->data and avoid this operation. Thanks Yafang