Netdev List
 help / color / mirror / Atom feed
From: Jianbo Liu <jianbol@mellanox.com>
To: netdev@vger.kernel.org, davem@davemloft.net, jiri@resnulli.us
Cc: Jianbo Liu <jianbol@mellanox.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Cong Wang <xiyou.wangcong@gmail.com>
Subject: [PATCH v2 net-next 2/5] net/sched: flower: Add support for matching on vlan ethertype
Date: Fri,  6 Jul 2018 05:38:13 +0000	[thread overview]
Message-ID: <20180706053817.17712-3-jianbol@mellanox.com> (raw)
In-Reply-To: <20180706053817.17712-1-jianbol@mellanox.com>

As flow dissector stores vlan ethertype, tc flower now can match on that.
It is to make preparation for supporting QinQ.

Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/cls_flower.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 352876b..da9ec30 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -500,6 +500,7 @@ static int fl_set_key_mpls(struct nlattr **tb,
 }
 
 static void fl_set_key_vlan(struct nlattr **tb,
+			    __be16 ethertype,
 			    struct flow_dissector_key_vlan *key_val,
 			    struct flow_dissector_key_vlan *key_mask)
 {
@@ -516,6 +517,8 @@ static void fl_set_key_vlan(struct nlattr **tb,
 			VLAN_PRIORITY_MASK;
 		key_mask->vlan_priority = VLAN_PRIORITY_MASK;
 	}
+	key_val->vlan_tpid = ethertype;
+	key_mask->vlan_tpid = cpu_to_be16(~0);
 }
 
 static void fl_set_key_flag(u32 flower_key, u32 flower_mask,
@@ -592,8 +595,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
 	if (tb[TCA_FLOWER_KEY_ETH_TYPE]) {
 		ethertype = nla_get_be16(tb[TCA_FLOWER_KEY_ETH_TYPE]);
 
-		if (ethertype == htons(ETH_P_8021Q)) {
-			fl_set_key_vlan(tb, &key->vlan, &mask->vlan);
+		if (eth_type_vlan(ethertype)) {
+			fl_set_key_vlan(tb, ethertype, &key->vlan, &mask->vlan);
 			fl_set_key_val(tb, &key->basic.n_proto,
 				       TCA_FLOWER_KEY_VLAN_ETH_TYPE,
 				       &mask->basic.n_proto, TCA_FLOWER_UNSPEC,
-- 
2.9.5

  parent reply	other threads:[~2018-07-06  5:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06  5:38 [PATCH v2 net-next 0/5] Introduce matching on double vlan/QinQ headers for TC flower Jianbo Liu
2018-07-06  5:38 ` [PATCH v2 net-next 1/5] net/flow_dissector: Save vlan ethertype from headers Jianbo Liu
2018-07-06  5:38 ` Jianbo Liu [this message]
2018-07-06  5:38 ` [PATCH v2 net-next 3/5] net/flow_dissector: Add support for QinQ dissection Jianbo Liu
2018-07-06  5:38 ` [PATCH v2 net-next 4/5] net/sched: flower: Dump the ethertype encapsulated in vlan Jianbo Liu
2018-07-06  5:38 ` [PATCH v2 net-next 5/5] net/sched: flower: Add supprt for matching on QinQ vlan headers Jianbo Liu
2018-07-08 10:27   ` Zahari, Doychev
2018-07-09  0:28     ` Jianbo Liu
2018-07-07 11:52 ` [PATCH v2 net-next 0/5] Introduce matching on double vlan/QinQ headers for TC flower 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=20180706053817.17712-3-jianbol@mellanox.com \
    --to=jianbol@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@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