netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Justin Lai <justinlai0215@realtek.com>
To: Simon Horman <horms@kernel.org>
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>,
	"andrew@lunn.ch" <andrew@lunn.ch>,
	"jiri@resnulli.us" <jiri@resnulli.us>,
	Ping-Ke Shih <pkshih@realtek.com>,
	Larry Chiu <larry.chiu@realtek.com>
Subject: RE: [PATCH net-next v17 02/13] rtase: Implement the .ndo_open function
Date: Mon, 6 May 2024 02:45:11 +0000	[thread overview]
Message-ID: <745b2ee9e81f4904920e0e4fe6e4df89@realtek.com> (raw)
In-Reply-To: <20240503085257.GM2821784@kernel.org>

> 
> 
> On Thu, May 02, 2024 at 05:18:36PM +0800, Justin Lai wrote:
> > Implement the .ndo_open function to set default hardware settings and
> > initialize the descriptor ring and interrupts. Among them, when
> > requesting irq, because the first group of interrupts needs to process
> > more events, the overall structure will be different from other groups
> > of interrupts, so it needs to be processed separately.
> >
> > Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> 
> Hi Justin,
> 
> some minor feedback from my side.
> 
> > ---
> >  .../net/ethernet/realtek/rtase/rtase_main.c   | 419 ++++++++++++++++++
> >  1 file changed, 419 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > index 5ddb5f7abfe9..b286aac1eedc 100644
> > --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > @@ -130,6 +130,293 @@ static u32 rtase_r32(const struct rtase_private *tp,
> u16 reg)
> >       return readl(tp->mmio_addr + reg);  }
> >
> > +static void rtase_set_rxbufsize(struct rtase_private *tp) {
> > +     tp->rx_buf_sz = RTASE_RX_BUF_SIZE; }
> 
> I'm a big fan of helpers, but maybe it's better to just open-code this one as it is
> trivial and seems to only be used once.

OK, I understand what you mean, I will modify it.
> 
> > +
> > +     rtase_set_rxbufsize(tp);
> > +
> > +     ret = rtase_alloc_desc(tp);
> > +     if (ret)
> > +             goto err_free_all_allocated_mem;
> > +
> > +     ret = rtase_init_ring(dev);
> > +     if (ret)
> > +             goto err_free_all_allocated_mem;
> > +
> > +     rtase_hw_config(dev);
> > +
> > +     if (tp->sw_flag & RTASE_SWF_MSIX_ENABLED) {
> > +             ret = request_irq(ivec->irq, rtase_interrupt, 0,
> > +                               dev->name, ivec);
> > +             if (ret)
> > +                     goto err_free_all_allocated_irq;
> 
> This goto jumps to code that relies on i to set the bounds on a loop.
> However, i is not initialised here. Perhaps it should be set to 1?
> 
> Flagged by Smatch, and clang-18 W=1 builds.

Thank you for telling me the problem here, I will modify it.
> 
> > +
> > +             /* request other interrupts to handle multiqueue */
> > +             for (i = 1; i < tp->int_nums; i++) {
> > +                     ivec = &tp->int_vector[i];
> > +                     snprintf(ivec->name, sizeof(ivec->name),
> > + "%s_int%i", tp->dev->name, i);
> 
> nit: This line could trivially be split into two lines,
>      each less than 80 columns wide.
> 
I will check if there are other similar issues and make corrections.

  parent reply	other threads:[~2024-05-06  2:45 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  9:18 [PATCH net-next v17 00/13] Add Realtek automotive PCIe driver Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 01/13] rtase: Add pci table supported in this module Justin Lai
2024-05-03  9:33   ` Simon Horman
2024-05-06 11:32     ` Justin Lai
2024-05-08  8:39       ` Simon Horman
2024-05-02  9:18 ` [PATCH net-next v17 02/13] rtase: Implement the .ndo_open function Justin Lai
2024-05-03  8:52   ` Simon Horman
2024-05-03 10:19     ` Justin Lai
2024-05-03 11:03       ` Simon Horman
2024-05-06  2:39         ` Justin Lai
2024-05-06  2:45     ` Justin Lai [this message]
2024-05-08  8:36       ` Simon Horman
2024-05-02  9:18 ` [PATCH net-next v17 03/13] rtase: Implement the rtase_down function Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 04/13] rtase: Implement the interrupt routine and rtase_poll Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 05/13] rtase: Implement hardware configuration function Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 06/13] rtase: Implement .ndo_start_xmit function Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 07/13] rtase: Implement a function to receive packets Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 08/13] rtase: Implement net_device_ops Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 09/13] rtase: Implement pci_driver suspend and resume function Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 10/13] rtase: Implement ethtool function Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 11/13] rtase: Add a Makefile in the rtase folder Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 12/13] realtek: Update the Makefile and Kconfig in the realtek folder Justin Lai
2024-05-03  8:35   ` Simon Horman
2024-05-06  2:59     ` Justin Lai
2024-05-07  9:44     ` Justin Lai
2024-05-08  8:40       ` Simon Horman
2024-05-04 13:39   ` kernel test robot
2024-05-04 18:01   ` kernel test robot
2024-05-06 11:39     ` Justin Lai
2024-05-02  9:18 ` [PATCH net-next v17 13/13] MAINTAINERS: Add the rtase ethernet driver entry Justin Lai
2024-05-02 10:23 ` [PATCH net-next v17 00/13] Add Realtek automotive PCIe driver Simon Horman
2024-05-06  2:55   ` 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=745b2ee9e81f4904920e0e4fe6e4df89@realtek.com \
    --to=justinlai0215@realtek.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --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;
as well as URLs for NNTP newsgroup(s).