Commit a5dd3087 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: Add overhead to tag protocol ops.

Each DSA tag protocol needs to add additional headers to the Ethernet
frame in order to direct it towards a specific switch egress port. It
must also remove the head from a frame received from a
switch. Indicate the maximum size of these headers in the tag protocol
ops structure, so the core can take these overheads into account.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5c327f67
...@@ -113,6 +113,7 @@ struct dsa_device_ops { ...@@ -113,6 +113,7 @@ struct dsa_device_ops {
struct packet_type *pt); struct packet_type *pt);
int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto, int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto,
int *offset); int *offset);
unsigned int overhead;
}; };
struct dsa_switch_tree { struct dsa_switch_tree {
......
...@@ -174,6 +174,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -174,6 +174,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops brcm_netdev_ops = { const struct dsa_device_ops brcm_netdev_ops = {
.xmit = brcm_tag_xmit, .xmit = brcm_tag_xmit,
.rcv = brcm_tag_rcv, .rcv = brcm_tag_rcv,
.overhead = BRCM_TAG_LEN,
}; };
#endif #endif
...@@ -196,5 +197,6 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb, ...@@ -196,5 +197,6 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb,
const struct dsa_device_ops brcm_prepend_netdev_ops = { const struct dsa_device_ops brcm_prepend_netdev_ops = {
.xmit = brcm_tag_xmit_prepend, .xmit = brcm_tag_xmit_prepend,
.rcv = brcm_tag_rcv_prepend, .rcv = brcm_tag_rcv_prepend,
.overhead = BRCM_TAG_LEN,
}; };
#endif #endif
...@@ -149,4 +149,5 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -149,4 +149,5 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops dsa_netdev_ops = { const struct dsa_device_ops dsa_netdev_ops = {
.xmit = dsa_xmit, .xmit = dsa_xmit,
.rcv = dsa_rcv, .rcv = dsa_rcv,
.overhead = DSA_HLEN,
}; };
...@@ -168,4 +168,5 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -168,4 +168,5 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops edsa_netdev_ops = { const struct dsa_device_ops edsa_netdev_ops = {
.xmit = edsa_xmit, .xmit = edsa_xmit,
.rcv = edsa_rcv, .rcv = edsa_rcv,
.overhead = EDSA_HLEN,
}; };
...@@ -106,4 +106,5 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb, ...@@ -106,4 +106,5 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb,
const struct dsa_device_ops gswip_netdev_ops = { const struct dsa_device_ops gswip_netdev_ops = {
.xmit = gswip_tag_xmit, .xmit = gswip_tag_xmit,
.rcv = gswip_tag_rcv, .rcv = gswip_tag_rcv,
.overhead = GSWIP_RX_HEADER_LEN,
}; };
...@@ -99,4 +99,5 @@ static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -99,4 +99,5 @@ static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops ksz_netdev_ops = { const struct dsa_device_ops ksz_netdev_ops = {
.xmit = ksz_xmit, .xmit = ksz_xmit,
.rcv = ksz_rcv, .rcv = ksz_rcv,
.overhead = KSZ_INGRESS_TAG_LEN,
}; };
...@@ -140,4 +140,5 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -140,4 +140,5 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops lan9303_netdev_ops = { const struct dsa_device_ops lan9303_netdev_ops = {
.xmit = lan9303_xmit, .xmit = lan9303_xmit,
.rcv = lan9303_rcv, .rcv = lan9303_rcv,
.overhead = LAN9303_TAG_LEN,
}; };
...@@ -109,4 +109,5 @@ const struct dsa_device_ops mtk_netdev_ops = { ...@@ -109,4 +109,5 @@ const struct dsa_device_ops mtk_netdev_ops = {
.xmit = mtk_tag_xmit, .xmit = mtk_tag_xmit,
.rcv = mtk_tag_rcv, .rcv = mtk_tag_rcv,
.flow_dissect = mtk_tag_flow_dissect, .flow_dissect = mtk_tag_flow_dissect,
.overhead = MTK_HDR_LEN,
}; };
...@@ -101,4 +101,5 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -101,4 +101,5 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops qca_netdev_ops = { const struct dsa_device_ops qca_netdev_ops = {
.xmit = qca_tag_xmit, .xmit = qca_tag_xmit,
.rcv = qca_tag_rcv, .rcv = qca_tag_rcv,
.overhead = QCA_HDR_LEN,
}; };
...@@ -84,4 +84,5 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -84,4 +84,5 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
const struct dsa_device_ops trailer_netdev_ops = { const struct dsa_device_ops trailer_netdev_ops = {
.xmit = trailer_xmit, .xmit = trailer_xmit,
.rcv = trailer_rcv, .rcv = trailer_rcv,
.overhead = 4,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment