All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl
@ 2017-05-25 13:24 Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-25 13:24 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Saeed Mahameed, Roi Dayan, Paul Blakey, Or Gerlitz

Hi Dave, 

The 1st two patches enable matching/classifying on ip tos and ttl by 
the flow dissector and flower. The other two patches offload matching 
on tcp flags and ip tos in mlx5. 

The mlx5 patches touch single file/function and not interfere with
other inflight mlx5 submissions.

Or.


Or Gerlitz (4):
  net/flow_dissector: add support for dissection of misc ip header fields
  net/sched: cls_flower: add support for matching on ip tos and ttl
  net/mlx5e: Offload TC matching on tcp flags
  net/mlx5e: Offload TC matching on ip tos / traffic-class

 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 46 ++++++++++++++++++++++++-
 include/net/flow_dissector.h                    | 11 ++++++
 include/uapi/linux/pkt_cls.h                    |  5 +++
 net/core/flow_dissector.c                       | 40 +++++++++++++++++++++
 net/sched/cls_flower.c                          | 39 +++++++++++++++++++--
 5 files changed, 138 insertions(+), 3 deletions(-)

-- 
2.3.7

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

* [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-25 13:24 [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl Or Gerlitz
@ 2017-05-25 13:24 ` Or Gerlitz
  2017-05-25 15:42   ` Tom Herbert
  2017-05-25 16:22   ` Tom Herbert
  2017-05-25 13:24 ` [PATCH net-next 2/4] net/sched: cls_flower: add support for matching on ip tos and ttl Or Gerlitz
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-25 13:24 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Saeed Mahameed, Roi Dayan, Paul Blakey, Or Gerlitz

Add support for dissection of ip tos and ttl and ipv6 traffic-class
and hoplimit. Both are dissected into the same struct.

Uses similar call to ip dissection function as with tcp, arp and others.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 include/net/flow_dissector.h | 11 +++++++++++
 net/core/flow_dissector.c    | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
index efe34eec..e2663e9 100644
--- a/include/net/flow_dissector.h
+++ b/include/net/flow_dissector.h
@@ -165,6 +165,16 @@ struct flow_dissector_key_tcp {
 	__be16 flags;
 };
 
+/**
+ * struct flow_dissector_key_ip:
+ * @tos: tos
+ * @ttl: ttl
+ */
+struct flow_dissector_key_ip {
+	__u8	tos;
+	__u8	ttl;
+};
+
 enum flow_dissector_key_id {
 	FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
 	FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
@@ -186,6 +196,7 @@ enum flow_dissector_key_id {
 	FLOW_DISSECTOR_KEY_ENC_PORTS, /* struct flow_dissector_key_ports */
 	FLOW_DISSECTOR_KEY_MPLS, /* struct flow_dissector_key_mpls */
 	FLOW_DISSECTOR_KEY_TCP, /* struct flow_dissector_key_tcp */
+	FLOW_DISSECTOR_KEY_IP, /* struct flow_dissector_key_ip */
 
 	FLOW_DISSECTOR_KEY_MAX,
 };
diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
index 5a45943..fc5fc45 100644
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
@@ -367,6 +367,40 @@ __skb_flow_dissect_tcp(const struct sk_buff *skb,
 	key_tcp->flags = (*(__be16 *) &tcp_flag_word(th) & htons(0x0FFF));
 }
 
+static void
+__skb_flow_dissect_ipv4(const struct sk_buff *skb,
+			struct flow_dissector *flow_dissector,
+			void *target_container, void *data, const struct iphdr *iph)
+{
+	struct flow_dissector_key_ip *key_ip;
+
+	if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
+		return;
+
+	key_ip = skb_flow_dissector_target(flow_dissector,
+					   FLOW_DISSECTOR_KEY_IP,
+					   target_container);
+	key_ip->tos = iph->tos;
+	key_ip->ttl = iph->ttl;
+}
+
+static void
+__skb_flow_dissect_ipv6(const struct sk_buff *skb,
+			struct flow_dissector *flow_dissector,
+			void *target_container, void *data, const struct ipv6hdr *iph)
+{
+	struct flow_dissector_key_ip *key_ip;
+
+	if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
+		return;
+
+	key_ip = skb_flow_dissector_target(flow_dissector,
+					   FLOW_DISSECTOR_KEY_IP,
+					   target_container);
+	key_ip->tos = ipv6_get_dsfield(iph);
+	key_ip->ttl = iph->hop_limit;
+}
+
 /**
  * __skb_flow_dissect - extract the flow_keys struct and return it
  * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified
@@ -469,6 +503,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 			}
 		}
 
+		__skb_flow_dissect_ipv4(skb, flow_dissector,
+					target_container, data, iph);
+
 		if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
 			goto out_good;
 
@@ -514,6 +551,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
 				goto out_good;
 		}
 
+		__skb_flow_dissect_ipv6(skb, flow_dissector,
+					target_container, data, iph);
+
 		if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
 			goto out_good;
 
-- 
2.3.7

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

* [PATCH net-next 2/4] net/sched: cls_flower: add support for matching on ip tos and ttl
  2017-05-25 13:24 [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
@ 2017-05-25 13:24 ` Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 3/4] net/mlx5e: Offload TC matching on tcp flags Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 4/4] net/mlx5e: Offload TC matching on ip tos / traffic-class Or Gerlitz
  3 siblings, 0 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-25 13:24 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Saeed Mahameed, Roi Dayan, Paul Blakey, Or Gerlitz

Benefit from the support of ip header fields dissection and
allow users to set rules matching on ipv4 tos and ttl or
ipv6 traffic-class and hoplimit.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 include/uapi/linux/pkt_cls.h |  5 +++++
 net/sched/cls_flower.c       | 39 +++++++++++++++++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index c6e8cf5..edf43dd 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -454,6 +454,11 @@ enum {
 	TCA_FLOWER_KEY_TCP_FLAGS,	/* be16 */
 	TCA_FLOWER_KEY_TCP_FLAGS_MASK,	/* be16 */
 
+	TCA_FLOWER_KEY_IP_TOS,		/* u8 */
+	TCA_FLOWER_KEY_IP_TOS_MASK,	/* u8 */
+	TCA_FLOWER_KEY_IP_TTL,		/* u8 */
+	TCA_FLOWER_KEY_IP_TTL_MASK,	/* u8 */
+
 	__TCA_FLOWER_MAX,
 };
 
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index fb74a47..33feaee 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -50,6 +50,7 @@ struct fl_flow_key {
 	struct flow_dissector_key_ports enc_tp;
 	struct flow_dissector_key_mpls mpls;
 	struct flow_dissector_key_tcp tcp;
+	struct flow_dissector_key_ip ip;
 } __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
 
 struct fl_flow_mask_range {
@@ -427,6 +428,10 @@ static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
 	[TCA_FLOWER_KEY_MPLS_LABEL]	= { .type = NLA_U32 },
 	[TCA_FLOWER_KEY_TCP_FLAGS]	= { .type = NLA_U16 },
 	[TCA_FLOWER_KEY_TCP_FLAGS_MASK]	= { .type = NLA_U16 },
+	[TCA_FLOWER_KEY_IP_TOS]		= { .type = NLA_U8 },
+	[TCA_FLOWER_KEY_IP_TOS_MASK]	= { .type = NLA_U8 },
+	[TCA_FLOWER_KEY_IP_TTL]		= { .type = NLA_U8 },
+	[TCA_FLOWER_KEY_IP_TTL_MASK]	= { .type = NLA_U8 },
 };
 
 static void fl_set_key_val(struct nlattr **tb,
@@ -528,6 +533,19 @@ static int fl_set_key_flags(struct nlattr **tb,
 	return 0;
 }
 
+static void fl_set_key_ip(struct nlattr **tb,
+			  struct flow_dissector_key_ip *key,
+			  struct flow_dissector_key_ip *mask)
+{
+		fl_set_key_val(tb, &key->tos, TCA_FLOWER_KEY_IP_TOS,
+			       &mask->tos, TCA_FLOWER_KEY_IP_TOS_MASK,
+			       sizeof(key->tos));
+
+		fl_set_key_val(tb, &key->ttl, TCA_FLOWER_KEY_IP_TTL,
+			       &mask->ttl, TCA_FLOWER_KEY_IP_TTL_MASK,
+			       sizeof(key->ttl));
+}
+
 static int fl_set_key(struct net *net, struct nlattr **tb,
 		      struct fl_flow_key *key, struct fl_flow_key *mask)
 {
@@ -570,6 +588,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
 		fl_set_key_val(tb, &key->basic.ip_proto, TCA_FLOWER_KEY_IP_PROTO,
 			       &mask->basic.ip_proto, TCA_FLOWER_UNSPEC,
 			       sizeof(key->basic.ip_proto));
+		fl_set_key_ip(tb, &key->ip, &mask->ip);
 	}
 
 	if (tb[TCA_FLOWER_KEY_IPV4_SRC] || tb[TCA_FLOWER_KEY_IPV4_DST]) {
@@ -773,6 +792,8 @@ static void fl_init_dissector(struct cls_fl_head *head,
 	FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt,
 			     FLOW_DISSECTOR_KEY_PORTS, tp);
 	FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt,
+			     FLOW_DISSECTOR_KEY_IP, ip);
+	FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt,
 			     FLOW_DISSECTOR_KEY_TCP, tcp);
 	FL_KEY_SET_IF_MASKED(&mask->key, keys, cnt,
 			     FLOW_DISSECTOR_KEY_ICMP, icmp);
@@ -1082,6 +1103,19 @@ static int fl_dump_key_mpls(struct sk_buff *skb,
 	return 0;
 }
 
+static int fl_dump_key_ip(struct sk_buff *skb,
+			  struct flow_dissector_key_ip *key,
+			  struct flow_dissector_key_ip *mask)
+{
+	if (fl_dump_key_val(skb, &key->tos, TCA_FLOWER_KEY_IP_TOS, &mask->tos,
+			    TCA_FLOWER_KEY_IP_TOS_MASK, sizeof(key->tos)) ||
+	    fl_dump_key_val(skb, &key->ttl, TCA_FLOWER_KEY_IP_TTL, &mask->ttl,
+			    TCA_FLOWER_KEY_IP_TTL_MASK, sizeof(key->ttl)))
+		return -1;
+
+	return 0;
+}
+
 static int fl_dump_key_vlan(struct sk_buff *skb,
 			    struct flow_dissector_key_vlan *vlan_key,
 			    struct flow_dissector_key_vlan *vlan_mask)
@@ -1195,9 +1229,10 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
 
 	if ((key->basic.n_proto == htons(ETH_P_IP) ||
 	     key->basic.n_proto == htons(ETH_P_IPV6)) &&
-	    fl_dump_key_val(skb, &key->basic.ip_proto, TCA_FLOWER_KEY_IP_PROTO,
+	    (fl_dump_key_val(skb, &key->basic.ip_proto, TCA_FLOWER_KEY_IP_PROTO,
 			    &mask->basic.ip_proto, TCA_FLOWER_UNSPEC,
-			    sizeof(key->basic.ip_proto)))
+			    sizeof(key->basic.ip_proto)) ||
+	    fl_dump_key_ip(skb, &key->ip, &mask->ip)))
 		goto nla_put_failure;
 
 	if (key->control.addr_type == FLOW_DISSECTOR_KEY_IPV4_ADDRS &&
-- 
2.3.7

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

* [PATCH net-next 3/4] net/mlx5e: Offload TC matching on tcp flags
  2017-05-25 13:24 [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 2/4] net/sched: cls_flower: add support for matching on ip tos and ttl Or Gerlitz
@ 2017-05-25 13:24 ` Or Gerlitz
  2017-05-25 13:24 ` [PATCH net-next 4/4] net/mlx5e: Offload TC matching on ip tos / traffic-class Or Gerlitz
  3 siblings, 0 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-25 13:24 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Saeed Mahameed, Roi Dayan, Paul Blakey, Or Gerlitz

Enable offloading of TC matching on tcp flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index a72ecbc..8e856cd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -580,7 +580,8 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 	      BIT(FLOW_DISSECTOR_KEY_ENC_IPV4_ADDRS) |
 	      BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) |
 	      BIT(FLOW_DISSECTOR_KEY_ENC_PORTS)	|
-	      BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL))) {
+	      BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL) |
+	      BIT(FLOW_DISSECTOR_KEY_TCP))) {
 		netdev_warn(priv->netdev, "Unsupported key used: 0x%x\n",
 			    f->dissector->used_keys);
 		return -EOPNOTSUPP;
@@ -807,6 +808,25 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 			*min_inline = MLX5_INLINE_MODE_TCP_UDP;
 	}
 
+	if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_TCP)) {
+		struct flow_dissector_key_tcp *key =
+			skb_flow_dissector_target(f->dissector,
+						  FLOW_DISSECTOR_KEY_TCP,
+						  f->key);
+		struct flow_dissector_key_tcp *mask =
+			skb_flow_dissector_target(f->dissector,
+						  FLOW_DISSECTOR_KEY_TCP,
+						  f->mask);
+
+		MLX5_SET(fte_match_set_lyr_2_4, headers_c, tcp_flags,
+			 ntohs(mask->flags));
+		MLX5_SET(fte_match_set_lyr_2_4, headers_v, tcp_flags,
+			 ntohs(key->flags));
+
+		if (mask->flags)
+			*min_inline = MLX5_INLINE_MODE_TCP_UDP;
+	}
+
 	return 0;
 }
 
-- 
2.3.7

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

* [PATCH net-next 4/4] net/mlx5e: Offload TC matching on ip tos / traffic-class
  2017-05-25 13:24 [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl Or Gerlitz
                   ` (2 preceding siblings ...)
  2017-05-25 13:24 ` [PATCH net-next 3/4] net/mlx5e: Offload TC matching on tcp flags Or Gerlitz
@ 2017-05-25 13:24 ` Or Gerlitz
  3 siblings, 0 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-25 13:24 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Saeed Mahameed, Roi Dayan, Paul Blakey, Or Gerlitz

Enable offloading of TC matching on ipv4 tos or ipv6 traffic-class.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 26 ++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 8e856cd..f8403fd 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -581,7 +581,8 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 	      BIT(FLOW_DISSECTOR_KEY_ENC_IPV6_ADDRS) |
 	      BIT(FLOW_DISSECTOR_KEY_ENC_PORTS)	|
 	      BIT(FLOW_DISSECTOR_KEY_ENC_CONTROL) |
-	      BIT(FLOW_DISSECTOR_KEY_TCP))) {
+	      BIT(FLOW_DISSECTOR_KEY_TCP) |
+	      BIT(FLOW_DISSECTOR_KEY_IP))) {
 		netdev_warn(priv->netdev, "Unsupported key used: 0x%x\n",
 			    f->dissector->used_keys);
 		return -EOPNOTSUPP;
@@ -808,6 +809,29 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,
 			*min_inline = MLX5_INLINE_MODE_TCP_UDP;
 	}
 
+	if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_IP)) {
+		struct flow_dissector_key_ip *key =
+			skb_flow_dissector_target(f->dissector,
+						  FLOW_DISSECTOR_KEY_IP,
+						  f->key);
+		struct flow_dissector_key_ip *mask =
+			skb_flow_dissector_target(f->dissector,
+						  FLOW_DISSECTOR_KEY_IP,
+						  f->mask);
+
+		MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_ecn, mask->tos & 0x3);
+		MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ecn, key->tos & 0x3);
+
+		MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_dscp, mask->tos >> 2);
+		MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_dscp, key->tos  >> 2);
+
+		if (mask->tos)
+			*min_inline = MLX5_INLINE_MODE_IP;
+
+		if (mask->ttl) /* currently not supported */
+			return -EOPNOTSUPP;
+	}
+
 	if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_TCP)) {
 		struct flow_dissector_key_tcp *key =
 			skb_flow_dissector_target(f->dissector,
-- 
2.3.7

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
@ 2017-05-25 15:42   ` Tom Herbert
  2017-05-27 16:29     ` Or Gerlitz
  2017-05-25 16:22   ` Tom Herbert
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Herbert @ 2017-05-25 15:42 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, Linux Kernel Network Developers, Saeed Mahameed,
	Roi Dayan, Paul Blakey

On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
> Add support for dissection of ip tos and ttl and ipv6 traffic-class
> and hoplimit. Both are dissected into the same struct.
>
> Uses similar call to ip dissection function as with tcp, arp and others.
>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/net/flow_dissector.h | 11 +++++++++++
>  net/core/flow_dissector.c    | 40 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>
> diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
> index efe34eec..e2663e9 100644
> --- a/include/net/flow_dissector.h
> +++ b/include/net/flow_dissector.h
> @@ -165,6 +165,16 @@ struct flow_dissector_key_tcp {
>         __be16 flags;
>  };
>
> +/**
> + * struct flow_dissector_key_ip:
> + * @tos: tos
> + * @ttl: ttl
> + */
> +struct flow_dissector_key_ip {
> +       __u8    tos;
> +       __u8    ttl;
> +};
> +

Looks like yet more complexity be piled onto flow dissector. Instead
of splitting out individual fields can we just return a pointer to the
IP header and let the caller extract the fields they're interested in?

Tom

>  enum flow_dissector_key_id {
>         FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
>         FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
> @@ -186,6 +196,7 @@ enum flow_dissector_key_id {
>         FLOW_DISSECTOR_KEY_ENC_PORTS, /* struct flow_dissector_key_ports */
>         FLOW_DISSECTOR_KEY_MPLS, /* struct flow_dissector_key_mpls */
>         FLOW_DISSECTOR_KEY_TCP, /* struct flow_dissector_key_tcp */
> +       FLOW_DISSECTOR_KEY_IP, /* struct flow_dissector_key_ip */
>
>         FLOW_DISSECTOR_KEY_MAX,
>  };
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 5a45943..fc5fc45 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -367,6 +367,40 @@ __skb_flow_dissect_tcp(const struct sk_buff *skb,
>         key_tcp->flags = (*(__be16 *) &tcp_flag_word(th) & htons(0x0FFF));
>  }
>
> +static void
> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
> +                       struct flow_dissector *flow_dissector,
> +                       void *target_container, void *data, const struct iphdr *iph)
> +{
> +       struct flow_dissector_key_ip *key_ip;
> +
> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
> +               return;
> +
> +       key_ip = skb_flow_dissector_target(flow_dissector,
> +                                          FLOW_DISSECTOR_KEY_IP,
> +                                          target_container);
> +       key_ip->tos = iph->tos;
> +       key_ip->ttl = iph->ttl;
> +}
> +
> +static void
> +__skb_flow_dissect_ipv6(const struct sk_buff *skb,
> +                       struct flow_dissector *flow_dissector,
> +                       void *target_container, void *data, const struct ipv6hdr *iph)
> +{
> +       struct flow_dissector_key_ip *key_ip;
> +
> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
> +               return;
> +
> +       key_ip = skb_flow_dissector_target(flow_dissector,
> +                                          FLOW_DISSECTOR_KEY_IP,
> +                                          target_container);
> +       key_ip->tos = ipv6_get_dsfield(iph);
> +       key_ip->ttl = iph->hop_limit;
> +}
> +
>  /**
>   * __skb_flow_dissect - extract the flow_keys struct and return it
>   * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified
> @@ -469,6 +503,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>                         }
>                 }
>
> +               __skb_flow_dissect_ipv4(skb, flow_dissector,
> +                                       target_container, data, iph);
> +
>                 if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
>                         goto out_good;
>
> @@ -514,6 +551,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>                                 goto out_good;
>                 }
>
> +               __skb_flow_dissect_ipv6(skb, flow_dissector,
> +                                       target_container, data, iph);
> +
>                 if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
>                         goto out_good;
>
> --
> 2.3.7
>

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
  2017-05-25 15:42   ` Tom Herbert
@ 2017-05-25 16:22   ` Tom Herbert
  2017-05-27 16:31     ` Or Gerlitz
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Herbert @ 2017-05-25 16:22 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, Linux Kernel Network Developers, Saeed Mahameed,
	Roi Dayan, Paul Blakey

On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
> Add support for dissection of ip tos and ttl and ipv6 traffic-class
> and hoplimit. Both are dissected into the same struct.
>
> Uses similar call to ip dissection function as with tcp, arp and others.
>
> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  include/net/flow_dissector.h | 11 +++++++++++
>  net/core/flow_dissector.c    | 40 ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+)
>
> diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
> index efe34eec..e2663e9 100644
> --- a/include/net/flow_dissector.h
> +++ b/include/net/flow_dissector.h
> @@ -165,6 +165,16 @@ struct flow_dissector_key_tcp {
>         __be16 flags;
>  };
>
> +/**
> + * struct flow_dissector_key_ip:
> + * @tos: tos
> + * @ttl: ttl
> + */
> +struct flow_dissector_key_ip {
> +       __u8    tos;
> +       __u8    ttl;
> +};
> +
>  enum flow_dissector_key_id {
>         FLOW_DISSECTOR_KEY_CONTROL, /* struct flow_dissector_key_control */
>         FLOW_DISSECTOR_KEY_BASIC, /* struct flow_dissector_key_basic */
> @@ -186,6 +196,7 @@ enum flow_dissector_key_id {
>         FLOW_DISSECTOR_KEY_ENC_PORTS, /* struct flow_dissector_key_ports */
>         FLOW_DISSECTOR_KEY_MPLS, /* struct flow_dissector_key_mpls */
>         FLOW_DISSECTOR_KEY_TCP, /* struct flow_dissector_key_tcp */
> +       FLOW_DISSECTOR_KEY_IP, /* struct flow_dissector_key_ip */
>
>         FLOW_DISSECTOR_KEY_MAX,
>  };
> diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c
> index 5a45943..fc5fc45 100644
> --- a/net/core/flow_dissector.c
> +++ b/net/core/flow_dissector.c
> @@ -367,6 +367,40 @@ __skb_flow_dissect_tcp(const struct sk_buff *skb,
>         key_tcp->flags = (*(__be16 *) &tcp_flag_word(th) & htons(0x0FFF));
>  }
>
> +static void
> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
> +                       struct flow_dissector *flow_dissector,
> +                       void *target_container, void *data, const struct iphdr *iph)
> +{
> +       struct flow_dissector_key_ip *key_ip;
> +
> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
> +               return;
> +
> +       key_ip = skb_flow_dissector_target(flow_dissector,
> +                                          FLOW_DISSECTOR_KEY_IP,
> +                                          target_container);
> +       key_ip->tos = iph->tos;
> +       key_ip->ttl = iph->ttl;

In an encapsulation this returns the tos and ttl of the encapsulated
packet. Is that really useful to the caller? Seems more likely that
they need the outer tos and ttl for forwarding.

> +}
> +
> +static void
> +__skb_flow_dissect_ipv6(const struct sk_buff *skb,
> +                       struct flow_dissector *flow_dissector,
> +                       void *target_container, void *data, const struct ipv6hdr *iph)
> +{
> +       struct flow_dissector_key_ip *key_ip;
> +
> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
> +               return;
> +
> +       key_ip = skb_flow_dissector_target(flow_dissector,
> +                                          FLOW_DISSECTOR_KEY_IP,
> +                                          target_container);
> +       key_ip->tos = ipv6_get_dsfield(iph);
> +       key_ip->ttl = iph->hop_limit;
> +}
> +
>  /**
>   * __skb_flow_dissect - extract the flow_keys struct and return it
>   * @skb: sk_buff to extract the flow from, can be NULL if the rest are specified
> @@ -469,6 +503,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>                         }
>                 }
>
> +               __skb_flow_dissect_ipv4(skb, flow_dissector,
> +                                       target_container, data, iph);
> +
>                 if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
>                         goto out_good;
>
> @@ -514,6 +551,9 @@ bool __skb_flow_dissect(const struct sk_buff *skb,
>                                 goto out_good;
>                 }
>
> +               __skb_flow_dissect_ipv6(skb, flow_dissector,
> +                                       target_container, data, iph);
> +
>                 if (flags & FLOW_DISSECTOR_F_STOP_AT_L3)
>                         goto out_good;
>
> --
> 2.3.7
>

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-25 15:42   ` Tom Herbert
@ 2017-05-27 16:29     ` Or Gerlitz
  0 siblings, 0 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-27 16:29 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, David S. Miller, Linux Kernel Network Developers,
	Saeed Mahameed, Roi Dayan, Paul Blakey

On Thu, May 25, 2017 at 6:42 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>> Add support for dissection of ip tos and ttl and ipv6 traffic-class
>> and hoplimit. Both are dissected into the same struct.

>> --- a/include/net/flow_dissector.h
>> +++ b/include/net/flow_dissector.h

>> +/**
>> + * struct flow_dissector_key_ip:
>> + * @tos: tos
>> + * @ttl: ttl
>> + */
>> +struct flow_dissector_key_ip {
>> +       __u8    tos;
>> +       __u8    ttl;
>> +};
>> +

> Looks like yet more complexity be piled onto flow dissector. Instead
> of splitting out individual fields can we just return a pointer to the
> IP header and let the caller extract the fields they're interested in?

Do you mean that struct flow_dissector_key_ip  will only contain
(union?) const struct iphdr * and const struct ipv6hdr * ? I wasn't
sure how would that further look on the kernel SW classification path
(the non offloaded case)

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-25 16:22   ` Tom Herbert
@ 2017-05-27 16:31     ` Or Gerlitz
  2017-05-27 17:18       ` Tom Herbert
  0 siblings, 1 reply; 16+ messages in thread
From: Or Gerlitz @ 2017-05-27 16:31 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, David S. Miller, Linux Kernel Network Developers,
	Saeed Mahameed, Roi Dayan, Paul Blakey

On Thu, May 25, 2017 at 7:22 PM, Tom Herbert <tom@herbertland.com> wrote:
> On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>> Add support for dissection of ip tos and ttl and ipv6 traffic-class
>> and hoplimit. Both are dissected into the same struct.

>> Uses similar call to ip dissection function as with tcp, arp and others.


>> +/**
>> + * struct flow_dissector_key_ip:
>> + * @tos: tos
>> + * @ttl: ttl
>> + */
>> +struct flow_dissector_key_ip {
>> +       __u8    tos;
>> +       __u8    ttl;
>> +};
>> --- a/net/core/flow_dissector.c
>> +++ b/net/core/flow_dissector.c

>> +static void
>> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
>> +                       struct flow_dissector *flow_dissector,
>> +                       void *target_container, void *data, const struct iphdr *iph)
>> +{
>> +       struct flow_dissector_key_ip *key_ip;
>> +
>> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
>> +               return;
>> +
>> +       key_ip = skb_flow_dissector_target(flow_dissector,
>> +                                          FLOW_DISSECTOR_KEY_IP,
>> +                                          target_container);
>> +       key_ip->tos = iph->tos;
>> +       key_ip->ttl = iph->ttl;
>
> In an encapsulation this returns the tos and ttl of the encapsulated
> packet. Is that really useful to the caller? Seems more likely that
> they need the outer tos and ttl for forwarding.

In what we are dealing with, classification is carried after the
packet is decapsulated by the shared tunnel device. So even today,e.g
for the src/dst IP, the dissection is carried on what were the inner
fields before decap.

When we did the the flower patches for being able to classify on both
the inner and outer fields (say outer src/dst ip, tunnel key) for what
related to the  macs/ips/ports/etc -- I don't think we touched the
existing dissection, I will look on that to see if I am wrong..

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-27 16:31     ` Or Gerlitz
@ 2017-05-27 17:18       ` Tom Herbert
  2017-05-27 20:56         ` Or Gerlitz
  2017-05-30 13:10         ` Jiri Pirko
  0 siblings, 2 replies; 16+ messages in thread
From: Tom Herbert @ 2017-05-27 17:18 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Or Gerlitz, David S. Miller, Linux Kernel Network Developers,
	Saeed Mahameed, Roi Dayan, Paul Blakey

On Sat, May 27, 2017 at 9:31 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
> On Thu, May 25, 2017 at 7:22 PM, Tom Herbert <tom@herbertland.com> wrote:
>> On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>>> Add support for dissection of ip tos and ttl and ipv6 traffic-class
>>> and hoplimit. Both are dissected into the same struct.
>
>>> Uses similar call to ip dissection function as with tcp, arp and others.
>
>
>>> +/**
>>> + * struct flow_dissector_key_ip:
>>> + * @tos: tos
>>> + * @ttl: ttl
>>> + */
>>> +struct flow_dissector_key_ip {
>>> +       __u8    tos;
>>> +       __u8    ttl;
>>> +};
>>> --- a/net/core/flow_dissector.c
>>> +++ b/net/core/flow_dissector.c
>
>>> +static void
>>> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
>>> +                       struct flow_dissector *flow_dissector,
>>> +                       void *target_container, void *data, const struct iphdr *iph)
>>> +{
>>> +       struct flow_dissector_key_ip *key_ip;
>>> +
>>> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
>>> +               return;
>>> +
>>> +       key_ip = skb_flow_dissector_target(flow_dissector,
>>> +                                          FLOW_DISSECTOR_KEY_IP,
>>> +                                          target_container);
>>> +       key_ip->tos = iph->tos;
>>> +       key_ip->ttl = iph->ttl;
>>
>> In an encapsulation this returns the tos and ttl of the encapsulated
>> packet. Is that really useful to the caller? Seems more likely that
>> they need the outer tos and ttl for forwarding.
>
> In what we are dealing with, classification is carried after the
> packet is decapsulated by the shared tunnel device. So even today,e.g
> for the src/dst IP, the dissection is carried on what were the inner
> fields before decap.
>
Or,

I think the problem is I don't know what you're dealing with. The only
thing I can derive from the commit log is that tos and ttl are being
extracted, but I don't know why they are needed. I do know this is
adding complexity to an already overly complex function, and this
introduces new conditionals and code into the primary use case of
flow_dissector which is to create a key for deriving skb->hash. I
don't see that the cost of this patch has been justified.

Tom

> When we did the the flower patches for being able to classify on both
> the inner and outer fields (say outer src/dst ip, tunnel key) for what
> related to the  macs/ips/ports/etc -- I don't think we touched the
> existing dissection, I will look on that to see if I am wrong..

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-27 17:18       ` Tom Herbert
@ 2017-05-27 20:56         ` Or Gerlitz
  2017-05-30 13:10         ` Jiri Pirko
  1 sibling, 0 replies; 16+ messages in thread
From: Or Gerlitz @ 2017-05-27 20:56 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, David S. Miller, Linux Kernel Network Developers,
	Saeed Mahameed, Roi Dayan, Paul Blakey

On Sat, May 27, 2017 at 8:18 PM, Tom Herbert <tom@herbertland.com> wrote:

> I think the problem is I don't know what you're dealing with. The only
> thing I can derive from the commit log is that tos and ttl are being
> extracted, but I don't know why they are needed.

The current case for matching on TTL I am dealing with is for using
TC/flower for offloading OVS in flow based VM traffic routing env
(Open-Stack and ODL
DVR - Distributed Virtual Routing) -- where packet headers are
re-written to set the next hop MACs and the TTL is changed. Fields
which are modified are also matched beforhand, and here comes the
matching on TTL.

> I do know this is
> adding complexity to an already overly complex function, and this
> introduces new conditionals and code into the primary use case of
> flow_dissector which is to create a key for deriving skb->hash. I
> don't see that the cost of this patch has been justified.

I hear what you're saying, but part of the rules is that everything to
be offloaded can also be carried out in the kernel SW data-path, so
here comes the touching that area. I have used the minimal foot print
I could and set the code to run in a separate helper called from the
main dissection function.


>> When we did the the flower patches for being able to classify on both
>> the inner and outer fields (say outer src/dst ip, tunnel key) for what
>> related to the  macs/ips/ports/etc -- I don't think we touched the
>> existing dissection, I will look on that to see if I am wrong..

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-27 17:18       ` Tom Herbert
  2017-05-27 20:56         ` Or Gerlitz
@ 2017-05-30 13:10         ` Jiri Pirko
  2017-05-30 16:06           ` Tom Herbert
  1 sibling, 1 reply; 16+ messages in thread
From: Jiri Pirko @ 2017-05-30 13:10 UTC (permalink / raw)
  To: Tom Herbert
  Cc: Or Gerlitz, Or Gerlitz, David S. Miller,
	Linux Kernel Network Developers, Saeed Mahameed, Roi Dayan,
	Paul Blakey

Sat, May 27, 2017 at 07:18:45PM CEST, tom@herbertland.com wrote:
>On Sat, May 27, 2017 at 9:31 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>> On Thu, May 25, 2017 at 7:22 PM, Tom Herbert <tom@herbertland.com> wrote:
>>> On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>>>> Add support for dissection of ip tos and ttl and ipv6 traffic-class
>>>> and hoplimit. Both are dissected into the same struct.
>>
>>>> Uses similar call to ip dissection function as with tcp, arp and others.
>>
>>
>>>> +/**
>>>> + * struct flow_dissector_key_ip:
>>>> + * @tos: tos
>>>> + * @ttl: ttl
>>>> + */
>>>> +struct flow_dissector_key_ip {
>>>> +       __u8    tos;
>>>> +       __u8    ttl;
>>>> +};
>>>> --- a/net/core/flow_dissector.c
>>>> +++ b/net/core/flow_dissector.c
>>
>>>> +static void
>>>> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
>>>> +                       struct flow_dissector *flow_dissector,
>>>> +                       void *target_container, void *data, const struct iphdr *iph)
>>>> +{
>>>> +       struct flow_dissector_key_ip *key_ip;
>>>> +
>>>> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
>>>> +               return;
>>>> +
>>>> +       key_ip = skb_flow_dissector_target(flow_dissector,
>>>> +                                          FLOW_DISSECTOR_KEY_IP,
>>>> +                                          target_container);
>>>> +       key_ip->tos = iph->tos;
>>>> +       key_ip->ttl = iph->ttl;
>>>
>>> In an encapsulation this returns the tos and ttl of the encapsulated
>>> packet. Is that really useful to the caller? Seems more likely that
>>> they need the outer tos and ttl for forwarding.
>>
>> In what we are dealing with, classification is carried after the
>> packet is decapsulated by the shared tunnel device. So even today,e.g
>> for the src/dst IP, the dissection is carried on what were the inner
>> fields before decap.
>>
>Or,
>
>I think the problem is I don't know what you're dealing with. The only
>thing I can derive from the commit log is that tos and ttl are being
>extracted, but I don't know why they are needed. I do know this is
>adding complexity to an already overly complex function, and this
>introduces new conditionals and code into the primary use case of
>flow_dissector which is to create a key for deriving skb->hash. I
>don't see that the cost of this patch has been justified.

Tom, we have been over this multiple times. The decision DaveM made at
the time I was pushing cls_flower was to have one shared dissection code
(I originally had a separate dissector inside cls_flower). And I
agree with that decision. It was a bit painful to work out the
flow_dissector in a generic way, but it was worth the efford.

So when we need to dissect something new for cls_flower, we put it here.
flow_dissector is now miles away from being just a plain
"creator of the key to derive skb->hash".

Jiří

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-30 13:10         ` Jiri Pirko
@ 2017-05-30 16:06           ` Tom Herbert
  2017-05-30 16:18             ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Herbert @ 2017-05-30 16:06 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: Or Gerlitz, Or Gerlitz, David S. Miller,
	Linux Kernel Network Developers, Saeed Mahameed, Roi Dayan,
	Paul Blakey

On Tue, May 30, 2017 at 6:10 AM, Jiri Pirko <jiri@resnulli.us> wrote:
> Sat, May 27, 2017 at 07:18:45PM CEST, tom@herbertland.com wrote:
>>On Sat, May 27, 2017 at 9:31 AM, Or Gerlitz <gerlitz.or@gmail.com> wrote:
>>> On Thu, May 25, 2017 at 7:22 PM, Tom Herbert <tom@herbertland.com> wrote:
>>>> On Thu, May 25, 2017 at 6:24 AM, Or Gerlitz <ogerlitz@mellanox.com> wrote:
>>>>> Add support for dissection of ip tos and ttl and ipv6 traffic-class
>>>>> and hoplimit. Both are dissected into the same struct.
>>>
>>>>> Uses similar call to ip dissection function as with tcp, arp and others.
>>>
>>>
>>>>> +/**
>>>>> + * struct flow_dissector_key_ip:
>>>>> + * @tos: tos
>>>>> + * @ttl: ttl
>>>>> + */
>>>>> +struct flow_dissector_key_ip {
>>>>> +       __u8    tos;
>>>>> +       __u8    ttl;
>>>>> +};
>>>>> --- a/net/core/flow_dissector.c
>>>>> +++ b/net/core/flow_dissector.c
>>>
>>>>> +static void
>>>>> +__skb_flow_dissect_ipv4(const struct sk_buff *skb,
>>>>> +                       struct flow_dissector *flow_dissector,
>>>>> +                       void *target_container, void *data, const struct iphdr *iph)
>>>>> +{
>>>>> +       struct flow_dissector_key_ip *key_ip;
>>>>> +
>>>>> +       if (!dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_IP))
>>>>> +               return;
>>>>> +
>>>>> +       key_ip = skb_flow_dissector_target(flow_dissector,
>>>>> +                                          FLOW_DISSECTOR_KEY_IP,
>>>>> +                                          target_container);
>>>>> +       key_ip->tos = iph->tos;
>>>>> +       key_ip->ttl = iph->ttl;
>>>>
>>>> In an encapsulation this returns the tos and ttl of the encapsulated
>>>> packet. Is that really useful to the caller? Seems more likely that
>>>> they need the outer tos and ttl for forwarding.
>>>
>>> In what we are dealing with, classification is carried after the
>>> packet is decapsulated by the shared tunnel device. So even today,e.g
>>> for the src/dst IP, the dissection is carried on what were the inner
>>> fields before decap.
>>>
>>Or,
>>
>>I think the problem is I don't know what you're dealing with. The only
>>thing I can derive from the commit log is that tos and ttl are being
>>extracted, but I don't know why they are needed. I do know this is
>>adding complexity to an already overly complex function, and this
>>introduces new conditionals and code into the primary use case of
>>flow_dissector which is to create a key for deriving skb->hash. I
>>don't see that the cost of this patch has been justified.
>
> Tom, we have been over this multiple times. The decision DaveM made at
> the time I was pushing cls_flower was to have one shared dissection code
> (I originally had a separate dissector inside cls_flower). And I
> agree with that decision. It was a bit painful to work out the
> flow_dissector in a generic way, but it was worth the efford.
>is i
> So when we need to dissect something new for cls_flower, we put it here.
> flow_dissector is now miles away from being just a plain
> "creator of the key to derive skb->hash".
>
Jiri,

The commit log does not mention cls_flower. There are no test results
given for the impact of the patch. There is no description why tos and
ttl are being added as opposed to id, flags, or IP options for that
matter.

Tom

> Jiří

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-30 16:06           ` Tom Herbert
@ 2017-05-30 16:18             ` David Miller
  2017-06-01 16:08               ` Or Gerlitz
  0 siblings, 1 reply; 16+ messages in thread
From: David Miller @ 2017-05-30 16:18 UTC (permalink / raw)
  To: tom; +Cc: jiri, gerlitz.or, ogerlitz, netdev, saeedm, roid, paulb

From: Tom Herbert <tom@herbertland.com>
Date: Tue, 30 May 2017 09:06:11 -0700

> The commit log does not mention cls_flower. There are no test results
> given for the impact of the patch. There is no description why tos and
> ttl are being added as opposed to id, flags, or IP options for that
> matter.

The top level merge commit explains everything, and since the patches
are grouped together logically, even if you just look at the merge
commit in the GIT tree, it is mentioned.

This has been going on for so long, it's kinda unreasonable for you to
start complaining now.

Thanks.

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-05-30 16:18             ` David Miller
@ 2017-06-01 16:08               ` Or Gerlitz
  2017-06-01 16:35                 ` David Miller
  0 siblings, 1 reply; 16+ messages in thread
From: Or Gerlitz @ 2017-06-01 16:08 UTC (permalink / raw)
  To: David Miller
  Cc: Tom Herbert, Jiri Pirko, Or Gerlitz, Linux Netdev List,
	Saeed Mahameed, Roi Dayan, Paul Blakey

On Tue, May 30, 2017 at 7:18 PM, David Miller <davem@davemloft.net> wrote:

> The top level merge commit explains everything, and since the patches
> are grouped together logically, even if you just look at the merge
> commit in the GIT tree, it is mentioned.

Hi Dave,

Do you want to see a repost here or you are going to process the
series I submitted from patchworks?

Or.

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

* Re: [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields
  2017-06-01 16:08               ` Or Gerlitz
@ 2017-06-01 16:35                 ` David Miller
  0 siblings, 0 replies; 16+ messages in thread
From: David Miller @ 2017-06-01 16:35 UTC (permalink / raw)
  To: gerlitz.or; +Cc: tom, jiri, ogerlitz, netdev, saeedm, roid, paulb

From: Or Gerlitz <gerlitz.or@gmail.com>
Date: Thu, 1 Jun 2017 19:08:56 +0300

> On Tue, May 30, 2017 at 7:18 PM, David Miller <davem@davemloft.net> wrote:
> 
>> The top level merge commit explains everything, and since the patches
>> are grouped together logically, even if you just look at the merge
>> commit in the GIT tree, it is mentioned.
> 
> Hi Dave,
> 
> Do you want to see a repost here or you are going to process the
> series I submitted from patchworks?

There needs to be a repost.

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

end of thread, other threads:[~2017-06-01 16:35 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 13:24 [PATCH net-next 0/4] add support for dissection and matching on ip tos and ttl Or Gerlitz
2017-05-25 13:24 ` [PATCH net-next 1/4] net/flow_dissector: add support for dissection of misc ip header fields Or Gerlitz
2017-05-25 15:42   ` Tom Herbert
2017-05-27 16:29     ` Or Gerlitz
2017-05-25 16:22   ` Tom Herbert
2017-05-27 16:31     ` Or Gerlitz
2017-05-27 17:18       ` Tom Herbert
2017-05-27 20:56         ` Or Gerlitz
2017-05-30 13:10         ` Jiri Pirko
2017-05-30 16:06           ` Tom Herbert
2017-05-30 16:18             ` David Miller
2017-06-01 16:08               ` Or Gerlitz
2017-06-01 16:35                 ` David Miller
2017-05-25 13:24 ` [PATCH net-next 2/4] net/sched: cls_flower: add support for matching on ip tos and ttl Or Gerlitz
2017-05-25 13:24 ` [PATCH net-next 3/4] net/mlx5e: Offload TC matching on tcp flags Or Gerlitz
2017-05-25 13:24 ` [PATCH net-next 4/4] net/mlx5e: Offload TC matching on ip tos / traffic-class Or Gerlitz

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.