From patchwork Fri Nov 10 11:54:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egil Hjelmeland X-Patchwork-Id: 836714 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yYJTj393gz9t3t for ; Fri, 10 Nov 2017 22:58:49 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284AbdKJL6C (ORCPT ); Fri, 10 Nov 2017 06:58:02 -0500 Received: from aibo.runbox.com ([91.220.196.211]:36940 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbdKJL6B (ORCPT ); Fri, 10 Nov 2017 06:58:01 -0500 Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1eD7wZ-0003X3-NC; Fri, 10 Nov 2017 12:57:55 +0100 Received: from 93.89.113.32.ip.vitnett.no ([93.89.113.32] helo=localhost.localdomain) by mailfront10.runbox.com with esmtpsa (uid:646232 ) (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1eD7wI-0006Wo-If; Fri, 10 Nov 2017 12:57:38 +0100 From: Egil Hjelmeland To: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Egil Hjelmeland Subject: [PATCH net-next 2/2] net: dsa: lan9303: Clear offload_fwd_mark for IGMP Date: Fri, 10 Nov 2017 12:54:35 +0100 Message-Id: <20171110115435.4261-3-privat@egil-hjelmeland.no> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171110115435.4261-1-privat@egil-hjelmeland.no> References: <20171110115435.4261-1-privat@egil-hjelmeland.no> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that IGMP packets no longer is flooded in HW, we want the SW bridge to forward packets based on bridge configuration. To make that happen, IGMP packets must have skb->offload_fwd_mark = 0. Signed-off-by: Egil Hjelmeland --- net/dsa/tag_lan9303.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index 5ba01fc3c6ba..b8c5e52b2eff 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -92,6 +92,8 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, { u16 *lan9303_tag; unsigned int source_port; + u16 ether_type_nw; + u8 ip_protocol; if (unlikely(!pskb_may_pull(skb, LAN9303_TAG_LEN))) { dev_warn_ratelimited(&dev->dev, @@ -129,6 +131,17 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, skb->offload_fwd_mark = !ether_addr_equal(skb->data - ETH_HLEN, eth_stp_addr); + /* We also need IGMP packets to have skb->offload_fwd_mark = 0. + * Solving this for all conceivable situations would add more cost to + * every packet. Instead we handle just the common case: + * No VLAN tag + Ethernet II framing. + * Test least probable term first. + */ + ether_type_nw = lan9303_tag[2]; + ip_protocol = *(skb->data + 9); + if (ip_protocol == IPPROTO_IGMP && ether_type_nw == htons(ETH_P_IP)) + skb->offload_fwd_mark = 0; + return skb; }