[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <979eca15-adfe-4afc-995f-ac59f702bbd1@lunn.ch>
Date: Thu, 17 Aug 2023 16:22:35 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Justin Lai <justinlai0215@...ltek.com>
Cc: kuba@...nel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next v4 1/2] net/ethernet/realtek: Add Realtek
automotive PCIe driver code
+static inline void rtase_enable_hw_interrupt(const struct rtase_private *tp)
If you read comments given to other developers, you would of seen that
inline functions are not allowed in .C files. Let the compiler decide.
> +static int rtase_get_settings(struct net_device *dev, struct ethtool_link_ksettings *cmd)
> +{
> + const struct rtase_private *tp = netdev_priv(dev);
> + u32 advertising = 0;
> + u32 supported = 0;
> + u32 speed = 0;
> + u16 value = 0;
> +
> + supported |= SUPPORTED_MII | SUPPORTED_Pause;
> +
> + advertising |= ADVERTISED_MII;
You don't advertise anything, because you don't have a PHY.
> +
> + /* speed */
> + switch (tp->pdev->bus->cur_bus_speed) {
Speed is meant to be line side speed. That is fixed at 5G. So i would
expect a hard coded value.
> +static void rtase_get_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
> +{
> + const struct rtase_private *tp = netdev_priv(dev);
> + u16 value = RTL_R16(tp, CPLUS_CMD);
> +
> + if ((value & (FORCE_TXFLOW_EN | FORCE_RXFLOW_EN)) == (FORCE_TXFLOW_EN | FORCE_RXFLOW_EN)) {
> + pause->rx_pause = 1;
> + pause->tx_pause = 1;
> + } else if ((value & FORCE_TXFLOW_EN) != 0u) {
> + pause->tx_pause = 1;
> + } else if ((value & FORCE_RXFLOW_EN) != 0u) {
> + pause->rx_pause = 1;
> + } else {
> + /* not enable pause */
> + }
Probably not required, but it would be good to set pause.autoneg to
false, just to make is clear you don't support negotiating it.
> +}
> +
> +static int rtase_set_pauseparam(struct net_device *dev, struct ethtool_pauseparam *pause)
> +{
> + const struct rtase_private *tp = netdev_priv(dev);
> + u16 value = RTL_R16(tp, CPLUS_CMD);
Similar to above, you should return EOPNOTSUPP if pause.autoneg is
true.
> +
> + value &= ~(FORCE_TXFLOW_EN | FORCE_RXFLOW_EN);
> +
> + if (pause->tx_pause == 1u)
> + value |= FORCE_TXFLOW_EN;
> +
> + if (pause->rx_pause == 1u)
You can treat these as boolean.
> + value |= FORCE_RXFLOW_EN;
> +
> + RTL_W16(tp, CPLUS_CMD, value);
> + return 0;
> +}
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists