From patchwork Fri Aug 19 05:05:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Changli Gao X-Patchwork-Id: 110567 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 2A751B6F72 for ; Fri, 19 Aug 2011 15:06:50 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751565Ab1HSFGp (ORCPT ); Fri, 19 Aug 2011 01:06:45 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]:40317 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751254Ab1HSFGp (ORCPT ); Fri, 19 Aug 2011 01:06:45 -0400 Received: by pzk37 with SMTP id 37so4216128pzk.1 for ; Thu, 18 Aug 2011 22:06:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=Gd6NHhE8gGDXf0+yqPZO9IXBQwZOVea9KRNH6zkr4Xg=; b=wkP3Y3Mt5lSV09QqfDzUlYiFdBx1EaGUq5FxI6Iy4W49OCxHenYw6eROSnRfzmpMvy Mvth10w21Ga9yp72/9T80tYYYg3JykGnSaJHNVuOLZNfa16+QDdjtRVx98myTt7P4Lxz TZ0n9I89aWg1x7Cam86GwqjQ01aigZU4pSb8w= Received: by 10.142.210.3 with SMTP id i3mr202892wfg.304.1313730404665; Thu, 18 Aug 2011 22:06:44 -0700 (PDT) Received: from localhost.localdomain ([221.239.34.230]) by mx.google.com with ESMTPS id i9sm470103pbc.5.2011.08.18.22.06.36 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 18 Aug 2011 22:06:42 -0700 (PDT) From: Changli Gao To: "David S. Miller" Cc: Eric Dumazet , Tom Herbert , netdev@vger.kernel.org, Changli Gao Subject: net: rps: support 802.1Q Date: Fri, 19 Aug 2011 13:05:53 +0800 Message-Id: <1313730353-25379-1-git-send-email-xiaosuo@gmail.com> X-Mailer: git-send-email 1.7.3.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org For the 802.1Q packets, if the NIC doesn't support hw-accel-vlan-rx, RPS won't inspect the internal 4 tuples to generate skb->rxhash, so this kind of traffic can't get any benefit from RPS. This patch adds the support for 802.1Q to RPS. Signed-off-by: Changli Gao --- net/core/dev.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 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/core/dev.c b/net/core/dev.c index ead0366..be7ee50 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2529,6 +2529,7 @@ void __skb_get_rxhash(struct sk_buff *skb) int nhoff, hash = 0, poff; const struct ipv6hdr *ip6; const struct iphdr *ip; + const struct vlan_hdr *vlan; u8 ip_proto; u32 addr1, addr2; u16 proto; @@ -2565,6 +2566,13 @@ again: addr2 = (__force u32) ip6->daddr.s6_addr32[3]; nhoff += 40; break; + case __constant_htons(ETH_P_8021Q): + if (!pskb_may_pull(skb, sizeof(*vlan) + nhoff)) + goto done; + vlan = (const struct vlan_hdr *) (skb->data + nhoff); + proto = vlan->h_vlan_encapsulated_proto; + nhoff += sizeof(*vlan); + goto again; default: goto done; }