From: Andrew Lunn <andrew@lunn.ch>
To: Pavel Machek <pavel@denx.de>
Cc: Woojung.Huh@microchip.com, nathan.leigh.conrad@gmail.com,
vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Tristram.Ha@micrel.com
Subject: Re: [PATCH] DSA support for Micrel KSZ8895
Date: Sun, 27 Aug 2017 18:44:34 +0200 [thread overview]
Message-ID: <20170827164434.GH13622@lunn.ch> (raw)
In-Reply-To: <20170827123658.GA727@amd>
> No, tag_ksz part probably is not acceptable. Do you see solution
> better than just copying it into tag_ksz1 file?
How about something like this, which needs further work to actually
compile, but should give you the idea.
Andrew
index 99e38af85fc5..843e77b7c270 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -49,8 +49,11 @@ const struct dsa_device_ops *dsa_device_ops[DSA_TAG_LAST] = {
#ifdef CONFIG_NET_DSA_TAG_EDSA
[DSA_TAG_PROTO_EDSA] = &edsa_netdev_ops,
#endif
-#ifdef CONFIG_NET_DSA_TAG_KSZ
- [DSA_TAG_PROTO_KSZ] = &ksz_netdev_ops,
+#ifdef CONFIG_NET_DSA_TAG_KSZ_8K
+ [DSA_TAG_PROTO_KSZ8K] = &ksz8k_netdev_ops,
+#endif
+#ifdef CONFIG_NET_DSA_TAG_KSZ_9K
+ [DSA_TAG_PROTO_KSZ9K] = &ksz9k_netdev_ops,
#endif
#ifdef CONFIG_NET_DSA_TAG_LAN9303
[DSA_TAG_PROTO_LAN9303] = &lan9303_netdev_ops,
diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
index de66ca8e6201..398b833889f1 100644
--- a/net/dsa/tag_ksz.c
+++ b/net/dsa/tag_ksz.c
@@ -35,6 +35,9 @@
static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_port *dp = p->dp;
+ struct dsa_switch *ds = dp->ds;
+ struct dsa_switch_tree *dst = ds->dst;
struct sk_buff *nskb;
int padlen;
u8 *tag;
@@ -69,8 +72,14 @@ static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
}
tag = skb_put(nskb, KSZ_INGRESS_TAG_LEN);
- tag[0] = 0;
- tag[1] = 1 << p->dp->index; /* destination port */
+ if (dst->tag_ops == ksz8k_netdev_ops) {
+ tag[0] = 1 << p->dp->index; /* destination port */0;
+ tag[1] = 0;
+ }
+
+ if (dst->tag_ops == ksz9k_netdev_ops) {
+ tag[0] = 0;
+ tag[1] = 1 << p->dp->index; /* destination port */
return nskb;
}
@@ -98,7 +107,12 @@ static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,
return skb;
}
-const struct dsa_device_ops ksz_netdev_ops = {
+const struct dsa_device_ops ksz8k_netdev_ops = {
+ .xmit = ksz_xmit,
+ .rcv = ksz_rcv,
+};
+
+const struct dsa_device_ops ksz9k_netdev_ops = {
.xmit = ksz_xmit,
.rcv = ksz_rcv,
};
next prev parent reply other threads:[~2017-08-27 16:44 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 7:55 DSA support for Micrel KSZ8895 Pavel Machek
2017-08-16 14:04 ` Andrew Lunn
2017-08-16 14:25 ` Woojung.Huh
2017-08-23 9:09 ` Pavel Machek
2017-08-23 12:42 ` Andrew Lunn
2017-08-23 21:48 ` Woojung.Huh
2017-08-28 10:14 ` Pavel Machek
2017-08-28 13:19 ` Andrew Lunn
2017-08-27 12:36 ` [PATCH] " Pavel Machek
2017-08-27 13:59 ` Andrew Lunn
2017-08-27 16:31 ` Andrew Lunn
2017-08-28 7:02 ` Pavel Machek
2017-08-28 14:09 ` Andrew Lunn
2017-08-28 14:47 ` Maxim Uvarov
2017-08-29 7:41 ` Pavel Machek
2017-08-29 12:26 ` Andrew Lunn
2017-08-29 21:15 ` Pavel Machek
2017-08-29 21:23 ` Florian Fainelli
2017-08-30 10:06 ` Maxim Uvarov
2017-08-29 7:45 ` Pavel Machek
2017-08-30 21:32 ` Tristram.Ha
2017-08-30 22:00 ` Andrew Lunn
2017-09-01 12:15 ` Pavel Machek
2017-09-01 22:18 ` Florian Fainelli
2017-09-02 15:40 ` Pavel Machek
2017-09-06 9:14 ` Maxim Uvarov
2017-09-06 16:47 ` Tristram.Ha
2017-09-06 17:09 ` Andrew Lunn
2017-08-27 16:44 ` Andrew Lunn [this message]
2017-08-28 6:40 ` Pavel Machek
2017-08-27 16:56 ` Florian Fainelli
2017-08-28 6:47 ` Pavel Machek
2017-08-27 22:03 ` Woojung.Huh
2017-08-29 15:33 ` kbuild test robot
2017-08-16 18:32 ` Pavel Machek
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=20170827164434.GH13622@lunn.ch \
--to=andrew@lunn.ch \
--cc=Tristram.Ha@micrel.com \
--cc=Woojung.Huh@microchip.com \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan.leigh.conrad@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pavel@denx.de \
--cc=vivien.didelot@savoirfairelinux.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).