All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg-uk2M96/98Pc@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-core 14/17] verbs: Use kernel uapi header for flow steering types
Date: Thu, 11 Jan 2018 15:13:37 -0700	[thread overview]
Message-ID: <20180111221340.965-15-jgg@ziepe.ca> (raw)
In-Reply-To: <20180111221340.965-1-jgg-uk2M96/98Pc@public.gmane.org>

From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The kernel versions are a bit different, they have a union
around the header fields mapping to ib_uverbs_flow_spec_hdr
but are otherwise the same.

Performed by this script:

$ sed -i \
 -e 's/struct[ \t]ibv_kern_spec_action_drop\([ \t,)]\)/struct ib_uverbs_flow_spec_action_drop\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_action_tag\([ \t,)]\)/struct ib_uverbs_flow_spec_action_tag\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_eth\([ \t,)]\)/struct ib_uverbs_flow_spec_eth\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_ipv4_ext\([ \t,)]\)/struct ib_uverbs_flow_spec_ipv4\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_ipv6\([ \t,)]\)/struct ib_uverbs_flow_spec_ipv6\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_tcp_udp\([ \t,)]\)/struct ib_uverbs_flow_spec_tcp_udp\1/g' \
 -e 's/struct[ \t]ibv_kern_spec_tunnel\([ \t,)]\)/struct ib_uverbs_flow_spec_tunnel\1/g' \
    `git ls-files`

And some minor touch ups.

Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 libibverbs/cmd.c      | 14 +++++-----
 libibverbs/kern-abi.h | 74 ++++++---------------------------------------------
 2 files changed, 15 insertions(+), 73 deletions(-)

diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
index dfa3fe6e113e98..f73af7b7a92d80 100644
--- a/libibverbs/cmd.c
+++ b/libibverbs/cmd.c
@@ -1790,7 +1790,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 	switch (kern_spec->hdr.type) {
 	case IBV_FLOW_SPEC_ETH:
 	case IBV_FLOW_SPEC_ETH | IBV_FLOW_SPEC_INNER:
-		kern_spec->eth.size = sizeof(struct ibv_kern_spec_eth);
+		kern_spec->eth.size = sizeof(struct ib_uverbs_flow_spec_eth);
 		memcpy(&kern_spec->eth.val, &ib_spec->eth.val,
 		       sizeof(struct ibv_flow_eth_filter));
 		memcpy(&kern_spec->eth.mask, &ib_spec->eth.mask,
@@ -1815,7 +1815,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		kern_spec->hdr.type = IBV_FLOW_SPEC_IPV4 |
 				     (IBV_FLOW_SPEC_INNER & ib_spec->hdr.type);
 		kern_spec->ipv4_ext.size = sizeof(struct
-						  ibv_kern_spec_ipv4_ext);
+						  ib_uverbs_flow_spec_ipv4);
 		memcpy(&kern_spec->ipv4_ext.val, &ib_spec->ipv4_ext.val,
 		       kern_filter_size);
 		memcpy(&kern_spec->ipv4_ext.mask, (void *)&ib_spec->ipv4_ext.val
@@ -1829,7 +1829,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		if (ret)
 			return ret;
 
-		kern_spec->ipv6.size = sizeof(struct ibv_kern_spec_ipv6);
+		kern_spec->ipv6.size = sizeof(struct ib_uverbs_flow_spec_ipv6);
 		memcpy(&kern_spec->ipv6.val, &ib_spec->ipv6.val,
 		       kern_filter_size);
 		memcpy(&kern_spec->ipv6.mask, (void *)&ib_spec->ipv6.val
@@ -1839,7 +1839,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 	case IBV_FLOW_SPEC_UDP:
 	case IBV_FLOW_SPEC_TCP | IBV_FLOW_SPEC_INNER:
 	case IBV_FLOW_SPEC_UDP | IBV_FLOW_SPEC_INNER:
-		kern_spec->tcp_udp.size = sizeof(struct ibv_kern_spec_tcp_udp);
+		kern_spec->tcp_udp.size = sizeof(struct ib_uverbs_flow_spec_tcp_udp);
 		memcpy(&kern_spec->tcp_udp.val, &ib_spec->tcp_udp.val,
 		       sizeof(struct ibv_flow_tcp_udp_filter));
 		memcpy(&kern_spec->tcp_udp.mask, &ib_spec->tcp_udp.mask,
@@ -1852,7 +1852,7 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		if (ret)
 			return ret;
 
-		kern_spec->tunnel.size = sizeof(struct ibv_kern_spec_tunnel);
+		kern_spec->tunnel.size = sizeof(struct ib_uverbs_flow_spec_tunnel);
 		memcpy(&kern_spec->tunnel.val, &ib_spec->tunnel.val,
 		       kern_filter_size);
 		memcpy(&kern_spec->tunnel.mask, (void *)&ib_spec->tunnel.val
@@ -1860,11 +1860,11 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec,
 		break;
 	case IBV_FLOW_SPEC_ACTION_TAG:
 		kern_spec->flow_tag.size =
-			sizeof(struct ibv_kern_spec_action_tag);
+			sizeof(struct ib_uverbs_flow_spec_action_tag);
 		kern_spec->flow_tag.tag_id = ib_spec->flow_tag.tag_id;
 		break;
 	case IBV_FLOW_SPEC_ACTION_DROP:
-		kern_spec->drop.size = sizeof(struct ibv_kern_spec_action_drop);
+		kern_spec->drop.size = sizeof(struct ib_uverbs_flow_spec_action_drop);
 		break;
 	default:
 		return EINVAL;
diff --git a/libibverbs/kern-abi.h b/libibverbs/kern-abi.h
index 277d968f0bcc2c..57ef1dd6ff6beb 100644
--- a/libibverbs/kern-abi.h
+++ b/libibverbs/kern-abi.h
@@ -390,14 +390,6 @@ struct ibv_destroy_qp {
 	__u32 reserved;
 };
 
-struct ibv_kern_spec_eth {
-	__u32 type;
-	__u16  size;
-	__u16 reserved;
-	struct ib_uverbs_flow_eth_filter val;
-	struct ib_uverbs_flow_eth_filter mask;
-};
-
 struct ibv_kern_ipv4_filter {
 	__u32 src_ip;
 	__u32 dst_ip;
@@ -411,67 +403,17 @@ struct ibv_kern_spec_ipv4 {
 	struct ibv_kern_ipv4_filter mask;
 };
 
-struct ibv_kern_spec_ipv4_ext {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-	struct ib_uverbs_flow_ipv4_filter val;
-	struct ib_uverbs_flow_ipv4_filter mask;
-};
-
-struct ibv_kern_spec_ipv6 {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-	struct ib_uverbs_flow_ipv6_filter val;
-	struct ib_uverbs_flow_ipv6_filter mask;
-};
-
-struct ibv_kern_spec_tcp_udp {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-	struct ib_uverbs_flow_tcp_udp_filter val;
-	struct ib_uverbs_flow_tcp_udp_filter mask;
-};
-
-struct ibv_kern_spec_action_tag {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-	__u32 tag_id;
-	__u32 reserved1;
-};
-
-struct ibv_kern_spec_tunnel {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-	struct ib_uverbs_flow_tunnel_filter val;
-	struct ib_uverbs_flow_tunnel_filter mask;
-};
-
-struct ibv_kern_spec_action_drop {
-	__u32  type;
-	__u16  size;
-	__u16 reserved;
-};
-
 struct ibv_kern_spec {
 	union {
-		struct {
-			__u32 type;
-			__u16 size;
-			__u16 reserved;
-		} hdr;
-		struct ibv_kern_spec_eth eth;
+		struct ib_uverbs_flow_spec_hdr hdr;
+		struct ib_uverbs_flow_spec_eth eth;
 		struct ibv_kern_spec_ipv4 ipv4;
-		struct ibv_kern_spec_ipv4_ext ipv4_ext;
-		struct ibv_kern_spec_tcp_udp tcp_udp;
-		struct ibv_kern_spec_ipv6 ipv6;
-		struct ibv_kern_spec_tunnel tunnel;
-		struct ibv_kern_spec_action_tag flow_tag;
-		struct ibv_kern_spec_action_drop drop;
+		struct ib_uverbs_flow_spec_ipv4 ipv4_ext;
+		struct ib_uverbs_flow_spec_tcp_udp tcp_udp;
+		struct ib_uverbs_flow_spec_ipv6 ipv6;
+		struct ib_uverbs_flow_spec_tunnel tunnel;
+		struct ib_uverbs_flow_spec_action_tag flow_tag;
+		struct ib_uverbs_flow_spec_action_drop drop;
 	};
 };
 
-- 
2.15.1

--
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

  parent reply	other threads:[~2018-01-11 22:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-11 22:13 [PATCH rdma-core 00/17] Use the kernel ABI header instead of kern-abi.h Jason Gunthorpe
     [not found] ` <20180111221340.965-1-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-11 22:13   ` [PATCH rdma-core 01/17] Update rdma/ib_user_verbs.h Jason Gunthorpe
     [not found]     ` <20180111221340.965-2-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-15 17:01       ` Yishai Hadas
     [not found]         ` <fe2337a1-b02d-cc01-c55d-e6e493ec30ef-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2018-01-15 17:10           ` Jason Gunthorpe
     [not found]             ` <20180115171033.GA2206-uk2M96/98Pc@public.gmane.org>
2018-01-22 10:48               ` Yishai Hadas
     [not found]                 ` <c4ee82a7-f235-4370-cf64-d5c73a79bd1b-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2018-01-22 15:42                   ` Jason Gunthorpe
     [not found]                     ` <20180122154206.GC14372-uk2M96/98Pc@public.gmane.org>
2018-01-22 15:56                       ` Yishai Hadas
2018-01-11 22:13   ` [PATCH rdma-core 02/17] verbs: Include rdma/ib_user_verbs.h in kern-abi.h Jason Gunthorpe
     [not found]     ` <20180111221340.965-3-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-12  6:34       ` Leon Romanovsky
     [not found]         ` <20180112063433.GH15760-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2018-01-12 16:28           ` Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 03/17] verbs: Delete extended command definitions from kern-abi.h Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 04/17] verbs: Remove unused structs Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 05/17] verbs: Remove kernel ABI v2 compat cruft Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 06/17] verbs: Add missing endian annotations to kern-abi.h Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 07/17] verbs: Use kernel uapi names for identical structs Jason Gunthorpe
     [not found]     ` <20180111221340.965-8-jgg-uk2M96/98Pc@public.gmane.org>
2018-01-15 16:48       ` Yishai Hadas
     [not found]         ` <2f04c4d8-bc14-9293-2e03-b29074e08637-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2018-01-15 17:01           ` Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 08/17] verbs: Use kernel uapi header for ibv_cq_moderation_caps_resp Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 09/17] verbs: Use kernel uapi header for ibv_query_device_resp_ex Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 10/17] verbs: Use kernel uapi header for ibv_kern_wc and ibv_poll_cq_resp Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 11/17] verbs: Use kernel uapi header for ibv_create_ah_resp Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 12/17] verbs: Use kernel uapi header for ibv_kern_send_wr Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 13/17] verbs: Use kernel uapi header for IBV_CREATE_QP_EX_KERNEL_MASK_IND_TABLE Jason Gunthorpe
2018-01-11 22:13   ` Jason Gunthorpe [this message]
2018-01-11 22:13   ` [PATCH rdma-core 15/17] verbs: Use kernel uapi header for ibv_modify_qp_common Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 16/17] verb: Use kernel uapi header in struct ex_hdr Jason Gunthorpe
2018-01-11 22:13   ` [PATCH rdma-core 17/17] verbs: Tidy up the remaining structs in kern-abi.h Jason Gunthorpe
2018-01-22 17:37   ` [PATCH rdma-core 00/17] Use the kernel ABI header instead of kern-abi.h Jason Gunthorpe

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=20180111221340.965-15-jgg@ziepe.ca \
    --to=jgg-uk2m96/98pc@public.gmane.org \
    --cc=jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /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 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.