Skip to contentSkip to conversation

basic ioctl support for netlink sockets

PATCH Superseded David Decotigny 3 participants 6 messages Mar 18, 2016 – Mar 21, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover basic ioctl support for netlink sockets

From: David Decotigny <[email protected]>

This removes the requirement that ethtool be tied to the support of a specific L3 protocol, also updates a comment.

############################################
# Patch Set Summary:

David Decotigny (2):
ethtool: minor doc update
netlink: add support for NIC driver ioctls

 include/uapi/linux/ethtool.h |  6 +++---
 net/netlink/af_netlink.c     | 10 +++++++++-
 2 files changed, 12 insertions(+), 4 deletions(-)
Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

PATCH 1/2 ethtool: minor doc update

From: David Decotigny <[email protected]>

Updates: commit 793cf87de9d1 ("ethtool: Set cmd field in
ETHTOOL_GLINKSETTINGS response to wrong nwords")

---
 include/uapi/linux/ethtool.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/ethtool.h +3 -3
index 2835b07..9222db8 100644
@@ -1648,9 +1648,9 @@ enum ethtool_reset_flags {
  *	%ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
  *	(>= 0); on return, if handshake in progress, negative if
  *	request size unsupported by kernel: absolute value indicates
- *	kernel recommended size and cmd field is 0, as well as all the
- *	other fields; otherwise (handshake completed), strictly
- *	positive to indicate size used by kernel and cmd field is
+ *	kernel expected size and all the other fields but cmd
+ *	are 0; otherwise (handshake completed), strictly positive
+ *	to indicate size used by kernel and cmd field stays
  *	%ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
  *	%ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
  *	value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
Signature · 1 line
2.8.0.rc3.226.g39d4020
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] ethtool: minor doc update

Quoted 6 lines · David Decotigny

From: David Decotigny <[email protected]>

Updates: commit 793cf87de9d1 ("ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords")

Quoted 21 lines

---
 include/uapi/linux/ethtool.h | 6 +++---

 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/ethtool.h +3 -3
index 2835b07..9222db8 100644
@@ -1648,9 +1648,9 @@ enum ethtool_reset_flags {
   *	%ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user
   *	(>= 0); on return, if handshake in progress, negative if
   *	request size unsupported by kernel: absolute value indicates
- *	kernel recommended size and cmd field is 0, as well as all the
- *	other fields; otherwise (handshake completed), strictly
- *	positive to indicate size used by kernel and cmd field is
+ *	kernel expected size and all the other fields but cmd
+ *	are 0; otherwise (handshake completed), strictly positive
+ *	to indicate size used by kernel and cmd field stays
   *	%ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For
   *	%ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive
   *	value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
Signature · 2 lines
Ben Hutchings
Absolutum obsoletum. (If it works, it's out of date.) - Stafford Beer
#3 lore raw

PATCH 2/2 netlink: add support for NIC driver ioctls

In reply to David Decotigny

From: David Decotigny <[email protected]>

This patch removes the requirement that ethtool be tied to the support of a specific L3 protocol (ethtool uses an AF_INET socket today).

---
 net/netlink/af_netlink.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
net/netlink/af_netlink.c +9 -1
index c841679..215fc08 100644
@@ -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,
Signature · 1 line
2.8.0.rc3.226.g39d4020
maintainer
#4 lore raw
In reply to David Decotigny

From: David Decotigny <[email protected]>
Date: Thu, 17 Mar 2016 17:03:54 -0700

Quoted 2 lines

This removes the requirement that ethtool be tied to the support of a specific L3 protocol, also updates a comment.

You're adding an ioctl handler to netlink sockets, and it is not at all apparent to me how this influences ethtool handling at all.

Therefore you have to explain this here and in your commit message.

#5 lore raw

sent updated version. commit description should have the details. what we are doing there is mimic what some others are doing, such as udp.c:
when returning -ENOIOCTLCMD, net/core would fallback to dev_ioctl, which implements the NIC driver ioctls, which include ethtool ioctl.

Quoted 10 lines · David Miller

From: David Decotigny <[email protected]>
Date: Thu, 17 Mar 2016 17:03:54 -0700

Quoted 2 lines

This removes the requirement that ethtool be tied to the support of a specific L3 protocol, also updates a comment.

You're adding an ioctl handler to netlink sockets, and it is not at all apparent to me how this influences ethtool handling at all.

Therefore you have to explain this here and in your commit message.