linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linux-wireless@vger.kernel.org, netdev@vger.kernel.org
Cc: pablo@netfilter.org, Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Benc <jbenc@redhat.com>,
	David Ahern <dsa@cumulusnetworks.com>,
	jiri@resnulli.us, Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 2/5] genetlink: pass extended ACK report down
Date: Sat,  8 Apr 2017 19:48:57 +0200	[thread overview]
Message-ID: <20170408174900.12820-3-johannes@sipsolutions.net> (raw)
In-Reply-To: <20170408174900.12820-1-johannes@sipsolutions.net>

From: Johannes Berg <johannes.berg@intel.com>

Pass the extended ACK reporting struct down from
generic netlink to the families, using the existing
struct genl_info for simplicity.

Also add support to set the extended ACK information
from generic netlink users.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 include/net/genetlink.h | 20 ++++++++++++++++++++
 net/netlink/genetlink.c |  6 ++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index a34275be3600..b81a4979e1db 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -84,6 +84,7 @@ struct nlattr **genl_family_attrbuf(const struct genl_family *family);
  * @attrs: netlink attributes
  * @_net: network namespace
  * @user_ptr: user pointers
+ * @extack: extended ACK report struct
  */
 struct genl_info {
 	u32			snd_seq;
@@ -94,6 +95,7 @@ struct genl_info {
 	struct nlattr **	attrs;
 	possible_net_t		_net;
 	void *			user_ptr[2];
+	struct netlink_ext_ack *extack;
 };
 
 static inline struct net *genl_info_net(struct genl_info *info)
@@ -106,6 +108,24 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net)
 	write_pnet(&info->_net, net);
 }
 
+#define GENL_SET_ERR_MSG(info, msg) NL_SET_ERR_MSG((info)->extack, msg)
+
+static inline int genl_err_attr(struct genl_info *info, int err,
+				struct nlattr *attr)
+{
+	info->extack->bad_attr = attr;
+
+	return err;
+}
+
+static inline int genl_err_attr_missing(struct genl_info *info, int err,
+					u16 attr)
+{
+	info->extack->missing_attr = attr;
+
+	return err;
+}
+
 /**
  * struct genl_ops - generic netlink operations
  * @cmd: command identifier
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 57b2e3648bc0..4b598a5999a2 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -497,7 +497,8 @@ static int genl_lock_done(struct netlink_callback *cb)
 
 static int genl_family_rcv_msg(const struct genl_family *family,
 			       struct sk_buff *skb,
-			       struct nlmsghdr *nlh)
+			       struct nlmsghdr *nlh,
+			       struct netlink_ext_ack *extack)
 {
 	const struct genl_ops *ops;
 	struct net *net = sock_net(skb->sk);
@@ -584,6 +585,7 @@ static int genl_family_rcv_msg(const struct genl_family *family,
 	info.genlhdr = nlmsg_data(nlh);
 	info.userhdr = nlmsg_data(nlh) + GENL_HDRLEN;
 	info.attrs = attrbuf;
+	info.extack = extack;
 	genl_info_net_set(&info, net);
 	memset(&info.user_ptr, 0, sizeof(info.user_ptr));
 
@@ -618,7 +620,7 @@ static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	if (!family->parallel_ops)
 		genl_lock();
 
-	err = genl_family_rcv_msg(family, skb, nlh);
+	err = genl_family_rcv_msg(family, skb, nlh, extack);
 
 	if (!family->parallel_ops)
 		genl_unlock();
-- 
2.11.0

  parent reply	other threads:[~2017-04-08 17:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-08 17:48 [PATCH 0/5] extended netlink ACK reporting Johannes Berg
2017-04-08 17:48 ` [PATCH 1/5] netlink: extended " Johannes Berg
2017-04-08 18:26   ` David Ahern
2017-04-08 18:34   ` Jiri Pirko
2017-04-08 18:37     ` Johannes Berg
2017-04-08 18:40       ` Jiri Pirko
2017-04-08 20:13         ` Johannes Berg
2017-04-09 17:43         ` David Ahern
2017-04-10  6:18           ` Johannes Berg
2017-04-13 13:27             ` Nicolas Dichtel
2017-04-13 13:29               ` Johannes Berg
2017-04-13 14:05                 ` Nicolas Dichtel
2017-04-13 19:24                   ` Johannes Berg
2017-04-16 14:40                     ` second wave of netlink " Jamal Hadi Salim
2017-04-16 14:45                       ` David Ahern
2017-04-16 14:48                         ` Jamal Hadi Salim
2017-04-16 14:50                           ` David Ahern
2017-04-16 16:55                       ` David Ahern
     [not found]                     ` <CAPWQB7FWOcEen3SGyQtW7t2WpDNLE08JEdHeZHmM738J=Rur0g@mail.gmail.com>
2017-04-18  9:41                       ` [PATCH 1/5] netlink: " Johannes Berg
2017-04-18 23:46                         ` Joe Stringer
2017-04-08 18:36   ` David Ahern
2017-04-08 18:37     ` Johannes Berg
2017-04-08 20:14   ` David Ahern
2017-04-08 17:48 ` Johannes Berg [this message]
2017-04-08 17:48 ` [PATCH 3/5] netlink: allow sending extended ACK with cookie on success Johannes Berg
2017-04-08 17:48 ` [PATCH 4/5] netlink: pass extended ACK struct to parsing functions Johannes Berg
2017-04-08 18:50   ` David Ahern
2017-04-08 20:15     ` Johannes Berg
2017-04-08 17:49 ` [PATCH 5/5] netlink: pass extended ACK struct where available Johannes Berg

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=20170408174900.12820-3-johannes@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=jbenc@redhat.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.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 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).