All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next V2 0/3] net/sched: cls_flower: Add ports masks
@ 2016-09-13 14:02 Or Gerlitz
  2016-09-13 14:02 ` [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports Or Gerlitz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Or Gerlitz @ 2016-09-13 14:02 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey, Or Gerlitz

This series adds the ability to specify tcp/udp ports masks 
for TC/flower filter matches.

I also removed an unused fields from the flower keys struct 
and clarified the format of the recently added vlan attibutes.

Or.

Or Gerlitz (3):
  net/sched: cls_flower: Support masking for matching on tcp/udp ports
  net/sched: cls_flower: Remove an unsed field from the filter key structure
  net/sched: cls_flower: Specify vlan attributes format in the UAPI header

 include/uapi/linux/pkt_cls.h | 10 +++++++---
 net/sched/cls_flower.c       | 21 ++++++++++++---------
 2 files changed, 19 insertions(+), 12 deletions(-)

-- 
2.3.7

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

* [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports
  2016-09-13 14:02 [PATCH net-next V2 0/3] net/sched: cls_flower: Add ports masks Or Gerlitz
@ 2016-09-13 14:02 ` Or Gerlitz
  2016-09-13 14:12   ` Jiri Pirko
  2016-09-13 14:02 ` [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure Or Gerlitz
  2016-09-13 14:02 ` [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header Or Gerlitz
  2 siblings, 1 reply; 8+ messages in thread
From: Or Gerlitz @ 2016-09-13 14:02 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey, Or Gerlitz

Add the definitions for src/dst udp/tcp port masks and use
them when setting && dumping the relevant keys.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Paul Blakey <paulb@mellanox.com>
---
 include/uapi/linux/pkt_cls.h |  4 ++++
 net/sched/cls_flower.c       | 20 ++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index f9c287c..60ea2a0 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -442,6 +442,10 @@ enum {
 	TCA_FLOWER_KEY_ENC_IPV6_DST,	/* struct in6_addr */
 	TCA_FLOWER_KEY_ENC_IPV6_DST_MASK,/* struct in6_addr */
 
+	TCA_FLOWER_KEY_TCP_SRC_MASK,	/* be16 */
+	TCA_FLOWER_KEY_TCP_DST_MASK,	/* be16 */
+	TCA_FLOWER_KEY_UDP_SRC_MASK,	/* be16 */
+	TCA_FLOWER_KEY_UDP_DST_MASK,	/* be16 */
 	__TCA_FLOWER_MAX,
 };
 
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index b084b2a..027523c 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -335,6 +335,10 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
 	[TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK] = { .len = sizeof(struct in6_addr) },
 	[TCA_FLOWER_KEY_ENC_IPV6_DST]	= { .len = sizeof(struct in6_addr) },
 	[TCA_FLOWER_KEY_ENC_IPV6_DST_MASK] = { .len = sizeof(struct in6_addr) },
+	[TCA_FLOWER_KEY_TCP_SRC_MASK]	= { .type = NLA_U16 },
+	[TCA_FLOWER_KEY_TCP_DST_MASK]	= { .type = NLA_U16 },
+	[TCA_FLOWER_KEY_UDP_SRC_MASK]	= { .type = NLA_U16 },
+	[TCA_FLOWER_KEY_UDP_DST_MASK]	= { .type = NLA_U16 },
 };
 
 static void fl_set_key_val(struct nlattr **tb,
@@ -432,17 +436,17 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
 
 	if (key->basic.ip_proto == IPPROTO_TCP) {
 		fl_set_key_val(tb, &key->tp.src, TCA_FLOWER_KEY_TCP_SRC,
-			       &mask->tp.src, TCA_FLOWER_UNSPEC,
+			       &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK,
 			       sizeof(key->tp.src));
 		fl_set_key_val(tb, &key->tp.dst, TCA_FLOWER_KEY_TCP_DST,
-			       &mask->tp.dst, TCA_FLOWER_UNSPEC,
+			       &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK,
 			       sizeof(key->tp.dst));
 	} else if (key->basic.ip_proto == IPPROTO_UDP) {
 		fl_set_key_val(tb, &key->tp.src, TCA_FLOWER_KEY_UDP_SRC,
-			       &mask->tp.src, TCA_FLOWER_UNSPEC,
+			       &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK,
 			       sizeof(key->tp.src));
 		fl_set_key_val(tb, &key->tp.dst, TCA_FLOWER_KEY_UDP_DST,
-			       &mask->tp.dst, TCA_FLOWER_UNSPEC,
+			       &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK,
 			       sizeof(key->tp.dst));
 	}
 
@@ -877,18 +881,18 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
 
 	if (key->basic.ip_proto == IPPROTO_TCP &&
 	    (fl_dump_key_val(skb, &key->tp.src, TCA_FLOWER_KEY_TCP_SRC,
-			     &mask->tp.src, TCA_FLOWER_UNSPEC,
+			     &mask->tp.src, TCA_FLOWER_KEY_TCP_SRC_MASK,
 			     sizeof(key->tp.src)) ||
 	     fl_dump_key_val(skb, &key->tp.dst, TCA_FLOWER_KEY_TCP_DST,
-			     &mask->tp.dst, TCA_FLOWER_UNSPEC,
+			     &mask->tp.dst, TCA_FLOWER_KEY_TCP_DST_MASK,
 			     sizeof(key->tp.dst))))
 		goto nla_put_failure;
 	else if (key->basic.ip_proto == IPPROTO_UDP &&
 		 (fl_dump_key_val(skb, &key->tp.src, TCA_FLOWER_KEY_UDP_SRC,
-				  &mask->tp.src, TCA_FLOWER_UNSPEC,
+				  &mask->tp.src, TCA_FLOWER_KEY_UDP_SRC_MASK,
 				  sizeof(key->tp.src)) ||
 		  fl_dump_key_val(skb, &key->tp.dst, TCA_FLOWER_KEY_UDP_DST,
-				  &mask->tp.dst, TCA_FLOWER_UNSPEC,
+				  &mask->tp.dst, TCA_FLOWER_KEY_UDP_DST_MASK,
 				  sizeof(key->tp.dst))))
 		goto nla_put_failure;
 
-- 
2.3.7

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

* [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure
  2016-09-13 14:02 [PATCH net-next V2 0/3] net/sched: cls_flower: Add ports masks Or Gerlitz
  2016-09-13 14:02 ` [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports Or Gerlitz
@ 2016-09-13 14:02 ` Or Gerlitz
  2016-09-13 14:20   ` Jiri Pirko
  2016-09-15 12:01   ` Sergei Shtylyov
  2016-09-13 14:02 ` [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header Or Gerlitz
  2 siblings, 2 replies; 8+ messages in thread
From: Or Gerlitz @ 2016-09-13 14:02 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey, Or Gerlitz

Commit c3f8324188fa "net: Add full IPv6 addresses to flow_keys" added an
unsed instance of struct flow_dissector_key_addrs into struct fl_flow_key,
remove it.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Hadar Hen Zion <hadarh@mellanox.com>
---
 net/sched/cls_flower.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 027523c..a3f4c70 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -33,7 +33,6 @@ struct fl_flow_key {
 	struct flow_dissector_key_basic basic;
 	struct flow_dissector_key_eth_addrs eth;
 	struct flow_dissector_key_vlan vlan;
-	struct flow_dissector_key_addrs ipaddrs;
 	union {
 		struct flow_dissector_key_ipv4_addrs ipv4;
 		struct flow_dissector_key_ipv6_addrs ipv6;
-- 
2.3.7

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

* [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header
  2016-09-13 14:02 [PATCH net-next V2 0/3] net/sched: cls_flower: Add ports masks Or Gerlitz
  2016-09-13 14:02 ` [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports Or Gerlitz
  2016-09-13 14:02 ` [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure Or Gerlitz
@ 2016-09-13 14:02 ` Or Gerlitz
  2016-09-13 14:21   ` Jiri Pirko
  2 siblings, 1 reply; 8+ messages in thread
From: Or Gerlitz @ 2016-09-13 14:02 UTC (permalink / raw)
  To: David S. Miller
  Cc: Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey, Or Gerlitz

Specify the format (size and endianess) for the vlan attributes.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 include/uapi/linux/pkt_cls.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index 60ea2a0..8915b61 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -428,9 +428,9 @@ enum {
 	TCA_FLOWER_KEY_UDP_DST,		/* be16 */
 
 	TCA_FLOWER_FLAGS,
-	TCA_FLOWER_KEY_VLAN_ID,
-	TCA_FLOWER_KEY_VLAN_PRIO,
-	TCA_FLOWER_KEY_VLAN_ETH_TYPE,
+	TCA_FLOWER_KEY_VLAN_ID,		/* be16 */
+	TCA_FLOWER_KEY_VLAN_PRIO,	/* u8   */
+	TCA_FLOWER_KEY_VLAN_ETH_TYPE,	/* be16 */
 
 	TCA_FLOWER_KEY_ENC_KEY_ID,	/* be32 */
 	TCA_FLOWER_KEY_ENC_IPV4_SRC,	/* be32 */
-- 
2.3.7

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

* Re: [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports
  2016-09-13 14:02 ` [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports Or Gerlitz
@ 2016-09-13 14:12   ` Jiri Pirko
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2016-09-13 14:12 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey

Tue, Sep 13, 2016 at 04:02:39PM CEST, ogerlitz@mellanox.com wrote:
>Add the definitions for src/dst udp/tcp port masks and use
>them when setting && dumping the relevant keys.
>
>Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
>Signed-off-by: Paul Blakey <paulb@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure
  2016-09-13 14:02 ` [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure Or Gerlitz
@ 2016-09-13 14:20   ` Jiri Pirko
  2016-09-15 12:01   ` Sergei Shtylyov
  1 sibling, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2016-09-13 14:20 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey

Tue, Sep 13, 2016 at 04:02:40PM CEST, ogerlitz@mellanox.com wrote:
>Commit c3f8324188fa "net: Add full IPv6 addresses to flow_keys" added an
>unsed instance of struct flow_dissector_key_addrs into struct fl_flow_key,
>remove it.
>
>Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
>Reported-by: Hadar Hen Zion <hadarh@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header
  2016-09-13 14:02 ` [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header Or Gerlitz
@ 2016-09-13 14:21   ` Jiri Pirko
  0 siblings, 0 replies; 8+ messages in thread
From: Jiri Pirko @ 2016-09-13 14:21 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey

Tue, Sep 13, 2016 at 04:02:41PM CEST, ogerlitz@mellanox.com wrote:
>Specify the format (size and endianess) for the vlan attributes.
>
>Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

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

* Re: [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure
  2016-09-13 14:02 ` [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure Or Gerlitz
  2016-09-13 14:20   ` Jiri Pirko
@ 2016-09-15 12:01   ` Sergei Shtylyov
  1 sibling, 0 replies; 8+ messages in thread
From: Sergei Shtylyov @ 2016-09-15 12:01 UTC (permalink / raw)
  To: Or Gerlitz, David S. Miller
  Cc: Jiri Pirko, netdev, Hadar Har-Zion, Paul Blakey

On 9/13/2016 5:02 PM, Or Gerlitz wrote:

> Commit c3f8324188fa "net: Add full IPv6 addresses to flow_keys" added an
> unsed instance of struct flow_dissector_key_addrs into struct fl_flow_key,

    Unused?

> remove it.
>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reported-by: Hadar Hen Zion <hadarh@mellanox.com>
[...]

MBR, Sergei

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

end of thread, other threads:[~2016-09-15 12:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 14:02 [PATCH net-next V2 0/3] net/sched: cls_flower: Add ports masks Or Gerlitz
2016-09-13 14:02 ` [PATCH net-next 1/3] net/sched: cls_flower: Support masking for matching on tcp/udp ports Or Gerlitz
2016-09-13 14:12   ` Jiri Pirko
2016-09-13 14:02 ` [PATCH net-next 2/3] net/sched: cls_flower: Remove an unsed field from the filter key structure Or Gerlitz
2016-09-13 14:20   ` Jiri Pirko
2016-09-15 12:01   ` Sergei Shtylyov
2016-09-13 14:02 ` [PATCH net-next 3/3] net/sched: cls_flower: Specify vlan attributes format in the UAPI header Or Gerlitz
2016-09-13 14:21   ` Jiri Pirko

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.