Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1734525
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers |
| Date | 2017-09-19 00:50 +0200 |
| Message-ID | <urd1v-4cQ-9@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <uncdI-5xq-27@gated-at.bofh.it> <uncQp-5Oa-5@gated-at.bofh.it> <ura3E-29O-31@gated-at.bofh.it> <uramZ-2hX-5@gated-at.bofh.it> <urbj4-32d-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Sep 18, 2017 at 08:55:17PM +0000, Tristram.Ha@microchip.com wrote:
> > > > This is ugly. We have a clean separation between a switch driver and a
> > > > tag driver. Here you are mixing them together. Don't. Look at the
> > > > mailing lists for what Florian and I suggested to Pavel. It will also
> > > > solve your include file issue above.
> > >
> > > It seems to me all tag_*.c are hard-coded. They do not have access to
> > > the switch device and just use the bit definitions defined in the top to
> > > do the job.
> > >
> > > This creates a problem for all KSZ switch devices as they have different
> > > tail tag formats and lengths. There will be potentially 4 additional
> > > DSA_TAG_PROT_KSZ* just to handle them. Extra files will be added
> > > with about the same code.
> >
> > Hi Tristram
> >
> > Think about factoring out the common code into a shared functions.
> >
>
> I am a little unsure what you have in mind. Can you elaborate?
You say you need 4 DSA_TAG_PROT_KSZ. I guess the code is nearly
identical in them all? If i remember correctly, the two tag bytes are
the other way around?
static int ksz8k_xmit( *skb, struct net_device *dev)
{
uint8* tag;
tag = ksz_xmit(skb, dev)
if (!tag)
return NULL;
tag[0] = 1 << p->dp->index;
tag[1] = 0;
return skb;
}
static int ksz9k_xmit( *skb, struct net_device *dev)
{
uint8* tag;
tag = ksz_xmit(skb, dev)
if (!tag)
return NULL;
tag[0] = 0;
tag[1] = 1 << p->dp->index;
return skb;
}
const struct dsa_device_ops ksz8k_netdev_ops = {
.xmit = ksz8k_xmit,
.rcv = ksz8k_rcv,
};
const struct dsa_device_ops ksz9k_netdev_ops = {
.xmit = ksz9k_xmit,
.rcv = ksz9k_rcv,
};
Andrew
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
RE: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers <Tristram.Ha@microchip.com> - 2017-09-18 21:40 +0200
Re: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers Andrew Lunn <andrew@lunn.ch> - 2017-09-18 22:00 +0200
RE: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers <Tristram.Ha@microchip.com> - 2017-09-18 23:00 +0200
Re: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers Andrew Lunn <andrew@lunn.ch> - 2017-09-19 00:50 +0200
Re: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers Andrew Lunn <andrew@lunn.ch> - 2017-09-19 01:00 +0200
Re: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers Florian Fainelli <f.fainelli@gmail.com> - 2017-09-19 01:50 +0200
RE: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers <Tristram.Ha@microchip.com> - 2017-09-19 02:50 +0200
RE: [PATCH RFC 6/6] Modify tag_ksz.c to support other KSZ switch drivers <Tristram.Ha@microchip.com> - 2017-09-19 01:50 +0200
csiph-web