From: Vladimir Oltean <olteanv@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, andrew@lunn.ch, f.fainelli@gmail.com,
vivien.didelot@gmail.com
Subject: [PATCH net 3/3] net: dsa: tag_8021q: get rid of dsa_8021q_xmit
Date: Fri, 20 Mar 2020 02:00:51 +0200 [thread overview]
Message-ID: <20200320000051.28548-4-olteanv@gmail.com> (raw)
In-Reply-To: <20200320000051.28548-1-olteanv@gmail.com>
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 --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,
--
2.17.1
next prev parent reply other threads:[~2020-03-20 0:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 0:00 [PATCH net 0/3] Bugfix, simplification and cleanup in DSA tag_8021q Vladimir Oltean
2020-03-20 0:00 ` [PATCH net 1/3] net: dsa: tag_8021q: replace dsa_8021q_remove_header with __skb_vlan_pop Vladimir Oltean
2020-03-20 0:00 ` [PATCH net 2/3] net: dsa: tag_8021q: remove obsolete comment Vladimir Oltean
2020-03-20 0:00 ` Vladimir Oltean [this message]
2020-03-24 3:56 ` [PATCH net 0/3] Bugfix, simplification and cleanup in DSA tag_8021q David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200320000051.28548-4-olteanv@gmail.com \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).