From patchwork Thu Apr 30 21:53:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 466744 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 158FD14076A for ; Fri, 1 May 2015 07:54:10 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752398AbbD3VyE (ORCPT ); Thu, 30 Apr 2015 17:54:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34091 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752192AbbD3VyA (ORCPT ); Thu, 30 Apr 2015 17:54:00 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 58076AC7C8; Thu, 30 Apr 2015 21:54:00 +0000 (UTC) Received: from [192.168.122.149] (vpn-225-10.phx2.redhat.com [10.3.225.10]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3ULrxKH001338; Thu, 30 Apr 2015 17:54:00 -0400 Subject: [PATCH 3/3] etherdev: Use skb->data to retrieve Ethernet header instead of eth_hdr From: Alexander Duyck To: netdev@vger.kernel.org Cc: davem@davemloft.net Date: Thu, 30 Apr 2015 14:53:59 -0700 Message-ID: <20150430215359.1798.79917.stgit@ahduyck-vm-fedora22> In-Reply-To: <20150430214917.1798.49769.stgit@ahduyck-vm-fedora22> References: <20150430214917.1798.49769.stgit@ahduyck-vm-fedora22> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Avoid recomputing the Ethernet header location and instead just use the pointer provided by skb->data. The problem with using eth_hdr is that the compiler wasn't smart enough to realize that skb->head + skb->mac_header was the same thing as skb->data before it added ETH_HLEN. By just caching it off before calling skb_pull_inline we can avoid a few unnecessary instructions. Signed-off-by: Alexander Duyck --- net/ethernet/eth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index 21c211e9fd5a..314e4c5a5a5e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -156,8 +156,9 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) skb->dev = dev; skb_reset_mac_header(skb); + + eth = (struct ethhdr *)skb->data; skb_pull_inline(skb, ETH_HLEN); - eth = eth_hdr(skb); if (unlikely(is_multicast_ether_addr_64bits(eth->h_dest))) { if (ether_addr_equal_64bits(eth->h_dest, dev->broadcast))