Subject: Re: [PATCH v2 net-next 4/7] octeontx2-vf: Ethtool support

From: Leon Romanovsky <[email-masked]>
Date: Fri, 13 Mar 2020 19:56:25 +0200

On Fri, Mar 13, 2020 at 03:12:43PM +0530, [email-masked] wrote:
> From: Tomasz Duszynski <[email-masked]>
>
> Added ethtool support for VF devices for
>  - Driver stats, Tx/Rx perqueue stats
>  - Set/show Rx/Tx queue count
>  - Set/show Rx/Tx ring sizes
>  - Set/show IRQ coalescing parameters
>  - RSS configuration etc
>
> It's the PF which owns the interface, hence VF
> cannot display underlying CGX interface stats.
> Except for this rest ethtool support reuses PF's
> APIs.
>
> Signed-off-by: Tomasz Duszynski <[email-masked]>
> Signed-off-by: Sunil Goutham <[email-masked]>
> ---
>  .../ethernet/marvell/octeontx2/nic/otx2_common.h   |   1 +
>  .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  | 133 ++++++++++++++++++++-
>  .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c   |   4 +
>  3 files changed, 136 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> index ca757b2..95b8f1e 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
> @@ -631,6 +631,7 @@ void otx2_update_lmac_stats(struct otx2_nic *pfvf);
>  int otx2_update_rq_stats(struct otx2_nic *pfvf, int qidx);
>  int otx2_update_sq_stats(struct otx2_nic *pfvf, int qidx);
>  void otx2_set_ethtool_ops(struct net_device *netdev);
> +void otx2vf_set_ethtool_ops(struct net_device *netdev);
>
>  int otx2_open(struct net_device *netdev);
>  int otx2_stop(struct net_device *netdev);
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> index f450111..1751e2d 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
> @@ -17,6 +17,7 @@
>  #include "otx2_common.h"
>
>  #define DRV_NAME	"octeontx2-nicpf"
> +#define DRV_VF_NAME	"octeontx2-nicvf"
>
>  struct otx2_stat {
>  	char name[ETH_GSTRING_LEN];
> @@ -63,14 +64,34 @@ static const unsigned int otx2_n_dev_stats = ARRAY_SIZE(otx2_dev_stats);
>  static const unsigned int otx2_n_drv_stats = ARRAY_SIZE(otx2_drv_stats);
>  static const unsigned int otx2_n_queue_stats = ARRAY_SIZE(otx2_queue_stats);
>
> +int __weak otx2vf_open(struct net_device *netdev)
> +{
> +	return 0;
> +}
> +
> +int __weak otx2vf_stop(struct net_device *netdev)
> +{
> +	return 0;
> +}

We tried very politely to explain that drivers shouldn't have "__weak"
in their code, sorry if it wasn't clear enough.

Thanks