public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Justin Lai <justinlai0215@realtek.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "kuba@kernel.org" <kuba@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH net-next v4 1/2] net/ethernet/realtek: Add Realtek automotive PCIe driver code
Date: Fri, 18 Aug 2023 12:01:17 +0000	[thread overview]
Message-ID: <23d2bbcca442457fa3efa5533b0a4246@realtek.com> (raw)
In-Reply-To: <979eca15-adfe-4afc-995f-ac59f702bbd1@lunn.ch>

>  +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

Hi, Andrew

Thanks for your quick review, I will check our code again and make changes.
> 
> ---
> pw-bot: cr
>

  reply	other threads:[~2023-08-18 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 13:38 [PATCH net-next v4 0/2] Add Realtek automotive PCIe driver Justin Lai
2023-08-17 13:38 ` [PATCH net-next v4 1/2] net/ethernet/realtek: Add Realtek automotive PCIe driver code Justin Lai
2023-08-17 14:22   ` Andrew Lunn
2023-08-18 12:01     ` Justin Lai [this message]
2023-08-17 13:38 ` [PATCH net-next v4 2/2] MAINTAINERS: Add the rtase ethernet driver entry Justin Lai

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=23d2bbcca442457fa3efa5533b0a4246@realtek.com \
    --to=justinlai0215@realtek.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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