igb: Add MII write support
authorJackie Jone <jackie.jone@alliedtelesis.co.nz>
Tue, 18 Jun 2024 21:33:28 +0000 (14:33 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 20 Jun 2024 13:21:50 +0000 (15:21 +0200)
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@alliedtelesis.co.nz>
Acked-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20240618213330.982046-1-anthony.l.nguyen@intel.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/intel/igb/igb_main.c

index fce2930ae6af75786bf95bd127044476299aa711..3af03a211c3cf53c7c830b693b04da4c60382316 100644 (file)
@@ -9139,6 +9139,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;
        default:
                return -EOPNOTSUPP;
        }