Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721053
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] DSA support for Micrel KSZ8895 |
| Date | 2017-08-28 08:50 +0200 |
| Message-ID | <ujm1Y-2ab-1@gated-at.bofh.it> (permalink) |
| References | <uf1p8-4gv-31@gated-at.bofh.it> <uf7bb-83I-5@gated-at.bofh.it> <uf7ux-8bJ-3@gated-at.bofh.it> <uj519-7Ez-21@gated-at.bofh.it> <uj8V4-1O7-17@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
Hi!
> > 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.
If that's acceptable, yes, I can do something similar. I don't think
CONFIG_NET_DSA_TAG_KSZ_8K / CONFIG_NET_DSA_TAG_KSZ_9K is suitable
naming (these will probably differ according to number of ports), what
about keeping CONFIG_NET_DSA_TAG_KSZ and adding
CONFIG_NET_DSA_TAG_KSZ_1B (for one byte)?
Thanks,
Pavel
> 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,
> };
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH] DSA support for Micrel KSZ8895 Andrew Lunn <andrew@lunn.ch> - 2017-08-27 18:50 +0200 Re: [PATCH] DSA support for Micrel KSZ8895 Pavel Machek <pavel@ucw.cz> - 2017-08-28 08:50 +0200
csiph-web