From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pavel Machek Subject: Re: [PATCH RFC 5/6] net: dsa: microchip: Update tag_ksz.c to access switch driver Date: Sun, 9 Dec 2018 10:17:20 +0100 Message-ID: <20181209091720.GE7561@amd> References: <1543880097-7106-1-git-send-email-Tristram.Ha@microchip.com> <1543880097-7106-6-git-send-email-Tristram.Ha@microchip.com> <20181205180038.GG12484@lunn.ch> <20181205181808.GH12484@lunn.ch> <899f4595-eaa1-269d-ca31-36bdf8b64923@gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DqhR8hV3EnoxUkKN" Cc: f.fainelli@gmail.com, andrew@lunn.ch, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org To: Tristram.Ha@microchip.com Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:52440 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbeLIJRX (ORCPT ); Sun, 9 Dec 2018 04:17:23 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: --DqhR8hV3EnoxUkKN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2018-12-06 20:00:26, Tristram.Ha@microchip.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 cann= ot > > >> 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. > >=20 > > Agreed, that is what is done by net/dsa/tag_brcm.c because there are two > > formats for the Broadcom tag: > >=20 > > - 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 > > >=20 > 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 fol= lowing > 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. >=20 > Even then it will not work if Microchip wants to add 1588 PTP capability = to the switches. >=20 > For KSZ9477 the length of the tail tag changes when the PTP function is e= nabled. > Typically this function is either enabled or disabled all the time, but i= f users want to > change that during normal operation to see how the switch behaves, the tr= ansmit > 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 --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --DqhR8hV3EnoxUkKN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlwM3aAACgkQMOfwapXb+vK5+wCeKT5nBYWvw6fXVXmIv16Qmheu D/4An2cJJCvRFvPILoSQwusF80TF16fY =bhK9 -----END PGP SIGNATURE----- --DqhR8hV3EnoxUkKN--