mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit
@ 2019-06-12 15:18 Maxime Chevallier
  2019-06-12 17:10 ` David Miller
  2019-06-12 18:06 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Maxime Chevallier @ 2019-06-12 15:18 UTC (permalink / raw)
  To: davem, Pablo Neira Ayuso, Florian Fainelli, Jiri Pirko, Jakub Kicinski
  Cc: Maxime Chevallier, netdev, linux-kernel, Antoine Tenart,
	thomas.petazzoni, Michał Mirosław, Toshiaki Makita

Using ethtool, users can specify a classification action matching on the
full vlan tag, which includes the DEI bit (also previously called CFI).

However, when converting the ethool_flow_spec to a flow_rule, we use
dissector keys to represent the matching patterns.

Since the vlan dissector key doesn't include the DEI bit, this
information was silently discarded when translating the ethtool
flow spec in to a flow_rule.

This commit adds the DEI bit into the vlan dissector key, and allows
propagating the information to the driver when parsing the ethtool flow
spec.

Fixes: eca4205f9ec3 ("ethtool: add ethtool_rx_flow_spec to flow_rule structure translator")
Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
V1 -> V2: Use "DEI" instead of the old name "CFI", as suggested by Toshiaki.
          Perform endianness swap on the constant, sothat it's done at
	  build-time, as suggested by Jakub.

 include/net/flow_dissector.h | 1 +
 net/core/ethtool.c           | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index 7c5a8d9a8d2a..dfabc0503446 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -46,6 +46,7 @@ struct flow_dissector_key_tags {
 
 struct flow_dissector_key_vlan {
 	u16	vlan_id:12,
+		vlan_dei:1,
 		vlan_priority:3;
 	__be16	vlan_tpid;
 };
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d08b1e19ce9c..4d1011b2e24f 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -3020,6 +3020,11 @@ ethtool_rx_flow_rule_create(const struct ethtool_rx_flow_spec_input *input)
 			match->mask.vlan.vlan_id =
 				ntohs(ext_m_spec->vlan_tci) & 0x0fff;
 
+			match->key.vlan.vlan_dei =
+				!!(ext_h_spec->vlan_tci & htons(0x1000));
+			match->mask.vlan.vlan_dei =
+				!!(ext_m_spec->vlan_tci & htons(0x1000));
+
 			match->key.vlan.vlan_priority =
 				(ntohs(ext_h_spec->vlan_tci) & 0xe000) >> 13;
 			match->mask.vlan.vlan_priority =
-- 
2.20.1


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

* Re: [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit
  2019-06-12 15:18 [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit Maxime Chevallier
@ 2019-06-12 17:10 ` David Miller
  2019-06-12 18:06 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-12 17:10 UTC (permalink / raw)
  To: maxime.chevallier
  Cc: pablo, f.fainelli, jiri, jakub.kicinski, netdev, linux-kernel,
	antoine.tenart, thomas.petazzoni, mirq-linux, toshiaki.makita1

From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: Wed, 12 Jun 2019 17:18:38 +0200

> Using ethtool, users can specify a classification action matching on the
> full vlan tag, which includes the DEI bit (also previously called CFI).
> 
> However, when converting the ethool_flow_spec to a flow_rule, we use
> dissector keys to represent the matching patterns.
> 
> Since the vlan dissector key doesn't include the DEI bit, this
> information was silently discarded when translating the ethtool
> flow spec in to a flow_rule.
> 
> This commit adds the DEI bit into the vlan dissector key, and allows
> propagating the information to the driver when parsing the ethtool flow
> spec.
> 
> Fixes: eca4205f9ec3 ("ethtool: add ethtool_rx_flow_spec to flow_rule structure translator")
> Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> V1 -> V2: Use "DEI" instead of the old name "CFI", as suggested by Toshiaki.
>           Perform endianness swap on the constant, sothat it's done at
> 	  build-time, as suggested by Jakub.

Applied and queued up for -stable, thanks.

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

* Re: [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit
  2019-06-12 15:18 [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit Maxime Chevallier
  2019-06-12 17:10 ` David Miller
@ 2019-06-12 18:06 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2019-06-12 18:06 UTC (permalink / raw)
  To: Maxime Chevallier
  Cc: davem, Pablo Neira Ayuso, Florian Fainelli, Jiri Pirko, netdev,
	linux-kernel, Antoine Tenart, thomas.petazzoni,
	Michał Mirosław, Toshiaki Makita

On Wed, 12 Jun 2019 17:18:38 +0200, Maxime Chevallier wrote:
> Using ethtool, users can specify a classification action matching on the
> full vlan tag, which includes the DEI bit (also previously called CFI).
> 
> However, when converting the ethool_flow_spec to a flow_rule, we use
> dissector keys to represent the matching patterns.
> 
> Since the vlan dissector key doesn't include the DEI bit, this
> information was silently discarded when translating the ethtool
> flow spec in to a flow_rule.
> 
> This commit adds the DEI bit into the vlan dissector key, and allows
> propagating the information to the driver when parsing the ethtool flow
> spec.
> 
> Fixes: eca4205f9ec3 ("ethtool: add ethtool_rx_flow_spec to flow_rule structure translator")
> Reported-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

LGTM, thanks!

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

end of thread, other threads:[~2019-06-12 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 15:18 [PATCH net v2] net: ethtool: Allow matching on vlan DEI bit Maxime Chevallier
2019-06-12 17:10 ` David Miller
2019-06-12 18:06 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®