[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1458580535-112916-3-git-send-email-ddecotig@gmail.com>
Date: Mon, 21 Mar 2016 10:15:35 -0700
From: David Decotigny <ddecotig@...il.com>
To: "David S. Miller" <davem@...emloft.net>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Cc: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Ben Hutchings <ben@...adent.org.uk>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
David Decotigny <decot@...glers.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Andrew Lunn <andrew@...n.ch>,
Hadar Hen Zion <hadarh@...lanox.com>,
Edward Cree <ecree@...arflare.com>,
John Fastabend <john.r.fastabend@...el.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Thomas Graf <tgraf@...g.ch>,
Daniel Borkmann <daniel@...earbox.net>,
Ken-ichirou MATSUZAWA <chamaken@...il.com>,
Florian Westphal <fw@...len.de>,
David Herrmann <dh.herrmann@...il.com>
Subject: [PATCH net-next v2 2/2] netlink: add support for NIC driver ioctls
From: David Decotigny <decot@...glers.com>
By returning -ENOIOCTLCMD, sock_do_ioctl() falls back to calling
dev_ioctl(), which provides support for NIC driver ioctls, which
includes ethtool support. This is similar to the way ioctls are handled
in udp.c or tcp.c.
This removes the requirement that ethtool for example be tied to the
support of a specific L3 protocol (ethtool uses an AF_INET socket
today).
Signed-off-by: David Decotigny <decot@...glers.com>
---
net/netlink/af_netlink.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c841679..215fc08 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1033,6 +1033,14 @@ static int netlink_getname(struct socket *sock, struct sockaddr *addr,
return 0;
}
+static int netlink_ioctl(struct socket *sock, unsigned int cmd,
+ unsigned long arg)
+{
+ /* try to hand this ioctl down to the NIC drivers.
+ */
+ return -ENOIOCTLCMD;
+}
+
static struct sock *netlink_getsockbyportid(struct sock *ssk, u32 portid)
{
struct sock *sock;
@@ -2494,7 +2502,7 @@ static const struct proto_ops netlink_ops = {
.accept = sock_no_accept,
.getname = netlink_getname,
.poll = datagram_poll,
- .ioctl = sock_no_ioctl,
+ .ioctl = netlink_ioctl,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = netlink_setsockopt,
--
2.8.0.rc3.226.g39d4020
Powered by blists - more mailing lists