Thread (6 messages) flat view 6 messages, 5 authors, 2014-01-13

RE: Use of ENOTSUPP in drivers?

From: Shahed Shaikh <hidden>
Date: 2014-01-13 06:45:49

-----Original Message-----
From: netdev-owner@vger.kernel.org [mailto:netdev-
owner@vger.kernel.org] On Behalf Of Sabrina Dubroca
Sent: Monday, January 13, 2014 12:27 AM
To: netdev
Cc: Ben Hutchings
Subject: Use of ENOTSUPP in drivers?


Thu, 2 Jan 2014 12:01:31 +0000, Ben Hutchings wrote:
quoted
Never return error code ENOTSUPP; it's *not* the same thing as ENOTSUP
in userland and is not part of the userland ABI.  I would use EINVAL
here.

I've found a few ethernet drivers that return -ENOTSUPP in various
functions. In particular, some ethtool functions or ioctl's.
Ben's message makes me think that the ethtool functions and ioctl's should
be modified.

There are other occurences, mostly in functions related to device
initialization. I didn't manage to track down exactly from where some of
them are called, and I don't know if ENOTSUPP is okay in these.

I've included the complete list of occurences (based on net-next) from
drivers/net/ethernet in patch form at the end, if that's more convenient
than the file/function list. This is not meant to be applied.


Do these (or part of them) need to be patched? Or is there something I'm
missing?


Thanks,
Sabrina


---
Hi Sabrina,

Using -EOPNOTSUPP instead of -ENOTSUPP,  ethtool is giving the expected error message.

# ethtool -w p6p1
Can not get dump level
: Operation not supported
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
index 03eb2ad..bb9f4ec 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
@@ -1641,7 +1641,7 @@ int qlcnic_83xx_loopback_test(struct net_device
*netdev, u8 mode)
 	if (ahw->op_mode == QLCNIC_NON_PRIV_FUNC) {
 		netdev_warn(netdev,
 			    "Loopback test not supported in non privileged
mode\n");
-		return -ENOTSUPP;
+		return -EINVAL;
Please use -EOPNOTSUPP
quoted hunk ↗ jump to hunk
 	}

 	if (test_bit(__QLCNIC_RESETTING, &adapter->state)) { diff --git
a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 45fa6ef..727be4e 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1681,7 +1681,7 @@ qlcnic_get_dump_flag(struct net_device *netdev,
struct ethtool_dump *dump)

 	if (!fw_dump->tmpl_hdr) {
 		netdev_err(adapter->netdev, "FW Dump not supported\n");
-		return -ENOTSUPP;
+		return -EINVAL;
Please use -EOPNOTSUPP
quoted hunk ↗ jump to hunk
 	}

 	if (fw_dump->clr)
@@ -1710,7 +1710,7 @@ qlcnic_get_dump_data(struct net_device *netdev,
struct ethtool_dump *dump,

 	if (!fw_dump->tmpl_hdr) {
 		netdev_err(netdev, "FW Dump not supported\n");
-		return -ENOTSUPP;
+		return -EINVAL;
Please use -EOPNOTSUPP
 	}

 	if (!fw_dump->clr) {
Thanks,
Shahed
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help