Received: by 10.223.164.202 with SMTP id h10csp217213wrb; Mon, 13 Nov 2017 05:26:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMYm4mgMnJhdZ3jOFLC8wHO7Aen7B9RjXK8EsNI+1j596oyPnfTl40sWfQDarYnFgzA+cbJl X-Received: by 10.84.200.39 with SMTP id s36mr8995270pld.9.1510579586114; Mon, 13 Nov 2017 05:26:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510579586; cv=none; d=google.com; s=arc-20160816; b=HZ5U5CQFLRmWTtegj3oJwtpwkwt5rg4GSQD3OcisZe3/VGFMxm+L7nKmIRTq46Ln8k K0labvPftqmPod/hhkBJX+SXjoCfwnT1n6LpvCkjClwzyjzf5JgSzTfOP12oGtgm+Nw2 9Vt+s6xiwGDTyO68hOHQB2+z9s8R4j4kTSWc6l7s/SZdJQaEqOalDFe+H29B/xQrIsXP DjxGKkAVSRMd3FrSJeyAw4VCSgCQLbGkzPtKamy91hmRMfVg3/tgkzI9r4PxQ1O4nNzh yHdjRRKgLd1wK9hDEfZWRwgCwD9vwiJa3KwnSeXxL2SUEbHVlAcvZYUhXlUOudHdDRPM EBdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=HlUte40KKtxxsTT4p12AglBph8Cc3q7Kazz/ezjf84g=; b=W7TQ4uz1i8VBu9lDAZntPcja04h6Fns5dyIvC5ruHu97urTSA5+1qmusXCLui7uASV U//J1yuOcc3cGdo3Ng4Kj/piVgQnYbJ9v6G0rvuoNmCQqFVc9e2S10Z738x+KqyGWJD7 pctJ2ievlP/AV4BocFvSUScWk4xsPa8pd4jdGumSJt1apacBpm3XwhqqNCRifqBfH//Q WYaTU84+bVGiLztXgtGYuv213ChSrTV0k36r9+z1x0Of0t8MMVJeEnhRBQKYfDcR7aTR bGccNtTxyON5/GU+9/B7dL9/MIpz7fDhQd1pJBFUg2372gJilyBvGMrFBkOF9O+Pl2rW JxFg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si13940786pgo.472.2017.11.13.05.26.13; Mon, 13 Nov 2017 05:26:26 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752637AbdKMNZi (ORCPT + 95 others); Mon, 13 Nov 2017 08:25:38 -0500 Received: from aibo.runbox.com ([91.220.196.211]:48420 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754482AbdKMNZg (ORCPT ); Mon, 13 Nov 2017 08:25:36 -0500 Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1eEEk0-0000Y4-94; Mon, 13 Nov 2017 14:25:32 +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 1eEEjz-0004jj-IY; Mon, 13 Nov 2017 14:25:31 +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] net: dsa: lan9303: calculate offload_fwd_mark from tag Date: Mon, 13 Nov 2017 14:25:25 +0100 Message-Id: <20171113132525.12599-1-privat@egil-hjelmeland.no> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The lan9303 set bits in the host CPU tag indicating if a ingress frame is a trapped IGMP or STP frame. Use these bits to calculate skb->offload_fwd_mark more efficiently. Signed-off-by: Egil Hjelmeland --- net/dsa/tag_lan9303.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/net/dsa/tag_lan9303.c b/net/dsa/tag_lan9303.c index b8c5e52b2eff..548c00254c07 100644 --- a/net/dsa/tag_lan9303.c +++ b/net/dsa/tag_lan9303.c @@ -42,6 +42,10 @@ #define LAN9303_TAG_LEN 4 # define LAN9303_TAG_TX_USE_ALR BIT(3) # define LAN9303_TAG_TX_STP_OVERRIDE BIT(4) +# define LAN9303_TAG_RX_IGMP BIT(3) +# define LAN9303_TAG_RX_STP BIT(4) +# define LAN9303_TAG_RX_TRAPPED_TO_CPU (LAN9303_TAG_RX_IGMP | \ + LAN9303_TAG_RX_STP) /* Decide whether to transmit using ALR lookup, or transmit directly to * port using tag. ALR learning is performed only when using ALR lookup. @@ -91,9 +95,8 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt) { u16 *lan9303_tag; + u16 lan9303_tag1; 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, @@ -114,7 +117,8 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, return NULL; } - source_port = ntohs(lan9303_tag[1]) & 0x3; + lan9303_tag1 = ntohs(lan9303_tag[1]); + source_port = lan9303_tag1 & 0x3; skb->dev = dsa_master_find_slave(dev, 0, source_port); if (!skb->dev) { @@ -128,19 +132,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, skb_pull_rcsum(skb, 2 + 2); memmove(skb->data - ETH_HLEN, skb->data - (ETH_HLEN + LAN9303_TAG_LEN), 2 * ETH_ALEN); - 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; + skb->offload_fwd_mark = !(lan9303_tag1 & LAN9303_TAG_RX_TRAPPED_TO_CPU); return skb; } -- 2.11.0 From 1583959409847320846@xxx Mon Nov 13 13:56:47 +0000 2017 X-GM-THRID: 1583945932285428456 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread