dsa: Add TAG protocol to tag ops
authorAndrew Lunn <andrew@lunn.ch>
Sun, 28 Apr 2019 17:37:14 +0000 (19:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Apr 2019 23:41:01 +0000 (19:41 -0400)
In order that we can match the tagging protocol a switch driver
request to the tagger, we need to know what protocol the tagger
supports. Add this information to the ops structure.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
v2
More tag protocol to end of structure to keep hot members at the beginning.

Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/dsa.h
net/dsa/dsa.c
net/dsa/tag_brcm.c
net/dsa/tag_dsa.c
net/dsa/tag_edsa.c
net/dsa/tag_gswip.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

index 8f3d5e0825a2efac1e15523023bc110647e048d0..720036f48fb333a3f67c7b1668ec4ab093cbbc58 100644 (file)
@@ -70,6 +70,7 @@ struct dsa_device_ops {
                            int *offset);
        unsigned int overhead;
        const char *name;
+       enum dsa_tag_protocol proto;
 };
 
 #define DSA_TAG_DRIVER_ALIAS "dsa_tag-"
index 92b3cd129eb79b6e66af577192651db5754da442..2da733dff86bc82369c690f8859d1047eadc8760 100644 (file)
@@ -36,6 +36,7 @@ static struct sk_buff *dsa_slave_notag_xmit(struct sk_buff *skb,
 
 static const struct dsa_device_ops none_ops = {
        .name   = "none",
+       .proto  = DSA_TAG_PROTO_NONE,
        .xmit   = dsa_slave_notag_xmit,
        .rcv    = NULL,
 };
index 59421f9e96de62232e23f471ed7f35fa227ea489..39b380485e5a24259effe3e1643d76cd856a95a2 100644 (file)
@@ -169,6 +169,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
 
 const struct dsa_device_ops brcm_netdev_ops = {
        .name   = "brcm",
+       .proto  = DSA_TAG_PROTO_BRCM,
        .xmit   = brcm_tag_xmit,
        .rcv    = brcm_tag_rcv,
        .overhead = BRCM_TAG_LEN,
@@ -195,6 +196,7 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb,
 
 const struct dsa_device_ops brcm_prepend_netdev_ops = {
        .name   = "brcm-prepend",
+       .proto  = DSA_TAG_PROTO_BRCM_PREPEND,
        .xmit   = brcm_tag_xmit_prepend,
        .rcv    = brcm_tag_rcv_prepend,
        .overhead = BRCM_TAG_LEN,
index b8f3236db87782528da17fa029f8b0df1def787a..ec9b66c11219c1c91bd9f9e09e7d445642d0fea6 100644 (file)
@@ -152,6 +152,7 @@ static int dsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 
 const struct dsa_device_ops dsa_netdev_ops = {
        .name   = "dsa",
+       .proto  = DSA_TAG_PROTO_DSA,
        .xmit   = dsa_xmit,
        .rcv    = dsa_rcv,
        .flow_dissect   = dsa_tag_flow_dissect,
index c4fddf7292cfe849b475c19941030c927220d2ca..866d4e684511b4b71d7c1d9d870cec53eb006e75 100644 (file)
@@ -171,6 +171,7 @@ static int edsa_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 
 const struct dsa_device_ops edsa_netdev_ops = {
        .name   = "edsa",
+       .proto  = DSA_TAG_PROTO_EDSA,
        .xmit   = edsa_xmit,
        .rcv    = edsa_rcv,
        .flow_dissect   = edsa_tag_flow_dissect,
index 6a7ff063b6e0dd0e65f3a188c68f79ccec373abf..1921563731088b1cfd68929fe1aa70232159d70e 100644 (file)
@@ -105,6 +105,7 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb,
 
 const struct dsa_device_ops gswip_netdev_ops = {
        .name = "gwsip",
+       .proto  = DSA_TAG_PROTO_GSWIP,
        .xmit = gswip_tag_xmit,
        .rcv = gswip_tag_rcv,
        .overhead = GSWIP_RX_HEADER_LEN,
index 6d78d88270fc19ce304dfbb51640961b7ceb92cc..5f5c8f9a6141fa54670d013b0a9f3ed7b8f8c192 100644 (file)
@@ -135,6 +135,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev,
 
 const struct dsa_device_ops ksz9477_netdev_ops = {
        .name   = "ksz9477",
+       .proto  = DSA_TAG_PROTO_KSZ9477,
        .xmit   = ksz9477_xmit,
        .rcv    = ksz9477_rcv,
        .overhead = KSZ9477_INGRESS_TAG_LEN,
@@ -171,6 +172,7 @@ static struct sk_buff *ksz9893_xmit(struct sk_buff *skb,
 
 const struct dsa_device_ops ksz9893_netdev_ops = {
        .name   = "ksz9893",
+       .proto  = DSA_TAG_PROTO_KSZ9893,
        .xmit   = ksz9893_xmit,
        .rcv    = ksz9477_rcv,
        .overhead = KSZ_INGRESS_TAG_LEN,
index 1f5819e4e6871bca950fc3c5a4524e2fe7ba3cc8..b6ef1e1a66731b724e10968cc5fdcc82ded1caf8 100644 (file)
@@ -130,6 +130,7 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
 
 const struct dsa_device_ops lan9303_netdev_ops = {
        .name = "lan9303",
+       .proto  = DSA_TAG_PROTO_LAN9303,
        .xmit = lan9303_xmit,
        .rcv = lan9303_rcv,
        .overhead = LAN9303_TAG_LEN,
index 7ecafb569f7406d6e84f7265d44742250f1640a1..ca02ab3dcd8009e926e3532b0faa98f33fb85e65 100644 (file)
@@ -100,6 +100,7 @@ static int mtk_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 
 const struct dsa_device_ops mtk_netdev_ops = {
        .name           = "mtk",
+       .proto          = DSA_TAG_PROTO_MTK,
        .xmit           = mtk_tag_xmit,
        .rcv            = mtk_tag_rcv,
        .flow_dissect   = mtk_tag_flow_dissect,
index f3fdeafef1fe01177941e0d951fc5e14013db8d6..1ff65c2e0cb4a2846bb26c7772ff8ff026369ce2 100644 (file)
@@ -101,6 +101,7 @@ static int qca_tag_flow_dissect(const struct sk_buff *skb, __be16 *proto,
 
 const struct dsa_device_ops qca_netdev_ops = {
        .name   = "qca",
+       .proto  = DSA_TAG_PROTO_QCA,
        .xmit   = qca_tag_xmit,
        .rcv    = qca_tag_rcv,
        .flow_dissect = qca_tag_flow_dissect,
index 9ec6aa7938cc5ba5544142f619b97064ce506150..628ab1a44ed7d5bbaa77de8a6fbaf636841121d8 100644 (file)
@@ -79,6 +79,7 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
 
 const struct dsa_device_ops trailer_netdev_ops = {
        .name   = "trailer",
+       .proto  = DSA_TAG_PROTO_TRAILER,
        .xmit   = trailer_xmit,
        .rcv    = trailer_rcv,
        .overhead = 4,