netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] VLAN tag handling cleanup
@ 2018-11-20 12:20 Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 1/4] net/vlan: introduce skb_vlan_tag_get_cfi() helper Michał Mirosław
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Michał Mirosław @ 2018-11-20 12:20 UTC (permalink / raw)
  To: netdev
  Cc: Ajit Khaparde, devel, Haiyang Zhang, K. Y. Srinivasan,
	Leon Romanovsky, linux-rdma, Saeed Mahameed, Sathya Perla,
	Somnath Kotur, Sriharsha Basavapatna, Stephen Hemminger

This is a cleanup set after VLAN_TAG_PRESENT removal. The CFI bit
handling is made similar to how other tag fields are used.

Michał Mirosław (4):
  net/vlan: introduce skb_vlan_tag_get_cfi() helper
  net/hyperv: use skb_vlan_tag_*() helpers
  benet: use skb_vlan_tag_get_prio()
  mlx5: use skb_vlan_tag_get_prio()

 drivers/net/ethernet/emulex/benet/be_main.c     | 2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
 drivers/net/hyperv/netvsc_drv.c                 | 9 +++++----
 include/linux/if_vlan.h                         | 3 ++-
 4 files changed, 9 insertions(+), 7 deletions(-)

-- 
2.19.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/4] net/vlan: introduce skb_vlan_tag_get_cfi() helper
  2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
@ 2018-11-20 12:20 ` Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers Michał Mirosław
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2018-11-20 12:20 UTC (permalink / raw)
  To: netdev
  Cc: Ajit Khaparde, devel, Haiyang Zhang, K. Y. Srinivasan,
	Leon Romanovsky, linux-rdma, Saeed Mahameed, Sathya Perla,
	Somnath Kotur, Sriharsha Basavapatna, Stephen Hemminger

Abstract CFI/DEI bit access consistently with other VLAN tag fields.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 include/linux/if_vlan.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 7a541eadf78e..4cca4da7a6de 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -65,7 +65,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb)
 
 #define VLAN_PRIO_MASK		0xe000 /* Priority Code Point */
 #define VLAN_PRIO_SHIFT		13
-#define VLAN_CFI_MASK		0x1000 /* Canonical Format Indicator */
+#define VLAN_CFI_MASK		0x1000 /* Canonical Format Indicator / Drop Eligible Indicator */
 #define VLAN_VID_MASK		0x0fff /* VLAN Identifier */
 #define VLAN_N_VID		4096
 
@@ -80,6 +80,7 @@ static inline bool is_vlan_dev(const struct net_device *dev)
 #define skb_vlan_tag_present(__skb)	((__skb)->vlan_present)
 #define skb_vlan_tag_get(__skb)		((__skb)->vlan_tci)
 #define skb_vlan_tag_get_id(__skb)	((__skb)->vlan_tci & VLAN_VID_MASK)
+#define skb_vlan_tag_get_cfi(__skb)	(!!((__skb)->vlan_tci & VLAN_CFI_MASK))
 #define skb_vlan_tag_get_prio(__skb)	(((__skb)->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT)
 
 static inline int vlan_get_rx_ctag_filter_info(struct net_device *dev)
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers
  2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 1/4] net/vlan: introduce skb_vlan_tag_get_cfi() helper Michał Mirosław
@ 2018-11-20 12:20 ` Michał Mirosław
  2018-11-20 20:37   ` Haiyang Zhang
  2018-11-20 12:20 ` [PATCH net-next 3/4] benet: use skb_vlan_tag_get_prio() Michał Mirosław
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Michał Mirosław @ 2018-11-20 12:20 UTC (permalink / raw)
  To: netdev
  Cc: K. Y. Srinivasan, Haiyang Zhang, Stephen Hemminger, devel,
	Ajit Khaparde, Leon Romanovsky, linux-rdma, Saeed Mahameed,
	Sathya Perla, Somnath Kotur, Sriharsha Basavapatna

Replace open-coded bitfield manipulation with skb_vlan_tag_*() helpers.
This also enables correctly passing of VLAN.CFI bit.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/hyperv/netvsc_drv.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index cf36e7ff3191..85936ed9e952 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -605,9 +605,9 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 				     IEEE_8021Q_INFO);
 
 		vlan->value = 0;
-		vlan->vlanid = skb->vlan_tci & VLAN_VID_MASK;
-		vlan->pri = (skb->vlan_tci & VLAN_PRIO_MASK) >>
-				VLAN_PRIO_SHIFT;
+		vlan->vlanid = skb_vlan_tag_get_id(skb);
+		vlan->cfi = skb_vlan_tag_get_cfi(skb);
+		vlan->pri = skb_vlan_tag_get_prio(skb);
 	}
 
 	if (skb_is_gso(skb)) {
@@ -781,7 +781,8 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
 	}
 
 	if (vlan) {
-		u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT);
+		u16 vlan_tci = vlan->vlanid | (vlan->pri << VLAN_PRIO_SHIFT) |
+			(vlan->cfi ? VLAN_CFI_MASK : 0);
 
 		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
 				       vlan_tci);
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 3/4] benet: use skb_vlan_tag_get_prio()
  2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 1/4] net/vlan: introduce skb_vlan_tag_get_cfi() helper Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers Michał Mirosław
@ 2018-11-20 12:20 ` Michał Mirosław
  2018-11-20 12:20 ` [PATCH net-next 4/4] mlx5: " Michał Mirosław
  2018-11-21 23:41 ` [PATCH net-next 0/4] VLAN tag handling cleanup David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2018-11-20 12:20 UTC (permalink / raw)
  To: netdev
  Cc: Sathya Perla, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
	devel, Haiyang Zhang, K. Y. Srinivasan, Leon Romanovsky,
	linux-rdma, Saeed Mahameed, Stephen Hemminger

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 80b2bd3747ce..245abf0d19c0 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -796,7 +796,7 @@ static inline u16 be_get_tx_vlan_tag(struct be_adapter *adapter,
 	u16 vlan_tag;
 
 	vlan_tag = skb_vlan_tag_get(skb);
-	vlan_prio = (vlan_tag & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
+	vlan_prio = skb_vlan_tag_get_prio(skb);
 	/* If vlan priority provided by OS is NOT in available bmap */
 	if (!(adapter->vlan_prio_bmap & (1 << vlan_prio)))
 		vlan_tag = (vlan_tag & ~VLAN_PRIO_MASK) |
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 4/4] mlx5: use skb_vlan_tag_get_prio()
  2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
                   ` (2 preceding siblings ...)
  2018-11-20 12:20 ` [PATCH net-next 3/4] benet: use skb_vlan_tag_get_prio() Michał Mirosław
@ 2018-11-20 12:20 ` Michał Mirosław
  2018-11-21 23:41 ` [PATCH net-next 0/4] VLAN tag handling cleanup David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: Michał Mirosław @ 2018-11-20 12:20 UTC (permalink / raw)
  To: netdev
  Cc: Saeed Mahameed, Leon Romanovsky, linux-rdma, Ajit Khaparde, devel,
	Haiyang Zhang, K. Y. Srinivasan, Sathya Perla, Somnath Kotur,
	Sriharsha Basavapatna, Stephen Hemminger

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
index 6dacaeba2fbf..9afdf955f2bc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
@@ -127,7 +127,7 @@ u16 mlx5e_select_queue(struct net_device *dev, struct sk_buff *skb,
 	else
 #endif
 		if (skb_vlan_tag_present(skb))
-			up = skb->vlan_tci >> VLAN_PRIO_SHIFT;
+			up = skb_vlan_tag_get_prio(skb);
 
 	/* channel_ix can be larger than num_channels since
 	 * dev->num_real_tx_queues = num_channels * num_tc
-- 
2.19.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers
  2018-11-20 12:20 ` [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers Michał Mirosław
@ 2018-11-20 20:37   ` Haiyang Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Haiyang Zhang @ 2018-11-20 20:37 UTC (permalink / raw)
  To: Michał Mirosław, netdev@vger.kernel.org
  Cc: KY Srinivasan, Stephen Hemminger, devel@linuxdriverproject.org,
	Ajit Khaparde, Leon Romanovsky, linux-rdma@vger.kernel.org,
	Saeed Mahameed, Sathya Perla, Somnath Kotur,
	Sriharsha Basavapatna



> -----Original Message-----
> From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Sent: Tuesday, November 20, 2018 7:21 AM
> To: netdev@vger.kernel.org
> Cc: KY Srinivasan <kys@microsoft.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; Stephen Hemminger
> <sthemmin@microsoft.com>; devel@linuxdriverproject.org; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Leon Romanovsky <leon@kernel.org>;
> linux-rdma@vger.kernel.org; Saeed Mahameed <saeedm@mellanox.com>;
> Sathya Perla <sathya.perla@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Sriharsha Basavapatna
> <sriharsha.basavapatna@broadcom.com>
> Subject: [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers
> 
> Replace open-coded bitfield manipulation with skb_vlan_tag_*() helpers.
> This also enables correctly passing of VLAN.CFI bit.
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> ---

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Thanks.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 0/4] VLAN tag handling cleanup
  2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
                   ` (3 preceding siblings ...)
  2018-11-20 12:20 ` [PATCH net-next 4/4] mlx5: " Michał Mirosław
@ 2018-11-21 23:41 ` David Miller
  4 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-11-21 23:41 UTC (permalink / raw)
  To: mirq-linux
  Cc: netdev, ajit.khaparde, devel, haiyangz, kys, leon, linux-rdma,
	saeedm, sathya.perla, somnath.kotur, sriharsha.basavapatna,
	sthemmin

From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Tue, 20 Nov 2018 13:20:30 +0100

> This is a cleanup set after VLAN_TAG_PRESENT removal. The CFI bit
> handling is made similar to how other tag fields are used.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-11-22 10:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-20 12:20 [PATCH net-next 0/4] VLAN tag handling cleanup Michał Mirosław
2018-11-20 12:20 ` [PATCH net-next 1/4] net/vlan: introduce skb_vlan_tag_get_cfi() helper Michał Mirosław
2018-11-20 12:20 ` [PATCH net-next 2/4] net/hyperv: use skb_vlan_tag_*() helpers Michał Mirosław
2018-11-20 20:37   ` Haiyang Zhang
2018-11-20 12:20 ` [PATCH net-next 3/4] benet: use skb_vlan_tag_get_prio() Michał Mirosław
2018-11-20 12:20 ` [PATCH net-next 4/4] mlx5: " Michał Mirosław
2018-11-21 23:41 ` [PATCH net-next 0/4] VLAN tag handling cleanup David Miller

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).