<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/net/ethtool, branch v5.16.1</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.16.1</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v5.16.1'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2021-12-07T00:53:32Z</updated>
<entry>
<title>ethtool: do not perform operations on net devices being unregistered</title>
<updated>2021-12-07T00:53:32Z</updated>
<author>
<name>Antoine Tenart</name>
<email>atenart@kernel.org</email>
</author>
<published>2021-12-03T10:13:18Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=dde91ccfa25fd58f64c397d91b81a4b393100ffa'/>
<id>urn:sha1:dde91ccfa25fd58f64c397d91b81a4b393100ffa</id>
<content type='text'>
There is a short period between a net device starts to be unregistered
and when it is actually gone. In that time frame ethtool operations
could still be performed, which might end up in unwanted or undefined
behaviours[1].

Do not allow ethtool operations after a net device starts its
unregistration. This patch targets the netlink part as the ioctl one
isn't affected: the reference to the net device is taken and the
operation is executed within an rtnl lock section and the net device
won't be found after unregister.

[1] For example adding Tx queues after unregister ends up in NULL
    pointer exceptions and UaFs, such as:

      BUG: KASAN: use-after-free in kobject_get+0x14/0x90
      Read of size 1 at addr ffff88801961248c by task ethtool/755

      CPU: 0 PID: 755 Comm: ethtool Not tainted 5.15.0-rc6+ #778
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-4.fc34 04/014
      Call Trace:
       dump_stack_lvl+0x57/0x72
       print_address_description.constprop.0+0x1f/0x140
       kasan_report.cold+0x7f/0x11b
       kobject_get+0x14/0x90
       kobject_add_internal+0x3d1/0x450
       kobject_init_and_add+0xba/0xf0
       netdev_queue_update_kobjects+0xcf/0x200
       netif_set_real_num_tx_queues+0xb4/0x310
       veth_set_channels+0x1c3/0x550
       ethnl_set_channels+0x524/0x610

Fixes: 041b1c5d4a53 ("ethtool: helper functions for netlink interface")
Suggested-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Antoine Tenart &lt;atenart@kernel.org&gt;
Link: https://lore.kernel.org/r/20211203101318.435618-1-atenart@kernel.org
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ethtool: ioctl: fix potential NULL deref in ethtool_set_coalesce()</title>
<updated>2021-11-26T19:17:47Z</updated>
<author>
<name>Julian Wiedmann</name>
<email>jwi@linux.ibm.com</email>
</author>
<published>2021-11-26T17:55:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0276af2176c78771da7f311621a25d7608045827'/>
<id>urn:sha1:0276af2176c78771da7f311621a25d7608045827</id>
<content type='text'>
ethtool_set_coalesce() now uses both the .get_coalesce() and
.set_coalesce() callbacks. But the check for their availability is
buggy, so changing the coalesce settings on a device where the driver
provides only _one_ of the callbacks results in a NULL pointer
dereference instead of an -EOPNOTSUPP.

Fix the condition so that the availability of both callbacks is
ensured. This also matches the netlink code.

Note that reproducing this requires some effort - it only affects the
legacy ioctl path, and needs a specific combination of driver options:
- have .get_coalesce() and .coalesce_supported but no
 .set_coalesce(), or
- have .set_coalesce() but no .get_coalesce(). Here eg. ethtool doesn't
  cause the crash as it first attempts to call ethtool_get_coalesce()
  and bails out on error.

Fixes: f3ccfda19319 ("ethtool: extend coalesce setting uAPI with CQE mode")
Cc: Yufeng Mo &lt;moyufeng@huawei.com&gt;
Cc: Huazhong Tan &lt;tanhuazhong@huawei.com&gt;
Cc: Andrew Lunn &lt;andrew@lunn.ch&gt;
Cc: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Julian Wiedmann &lt;jwi@linux.ibm.com&gt;
Link: https://lore.kernel.org/r/20211126175543.28000-1-jwi@linux.ibm.com
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ethtool: fix ethtool msg len calculation for pause stats</title>
<updated>2021-11-03T11:20:45Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-11-02T22:02:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1aabe578dd86e9f2867c4db4fba9a15f4ba1825d'/>
<id>urn:sha1:1aabe578dd86e9f2867c4db4fba9a15f4ba1825d</id>
<content type='text'>
ETHTOOL_A_PAUSE_STAT_MAX is the MAX attribute id,
so we need to subtract non-stats and add one to
get a count (IOW -2+1 == -1).

Otherwise we'll see:

  ethnl cmd 21: calculated reply length 40, but consumed 52

Fixes: 9a27a33027f2 ("ethtool: add standard pause stats")
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Reviewed-by: Saeed Mahameed &lt;saeedm@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: don't drop the rtnl_lock half way thru the ioctl</title>
<updated>2021-11-01T13:26:07Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-30T17:18:51Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=1af0a0948e28d83bcfa9d48cd0f992f616c5d62e'/>
<id>urn:sha1:1af0a0948e28d83bcfa9d48cd0f992f616c5d62e</id>
<content type='text'>
devlink compat code needs to drop rtnl_lock to take
devlink-&gt;lock to ensure correct lock ordering.

This is problematic because we're not strictly guaranteed
that the netdev will not disappear after we re-lock.
It may open a possibility of nested -&gt;begin / -&gt;complete
calls.

Instead of calling into devlink under rtnl_lock take
a ref on the devlink instance and make the call after
we've dropped rtnl_lock.

We (continue to) assume that netdevs have an implicit
reference on the devlink returned from ndo_get_devlink_port

Note that ndo_get_devlink_port will now get called
under rtnl_lock. That should be fine since none of
the drivers seem to be taking serious locks inside
ndo_get_devlink_port.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: handle info/flash data copying outside rtnl_lock</title>
<updated>2021-11-01T13:26:07Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-30T17:18:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=095cfcfe13e5a6599cf0a41fe1e8bbfa76cd1c9d'/>
<id>urn:sha1:095cfcfe13e5a6599cf0a41fe1e8bbfa76cd1c9d</id>
<content type='text'>
We need to increase the lifetime of the data for .get_info
and .flash_update beyond their handlers inside rtnl_lock.

Allocate a union on the heap and use it instead.

Note that we now copy the ethcmd before we lookup dev,
hopefully there is no crazy user space depending on error
codes.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: push the rtnl_lock into dev_ethtool()</title>
<updated>2021-11-01T13:26:07Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2021-10-30T17:18:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f49deaa64af10276ef0c9a09558152f990b5f3b1'/>
<id>urn:sha1:f49deaa64af10276ef0c9a09558152f990b5f3b1</id>
<content type='text'>
Don't take the lock in net/core/dev_ioctl.c,
we'll have things to do outside rtnl_lock soon.

Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Reviewed-by: Leon Romanovsky &lt;leonro@nvidia.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>net: convert users of bitmap_foo() to linkmode_foo()</title>
<updated>2021-10-24T12:58:52Z</updated>
<author>
<name>Sean Anderson</name>
<email>sean.anderson@seco.com</email>
</author>
<published>2021-10-22T22:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4973056cceacc70966396039fae99867dfafd796'/>
<id>urn:sha1:4973056cceacc70966396039fae99867dfafd796</id>
<content type='text'>
This converts instances of
	bitmap_foo(args..., __ETHTOOL_LINK_MODE_MASK_NBITS)
to
	linkmode_foo(args...)

I manually fixed up some lines to prevent them from being excessively
long. Otherwise, this change was generated with the following semantic
patch:

// Generated with
// echo linux/linkmode.h &gt; includes
// git grep -Flf includes include/ | cut -f 2- -d / | cat includes - \
// | sort | uniq | tee new_includes | wc -l &amp;&amp; mv new_includes includes
// and repeating until the number stopped going up
@i@
@@

(
 #include &lt;linux/acpi_mdio.h&gt;
|
 #include &lt;linux/brcmphy.h&gt;
|
 #include &lt;linux/dsa/loop.h&gt;
|
 #include &lt;linux/dsa/sja1105.h&gt;
|
 #include &lt;linux/ethtool.h&gt;
|
 #include &lt;linux/ethtool_netlink.h&gt;
|
 #include &lt;linux/fec.h&gt;
|
 #include &lt;linux/fs_enet_pd.h&gt;
|
 #include &lt;linux/fsl/enetc_mdio.h&gt;
|
 #include &lt;linux/fwnode_mdio.h&gt;
|
 #include &lt;linux/linkmode.h&gt;
|
 #include &lt;linux/lsm_audit.h&gt;
|
 #include &lt;linux/mdio-bitbang.h&gt;
|
 #include &lt;linux/mdio.h&gt;
|
 #include &lt;linux/mdio-mux.h&gt;
|
 #include &lt;linux/mii.h&gt;
|
 #include &lt;linux/mii_timestamper.h&gt;
|
 #include &lt;linux/mlx5/accel.h&gt;
|
 #include &lt;linux/mlx5/cq.h&gt;
|
 #include &lt;linux/mlx5/device.h&gt;
|
 #include &lt;linux/mlx5/driver.h&gt;
|
 #include &lt;linux/mlx5/eswitch.h&gt;
|
 #include &lt;linux/mlx5/fs.h&gt;
|
 #include &lt;linux/mlx5/port.h&gt;
|
 #include &lt;linux/mlx5/qp.h&gt;
|
 #include &lt;linux/mlx5/rsc_dump.h&gt;
|
 #include &lt;linux/mlx5/transobj.h&gt;
|
 #include &lt;linux/mlx5/vport.h&gt;
|
 #include &lt;linux/of_mdio.h&gt;
|
 #include &lt;linux/of_net.h&gt;
|
 #include &lt;linux/pcs-lynx.h&gt;
|
 #include &lt;linux/pcs/pcs-xpcs.h&gt;
|
 #include &lt;linux/phy.h&gt;
|
 #include &lt;linux/phy_led_triggers.h&gt;
|
 #include &lt;linux/phylink.h&gt;
|
 #include &lt;linux/platform_data/bcmgenet.h&gt;
|
 #include &lt;linux/platform_data/xilinx-ll-temac.h&gt;
|
 #include &lt;linux/pxa168_eth.h&gt;
|
 #include &lt;linux/qed/qed_eth_if.h&gt;
|
 #include &lt;linux/qed/qed_fcoe_if.h&gt;
|
 #include &lt;linux/qed/qed_if.h&gt;
|
 #include &lt;linux/qed/qed_iov_if.h&gt;
|
 #include &lt;linux/qed/qed_iscsi_if.h&gt;
|
 #include &lt;linux/qed/qed_ll2_if.h&gt;
|
 #include &lt;linux/qed/qed_nvmetcp_if.h&gt;
|
 #include &lt;linux/qed/qed_rdma_if.h&gt;
|
 #include &lt;linux/sfp.h&gt;
|
 #include &lt;linux/sh_eth.h&gt;
|
 #include &lt;linux/smsc911x.h&gt;
|
 #include &lt;linux/soc/nxp/lpc32xx-misc.h&gt;
|
 #include &lt;linux/stmmac.h&gt;
|
 #include &lt;linux/sunrpc/svc_rdma.h&gt;
|
 #include &lt;linux/sxgbe_platform.h&gt;
|
 #include &lt;net/cfg80211.h&gt;
|
 #include &lt;net/dsa.h&gt;
|
 #include &lt;net/mac80211.h&gt;
|
 #include &lt;net/selftests.h&gt;
|
 #include &lt;rdma/ib_addr.h&gt;
|
 #include &lt;rdma/ib_cache.h&gt;
|
 #include &lt;rdma/ib_cm.h&gt;
|
 #include &lt;rdma/ib_hdrs.h&gt;
|
 #include &lt;rdma/ib_mad.h&gt;
|
 #include &lt;rdma/ib_marshall.h&gt;
|
 #include &lt;rdma/ib_pack.h&gt;
|
 #include &lt;rdma/ib_pma.h&gt;
|
 #include &lt;rdma/ib_sa.h&gt;
|
 #include &lt;rdma/ib_smi.h&gt;
|
 #include &lt;rdma/ib_umem.h&gt;
|
 #include &lt;rdma/ib_umem_odp.h&gt;
|
 #include &lt;rdma/ib_verbs.h&gt;
|
 #include &lt;rdma/iw_cm.h&gt;
|
 #include &lt;rdma/mr_pool.h&gt;
|
 #include &lt;rdma/opa_addr.h&gt;
|
 #include &lt;rdma/opa_port_info.h&gt;
|
 #include &lt;rdma/opa_smi.h&gt;
|
 #include &lt;rdma/opa_vnic.h&gt;
|
 #include &lt;rdma/rdma_cm.h&gt;
|
 #include &lt;rdma/rdma_cm_ib.h&gt;
|
 #include &lt;rdma/rdmavt_cq.h&gt;
|
 #include &lt;rdma/rdma_vt.h&gt;
|
 #include &lt;rdma/rdmavt_qp.h&gt;
|
 #include &lt;rdma/rw.h&gt;
|
 #include &lt;rdma/tid_rdma_defs.h&gt;
|
 #include &lt;rdma/uverbs_ioctl.h&gt;
|
 #include &lt;rdma/uverbs_named_ioctl.h&gt;
|
 #include &lt;rdma/uverbs_std_types.h&gt;
|
 #include &lt;rdma/uverbs_types.h&gt;
|
 #include &lt;soc/mscc/ocelot.h&gt;
|
 #include &lt;soc/mscc/ocelot_ptp.h&gt;
|
 #include &lt;soc/mscc/ocelot_vcap.h&gt;
|
 #include &lt;trace/events/ib_mad.h&gt;
|
 #include &lt;trace/events/rdma_core.h&gt;
|
 #include &lt;trace/events/rdma.h&gt;
|
 #include &lt;trace/events/rpcrdma.h&gt;
|
 #include &lt;uapi/linux/ethtool.h&gt;
|
 #include &lt;uapi/linux/ethtool_netlink.h&gt;
|
 #include &lt;uapi/linux/mdio.h&gt;
|
 #include &lt;uapi/linux/mii.h&gt;
)

@depends on i@
expression list args;
@@

(
- bitmap_zero(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_zero(args)
|
- bitmap_copy(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_copy(args)
|
- bitmap_and(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_and(args)
|
- bitmap_or(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_or(args)
|
- bitmap_empty(args, ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_empty(args)
|
- bitmap_andnot(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_andnot(args)
|
- bitmap_equal(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_equal(args)
|
- bitmap_intersects(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_intersects(args)
|
- bitmap_subset(args, __ETHTOOL_LINK_MODE_MASK_NBITS)
+ linkmode_subset(args)
)

Add missing linux/mii.h include to mellanox. -DaveM

Signed-off-by: Sean Anderson &lt;sean.anderson@seco.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: Add ability to control transceiver modules' power mode</title>
<updated>2021-10-07T00:47:49Z</updated>
<author>
<name>Ido Schimmel</name>
<email>idosch@nvidia.com</email>
</author>
<published>2021-10-06T10:46:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=353407d917b2d87cd8104a0453d012439c6ca4be'/>
<id>urn:sha1:353407d917b2d87cd8104a0453d012439c6ca4be</id>
<content type='text'>
Add a pair of new ethtool messages, 'ETHTOOL_MSG_MODULE_SET' and
'ETHTOOL_MSG_MODULE_GET', that can be used to control transceiver
modules parameters and retrieve their status.

The first parameter to control is the power mode of the module. It is
only relevant for paged memory modules, as flat memory modules always
operate in low power mode.

When a paged memory module is in low power mode, its power consumption
is reduced to the minimum, the management interface towards the host is
available and the data path is deactivated.

User space can choose to put modules that are not currently in use in
low power mode and transition them to high power mode before putting the
associated ports administratively up. This is useful for user space that
favors reduced power consumption and lower temperatures over reduced
link up times. In QSFP-DD modules the transition from low power mode to
high power mode can take a few seconds and this transition is only
expected to get longer with future / more complex modules.

User space can control the power mode of the module via the power mode
policy attribute ('ETHTOOL_A_MODULE_POWER_MODE_POLICY'). Possible
values:

* high: Module is always in high power mode.

* auto: Module is transitioned by the host to high power mode when the
  first port using it is put administratively up and to low power mode
  when the last port using it is put administratively down.

The operational power mode of the module is available to user space via
the 'ETHTOOL_A_MODULE_POWER_MODE' attribute. The attribute is not
reported to user space when a module is not plugged-in.

The user API is designed to be generic enough so that it could be used
for modules with different memory maps (e.g., SFF-8636, CMIS).

The only implementation of the device driver API in this series is for a
MAC driver (mlxsw) where the module is controlled by the device's
firmware, but it is designed to be generic enough so that it could also
be used by implementations where the module is controlled by the CPU.

CMIS testing
============

 # ethtool -m swp11
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
 ...
 Module State                              : 0x03 (ModuleReady)
 LowPwrAllowRequestHW                      : Off
 LowPwrRequestSW                           : Off

The module is not in low power mode, as it is not forced by hardware
(LowPwrAllowRequestHW is off) or by software (LowPwrRequestSW is off).

The power mode can be queried from the kernel. In case
LowPwrAllowRequestHW was on, the kernel would need to take into account
the state of the LowPwrRequestHW signal, which is not visible to user
space.

 $ ethtool --show-module swp11
 Module parameters for swp11:
 power-mode-policy high
 power-mode high

Change the power mode policy to 'auto':

 # ethtool --set-module swp11 power-mode-policy auto

Query the power mode again:

 $ ethtool --show-module swp11
 Module parameters for swp11:
 power-mode-policy auto
 power-mode low

Verify with the data read from the EEPROM:

 # ethtool -m swp11
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
 ...
 Module State                              : 0x01 (ModuleLowPwr)
 LowPwrAllowRequestHW                      : Off
 LowPwrRequestSW                           : On

Put the associated port administratively up which will instruct the host
to transition the module to high power mode:

 # ip link set dev swp11 up

Query the power mode again:

 $ ethtool --show-module swp11
 Module parameters for swp11:
 power-mode-policy auto
 power-mode high

Verify with the data read from the EEPROM:

 # ethtool -m swp11
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
 ...
 Module State                              : 0x03 (ModuleReady)
 LowPwrAllowRequestHW                      : Off
 LowPwrRequestSW                           : Off

Put the associated port administratively down which will instruct the
host to transition the module to low power mode:

 # ip link set dev swp11 down

Query the power mode again:

 $ ethtool --show-module swp11
 Module parameters for swp11:
 power-mode-policy auto
 power-mode low

Verify with the data read from the EEPROM:

 # ethtool -m swp11
 Identifier                                : 0x18 (QSFP-DD Double Density 8X Pluggable Transceiver (INF-8628))
 ...
 Module State                              : 0x01 (ModuleLowPwr)
 LowPwrAllowRequestHW                      : Off
 LowPwrRequestSW                           : On

SFF-8636 testing
================

 # ethtool -m swp13
 Identifier                                : 0x11 (QSFP28)
 ...
 Extended identifier description           : 5.0W max. Power consumption,  High Power Class (&gt; 3.5 W) enabled
 Power set                                 : Off
 Power override                            : On
 ...
 Transmit avg optical power (Channel 1)    : 0.7733 mW / -1.12 dBm
 Transmit avg optical power (Channel 2)    : 0.7649 mW / -1.16 dBm
 Transmit avg optical power (Channel 3)    : 0.7790 mW / -1.08 dBm
 Transmit avg optical power (Channel 4)    : 0.7837 mW / -1.06 dBm
 Rcvr signal avg optical power(Channel 1)  : 0.9302 mW / -0.31 dBm
 Rcvr signal avg optical power(Channel 2)  : 0.9079 mW / -0.42 dBm
 Rcvr signal avg optical power(Channel 3)  : 0.8993 mW / -0.46 dBm
 Rcvr signal avg optical power(Channel 4)  : 0.8778 mW / -0.57 dBm

The module is not in low power mode, as it is not forced by hardware
(Power override is on) or by software (Power set is off).

The power mode can be queried from the kernel. In case Power override
was off, the kernel would need to take into account the state of the
LPMode signal, which is not visible to user space.

 $ ethtool --show-module swp13
 Module parameters for swp13:
 power-mode-policy high
 power-mode high

Change the power mode policy to 'auto':

 # ethtool --set-module swp13 power-mode-policy auto

Query the power mode again:

 $ ethtool --show-module swp13
 Module parameters for swp13:
 power-mode-policy auto
 power-mode low

Verify with the data read from the EEPROM:

 # ethtool -m swp13
 Identifier                                : 0x11 (QSFP28)
 Extended identifier description           : 5.0W max. Power consumption,  High Power Class (&gt; 3.5 W) not enabled
 Power set                                 : On
 Power override                            : On
 ...
 Transmit avg optical power (Channel 1)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 2)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 3)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 4)    : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 1)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 2)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 3)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 4)  : 0.0000 mW / -inf dBm

Put the associated port administratively up which will instruct the host
to transition the module to high power mode:

 # ip link set dev swp13 up

Query the power mode again:

 $ ethtool --show-module swp13
 Module parameters for swp13:
 power-mode-policy auto
 power-mode high

Verify with the data read from the EEPROM:

 # ethtool -m swp13
 Identifier                                : 0x11 (QSFP28)
 ...
 Extended identifier description           : 5.0W max. Power consumption,  High Power Class (&gt; 3.5 W) enabled
 Power set                                 : Off
 Power override                            : On
 ...
 Transmit avg optical power (Channel 1)    : 0.7934 mW / -1.01 dBm
 Transmit avg optical power (Channel 2)    : 0.7859 mW / -1.05 dBm
 Transmit avg optical power (Channel 3)    : 0.7885 mW / -1.03 dBm
 Transmit avg optical power (Channel 4)    : 0.7985 mW / -0.98 dBm
 Rcvr signal avg optical power(Channel 1)  : 0.9325 mW / -0.30 dBm
 Rcvr signal avg optical power(Channel 2)  : 0.9034 mW / -0.44 dBm
 Rcvr signal avg optical power(Channel 3)  : 0.9086 mW / -0.42 dBm
 Rcvr signal avg optical power(Channel 4)  : 0.8885 mW / -0.51 dBm

Put the associated port administratively down which will instruct the
host to transition the module to low power mode:

 # ip link set dev swp13 down

Query the power mode again:

 $ ethtool --show-module swp13
 Module parameters for swp13:
 power-mode-policy auto
 power-mode low

Verify with the data read from the EEPROM:

 # ethtool -m swp13
 Identifier                                : 0x11 (QSFP28)
 ...
 Extended identifier description           : 5.0W max. Power consumption,  High Power Class (&gt; 3.5 W) not enabled
 Power set                                 : On
 Power override                            : On
 ...
 Transmit avg optical power (Channel 1)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 2)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 3)    : 0.0000 mW / -inf dBm
 Transmit avg optical power (Channel 4)    : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 1)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 2)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 3)  : 0.0000 mW / -inf dBm
 Rcvr signal avg optical power(Channel 4)  : 0.0000 mW / -inf dBm

Signed-off-by: Ido Schimmel &lt;idosch@nvidia.com&gt;
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>ethtool: ioctl: Use array_size() helper in copy_{from,to}_user()</title>
<updated>2021-09-29T10:32:14Z</updated>
<author>
<name>Gustavo A. R. Silva</name>
<email>gustavoars@kernel.org</email>
</author>
<published>2021-09-28T19:57:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ed717613f972453ab924eee8b64a62e0db83be67'/>
<id>urn:sha1:ed717613f972453ab924eee8b64a62e0db83be67</id>
<content type='text'>
Use array_size() helper instead of the open-coded version in
copy_{from,to}_user().  These sorts of multiplication factors
need to be wrapped in array_size().

Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva &lt;gustavoars@kernel.org&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>ethtool: prevent endless loop if eeprom size is smaller than announced</title>
<updated>2021-09-14T13:26:47Z</updated>
<author>
<name>Heiner Kallweit</name>
<email>hkallweit1@gmail.com</email>
</author>
<published>2021-09-13T19:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b9bbc4c1debc837ba56872fb3b2499ba6459ca8b'/>
<id>urn:sha1:b9bbc4c1debc837ba56872fb3b2499ba6459ca8b</id>
<content type='text'>
It shouldn't happen, but can happen that readable eeprom size is smaller
than announced. Then we would be stuck in an endless loop here because
after reaching the actual end reads return eeprom.len = 0. I faced this
issue when making a mistake in driver development. Detect this scenario
and return an error.

Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
