From: Andrew Lunn <andrew@lunn.ch>
To: Marek Vasut <marex@denx.de>
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com,
vivien.didelot@savoirfairelinux.com, Woojung.Huh@microchip.com,
UNGLinuxDriver@microchip.com,
Tristram Ha <Tristram.Ha@microchip.com>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH 3/5] net: dsa: ksz: Factor out common tag code
Date: Sat, 8 Dec 2018 12:34:48 +0100 [thread overview]
Message-ID: <20181208113448.GD16502@lunn.ch> (raw)
In-Reply-To: <20181207181845.21702-3-marex@denx.de>
On Fri, Dec 07, 2018 at 07:18:43PM +0100, Marek Vasut wrote:
> From: Tristram Ha <Tristram.Ha@microchip.com>
>
> Factor out common code from the tag_ksz , so that the code can be used
> with other KSZ family switches which use differenly sized tags.
I prefer this implementation over what Tristram recently submitted. It
is also what we suggested a while back. However, since then we have
had Spectra/meltdown, and we now know a function call through a
pointer is expensive. This is the hot path, every frame comes through
here, so it is worth taking the time to optimize this. Could you try
to remove the ksz_tag_ops structure. xmit looks simple, since it is a
tail call, so you can do that in ksz9477_xmit. Receive looks a bit
more complex.
I also think for the moment we need it ignore PTP until we have the
big picture sorted out. If need be, the code can be refactored yet
again. But i don't want PTP holding up getting more switches
supported.
> Signed-off-by: Tristram Ha <Tristram.Ha@microchip.com>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> Cc: Woojung Huh <woojung.huh@microchip.com>
> Cc: David S. Miller <davem@davemloft.net>
> ---
> net/dsa/tag_ksz.c | 125 +++++++++++++++++++++++++++++++++-------------
> 1 file changed, 90 insertions(+), 35 deletions(-)
>
> diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c
> index 036bc62198f28..d94bad1ab7e53 100644
> --- a/net/dsa/tag_ksz.c
> +++ b/net/dsa/tag_ksz.c
> @@ -14,34 +14,30 @@
> #include <net/dsa.h>
> #include "dsa_priv.h"
>
> -/* For Ingress (Host -> KSZ), 2 bytes are added before FCS.
> - * ---------------------------------------------------------------------------
> - * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|tag1(1byte)|FCS(4bytes)
> - * ---------------------------------------------------------------------------
> - * tag0 : Prioritization (not used now)
> - * tag1 : each bit represents port (eg, 0x01=port1, 0x02=port2, 0x10=port5)
> - *
> - * For Egress (KSZ -> Host), 1 byte is added before FCS.
> - * ---------------------------------------------------------------------------
> - * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|tag0(1byte)|FCS(4bytes)
> - * ---------------------------------------------------------------------------
> - * tag0 : zero-based value represents port
> - * (eg, 0x00=port1, 0x02=port3, 0x06=port7)
> - */
> +struct ksz_tag_ops {
> + void (*get_tag)(u8 *tag, unsigned int *port, unsigned int *len);
> + void (*set_tag)(struct sk_buff *skb, struct net_device *dev);
> +};
>
> -#define KSZ_INGRESS_TAG_LEN 2
> -#define KSZ_EGRESS_TAG_LEN 1
> +/* Typically only one byte is used for tail tag. */
> +#define KSZ_EGRESS_TAG_LEN 1
>
> -static struct sk_buff *ksz_xmit(struct sk_buff *skb, struct net_device *dev)
> +/* Frames with following addresse may need to be sent even when the port is
> + * closed.
> + */
> +static const u8 special_mult_addr[] = {
> + 0x01, 0x80, 0xC2, 0x00, 0x00, 0x00
> +};
> +
This is new functionality, not part of the refactoring the
code. Please add that as a new patch. Also, you can probably make use
of is_link_local_ether_addr().
Andrew
next prev parent reply other threads:[~2018-12-08 11:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-07 18:18 [PATCH 1/5] net: dsa: ksz: Add MIB counter reading support Marek Vasut
2018-12-07 18:18 ` [PATCH 2/5] net: dsa: ksz: Rename NET_DSA_TAG_KSZ to _KSZ9477 Marek Vasut
2018-12-07 18:18 ` [PATCH 3/5] net: dsa: ksz: Factor out common tag code Marek Vasut
2018-12-08 11:34 ` Andrew Lunn [this message]
2018-12-10 20:32 ` Tristram.Ha
2018-12-10 21:58 ` Marek Vasut
2018-12-11 7:40 ` Andrew Lunn
2018-12-13 3:42 ` Marek Vasut
2018-12-07 18:18 ` [PATCH 4/5] net: dsa: ksz: Add KSZ8795 " Marek Vasut
2018-12-07 18:18 ` [PATCH 5/5] net: dsa: ksz: Add Microchip KSZ8795 DSA driver Marek Vasut
2018-12-08 11:52 ` Andrew Lunn
2018-12-07 20:56 ` [PATCH 1/5] net: dsa: ksz: Add MIB counter reading support David Miller
2018-12-08 11:16 ` Andrew Lunn
2018-12-10 13:27 ` Marek Vasut
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=20181208113448.GD16502@lunn.ch \
--to=andrew@lunn.ch \
--cc=Tristram.Ha@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=marex@denx.de \
--cc=netdev@vger.kernel.org \
--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).