All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Dimitris Michailidis <d.michailidis@fungible.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 4/8] net/funeth: ethtool operations
Date: Thu, 30 Dec 2021 19:04:08 +0100	[thread overview]
Message-ID: <Yc30mG7tPQIT2HZK@lunn.ch> (raw)
In-Reply-To: <20211230163909.160269-5-dmichail@fungible.com>

> +static void fun_get_pauseparam(struct net_device *netdev,
> +			       struct ethtool_pauseparam *pause)
> +{
> +	const struct funeth_priv *fp = netdev_priv(netdev);
> +	u8 active_pause = fp->active_fc;
> +
> +	pause->rx_pause = active_pause & FUN_PORT_CAP_RX_PAUSE;
> +	pause->tx_pause = active_pause & FUN_PORT_CAP_TX_PAUSE;
> +	pause->autoneg = !!(fp->advertising & FUN_PORT_CAP_AUTONEG);
> +}
> +
> +static int fun_set_pauseparam(struct net_device *netdev,
> +			      struct ethtool_pauseparam *pause)
> +{
> +	struct funeth_priv *fp = netdev_priv(netdev);
> +	u64 new_advert;
> +
> +	if (fp->port_caps & FUN_PORT_CAP_VPORT)
> +		return -EOPNOTSUPP;
> +	if (pause->autoneg && !(fp->advertising & FUN_PORT_CAP_AUTONEG))
> +		return -EINVAL;
> +	if (pause->tx_pause & !(fp->port_caps & FUN_PORT_CAP_TX_PAUSE))
> +		return -EINVAL;
> +	if (pause->rx_pause & !(fp->port_caps & FUN_PORT_CAP_RX_PAUSE))
> +		return -EINVAL;
> +

I _think_ this is wrong. pause->autoneg means we are autoneg'ing
pause, not that we are using auto-neg in general. The user can have
autoneg turned on, but force pause by setting pause->autoneg to False.
In that case, the pause->rx_pause and pause->tx_pause are given direct
to the MAC, not auto negotiated.

> +static void fun_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
> +{
> +	wol->supported = 0;
> +	wol->wolopts = 0;
> +}

Not required. If you don't provide the callback, the core will return
-EOPNOTSUPP.

> +static void fun_get_drvinfo(struct net_device *netdev,
> +			    struct ethtool_drvinfo *info)
> +{
> +	const struct funeth_priv *fp = netdev_priv(netdev);
> +
> +	strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> +	strcpy(info->fw_version, "N/A");

Don't set it, if you have nothing useful to put in it.

      Andrew

  reply	other threads:[~2021-12-30 18:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-30 16:39 [PATCH net-next 0/8] new Fungible Ethernet driver Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 1/8] PCI: add Fungible vendor ID to pci_ids.h Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 2/8] net/fungible: Add service module for Fungible drivers Dimitris Michailidis
2021-12-30 17:28   ` Andrew Lunn
2021-12-30 18:24     ` Dimitris Michailidis
2021-12-30 19:00       ` Andrew Lunn
2021-12-30 20:13         ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 3/8] net/funeth: probing and netdev ops Dimitris Michailidis
2021-12-30 17:40   ` Andrew Lunn
2021-12-30 18:33     ` Dimitris Michailidis
2021-12-30 19:02       ` Andrew Lunn
2021-12-30 20:05         ` Dimitris Michailidis
2021-12-31 11:14   ` Heiner Kallweit
2022-01-03 22:11     ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 4/8] net/funeth: ethtool operations Dimitris Michailidis
2021-12-30 18:04   ` Andrew Lunn [this message]
2021-12-30 20:22     ` Jakub Kicinski
2021-12-30 20:30       ` Dimitris Michailidis
2021-12-30 20:43         ` Jakub Kicinski
2021-12-30 20:56           ` Dimitris Michailidis
2021-12-30 20:27     ` Dimitris Michailidis
2021-12-30 22:25       ` Andrew Lunn
2021-12-31  1:23         ` Dimitris Michailidis
2021-12-31  2:24           ` Andrew Lunn
2021-12-31  3:23             ` Dimitris Michailidis
2021-12-30 20:28   ` Jakub Kicinski
2021-12-30 20:31     ` Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 5/8] net/funeth: devlink support Dimitris Michailidis
2021-12-30 17:41   ` Jakub Kicinski
2021-12-30 16:39 ` [PATCH net-next 6/8] net/funeth: add the data path Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 7/8] net/funeth: add kTLS TX control part Dimitris Michailidis
2021-12-30 16:39 ` [PATCH net-next 8/8] net/fungible: Kconfig, Makefiles, and MAINTAINERS Dimitris Michailidis
2021-12-30 17:43   ` Jakub Kicinski
2021-12-30 20:54     ` Dimitris Michailidis
2021-12-30 21:16       ` Dimitris Michailidis
2021-12-30 22:17         ` Jakub Kicinski
2021-12-30 22:27       ` Andrew Lunn
2021-12-30 22:59         ` Dimitris Michailidis

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=Yc30mG7tPQIT2HZK@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=d.michailidis@fungible.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.