* [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT
@ 2018-11-07 17:07 Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 2/4] net/vlan: introduce __vlan_hwaccel_copy_tag() helper Michał Mirosław
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Michał Mirosław @ 2018-11-07 17:07 UTC (permalink / raw)
To: netdev
This is a preparatory patchset before removing the use of VLAN_TAG_PRESENT
bit in skb->vlan_tci as indication of VLAN offload. This set includes
only cleanups that allow abstracting of code testing VLAN tag presence
in drivers and networking code.
Michał Mirosław (4):
net/vlan: introduce __vlan_hwaccel_clear_tag() helper
net/vlan: introduce __vlan_hwaccel_copy_tag() helper
net/vlan: include the shift in skb_vlan_tag_get_prio()
net/vlan: remove unused #define HAVE_VLAN_GET_TAG
include/linux/if_vlan.h | 30 ++++++++++++++++++++++++++----
net/core/flow_dissector.c | 3 +--
2 files changed, 27 insertions(+), 6 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH net-next 2/4] net/vlan: introduce __vlan_hwaccel_copy_tag() helper
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
@ 2018-11-07 17:07 ` Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 1/4] net/vlan: introduce __vlan_hwaccel_clear_tag() helper Michał Mirosław
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2018-11-07 17:07 UTC (permalink / raw)
To: netdev
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index c438fa0a1c6a..941da4bf3929 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -472,6 +472,19 @@ static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
skb->vlan_tci = 0;
}
+/**
+ * __vlan_hwaccel_copy_tag - copy hardware accelerated VLAN info from another skb
+ * @dst: skbuff to copy to
+ * @src: skbuff to copy from
+ *
+ * Copies VLAN information from @src to @dst (for branchless code)
+ */
+static inline void __vlan_hwaccel_copy_tag(struct sk_buff *dst, const struct sk_buff *src)
+{
+ dst->vlan_proto = src->vlan_proto;
+ dst->vlan_tci = src->vlan_tci;
+}
+
/*
* __vlan_hwaccel_push_inside - pushes vlan tag to the payload
* @skb: skbuff to tag
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 1/4] net/vlan: introduce __vlan_hwaccel_clear_tag() helper
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 2/4] net/vlan: introduce __vlan_hwaccel_copy_tag() helper Michał Mirosław
@ 2018-11-07 17:07 ` Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 4/4] net/vlan: remove unused #define HAVE_VLAN_GET_TAG Michał Mirosław
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2018-11-07 17:07 UTC (permalink / raw)
To: netdev
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 83ea4df6ab81..c438fa0a1c6a 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -461,6 +461,17 @@ static inline struct sk_buff *vlan_insert_tag_set_proto(struct sk_buff *skb,
return skb;
}
+/**
+ * __vlan_hwaccel_clear_tag - clear hardware accelerated VLAN info
+ * @skb: skbuff to clear
+ *
+ * Clears the VLAN information from @skb
+ */
+static inline void __vlan_hwaccel_clear_tag(struct sk_buff *skb)
+{
+ skb->vlan_tci = 0;
+}
+
/*
* __vlan_hwaccel_push_inside - pushes vlan tag to the payload
* @skb: skbuff to tag
@@ -475,7 +486,7 @@ static inline struct sk_buff *__vlan_hwaccel_push_inside(struct sk_buff *skb)
skb = vlan_insert_tag_set_proto(skb, skb->vlan_proto,
skb_vlan_tag_get(skb));
if (likely(skb))
- skb->vlan_tci = 0;
+ __vlan_hwaccel_clear_tag(skb);
return skb;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 4/4] net/vlan: remove unused #define HAVE_VLAN_GET_TAG
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 2/4] net/vlan: introduce __vlan_hwaccel_copy_tag() helper Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 1/4] net/vlan: introduce __vlan_hwaccel_clear_tag() helper Michał Mirosław
@ 2018-11-07 17:07 ` Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 3/4] net/vlan: include the shift in skb_vlan_tag_get_prio() Michał Mirosław
2018-11-08 6:41 ` [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2018-11-07 17:07 UTC (permalink / raw)
To: netdev
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 2 --
1 file changed, 2 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index b14bf87999aa..03b08ffded07 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -555,8 +555,6 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb,
}
}
-#define HAVE_VLAN_GET_TAG
-
/**
* vlan_get_tag - get the VLAN ID from the skb
* @skb: skbuff to query
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/4] net/vlan: include the shift in skb_vlan_tag_get_prio()
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
` (2 preceding siblings ...)
2018-11-07 17:07 ` [PATCH net-next 4/4] net/vlan: remove unused #define HAVE_VLAN_GET_TAG Michał Mirosław
@ 2018-11-07 17:07 ` Michał Mirosław
2018-11-08 6:41 ` [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT David Miller
4 siblings, 0 replies; 6+ messages in thread
From: Michał Mirosław @ 2018-11-07 17:07 UTC (permalink / raw)
To: netdev
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 2 +-
net/core/flow_dissector.c | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 941da4bf3929..b14bf87999aa 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -81,7 +81,7 @@ static inline bool is_vlan_dev(const struct net_device *dev)
#define skb_vlan_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
#define skb_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
#define skb_vlan_tag_get_id(__skb) ((__skb)->vlan_tci & VLAN_VID_MASK)
-#define skb_vlan_tag_get_prio(__skb) ((__skb)->vlan_tci & VLAN_PRIO_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)
{
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 676f3ad629f9..56d1e9b73142 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -952,8 +952,7 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
if (!vlan) {
key_vlan->vlan_id = skb_vlan_tag_get_id(skb);
- key_vlan->vlan_priority =
- (skb_vlan_tag_get_prio(skb) >> VLAN_PRIO_SHIFT);
+ key_vlan->vlan_priority = skb_vlan_tag_get_prio(skb);
} else {
key_vlan->vlan_id = ntohs(vlan->h_vlan_TCI) &
VLAN_VID_MASK;
--
2.19.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
` (3 preceding siblings ...)
2018-11-07 17:07 ` [PATCH net-next 3/4] net/vlan: include the shift in skb_vlan_tag_get_prio() Michał Mirosław
@ 2018-11-08 6:41 ` David Miller
4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2018-11-08 6:41 UTC (permalink / raw)
To: mirq-linux; +Cc: netdev
From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Wed, 07 Nov 2018 18:07:02 +0100
> This is a preparatory patchset before removing the use of VLAN_TAG_PRESENT
> bit in skb->vlan_tci as indication of VLAN offload. This set includes
> only cleanups that allow abstracting of code testing VLAN tag presence
> in drivers and networking code.
Series applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-11-08 16:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 17:07 [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 2/4] net/vlan: introduce __vlan_hwaccel_copy_tag() helper Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 1/4] net/vlan: introduce __vlan_hwaccel_clear_tag() helper Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 4/4] net/vlan: remove unused #define HAVE_VLAN_GET_TAG Michał Mirosław
2018-11-07 17:07 ` [PATCH net-next 3/4] net/vlan: include the shift in skb_vlan_tag_get_prio() Michał Mirosław
2018-11-08 6:41 ` [PATCH net-next 0/4] net/vlan: prepare for removal of VLAN_TAG_PRESENT David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.