使用ioctl命令时,可以看到上述两个命令的存在,
在头文件 include/linux/sockios.h,定义如下:
#define SIOCETHTOOL 0x8946 /* Ethtool interface */ ethtool 接口
#define SIOCGMIIPHY 0x8947 /* Get address of MII PHY in use. */ 获取MII phy的地址
#define SIOCGMIIREG 0x8948 /* Read MII PHY register. */ 读取 MII phy 寄存器
#define SIOCSMIIREG 0x8949 /* Write MII PHY register. */ 写MII phy 寄存器
内核中对于上述两个命令的处理定义在文件 /drivers/net/phy/phy.c 的函数 phy_mii_ioctl中,
函数原型如下:
/**
* phy_mii_ioctl - generic PHY MII ioctl interface
* @phydev: the phy_device struct
* @ifr: &struct ifreq for socket ioctl's
* @cmd: ioctl cmd to execute
*
* Note that this function is currently incompatible with the
* PHYCONTROL layer. It changes registers without regard to
* curr