linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Veerasenareddy Burru <vburru@marvell.com>
Cc: davem@davemloft.net, kuba@kernel.org, corbet@lwn.net,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Abhijit Ayarekar <aayarekar@marvell.com>,
	Satananda Burla <sburla@marvell.com>
Subject: Re: [PATCH 4/4] octeon_ep: add ethtool support for Octeon PCI Endpoint NIC.
Date: Fri, 11 Feb 2022 22:40:56 +0100	[thread overview]
Message-ID: <YgbX6N5efWf7J4ds@lunn.ch> (raw)
In-Reply-To: <20220210213306.3599-5-vburru@marvell.com>

> +static void octep_get_drvinfo(struct net_device *netdev,
> +			      struct ethtool_drvinfo *info)
> +{
> +	struct octep_device *oct = netdev_priv(netdev);
> +
> +	strscpy(info->driver, OCTEP_DRV_NAME, sizeof(info->driver));
> +	strscpy(info->version, OCTEP_DRV_VERSION_STR, sizeof(info->version));

A driver version string is meaningless. If you don't set it, the core
will fill in the kernel version, which is actually usable information.

> +static int octep_get_link_ksettings(struct net_device *netdev,
> +				    struct ethtool_link_ksettings *cmd)
> +{
> +	struct octep_device *oct = netdev_priv(netdev);
> +	struct octep_iface_link_info *link_info;
> +	u32 advertised, supported;
> +
> +	ethtool_link_ksettings_zero_link_mode(cmd, supported);
> +	ethtool_link_ksettings_zero_link_mode(cmd, advertising);
> +
> +	octep_get_link_info(oct);
> +
> +	advertised = oct->link_info.advertised_modes;
> +	supported = oct->link_info.supported_modes;
> +	link_info = &oct->link_info;
> +
> +	if (supported & BIT(OCTEP_LINK_MODE_10GBASE_T))
> +		ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseT_Full);
> +	if (supported & BIT(OCTEP_LINK_MODE_10GBASE_R))
> +		ethtool_link_ksettings_add_link_mode(cmd, supported, 10000baseR_FEC);

....

> +
> +	if (advertised & BIT(OCTEP_LINK_MODE_10GBASE_T))
> +		ethtool_link_ksettings_add_link_mode(cmd, advertising, 10000baseT_Full);
> +	if (advertised & BIT(OCTEP_LINK_MODE_10GBASE_R))
> +		ethtool_link_ksettings_add_link_mode(cmd, advertising, 10000baseR_FEC);

It looks like you are doing the same thing twice, just different
variables. Pull this out into a helper.

Do you know what the link partner is advertising? It is useful debug
information if your firmware will tell you.

> diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> index 700852fd4c3a..00c6ca047332 100644
> --- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> +++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c
> @@ -827,7 +827,7 @@ static int octep_set_mac(struct net_device *netdev, void *p)
>  		return err;
>  
>  	memcpy(oct->mac_addr, addr->sa_data, ETH_ALEN);
> -	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
> +	eth_hw_addr_set(netdev, addr->sa_data);
>  
>  	return 0;
>  }
> @@ -1067,7 +1068,7 @@ static int octep_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	netdev->mtu = OCTEP_DEFAULT_MTU;
>  
>  	octep_get_mac_addr(octep_dev, octep_dev->mac_addr);
> -	memcpy(netdev->dev_addr, octep_dev->mac_addr, netdev->addr_len);
> +	eth_hw_addr_set(netdev, octep_dev->mac_addr);

These two changes don't belong here.

      Andrew

  reply	other threads:[~2022-02-11 21:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 21:33 [PATCH 0/4] Add octeon_ep driver Veerasenareddy Burru
2022-02-10 21:33 ` [PATCH 2/4] octeon_ep: add support for ndo ops Veerasenareddy Burru
2022-02-13 15:16   ` Leon Romanovsky
2022-02-10 21:33 ` [PATCH 3/4] octeon_ep: add Tx/Rx and interrupt support Veerasenareddy Burru
2022-02-10 21:33 ` [PATCH 4/4] octeon_ep: add ethtool support for Octeon PCI Endpoint NIC Veerasenareddy Burru
2022-02-11 21:40   ` Andrew Lunn [this message]
     [not found] ` <20220210213306.3599-2-vburru@marvell.com>
2022-02-11  2:29   ` [PATCH 1/4] octeon_ep: Add driver framework and device initiazliation Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgbX6N5efWf7J4ds@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=aayarekar@marvell.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sburla@marvell.com \
    --cc=vburru@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).