From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, andrew@lunn.ch, linux@roeck-us.net,
jiri@resnulli.us, sfeldma@gmail.com,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH RFC 5/5] net: dsa: bcm_sf2: Allow disabling tagging protocol
Date: Tue, 25 Aug 2015 15:50:15 -0700 [thread overview]
Message-ID: <1440543015-14693-6-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1440543015-14693-1-git-send-email-f.fainelli@gmail.com>
Update the IMP port configuration to check whether tagging is enabled
(DSA_TAG_PROTO_BRCM) or disabled (DSA_TAG_PROTO_NONE) and correctly
program the relevant registers in both cases.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/bcm_sf2.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 289e20443d83..68abcc545231 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -159,6 +159,7 @@ static void bcm_sf2_imp_vlan_setup(struct dsa_switch *ds, int cpu_port)
static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
{
+ bool tagging_disabled = !!(ds->tag_protocol == DSA_TAG_PROTO_NONE);
struct bcm_sf2_priv *priv = ds_to_priv(ds);
u32 reg, val;
@@ -199,21 +200,30 @@ static void bcm_sf2_imp_setup(struct dsa_switch *ds, int port)
/* Enable Broadcom tags for IMP port */
reg = core_readl(priv, CORE_BRCM_HDR_CTRL);
- reg |= val;
+ if (!tagging_disabled)
+ reg |= val;
+ else
+ reg &= ~val;
core_writel(priv, reg, CORE_BRCM_HDR_CTRL);
/* Enable reception Broadcom tag for CPU TX (switch RX) to
* allow us to tag outgoing frames
*/
reg = core_readl(priv, CORE_BRCM_HDR_RX_DIS);
- reg &= ~(1 << port);
+ if (tagging_disabled)
+ reg |= 1 << port;
+ else
+ reg &= ~(1 << port);
core_writel(priv, reg, CORE_BRCM_HDR_RX_DIS);
/* Enable transmission of Broadcom tags from the switch (CPU RX) to
* allow delivering frames to the per-port net_devices
*/
reg = core_readl(priv, CORE_BRCM_HDR_TX_DIS);
- reg &= ~(1 << port);
+ if (tagging_disabled)
+ reg |= 1 << port;
+ else
+ reg &= ~(1 << port);
core_writel(priv, reg, CORE_BRCM_HDR_TX_DIS);
/* Force link status for IMP port */
--
2.1.0
next prev parent reply other threads:[~2015-08-25 22:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-25 22:50 [PATCH RFC 0/5] net: L2 only interfaces Florian Fainelli
2015-08-25 22:50 ` [PATCH RFC 1/5] net: add IFF_L2_ONLY flag Florian Fainelli
2015-08-25 22:50 ` [PATCH RFC 2/5] net: ipv4: Skip in_dev initialization for IFF_L2_ONLY interfaces Florian Fainelli
2015-08-25 22:50 ` [PATCH RFC 3/5] net: ipv6: Skip in6_dev " Florian Fainelli
2015-08-25 22:50 ` [PATCH RFC 4/5] net: dsa: Flag slave network devices with IFF_L2_ONLY Florian Fainelli
2015-08-25 22:50 ` Florian Fainelli [this message]
2015-08-26 0:09 ` [PATCH RFC 5/5] net: dsa: bcm_sf2: Allow disabling tagging protocol David Miller
2015-08-25 23:20 ` [PATCH RFC 0/5] net: L2 only interfaces Alexei Starovoitov
2015-08-25 23:24 ` Florian Fainelli
2015-08-25 23:33 ` David Ahern
2015-09-01 17:07 ` Vivien Didelot
2015-08-25 23:24 ` Stephen Hemminger
2015-08-25 23:23 ` Florian Fainelli
2015-08-25 23:44 ` Sowmini Varadhan
2015-08-25 23:52 ` David Ahern
2015-08-26 0:05 ` Sowmini Varadhan
2015-08-26 0:12 ` David Miller
2015-08-26 4:24 ` Marcel Holtmann
2015-08-26 17:37 ` Florian Fainelli
2015-08-26 17:56 ` Marcel Holtmann
2015-08-26 17:32 ` Florian Fainelli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440543015-14693-6-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=linux@roeck-us.net \
--cc=netdev@vger.kernel.org \
--cc=sfeldma@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).