From patchwork Thu Jan 11 22:13:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10158819 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 56F2560170 for ; Thu, 11 Jan 2018 22:30:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02BB8289E9 for ; Thu, 11 Jan 2018 22:30:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 009A1288E5; Thu, 11 Jan 2018 22:30:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7D8F288F4 for ; Thu, 11 Jan 2018 22:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933390AbeAKWa1 (ORCPT ); Thu, 11 Jan 2018 17:30:27 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44834 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933287AbeAKWa0 (ORCPT ); Thu, 11 Jan 2018 17:30:26 -0500 Received: by mail-wr0-f194.google.com with SMTP id w50so3655369wrc.11 for ; Thu, 11 Jan 2018 14:30:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4UuBwDFwXkc1VyD3MzUquxx4j33Kvp+vKAESVdvgYNA=; b=fBe1vCAmoanHl1Wvhd6ZtXdDqtU7yFzRloSgp54aAlKQe6KwCSJIzMRXEQ7i+3zEjw yG+y8QWT0idERdxs/S/uJ/dgJuR85QEELeQ4WhqPVt4K6NBmR5NphZoHKhX2kJqa1TYr WBasuKQ0o048AzVS61htorQDiaUhaf4aJoJU71sdWs/4gvdvsozqv2gwUEImmy9kubrY atxVuw03X/ByxiJXXZ4ZoZHBy4rvh5OtDwjOjHNXDQoCKeWjDo/zpxk4h2a/eTPvmpjW oatxvMdQZBEqdbxqMnKGHJSyxviR3tUcXkM97KXMBVK/QlsodtGmbtXtoqNnZWtxNEb+ ITxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4UuBwDFwXkc1VyD3MzUquxx4j33Kvp+vKAESVdvgYNA=; b=qqp2zkVjU7JX21CCdbrUhPbVEw6aVUsInJvXgkz4rsxQYF9bjmK6t8NlEq+sd0C4/G j7s06pVJNuw2xiLhF06u5yNOb3HBthI76VA7vpLwSEsarnjlJ2ne3kURUhAgWyXO1gU0 EWpwln7PU8T3zzfa35qmYuneSOURPnQ7qH4u6t/2JaG0KyWpBD9aBemP5qXTiiA+yogf 0q/KW51Kovtei+Xt1Hgf85SJ6Ke0MnT+wVKb9HLMzaJw0IJS+Ubz9CCo+Amxy2G4e+0X Fkw3lopjlBJpkAH2BMYqaHz9SWoktT5VL+QLEIpRzUvf2zma0FZLUf2DJ3E9MqIui3oX fVeQ== X-Gm-Message-State: AKGB3mIUzb71d2IcZwchdXZtnK3KoaD8a7QGyo8qw/3drzZxD6VVXBnF nCwYhJ4fgoY0MZu35gG7P03G77wruwY= X-Google-Smtp-Source: ACJfBovq79LpmFQYtI3ujJ04yyDcZkhp5NeAvtcq9qQmYBVtG0dFxj0r9ubKYQIAUGM26Yaonf4RHQ== X-Received: by 10.223.199.78 with SMTP id b14mr21186065wrh.279.1515709824886; Thu, 11 Jan 2018 14:30:24 -0800 (PST) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id x81sm1552023wmd.14.2018.01.11.14.30.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jan 2018 14:30:24 -0800 (PST) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eZl6Z-0000KG-6E; Thu, 11 Jan 2018 15:13:47 -0700 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH rdma-core 14/17] verbs: Use kernel uapi header for flow steering types Date: Thu, 11 Jan 2018 15:13:37 -0700 Message-Id: <20180111221340.965-15-jgg@ziepe.ca> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180111221340.965-1-jgg@ziepe.ca> References: <20180111221340.965-1-jgg@ziepe.ca> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe 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 --- 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; }; };