> -----Original Message----- > From: Hyong Youb Kim (hyonkim) <hyon...@cisco.com> > Sent: Wednesday, July 17, 2019 11:26 AM > To: Nithin Kumar Dabilpuram <ndabilpu...@marvell.com>; David Marchand > <david.march...@redhat.com>; Thomas Monjalon > <tho...@monjalon.net>; Ferruh Yigit <ferruh.yi...@intel.com>; Bruce > Richardson <bruce.richard...@intel.com> > Cc: Jerin Jacob Kollanukkaran <jer...@marvell.com>; John Daley (johndale) > <johnd...@cisco.com>; Shahed Shaikh <shsha...@marvell.com>; > dev@dpdk.org > Subject: RE: [RFC PATCH v3 2/3] eal: add mask and unmask interrupt APIs > > +rte_intr_mask(const struct rte_intr_handle *intr_handle) { > > + if (intr_handle && intr_handle->type == RTE_INTR_HANDLE_VDEV) > > + return 0; > > + > > + if (!intr_handle || intr_handle->fd < 0 || intr_handle->uio_cfg_fd < > 0) > > + return -1; > > + > > + switch (intr_handle->type){ > > + /* Both masking and disabling are same for UIO */ > > + case RTE_INTR_HANDLE_UIO: > > + if (uio_intr_disable(intr_handle)) > > + return -1; > > + break; > > + case RTE_INTR_HANDLE_UIO_INTX: > > + if (uio_intx_intr_disable(intr_handle)) > > + return -1; > > + break; > > + /* not used at this moment */ > > + case RTE_INTR_HANDLE_ALARM: > > + return -1; > > +#ifdef VFIO_PRESENT > > + case RTE_INTR_HANDLE_VFIO_MSIX: > > + case RTE_INTR_HANDLE_VFIO_MSI: > > + return 0; > > Isn't this a little confusing? It returns success, but irq is not masked.
Yes. How about changing the API to rte_intr_ack()(Acknowledge the interrupt) Or something similar? i.e replace rte_intr_unmask() with rte_intr_ack() for this use case. > As is, return code 0 means... > - igb_uio: irq is masked for INTx, MSI, MSI-X > - vfio-pci + INTx: irq is masked > - vfio-pci + MSI/MSI-X: no changes > > Masking is useful only for INTx, IMO... > > Masking MSI/MSI-X via PCI-defined mechanisms (e.g. Mask bit in MSI-X > Table) has no practical use for drivers. Handshaking/masking/unmasking is > done via device/vendor specific ways, as needed. See all those > ack/block/unblock/credit/... mechanisms used in various drivers/NICs to > control interrupts their own way. > > A long time ago in early PCIe days, the linux kernel did auto-masking for > MSI/MSI-X (i.e. mask before calling netdev irq handler). It was soon removed > as it was unnecessary overhead (expensive PIOs to NIC for every interrupt). > Windows and FreeBSD do not do auto-masking either. rte_intr_ack() can abstract FreeBSD and Windows difference.