[Intel-wired-lan] [PATCH] igb: Add MII write support
Jacob Keller
jacob.e.keller at intel.com
Wed Jun 5 20:51:24 UTC 2024
On 6/3/2024 8:10 PM, jackie.jone at alliedtelesis.co.nz wrote:
> From: Jackie Jone <jackie.jone at alliedtelesis.co.nz>
>
> To facilitate running PHY parametric tests, add support for the SIOCSMIIREG
> ioctl. This allows a userspace application to write to the PHY registers
> to enable the test modes.
>
> Signed-off-by: Jackie Jone <jackie.jone at alliedtelesis.co.nz>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 03a4da6a1447..7fbfcf01fbf9 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -8977,6 +8977,10 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
> return -EIO;
> break;
> case SIOCSMIIREG:
> + if (igb_write_phy_reg(&adapter->hw, data->reg_num & 0x1F,
> + data->val_in))
> + return -EIO;
> + break;
A handful of drivers seem to expose this. What are the consequences of
exposing this ioctl? What can user space do with it?
It looks like a few drivers also check something like CAP_NET_ADMIN to
avoid allowing write access to all users. Is that enforced somewhere else?
More information about the Intel-wired-lan
mailing list