Subject: RE: [PATCH net-next v27 10/13] rtase: Implement ethtool function

From: Justin Lai <[email-masked]>
Date: Fri, 16 Aug 2024 06:44:17 +0000

> On Mon, 12 Aug 2024 14:35:36 +0800 Justin Lai wrote:
> > +static void rtase_get_drvinfo(struct net_device *dev,
> > +                           struct ethtool_drvinfo *info) {
> > +     const struct rtase_private *tp = netdev_priv(dev);
> > +
> > +     strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
> > +     strscpy(info->bus_info, pci_name(tp->pdev),
> > +sizeof(info->bus_info)); }
> 
> This shouldn't be necessary, can you delete this function from the driver and
> check if the output of ethtool -i changes?
> ethtool_get_drvinfo() should fill this in for you.

Thank you for your response. As you mentioned, ethtool_get_drvinfo()
will indeed populate the relevant information. I will remove
rtase_get_drvinfo().

> 
> > +static void rtase_get_pauseparam(struct net_device *dev,
> > +                              struct ethtool_pauseparam *pause) {
> > +     const struct rtase_private *tp = netdev_priv(dev);
> > +     u16 value = rtase_r16(tp, RTASE_CPLUS_CMD);
> > +
> > +     pause->autoneg = AUTONEG_DISABLE;
> > +
> > +     if ((value & (RTASE_FORCE_TXFLOW_EN |
> RTASE_FORCE_RXFLOW_EN)) ==
> > +         (RTASE_FORCE_TXFLOW_EN | RTASE_FORCE_RXFLOW_EN)) {
> > +             pause->rx_pause = 1;
> > +             pause->tx_pause = 1;
> > +     } else if (value & RTASE_FORCE_TXFLOW_EN) {
> > +             pause->tx_pause = 1;
> > +     } else if (value & RTASE_FORCE_RXFLOW_EN) {
> > +             pause->rx_pause = 1;
> > +     }
> 
> This 3 if statements can be replaced with just two lines:
> 
>         pause->rx_pause = !!(value & RTASE_FORCE_RXFLOW_EN);
>         pause->tx_pause = !!(value & RTASE_FORCE_TXFLOW_EN);

Ok, I will modify it.

Thanks
Justin