[net-next RFC PATCH 0/6] Add support for qca8k mdio rw in Ethernet packet

From: Ansuel Smith
Date: Tue Dec 07 2021 - 09:59:57 EST


Hi, this is still WIP and currently has some problem but I would love if
someone can give this a superficial review and answer to some problem
with this.

The main reason for this is that we notice some routing problem in the
switch and it seems assisted learning is needed. Considering mdio is
quite slow due to the indirect write using this Ethernet alternative way
seems to be quicker.

The qca8k switch supports a special way to pass mdio read/write request
using specially crafted Ethernet packet.
This works by putting some defined data in the Ethernet header where the
mac source and dst should be placed. The Ethernet type header is set to qca
header and is set to a mdio read/write type.
This is used to communicate to the switch that this is a special packet
and should be parsed differently.

Current implementation of this use completion API to wait for the packet
to be processed by the tagger and has a timeout that fallback to the
legacy mdio way and mutex to enforce one transaction at time.

Here I list the main concern I have about this:
- Is the changes done to the tagger acceptable? (moving stuff to global
include)
- Is it correct to put the skb generation code in the qca8k source?
- Is the changes generally correct? (referring to how this is
implemented with part of the implementation split between the tagger
and the driver)

I still have to find a solution to a slowdown problem and this is where
I would love to get some hint.
Currently I still didn't find a good way to understand when the tagger
starts to accept packets and because of this the initial setup is slow
as every completion timeouts. Am I missing something or is there a way
to check for this?
After the initial slowdown, as soon as the cpu port is ready and starts
to accept packet, every transaction is near instant and no completion
timeouts.

As I said this is still WIP but it does work correctly aside from the
initial slowdown problem. (the slowdown is in the first port init and at
the first port init... from port 2 the tagger starts to accept packet
and this starts to work)

Ansuel Smith (6):
net: dsa: tag_qca: convert to FIELD macro
net: dsa: tag_qca: move define to include linux/dsa
net: dsa: tag_qca: add define for mdio read/write in ethernet packet
net: dsa: qca8k: Add support for mdio read/write in Ethernet packet
net: dsa: tag_qca: Add support for handling mdio read/write packet
net: dsa: qca8k: cache lo and hi for mdio write

drivers/net/dsa/qca8k.c | 205 ++++++++++++++++++++++++++++++++++--
drivers/net/dsa/qca8k.h | 5 +
include/linux/dsa/tag_qca.h | 75 +++++++++++++
net/dsa/tag_qca.c | 69 +++++++-----
4 files changed, 320 insertions(+), 34 deletions(-)
create mode 100644 include/linux/dsa/tag_qca.h

--
2.32.0