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>,
	Ping-Ke Shih <pkshih@realtek.com>,
	Larry Chiu <larry.chiu@realtek.com>
Subject: RE: [PATCH net-next v9 08/13] net:ethernet:realtek:rtase: Implement net_device_ops
Date: Fri, 6 Oct 2023 04:02:48 +0000	[thread overview]
Message-ID: <99dfcd7363dc412f877730fab4a9f7dd@realtek.com> (raw)
In-Reply-To: <b28a3ea6-d75e-45e0-8b87-0b062b5c3a64@lunn.ch>

> > +static int rtase_change_mtu(struct net_device *dev, int new_mtu) {
> > +     struct rtase_private *tp = netdev_priv(dev);
> > +     int ret;
> > +
> > +     dev->mtu = new_mtu;
> > +
> > +     if (!netif_running(dev))
> > +             goto out;
> > +
> > +     rtase_down(dev);
> > +
> > +     rtase_set_rxbufsize(tp, dev);
> > +
> > +     ret = rtase_init_ring(dev);
> > +
> > +     if (ret)
> > +             return ret;
> 
> If this fails, what state is the interface in?
> 
> What you often see is that the new ring is first allocated. If that is successful,
> you free the old rung. If the allocation fails, it does not matter, you still have
> the old ring, and you keep using it.
> 

If it fails, the driver will not work properly. We will make modifications based on your suggestions.

> > +
> > +     netif_stop_queue(dev);
> > +     netif_carrier_off(dev);
> > +     rtase_hw_config(dev);
> > +
> > +     /* always link, so start to transmit & receive */
> > +     rtase_hw_start(dev);
> > +     netif_carrier_on(dev);
> > +     netif_wake_queue(dev);
> 
> I don't think you need to down/up the carrier when changing the MTU.

Thank you for your suggestion, we will confirm this part again.

> 
> > +static void rtase_sw_reset(struct net_device *dev) {
> > +     struct rtase_private *tp = netdev_priv(dev);
> > +     int ret;
> > +
> > +     netif_stop_queue(dev);
> > +     netif_carrier_off(dev);
> > +     rtase_hw_reset(dev);
> > +
> > +     /* let's wait a bit while any (async) irq lands on */
> > +     rtase_wait_for_quiescence(dev);
> > +     rtase_tx_clear(tp);
> > +     rtase_rx_clear(tp);
> > +
> > +     ret = rtase_init_ring(dev);
> > +     if (ret)
> > +             netdev_alert(dev, "unable to init ring\n");
> > +
> > +     rtase_hw_config(dev);
> > +     /* always link, so start to transmit & receive */
> > +     rtase_hw_start(dev);
> > +
> > +     netif_carrier_on(dev);
> > +     netif_wake_queue(dev);
> > +}
> > +
> > +static void rtase_tx_timeout(struct net_device *dev, unsigned int
> > +txqueue) {
> > +     rtase_sw_reset(dev);
> 
> Do you actually see this happening? The timeout is set pretty high, i think 5
> seconds. If it does happen, it probably means you have a hardware/firmware
> bug. So you want to be noisy here, so you get to know about these problems,
> rather than silently work around them.

I would like to ask if we can dump some information that will help us understand the cause of the problem before doing the reset? And should we use netdev_warn to print this information?

> 
> > +static int rtase_setup_tc(struct net_device *dev, enum tc_setup_type type,
> > +                       void *type_data) {
> > +     struct rtase_private *tp = netdev_priv(dev);
> > +     int ret = 0;
> > +
> > +     switch (type) {
> > +     case TC_SETUP_QDISC_MQPRIO:
> > +             break;
> > +     case TC_SETUP_BLOCK:
> > +             break;
> 
> This looks odd. You silently return 0, doing nothing?

Thank you for your reminder, we will remove it.

> 
> > +     case TC_SETUP_QDISC_CBS:
> > +             ret = rtase_setup_tc_cbs(tp, type_data);
> > +             break;
> > +     default:
> > +             return -EOPNOTSUPP;
> > +     }
> > +
> > +     return ret;
> > +}
> > +
> > +static netdev_features_t rtase_fix_features(struct net_device *dev,
> > +                                         netdev_features_t
> features)
> > +{
> > +     netdev_features_t features_fix = features;
> > +
> > +     if (dev->mtu > MSS_MAX)
> > +             features_fix &= ~NETIF_F_ALL_TSO;
> > +
> > +     if (dev->mtu > ETH_DATA_LEN) {
> > +             features_fix &= ~NETIF_F_ALL_TSO;
> > +             features_fix &= ~NETIF_F_CSUM_MASK;
> > +     }
> 
> So the hardware does not support TSO and checksumming for jumbo frames?

This hardware supports checksumming for jumbo frames, but does not support TSO. We will modify this part, thank you.

> 
>    Andrew

  reply	other threads:[~2023-10-06  4:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 10:49 [PATCH net-next v9 00/13] Add Realtek automotive PCIe driver Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 01/13] net:ethernet:realtek:rtase: Add pci table supported in this module Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 02/13] net:ethernet:realtek:rtase: Implement the .ndo_open function Justin Lai
2023-09-28 12:57   ` Andrew Lunn
2023-10-03 12:40     ` Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 03/13] net:ethernet:realtek:rtase: Implement the rtase_down function Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 04/13] net:ethernet:realtek:rtase: Implement the interrupt routine and rtase_poll Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 05/13] net:ethernet:realtek:rtase: Implement hardware configuration function Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 06/13] net:ethernet:realtek:rtase: Implement .ndo_start_xmit function Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 07/13] net:ethernet:realtek:rtase: Implement a function to receive packets Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 08/13] net:ethernet:realtek:rtase: Implement net_device_ops Justin Lai
2023-09-28 14:02   ` Andrew Lunn
2023-10-06  4:02     ` Justin Lai [this message]
2023-10-06 13:44       ` Andrew Lunn
2023-10-16  1:49         ` Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 09/13] net:ethernet:realtek:rtase: Implement pci_driver suspend and resume function Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 10/13] net:ethernet:realtek:rtase: Implement ethtool function Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 11/13] net:ethernet:realtek:rtase: Add a Makefile in the rtase folder Justin Lai
2023-09-28 10:49 ` [PATCH net-next v9 12/13] net:ethernet:realtek: Update the Makefile and Kconfig in the realtek folder Justin Lai
2023-09-28 21:00   ` kernel test robot
2023-10-04 23:47   ` kernel test robot
2023-09-28 10:49 ` [PATCH net-next v9 13/13] 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=99dfcd7363dc412f877730fab4a9f7dd@realtek.com \
    --to=justinlai0215@realtek.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=larry.chiu@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pkshih@realtek.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