linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rdma-next 0/5] Add flow tag support to flow specification
@ 2017-01-18 12:59 Leon Romanovsky
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim

Hi Doug,

The flow tag feature allows an application to request to add an action
to tag all the packets that matches this rule.

The tag is a number that will came as a metadata with every packet in
the CQE.

The tag rule == 0 is chosen as the default tag and application can use
it in order to avoid the need to classify the packets that came with a
tag while continuing to benefit from this tag mechanism.

struct definition:

struct ib_uverbs_flow_spec_action_tag {
     union {
          struct ib_uverbs_flow_spec_hdr hdr;
          struct {
              __u32 type;
              __u16 size;
              __u16 reserved;
          };
     };
     __be32                   tag_id;
     __u32                    reserved1;
};

struct ib_uverbs_flow_spec {
     union {
          union {
              struct ib_uverbs_flow_spec_hdr hdr;
              struct {
                   __u32 type;
                   __u16 size;
                   __u16 reserved;
              };
          };
          struct ib_uverbs_flow_spec_eth     eth;
          struct ib_uverbs_flow_spec_ipv4    ipv4;
          struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
          struct ib_uverbs_flow_spec_ipv6    ipv6;
          struct ib_uverbs_flow_spec_action_tag flow_tag;
     };
};

Where:

* type, size, reserved fields are identical to the rest of the
* protocols,
   and are used to identify the spec.
* flow_tag is a spec of type 'action'
* the ib_uverbs_flow_spec_hdr is identical to the rest of the specs.
* tag_id - is the value of the stream defined by the specs.

Thanks,
	Moses

CC: Rony Efraim <ronye-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
----

Doug,
I used this opportunity and fixed parse_flow_attr(..) return values.
Adjusting this fix to this series minimizes chances of possible merge
conflicts between different series.

This patchset was generated against commit
f502d834950a ("net/mlx5: Activate support for 4K UARs") and it applies
cleanly on k.o/for-4.11 branch.

Available in the "topic/flow-tag" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git

Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/flow-tag

Leon Romanovsky (1):
  IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP

Maor Gottlieb (1):
  net/mlx5: Consolidate flow rules regardless their flow tag

Moses Reuben (3):
  IB/core: Introduce flow tag specification
  IB/uverbs: Add support for flow tag
  IB/mlx5: Add flow tag support

 drivers/infiniband/core/uverbs.h                  |  1 +
 drivers/infiniband/core/uverbs_cmd.c              | 35 +++++++++++++++++++--
 drivers/infiniband/hw/mlx5/main.c                 | 38 +++++++++++++++++------
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 12 +++++--
 include/rdma/ib_verbs.h                           |  9 ++++++
 include/uapi/rdma/ib_user_verbs.h                 | 13 ++++++++
 6 files changed, 95 insertions(+), 13 deletions(-)

--
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 1/5] net/mlx5: Consolidate flow rules regardless their flow tag
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-01-18 12:59   ` Leon Romanovsky
  2017-01-18 12:59   ` [PATCH rdma-next 2/5] IB/core: Introduce flow tag specification Leon Romanovsky
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim, Maor Gottlieb

From: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Flow rules with same match criteria and value should be mapped to
the same flow table entry regardless the flow tag identifier.

Flow tag is part of flow table entry context and not of the
destination, therefore we should return error when we try to add
destination to flow table entry with different flow tag.

Signed-off-by: Maor Gottlieb <maorg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
index a263d89..1c750af 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
@@ -1232,10 +1232,18 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
 	fs_for_each_fte(fte, fg) {
 		nested_lock_ref_node(&fte->node, FS_MUTEX_CHILD);
 		if (compare_match_value(&fg->mask, match_value, &fte->val) &&
-		    (flow_act->action & fte->action) &&
-		    flow_act->flow_tag == fte->flow_tag) {
+		    (flow_act->action & fte->action)) {
 			int old_action = fte->action;
 
+			if (fte->flow_tag != flow_act->flow_tag) {
+				mlx5_core_warn(get_dev(&fte->node),
+					       "FTE flow tag %u already exists with different flow tag %u\n",
+					       fte->flow_tag,
+					       flow_act->flow_tag);
+				handle = ERR_PTR(-EEXIST);
+				goto unlock_fte;
+			}
+
 			fte->action |= flow_act->action;
 			handle = add_rule_fte(fte, fg, dest, dest_num,
 					      old_action != flow_act->action);
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 2/5] IB/core: Introduce flow tag specification
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-01-18 12:59   ` [PATCH rdma-next 1/5] net/mlx5: Consolidate flow rules regardless their flow tag Leon Romanovsky
@ 2017-01-18 12:59   ` Leon Romanovsky
  2017-01-18 12:59   ` [PATCH rdma-next 3/5] IB/uverbs: Add support for flow tag Leon Romanovsky
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim, Moses Reuben

From: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

This specification identifies flow with a specific tag-id.
This tag-id will be reported in the CQE.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 include/rdma/ib_verbs.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 958a24d..da08a04 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1604,6 +1604,8 @@ enum ib_flow_spec_type {
 	IB_FLOW_SPEC_UDP		= 0x41,
 	IB_FLOW_SPEC_VXLAN_TUNNEL	= 0x50,
 	IB_FLOW_SPEC_INNER		= 0x100,
+	/* Actions */
+	IB_FLOW_SPEC_ACTION_TAG         = 0x1000,
 };
 #define IB_FLOW_SPEC_LAYER_MASK	0xF0
 #define IB_FLOW_SPEC_SUPPORT_LAYERS 8
@@ -1726,6 +1728,12 @@ struct ib_flow_spec_tunnel {
 	struct ib_flow_tunnel_filter  mask;
 };
 
+struct ib_flow_spec_action_tag {
+	enum ib_flow_spec_type	      type;
+	u16			      size;
+	u32                           tag_id;
+};
+
 union ib_flow_spec {
 	struct {
 		u32			type;
@@ -1737,6 +1745,7 @@ union ib_flow_spec {
 	struct ib_flow_spec_tcp_udp	tcp_udp;
 	struct ib_flow_spec_ipv6        ipv6;
 	struct ib_flow_spec_tunnel      tunnel;
+	struct ib_flow_spec_action_tag  flow_tag;
 };
 
 struct ib_flow_attr {
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 3/5] IB/uverbs: Add support for flow tag
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-01-18 12:59   ` [PATCH rdma-next 1/5] net/mlx5: Consolidate flow rules regardless their flow tag Leon Romanovsky
  2017-01-18 12:59   ` [PATCH rdma-next 2/5] IB/core: Introduce flow tag specification Leon Romanovsky
@ 2017-01-18 12:59   ` Leon Romanovsky
  2017-01-18 12:59   ` [PATCH rdma-next 4/5] IB/mlx5: Add flow tag support Leon Romanovsky
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim, Moses Reuben

From: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The struct ib_uverbs_flow_spec_action_tag associates a tag_id with the
flow defined by any number of other flow_spec entries which can reference
L2, L3, and L4 packet contents.

Use of ib_uverbs_flow_spec_action_tag allows the consumer to identify
the set of rules which where matched by
the packet by examining the tag_id in the CQE.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/uverbs.h     |  1 +
 drivers/infiniband/core/uverbs_cmd.c | 35 +++++++++++++++++++++++++++++++++--
 include/uapi/rdma/ib_user_verbs.h    | 13 +++++++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 455034a..e1bedf0 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -228,6 +228,7 @@ struct ib_uverbs_flow_spec {
 		struct ib_uverbs_flow_spec_ipv4    ipv4;
 		struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
 		struct ib_uverbs_flow_spec_ipv6    ipv6;
+		struct ib_uverbs_flow_spec_action_tag	flow_tag;
 	};
 };
 
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 7007822..0834dce 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3143,6 +3143,25 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
 	return ret ? ret : in_len;
 }
 
+static int kern_spec_to_ib_spec_action(struct ib_uverbs_flow_spec *kern_spec,
+				       union ib_flow_spec *ib_spec)
+{
+	ib_spec->type = kern_spec->type;
+	switch (ib_spec->type) {
+	case IB_FLOW_SPEC_ACTION_TAG:
+		if (kern_spec->flow_tag.size !=
+		    sizeof(struct ib_uverbs_flow_spec_action_tag))
+			return -EINVAL;
+
+		ib_spec->flow_tag.size = sizeof(struct ib_flow_spec_action_tag);
+		ib_spec->flow_tag.tag_id = kern_spec->flow_tag.tag_id;
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
 static size_t kern_spec_filter_sz(struct ib_uverbs_flow_spec_hdr *spec)
 {
 	/* Returns user space filter size, includes padding */
@@ -3167,8 +3186,8 @@ static ssize_t spec_filter_size(void *kern_spec_filter, u16 kern_filter_size,
 	return kern_filter_size;
 }
 
-static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
-				union ib_flow_spec *ib_spec)
+static int kern_spec_to_ib_spec_filter(struct ib_uverbs_flow_spec *kern_spec,
+				       union ib_flow_spec *ib_spec)
 {
 	ssize_t actual_filter_sz;
 	ssize_t kern_filter_sz;
@@ -3263,6 +3282,18 @@ static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
 	return 0;
 }
 
+static int kern_spec_to_ib_spec(struct ib_uverbs_flow_spec *kern_spec,
+				union ib_flow_spec *ib_spec)
+{
+	if (kern_spec->reserved)
+		return -EINVAL;
+
+	if (kern_spec->type >= IB_FLOW_SPEC_ACTION_TAG)
+		return kern_spec_to_ib_spec_action(kern_spec, ib_spec);
+	else
+		return kern_spec_to_ib_spec_filter(kern_spec, ib_spec);
+}
+
 int ib_uverbs_ex_create_wq(struct ib_uverbs_file *file,
 			   struct ib_device *ib_dev,
 			   struct ib_udata *ucore,
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index dfdfe4e..b458fea 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -929,6 +929,19 @@ struct ib_uverbs_flow_spec_ipv6 {
 	struct ib_uverbs_flow_ipv6_filter mask;
 };
 
+struct ib_uverbs_flow_spec_action_tag {
+	union {
+		struct ib_uverbs_flow_spec_hdr hdr;
+		struct {
+			__u32 type;
+			__u16 size;
+			__u16 reserved;
+		};
+	};
+	__u32			      tag_id;
+	__u32			      reserved1;
+};
+
 struct ib_uverbs_flow_tunnel_filter {
 	__be32 tunnel_id;
 };
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 4/5] IB/mlx5: Add flow tag support
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-01-18 12:59   ` [PATCH rdma-next 3/5] IB/uverbs: Add support for flow tag Leon Romanovsky
@ 2017-01-18 12:59   ` Leon Romanovsky
  2017-01-18 12:59   ` [PATCH rdma-next 5/5] IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP Leon Romanovsky
  2017-02-14 15:27   ` [PATCH rdma-next 0/5] Add flow tag support to flow specification Doug Ledford
  5 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim, Moses Reuben

From: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Set flow tag in flow table entry, when IB_FLOW_SPEC_ACTION_TAG
is part of the flow specifications.

Flow tag doesn't support multicast flows, so it's passing to
hardware only when used.

Signed-off-by: Moses Reuben <mosesr-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index a191b93..d557150 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1652,6 +1652,7 @@ static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
 #define LAST_IPV6_FIELD traffic_class
 #define LAST_TCP_UDP_FIELD src_port
 #define LAST_TUNNEL_FIELD tunnel_id
+#define LAST_FLOW_TAG_FIELD tag_id
 
 /* Field is the last supported field */
 #define FIELDS_NOT_SUPPORTED(filter, field)\
@@ -1662,7 +1663,7 @@ static void set_tos(void *outer_c, void *outer_v, u8 mask, u8 val)
 		   sizeof(filter.field))
 
 static int parse_flow_attr(u32 *match_c, u32 *match_v,
-			   const union ib_flow_spec *ib_spec)
+			   const union ib_flow_spec *ib_spec, u32 *tag_id)
 {
 	void *misc_params_c = MLX5_ADDR_OF(fte_match_param, match_c,
 					   misc_parameters);
@@ -1854,6 +1855,15 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 		MLX5_SET(fte_match_set_misc, misc_params_v, vxlan_vni,
 			 ntohl(ib_spec->tunnel.val.tunnel_id));
 		break;
+	case IB_FLOW_SPEC_ACTION_TAG:
+		if (FIELDS_NOT_SUPPORTED(ib_spec->flow_tag,
+					 LAST_FLOW_TAG_FIELD))
+			return -EOPNOTSUPP;
+		if (ib_spec->flow_tag.tag_id >= BIT(24))
+			return -EINVAL;
+
+		*tag_id = ib_spec->flow_tag.tag_id;
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -2037,6 +2047,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
 	struct mlx5_flow_spec *spec;
 	const void *ib_flow = (const void *)flow_attr + sizeof(*flow_attr);
 	unsigned int spec_index;
+	u32 flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
 	int err = 0;
 
 	if (!is_valid_attr(flow_attr))
@@ -2053,7 +2064,7 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
 
 	for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) {
 		err = parse_flow_attr(spec->match_criteria,
-				      spec->match_value, ib_flow);
+				      spec->match_value, ib_flow, &flow_tag);
 		if (err < 0)
 			goto free;
 
@@ -2063,7 +2074,16 @@ static struct mlx5_ib_flow_handler *create_flow_rule(struct mlx5_ib_dev *dev,
 	spec->match_criteria_enable = get_match_criteria_enable(spec->match_criteria);
 	flow_act.action = dst ? MLX5_FLOW_CONTEXT_ACTION_FWD_DEST :
 		MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO;
-	flow_act.flow_tag = MLX5_FS_DEFAULT_FLOW_TAG;
+
+	if (flow_tag != MLX5_FS_DEFAULT_FLOW_TAG &&
+	    (flow_attr->type == IB_FLOW_ATTR_ALL_DEFAULT ||
+	     flow_attr->type == IB_FLOW_ATTR_MC_DEFAULT)) {
+		mlx5_ib_warn(dev, "Flow tag %u and attribute type %x isn't allowed in leftovers\n",
+			     flow_tag, flow_attr->type);
+		err = -EINVAL;
+		goto free;
+	}
+	flow_act.flow_tag = flow_tag;
 	handler->rule = mlx5_add_flow_rules(ft, spec,
 					    &flow_act,
 					    dst, 1);
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH rdma-next 5/5] IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-01-18 12:59   ` [PATCH rdma-next 4/5] IB/mlx5: Add flow tag support Leon Romanovsky
@ 2017-01-18 12:59   ` Leon Romanovsky
  2017-02-14 15:27   ` [PATCH rdma-next 0/5] Add flow tag support to flow specification Doug Ledford
  5 siblings, 0 replies; 7+ messages in thread
From: Leon Romanovsky @ 2017-01-18 12:59 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim, Leon Romanovsky

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Flow steering is supposed to return EOPNOTSUPP error
for unsupported fields and not ENOTSUPP error.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index d557150..858fc3f 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -1687,7 +1687,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 	switch (ib_spec->type & ~IB_FLOW_SPEC_INNER) {
 	case IB_FLOW_SPEC_ETH:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->eth.mask, LAST_ETH_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		ether_addr_copy(MLX5_ADDR_OF(fte_match_set_lyr_2_4, headers_c,
 					     dmac_47_16),
@@ -1735,7 +1735,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 		break;
 	case IB_FLOW_SPEC_IPV4:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->ipv4.mask, LAST_IPV4_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		MLX5_SET(fte_match_set_lyr_2_4, headers_c,
 			 ethertype, 0xffff);
@@ -1767,7 +1767,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 		break;
 	case IB_FLOW_SPEC_IPV6:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->ipv6.mask, LAST_IPV6_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		MLX5_SET(fte_match_set_lyr_2_4, headers_c,
 			 ethertype, 0xffff);
@@ -1808,7 +1808,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 	case IB_FLOW_SPEC_TCP:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->tcp_udp.mask,
 					 LAST_TCP_UDP_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol,
 			 0xff);
@@ -1828,7 +1828,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 	case IB_FLOW_SPEC_UDP:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->tcp_udp.mask,
 					 LAST_TCP_UDP_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		MLX5_SET(fte_match_set_lyr_2_4, headers_c, ip_protocol,
 			 0xff);
@@ -1848,7 +1848,7 @@ static int parse_flow_attr(u32 *match_c, u32 *match_v,
 	case IB_FLOW_SPEC_VXLAN_TUNNEL:
 		if (FIELDS_NOT_SUPPORTED(ib_spec->tunnel.mask,
 					 LAST_TUNNEL_FIELD))
-			return -ENOTSUPP;
+			return -EOPNOTSUPP;
 
 		MLX5_SET(fte_match_set_misc, misc_params_c, vxlan_vni,
 			 ntohl(ib_spec->tunnel.mask.tunnel_id));
-- 
2.10.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH rdma-next 0/5] Add flow tag support to flow specification
       [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                     ` (4 preceding siblings ...)
  2017-01-18 12:59   ` [PATCH rdma-next 5/5] IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP Leon Romanovsky
@ 2017-02-14 15:27   ` Doug Ledford
  5 siblings, 0 replies; 7+ messages in thread
From: Doug Ledford @ 2017-02-14 15:27 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Rony Efraim

[-- Attachment #1: Type: text/plain, Size: 4140 bytes --]

On Wed, 2017-01-18 at 14:59 +0200, Leon Romanovsky wrote:
> Hi Doug,
> 
> The flow tag feature allows an application to request to add an
> action
> to tag all the packets that matches this rule.
> 
> The tag is a number that will came as a metadata with every packet in
> the CQE.
> 
> The tag rule == 0 is chosen as the default tag and application can
> use
> it in order to avoid the need to classify the packets that came with
> a
> tag while continuing to benefit from this tag mechanism.
> 
> struct definition:
> 
> struct ib_uverbs_flow_spec_action_tag {
>      union {
>           struct ib_uverbs_flow_spec_hdr hdr;
>           struct {
>               __u32 type;
>               __u16 size;
>               __u16 reserved;
>           };
>      };
>      __be32                   tag_id;
>      __u32                    reserved1;
> };
> 
> struct ib_uverbs_flow_spec {
>      union {
>           union {
>               struct ib_uverbs_flow_spec_hdr hdr;
>               struct {
>                    __u32 type;
>                    __u16 size;
>                    __u16 reserved;
>               };
>           };
>           struct ib_uverbs_flow_spec_eth     eth;
>           struct ib_uverbs_flow_spec_ipv4    ipv4;
>           struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
>           struct ib_uverbs_flow_spec_ipv6    ipv6;
>           struct ib_uverbs_flow_spec_action_tag flow_tag;
>      };
> };
> 
> Where:
> 
> * type, size, reserved fields are identical to the rest of the
> * protocols,
>    and are used to identify the spec.
> * flow_tag is a spec of type 'action'
> * the ib_uverbs_flow_spec_hdr is identical to the rest of the specs.
> * tag_id - is the value of the stream defined by the specs.
> 
> Thanks,
> 	Moses
> 
> CC: Rony Efraim <ronye@mellanox.com>
> ----
> 
> Doug,
> I used this opportunity and fixed parse_flow_attr(..) return values.
> Adjusting this fix to this series minimizes chances of possible merge
> conflicts between different series.
> 
> This patchset was generated against commit
> f502d834950a ("net/mlx5: Activate support for 4K UARs") and it
> applies
> cleanly on k.o/for-4.11 branch.
> 
> Available in the "topic/flow-tag" topic branch of this git repo:
> git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
> 
> Or for browsing:
> https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/
> ?h=topic/flow-tag
> 
> Leon Romanovsky (1):
>   IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP
> 
> Maor Gottlieb (1):
>   net/mlx5: Consolidate flow rules regardless their flow tag
> 
> Moses Reuben (3):
>   IB/core: Introduce flow tag specification
>   IB/uverbs: Add support for flow tag
>   IB/mlx5: Add flow tag support
> 
>  drivers/infiniband/core/uverbs.h                  |  1 +
>  drivers/infiniband/core/uverbs_cmd.c              | 35
> +++++++++++++++++++--
>  drivers/infiniband/hw/mlx5/main.c                 | 38
> +++++++++++++++++------
>  drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 12 +++++--
>  include/rdma/ib_verbs.h                           |  9 ++++++
>  include/uapi/rdma/ib_user_verbs.h                 | 13 ++++++++
>  6 files changed, 95 insertions(+), 13 deletions(-)

I looked through the API additions and they look reasonable to me
(meaning that if anyone else wants to implement tags on specific flows,
this API is appropriate for that, and if they want to do other things,
then this is not appropriate, but there is no restriction against other
action types in the enum, so extensibility is preserved).  Series
applied, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-02-14 15:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 12:59 [PATCH rdma-next 0/5] Add flow tag support to flow specification Leon Romanovsky
     [not found] ` <20170118125951.3469-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-01-18 12:59   ` [PATCH rdma-next 1/5] net/mlx5: Consolidate flow rules regardless their flow tag Leon Romanovsky
2017-01-18 12:59   ` [PATCH rdma-next 2/5] IB/core: Introduce flow tag specification Leon Romanovsky
2017-01-18 12:59   ` [PATCH rdma-next 3/5] IB/uverbs: Add support for flow tag Leon Romanovsky
2017-01-18 12:59   ` [PATCH rdma-next 4/5] IB/mlx5: Add flow tag support Leon Romanovsky
2017-01-18 12:59   ` [PATCH rdma-next 5/5] IB/mlx5: Replace ENOTSUPP usage with EOPNOTSUPP Leon Romanovsky
2017-02-14 15:27   ` [PATCH rdma-next 0/5] Add flow tag support to flow specification Doug Ledford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).