Stephen, ethtool_get_link returns EOPNOTSUPP if device doesn't supply get_link:
static int ethtool_get_link(struct net_device *dev, char __user *useraddr) { struct ethtool_value edata = { .cmd = ETHTOOL_GLINK }; if (!dev->ethtool_ops->get_link) return -EOPNOTSUPP; edata.data = netif_running(dev) && dev->ethtool_ops->get_link(dev); if (copy_to_user(useraddr, &edata, sizeof(edata))) return -EFAULT; return 0; } On Sat, Dec 1, 2018 at 8:31 PM Stephen Hemminger <step...@networkplumber.org> wrote: > On Sat, 1 Dec 2018 14:12:54 +0300 > Igor Ryzhov <iryz...@nfware.com> wrote: > > > Hi Stephen, > > > > I also do not see the point of the current implementation of ethtool > > support. > > That's why I sent this patch – it enables ethtool_ops for all devices, > > independent of the underlying driver. > > Right now only .get_link is supported, but I am thinking about > > implementation of a larger set of functions, using req/resp queue, like > > netdev_ops functions are working. > > > > Regarding the KNI itself, we use it as Linux mirror of physical port for: > > 1. Port configuration from Linux – such functions as set_mac, change_mtu, > > etc. And ethtool_ops will be used the same way. > > 2. Passing control-plane packets to Linux. > > > > Can virtio user be used the same way, as a mirror of physical port? > > > > Best regards, > > Igor > > In Linux if device does not supply get_link the base code does the > right thing > > > u32 ethtool_op_get_link(struct net_device *dev) > { > return netif_carrier_ok(dev) ? 1 : 0; > } > > > > Doing set_mac, change_mtu and ethtool_ops in virtio_user should be possible > but probably not implemented. > >