RE: [PATCH net-next v13 01/13] rtase: Add pci table supported in this module

From: Justin Lai
Date: Fri Dec 08 2023 - 04:28:18 EST


>
> On Wed, 6 Dec 2023 03:28:32 +0000 Justin Lai wrote:
> > > > +static void rtase_remove_one(struct pci_dev *pdev) {
> > > > + struct net_device *dev = pci_get_drvdata(pdev);
> > > > + struct rtase_private *tp = netdev_priv(dev);
> > > > + struct rtase_int_vector *ivec;
> > > > + u32 i;
> > > > +
> > > > + for (i = 0; i < tp->int_nums; i++) {
> > > > + ivec = &tp->int_vector[i];
> > > > + netif_napi_del(&ivec->napi);
> > >
> > > NAPI instances should be added on ndo_open()
> >
> > Do you want me to call netif_napi_add() in the .ndo_open function, and
> > netif_napi_del() in the .ndo_stop function? However, I saw that many
> > drivers do it in probe and remove. What is the purpose of doing this
> > in .ndo_open and .ndo_stop?
>
> They will sit in a fixed-size hash table used for NAPI lookup in the core. Not a
> big deal, but not the best way either.
>
> I think the main thing that prompted me to ask was that I couldn't find
> napi_disable() in the first few patches. You should probably call it on close,
> otherwise making sure NAPI is not running when you start freeing rings is hard.
> synchronize_irq() will not help you at all if you're using NAPI.

Thanks, I will call napi_disable() on close to fix this issue.