]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net: dsa: add master helper to look up slaves
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Fri, 29 Sep 2017 21:19:15 +0000 (17:19 -0400)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Oct 2017 03:15:07 +0000 (04:15 +0100)
commit3775b1b7f0c330e59c434d1852d7762ae0a9c164
tree260da462218e9ef4823835cce47f1224a452c6e9
parent075cfdd659cb1e86f948f11ba577f27706f0756e
net: dsa: add master helper to look up slaves

The DSA tagging code does not need to know about the DSA architecture,
it only needs to return the slave device corresponding to the source
port index (and eventually the source device index for cascade-capable
switches) parsed from the frame received on the master device.

For this purpose, provide an inline dsa_master_get_slave helper which
validates the device and port indexes and look up the slave device.

This makes the tagging rcv functions more concise and robust, and also
makes dsa_get_cpu_port obsolete.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa_priv.h
net/dsa/tag_brcm.c
net/dsa/tag_dsa.c
net/dsa/tag_edsa.c
net/dsa/tag_ksz.c
net/dsa/tag_lan9303.c
net/dsa/tag_mtk.c
net/dsa/tag_qca.c
net/dsa/tag_trailer.c