Skip to contentSkip to conversation

ethtool: fec: ioctl kdoc touch ups

PATCH Applied Jakub Kicinski 2 participants 5 messages Mar 26, 2021

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

cover ethtool: fec: ioctl kdoc touch ups

A few touch ups from v1 review.

Jakub Kicinski (3):
ethtool: fec: add note about reuse of reserved
ethtool: fec: fix FEC_NONE check
ethtool: document the enum values not defines

 include/uapi/linux/ethtool.h | 24 ++++++++++++++----------
 net/ethtool/ioctl.c          |  2 +-
 2 files changed, 15 insertions(+), 11 deletions(-)
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/3 ethtool: fec: add note about reuse of reserved

struct ethtool_fecparam::reserved can't be used in SET, because ethtool user space doesn't zero-initialize the structure. Make this clear.

---
 include/uapi/linux/ethtool.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/ethtool.h +4 -0
index f6ef7d42c7a1..9a47c3efd8ca 100644
@@ -1382,6 +1382,10 @@ struct ethtool_per_queue_op {
  * @fec: Bitmask of configured FEC modes.
  * @reserved: Reserved for future extensions, ignore on GET, write 0 for SET.
  *
+ * Note that @reserved was never validated on input and ethtool user space
+ * left it uninitialized when calling SET. Hence going forward it can only be
+ * used to return a value to userspace with GET.
+ *
  * FEC modes supported by the device can be read via %ETHTOOL_GLINKSETTINGS.
  * FEC settings are configured by link autonegotiation whenever it's enabled.
  * With autoneg on %ETHTOOL_GFECPARAM can be used to read the current mode.
Signature · 1 line
2.30.2
author maintainer
#2 lore raw

PATCH 2/3 ethtool: fec: fix FEC_NONE check

In reply to Jakub Kicinski

Dan points out we need to use the mask not the bit (which is 0).

Fixes 42ce127d9864 ("ethtool: fec: sanitize ethtool_fecparam->fec")
---
 net/ethtool/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/ioctl.c +1 -1
index 8797533ddc4b..26b3e7086075 100644
@@ -2586,7 +2586,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
 	if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))
 		return -EFAULT;
 
-	if (!fecparam.fec || fecparam.fec & ETHTOOL_FEC_NONE_BIT)
+	if (!fecparam.fec || fecparam.fec & ETHTOOL_FEC_NONE)
 		return -EINVAL;
 
 	fecparam.active_fec = 0;
Signature · 1 line
2.30.2
author maintainer
#3 lore raw

PATCH 3/3 ethtool: document the enum values not defines

In reply to Jakub Kicinski

kdoc does not have good support for documenting defines, and we can't abuse the enum documentation because it generates warnings.

---
 include/uapi/linux/ethtool.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
include/uapi/linux/ethtool.h +10 -10
index 9a47c3efd8ca..868b513d4f54 100644
@@ -1414,16 +1414,16 @@ struct ethtool_fecparam {
 
 /**
  * enum ethtool_fec_config_bits - flags definition of ethtool_fec_configuration
- * @ETHTOOL_FEC_NONE: FEC mode configuration is not supported. Should not
- *		      be used together with other bits. GET only.
- * @ETHTOOL_FEC_AUTO: Select default/best FEC mode automatically, usually based
- *		      link mode and SFP parameters read from module's EEPROM.
- *		      This bit does _not_ mean autonegotiation.
- * @ETHTOOL_FEC_OFF: No FEC Mode
- * @ETHTOOL_FEC_RS: Reed-Solomon FEC Mode
- * @ETHTOOL_FEC_BASER: Base-R/Reed-Solomon FEC Mode
- * @ETHTOOL_FEC_LLRS: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet
- *		      Consortium)
+ * @ETHTOOL_FEC_NONE_BIT: FEC mode configuration is not supported. Should not
+ *			be used together with other bits. GET only.
+ * @ETHTOOL_FEC_AUTO_BIT: Select default/best FEC mode automatically, usually
+ *			based link mode and SFP parameters read from module's
+ *			EEPROM. This bit does _not_ mean autonegotiation.
+ * @ETHTOOL_FEC_OFF_BIT: No FEC Mode
+ * @ETHTOOL_FEC_RS_BIT: Reed-Solomon FEC Mode
+ * @ETHTOOL_FEC_BASER_BIT: Base-R/Reed-Solomon FEC Mode
+ * @ETHTOOL_FEC_LLRS_BIT: Low Latency Reed Solomon FEC Mode (25G/50G Ethernet
+ *			Consortium)
  */
 enum ethtool_fec_config_bits {
 	ETHTOOL_FEC_NONE_BIT,
Signature · 1 line
2.30.2
#4 lore raw
In reply to Jakub Kicinski
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 8 lines · On Fri, 26 Mar 2021 13:22:20 -0700 you wrote:

A few touch ups from v1 review.

Jakub Kicinski (3):
ethtool: fec: add note about reuse of reserved
ethtool: fec: fix FEC_NONE check
ethtool: document the enum values not defines

[...]

Here is the summary with links:
- [net-next,1/3] ethtool: fec: add note about reuse of reserved

    https://git.kernel.org/netdev/net-next/c/ad1cd7856d87
  - [net-next,2/3] ethtool: fec: fix FEC_NONE check
    https://git.kernel.org/netdev/net-next/c/cf2cc0bf4fde
  - [net-next,3/3] ethtool: document the enum values not defines
    https://git.kernel.org/netdev/net-next/c/d04feecaf154

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html