[dpdk-dev] [PATCH v2] kni: use kni_ethtool_ops only with unknown drivers

Ferruh Yigit ferruh.yigit at intel.com
Tue Dec 18 19:04:54 CET 2018


On 11/30/2018 7:47 PM, Igor Ryzhov wrote:
> Current implementation of kni_ethtool_ops just uses corresponding
> ethtool_ops function of underlying driver for all functions except for
> .get_link. This commit sets kni->net_dev->ethtool_ops directly to the
> ethtool_ops of the corresponding driver.
I think we can't assign ethtool_ops directly to the driver ethtool_ops.

There are two net_device in the system for the ethtool support case:
1) kni net_device
2) driver net_device

Linux kernel driver probed() at some level at least a net_device struct created
for it, that is how we have 2). And 2), driver net_device, is saved in the
context of the kni.

The function of the kni_ethtool.c is, convert "kni net_device" to "driver
net_device":

 struct kni_dev *priv = netdev_priv(dev);
 ethtool_ops->xxx(priv->lad_dev, ...);

When you are directly set kni ethtool_ops to driver ethtool_ops, you will be
passing "kni net_device" to the kernel driver. I can't predict what will be the
results there.
How this can work, did you able to test this?

> 
> For unknown drivers (all but ixgbe and i40e) we still use

It is igb & ixgbe, i40e is not supported but it is a detail only.

> kni_ethtool_ops with implemented .get_link function.

Not exactly, unless I am missing something.

.get_link function is not implemented for "unknown drivers". It gets carrier
status of the kni net_device. There is nothing related to the underlying device
here.

For the ethtool functions you have removed, they goes to hardware mapped to kni
interface and gets the value from them. Existing .get_link just gets the kni
interface value, it doesn't go to any hardware.

In *sample* application a logic has been added to reflect the hardware link
status to kni interface thorough the sysfs interface kni has, if you are
referring that one, it is not implementing ethtool support for "unknown
drivers", it is relying to application later to reflect hardware link status to
kni interface so that you can read from kni interface.

> 
> Signed-off-by: Igor Ryzhov <iryzhov at nfware.com>
> ---
>  kernel/linux/kni/Makefile      |   2 +-
>  kernel/linux/kni/kni_ethtool.c | 210 ---------------------------------
>  kernel/linux/kni/kni_misc.c    |   9 +-
>  3 files changed, 7 insertions(+), 214 deletions(-)

<...>


More information about the dev mailing list