diff mbox series

[net,3/3] net: dsa: tag_8021q: get rid of dsa_8021q_xmit

Message ID 20200320000051.28548-4-olteanv@gmail.com
State New
Headers show
Series [net,1/3] net: dsa: tag_8021q: replace dsa_8021q_remove_header with __skb_vlan_pop | expand

Commit Message

Vladimir Oltean March 20, 2020, midnight UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

Calling vlan_insert_tag is easy enough that having a dedicated function
in tag_8021q does not bring any benefit at all.

Fixes: f9bbe4477c30 ("net: dsa: Optional VLAN-based port separation for switches without tagging")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 include/linux/dsa/8021q.h |  9 ---------
 net/dsa/tag_8021q.c       | 10 ----------
 net/dsa/tag_sja1105.c     |  8 ++++++--
 3 files changed, 6 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/dsa/8021q.h b/include/linux/dsa/8021q.h
index c620d9139c28..ac2e5cc2c238 100644
--- a/include/linux/dsa/8021q.h
+++ b/include/linux/dsa/8021q.h
@@ -17,9 +17,6 @@  struct packet_type;
 int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
 				 bool enabled);
 
-struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
-			       u16 tpid, u16 tci);
-
 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port);
 
 u16 dsa_8021q_rx_vid(struct dsa_switch *ds, int port);
@@ -36,12 +33,6 @@  int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int index,
 	return 0;
 }
 
-struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
-			       u16 tpid, u16 tci)
-{
-	return NULL;
-}
-
 u16 dsa_8021q_tx_vid(struct dsa_switch *ds, int port)
 {
 	return 0;
diff --git a/net/dsa/tag_8021q.c b/net/dsa/tag_8021q.c
index 0d51d4974826..1ccd3069f977 100644
--- a/net/dsa/tag_8021q.c
+++ b/net/dsa/tag_8021q.c
@@ -286,14 +286,4 @@  int dsa_port_setup_8021q_tagging(struct dsa_switch *ds, int port, bool enabled)
 }
 EXPORT_SYMBOL_GPL(dsa_port_setup_8021q_tagging);
 
-struct sk_buff *dsa_8021q_xmit(struct sk_buff *skb, struct net_device *netdev,
-			       u16 tpid, u16 tci)
-{
-	/* skb->data points at skb_mac_header, which
-	 * is fine for vlan_insert_tag.
-	 */
-	return vlan_insert_tag(skb, htons(tpid), tci);
-}
-EXPORT_SYMBOL_GPL(dsa_8021q_xmit);
-
 MODULE_LICENSE("GPL v2");
diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c
index d553bf36bd41..ad1cbeb1146f 100644
--- a/net/dsa/tag_sja1105.c
+++ b/net/dsa/tag_sja1105.c
@@ -103,6 +103,8 @@  static struct sk_buff *sja1105_xmit(struct sk_buff *skb,
 	u16 tx_vid = dsa_8021q_tx_vid(dp->ds, dp->index);
 	u16 queue_mapping = skb_get_queue_mapping(skb);
 	u8 pcp = netdev_txq_to_tc(netdev, queue_mapping);
+	u16 tci = (pcp << VLAN_PRIO_SHIFT) | tx_vid;
+	u16 tpid = ETH_P_SJA1105;
 
 	/* Transmitting management traffic does not rely upon switch tagging,
 	 * but instead SPI-installed management routes. Part 2 of this
@@ -119,8 +121,10 @@  static struct sk_buff *sja1105_xmit(struct sk_buff *skb,
 	if (dsa_port_is_vlan_filtering(dp))
 		return skb;
 
-	return dsa_8021q_xmit(skb, netdev, ETH_P_SJA1105,
-			     ((pcp << VLAN_PRIO_SHIFT) | tx_vid));
+	/* skb->data points at skb_mac_header, which
+	 * is fine for vlan_insert_tag.
+	 */
+	return vlan_insert_tag(skb, htons(tpid), tci);
 }
 
 static void sja1105_transfer_meta(struct sk_buff *skb,