From patchwork Wed Apr 19 21:35:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 752544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w7b1l5FQVz9s2x for ; Thu, 20 Apr 2017 07:37:15 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 55152C64; Wed, 19 Apr 2017 21:36:02 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 400E6C54 for ; Wed, 19 Apr 2017 21:36:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 4AA49199 for ; Wed, 19 Apr 2017 21:36:00 +0000 (UTC) Received: from mfilter19-d.gandi.net (mfilter19-d.gandi.net [217.70.178.147]) by relay2-d.mail.gandi.net (Postfix) with ESMTP id 157D1C5A50; Wed, 19 Apr 2017 23:35:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter19-d.gandi.net Received: from relay2-d.mail.gandi.net ([IPv6:::ffff:217.70.183.194]) by mfilter19-d.gandi.net (mfilter19-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id ZoZox3YrFjXE; Wed, 19 Apr 2017 23:35:57 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from sc9-mailhost3.vmware.com (unknown [208.91.1.34]) (Authenticated sender: jarno@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id D60D0C5A44; Wed, 19 Apr 2017 23:35:55 +0200 (CEST) From: Jarno Rajahalme To: dev@openvswitch.org Date: Wed, 19 Apr 2017 14:35:45 -0700 Message-Id: <1492637745-73976-3-git-send-email-jarno@ovn.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1492637745-73976-1-git-send-email-jarno@ovn.org> References: <1492637745-73976-1-git-send-email-jarno@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Johannes Berg Subject: [ovs-dev] [PATCH 3/3] datapath: pass extended ACK struct to parsing functions X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Johannes Berg Upstream commit: commit fceb6435e85298f747fee938415057af837f5a8a Author: Johannes Berg Date: Wed Apr 12 14:34:07 2017 +0200 netlink: pass extended ACK struct to parsing functions Pass the new extended ACK reporting struct to all of the generic netlink parsing functions. For now, pass NULL in almost all callers (except for some in the core.) Signed-off-by: Johannes Berg Signed-off-by: David S. Miller Signed-off-by: Jarno Rajahalme --- acinclude.m4 | 3 +++ datapath/datapath.c | 2 +- datapath/flow_netlink.c | 4 ++-- datapath/linux/compat/include/net/genetlink.h | 14 +++++++++----- datapath/linux/compat/include/net/netlink.h | 14 ++++++++++++++ datapath/vport-vxlan.c | 3 ++- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 6a2b9f1..9f8e30d 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -663,6 +663,9 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_is_last]) OVS_GREP_IFELSE([$KSRC/include/linux/netlink.h], [void.*netlink_set_err], [OVS_DEFINE([HAVE_VOID_NETLINK_SET_ERR])]) + OVS_FIND_PARAM_IFELSE([$KSRC/include/net/netlink.h], + [nla_parse], [netlink_ext_ack], + [OVS_DEFINE([HAVE_NETLINK_EXT_ACK])]) OVS_GREP_IFELSE([$KSRC/include/net/sctp/checksum.h], [sctp_compute_cksum]) diff --git a/datapath/datapath.c b/datapath/datapath.c index 8cf0381..c85029c 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1365,7 +1365,7 @@ static int ovs_flow_cmd_dump(struct sk_buff *skb, struct netlink_callback *cb) int err; err = genlmsg_parse(cb->nlh, &dp_flow_genl_family, a, - OVS_FLOW_ATTR_MAX, flow_policy); + OVS_FLOW_ATTR_MAX, flow_policy, NULL); if (err) return err; ufid_flags = ovs_nla_get_ufid_flags(a[OVS_FLOW_ATTR_UFID_FLAGS]); diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c index 0762f6c..07ab8e9 100644 --- a/datapath/flow_netlink.c +++ b/datapath/flow_netlink.c @@ -2431,8 +2431,8 @@ static int validate_userspace(const struct nlattr *attr) struct nlattr *a[OVS_USERSPACE_ATTR_MAX + 1]; int error; - error = nla_parse_nested(a, OVS_USERSPACE_ATTR_MAX, - attr, userspace_policy); + error = nla_parse_nested(a, OVS_USERSPACE_ATTR_MAX, attr, + userspace_policy, NULL); if (error) return error; diff --git a/datapath/linux/compat/include/net/genetlink.h b/datapath/linux/compat/include/net/genetlink.h index 4b42cf7..f35bc02 100644 --- a/datapath/linux/compat/include/net/genetlink.h +++ b/datapath/linux/compat/include/net/genetlink.h @@ -125,15 +125,19 @@ static inline int rpl_genl_has_listeners(struct genl_family *family, #endif /* HAVE_GENL_HAS_LISTENERS */ -#ifndef HAVE_GENLMSG_PARSE -static inline int genlmsg_parse(const struct nlmsghdr *nlh, - const struct genl_family *family, - struct nlattr *tb[], int maxtype, - const struct nla_policy *policy) +#ifndef HAVE_NETLINK_EXT_ACK +struct netlink_ext_ack; + +static inline int rpl_genlmsg_parse(const struct nlmsghdr *nlh, + const struct genl_family *family, + struct nlattr *tb[], int maxtype, + const struct nla_policy *policy, + struct netlink_ext_ack *extack) { return nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype, policy); } +#define genlmsg_parse rpl_genlmsg_parse #endif #endif /* genetlink.h */ diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h index 082afac..b791a3f 100644 --- a/datapath/linux/compat/include/net/netlink.h +++ b/datapath/linux/compat/include/net/netlink.h @@ -157,4 +157,18 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value, } #endif + +#ifndef HAVE_NETLINK_EXT_ACK +struct netlink_ext_ack; + +static inline int rpl_nla_parse_nested(struct nlattr *tb[], int maxtype, + const struct nlattr *nla, + const struct nla_policy *policy, + struct netlink_ext_ack *extack) +{ + return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy); +} +#define nla_parse_nested rpl_nla_parse_nested +#endif + #endif /* net/netlink.h */ diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index 11965c0..7beaf6e 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -70,7 +70,8 @@ static int vxlan_configure_exts(struct vport *vport, struct nlattr *attr, if (nla_len(attr) < sizeof(struct nlattr)) return -EINVAL; - err = nla_parse_nested(exts, OVS_VXLAN_EXT_MAX, attr, exts_policy); + err = nla_parse_nested(exts, OVS_VXLAN_EXT_MAX, attr, exts_policy, + NULL); if (err < 0) return err;