[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181209091720.GE7561@amd>
Date: Sun, 9 Dec 2018 10:17:20 +0100
From: Pavel Machek <pavel@....cz>
To: Tristram.Ha@...rochip.com
Cc: f.fainelli@...il.com, andrew@...n.ch, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org
Subject: Re: [PATCH RFC 5/6] net: dsa: microchip: Update tag_ksz.c to access
switch driver
On Thu 2018-12-06 20:00:26, Tristram.Ha@...rochip.com wrote:
> > >>> Update tag_ksz.c to access switch driver's tail tagging operations.
> > >>
> > >> Hi Tristram
> > >>
> > >> Humm, i'm not sure we want this, the tagging spit into two places. I
> > >> need to take a closer look at the previous patch, to see why it cannot
> > >> be done here.
> > >
> > > O.K, i think i get what is going on.
> > >
> > > I would however implement it differently.
> > >
> > > One net/dsa/tag_X.c file can export two dsa_device_ops structures,
> > > allowing you to share common code for the two taggers. You could call
> > > these DSA_TAG_PROTO_KSZ_1_BYTE, and DSA_TAG_PROTO_KSZ_2_BYTE,
> > and the
> > > .get_tag_protocol call would then return the correct one for the
> > > switch.
> >
> > Agreed, that is what is done by net/dsa/tag_brcm.c because there are two
> > formats for the Broadcom tag:
> >
> > - TAG_BRCM: the 4-bytes Broadcom tag is between MAC SA and Ethertype
> > - TAG_BRCM_PREPEND: the 4-bytes Broadcom tag is before the MAC DA
> >
>
> I did try to implement this way. But the other switches do not have the same
> format even though the length is the same. Then I need to change the following
> files for any new KSZ switch: include/linux/dsa.h, net/dsa/dsa.c, net/dsa/dsa_priv.h,
> and finally net/dsa/tag_ksz.c.
>
> Even then it will not work if Microchip wants to add 1588 PTP capability to the switches.
>
> For KSZ9477 the length of the tail tag changes when the PTP function is enabled.
> Typically this function is either enabled or disabled all the time, but if users want to
> change that during normal operation to see how the switch behaves, the transmit
> function completely stops working correctly.
I'd be careful about locking. Seems like dsa was designed with "tag
format is static", and you want to change it dynamically...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists