Skip to content

Commit a5dd308

Browse files
lunndavem330
authored andcommitted
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: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 5c327f6 commit a5dd308

File tree

10 files changed

+11
-0
lines changed

10 files changed

+11
-0
lines changed

include/net/dsa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ struct dsa_device_ops {
113113
struct packet_type *pt);
114114
int (*flow_dissect)(const struct sk_buff *skb, __be16 *proto,
115115
int *offset);
116+
unsigned int overhead;
116117
};
117118

118119
struct dsa_switch_tree {

net/dsa/tag_brcm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ static struct sk_buff *brcm_tag_rcv(struct sk_buff *skb, struct net_device *dev,
174174
const struct dsa_device_ops brcm_netdev_ops = {
175175
.xmit = brcm_tag_xmit,
176176
.rcv = brcm_tag_rcv,
177+
.overhead = BRCM_TAG_LEN,
177178
};
178179
#endif
179180

@@ -196,5 +197,6 @@ static struct sk_buff *brcm_tag_rcv_prepend(struct sk_buff *skb,
196197
const struct dsa_device_ops brcm_prepend_netdev_ops = {
197198
.xmit = brcm_tag_xmit_prepend,
198199
.rcv = brcm_tag_rcv_prepend,
200+
.overhead = BRCM_TAG_LEN,
199201
};
200202
#endif

net/dsa/tag_dsa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,5 @@ static struct sk_buff *dsa_rcv(struct sk_buff *skb, struct net_device *dev,
149149
const struct dsa_device_ops dsa_netdev_ops = {
150150
.xmit = dsa_xmit,
151151
.rcv = dsa_rcv,
152+
.overhead = DSA_HLEN,
152153
};

net/dsa/tag_edsa.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,5 @@ static struct sk_buff *edsa_rcv(struct sk_buff *skb, struct net_device *dev,
168168
const struct dsa_device_ops edsa_netdev_ops = {
169169
.xmit = edsa_xmit,
170170
.rcv = edsa_rcv,
171+
.overhead = EDSA_HLEN,
171172
};

net/dsa/tag_gswip.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@ static struct sk_buff *gswip_tag_rcv(struct sk_buff *skb,
106106
const struct dsa_device_ops gswip_netdev_ops = {
107107
.xmit = gswip_tag_xmit,
108108
.rcv = gswip_tag_rcv,
109+
.overhead = GSWIP_RX_HEADER_LEN,
109110
};

net/dsa/tag_ksz.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ static struct sk_buff *ksz_rcv(struct sk_buff *skb, struct net_device *dev,
9999
const struct dsa_device_ops ksz_netdev_ops = {
100100
.xmit = ksz_xmit,
101101
.rcv = ksz_rcv,
102+
.overhead = KSZ_INGRESS_TAG_LEN,
102103
};

net/dsa/tag_lan9303.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ static struct sk_buff *lan9303_rcv(struct sk_buff *skb, struct net_device *dev,
140140
const struct dsa_device_ops lan9303_netdev_ops = {
141141
.xmit = lan9303_xmit,
142142
.rcv = lan9303_rcv,
143+
.overhead = LAN9303_TAG_LEN,
143144
};

net/dsa/tag_mtk.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,5 @@ const struct dsa_device_ops mtk_netdev_ops = {
109109
.xmit = mtk_tag_xmit,
110110
.rcv = mtk_tag_rcv,
111111
.flow_dissect = mtk_tag_flow_dissect,
112+
.overhead = MTK_HDR_LEN,
112113
};

net/dsa/tag_qca.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,5 @@ static struct sk_buff *qca_tag_rcv(struct sk_buff *skb, struct net_device *dev,
101101
const struct dsa_device_ops qca_netdev_ops = {
102102
.xmit = qca_tag_xmit,
103103
.rcv = qca_tag_rcv,
104+
.overhead = QCA_HDR_LEN,
104105
};

net/dsa/tag_trailer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,5 @@ static struct sk_buff *trailer_rcv(struct sk_buff *skb, struct net_device *dev,
8484
const struct dsa_device_ops trailer_netdev_ops = {
8585
.xmit = trailer_xmit,
8686
.rcv = trailer_rcv,
87+
.overhead = 4,
8788
};

0 commit comments

Comments
 (0)