diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2014-08-27 20:04:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-08-28 01:59:39 -0400 |
commit | 3e8a72d1dae374cf6fc1dba97cec663585845ff9 (patch) | |
tree | 83a2ebc590d0dc90d27515dc15bf6323cb2a6c1b | |
parent | 8663dc2002b02abfe5dfb0fb7e544b81982ad95b (diff) |
net: dsa: reduce number of protocol hooks
DSA is currently registering one packet_type function per EtherType it
needs to intercept in the receive path of a DSA-enabled Ethernet device.
Right now we have three of them: trailer, DSA and eDSA, and there might
be more in the future, this will not scale to the addition of new
protocols.
This patch proceeds with adding a new layer of abstraction and two new
functions:
dsa_switch_rcv() which will dispatch into the tag-protocol specific
receive function implemented by net/dsa/tag_*.c
dsa_slave_xmit() which will dispatch into the tag-protocol specific
transmit function implemented by net/dsa/tag_*.c
When we do create the per-port slave network devices, we iterate over
the switch protocol to assign the DSA-specific receive and transmit
operations.
A new fake ethertype value is used: ETH_P_XDSA to illustrate the fact
that this is no longer going to look like ETH_P_DSA or ETH_P_TRAILER
like it used to be.
This allows us to greatly simplify the check in eth_type_trans() and
always override the skb->protocol with ETH_P_XDSA for Ethernet switches
tagged protocol, while also reducing the number repetitive slave
netdevice_ops assignments.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 28 | ||||
-rw-r--r-- | include/net/dsa.h | 20 | ||||
-rw-r--r-- | include/uapi/linux/if_ether.h | 1 | ||||
-rw-r--r-- | net/dsa/dsa.c | 39 | ||||
-rw-r--r-- | net/dsa/dsa_priv.h | 9 | ||||
-rw-r--r-- | net/dsa/slave.c | 45 | ||||
-rw-r--r-- | net/dsa/tag_dsa.c | 8 | ||||
-rw-r--r-- | net/dsa/tag_edsa.c | 8 | ||||
-rw-r--r-- | net/dsa/tag_trailer.c | 8 | ||||
-rw-r--r-- | net/ethernet/eth.c | 7 |
10 files changed, 68 insertions, 105 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 039b23786c22..1875dc71422a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1781,24 +1781,13 @@ void dev_net_set(struct net_device *dev, struct net *net) | |||
1781 | #endif | 1781 | #endif |
1782 | } | 1782 | } |
1783 | 1783 | ||
1784 | static inline bool netdev_uses_dsa_tags(struct net_device *dev) | 1784 | static inline bool netdev_uses_dsa(struct net_device *dev) |
1785 | { | 1785 | { |
1786 | #ifdef CONFIG_NET_DSA_TAG_DSA | 1786 | #ifdef CONFIG_NET_DSA |
1787 | if (dev->dsa_ptr != NULL) | 1787 | return dev->dsa_ptr != NULL; |
1788 | return dsa_uses_dsa_tags(dev->dsa_ptr); | 1788 | #else |
1789 | #endif | 1789 | return false; |
1790 | |||
1791 | return 0; | ||
1792 | } | ||
1793 | |||
1794 | static inline bool netdev_uses_trailer_tags(struct net_device *dev) | ||
1795 | { | ||
1796 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
1797 | if (dev->dsa_ptr != NULL) | ||
1798 | return dsa_uses_trailer_tags(dev->dsa_ptr); | ||
1799 | #endif | 1790 | #endif |
1800 | |||
1801 | return 0; | ||
1802 | } | 1791 | } |
1803 | 1792 | ||
1804 | /** | 1793 | /** |
@@ -1933,6 +1922,13 @@ struct udp_offload { | |||
1933 | struct offload_callbacks callbacks; | 1922 | struct offload_callbacks callbacks; |
1934 | }; | 1923 | }; |
1935 | 1924 | ||
1925 | struct dsa_device_ops { | ||
1926 | netdev_tx_t (*xmit)(struct sk_buff *skb, struct net_device *dev); | ||
1927 | int (*rcv)(struct sk_buff *skb, struct net_device *dev, | ||
1928 | struct packet_type *pt, struct net_device *orig_dev); | ||
1929 | }; | ||
1930 | |||
1931 | |||
1936 | /* often modified stats are per cpu, other are shared (netdev->stats) */ | 1932 | /* often modified stats are per cpu, other are shared (netdev->stats) */ |
1937 | struct pcpu_sw_netstats { | 1933 | struct pcpu_sw_netstats { |
1938 | u64 rx_packets; | 1934 | u64 rx_packets; |
diff --git a/include/net/dsa.h b/include/net/dsa.h index 6efce384451e..6e26f1e4d8ce 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -59,6 +59,8 @@ struct dsa_platform_data { | |||
59 | struct dsa_chip_data *chip; | 59 | struct dsa_chip_data *chip; |
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct dsa_device_ops; | ||
63 | |||
62 | struct dsa_switch_tree { | 64 | struct dsa_switch_tree { |
63 | /* | 65 | /* |
64 | * Configuration data for the platform device that owns | 66 | * Configuration data for the platform device that owns |
@@ -71,6 +73,7 @@ struct dsa_switch_tree { | |||
71 | * protocol to use. | 73 | * protocol to use. |
72 | */ | 74 | */ |
73 | struct net_device *master_netdev; | 75 | struct net_device *master_netdev; |
76 | const struct dsa_device_ops *ops; | ||
74 | __be16 tag_protocol; | 77 | __be16 tag_protocol; |
75 | 78 | ||
76 | /* | 79 | /* |
@@ -186,21 +189,4 @@ static inline void *ds_to_priv(struct dsa_switch *ds) | |||
186 | return (void *)(ds + 1); | 189 | return (void *)(ds + 1); |
187 | } | 190 | } |
188 | 191 | ||
189 | /* | ||
190 | * The original DSA tag format and some other tag formats have no | ||
191 | * ethertype, which means that we need to add a little hack to the | ||
192 | * networking receive path to make sure that received frames get | ||
193 | * the right ->protocol assigned to them when one of those tag | ||
194 | * formats is in use. | ||
195 | */ | ||
196 | static inline bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst) | ||
197 | { | ||
198 | return !!(dst->tag_protocol == htons(ETH_P_DSA)); | ||
199 | } | ||
200 | |||
201 | static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst) | ||
202 | { | ||
203 | return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); | ||
204 | } | ||
205 | |||
206 | #endif | 192 | #endif |
diff --git a/include/uapi/linux/if_ether.h b/include/uapi/linux/if_ether.h index 0f8210b8e0bc..aa63ed023c2b 100644 --- a/include/uapi/linux/if_ether.h +++ b/include/uapi/linux/if_ether.h | |||
@@ -128,6 +128,7 @@ | |||
128 | #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ | 128 | #define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ |
129 | #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ | 129 | #define ETH_P_IEEE802154 0x00F6 /* IEEE802.15.4 frame */ |
130 | #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ | 130 | #define ETH_P_CAIF 0x00F7 /* ST-Ericsson CAIF protocol */ |
131 | #define ETH_P_XDSA 0x00F8 /* Multiplexed DSA protocol */ | ||
131 | 132 | ||
132 | /* | 133 | /* |
133 | * This is an Ethernet frame header. | 134 | * This is an Ethernet frame header. |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 0a49632fac47..92e71d2a2ccd 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -608,6 +608,24 @@ static void dsa_shutdown(struct platform_device *pdev) | |||
608 | { | 608 | { |
609 | } | 609 | } |
610 | 610 | ||
611 | static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, | ||
612 | struct packet_type *pt, struct net_device *orig_dev) | ||
613 | { | ||
614 | struct dsa_switch_tree *dst = dev->dsa_ptr; | ||
615 | |||
616 | if (unlikely(dst == NULL)) { | ||
617 | kfree_skb(skb); | ||
618 | return 0; | ||
619 | } | ||
620 | |||
621 | return dst->ops->rcv(skb, dev, pt, orig_dev); | ||
622 | } | ||
623 | |||
624 | struct packet_type dsa_pack_type __read_mostly = { | ||
625 | .type = cpu_to_be16(ETH_P_XDSA), | ||
626 | .func = dsa_switch_rcv, | ||
627 | }; | ||
628 | |||
611 | static const struct of_device_id dsa_of_match_table[] = { | 629 | static const struct of_device_id dsa_of_match_table[] = { |
612 | { .compatible = "marvell,dsa", }, | 630 | { .compatible = "marvell,dsa", }, |
613 | {} | 631 | {} |
@@ -633,30 +651,15 @@ static int __init dsa_init_module(void) | |||
633 | if (rc) | 651 | if (rc) |
634 | return rc; | 652 | return rc; |
635 | 653 | ||
636 | #ifdef CONFIG_NET_DSA_TAG_DSA | 654 | dev_add_pack(&dsa_pack_type); |
637 | dev_add_pack(&dsa_packet_type); | 655 | |
638 | #endif | ||
639 | #ifdef CONFIG_NET_DSA_TAG_EDSA | ||
640 | dev_add_pack(&edsa_packet_type); | ||
641 | #endif | ||
642 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
643 | dev_add_pack(&trailer_packet_type); | ||
644 | #endif | ||
645 | return 0; | 656 | return 0; |
646 | } | 657 | } |
647 | module_init(dsa_init_module); | 658 | module_init(dsa_init_module); |
648 | 659 | ||
649 | static void __exit dsa_cleanup_module(void) | 660 | static void __exit dsa_cleanup_module(void) |
650 | { | 661 | { |
651 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 662 | dev_remove_pack(&dsa_pack_type); |
652 | dev_remove_pack(&trailer_packet_type); | ||
653 | #endif | ||
654 | #ifdef CONFIG_NET_DSA_TAG_EDSA | ||
655 | dev_remove_pack(&edsa_packet_type); | ||
656 | #endif | ||
657 | #ifdef CONFIG_NET_DSA_TAG_DSA | ||
658 | dev_remove_pack(&dsa_packet_type); | ||
659 | #endif | ||
660 | platform_driver_unregister(&dsa_driver); | 663 | platform_driver_unregister(&dsa_driver); |
661 | } | 664 | } |
662 | module_exit(dsa_cleanup_module); | 665 | module_exit(dsa_cleanup_module); |
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index d4cf5cc747e3..218d75d16f6f 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h | |||
@@ -45,16 +45,13 @@ struct net_device *dsa_slave_create(struct dsa_switch *ds, | |||
45 | int port, char *name); | 45 | int port, char *name); |
46 | 46 | ||
47 | /* tag_dsa.c */ | 47 | /* tag_dsa.c */ |
48 | netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev); | 48 | extern const struct dsa_device_ops dsa_netdev_ops; |
49 | extern struct packet_type dsa_packet_type; | ||
50 | 49 | ||
51 | /* tag_edsa.c */ | 50 | /* tag_edsa.c */ |
52 | netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev); | 51 | extern const struct dsa_device_ops edsa_netdev_ops; |
53 | extern struct packet_type edsa_packet_type; | ||
54 | 52 | ||
55 | /* tag_trailer.c */ | 53 | /* tag_trailer.c */ |
56 | netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev); | 54 | extern const struct dsa_device_ops trailer_netdev_ops; |
57 | extern struct packet_type trailer_packet_type; | ||
58 | 55 | ||
59 | 56 | ||
60 | #endif | 57 | #endif |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 45a1e34c89e0..ad1a913533aa 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -171,6 +171,14 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
171 | return -EOPNOTSUPP; | 171 | return -EOPNOTSUPP; |
172 | } | 172 | } |
173 | 173 | ||
174 | static netdev_tx_t dsa_slave_xmit(struct sk_buff *skb, struct net_device *dev) | ||
175 | { | ||
176 | struct dsa_slave_priv *p = netdev_priv(dev); | ||
177 | struct dsa_switch_tree *dst = p->parent->dst; | ||
178 | |||
179 | return dst->ops->xmit(skb, dev); | ||
180 | } | ||
181 | |||
174 | 182 | ||
175 | /* ethtool operations *******************************************************/ | 183 | /* ethtool operations *******************************************************/ |
176 | static int | 184 | static int |
@@ -293,42 +301,16 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = { | |||
293 | .get_sset_count = dsa_slave_get_sset_count, | 301 | .get_sset_count = dsa_slave_get_sset_count, |
294 | }; | 302 | }; |
295 | 303 | ||
296 | #ifdef CONFIG_NET_DSA_TAG_DSA | 304 | static const struct net_device_ops dsa_slave_netdev_ops = { |
297 | static const struct net_device_ops dsa_netdev_ops = { | ||
298 | .ndo_init = dsa_slave_init, | 305 | .ndo_init = dsa_slave_init, |
299 | .ndo_open = dsa_slave_open, | 306 | .ndo_open = dsa_slave_open, |
300 | .ndo_stop = dsa_slave_close, | 307 | .ndo_stop = dsa_slave_close, |
301 | .ndo_start_xmit = dsa_xmit, | 308 | .ndo_start_xmit = dsa_slave_xmit, |
302 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | 309 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, |
303 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | 310 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, |
304 | .ndo_set_mac_address = dsa_slave_set_mac_address, | 311 | .ndo_set_mac_address = dsa_slave_set_mac_address, |
305 | .ndo_do_ioctl = dsa_slave_ioctl, | 312 | .ndo_do_ioctl = dsa_slave_ioctl, |
306 | }; | 313 | }; |
307 | #endif | ||
308 | #ifdef CONFIG_NET_DSA_TAG_EDSA | ||
309 | static const struct net_device_ops edsa_netdev_ops = { | ||
310 | .ndo_init = dsa_slave_init, | ||
311 | .ndo_open = dsa_slave_open, | ||
312 | .ndo_stop = dsa_slave_close, | ||
313 | .ndo_start_xmit = edsa_xmit, | ||
314 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | ||
315 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | ||
316 | .ndo_set_mac_address = dsa_slave_set_mac_address, | ||
317 | .ndo_do_ioctl = dsa_slave_ioctl, | ||
318 | }; | ||
319 | #endif | ||
320 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | ||
321 | static const struct net_device_ops trailer_netdev_ops = { | ||
322 | .ndo_init = dsa_slave_init, | ||
323 | .ndo_open = dsa_slave_open, | ||
324 | .ndo_stop = dsa_slave_close, | ||
325 | .ndo_start_xmit = trailer_xmit, | ||
326 | .ndo_change_rx_flags = dsa_slave_change_rx_flags, | ||
327 | .ndo_set_rx_mode = dsa_slave_set_rx_mode, | ||
328 | .ndo_set_mac_address = dsa_slave_set_mac_address, | ||
329 | .ndo_do_ioctl = dsa_slave_ioctl, | ||
330 | }; | ||
331 | #endif | ||
332 | 314 | ||
333 | /* slave device setup *******************************************************/ | 315 | /* slave device setup *******************************************************/ |
334 | struct net_device * | 316 | struct net_device * |
@@ -349,21 +331,22 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
349 | slave_dev->ethtool_ops = &dsa_slave_ethtool_ops; | 331 | slave_dev->ethtool_ops = &dsa_slave_ethtool_ops; |
350 | eth_hw_addr_inherit(slave_dev, master); | 332 | eth_hw_addr_inherit(slave_dev, master); |
351 | slave_dev->tx_queue_len = 0; | 333 | slave_dev->tx_queue_len = 0; |
334 | slave_dev->netdev_ops = &dsa_slave_netdev_ops; | ||
352 | 335 | ||
353 | switch (ds->dst->tag_protocol) { | 336 | switch (ds->dst->tag_protocol) { |
354 | #ifdef CONFIG_NET_DSA_TAG_DSA | 337 | #ifdef CONFIG_NET_DSA_TAG_DSA |
355 | case htons(ETH_P_DSA): | 338 | case htons(ETH_P_DSA): |
356 | slave_dev->netdev_ops = &dsa_netdev_ops; | 339 | ds->dst->ops = &dsa_netdev_ops; |
357 | break; | 340 | break; |
358 | #endif | 341 | #endif |
359 | #ifdef CONFIG_NET_DSA_TAG_EDSA | 342 | #ifdef CONFIG_NET_DSA_TAG_EDSA |
360 | case htons(ETH_P_EDSA): | 343 | case htons(ETH_P_EDSA): |
361 | slave_dev->netdev_ops = &edsa_netdev_ops; | 344 | ds->dst->ops = &edsa_netdev_ops; |
362 | break; | 345 | break; |
363 | #endif | 346 | #endif |
364 | #ifdef CONFIG_NET_DSA_TAG_TRAILER | 347 | #ifdef CONFIG_NET_DSA_TAG_TRAILER |
365 | case htons(ETH_P_TRAILER): | 348 | case htons(ETH_P_TRAILER): |
366 | slave_dev->netdev_ops = &trailer_netdev_ops; | 349 | ds->dst->ops = &trailer_netdev_ops; |
367 | break; | 350 | break; |
368 | #endif | 351 | #endif |
369 | default: | 352 | default: |
diff --git a/net/dsa/tag_dsa.c b/net/dsa/tag_dsa.c index cacce1e22f9c..d7dbc5bda5c0 100644 --- a/net/dsa/tag_dsa.c +++ b/net/dsa/tag_dsa.c | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | #define DSA_HLEN 4 | 17 | #define DSA_HLEN 4 |
18 | 18 | ||
19 | netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev) | 19 | static netdev_tx_t dsa_xmit(struct sk_buff *skb, struct net_device *dev) |
20 | { | 20 | { |
21 | struct dsa_slave_priv *p = netdev_priv(dev); | 21 | struct dsa_slave_priv *p = netdev_priv(dev); |
22 | u8 *dsa_header; | 22 | u8 *dsa_header; |
@@ -186,7 +186,7 @@ out: | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | struct packet_type dsa_packet_type __read_mostly = { | 189 | const struct dsa_device_ops dsa_netdev_ops = { |
190 | .type = cpu_to_be16(ETH_P_DSA), | 190 | .xmit = dsa_xmit, |
191 | .func = dsa_rcv, | 191 | .rcv = dsa_rcv, |
192 | }; | 192 | }; |
diff --git a/net/dsa/tag_edsa.c b/net/dsa/tag_edsa.c index e70c43c25e64..6b30abe89183 100644 --- a/net/dsa/tag_edsa.c +++ b/net/dsa/tag_edsa.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #define DSA_HLEN 4 | 17 | #define DSA_HLEN 4 |
18 | #define EDSA_HLEN 8 | 18 | #define EDSA_HLEN 8 |
19 | 19 | ||
20 | netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev) | 20 | static netdev_tx_t edsa_xmit(struct sk_buff *skb, struct net_device *dev) |
21 | { | 21 | { |
22 | struct dsa_slave_priv *p = netdev_priv(dev); | 22 | struct dsa_slave_priv *p = netdev_priv(dev); |
23 | u8 *edsa_header; | 23 | u8 *edsa_header; |
@@ -205,7 +205,7 @@ out: | |||
205 | return 0; | 205 | return 0; |
206 | } | 206 | } |
207 | 207 | ||
208 | struct packet_type edsa_packet_type __read_mostly = { | 208 | const struct dsa_device_ops edsa_netdev_ops = { |
209 | .type = cpu_to_be16(ETH_P_EDSA), | 209 | .xmit = edsa_xmit, |
210 | .func = edsa_rcv, | 210 | .rcv = edsa_rcv, |
211 | }; | 211 | }; |
diff --git a/net/dsa/tag_trailer.c b/net/dsa/tag_trailer.c index 94bc260d015d..5fe9444842c5 100644 --- a/net/dsa/tag_trailer.c +++ b/net/dsa/tag_trailer.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include "dsa_priv.h" | 15 | #include "dsa_priv.h" |
16 | 16 | ||
17 | netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev) | 17 | static netdev_tx_t trailer_xmit(struct sk_buff *skb, struct net_device *dev) |
18 | { | 18 | { |
19 | struct dsa_slave_priv *p = netdev_priv(dev); | 19 | struct dsa_slave_priv *p = netdev_priv(dev); |
20 | struct sk_buff *nskb; | 20 | struct sk_buff *nskb; |
@@ -114,7 +114,7 @@ out: | |||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
116 | 116 | ||
117 | struct packet_type trailer_packet_type __read_mostly = { | 117 | const struct dsa_device_ops trailer_netdev_ops = { |
118 | .type = cpu_to_be16(ETH_P_TRAILER), | 118 | .xmit = trailer_xmit, |
119 | .func = trailer_rcv, | 119 | .rcv = trailer_rcv, |
120 | }; | 120 | }; |
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index f405e0592407..5cebca134585 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c | |||
@@ -181,11 +181,8 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
181 | * variants has been configured on the receiving interface, | 181 | * variants has been configured on the receiving interface, |
182 | * and if so, set skb->protocol without looking at the packet. | 182 | * and if so, set skb->protocol without looking at the packet. |
183 | */ | 183 | */ |
184 | if (unlikely(netdev_uses_dsa_tags(dev))) | 184 | if (unlikely(netdev_uses_dsa(dev))) |
185 | return htons(ETH_P_DSA); | 185 | return htons(ETH_P_XDSA); |
186 | |||
187 | if (unlikely(netdev_uses_trailer_tags(dev))) | ||
188 | return htons(ETH_P_TRAILER); | ||
189 | 186 | ||
190 | if (likely(ntohs(eth->h_proto) >= ETH_P_802_3_MIN)) | 187 | if (likely(ntohs(eth->h_proto) >= ETH_P_802_3_MIN)) |
191 | return eth->h_proto; | 188 | return eth->h_proto; |