[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <874d99a1ed984ef09a332855bafaedb5@realtek.com>
Date: Fri, 28 Jun 2024 10:05:30 +0000
From: Justin Lai <justinlai0215@...ltek.com>
To: Joe Damato <jdamato@...tly.com>
CC: "kuba@...nel.org" <kuba@...nel.org>,
"davem@...emloft.net"
<davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"andrew@...n.ch" <andrew@...n.ch>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"horms@...nel.org" <horms@...nel.org>,
"rkannoth@...vell.com" <rkannoth@...vell.com>,
Ping-Ke Shih
<pkshih@...ltek.com>,
Larry Chiu <larry.chiu@...ltek.com>
Subject: RE: [PATCH net-next v21 02/13] rtase: Implement the .ndo_open function
>
> On Mon, Jun 24, 2024 at 02:28:10PM +0800, Justin Lai wrote:
>
> [...]
>
> > +static int rtase_open(struct net_device *dev) {
> > + struct rtase_private *tp = netdev_priv(dev);
> > + const struct pci_dev *pdev = tp->pdev;
> > + struct rtase_int_vector *ivec;
> > + u16 i = 0, j;
> > + int ret;
> > +
> > + ivec = &tp->int_vector[0];
> > + tp->rx_buf_sz = RTASE_RX_BUF_SIZE;
> > +
> > + ret = rtase_alloc_desc(tp);
> > + if (ret)
> > + return ret;
> > +
> > + 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;
> > +
> > + /* 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);
> > + ret = request_irq(ivec->irq, rtase_q_interrupt, 0,
> > + ivec->name, ivec);
> > + if (ret)
> > + goto err_free_all_allocated_irq;
> > + }
> > + } else {
> > + ret = request_irq(pdev->irq, rtase_interrupt, 0, dev->name,
> > + ivec);
> > + if (ret)
> > + goto err_free_all_allocated_mem;
> > + }
> > +
> > + rtase_hw_start(dev);
> > +
> > + for (i = 0; i < tp->int_nums; i++) {
> > + ivec = &tp->int_vector[i];
> > + napi_enable(&ivec->napi);
>
> nit / suggestion for the future (not to hold this back): it'd be nice to add support
> for netif_napi_set_irq and netif_queue_set_napi so that userland can use
> netdev-genl to get queue/irq/napi mappings.
Thank you for your suggestion, I will consider adding this feature in future versions.
Powered by blists - more mailing lists