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 v7 4/8] net/funeth: ethtool operations
Date: Thu, 24 Feb 2022 21:30:12 +0100 [thread overview]
Message-ID: <Yhfq1N7ce/adhmN9@lunn.ch> (raw)
In-Reply-To: <20220218234536.9810-5-dmichail@fungible.com>
> +static void fun_link_modes_to_ethtool(u64 modes,
> + unsigned long *ethtool_modes_map)
> +{
> +#define ADD_LINK_MODE(mode) \
> + __set_bit(ETHTOOL_LINK_MODE_ ## mode ## _BIT, ethtool_modes_map)
> +
> + if (modes & FUN_PORT_CAP_AUTONEG)
> + ADD_LINK_MODE(Autoneg);
> + if (modes & FUN_PORT_CAP_1000_X)
> + ADD_LINK_MODE(1000baseX_Full);
> + if (modes & FUN_PORT_CAP_10G_R) {
> + ADD_LINK_MODE(10000baseCR_Full);
> + ADD_LINK_MODE(10000baseSR_Full);
> + ADD_LINK_MODE(10000baseLR_Full);
> + ADD_LINK_MODE(10000baseER_Full);
> + }
> +static unsigned int fun_port_type(unsigned int xcvr)
> +{
> + if (!xcvr)
> + return PORT_NONE;
> +
> + switch (xcvr & 7) {
> + case FUN_XCVR_BASET:
> + return PORT_TP;
You support twisted pair, so should you also have the BaseT_FULL link
modes above?
> +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);
pause->autoneg is if you are negotiating pause via autneg, not if you
are doing autoneg in general. The user can set pause autoneg to false, via
ethtool -A|--pause devname [autoneg on|off]
but the link can still negotiate speed, duplex etc. But then it gets
more confusing with the following code:
> +}
> +
> +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;
> + /* Forcing PAUSE settings with AN enabled is unsupported. */
> + if (!pause->autoneg && (fp->advertising & FUN_PORT_CAP_AUTONEG))
> + return -EOPNOTSUPP;
This seems wrong. You don't advertise you cannot advertise. You simply
don't advertise. It could just be you have a bad variable name here?
> + if (pause->autoneg && !(fp->advertising & FUN_PORT_CAP_AUTONEG))
> + return -EINVAL;
So it should be, you have the capability to advertise pause, not that
you have the ability to advertise advertising. And it sounds like the
ability to advertise pause is hard coded on.
> +static void fun_get_ethtool_stats(struct net_device *netdev,
> + struct ethtool_stats *stats, u64 *data)
> +{
> + const struct funeth_priv *fp = netdev_priv(netdev);
> + struct funeth_txq_stats txs;
> + struct funeth_rxq_stats rxs;
> + struct funeth_txq **xdpqs;
> + struct funeth_rxq **rxqs;
> + unsigned int i, start;
> + u64 *totals, *tot;
> +
> + if (!netif_running(netdev))
> + return;
Why this limitation? I don't expect the counters to increment, but
they should still indicate the state when the interface was configured
down.
Andrew
next prev parent reply other threads:[~2022-02-24 20:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 23:45 [PATCH net-next v7 0/8] new Fungible Ethernet driver Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 1/8] PCI: Add Fungible Vendor ID to pci_ids.h Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 2/8] net/fungible: Add service module for Fungible drivers Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 3/8] net/funeth: probing and netdev ops Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 4/8] net/funeth: ethtool operations Dimitris Michailidis
2022-02-24 20:30 ` Andrew Lunn [this message]
2022-02-25 0:57 ` Dimitris Michailidis
2022-02-25 7:52 ` Andrew Lunn
2022-02-25 9:28 ` Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 5/8] net/funeth: devlink support Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 6/8] net/funeth: add the data path Dimitris Michailidis
2022-02-24 4:55 ` Jakub Kicinski
2022-02-24 18:47 ` Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 7/8] net/funeth: add kTLS TX control part Dimitris Michailidis
2022-02-18 23:45 ` [PATCH net-next v7 8/8] net/fungible: Kconfig, Makefiles, and MAINTAINERS Dimitris Michailidis
2022-02-19 4:58 ` [PATCH net-next v7 0/8] new Fungible Ethernet driver 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=Yhfq1N7ce/adhmN9@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 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).