net: dsa: Factor bottom tag receive functions

All DSA tag receive functions do strictly the same thing after they have located
the originating source port from their tag specific protocol:

- push ETH_HLEN bytes
- set pkt_type to PACKET_HOST
- call eth_type_trans()
- bump up counters
- call netif_receive_skb()

Factor all of that into dsa_switch_rcv(). This also makes us return a pointer to
a sk_buff, which makes us symetric with the xmit function.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli
2017-04-08 08:55:23 -07:00
committed by David S. Miller
parent 16c5dcb13a
commit a86d8becc3
9 changed files with 53 additions and 84 deletions

View File

@@ -124,7 +124,7 @@ struct dsa_switch_tree {
* protocol to use.
*/
struct net_device *master_netdev;
int (*rcv)(struct sk_buff *skb,
struct sk_buff * (*rcv)(struct sk_buff *skb,
struct net_device *dev,
struct packet_type *pt,
struct net_device *orig_dev);