make rte_intr_handle internal
Subsystems (6)
PATCH v5 4/6 drivers: remove direct access to interrupt handle
In reply to Harman KalraRemoving direct access to interrupt handle structure fields, rather use respective get set APIs for the same. Making changes to all the drivers and libraries access the interrupt handle fields.
--- drivers/baseband/acc100/rte_acc100_pmd.c | 18 +-- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 21 ++-- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 21 ++-- drivers/bus/auxiliary/auxiliary_common.c | 2 + drivers/bus/auxiliary/linux/auxiliary.c | 10 ++ drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 ++++- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 16 ++- drivers/bus/fslmc/fslmc_vfio.c | 32 +++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 20 ++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 15 ++- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 21 ++-- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 73 +++++++---- drivers/bus/pci/linux/pci_vfio.c | 108 ++++++++++------ drivers/bus/pci/pci_common.c | 29 ++++- drivers/bus/pci/pci_common_uio.c | 21 ++-- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 37 ++++-- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 24 ++-- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +-- drivers/common/cnxk/roc_irq.c | 108 +++++++++------- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +++--- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 ++++++-- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +-- drivers/common/octeontx2/otx2_irq.c | 117 ++++++++++-------- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 ++- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +++-- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 47 ++++--- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 ++-- drivers/net/e1000/igb_ethdev.c | 79 ++++++------ drivers/net/ena/ena_ethdev.c | 35 +++--- drivers/net/enic/enic_main.c | 26 ++-- drivers/net/failsafe/failsafe.c | 23 +++- drivers/net/failsafe/failsafe_intr.c | 43 ++++--- drivers/net/failsafe/failsafe_ops.c | 19 ++- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 ++--- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 ++++----- drivers/net/hns3/hns3_ethdev_vf.c | 64 +++++----- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 ++++---- drivers/net/iavf/iavf_ethdev.c | 42 +++---- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 ++-- drivers/net/ice/ice_ethdev.c | 49 ++++---- drivers/net/igc/igc_ethdev.c | 45 ++++--- drivers/net/ionic/ionic_ethdev.c | 17 +-- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +++++----- drivers/net/memif/memif_socket.c | 111 ++++++++++++----- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 61 +++++++-- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 ++- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 ++++--- drivers/net/mlx5/linux/mlx5_os.c | 53 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 25 ++-- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 42 ++++--- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 26 ++-- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 ++--- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 ++--- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +++--- drivers/net/qede/qede_ethdev.c | 16 +-- drivers/net/sfc/sfc_intr.c | 30 ++--- drivers/net/tap/rte_eth_tap.c | 36 ++++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +++-- drivers/net/thunderx/nicvf_ethdev.c | 12 ++ drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +++--- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 76 +++++++----- drivers/net/virtio/virtio_ethdev.c | 21 ++-- .../net/virtio/virtio_user/virtio_user_dev.c | 48 ++++--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 ++++--- drivers/raw/ifpga/ifpga_rawdev.c | 62 +++++++--- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 10 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 ++-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 45 ++++--- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/freebsd/eal_alarm.c | 46 ++++++- lib/eal/include/rte_eal_trace.h | 24 +--- lib/eal/linux/eal_alarm.c | 30 +++-- lib/eal/linux/eal_dev.c | 63 ++++++---- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +-- 118 files changed, 1818 insertions(+), 1221 deletions(-)
drivers/baseband/acc100/rte_acc100_pmd.c +11 -7
@@ -720,8 +720,10 @@ acc100_intr_enable(struct rte_bbdev *dev)struct acc100_device *d = dev->data->dev_private;/* Only MSI are currently supported */ -if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || - dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ) { +if (rte_intr_type_get (dev->intr_handle) == +RTE_INTR_HANDLE_VFIO_MSI || +rte_intr_type_get (dev->intr_handle) == +RTE_INTR_HANDLE_UIO ) { ret =allocate_info_ring (dev);if (ret <0 ) {
@@ -1098,8 +1100,9 @@ acc100_queue_intr_enable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) != +RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =1 ;
@@ -1111,8 +1114,9 @@ acc100_queue_intr_disable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) != +RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =0 ;
@@ -4185,7 +4189,7 @@ static int acc100_pci_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke ACC100 device initialization function */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +10 -11
@@ -744,16 +744,15 @@ fpga_intr_enable(struct rte_bbdev *dev)* invoked when any FPGA queue issues interrupt. */ for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -1880,7 +1879,7 @@ fpga_5gnr_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +10 -11
@@ -1015,16 +1015,15 @@ fpga_intr_enable(struct rte_bbdev *dev)* invoked when any FPGA queue issues interrupt. */ for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -2370,7 +2369,7 @@ fpga_lte_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/bus/auxiliary/auxiliary_common.c +2 -0
@@ -320,6 +320,8 @@ auxiliary_unplug(struct rte_device *dev)if (ret ==0 ) {rte_auxiliary_remove_device (adev);rte_devargs_remove (dev->devargs); +if (adev->intr_handle) +rte_intr_instance_free (adev->intr_handle);free (adev); }return ret;
drivers/bus/auxiliary/linux/auxiliary.c +10 -0
@@ -39,6 +39,14 @@ auxiliary_scan_one(const char *dirname, const char *name) dev->device.name = dev->name; dev->device.bus = &auxiliary_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) { +free (dev); +return -1 ; + } +/* Get NUMA node, default to 0 if not present */ snprintf (filename,sizeof (filename),"%s/%s/numa_node" , dirname, name);
@@ -67,6 +75,8 @@ auxiliary_scan_one(const char *dirname, const char *name)rte_devargs_remove (dev2->device.devargs);auxiliary_on_scan (dev2); } +if (dev->intr_handle) +rte_intr_instance_free (dev->intr_handle);free (dev); }return 0 ;
drivers/bus/auxiliary/rte_bus_auxiliary.h +1 -1
@@ -115,7 +115,7 @@ struct rte_auxiliary_device {RTE_TAILQ_ENTRY (rte_auxiliary_device) next;/**< Next probed device. */ struct rte_device device;/**< Inherit core device */ char name[RTE_DEV_NAME_MAX_LEN +1 ];/**< ASCII device name */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_auxiliary_driver *driver;/**< Device driver */ };
drivers/bus/dpaa/dpaa_bus.c +25 -3
@@ -172,6 +172,15 @@ dpaa_create_device_list(void) dev->device.bus = &rte_dpaa_bus.bus; +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + cfg = &dpaa_netcfg->port_cfg[i]; fman_intf = cfg->fman_if;
@@ -214,6 +223,15 @@ dpaa_create_device_list(void) goto cleanup; } +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + dev->device_type =FSL_DPAA_CRYPTO ; dev->id.dev_id = rte_dpaa_bus.device_count + i;
@@ -247,6 +265,7 @@ dpaa_clean_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {TAILQ_REMOVE (&rte_dpaa_bus.device_list, dev, next); +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -559,8 +578,11 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)return errno; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_EXT ; +if (rte_intr_fd_set (intr_handle, fd)) +return -rte_errno; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_EXT )) +return -rte_errno;return 0 ; }
@@ -612,7 +634,7 @@ rte_dpaa_bus_probe(void) TAILQ_FOREACH(dev, &rte_dpaa_bus.device_list, next) {if (dev->device_type ==FSL_DPAA_ETH ) { - ret =rte_dpaa_setup_intr (&dev->intr_handle); + ret =rte_dpaa_setup_intr (dev->intr_handle);if (ret)DPAA_BUS_ERR ("Error setting up interrupt.\n" ); }
drivers/bus/dpaa/rte_dpaa_bus.h +1 -1
@@ -98,7 +98,7 @@ struct rte_dpaa_device { };struct rte_dpaa_driver *driver;struct dpaa_device_id id; -struct rte_intr_handle intr_handle; +struct rte_intr_handle *intr_handle;enum rte_dpaa_type device_type;/**< Ethernet or crypto type device */ char name[RTE_ETH_NAME_MAX_LEN ]; };
drivers/bus/fslmc/fslmc_bus.c +15 -1
@@ -47,6 +47,8 @@ cleanup_fslmc_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, t_dev) {TAILQ_REMOVE (&rte_fslmc_bus.device_list, dev, next); +if (dev->intr_handle) +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -160,6 +162,15 @@ scan_one_fslmc_device(char *dev_name) dev->device.bus = &rte_fslmc_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } +/* Parse the device name and ID */ t_ptr =strtok (dup_dev_name,"." );if (!t_ptr) {
@@ -220,8 +231,11 @@ scan_one_fslmc_device(char *dev_name) cleanup:if (dup_dev_name)free (dup_dev_name); -if (dev) +if (dev) { +if (dev->intr_handle) +rte_intr_instance_free (dev->intr_handle);free (dev); + }return ret; }
drivers/bus/fslmc/fslmc_vfio.c +21 -11
@@ -599,7 +599,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)int len, ret;char irq_set_buf[IRQ_SET_BUF_LEN ];struct vfio_irq_set *irq_set; -int *fd_ptr; +int *fd_ptr, vfio_dev_fd; len =sizeof (irq_set_buf);
@@ -611,12 +611,14 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) irq_set->index = index; irq_set->start =0 ; fd_ptr = (int *)&irq_set->data; - *fd_ptr = intr_handle->fd; + *fd_ptr =rte_intr_fd_get (intr_handle); - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret) {DPAA2_BUS_ERR ("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)" , - intr_handle->fd, errno,strerror (errno)); +rte_intr_fd_get (intr_handle), errno, +strerror (errno));return ret; }
@@ -627,7 +629,7 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) {struct vfio_irq_set *irq_set;char irq_set_buf[IRQ_SET_BUF_LEN ]; -int len, ret; +int len, ret, vfio_dev_fd; len =sizeof (struct vfio_irq_set );
@@ -638,11 +640,12 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) irq_set->start =0 ; irq_set->count =0 ; - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret)DPAA2_BUS_ERR ("Error disabling dpaa2 interrupts for fd %d" , - intr_handle->fd); +rte_intr_fd_get (intr_handle));return ret; }
@@ -684,9 +687,16 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,return -1 ; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_VFIO_MSI ; - intr_handle->vfio_dev_fd = vfio_dev_fd; +if (rte_intr_fd_set (intr_handle, fd)) +return -rte_errno; + +if (rte_intr_type_set (intr_handle, +RTE_INTR_HANDLE_VFIO_MSI )) +return -rte_errno; + +if (rte_intr_dev_fd_set (intr_handle, vfio_dev_fd)) +return -rte_errno; +return 0 ; }
@@ -711,7 +721,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)switch (dev->dev_type) {case DPAA2_ETH : -rte_dpaa2_vfio_setup_intr (&dev->intr_handle, dev_fd, +rte_dpaa2_vfio_setup_intr (dev->intr_handle, dev_fd, device_info.num_irqs);break ;case DPAA2_CON :
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +16 -4
@@ -176,7 +176,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)int threshold =0x3 , timeout =0xFF ; dpio_epoll_fd =epoll_create (1 ); - ret =rte_dpaa2_intr_enable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_enable (dpio_dev->intr_handle,0 );if (ret) {DPAA2_BUS_ERR ("Interrupt registeration failed" );return -1 ;
@@ -195,7 +195,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)qbman_swp_dqrr_thrshld_write (dpio_dev->sw_portal, threshold);qbman_swp_intr_timeout_write (dpio_dev->sw_portal, timeout); - eventfd = dpio_dev->intr_handle.fd; + eventfd =rte_intr_fd_get (dpio_dev->intr_handle); epoll_ev.events =EPOLLIN |EPOLLPRI |EPOLLET ; epoll_ev.data.fd = eventfd;
@@ -213,7 +213,7 @@ static void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev) {int ret; - ret =rte_dpaa2_intr_disable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_disable (dpio_dev->intr_handle,0 );if (ret)DPAA2_BUS_ERR ("DPIO interrupt disable failed" );
@@ -388,6 +388,14 @@ dpaa2_create_dpio_device(int vdev_fd,/* Using single portal for all devices */ dpio_dev->mc_portal =dpaa2_get_mcp_ptr (MC_PORTAL_INDEX ); +/* Allocate interrupt instance */ + dpio_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (!dpio_dev->intr_handle) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + goto err; + } + dpio_dev->dpio =rte_zmalloc (NULL ,sizeof (struct fsl_mc_io ),RTE_CACHE_LINE_SIZE );if (!dpio_dev->dpio) {
@@ -490,7 +498,7 @@ dpaa2_create_dpio_device(int vdev_fd, io_space_count++; dpio_dev->index = io_space_count; -if (rte_dpaa2_vfio_setup_intr (&dpio_dev->intr_handle, vdev_fd,1 )) { +if (rte_dpaa2_vfio_setup_intr (dpio_dev->intr_handle, vdev_fd,1 )) {DPAA2_BUS_ERR ("Fail to setup interrupt for %d" , dpio_dev->hw_id); goto err;
@@ -538,6 +546,8 @@ dpaa2_create_dpio_device(int vdev_fd,rte_free (dpio_dev->dpio); } +if (dpio_dev->intr_handle) +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev);/* For each element in the list, cleanup */
@@ -549,6 +559,8 @@ dpaa2_create_dpio_device(int vdev_fd, dpio_dev->token);rte_free (dpio_dev->dpio); } +if (dpio_dev->intr_handle) +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev); }
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -1
@@ -116,7 +116,7 @@ struct dpaa2_dpio_dev {uintptr_t qbman_portal_ci_paddr;/**< Physical address of Cache Inhibit Area */ uintptr_t ci_size;/**< Size of the CI region */ -struct rte_intr_handle intr_handle;/* Interrupt related info */ +struct rte_intr_handle *intr_handle;/* Interrupt related info */ int32_t epoll_fd;/**< File descriptor created for interrupt polling */ int32_t hw_id;/**< An unique ID of this DPIO device instance */ struct dpaa2_portal_dqrr dpaa2_held_bufs;
drivers/bus/fslmc/rte_fslmc.h +1 -1
@@ -122,7 +122,7 @@ struct rte_dpaa2_device { };enum rte_dpaa2_dev_type dev_type;/**< Device Type */ uint16_t object_id;/**< DPAA2 Object ID */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_dpaa2_driver *driver;/**< Associated driver */ char name[FSLMC_OBJECT_MAX_LEN ];/**< DPAA2 Object name*/ };
drivers/bus/ifpga/ifpga_bus.c +14 -1
@@ -161,6 +161,14 @@ ifpga_scan_one(struct rte_rawdev *rawdev, afu_dev->id.uuid.uuid_high =0 ; afu_dev->id.port = afu_pr_conf.afu_id.port; +/* Allocate interrupt instance */ + afu_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!afu_dev->intr_handle) { +IFPGA_BUS_ERR ("Failed to allocate intr handle" ); + goto end; + } +if (rawdev->dev_ops && rawdev->dev_ops->dev_info_get) rawdev->dev_ops->dev_info_get (rawdev, afu_dev,sizeof (*afu_dev));
@@ -189,8 +197,11 @@ ifpga_scan_one(struct rte_rawdev *rawdev,rte_kvargs_free (kvlist);if (path)free (path); -if (afu_dev) +if (afu_dev) { +if (afu_dev->intr_handle) +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev); + }return NULL ; }
@@ -396,6 +407,8 @@ ifpga_unplug(struct rte_device *dev)TAILQ_REMOVE (&ifpga_afu_dev_list, afu_dev, next);rte_devargs_remove (dev->devargs); +if (afu_dev->intr_handle) +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev);return 0 ;
drivers/bus/ifpga/rte_bus_ifpga.h +1 -1
@@ -79,7 +79,7 @@ struct rte_afu_device {struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< AFU Memory Resource */ struct rte_afu_shared shared; -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_afu_driver *driver;/**< Associated driver */ char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN ]; } __rte_packed;
drivers/bus/pci/bsd/pci.c +14 -7
@@ -95,10 +95,11 @@ pci_uio_free_resource(struct rte_pci_device *dev, {rte_free (uio_res); -if (dev->intr_handle.fd) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle)) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle, +RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -121,13 +122,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, }/* save fd if in primary process */ - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { +if (rte_intr_fd_set (dev->intr_handle,open (devname,O_RDWR ))) { +RTE_LOG (WARNING ,EAL ,"Failed to save fd" ); + goto error; + } + +if (rte_intr_fd_get (dev->intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot open %s: %s\n" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO ; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UIO )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/pci/linux/pci.c +2 -2
@@ -645,7 +645,7 @@ int rte_pci_read_config(const struct rte_pci_device *device, void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
@@ -669,7 +669,7 @@ int rte_pci_write_config(const struct rte_pci_device *device, const void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
drivers/bus/pci/linux/pci_uio.c +49 -24
142 lines not on this page · raw message
drivers/bus/pci/linux/pci_vfio.c +70 -38
245 lines not on this page · raw message
drivers/bus/pci/pci_common.c +27 -2
@@ -230,6 +230,24 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, }if (!already_probed && (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING )) { +/* Allocate interrupt instance for pci device */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) { +RTE_LOG (ERR ,EAL , +"Failed to create interrupt instance for %s\n" , + dev->device.name); +return -ENOMEM ; + } + + dev->vfio_req_intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->vfio_req_intr_handle) { +RTE_LOG (ERR ,EAL , +"Failed to create vfio req interrupt instance for %s\n" , + dev->device.name); +return -ENOMEM ; + }/* map resources for devices that use igb_uio */ ret =rte_pci_map_device (dev);if (ret !=0 ) {
@@ -253,8 +271,12 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,* driver needs mapped resources. */ !(ret > 0 && - (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) + (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) {rte_pci_unmap_device (dev); +rte_intr_instance_free (dev->intr_handle); +rte_intr_instance_free ( + dev->vfio_req_intr_handle); + } }else { dev->device.driver = &dr->driver; }
@@ -296,9 +318,12 @@ rte_pci_detach_dev(struct rte_pci_device *dev) dev->driver =NULL ; dev->device.driver =NULL ; -if (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING ) +if (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING ) {/* unmap resources for devices that use igb_uio */ rte_pci_unmap_device (dev); +rte_intr_instance_free (dev->intr_handle); +rte_intr_instance_free (dev->vfio_req_intr_handle); + }return 0 ; }
drivers/bus/pci/pci_common_uio.c +13 -8
@@ -90,8 +90,11 @@ pci_uio_map_resource(struct rte_pci_device *dev)struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -207,6 +210,7 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)struct mapped_pci_resource *uio_res;struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); +int uio_cfg_fd;if (dev ==NULL )return ;
@@ -229,12 +233,13 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); + uio_cfg_fd =rte_intr_dev_fd_get (dev->intr_handle); +if (uio_cfg_fd >=0 ) { +close (uio_cfg_fd); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/bus/pci/rte_bus_pci.h +2 -2
@@ -69,12 +69,12 @@ struct rte_pci_device {struct rte_pci_id id;/**< PCI ID. */ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< PCI Memory Resource */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_pci_driver *driver;/**< PCI driver used in probing */ uint16_t max_vfs;/**< sriov enable if not zero */ enum rte_pci_kernel_driver kdrv;/**< Kernel driver passthrough */ char name[PCI_PRI_STR_SIZE +1 ];/**< PCI location (ASCII) */ -struct rte_intr_handle vfio_req_intr_handle; +struct rte_intr_handle *vfio_req_intr_handle;/**< Handler of VFIO request interrupt */ };
drivers/bus/vmbus/linux/vmbus_bus.c +6 -0
@@ -299,6 +299,12 @@ vmbus_scan_one(const char *name) dev->device.devargs =vmbus_devargs_lookup (dev); +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!dev->intr_handle) + goto error; +/* device is valid, add in list (sorted) */ VMBUS_LOG (DEBUG ,"Adding vmbus device %s" , name);
drivers/bus/vmbus/linux/vmbus_uio.c +24 -13
@@ -30,9 +30,11 @@ static void *vmbus_map_addr;/* Control interrupts */ void vmbus_uio_irq_control (struct rte_vmbus_device *dev,int32_t onoff) { -if (write (dev->intr_handle.fd, &onoff,sizeof (onoff)) <0 ) { +if (write (rte_intr_fd_get (dev->intr_handle), &onoff, +sizeof (onoff)) <0 ) {VMBUS_LOG (ERR ,"cannot write to %d:%s" , - dev->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (dev->intr_handle), +strerror (errno)); } }
@@ -41,7 +43,8 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)int32_t count;int cc; - cc =read (dev->intr_handle.fd, &count,sizeof (count)); + cc =read (rte_intr_fd_get (dev->intr_handle), &count, +sizeof (count));if (cc < (int )sizeof (count)) {if (cc <0 ) { VMBUS_LOG(ERR, "IRQ read failed %s",
@@ -61,15 +64,16 @@ vmbus_uio_free_resource(struct rte_vmbus_device *dev, {rte_free (uio_res); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } -if (dev->intr_handle.fd >=0 ) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle, +RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -78,16 +82,23 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, struct mapped_vmbus_resource **uio_res) {char devname[PATH_MAX ];/* contains the /dev/uioX */ +int fd;/* save fd if in primary process */ snprintf (devname,sizeof (devname),"/dev/uio%u" , dev->uio_num); - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { + fd =open (devname,O_RDWR ); +if (fd <0 ) {VMBUS_LOG (ERR ,"Cannot open %s: %s" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO_INTX ; + +if (rte_intr_fd_set (dev->intr_handle, fd)) + goto error; + +if (rte_intr_type_set (dev->intr_handle, +RTE_INTR_HANDLE_UIO_INTX )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/vmbus/rte_bus_vmbus.h +1 -1
@@ -73,7 +73,7 @@ struct rte_vmbus_device {struct vmbus_channel *primary;/**< VMBUS primary channel */ struct vmbus_mon_page *monitor_page;/**< VMBUS monitor page */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_mem_resource resource[VMBUS_MAX_RESOURCE ]; };
drivers/bus/vmbus/vmbus_common_uio.c +15 -9
@@ -171,9 +171,15 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)int ret;/* TODO: handle rescind */ - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_type_set (dev->intr_handle, +RTE_INTR_HANDLE_UNKNOWN )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -253,12 +259,12 @@ vmbus_uio_unmap_resource(struct rte_vmbus_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/common/cnxk/roc_cpt.c +4 -4
@@ -65,7 +65,7 @@ cpt_lf_register_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -85,7 +85,7 @@ cpt_lf_unregister_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -129,7 +129,7 @@ cpt_lf_register_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
@@ -152,7 +152,7 @@ cpt_lf_unregister_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
drivers/common/cnxk/roc_dev.c +7 -7
@@ -641,7 +641,7 @@ roc_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -691,7 +691,7 @@ mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static int mbox_register_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -724,7 +724,7 @@ mbox_register_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -755,7 +755,7 @@ mbox_unregister_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -839,7 +839,7 @@ roc_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;plt_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -860,7 +860,7 @@ vf_flr_unregister_irqs(struct plt_pci_device *pci_dev, struct dev *dev)static int vf_flr_register_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *handle = &pci_dev->intr_handle; +struct plt_intr_handle *handle = pci_dev->intr_handle;int i, rc;plt_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1211,7 +1211,7 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)int dev_fini (struct dev *dev,struct plt_pci_device *pci_dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;struct mbox *mbox;/* Check if this dev hosts npalf and has 1+ refs */
drivers/common/cnxk/roc_irq.c +63 -45
220 lines not on this page · raw message
drivers/common/cnxk/roc_nix_inl_dev_irq.c +4 -4
@@ -99,7 +99,7 @@ nix_inl_sso_hws_irq(void *param)int nix_inl_sso_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -147,7 +147,7 @@ nix_inl_sso_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_sso_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -282,7 +282,7 @@ nix_inl_nix_err_irq(void *param)int nix_inl_nix_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;int rc;
@@ -331,7 +331,7 @@ nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_nix_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;
drivers/common/cnxk/roc_nix_irq.c +19 -17
@@ -82,7 +82,7 @@ nix_lf_err_irq(void *param)static int nix_lf_register_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -99,7 +99,7 @@ nix_lf_register_err_irq(struct nix *nix)static void nix_lf_unregister_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -131,7 +131,7 @@ nix_lf_ras_irq(void *param)static int nix_lf_register_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -148,7 +148,7 @@ nix_lf_register_ras_irq(struct nix *nix)static void nix_lf_unregister_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -300,7 +300,7 @@ roc_nix_register_queue_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;/* Figure out max qintx required */ rqs =PLT_MIN (nix->qints, nix->nb_rx_queues);
@@ -352,7 +352,7 @@ roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_qints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_QINT_START + q;
@@ -382,7 +382,7 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle; nix->configured_cints =PLT_MIN (nix->cints, nix->nb_rx_queues);
@@ -414,19 +414,19 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)return rc; } -if (!handle->intr_vec) { - handle->intr_vec =plt_zmalloc ( - nix->configured_cints *sizeof (int ),0 ); -if (!handle->intr_vec) { -plt_err ("Failed to allocate %d rx intr_vec" , - nix->configured_cints); -return -ENOMEM ; - } + rc =plt_intr_vec_list_alloc (handle,"cnxk" , + nix->configured_cints); +if (rc) { +plt_err ("Fail to allocate intr vec list, rc=%d" , + rc); +return rc; }/* VFIO vector zero is resereved for misc interrupt so * doing required adjustment. (b13bfab4cd) */ - handle->intr_vec[q] =PLT_INTR_VEC_RXTX_OFFSET + vec; +if (plt_intr_vec_list_index_set (handle, q, +PLT_INTR_VEC_RXTX_OFFSET + vec)) +return -1 ;/* Configure CQE interrupt coalescing parameters */ plt_write64(((CQ_CQE_THRESH_DEFAULT) |
@@ -450,7 +450,7 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_cints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_CINT_START + q;
@@ -465,6 +465,8 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)dev_irq_unregister (handle, nix_lf_cq_irq, &nix->cints_mem[q], vec); } + +plt_intr_vec_list_free (handle);plt_free (nix->cints_mem); }
drivers/common/cnxk/roc_npa.c +1 -1
@@ -710,7 +710,7 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/common/cnxk/roc_platform.h +38 -11
69 lines not on this page · raw message
drivers/common/cnxk/roc_sso.c +2 -2
@@ -505,7 +505,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } - rc =sso_register_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, nb_hws, + rc =sso_register_irqs_priv (roc_sso, sso->pci_dev->intr_handle, nb_hws, nb_hwgrp);if (rc <0 ) {plt_err ("Failed to register SSO LF IRQs" );
@@ -535,7 +535,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)if (!roc_sso->nb_hws && !roc_sso->nb_hwgrp)return ; -sso_unregister_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, +sso_unregister_irqs_priv (roc_sso, sso->pci_dev->intr_handle, roc_sso->nb_hws, roc_sso->nb_hwgrp);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWS , roc_sso->nb_hws);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWGRP , roc_sso->nb_hwgrp);
drivers/common/cnxk/roc_tim.c +2 -2
@@ -200,7 +200,7 @@ roc_tim_lf_alloc(struct roc_tim *roc_tim, uint8_t ring_id, uint64_t *clk)if (clk) *clk = rsp->tenns_clk; - rc =tim_register_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, + rc =tim_register_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]);if (rc <0 ) {plt_tim_dbg ("Failed to register Ring[%d] IRQ" , ring_id);
@@ -223,7 +223,7 @@ roc_tim_lf_free(struct roc_tim *roc_tim, uint8_t ring_id)struct tim_ring_req *req;int rc = -ENOSPC ; -tim_unregister_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, +tim_unregister_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]); req =mbox_alloc_msg_tim_lf_free (dev->mbox);
drivers/common/octeontx2/otx2_dev.c +7 -7
@@ -643,7 +643,7 @@ otx2_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -693,7 +693,7 @@ mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int mbox_register_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -726,7 +726,7 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -758,7 +758,7 @@ mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ otx2_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -841,7 +841,7 @@ otx2_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;otx2_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -862,7 +862,7 @@ vf_flr_unregister_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int vf_flr_register_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int i, rc;otx2_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1039,7 +1039,7 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev)void otx2_dev_fini (struct rte_pci_device *pci_dev,void *otx2_dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct otx2_dev *dev = otx2_dev;struct otx2_idev_cfg *idev;struct otx2_mbox *mbox;
drivers/common/octeontx2/otx2_irq.c +68 -49
231 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +2 -2
@@ -36,7 +36,7 @@ otx2_cpt_lf_err_intr_unregister(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;/* Disable error interrupts */ otx2_write64 (~0ull , base +OTX2_CPT_LF_MISC_INT_ENA_W1C );
@@ -65,7 +65,7 @@ otx2_cpt_lf_err_intr_register(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int ret;/* Disable error interrupts */
drivers/event/octeontx2/otx2_evdev_irq.c +6 -6
@@ -29,7 +29,7 @@ sso_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -66,7 +66,7 @@ ssow_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -86,7 +86,7 @@ sso_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -101,7 +101,7 @@ ssow_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -198,7 +198,7 @@ static int tim_lf_register_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
@@ -226,7 +226,7 @@ static void tim_lf_unregister_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
drivers/mempool/octeontx2/otx2_mempool.c +1 -1
@@ -301,7 +301,7 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/net/atlantic/atl_ethdev.c +8 -12
@@ -359,7 +359,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) {struct atl_adapter *adapter = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);int err =0 ;
@@ -478,7 +478,7 @@ atl_dev_start(struct rte_eth_dev *dev) {struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;int status;int err;
@@ -524,10 +524,9 @@ atl_dev_start(struct rte_eth_dev *dev) } } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ;
@@ -607,7 +606,7 @@ atl_dev_stop(struct rte_eth_dev *dev)struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;PMD_INIT_FUNC_TRACE (); dev->data->dev_started =0 ;
@@ -637,10 +636,7 @@ atl_dev_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -691,7 +687,7 @@ static int atl_dev_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw;int ret;
drivers/net/avp/avp_ethdev.c +4 -4
@@ -711,7 +711,7 @@ avp_dev_interrupt_handler(void *data) status);/* re-enable UIO interrupt handling */ - ret =rte_intr_ack (&pci_dev->intr_handle); + ret =rte_intr_ack (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to re-enable UIO interrupts, ret=%d\n" , ret);
@@ -730,7 +730,7 @@ avp_dev_enable_interrupts(struct rte_eth_dev *eth_dev)return -EINVAL ;/* enable UIO interrupt handling */ - ret =rte_intr_enable (&pci_dev->intr_handle); + ret =rte_intr_enable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to enable UIO interrupts, ret=%d\n" , ret);
@@ -759,7 +759,7 @@ avp_dev_disable_interrupts(struct rte_eth_dev *eth_dev) RTE_PTR_ADD(registers, RTE_AVP_INTERRUPT_MASK_OFFSET));/* enable UIO interrupt handling */ - ret =rte_intr_disable (&pci_dev->intr_handle); + ret =rte_intr_disable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to disable UIO interrupts, ret=%d\n" , ret);
@@ -776,7 +776,7 @@ avp_dev_setup_interrupts(struct rte_eth_dev *eth_dev)int ret;/* register a callback handler with UIO for interrupt notifications */ - ret =rte_intr_callback_register (&pci_dev->intr_handle, + ret =rte_intr_callback_register (pci_dev->intr_handle, avp_dev_interrupt_handler, (void *)eth_dev);if (ret <0 ) {
drivers/net/axgbe/axgbe_ethdev.c +6 -6
@@ -313,7 +313,7 @@ axgbe_dev_interrupt_handler(void *param) } }/* Unmask interrupts since disabled after generation */ -rte_intr_ack (&pdata->pci_dev->intr_handle); +rte_intr_ack (pdata->pci_dev->intr_handle); }/*
@@ -374,7 +374,7 @@ axgbe_dev_start(struct rte_eth_dev *dev) }/* enable uio/vfio intr/eventfd mapping */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);/* phy start*/ pdata->phy_if.phy_start (pdata);
@@ -406,7 +406,7 @@ axgbe_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE (); -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);if (rte_bit_relaxed_get32 (AXGBE_STOPPED , &pdata->dev_state))return 0 ;
@@ -2311,7 +2311,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)return ret; } -rte_intr_callback_register (&pci_dev->intr_handle, +rte_intr_callback_register (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
@@ -2335,8 +2335,8 @@ axgbe_dev_close(struct rte_eth_dev *eth_dev)axgbe_dev_clear_queues (eth_dev);/* disable uio intr before callback unregister */ -rte_intr_disable (&pci_dev->intr_handle); -rte_intr_callback_unregister (&pci_dev->intr_handle, +rte_intr_disable (pci_dev->intr_handle); +rte_intr_callback_unregister (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev);
drivers/net/axgbe/axgbe_mdio.c +3 -3
@@ -933,7 +933,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }/* Disable auto-negotiation interrupt */ -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);/* Start auto-negotiation in a supported mode */ if (axgbe_use_mode (pdata,AXGBE_MODE_KR )) {
@@ -951,7 +951,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }else if (axgbe_use_mode (pdata,AXGBE_MODE_SGMII_100 )) {axgbe_set_mode (pdata,AXGBE_MODE_SGMII_100 ); }else { -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);return -EINVAL ; }
@@ -964,7 +964,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) pdata->kx_state =AXGBE_RX_BPA ;/* Re-enable auto-negotiation interrupt */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);axgbe_an37_enable_interrupts (pdata);axgbe_an_init (pdata);
drivers/net/bnx2x/bnx2x_ethdev.c +5 -5
@@ -134,7 +134,7 @@ bnx2x_interrupt_handler(void *param)PMD_DEBUG_PERIODIC_LOG (INFO , sc,"Interrupt handled" );bnx2x_interrupt_action (dev,1 ); -rte_intr_ack (&sc->pci_dev->intr_handle); +rte_intr_ack (sc->pci_dev->intr_handle); }static void bnx2x_periodic_start (void *param)
@@ -230,10 +230,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev) }if (IS_PF (sc)) { -rte_intr_callback_register (&sc->pci_dev->intr_handle, +rte_intr_callback_register (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev); -if (rte_intr_enable (&sc->pci_dev->intr_handle)) +if (rte_intr_enable (sc->pci_dev->intr_handle))PMD_DRV_LOG (ERR , sc,"rte_intr_enable failed" ); }
@@ -258,8 +258,8 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)bnx2x_dev_rxtx_init_dummy (dev);if (IS_PF (sc)) { -rte_intr_disable (&sc->pci_dev->intr_handle); -rte_intr_callback_unregister (&sc->pci_dev->intr_handle, +rte_intr_disable (sc->pci_dev->intr_handle); +rte_intr_callback_unregister (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev);/* stop the periodic callout */
drivers/net/bnxt/bnxt_ethdev.c +14 -19
@@ -729,7 +729,7 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp)static int bnxt_start_nic (struct bnxt *bp) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (bp->eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;uint32_t queue_id, base =BNXT_MISC_VEC_ID ;uint32_t vec =BNXT_MISC_VEC_ID ;
@@ -846,26 +846,24 @@ static int bnxt_start_nic(struct bnxt *bp)return rc; } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - bp->eth_dev->data->nb_rx_queues * -sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + bp->eth_dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , bp->eth_dev->data->nb_rx_queues); rc = -ENOMEM ; goto err_out; } -PMD_DRV_LOG (DEBUG ,"intr_handle->intr_vec = %p " -"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n" , - intr_handle->intr_vec, intr_handle->nb_efd, - intr_handle->max_intr); +PMD_DRV_LOG (DEBUG ,"intr_handle->nb_efd = %d " +"intr_handle->max_intr = %d\n" , +rte_intr_nb_efd_get (intr_handle), +rte_intr_max_intr_get (intr_handle));for (queue_id =0 ; queue_id < bp->eth_dev->data->nb_rx_queues; queue_id++) { - intr_handle->intr_vec[queue_id] = - vec +BNXT_RX_VEC_START ; -if (vec < base + intr_handle->nb_efd -1 ) +rte_intr_vec_list_index_set (intr_handle, + queue_id, vec +BNXT_RX_VEC_START ); +if (vec < base +rte_intr_nb_efd_get (intr_handle) + -1 ) vec++; } }
@@ -1473,7 +1471,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) {struct bnxt *bp = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct rte_eth_link link;int ret;
@@ -1515,10 +1513,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)/* Clean queue intr-vector mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);bnxt_hwrm_port_clr_stats (bp);bnxt_free_tx_mbufs (bp);
drivers/net/bnxt/bnxt_irq.c +2 -2
@@ -67,7 +67,7 @@ void bnxt_int_handler(void *param)int bnxt_free_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
@@ -170,7 +170,7 @@ int bnxt_setup_int(struct bnxt *bp)int bnxt_request_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
drivers/net/dpaa/dpaa_ethdev.c +31 -16
94 lines not on this page · raw message
drivers/net/dpaa2/dpaa2_ethdev.c +5 -5
@@ -1145,7 +1145,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle; dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device); - intr_handle = &dpaa2_dev->intr_handle; + intr_handle = dpaa2_dev->intr_handle;PMD_INIT_FUNC_TRACE ();
@@ -1216,8 +1216,8 @@ dpaa2_dev_start(struct rte_eth_dev *dev) }/* if the interrupts were configured on this devices*/ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/* Registering LSC interrupt handler */ rte_intr_callback_register(intr_handle, dpaa2_interrupt_handler,
@@ -1256,8 +1256,8 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();/* reset interrupt callback */ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/*disable dpni irqs */ dpaa2_eth_setup_irqs (dev,0 );
drivers/net/e1000/em_ethdev.c +9 -14
@@ -237,7 +237,7 @@ static int eth_em_dev_init(struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct e1000_adapter *adapter =E1000_DEV_PRIVATE (eth_dev->data->dev_private); struct e1000_hw *hw =
@@ -523,7 +523,7 @@ eth_em_start(struct rte_eth_dev *dev)struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret, mask;uint32_t intr_vector =0 ;uint32_t *speeds;
@@ -573,12 +573,10 @@ eth_em_start(struct rte_eth_dev *dev) }if (rte_intr_dp_is_en (intr_handle)) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" -" intr_vec" , dev->data->nb_rx_queues); +" intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ; }
@@ -716,7 +714,7 @@ eth_em_stop(struct rte_eth_dev *dev)struct rte_eth_link link;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle; dev->data->dev_started =0 ;
@@ -750,10 +748,7 @@ eth_em_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -765,7 +760,7 @@ eth_em_close(struct rte_eth_dev *dev)struct e1000_adapter *adapter =E1000_DEV_PRIVATE (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -1006,7 +1001,7 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue {struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;em_rxq_intr_enable (hw);rte_intr_ack (intr_handle);
drivers/net/e1000/igb_ethdev.c +36 -43
215 lines not on this page · raw message
drivers/net/ena/ena_ethdev.c +19 -16
@@ -495,7 +495,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter)static int ena_close (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_adapter *adapter = dev->data->dev_private;int ret =0 ;
@@ -955,7 +955,7 @@ static int ena_stop(struct rte_eth_dev *dev)struct ena_adapter *adapter = dev->data->dev_private;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Cannot free memory in secondary process */
@@ -977,10 +977,9 @@ static int ena_stop(struct rte_eth_dev *dev)rte_intr_disable (intr_handle);rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +/* Cleanup vector list */ +rte_intr_vec_list_free (intr_handle);rte_intr_enable (intr_handle);
@@ -996,7 +995,7 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring)struct ena_adapter *adapter = ring->adapter;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_com_create_io_ctx ctx =/* policy set to _HOST just to satisfy icc compiler */ {ENA_ADMIN_PLACEMENT_POLICY_HOST ,
@@ -1016,7 +1015,10 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring) ena_qid =ENA_IO_RXQ_IDX (ring->id); ctx.direction =ENA_COM_IO_QUEUE_DIRECTION_RX ;if (rte_intr_dp_is_en (intr_handle)) - ctx.msix_vector = intr_handle->intr_vec[ring->id]; + ctx.msix_vector = +rte_intr_vec_list_index_get (intr_handle, + ring->id); +for (i =0 ; i < ring->ring_size; i++) ring->empty_rx_reqs[i] = i; }
@@ -1825,7 +1827,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) pci_dev->addr.devid, pci_dev->addr.function); - intr_handle = &pci_dev->intr_handle; + intr_handle = pci_dev->intr_handle; adapter->regs = pci_dev->mem_resource[ENA_REGS_BAR ].addr; adapter->dev_mem_base = pci_dev->mem_resource[ENA_MEM_BAR ].addr;
@@ -3113,7 +3115,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,static int ena_setup_rx_intr (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;uint16_t vectors_nb, i;bool rx_intr_requested = dev->data->dev_conf.intr_conf.rxq;
@@ -3140,9 +3142,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) goto enable_intr; } - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (*intr_handle->intr_vec),0 ); -if (intr_handle->intr_vec ==NULL ) { +/* Allocate the vector list */ +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate interrupt vector for %d queues\n" , dev->data->nb_rx_queues);
@@ -3161,7 +3163,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) }for (i =0 ; i < vectors_nb; ++i) - intr_handle->intr_vec[i] =RTE_INTR_VEC_RXTX_OFFSET + i; +if (rte_intr_vec_list_index_set (intr_handle, i, +RTE_INTR_VEC_RXTX_OFFSET + i)) + goto disable_intr_efd;rte_intr_enable (intr_handle);return 0 ;
@@ -3169,8 +3173,7 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) disable_intr_efd:rte_intr_efd_disable (intr_handle); free_intr_vec: -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; +rte_intr_vec_list_free (intr_handle); enable_intr:rte_intr_enable (intr_handle);return rc;
drivers/net/enic/enic_main.c +13 -13
@@ -448,7 +448,7 @@ enic_intr_handler(void *arg)rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_INTR_LSC ,NULL );enic_log_q_error (enic);/* Re-enable irq in case of INTx */ -rte_intr_ack (&enic->pdev->intr_handle); +rte_intr_ack (enic->pdev->intr_handle); }static int enic_rxq_intr_init (struct enic *enic)
@@ -477,14 +477,16 @@ static int enic_rxq_intr_init(struct enic *enic) " interrupts\n");return err; } - intr_handle->intr_vec =rte_zmalloc ("enic_intr_vec" , - rxq_intr_count *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { + +if (rte_intr_vec_list_alloc (intr_handle,"enic_intr_vec" , + rxq_intr_count)) {dev_err (enic,"Failed to allocate intr_vec\n" );return -ENOMEM ; }for (i =0 ; i < rxq_intr_count; i++) - intr_handle->intr_vec[i] = i +ENICPMD_RXQ_INTR_OFFSET ; +if (rte_intr_vec_list_index_set (intr_handle, i, + i +ENICPMD_RXQ_INTR_OFFSET )) +return -rte_errno;return 0 ; }
@@ -494,10 +496,8 @@ static void enic_rxq_intr_deinit(struct enic *enic) intr_handle = enic->rte_dev->intr_handle;rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +rte_intr_vec_list_free (intr_handle); }static void enic_prep_wq_for_simple_tx (struct enic *enic,uint16_t queue_idx)
@@ -667,10 +667,10 @@ int enic_enable(struct enic *enic)vnic_dev_enable_wait (enic->vdev);/* Register and enable error interrupt */ -rte_intr_callback_register (&(enic->pdev->intr_handle), +rte_intr_callback_register (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev); -rte_intr_enable (&(enic->pdev->intr_handle)); +rte_intr_enable (enic->pdev->intr_handle);/* Unmask LSC interrupt */ vnic_intr_unmask (&enic->intr[ENICPMD_LSC_INTR_OFFSET ]);
@@ -1111,8 +1111,8 @@ int enic_disable(struct enic *enic) (void )vnic_intr_masked (&enic->intr[i]);/* flush write */ }enic_rxq_intr_deinit (enic); -rte_intr_disable (&enic->pdev->intr_handle); -rte_intr_callback_unregister (&enic->pdev->intr_handle, +rte_intr_disable (enic->pdev->intr_handle); +rte_intr_callback_unregister (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev);
drivers/net/failsafe/failsafe.c +19 -4
@@ -264,11 +264,24 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) RTE_ETHER_ADDR_BYTES(mac)); dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; -PRIV (dev)->intr_handle = (struct rte_intr_handle ){ - .fd =-1 , - .type =RTE_INTR_HANDLE_EXT , - }; + +/* Allocate interrupt instance */ +PRIV (dev)->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (!PRIV (dev)->intr_handle) { +ERROR ("Failed to allocate intr handle" ); + goto cancel_alarm; + } + +if (rte_intr_fd_set (PRIV (dev)->intr_handle,-1 )) + goto cancel_alarm; + +if (rte_intr_type_set (PRIV (dev)->intr_handle, +RTE_INTR_HANDLE_EXT )) + goto cancel_alarm; +rte_eth_dev_probing_finish (dev); +return 0 ; cancel_alarm:failsafe_hotplug_alarm_cancel (dev);
@@ -297,6 +310,8 @@ fs_rte_eth_free(const char *name)return 0 ;/* port already released */ ret =failsafe_eth_dev_close (dev);rte_eth_dev_release_port (dev); +if (PRIV (dev)->intr_handle) +rte_intr_instance_free (PRIV (dev)->intr_handle);return ret; }
drivers/net/failsafe/failsafe_intr.c +24 -19
84 lines not on this page · raw message
drivers/net/failsafe/failsafe_ops.c +13 -6
@@ -393,15 +393,22 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,* For the time being, fake as if we are using MSIX interrupts, * this will cause rte_intr_efd_enable to allocate an eventfd for us. */ -struct rte_intr_handle intr_handle = { - .type =RTE_INTR_HANDLE_VFIO_MSIX , - .efds = {-1 , }, - }; +struct rte_intr_handle *intr_handle;struct sub_device *sdev;struct rxq *rxq;uint8_t i;int ret; + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_UNSHARED ); +if (!intr_handle) +return -ENOMEM ; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_VFIO_MSIX )) +return -rte_errno; + +if (rte_intr_efds_index_set (intr_handle,0 ,-1 )) +return -rte_errno; +fs_lock (dev,0 );if (rx_conf->rx_deferred_start) { FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
@@ -435,12 +442,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, rxq->info.nb_desc = nb_rx_desc; rxq->priv =PRIV (dev); rxq->sdev =PRIV (dev)->subs; - ret =rte_intr_efd_enable (&intr_handle,1 ); + ret =rte_intr_efd_enable (intr_handle,1 );if (ret <0 ) {fs_unlock (dev,0 );return ret; } - rxq->event_fd = intr_handle.efds[0 ]; + rxq->event_fd =rte_intr_efds_index_get (intr_handle,0 );
Lines of this file are not shown. View the raw message.
drivers/net/failsafe/failsafe_private.h +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/hns3/hns3_ethdev.c +27 -30
57 lines not on this page · raw message
drivers/net/hns3/hns3_ethdev_vf.c +32 -32
64 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +26 -27
53 lines not on this page · raw message
drivers/net/iavf/iavf_ethdev.c +21 -21
42 lines not on this page · raw message
drivers/net/ice/ice_ethdev.c +24 -25
49 lines not on this page · raw message
drivers/net/igc/igc_ethdev.c +21 -24
45 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethdev.c +30 -36
66 lines not on this page · raw message
drivers/net/memif/memif_socket.c +82 -29
111 lines not on this page · raw message
drivers/net/memif/rte_eth_memif.c +49 -12
61 lines not on this page · raw message
drivers/net/mlx4/mlx4_intr.c +29 -18
47 lines not on this page · raw message
drivers/net/mlx5/linux/mlx5_os.c +35 -18
53 lines not on this page · raw message
drivers/net/mlx5/mlx5_rxq.c +24 -18
42 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +17 -18
Lines of this file are not shown. View the raw message.
drivers/net/vhost/rte_eth_vhost.c +46 -30
76 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.c +33 -15
48 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethdev.c +23 -20
43 lines not on this page · raw message
drivers/raw/ifpga/ifpga_rawdev.c +46 -16
62 lines not on this page · raw message
drivers/regex/octeontx2/otx2_regexdev_hw_access.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +31 -14
45 lines not on this page · raw message
lib/eal/freebsd/eal_alarm.c +40 -6
46 lines not on this page · raw message
lib/eal/linux/eal_dev.c +40 -23
63 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.18.0
Part of the diff is not shown here. View the raw message.
PATCH v5 5/6 eal/interrupts: make interrupt handle structure opaque
In reply to Harman KalraMoving interrupt handle structure definition inside the c file to make its fields totally opaque to the outside world.
Dynamically allocating the efds and elist array os intr_handle structure, based on size provided by user. Eg size can be MSIX interrupts supported by a PCI device.
--- drivers/bus/pci/linux/pci_vfio.c | 7 + lib/eal/common/eal_common_interrupts.c | 190 +++++++++++++++++++++++-- lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 ---------- lib/eal/include/rte_interrupts.h | 22 ++- 5 files changed, 209 insertions(+), 83 deletions(-) delete mode 100644 lib/eal/include/rte_eal_interrupts.h
drivers/bus/pci/linux/pci_vfio.c +7 -0
@@ -266,6 +266,13 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)return -1 ; } +/* Reallocate the efds and elist fields of intr_handle based +* on PCI device MSIX size. +*/ +if (rte_intr_event_list_update (dev->intr_handle, + irq.count)) +return -1 ; +/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) {
lib/eal/common/eal_common_interrupts.c +181 -9
271 lines not on this page · raw message
lib/eal/include/meson.build +0 -1
@@ -49,7 +49,6 @@ headers += files( 'rte_version.h', 'rte_vfio.h', ) -indirect_headers += files('rte_eal_interrupts.h') # special case install the generic headers, since they go in a subdir generic_headers = files(
lib/eal/include/rte_eal_interrupts.h deleted +0 -72
72 lines not on this page · raw message
lib/eal/include/rte_interrupts.h +21 -1
@@ -33,7 +33,27 @@ struct rte_intr_handle;/** Interrupt instance could be shared within primary secondary process. */ #define RTE_INTR_INSTANCE_F_SHARED 0x00000002 -#include "rte_eal_interrupts.h" +#define RTE_MAX_RXTX_INTR_VEC_ID 512 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 + +/** +* The interrupt source type, e.g. UIO, VFIO, ALARM etc. +*/ +enum rte_intr_handle_type { +RTE_INTR_HANDLE_UNKNOWN =0 ,/**< generic unknown handle */ +RTE_INTR_HANDLE_UIO ,/**< uio device handle */ +RTE_INTR_HANDLE_UIO_INTX ,/**< uio generic handle */ +RTE_INTR_HANDLE_VFIO_LEGACY ,/**< vfio device handle (legacy) */ +RTE_INTR_HANDLE_VFIO_MSI ,/**< vfio device handle (MSI) */ +RTE_INTR_HANDLE_VFIO_MSIX ,/**< vfio device handle (MSIX) */ +RTE_INTR_HANDLE_ALARM ,/**< alarm handle */ +RTE_INTR_HANDLE_EXT ,/**< external handler */ +RTE_INTR_HANDLE_VDEV ,/**< virtual device */ +RTE_INTR_HANDLE_DEV_EVENT ,/**< device event handle */ +RTE_INTR_HANDLE_VFIO_REQ ,/**< VFIO request handle */ +RTE_INTR_HANDLE_MAX /**< count of elements */ +};/** Function to be registered for the specific interrupt */ typedef void (*rte_intr_callback_fn )(void *cb_arg);
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v5 5/6] eal/interrupts: make interrupt handle structure opaque
2021-10-23 02:19 (UTC+0530), Harman Kalra:
Quoted 38 lines
Moving interrupt handle structure definition inside the c file to make its fields totally opaque to the outside world.
Dynamically allocating the efds and elist array os
intr_handlestructure, based on size provided by user. Eg size can be MSIX interrupts supported by a PCI device.Signed-off-by Harman Kalra <[email protected]>--- drivers/bus/pci/linux/pci_vfio.c | 7 + lib/eal/common/eal_common_interrupts.c | 190 +++++++++++++++++++++++-- lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 ---------- lib/eal/include/rte_interrupts.h | 22 ++- 5 files changed, 209 insertions(+), 83 deletions(-) delete mode 100644 lib/eal/include/rte_eal_interrupts.hdrivers/bus/pci/linux/pci_vfio.c +0
-0lib/eal/include/rte_interrupts.h +10
-1@@ -33,7 +33,27 @@ struct rte_intr_handle;/** Interrupt instance could be shared within primary secondary process. */ #define RTE_INTR_INSTANCE_F_SHARED 0x00000002 -#include "rte_eal_interrupts.h" +#define RTE_MAX_RXTX_INTR_VEC_ID 512 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 + +/** +* The interrupt source type, e.g. UIO, VFIO, ALARM etc. +*/ +enum rte_intr_handle_type { +RTE_INTR_HANDLE_UNKNOWN =0 ,/**< generic unknown handle */ +RTE_INTR_HANDLE_UIO ,/**< uio device handle */
lib/eal/include/rte_interrupts.h struct rte_intr_handle; · line 55
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+RTE_INTR_HANDLE_UIO_INTX ,/**< uio generic handle */ +RTE_INTR_HANDLE_VFIO_LEGACY ,/**< vfio device handle (legacy) */ +RTE_INTR_HANDLE_VFIO_MSI ,/**< vfio device handle (MSI) */ +RTE_INTR_HANDLE_VFIO_MSIX ,/**< vfio device handle (MSIX) */ +RTE_INTR_HANDLE_ALARM ,/**< alarm handle */ +RTE_INTR_HANDLE_EXT ,/**< external handler */ +RTE_INTR_HANDLE_VDEV ,/**< virtual device */ +RTE_INTR_HANDLE_DEV_EVENT ,/**< device event handle */ +RTE_INTR_HANDLE_VFIO_REQ ,/**< VFIO request handle */ +RTE_INTR_HANDLE_MAX /**< count of elements */
Wasn't this member going to be removed since v1?
Ray, do you agree?
MAX enum members have been scheduled for removal long ago. This one even seems unlikely to be used as array size and break anything.
Quoted 4 lines
lib/eal/include/rte_interrupts.h +1
-0+};/** Function to be registered for the specific interrupt */ typedef void (*rte_intr_callback_fn )(void *cb_arg);
PATCH v5 6/6 eal/alarm: introduce alarm fini routine
In reply to Harman KalraImplementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
--- lib/eal/common/eal_private.h | 11 +++++++++++ lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 7 +++++++ lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 7 +++++++ 5 files changed, 27 insertions(+)
lib/eal/common/eal_private.h +11 -0
@@ -163,6 +163,17 @@ int rte_eal_intr_init(void);*/ int rte_eal_alarm_init (void ); +/** +* Init alarm mechanism. This is to allow a callback be called after +* specific time. +* +* This function is private to EAL. +* +* @return +* 0 on success, negative on error +*/ +void rte_eal_alarm_fini (void ); +/** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded.
lib/eal/freebsd/eal.c +1 -0
@@ -977,6 +977,7 @@ rte_eal_cleanup(void)rte_eal_memory_detach ();rte_trace_save ();eal_trace_fini (); +rte_eal_alarm_fini ();eal_cleanup_config (internal_conf);return 0 ; }
lib/eal/freebsd/eal_alarm.c +7 -0
@@ -46,6 +46,13 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;static struct rte_intr_handle *intr_handle;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_fini (void ) +{ +if (intr_handle) +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {
lib/eal/linux/eal.c +1 -0
@@ -1370,6 +1370,7 @@ rte_eal_cleanup(void)rte_eal_memory_detach ();rte_trace_save ();eal_trace_fini (); +rte_eal_alarm_fini ();eal_cleanup_config (internal_conf);return 0 ; }
lib/eal/linux/eal_alarm.c +7 -0
@@ -58,6 +58,13 @@ static struct rte_intr_handle *intr_handle;static int handler_registered =0 ;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_fini (void ) +{ +if (intr_handle) +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v5 6/6] eal/alarm: introduce alarm fini routine
2021-10-23 02:19 (UTC+0530), Harman Kalra:
Quoted 21 lines
Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
Signed-off-by Harman Kalra <[email protected]>--- lib/eal/common/eal_private.h | 11 +++++++++++ lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 7 +++++++ lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 7 +++++++ 5 files changed, 27 insertions(+)lib/eal/common/eal_private.h +1
-0@@ -163,6 +163,17 @@ int rte_eal_intr_init(void);*/ int rte_eal_alarm_init (void ); +/**
lib/eal/common/eal_private.h int rte_eal_intr_init(void); · line 176
Quoted 10 lines
lib/eal/common/eal_private.h +10
-0+* Init alarm mechanism. This is to allow a callback be called after +* specific time. +* +* This function is private to EAL. +* +* @return +* 0 on success, negative on error +*/ +void rte_eal_alarm_fini (void ); +
The description should say the opposite.
lib/eal/freebsd/eal.c rte_eal_cleanup(void) · line 980
Quoted 12 lines
lib/eal/common/eal_private.h +0
-0/** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded. lib/eal/freebsd/eal.c +1
-0@@ -977,6 +977,7 @@ rte_eal_cleanup(void)rte_eal_memory_detach ();rte_trace_save ();eal_trace_fini (); +rte_eal_alarm_fini ();
Alarms are initialized after tracing, so they should be finalized after.
Quoted 26 lines
lib/eal/freebsd/eal.c +0
-0eal_cleanup_config (internal_conf);return 0 ; }lib/eal/freebsd/eal_alarm.c +7
-0@@ -46,6 +46,13 @@ static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER;static struct rte_intr_handle *intr_handle;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_fini (void ) +{ +if (intr_handle) +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {lib/eal/linux/eal.c +0
-0
lib/eal/linux/eal.c rte_eal_cleanup(void) · line 1373
Quoted 4 lines
lib/eal/linux/eal.c +1
-0@@ -1370,6 +1370,7 @@ rte_eal_cleanup(void)rte_eal_memory_detach ();rte_trace_save ();eal_trace_fini (); +rte_eal_alarm_fini ();
Likewise.
Quoted 11 lines
lib/eal/linux/eal.c +0
-0eal_cleanup_config (internal_conf);return 0 ; }lib/eal/linux/eal_alarm.c +0
-0@@ -58,6 +58,13 @@ static struct rte_intr_handle *intr_handle;static int handler_registered =0 ;static void eal_alarm_callback (void *arg);
lib/eal/linux/eal_alarm.c static struct rte_intr_handle *intr_handle; · line 70
Quoted 10 lines
lib/eal/linux/eal_alarm.c +7
-0+void +rte_eal_alarm_fini (void ) +{ +if (intr_handle) +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {
That being fixed,
Re: [dpdk-dev] [PATCH v5 6/6] eal/alarm: introduce alarm fini routine
2021-10-23 02:33 (UTC+0300), Dmitry Kozlyuk:
Quoted 16 lines
2021-10-23 02:19 (UTC+0530), Harman Kalra:
[...]lib/eal/freebsd/eal.c rte_eal_cleanup(void) · line 980
Quoted 12 lines
/**
* Function is to check if the kernel module(like, vfio,vfio_iommu_type1,
* etc.) loaded.lib/eal/freebsd/eal.c +1
-0@@ -977,6 +977,7 @@ rte_eal_cleanup(void)rte_eal_memory_detach ();rte_trace_save ();eal_trace_fini (); +rte_eal_alarm_fini ();Alarms are initialized after tracing, so they should be finalized after.
"...finalized before", sorry.
v6 cover make rte_intr_handle internal
In reply to Harman KalraMoving struct rte_intr_handle as an internal structure to avoid any ABI breakages in future. Since this structure defines some static arrays and changing respective macros breaks the ABI. Eg:
Currently RTE_MAX_RXTX_INTR_VEC_ID imposes a limit of maximum 512 MSI-X interrupts that can be defined for a PCI device, while PCI specification allows maximum 2048 MSI-X interrupts that can be used. If some PCI device requires more than 512 vectors, either change the RTE_MAX_RXTX_INTR_VEC_ID limit or dynamically allocate based on PCI device MSI-X size on probe time. Either way its an ABI breakage.
Change already included in 21.11 ABI improvement spreadsheet (item 42):
https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_s
preadsheets_d_1betlC000ua5SsSiJIcC54mCCCJnW6voH5Dqv9UxeyfE_edit-23gid- 3D0&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V-7JdkxT_Z_SU6RrS37ys4U XudBQ_rrS5LRo&m=7dl3OmXU7QHMmWYB6V1hYJtq1cUkjfhXUwze2Si_48c&s=lh6DEGhR Bg1shODpAy3RQk-H-0uQx5icRfUBf9dtCp4&e=
This series makes struct rte_intr_handle totally opaque to the outside world by wrapping it inside a .c file and providing get set wrapper APIs to read or manipulate its fields.. Any changes to be made to any of the fields should be done via these get set APIs.
Introduced a new eal_common_interrupts.c where all these APIs are defined and also hides struct rte_intr_handle definition.
v1:
* Fixed freebsd compilation failure
* Fixed seg fault in case of memif
v2:
* Merged the prototype and implementation patch to 1.
* Restricting allocation of single interrupt instance.
* Removed base APIs, as they were exposing internally allocated memory information.
* Fixed some memory leak issues.
* Marked some library specific APIs as internal.
v3:
* Removed flag from instance alloc API, rather auto detect if memory should be allocated using glibc malloc APIs or rte_malloc*
* Added APIs for get/set windows handle.
* Defined macros for repeated checks.
v4:
* Rectified some typo in the APIs documentation.
* Better names for some internal variables.
v5:
* Reverted back to passing flag to instance alloc API, as with auto detect some multiprocess issues existing in the library were causing tests failure.
* Rebased to top of tree.
v6:
* renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
* changed API and removed need for alloc_flag content exposure (see rte_intr_instance_dup() in patch 1 and 2),
* exported all symbols for Windows,
* fixed leak in unit tests in case of alloc failure,
* split (previously) patch 4 into three patches
* (now) patch 4 only concerns alarm and (previously) patch 6 cleanup bits are squashed in it,
* (now) patch 5 concerns other libraries updates,
* (now) patch 6 concerns drivers updates:
* instance allocation is moved to probing for auxiliary,
* there might be a bug for PCI drivers non requesting RTE_PCI_DRV_NEED_MAPPING, but code is left as v5,
* split (previously) patch 5 into three patches
* (now) patch 7 only hides structure, but keep it in a EAL private header, this makes it possible to keep info in tracepoints,
* (now) patch 8 deals with VFIO/UIO internal fds merge,
* (now) patch 9 extends event list,
Signature · 153 lines
David Marchand Harman Kalra (9): interrupts: add allocator and accessors interrupts: remove direct access to interrupt handle test/interrupts: remove direct access to interrupt handle alarm: remove direct access to interrupt handle lib: remove direct access to interrupt handle drivers: remove direct access to interrupt handle interrupts: make interrupt handle structure opaque interrupts: rename device specific file descriptor interrupts: extend event list MAINTAINERS | 1 + app/test/test_interrupts.c | 164 +++-- drivers/baseband/acc100/rte_acc100_pmd.c | 14 +- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 24 +- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 24 +- drivers/bus/auxiliary/auxiliary_common.c | 17 +- drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 14 +- drivers/bus/fslmc/fslmc_vfio.c | 30 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 18 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 13 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 20 +- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 69 +- drivers/bus/pci/linux/pci_vfio.c | 108 ++- drivers/bus/pci/pci_common.c | 28 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 35 +- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 23 +- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +- drivers/common/cnxk/roc_irq.c | 107 +-- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 +- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +- drivers/common/octeontx2/otx2_irq.c | 117 ++-- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 48 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 +- drivers/net/e1000/igb_ethdev.c | 79 +-- drivers/net/ena/ena_ethdev.c | 35 +- drivers/net/enic/enic_main.c | 26 +- drivers/net/failsafe/failsafe.c | 21 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 19 +- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 +- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 +- drivers/net/hns3/hns3_ethdev_vf.c | 64 +- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 +- drivers/net/iavf/iavf_ethdev.c | 42 +- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 +- drivers/net/ice/ice_ethdev.c | 49 +- drivers/net/igc/igc_ethdev.c | 45 +- drivers/net/ionic/ionic_ethdev.c | 17 +- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +- drivers/net/memif/memif_socket.c | 108 ++- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 56 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 55 +- drivers/net/mlx5/linux/mlx5_socket.c | 25 +- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 43 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 25 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 +- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 +- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +- drivers/net/qede/qede_ethdev.c | 16 +- drivers/net/sfc/sfc_intr.c | 30 +- drivers/net/tap/rte_eth_tap.c | 33 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 33 +- drivers/net/thunderx/nicvf_ethdev.c | 10 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 80 ++- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 56 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 62 +- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 8 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 21 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 528 ++++++++++++++ lib/eal/common/eal_interrupts.h | 30 + lib/eal/common/eal_private.h | 10 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 44 +- lib/eal/freebsd/eal_interrupts.c | 85 ++- lib/eal/include/meson.build | 2 +- lib/eal/include/rte_eal_interrupts.h | 269 -------- lib/eal/include/rte_eal_trace.h | 10 +- lib/eal/include/rte_epoll.h | 118 ++++ lib/eal/include/rte_interrupts.h | 651 +++++++++++++++++- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 +- lib/eal/linux/eal_dev.c | 57 +- lib/eal/linux/eal_interrupts.c | 304 ++++---- lib/eal/version.map | 45 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 132 files changed, 3473 insertions(+), 1742 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h create mode 100644 lib/eal/include/rte_epoll.h -- 2.23.0
PATCH v6 1/9 interrupts: add allocator and accessors
From: Harman Kalra <[email protected]>
Prototype/Implement get set APIs for interrupt handle fields. User won't be able to access any of the interrupt handle fields directly while should use these get/set APIs to access/manipulate them.
Internal interrupt header i.e. rte_eal_interrupt.h is rearranged, as APIs defined are moved to rte_interrupts.h and epoll specific definitions are moved to a new header rte_epoll.h. Later in the series rte_eal_interrupt.h will be removed.
---
Changes since v5:
- renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
- used a single bit to mark instance as shared (default is private),
- removed rte_intr_instance_copy / rte_intr_instance_alloc_flag_get with a single rte_intr_instance_dup helper,
- made rte_intr_vec_list_alloc alloc_flags-aware,
- exported all symbols for Windows,
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 411 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 207 +------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 627 +++++++++++++++++++++++++ lib/eal/version.map | 45 +- 8 files changed, 1201 insertions(+), 210 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.h
MAINTAINERS +1 -0
@@ -211,6 +211,7 @@ F: app/test/test_memzone.c Interrupt Subsystem M: Harman Kalra <[email protected]> +F: lib/eal/include/rte_epoll.h F: lib/eal/*/*interrupts.* F: app/test/test_interrupts.c
lib/eal/common/eal_common_interrupts.c new file +411 -0
411 lines not on this page · raw message
lib/eal/common/meson.build +1 -0
@@ -15,6 +15,7 @@ sources += files( 'eal_common_errno.c', 'eal_common_fbarray.c', 'eal_common_hexdump.c', + 'eal_common_interrupts.c', 'eal_common_launch.c', 'eal_common_lcore.c', 'eal_common_log.c',
lib/eal/include/meson.build +1 -0
@@ -19,6 +19,7 @@ headers += files( 'rte_eal_memconfig.h', 'rte_eal_trace.h', 'rte_errno.h', + 'rte_epoll.h', 'rte_fbarray.h', 'rte_hexdump.h', 'rte_hypervisor.h',
lib/eal/include/rte_eal_interrupts.h +5 -202
228 lines not on this page · raw message
lib/eal/include/rte_epoll.h new file +118 -0
118 lines not on this page · raw message
lib/eal/include/rte_interrupts.h +627 -0
647 lines not on this page · raw message
lib/eal/version.map +37 -8
67 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH v6 2/9 interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field.
---
Changes since v5:
- used new helper rte_intr_instance_dup,
--- lib/eal/freebsd/eal_interrupts.c | 85 +++++---- lib/eal/linux/eal_interrupts.c | 304 +++++++++++++++++-------------- 2 files changed, 219 insertions(+), 170 deletions(-)
lib/eal/freebsd/eal_interrupts.c +47 -38
@@ -40,7 +40,7 @@ struct rte_intr_callback {struct rte_intr_source {TAILQ_ENTRY (rte_intr_source) next; -struct rte_intr_handle intr_handle;/**< interrupt handle */ +struct rte_intr_handle *intr_handle;/**< interrupt handle */ struct rte_intr_cb_list callbacks;/**< user callbacks */ uint32_t active; };
@@ -60,7 +60,7 @@ static int intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) {/* alarm callbacks are special case */ -if (ih->type ==RTE_INTR_HANDLE_ALARM ) { +if (rte_intr_type_get (ih) ==RTE_INTR_HANDLE_ALARM ) {uint64_t timeout_ns;/* get soonest alarm timeout */
@@ -75,7 +75,7 @@ intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) }else { ke->filter =EVFILT_READ ; } - ke->ident = ih->fd; + ke->ident =rte_intr_fd_get (ih);return 0 ; }
@@ -89,7 +89,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,int ret =0 , add_event =0 ;/* first do parameter checking */ -if (intr_handle ==NULL || intr_handle->fd <0 || cb ==NULL ) { +if (rte_intr_fd_get (intr_handle) <0 || cb ==NULL ) {RTE_LOG (ERR ,EAL ,"Registering with invalid input parameter\n" );return -EINVAL ;
@@ -103,7 +103,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* find the source for this intr_handle */ TAILQ_FOREACH(src, &intr_sources, next) { -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ; }
@@ -112,8 +112,9 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,* thing on the list should be eal_alarm_callback() and we may * be called just to reset the timer. */ -if (src !=NULL && src->intr_handle.type ==RTE_INTR_HANDLE_ALARM && - !TAILQ_EMPTY (&src->callbacks)) { +if (src !=NULL && +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM && + !TAILQ_EMPTY (&src->callbacks)) { callback =NULL ; }else {/* allocate a new interrupt callback entity */
@@ -135,7 +136,14 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; + src->intr_handle =rte_intr_instance_dup (intr_handle); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); + ret = -ENOMEM ; +free (src); + src =NULL ; + goto fail; + }TAILQ_INIT (&src->callbacks);TAILQ_INSERT_TAIL (&intr_sources, src, next); }
@@ -151,7 +159,8 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* add events to the queue. timer events are special as we need to * re-set the timer. */ -if (add_event || src->intr_handle.type ==RTE_INTR_HANDLE_ALARM ) { +if (add_event || +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM ) {struct kevent ke;memset (&ke,0 ,sizeof (ke));
@@ -173,12 +182,11 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,*/ if (errno ==ENODEV )RTE_LOG (DEBUG ,EAL ,"Interrupt handle %d not supported\n" , - src->intr_handle.fd); +rte_intr_fd_get (src->intr_handle));else -RTE_LOG (ERR ,EAL ,"Error adding fd %d " -"kevent, %s\n" , - src->intr_handle.fd, -strerror (errno)); +RTE_LOG (ERR ,EAL ,"Error adding fd %d kevent, %s\n" , +rte_intr_fd_get (src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +221,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -228,7 +236,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -268,7 +276,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -282,7 +290,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -314,7 +322,8 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" , - src->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (src->intr_handle), +strerror (errno));/* removing non-existent even is an expected condition * in some circumstances (e.g. oneshot events). */
@@ -365,17 +374,18 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -386,9 +396,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +415,18 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -427,9 +437,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +450,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)int rte_intr_ack (const struct rte_intr_handle *intr_handle) { -if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV ) +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +472,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_lock (&intr_lock); TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == event_fd) +if (rte_intr_fd_get (src->intr_handle) == event_fd)break ;if (src ==NULL ) {rte_spinlock_unlock (&intr_lock);
@@ -475,7 +484,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_unlock (&intr_lock);/* set the length to be read dor different handle type */ -switch (src->intr_handle.type) { +switch (rte_intr_type_get (src->intr_handle)) {case RTE_INTR_HANDLE_ALARM : bytes_read =0 ; call = true;
@@ -546,7 +555,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)/* mark for deletion from the queue */ ke.flags =EV_DELETE ; -if (intr_source_to_kevent (&src->intr_handle, &ke) <0 ) { +if (intr_source_to_kevent (src->intr_handle, &ke) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot convert to kevent\n" );rte_spinlock_unlock (&intr_lock);return ;
@@ -556,8 +565,8 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)* remove intr file descriptor from wait list. */ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) { -RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" + rte_intr_fd_get(src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +576,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)TAILQ_REMOVE (&src->callbacks, cb, next);if (cb->ucb_fn) - cb->ucb_fn (&src->intr_handle, cb->cb_arg); + cb->ucb_fn (src->intr_handle, cb->cb_arg);free (cb); } }
lib/eal/linux/eal_interrupts.c +172 -132
754 lines not on this page · raw message
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v6 2/9] interrupts: remove direct access to interrupt handle
lib/eal/freebsd/eal_interrupts.c eal_intr_process_interrupts(struct kevent *events, int nfds) · line 572
Quoted 11 lines · David Marchand
lib/eal/freebsd/eal_interrupts.c +2
-2@@ -556,8 +565,8 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)* remove intr file descriptor from wait list. */ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) { -RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" + rte_intr_fd_get(src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
My fault, missing a ,
Signature · 1 line
David Marchand.
PATCH v6 3/9 test/interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Updating the interrupt testsuite to make use of interrupt handle get set APIs.
---
Changes since v5:
- fixed leak on when some interrupt handle can't be allocated,
--- app/test/test_interrupts.c | 164 ++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 66 deletions(-)
app/test/test_interrupts.c +98 -66
@@ -16,7 +16,7 @@/* predefined interrupt handle types */ enum test_interrupt_handle_type { -TEST_INTERRUPT_HANDLE_INVALID , +TEST_INTERRUPT_HANDLE_INVALID =0 ,TEST_INTERRUPT_HANDLE_VALID ,TEST_INTERRUPT_HANDLE_VALID_UIO ,TEST_INTERRUPT_HANDLE_VALID_ALARM ,
@@ -27,7 +27,7 @@ enum test_interrupt_handle_type {/* flag of if callback is called */ static volatile int flag; -static struct rte_intr_handle intr_handles[TEST_INTERRUPT_HANDLE_MAX ]; +static struct rte_intr_handle *intr_handles[TEST_INTERRUPT_HANDLE_MAX ];static enum test_interrupt_handle_type test_intr_type =TEST_INTERRUPT_HANDLE_MAX ;
@@ -50,7 +50,7 @@ static union intr_pipefds pfds;static inline int test_interrupt_handle_sanity_check (struct rte_intr_handle *intr_handle) { -if (!intr_handle || intr_handle->fd <0 ) +if (!intr_handle ||rte_intr_fd_get (intr_handle) <0 )return -1 ;return 0 ;
@@ -62,31 +62,54 @@ test_interrupt_handle_sanity_check(struct rte_intr_handle *intr_handle)static int test_interrupt_init (void ) { +struct rte_intr_handle *test_intr_handle; +int i; +if (pipe (pfds.pipefd) <0 )return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].fd =-1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) { + intr_handles[i] = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (!intr_handles[i]) +return -1 ; + } - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; +if (rte_intr_fd_set (test_intr_handle,-1 )) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].type = -RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; + + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].type = -RTE_INTR_HANDLE_ALARM ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_ALARM )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].type = -RTE_INTR_HANDLE_DEV_EVENT ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_DEV_EVENT )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].fd = pfds.writefd; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].type =RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; +if (rte_intr_fd_set (test_intr_handle, pfds.writefd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ;return 0 ; }
@@ -97,6 +120,10 @@ test_interrupt_init(void)static int test_interrupt_deinit (void ) { +int i; + +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) +rte_intr_instance_free (intr_handles[i]);close (pfds.pipefd[0 ]);close (pfds.pipefd[1 ]);
@@ -125,8 +152,10 @@ test_interrupt_handle_compare(struct rte_intr_handle *intr_handle_l,if (!intr_handle_l || !intr_handle_r)return -1 ; -if (intr_handle_l->fd != intr_handle_r->fd || - intr_handle_l->type != intr_handle_r->type) +if (rte_intr_fd_get (intr_handle_l) != +rte_intr_fd_get (intr_handle_r) || +rte_intr_type_get (intr_handle_l) != +rte_intr_type_get (intr_handle_r))return -1 ;return 0 ;
@@ -178,6 +207,8 @@ static void test_interrupt_callback(void *arg) {struct rte_intr_handle *intr_handle = arg; +struct rte_intr_handle *test_intr_handle; +if (test_intr_type >=TEST_INTERRUPT_HANDLE_MAX ) {printf ("invalid interrupt type\n" ); flag =-1 ;
@@ -198,8 +229,8 @@ test_interrupt_callback(void *arg)return ; } -if (test_interrupt_handle_compare (intr_handle, - &(intr_handles[test_intr_type])) ==0 ) + test_intr_handle = intr_handles[test_intr_type]; +if (test_interrupt_handle_compare (intr_handle, test_intr_handle) ==0 ) flag =1 ; }
@@ -223,7 +254,7 @@ test_interrupt_callback_1(void *arg)static int test_interrupt_enable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_enable (NULL ) ==0 ) {
@@ -233,7 +264,7 @@ test_interrupt_enable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable invalid intr_handle " "successfully\n" );return -1 ;
@@ -241,7 +272,7 @@ test_interrupt_enable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -249,7 +280,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -257,7 +288,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -265,13 +296,13 @@ test_interrupt_enable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_enable (&test_intr_handle) <0 ) { +if (rte_intr_enable (test_intr_handle) <0 ) {printf ("fail to enable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -286,7 +317,7 @@ test_interrupt_enable(void)static int test_interrupt_disable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_disable (NULL ) ==0 ) {
@@ -297,7 +328,7 @@ test_interrupt_disable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable invalid intr_handle " "successfully\n" );return -1 ;
@@ -305,7 +336,7 @@ test_interrupt_disable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -313,7 +344,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -321,7 +352,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -329,13 +360,13 @@ test_interrupt_disable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_disable (&test_intr_handle) <0 ) { +if (rte_intr_disable (test_intr_handle) <0 ) {printf ("fail to disable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -351,13 +382,13 @@ static int test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type) {int count; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle; flag =0 ; test_intr_handle = intr_handles[intr_type]; test_intr_type = intr_type; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("fail to register callback\n" );return -1 ; }
@@ -371,9 +402,9 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)rte_delay_ms (TEST_INTERRUPT_CHECK_INTERVAL );while ((count = -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, - &test_intr_handle)) <0 ) { + test_intr_handle)) <0 ) {if (count != -EAGAIN )return -1 ; }
@@ -396,11 +427,11 @@ static inttest_interrupt (void) {int ret =-1 ; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;if (test_interrupt_init () <0 ) {printf ("fail to initialize for testing interrupt\n" ); -return -1 ; + goto out; }printf ("Check unknown valid interrupt full path\n" );
@@ -445,8 +476,8 @@ test_interrupt(void)/* check if it will fail to register cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with invalid " "intr_handle\n" ); goto out;
@@ -454,7 +485,8 @@ test_interrupt(void)/* check if it will fail to register without callback */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle,NULL , &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle,NULL , + test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with " "null callback\n" ); goto out;
@@ -470,8 +502,8 @@ test_interrupt(void)/* check if it will fail to unregister cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) >0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) >0 ) {printf ("unexpectedly unregister successfully with " "invalid intr_handle\n" ); goto out;
@@ -479,29 +511,29 @@ test_interrupt(void)/* check if it is ok to register the same intr_handle twice */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback_1, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback_1, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback_1\n" ); goto out; }/* check if it will fail to unregister with invalid parameter */ -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)0xff ) !=0 ) {printf ("unexpectedly unregisters successfully with " "invalid arg\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <=0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) <=0 ) {printf ("it fails to unregister test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ) <=0 ) {printf ("it fails to unregister test_interrupt_callback_1 " "for all\n" );
@@ -529,27 +561,27 @@ test_interrupt(void)printf ("Clearing for interrupt tests\n" );/* clear registered callbacks */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 );rte_delay_ms (2 *TEST_INTERRUPT_CHECK_INTERVAL );
Signature · 1 line
2.23.0
PATCH v6 4/9 alarm: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
---
Changes since v5:
- split from patch4,
- merged patch6,
- renamed rte_eal_alarm_fini as rte_eal_alarm_cleanup,
--- lib/eal/common/eal_private.h | 10 ++++++++ lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 44 +++++++++++++++++++++++++++++++----- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 ++++++++++++++++++++------ 5 files changed, 75 insertions(+), 13 deletions(-)
lib/eal/common/eal_private.h +10 -0
@@ -163,6 +163,16 @@ int rte_eal_intr_init(void);*/ int rte_eal_alarm_init (void ); +/** +* Alarm mechanism cleanup. +* +* This function is private to EAL. +* +* @return +* 0 on success, negative on error +*/ +void rte_eal_alarm_cleanup (void ); +/** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded.
lib/eal/freebsd/eal.c +1 -0
@@ -975,6 +975,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/freebsd/eal_alarm.c +38 -6
105 lines not on this page · raw message
lib/eal/linux/eal.c +1 -0
@@ -1368,6 +1368,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/linux/eal_alarm.c +25 -7
@@ -54,22 +54,40 @@ struct alarm_entry { static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();static rte_spinlock_t alarm_list_lk =RTE_SPINLOCK_INITIALIZER ; -static struct rte_intr_handle intr_handle = {.fd =-1 }; +static struct rte_intr_handle *intr_handle;static int handler_registered =0 ;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_cleanup (void ) +{ +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) { - intr_handle.type =RTE_INTR_HANDLE_ALARM ; + + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + goto error; + } + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error; +/* create a timerfd file descriptor */ - intr_handle.fd =timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ); -if (intr_handle.fd ==-1 ) +if (rte_intr_fd_set (intr_handle, +timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ))) goto error; +if (rte_intr_fd_get (intr_handle) ==-1 ) + goto error;return 0 ; error: +rte_intr_instance_free (intr_handle); rte_errno = errno;return -1 ; }
@@ -109,7 +127,7 @@ eal_alarm_callback(void *arg __rte_unused) atime.it_value.tv_sec -= now.tv_sec; atime.it_value.tv_nsec -= now.tv_nsec; -timerfd_settime (intr_handle.fd,0 , &atime,NULL ); +timerfd_settime (rte_intr_fd_get (intr_handle),0 , &atime,NULL ); }rte_spinlock_unlock (&alarm_list_lk); }
@@ -140,7 +158,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)rte_spinlock_lock (&alarm_list_lk);if (!handler_registered) {/* registration can fail, callback can be registered later */ -if (rte_intr_callback_register (&intr_handle, +if (rte_intr_callback_register (intr_handle, eal_alarm_callback,NULL ) ==0 ) handler_registered =1 ; }
@@ -170,7 +188,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg) .tv_nsec = (us % US_PER_S) * NS_PER_US, }, }; - ret |=timerfd_settime (intr_handle.fd,0 , &alarm_time,NULL ); + ret |=timerfd_settime (rte_intr_fd_get (intr_handle),0 , &alarm_time,NULL ); }rte_spinlock_unlock (&alarm_list_lk);
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v6 4/9] alarm: remove direct access to interrupt handle
2021-10-24 22:04 (UTC+0200), David Marchand:
Quoted 18 lines
From: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
Signed-off-by Harman Kalra <[email protected]>Signed-off-by David Marchand <[email protected]>---
Changes since v5:
- split from patch4,
- merged patch6,
- renamedrte_eal_alarm_finiasrte_eal_alarm_cleanup,---
[...]
lib/eal/freebsd/eal_alarm.c line 35
Quoted 10 lines
lib/eal/freebsd/eal_alarm.c +1
-1@@ -32,7 +32,7 @@struct alarm_entry {LIST_ENTRY (alarm_entry) next; -struct rte_intr_handle handle; +struct rte_intr_handle *handle;
This field is never used and can be just removed.
Quoted 3 lines
lib/eal/freebsd/eal_alarm.c +0
-0struct timespec time;rte_eal_alarm_callback cb_fn;void *cb_arg;
[...]
Re: [dpdk-dev] [PATCH v6 4/9] alarm: remove direct access to interrupt handle
Quoted 6 lines · Dmitry Kozlyuk
Quoted 6 lines
lib/eal/freebsd/eal_alarm.c +0
-0@@ -32,7 +32,7 @@
Quoted 6 lines
lib/eal/freebsd/eal_alarm.c line 35
Quoted 4 lines
lib/eal/freebsd/eal_alarm.c +1
-1struct alarm_entry {LIST_ENTRY (alarm_entry) next; -struct rte_intr_handle handle; +struct rte_intr_handle *handle;This field is never used and can be just removed.
Indeed, removed.
Quoted 6 lines
Quoted 4 lines
lib/eal/freebsd/eal_alarm.c +0
-0struct timespec time;rte_eal_alarm_callback cb_fn;void *cb_arg;[...]
Signature · 1 line
David Marchand
PATCH v6 5/9 lib: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
---
Changes since v5:
- split from patch4,
--- lib/bbdev/rte_bbdev.c | 4 +-- lib/eal/linux/eal_dev.c | 57 ++++++++++++++++++++++++----------------- lib/ethdev/rte_ethdev.c | 14 +++++----- 3 files changed, 43 insertions(+), 32 deletions(-)
lib/bbdev/rte_bbdev.c +2 -2
@@ -1094,7 +1094,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,VALID_QUEUE_OR_RET_ERR (queue_id, dev); intr_handle = dev->intr_handle; -if (!intr_handle || !intr_handle->intr_vec) { +if (intr_handle ==NULL ) {rte_bbdev_log (ERR ,"Device %u intr handle unset\n" , dev_id);return -ENOTSUP ; }
@@ -1105,7 +1105,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,return -ENOTSUP ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); ret =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (ret && (ret != -EEXIST )) { rte_bbdev_log(ERR,
lib/eal/linux/eal_dev.c +34 -23
127 lines not on this page · raw message
lib/ethdev/rte_ethdev.c +7 -7
@@ -4819,13 +4819,13 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; }for (qid =0 ; qid < dev->data->nb_rx_queues; qid++) { - vec = intr_handle->intr_vec[qid]; + vec =rte_intr_vec_list_index_get (intr_handle, qid); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
@@ -4860,15 +4860,15 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -1 ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); efd_idx = (vec >=RTE_INTR_VEC_RXTX_OFFSET ) ? (vec -RTE_INTR_VEC_RXTX_OFFSET ) : vec; - fd = intr_handle->efds[efd_idx]; + fd =rte_intr_efds_index_get (intr_handle, efd_idx);return fd; }
@@ -5046,12 +5046,12 @@ rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
Signature · 1 line
2.23.0
PATCH v6 6/9 drivers: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the drivers access the interrupt handle fields.
---
Changes since v5:
- moved instance allocation to probing for auxiliary,
- fixed dev_irq_register() return value sign on error for drivers/common/cnxk/roc_irq.c,
--- drivers/baseband/acc100/rte_acc100_pmd.c | 14 +-- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 24 ++-- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 24 ++-- drivers/bus/auxiliary/auxiliary_common.c | 17 ++- drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 ++++- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 14 ++- drivers/bus/fslmc/fslmc_vfio.c | 30 +++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 18 ++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 13 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 20 +-- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 69 +++++++---- drivers/bus/pci/linux/pci_vfio.c | 102 +++++++++------ drivers/bus/pci/pci_common.c | 28 ++++- drivers/bus/pci/pci_common_uio.c | 21 ++-- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 35 ++++-- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 23 ++-- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +-- drivers/common/cnxk/roc_irq.c | 107 +++++++++------- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +++--- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 48 +++++-- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +-- drivers/common/octeontx2/otx2_irq.c | 117 ++++++++++-------- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 ++- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +++-- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 48 ++++--- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 ++-- drivers/net/e1000/igb_ethdev.c | 79 ++++++------ drivers/net/ena/ena_ethdev.c | 35 +++--- drivers/net/enic/enic_main.c | 26 ++-- drivers/net/failsafe/failsafe.c | 21 +++- drivers/net/failsafe/failsafe_intr.c | 43 ++++--- drivers/net/failsafe/failsafe_ops.c | 19 ++- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 ++--- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 ++++----- drivers/net/hns3/hns3_ethdev_vf.c | 64 +++++----- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 ++++---- drivers/net/iavf/iavf_ethdev.c | 42 +++---- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 ++-- drivers/net/ice/ice_ethdev.c | 49 ++++---- drivers/net/igc/igc_ethdev.c | 45 ++++--- drivers/net/ionic/ionic_ethdev.c | 17 +-- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +++++----- drivers/net/memif/memif_socket.c | 108 +++++++++++----- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 56 +++++++-- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 ++- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 ++++--- drivers/net/mlx5/linux/mlx5_os.c | 55 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 25 ++-- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 43 ++++--- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 25 ++-- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 ++--- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 ++--- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +++--- drivers/net/qede/qede_ethdev.c | 16 +-- drivers/net/sfc/sfc_intr.c | 30 ++--- drivers/net/tap/rte_eth_tap.c | 33 +++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 33 ++--- drivers/net/thunderx/nicvf_ethdev.c | 10 ++ drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +++--- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 80 ++++++------ drivers/net/virtio/virtio_ethdev.c | 21 ++-- .../net/virtio/virtio_user/virtio_user_dev.c | 56 +++++---- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 ++++--- drivers/raw/ifpga/ifpga_rawdev.c | 62 +++++++--- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 8 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 21 ++-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 ++++--- lib/ethdev/ethdev_pci.h | 2 +- 111 files changed, 1660 insertions(+), 1177 deletions(-)
drivers/baseband/acc100/rte_acc100_pmd.c +7 -7
@@ -720,8 +720,8 @@ acc100_intr_enable(struct rte_bbdev *dev)struct acc100_device *d = dev->data->dev_private;/* Only MSI are currently supported */ -if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || - dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ) { +if (rte_intr_type_get (dev->intr_handle) ==RTE_INTR_HANDLE_VFIO_MSI || +rte_intr_type_get (dev->intr_handle) ==RTE_INTR_HANDLE_UIO ) { ret =allocate_info_ring (dev);if (ret <0 ) {
@@ -1098,8 +1098,8 @@ acc100_queue_intr_enable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =1 ;
@@ -1111,8 +1111,8 @@ acc100_queue_intr_disable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =0 ;
@@ -4185,7 +4185,7 @@ static int acc100_pci_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke ACC100 device initialization function */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +12 -12
@@ -743,17 +743,17 @@ fpga_intr_enable(struct rte_bbdev *dev)* It ensures that callback function assigned to that descriptor will * invoked when any FPGA queue issues interrupt. */ -for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) { +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + } + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -1880,7 +1880,7 @@ fpga_5gnr_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +12 -12
@@ -1014,17 +1014,17 @@ fpga_intr_enable(struct rte_bbdev *dev)* It ensures that callback function assigned to that descriptor will * invoked when any FPGA queue issues interrupt. */ -for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) { +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + } + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -2370,7 +2370,7 @@ fpga_lte_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/bus/auxiliary/auxiliary_common.c +15 -2
@@ -121,15 +121,27 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,return -EINVAL ; } +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +AUXILIARY_LOG (ERR ,"Could not allocate interrupt instance for device %s" , + dev->name); +return -ENOMEM ; + } + dev->driver = drv;AUXILIARY_LOG (INFO ,"Probe auxiliary driver: %s device: %s (NUMA node %i)" , drv->driver.name, dev->name, dev->device.numa_node); ret = drv->probe (drv, dev); -if (ret !=0 ) +if (ret !=0 ) { dev->driver =NULL ; -else +rte_intr_instance_free (dev->intr_handle); + dev->intr_handle =NULL ; + }else { dev->device.driver = &drv->driver; + }return ret; }
@@ -320,6 +332,7 @@ auxiliary_unplug(struct rte_device *dev)if (ret ==0 ) {rte_auxiliary_remove_device (adev);rte_devargs_remove (dev->devargs); +rte_intr_instance_free (adev->intr_handle);free (adev); }return ret;
drivers/bus/auxiliary/rte_bus_auxiliary.h +1 -1
@@ -115,7 +115,7 @@ struct rte_auxiliary_device {RTE_TAILQ_ENTRY (rte_auxiliary_device) next;/**< Next probed device. */ struct rte_device device;/**< Inherit core device */ char name[RTE_DEV_NAME_MAX_LEN +1 ];/**< ASCII device name */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_auxiliary_driver *driver;/**< Device driver */ };
drivers/bus/dpaa/dpaa_bus.c +25 -3
@@ -172,6 +172,15 @@ dpaa_create_device_list(void) dev->device.bus = &rte_dpaa_bus.bus; +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + cfg = &dpaa_netcfg->port_cfg[i]; fman_intf = cfg->fman_if;
@@ -214,6 +223,15 @@ dpaa_create_device_list(void) goto cleanup; } +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + dev->device_type =FSL_DPAA_CRYPTO ; dev->id.dev_id = rte_dpaa_bus.device_count + i;
@@ -247,6 +265,7 @@ dpaa_clean_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {TAILQ_REMOVE (&rte_dpaa_bus.device_list, dev, next); +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -559,8 +578,11 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)return errno; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_EXT ; +if (rte_intr_fd_set (intr_handle, fd)) +return rte_errno; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_EXT )) +return rte_errno;return 0 ; }
@@ -612,7 +634,7 @@ rte_dpaa_bus_probe(void) TAILQ_FOREACH(dev, &rte_dpaa_bus.device_list, next) {if (dev->device_type ==FSL_DPAA_ETH ) { - ret =rte_dpaa_setup_intr (&dev->intr_handle); + ret =rte_dpaa_setup_intr (dev->intr_handle);if (ret)DPAA_BUS_ERR ("Error setting up interrupt.\n" ); }
drivers/bus/dpaa/rte_dpaa_bus.h +1 -1
@@ -98,7 +98,7 @@ struct rte_dpaa_device { };struct rte_dpaa_driver *driver;struct dpaa_device_id id; -struct rte_intr_handle intr_handle; +struct rte_intr_handle *intr_handle;enum rte_dpaa_type device_type;/**< Ethernet or crypto type device */ char name[RTE_ETH_NAME_MAX_LEN ]; };
drivers/bus/fslmc/fslmc_bus.c +13 -1
@@ -47,6 +47,7 @@ cleanup_fslmc_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, t_dev) {TAILQ_REMOVE (&rte_fslmc_bus.device_list, dev, next); +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -160,6 +161,15 @@ scan_one_fslmc_device(char *dev_name) dev->device.bus = &rte_fslmc_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } +/* Parse the device name and ID */ t_ptr =strtok (dup_dev_name,"." );if (!t_ptr) {
@@ -220,8 +230,10 @@ scan_one_fslmc_device(char *dev_name) cleanup:if (dup_dev_name)free (dup_dev_name); -if (dev) +if (dev) { +rte_intr_instance_free (dev->intr_handle);free (dev); + }return ret; }
drivers/bus/fslmc/fslmc_vfio.c +19 -11
@@ -599,7 +599,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)int len, ret;char irq_set_buf[IRQ_SET_BUF_LEN ];struct vfio_irq_set *irq_set; -int *fd_ptr; +int *fd_ptr, vfio_dev_fd; len =sizeof (irq_set_buf);
@@ -611,12 +611,14 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) irq_set->index = index; irq_set->start =0 ; fd_ptr = (int *)&irq_set->data; - *fd_ptr = intr_handle->fd; + *fd_ptr =rte_intr_fd_get (intr_handle); - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret) {DPAA2_BUS_ERR ("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)" , - intr_handle->fd, errno,strerror (errno)); +rte_intr_fd_get (intr_handle), errno, +strerror (errno));return ret; }
@@ -627,7 +629,7 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) {struct vfio_irq_set *irq_set;char irq_set_buf[IRQ_SET_BUF_LEN ]; -int len, ret; +int len, ret, vfio_dev_fd; len =sizeof (struct vfio_irq_set );
@@ -638,11 +640,12 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) irq_set->start =0 ; irq_set->count =0 ; - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret)DPAA2_BUS_ERR ("Error disabling dpaa2 interrupts for fd %d" , - intr_handle->fd); +rte_intr_fd_get (intr_handle));return ret; }
@@ -684,9 +687,14 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,return -1 ; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_VFIO_MSI ; - intr_handle->vfio_dev_fd = vfio_dev_fd; +if (rte_intr_fd_set (intr_handle, fd)) +return -rte_errno; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_VFIO_MSI )) +return -rte_errno; + +if (rte_intr_dev_fd_set (intr_handle, vfio_dev_fd)) +return -rte_errno;return 0 ; }
@@ -711,7 +719,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)switch (dev->dev_type) {case DPAA2_ETH : -rte_dpaa2_vfio_setup_intr (&dev->intr_handle, dev_fd, +rte_dpaa2_vfio_setup_intr (dev->intr_handle, dev_fd, device_info.num_irqs);break ;case DPAA2_CON :
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +14 -4
@@ -176,7 +176,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)int threshold =0x3 , timeout =0xFF ; dpio_epoll_fd =epoll_create (1 ); - ret =rte_dpaa2_intr_enable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_enable (dpio_dev->intr_handle,0 );if (ret) {DPAA2_BUS_ERR ("Interrupt registeration failed" );return -1 ;
@@ -195,7 +195,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)qbman_swp_dqrr_thrshld_write (dpio_dev->sw_portal, threshold);qbman_swp_intr_timeout_write (dpio_dev->sw_portal, timeout); - eventfd = dpio_dev->intr_handle.fd; + eventfd =rte_intr_fd_get (dpio_dev->intr_handle); epoll_ev.events =EPOLLIN |EPOLLPRI |EPOLLET ; epoll_ev.data.fd = eventfd;
@@ -213,7 +213,7 @@ static void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev) {int ret; - ret =rte_dpaa2_intr_disable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_disable (dpio_dev->intr_handle,0 );if (ret)DPAA2_BUS_ERR ("DPIO interrupt disable failed" );
@@ -388,6 +388,14 @@ dpaa2_create_dpio_device(int vdev_fd,/* Using single portal for all devices */ dpio_dev->mc_portal =dpaa2_get_mcp_ptr (MC_PORTAL_INDEX ); +/* Allocate interrupt instance */ + dpio_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (!dpio_dev->intr_handle) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + goto err; + } + dpio_dev->dpio =rte_zmalloc (NULL ,sizeof (struct fsl_mc_io ),RTE_CACHE_LINE_SIZE );if (!dpio_dev->dpio) {
@@ -490,7 +498,7 @@ dpaa2_create_dpio_device(int vdev_fd, io_space_count++; dpio_dev->index = io_space_count; -if (rte_dpaa2_vfio_setup_intr (&dpio_dev->intr_handle, vdev_fd,1 )) { +if (rte_dpaa2_vfio_setup_intr (dpio_dev->intr_handle, vdev_fd,1 )) {DPAA2_BUS_ERR ("Fail to setup interrupt for %d" , dpio_dev->hw_id); goto err;
@@ -538,6 +546,7 @@ dpaa2_create_dpio_device(int vdev_fd,rte_free (dpio_dev->dpio); } +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev);/* For each element in the list, cleanup */
@@ -549,6 +558,7 @@ dpaa2_create_dpio_device(int vdev_fd, dpio_dev->token);rte_free (dpio_dev->dpio); } +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev); }
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -1
@@ -116,7 +116,7 @@ struct dpaa2_dpio_dev {uintptr_t qbman_portal_ci_paddr;/**< Physical address of Cache Inhibit Area */ uintptr_t ci_size;/**< Size of the CI region */ -struct rte_intr_handle intr_handle;/* Interrupt related info */ +struct rte_intr_handle *intr_handle;/* Interrupt related info */ int32_t epoll_fd;/**< File descriptor created for interrupt polling */ int32_t hw_id;/**< An unique ID of this DPIO device instance */ struct dpaa2_portal_dqrr dpaa2_held_bufs;
drivers/bus/fslmc/rte_fslmc.h +1 -1
@@ -122,7 +122,7 @@ struct rte_dpaa2_device { };enum rte_dpaa2_dev_type dev_type;/**< Device Type */ uint16_t object_id;/**< DPAA2 Object ID */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_dpaa2_driver *driver;/**< Associated driver */ char name[FSLMC_OBJECT_MAX_LEN ];/**< DPAA2 Object name*/ };
drivers/bus/ifpga/ifpga_bus.c +12 -1
@@ -161,6 +161,14 @@ ifpga_scan_one(struct rte_rawdev *rawdev, afu_dev->id.uuid.uuid_high =0 ; afu_dev->id.port = afu_pr_conf.afu_id.port; +/* Allocate interrupt instance */ + afu_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (afu_dev->intr_handle ==NULL ) { +IFPGA_BUS_ERR ("Failed to allocate intr handle" ); + goto end; + } +if (rawdev->dev_ops && rawdev->dev_ops->dev_info_get) rawdev->dev_ops->dev_info_get (rawdev, afu_dev,sizeof (*afu_dev));
@@ -189,8 +197,10 @@ ifpga_scan_one(struct rte_rawdev *rawdev,rte_kvargs_free (kvlist);if (path)free (path); -if (afu_dev) +if (afu_dev) { +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev); + }return NULL ; }
@@ -396,6 +406,7 @@ ifpga_unplug(struct rte_device *dev)TAILQ_REMOVE (&ifpga_afu_dev_list, afu_dev, next);rte_devargs_remove (dev->devargs); +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev);return 0 ;
drivers/bus/ifpga/rte_bus_ifpga.h +1 -1
@@ -79,7 +79,7 @@ struct rte_afu_device {struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< AFU Memory Resource */ struct rte_afu_shared shared; -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_afu_driver *driver;/**< Associated driver */ char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN ]; } __rte_packed;
drivers/bus/pci/bsd/pci.c +13 -7
@@ -95,10 +95,10 @@ pci_uio_free_resource(struct rte_pci_device *dev, {rte_free (uio_res); -if (dev->intr_handle.fd) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle)) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -121,13 +121,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, }/* save fd if in primary process */ - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { +if (rte_intr_fd_set (dev->intr_handle,open (devname,O_RDWR ))) { +RTE_LOG (WARNING ,EAL ,"Failed to save fd" ); + goto error; + } + +if (rte_intr_fd_get (dev->intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot open %s: %s\n" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO ; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UIO )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/pci/linux/pci.c +2 -2
@@ -645,7 +645,7 @@ int rte_pci_read_config(const struct rte_pci_device *device, void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
@@ -669,7 +669,7 @@ int rte_pci_write_config(const struct rte_pci_device *device, const void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
drivers/bus/pci/linux/pci_uio.c +45 -24
138 lines not on this page · raw message
drivers/bus/pci/linux/pci_vfio.c +64 -38
239 lines not on this page · raw message
drivers/bus/pci/pci_common.c +26 -2
@@ -230,6 +230,24 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr, }if (!already_probed && (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING )) { +/* Allocate interrupt instance for pci device */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL , +"Failed to create interrupt instance for %s\n" , + dev->device.name); +return -ENOMEM ; + } + + dev->vfio_req_intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->vfio_req_intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL , +"Failed to create vfio req interrupt instance for %s\n" , + dev->device.name); +return -ENOMEM ; + }/* map resources for devices that use igb_uio */ ret =rte_pci_map_device (dev);if (ret !=0 ) {
@@ -253,8 +271,11 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,* driver needs mapped resources. */ !(ret > 0 && - (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) + (dr->drv_flags & RTE_PCI_DRV_KEEP_MAPPED_RES))) {rte_pci_unmap_device (dev); +rte_intr_instance_free (dev->intr_handle); +rte_intr_instance_free (dev->vfio_req_intr_handle); + } }else { dev->device.driver = &dr->driver; }
@@ -296,9 +317,12 @@ rte_pci_detach_dev(struct rte_pci_device *dev) dev->driver =NULL ; dev->device.driver =NULL ; -if (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING ) +if (dr->drv_flags &RTE_PCI_DRV_NEED_MAPPING ) {/* unmap resources for devices that use igb_uio */ rte_pci_unmap_device (dev); +rte_intr_instance_free (dev->intr_handle); +rte_intr_instance_free (dev->vfio_req_intr_handle); + }return 0 ; }
drivers/bus/pci/pci_common_uio.c +13 -8
@@ -90,8 +90,11 @@ pci_uio_map_resource(struct rte_pci_device *dev)struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -207,6 +210,7 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)struct mapped_pci_resource *uio_res;struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); +int uio_cfg_fd;if (dev ==NULL )return ;
@@ -229,12 +233,13 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); + uio_cfg_fd =rte_intr_dev_fd_get (dev->intr_handle); +if (uio_cfg_fd >=0 ) { +close (uio_cfg_fd); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/bus/pci/rte_bus_pci.h +2 -2
@@ -69,12 +69,12 @@ struct rte_pci_device {struct rte_pci_id id;/**< PCI ID. */ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< PCI Memory Resource */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_pci_driver *driver;/**< PCI driver used in probing */ uint16_t max_vfs;/**< sriov enable if not zero */ enum rte_pci_kernel_driver kdrv;/**< Kernel driver passthrough */ char name[PCI_PRI_STR_SIZE +1 ];/**< PCI location (ASCII) */ -struct rte_intr_handle vfio_req_intr_handle; +struct rte_intr_handle *vfio_req_intr_handle;/**< Handler of VFIO request interrupt */ };
drivers/bus/vmbus/linux/vmbus_bus.c +6 -0
@@ -299,6 +299,12 @@ vmbus_scan_one(const char *name) dev->device.devargs =vmbus_devargs_lookup (dev); +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) + goto error; +/* device is valid, add in list (sorted) */ VMBUS_LOG (DEBUG ,"Adding vmbus device %s" , name);
drivers/bus/vmbus/linux/vmbus_uio.c +22 -13
@@ -30,9 +30,11 @@ static void *vmbus_map_addr;/* Control interrupts */ void vmbus_uio_irq_control (struct rte_vmbus_device *dev,int32_t onoff) { -if (write (dev->intr_handle.fd, &onoff,sizeof (onoff)) <0 ) { +if (write (rte_intr_fd_get (dev->intr_handle), &onoff, +sizeof (onoff)) <0 ) {VMBUS_LOG (ERR ,"cannot write to %d:%s" , - dev->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (dev->intr_handle), +strerror (errno)); } }
@@ -41,7 +43,8 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)int32_t count;int cc; - cc =read (dev->intr_handle.fd, &count,sizeof (count)); + cc =read (rte_intr_fd_get (dev->intr_handle), &count, +sizeof (count));if (cc < (int )sizeof (count)) {if (cc <0 ) { VMBUS_LOG(ERR, "IRQ read failed %s",
@@ -61,15 +64,15 @@ vmbus_uio_free_resource(struct rte_vmbus_device *dev, {rte_free (uio_res); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } -if (dev->intr_handle.fd >=0 ) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -78,16 +81,22 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, struct mapped_vmbus_resource **uio_res) {char devname[PATH_MAX ];/* contains the /dev/uioX */ +int fd;/* save fd if in primary process */ snprintf (devname,sizeof (devname),"/dev/uio%u" , dev->uio_num); - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { + fd =open (devname,O_RDWR ); +if (fd <0 ) {VMBUS_LOG (ERR ,"Cannot open %s: %s" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO_INTX ; + +if (rte_intr_fd_set (dev->intr_handle, fd)) + goto error; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UIO_INTX )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/vmbus/rte_bus_vmbus.h +1 -1
@@ -73,7 +73,7 @@ struct rte_vmbus_device {struct vmbus_channel *primary;/**< VMBUS primary channel */ struct vmbus_mon_page *monitor_page;/**< VMBUS monitor page */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_mem_resource resource[VMBUS_MAX_RESOURCE ]; };
drivers/bus/vmbus/vmbus_common_uio.c +14 -9
@@ -171,9 +171,14 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)int ret;/* TODO: handle rescind */ - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -253,12 +258,12 @@ vmbus_uio_unmap_resource(struct rte_vmbus_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/common/cnxk/roc_cpt.c +4 -4
@@ -65,7 +65,7 @@ cpt_lf_register_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -85,7 +85,7 @@ cpt_lf_unregister_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -129,7 +129,7 @@ cpt_lf_register_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
@@ -152,7 +152,7 @@ cpt_lf_unregister_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
drivers/common/cnxk/roc_dev.c +7 -7
@@ -641,7 +641,7 @@ roc_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -691,7 +691,7 @@ mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static int mbox_register_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -724,7 +724,7 @@ mbox_register_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -755,7 +755,7 @@ mbox_unregister_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -839,7 +839,7 @@ roc_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;plt_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -860,7 +860,7 @@ vf_flr_unregister_irqs(struct plt_pci_device *pci_dev, struct dev *dev)static int vf_flr_register_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *handle = &pci_dev->intr_handle; +struct plt_intr_handle *handle = pci_dev->intr_handle;int i, rc;plt_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1211,7 +1211,7 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)int dev_fini (struct dev *dev,struct plt_pci_device *pci_dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;struct mbox *mbox;/* Check if this dev hosts npalf and has 1+ refs */
drivers/common/cnxk/roc_irq.c +62 -45
219 lines not on this page · raw message
drivers/common/cnxk/roc_nix_inl_dev_irq.c +4 -4
@@ -99,7 +99,7 @@ nix_inl_sso_hws_irq(void *param)int nix_inl_sso_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -147,7 +147,7 @@ nix_inl_sso_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_sso_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -282,7 +282,7 @@ nix_inl_nix_err_irq(void *param)int nix_inl_nix_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;int rc;
@@ -331,7 +331,7 @@ nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_nix_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;
drivers/common/cnxk/roc_nix_irq.c +19 -17
@@ -82,7 +82,7 @@ nix_lf_err_irq(void *param)static int nix_lf_register_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -99,7 +99,7 @@ nix_lf_register_err_irq(struct nix *nix)static void nix_lf_unregister_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -131,7 +131,7 @@ nix_lf_ras_irq(void *param)static int nix_lf_register_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -148,7 +148,7 @@ nix_lf_register_ras_irq(struct nix *nix)static void nix_lf_unregister_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -300,7 +300,7 @@ roc_nix_register_queue_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;/* Figure out max qintx required */ rqs =PLT_MIN (nix->qints, nix->nb_rx_queues);
@@ -352,7 +352,7 @@ roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_qints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_QINT_START + q;
@@ -382,7 +382,7 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle; nix->configured_cints =PLT_MIN (nix->cints, nix->nb_rx_queues);
@@ -414,19 +414,19 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)return rc; } -if (!handle->intr_vec) { - handle->intr_vec =plt_zmalloc ( - nix->configured_cints *sizeof (int ),0 ); -if (!handle->intr_vec) { -plt_err ("Failed to allocate %d rx intr_vec" , - nix->configured_cints); -return -ENOMEM ; - } + rc =plt_intr_vec_list_alloc (handle,"cnxk" , + nix->configured_cints); +if (rc) { +plt_err ("Fail to allocate intr vec list, rc=%d" , + rc); +return rc; }/* VFIO vector zero is resereved for misc interrupt so * doing required adjustment. (b13bfab4cd) */ - handle->intr_vec[q] =PLT_INTR_VEC_RXTX_OFFSET + vec; +if (plt_intr_vec_list_index_set (handle, q, +PLT_INTR_VEC_RXTX_OFFSET + vec)) +return -1 ;/* Configure CQE interrupt coalescing parameters */ plt_write64(((CQ_CQE_THRESH_DEFAULT) |
@@ -450,7 +450,7 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_cints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_CINT_START + q;
@@ -465,6 +465,8 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)dev_irq_unregister (handle, nix_lf_cq_irq, &nix->cints_mem[q], vec); } + +plt_intr_vec_list_free (handle);plt_free (nix->cints_mem); }
drivers/common/cnxk/roc_npa.c +1 -1
@@ -710,7 +710,7 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/common/cnxk/roc_platform.h +37 -11
68 lines not on this page · raw message
drivers/common/cnxk/roc_sso.c +2 -2
@@ -505,7 +505,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } - rc =sso_register_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, nb_hws, + rc =sso_register_irqs_priv (roc_sso, sso->pci_dev->intr_handle, nb_hws, nb_hwgrp);if (rc <0 ) {plt_err ("Failed to register SSO LF IRQs" );
@@ -535,7 +535,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)if (!roc_sso->nb_hws && !roc_sso->nb_hwgrp)return ; -sso_unregister_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, +sso_unregister_irqs_priv (roc_sso, sso->pci_dev->intr_handle, roc_sso->nb_hws, roc_sso->nb_hwgrp);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWS , roc_sso->nb_hws);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWGRP , roc_sso->nb_hwgrp);
drivers/common/cnxk/roc_tim.c +2 -2
@@ -200,7 +200,7 @@ roc_tim_lf_alloc(struct roc_tim *roc_tim, uint8_t ring_id, uint64_t *clk)if (clk) *clk = rsp->tenns_clk; - rc =tim_register_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, + rc =tim_register_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]);if (rc <0 ) {plt_tim_dbg ("Failed to register Ring[%d] IRQ" , ring_id);
@@ -223,7 +223,7 @@ roc_tim_lf_free(struct roc_tim *roc_tim, uint8_t ring_id)struct tim_ring_req *req;int rc = -ENOSPC ; -tim_unregister_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, +tim_unregister_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]); req =mbox_alloc_msg_tim_lf_free (dev->mbox);
drivers/common/octeontx2/otx2_dev.c +7 -7
@@ -643,7 +643,7 @@ otx2_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -693,7 +693,7 @@ mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int mbox_register_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -726,7 +726,7 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -758,7 +758,7 @@ mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ otx2_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -841,7 +841,7 @@ otx2_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;otx2_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -862,7 +862,7 @@ vf_flr_unregister_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int vf_flr_register_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int i, rc;otx2_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1039,7 +1039,7 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev)void otx2_dev_fini (struct rte_pci_device *pci_dev,void *otx2_dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct otx2_dev *dev = otx2_dev;struct otx2_idev_cfg *idev;struct otx2_mbox *mbox;
drivers/common/octeontx2/otx2_irq.c +68 -49
231 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +2 -2
@@ -36,7 +36,7 @@ otx2_cpt_lf_err_intr_unregister(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;/* Disable error interrupts */ otx2_write64 (~0ull , base +OTX2_CPT_LF_MISC_INT_ENA_W1C );
@@ -65,7 +65,7 @@ otx2_cpt_lf_err_intr_register(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int ret;/* Disable error interrupts */
drivers/event/octeontx2/otx2_evdev_irq.c +6 -6
@@ -29,7 +29,7 @@ sso_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -66,7 +66,7 @@ ssow_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -86,7 +86,7 @@ sso_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -101,7 +101,7 @@ ssow_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -198,7 +198,7 @@ static int tim_lf_register_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
@@ -226,7 +226,7 @@ static void tim_lf_unregister_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
drivers/mempool/octeontx2/otx2_mempool.c +1 -1
@@ -301,7 +301,7 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/net/atlantic/atl_ethdev.c +8 -12
@@ -359,7 +359,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) {struct atl_adapter *adapter = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);int err =0 ;
@@ -478,7 +478,7 @@ atl_dev_start(struct rte_eth_dev *dev) {struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;int status;int err;
@@ -524,10 +524,9 @@ atl_dev_start(struct rte_eth_dev *dev) } } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ;
@@ -607,7 +606,7 @@ atl_dev_stop(struct rte_eth_dev *dev)struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;PMD_INIT_FUNC_TRACE (); dev->data->dev_started =0 ;
@@ -637,10 +636,7 @@ atl_dev_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -691,7 +687,7 @@ static int atl_dev_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw;int ret;
drivers/net/avp/avp_ethdev.c +4 -4
@@ -711,7 +711,7 @@ avp_dev_interrupt_handler(void *data) status);/* re-enable UIO interrupt handling */ - ret =rte_intr_ack (&pci_dev->intr_handle); + ret =rte_intr_ack (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to re-enable UIO interrupts, ret=%d\n" , ret);
@@ -730,7 +730,7 @@ avp_dev_enable_interrupts(struct rte_eth_dev *eth_dev)return -EINVAL ;/* enable UIO interrupt handling */ - ret =rte_intr_enable (&pci_dev->intr_handle); + ret =rte_intr_enable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to enable UIO interrupts, ret=%d\n" , ret);
@@ -759,7 +759,7 @@ avp_dev_disable_interrupts(struct rte_eth_dev *eth_dev) RTE_PTR_ADD(registers, RTE_AVP_INTERRUPT_MASK_OFFSET));/* enable UIO interrupt handling */ - ret =rte_intr_disable (&pci_dev->intr_handle); + ret =rte_intr_disable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to disable UIO interrupts, ret=%d\n" , ret);
@@ -776,7 +776,7 @@ avp_dev_setup_interrupts(struct rte_eth_dev *eth_dev)int ret;/* register a callback handler with UIO for interrupt notifications */ - ret =rte_intr_callback_register (&pci_dev->intr_handle, + ret =rte_intr_callback_register (pci_dev->intr_handle, avp_dev_interrupt_handler, (void *)eth_dev);if (ret <0 ) {
drivers/net/axgbe/axgbe_ethdev.c +6 -6
@@ -313,7 +313,7 @@ axgbe_dev_interrupt_handler(void *param) } }/* Unmask interrupts since disabled after generation */ -rte_intr_ack (&pdata->pci_dev->intr_handle); +rte_intr_ack (pdata->pci_dev->intr_handle); }/*
@@ -374,7 +374,7 @@ axgbe_dev_start(struct rte_eth_dev *dev) }/* enable uio/vfio intr/eventfd mapping */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);/* phy start*/ pdata->phy_if.phy_start (pdata);
@@ -406,7 +406,7 @@ axgbe_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE (); -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);if (rte_bit_relaxed_get32 (AXGBE_STOPPED , &pdata->dev_state))return 0 ;
@@ -2311,7 +2311,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)return ret; } -rte_intr_callback_register (&pci_dev->intr_handle, +rte_intr_callback_register (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
@@ -2335,8 +2335,8 @@ axgbe_dev_close(struct rte_eth_dev *eth_dev)axgbe_dev_clear_queues (eth_dev);/* disable uio intr before callback unregister */ -rte_intr_disable (&pci_dev->intr_handle); -rte_intr_callback_unregister (&pci_dev->intr_handle, +rte_intr_disable (pci_dev->intr_handle); +rte_intr_callback_unregister (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev);
drivers/net/axgbe/axgbe_mdio.c +3 -3
@@ -933,7 +933,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }/* Disable auto-negotiation interrupt */ -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);/* Start auto-negotiation in a supported mode */ if (axgbe_use_mode (pdata,AXGBE_MODE_KR )) {
@@ -951,7 +951,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }else if (axgbe_use_mode (pdata,AXGBE_MODE_SGMII_100 )) {axgbe_set_mode (pdata,AXGBE_MODE_SGMII_100 ); }else { -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);return -EINVAL ; }
@@ -964,7 +964,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) pdata->kx_state =AXGBE_RX_BPA ;/* Re-enable auto-negotiation interrupt */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);axgbe_an37_enable_interrupts (pdata);axgbe_an_init (pdata);
drivers/net/bnx2x/bnx2x_ethdev.c +5 -5
@@ -134,7 +134,7 @@ bnx2x_interrupt_handler(void *param)PMD_DEBUG_PERIODIC_LOG (INFO , sc,"Interrupt handled" );bnx2x_interrupt_action (dev,1 ); -rte_intr_ack (&sc->pci_dev->intr_handle); +rte_intr_ack (sc->pci_dev->intr_handle); }static void bnx2x_periodic_start (void *param)
@@ -230,10 +230,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev) }if (IS_PF (sc)) { -rte_intr_callback_register (&sc->pci_dev->intr_handle, +rte_intr_callback_register (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev); -if (rte_intr_enable (&sc->pci_dev->intr_handle)) +if (rte_intr_enable (sc->pci_dev->intr_handle))PMD_DRV_LOG (ERR , sc,"rte_intr_enable failed" ); }
@@ -258,8 +258,8 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)bnx2x_dev_rxtx_init_dummy (dev);if (IS_PF (sc)) { -rte_intr_disable (&sc->pci_dev->intr_handle); -rte_intr_callback_unregister (&sc->pci_dev->intr_handle, +rte_intr_disable (sc->pci_dev->intr_handle); +rte_intr_callback_unregister (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev);/* stop the periodic callout */
drivers/net/bnxt/bnxt_ethdev.c +14 -19
@@ -729,7 +729,7 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp)static int bnxt_start_nic (struct bnxt *bp) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (bp->eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;uint32_t queue_id, base =BNXT_MISC_VEC_ID ;uint32_t vec =BNXT_MISC_VEC_ID ;
@@ -846,26 +846,24 @@ static int bnxt_start_nic(struct bnxt *bp)return rc; } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - bp->eth_dev->data->nb_rx_queues * -sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + bp->eth_dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , bp->eth_dev->data->nb_rx_queues); rc = -ENOMEM ; goto err_out; } -PMD_DRV_LOG (DEBUG ,"intr_handle->intr_vec = %p " -"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n" , - intr_handle->intr_vec, intr_handle->nb_efd, - intr_handle->max_intr); +PMD_DRV_LOG (DEBUG ,"intr_handle->nb_efd = %d " +"intr_handle->max_intr = %d\n" , +rte_intr_nb_efd_get (intr_handle), +rte_intr_max_intr_get (intr_handle));for (queue_id =0 ; queue_id < bp->eth_dev->data->nb_rx_queues; queue_id++) { - intr_handle->intr_vec[queue_id] = - vec +BNXT_RX_VEC_START ; -if (vec < base + intr_handle->nb_efd -1 ) +rte_intr_vec_list_index_set (intr_handle, + queue_id, vec +BNXT_RX_VEC_START ); +if (vec < base +rte_intr_nb_efd_get (intr_handle) + -1 ) vec++; } }
@@ -1473,7 +1471,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) {struct bnxt *bp = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct rte_eth_link link;int ret;
@@ -1515,10 +1513,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)/* Clean queue intr-vector mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);bnxt_hwrm_port_clr_stats (bp);bnxt_free_tx_mbufs (bp);
drivers/net/bnxt/bnxt_irq.c +2 -2
@@ -67,7 +67,7 @@ void bnxt_int_handler(void *param)int bnxt_free_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
@@ -170,7 +170,7 @@ int bnxt_setup_int(struct bnxt *bp)int bnxt_request_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
drivers/net/dpaa/dpaa_ethdev.c +31 -17
100 lines not on this page · raw message
drivers/net/dpaa2/dpaa2_ethdev.c +5 -5
@@ -1145,7 +1145,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle; dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device); - intr_handle = &dpaa2_dev->intr_handle; + intr_handle = dpaa2_dev->intr_handle;PMD_INIT_FUNC_TRACE ();
@@ -1216,8 +1216,8 @@ dpaa2_dev_start(struct rte_eth_dev *dev) }/* if the interrupts were configured on this devices*/ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/* Registering LSC interrupt handler */ rte_intr_callback_register(intr_handle, dpaa2_interrupt_handler,
@@ -1256,8 +1256,8 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();/* reset interrupt callback */ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/*disable dpni irqs */ dpaa2_eth_setup_irqs (dev,0 );
drivers/net/e1000/em_ethdev.c +9 -14
@@ -237,7 +237,7 @@ static int eth_em_dev_init(struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct e1000_adapter *adapter =E1000_DEV_PRIVATE (eth_dev->data->dev_private); struct e1000_hw *hw =
@@ -523,7 +523,7 @@ eth_em_start(struct rte_eth_dev *dev)struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret, mask;uint32_t intr_vector =0 ;uint32_t *speeds;
@@ -573,12 +573,10 @@ eth_em_start(struct rte_eth_dev *dev) }if (rte_intr_dp_is_en (intr_handle)) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" -" intr_vec" , dev->data->nb_rx_queues); +" intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ; }
@@ -716,7 +714,7 @@ eth_em_stop(struct rte_eth_dev *dev)struct rte_eth_link link;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle; dev->data->dev_started =0 ;
@@ -750,10 +748,7 @@ eth_em_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -765,7 +760,7 @@ eth_em_close(struct rte_eth_dev *dev)struct e1000_adapter *adapter =E1000_DEV_PRIVATE (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -1006,7 +1001,7 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue {struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;em_rxq_intr_enable (hw);rte_intr_ack (intr_handle);
drivers/net/e1000/igb_ethdev.c +36 -43
215 lines not on this page · raw message
drivers/net/ena/ena_ethdev.c +19 -16
@@ -494,7 +494,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter)static int ena_close (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_adapter *adapter = dev->data->dev_private;int ret =0 ;
@@ -954,7 +954,7 @@ static int ena_stop(struct rte_eth_dev *dev)struct ena_adapter *adapter = dev->data->dev_private;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Cannot free memory in secondary process */
@@ -976,10 +976,9 @@ static int ena_stop(struct rte_eth_dev *dev)rte_intr_disable (intr_handle);rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +/* Cleanup vector list */ +rte_intr_vec_list_free (intr_handle);rte_intr_enable (intr_handle);
@@ -995,7 +994,7 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring)struct ena_adapter *adapter = ring->adapter;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_com_create_io_ctx ctx =/* policy set to _HOST just to satisfy icc compiler */ {ENA_ADMIN_PLACEMENT_POLICY_HOST ,
@@ -1015,7 +1014,10 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring) ena_qid =ENA_IO_RXQ_IDX (ring->id); ctx.direction =ENA_COM_IO_QUEUE_DIRECTION_RX ;if (rte_intr_dp_is_en (intr_handle)) - ctx.msix_vector = intr_handle->intr_vec[ring->id]; + ctx.msix_vector = +rte_intr_vec_list_index_get (intr_handle, + ring->id); +for (i =0 ; i < ring->ring_size; i++) ring->empty_rx_reqs[i] = i; }
@@ -1824,7 +1826,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) pci_dev->addr.devid, pci_dev->addr.function); - intr_handle = &pci_dev->intr_handle; + intr_handle = pci_dev->intr_handle; adapter->regs = pci_dev->mem_resource[ENA_REGS_BAR ].addr; adapter->dev_mem_base = pci_dev->mem_resource[ENA_MEM_BAR ].addr;
@@ -3112,7 +3114,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,static int ena_setup_rx_intr (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;uint16_t vectors_nb, i;bool rx_intr_requested = dev->data->dev_conf.intr_conf.rxq;
@@ -3139,9 +3141,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) goto enable_intr; } - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (*intr_handle->intr_vec),0 ); -if (intr_handle->intr_vec ==NULL ) { +/* Allocate the vector list */ +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate interrupt vector for %d queues\n" , dev->data->nb_rx_queues);
@@ -3160,7 +3162,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) }for (i =0 ; i < vectors_nb; ++i) - intr_handle->intr_vec[i] =RTE_INTR_VEC_RXTX_OFFSET + i; +if (rte_intr_vec_list_index_set (intr_handle, i, +RTE_INTR_VEC_RXTX_OFFSET + i)) + goto disable_intr_efd;rte_intr_enable (intr_handle);return 0 ;
@@ -3168,8 +3172,7 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) disable_intr_efd:rte_intr_efd_disable (intr_handle); free_intr_vec: -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; +rte_intr_vec_list_free (intr_handle); enable_intr:rte_intr_enable (intr_handle);return rc;
drivers/net/enic/enic_main.c +13 -13
@@ -448,7 +448,7 @@ enic_intr_handler(void *arg)rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_INTR_LSC ,NULL );enic_log_q_error (enic);/* Re-enable irq in case of INTx */ -rte_intr_ack (&enic->pdev->intr_handle); +rte_intr_ack (enic->pdev->intr_handle); }static int enic_rxq_intr_init (struct enic *enic)
@@ -477,14 +477,16 @@ static int enic_rxq_intr_init(struct enic *enic) " interrupts\n");return err; } - intr_handle->intr_vec =rte_zmalloc ("enic_intr_vec" , - rxq_intr_count *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { + +if (rte_intr_vec_list_alloc (intr_handle,"enic_intr_vec" , + rxq_intr_count)) {dev_err (enic,"Failed to allocate intr_vec\n" );return -ENOMEM ; }for (i =0 ; i < rxq_intr_count; i++) - intr_handle->intr_vec[i] = i +ENICPMD_RXQ_INTR_OFFSET ; +if (rte_intr_vec_list_index_set (intr_handle, i, + i +ENICPMD_RXQ_INTR_OFFSET )) +return -rte_errno;return 0 ; }
@@ -494,10 +496,8 @@ static void enic_rxq_intr_deinit(struct enic *enic) intr_handle = enic->rte_dev->intr_handle;rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +rte_intr_vec_list_free (intr_handle); }static void enic_prep_wq_for_simple_tx (struct enic *enic,uint16_t queue_idx)
@@ -667,10 +667,10 @@ int enic_enable(struct enic *enic)vnic_dev_enable_wait (enic->vdev);/* Register and enable error interrupt */ -rte_intr_callback_register (&(enic->pdev->intr_handle), +rte_intr_callback_register (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev); -rte_intr_enable (&(enic->pdev->intr_handle)); +rte_intr_enable (enic->pdev->intr_handle);/* Unmask LSC interrupt */ vnic_intr_unmask (&enic->intr[ENICPMD_LSC_INTR_OFFSET ]);
@@ -1111,8 +1111,8 @@ int enic_disable(struct enic *enic) (void )vnic_intr_masked (&enic->intr[i]);/* flush write */ }enic_rxq_intr_deinit (enic); -rte_intr_disable (&enic->pdev->intr_handle); -rte_intr_callback_unregister (&enic->pdev->intr_handle, +rte_intr_disable (enic->pdev->intr_handle); +rte_intr_callback_unregister (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev);
drivers/net/failsafe/failsafe.c +17 -4
@@ -264,11 +264,23 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) RTE_ETHER_ADDR_BYTES(mac)); dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; -PRIV (dev)->intr_handle = (struct rte_intr_handle ){ - .fd =-1 , - .type =RTE_INTR_HANDLE_EXT , - }; + +/* Allocate interrupt instance */ +PRIV (dev)->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (PRIV (dev)->intr_handle ==NULL ) { +ERROR ("Failed to allocate intr handle" ); + goto cancel_alarm; + } + +if (rte_intr_fd_set (PRIV (dev)->intr_handle,-1 )) + goto cancel_alarm; + +if (rte_intr_type_set (PRIV (dev)->intr_handle,RTE_INTR_HANDLE_EXT )) + goto cancel_alarm; +rte_eth_dev_probing_finish (dev); +return 0 ; cancel_alarm:failsafe_hotplug_alarm_cancel (dev);
@@ -297,6 +309,7 @@ fs_rte_eth_free(const char *name)return 0 ;/* port already released */ ret =failsafe_eth_dev_close (dev);rte_eth_dev_release_port (dev); +rte_intr_instance_free (PRIV (dev)->intr_handle);return ret; }
drivers/net/failsafe/failsafe_intr.c +24 -19
84 lines not on this page · raw message
drivers/net/failsafe/failsafe_ops.c +13 -6
@@ -393,15 +393,22 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,* For the time being, fake as if we are using MSIX interrupts, * this will cause rte_intr_efd_enable to allocate an eventfd for us. */ -struct rte_intr_handle intr_handle = { - .type =RTE_INTR_HANDLE_VFIO_MSIX , - .efds = {-1 , }, - }; +struct rte_intr_handle *intr_handle;struct sub_device *sdev;struct rxq *rxq;uint8_t i;int ret; + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) +return -ENOMEM ; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_VFIO_MSIX )) +return -rte_errno; + +if (rte_intr_efds_index_set (intr_handle,0 ,-1 )) +return -rte_errno; +fs_lock (dev,0 );if (rx_conf->rx_deferred_start) { FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
@@ -435,12 +442,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, rxq->info.nb_desc = nb_rx_desc; rxq->priv =PRIV (dev); rxq->sdev =PRIV (dev)->subs; - ret =rte_intr_efd_enable (&intr_handle,1 ); + ret =rte_intr_efd_enable (intr_handle,1 );if (ret <0 ) {fs_unlock (dev,0 );return ret; } - rxq->event_fd = intr_handle.efds[0 ]; + rxq->event_fd =rte_intr_efds_index_get (intr_handle,0 ); dev->data->rx_queues[rx_queue_id] = rxq; FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { ret = rte_eth_rx_queue_setup(PORT_ID(sdev),
drivers/net/failsafe/failsafe_private.h +1 -1
@@ -166,7 +166,7 @@ struct fs_priv {struct rte_ether_addr *mcast_addrs;/* current capabilities */ struct rte_eth_dev_owner my_owner;/* Unique owner. */ -struct rte_intr_handle intr_handle;/* Port interrupt handle. */ +struct rte_intr_handle *intr_handle;/* Port interrupt handle. */ /* * Fail-safe state machine. * This level will be tracking state of the EAL and eth
drivers/net/fm10k/fm10k_ethdev.c +17 -15
@@ -32,7 +32,8 @@#define BIT_MASK_PER_UINT32 ((1 << CHARS_PER_UINT32) - 1)
Lines of this file are not shown. View the raw message.
drivers/net/hns3/hns3_ethdev.c +27 -30
57 lines not on this page · raw message
drivers/net/hns3/hns3_ethdev_vf.c +32 -32
64 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +26 -27
53 lines not on this page · raw message
drivers/net/iavf/iavf_ethdev.c +21 -21
42 lines not on this page · raw message
drivers/net/ice/ice_ethdev.c +24 -25
49 lines not on this page · raw message
drivers/net/igc/igc_ethdev.c +21 -24
45 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethdev.c +30 -36
66 lines not on this page · raw message
drivers/net/memif/memif_socket.c +79 -29
108 lines not on this page · raw message
drivers/net/memif/rte_eth_memif.c +44 -12
56 lines not on this page · raw message
drivers/net/mlx4/mlx4_intr.c +28 -19
47 lines not on this page · raw message
drivers/net/mlx5/linux/mlx5_os.c +35 -20
55 lines not on this page · raw message
drivers/net/mlx5/mlx5_rxq.c +24 -19
43 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +17 -18
Lines of this file are not shown. View the raw message.
drivers/net/vhost/rte_eth_vhost.c +45 -35
80 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.c +35 -21
56 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethdev.c +23 -20
43 lines not on this page · raw message
drivers/raw/ifpga/ifpga_rawdev.c +46 -16
62 lines not on this page · raw message
drivers/regex/octeontx2/otx2_regexdev_hw_access.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +30 -14
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.23.0
Part of the diff is not shown here. View the raw message.
PATCH v6 7/9 interrupts: make interrupt handle structure opaque
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Moving interrupt handle structure definition inside a EAL private header to make its fields totally opaque to the outside world.
---
Changes since v5:
- let rte_intr_handle fields untouched:
- split vfio / uio fd renames in a separate commit,
- split event list update in a separate commit,
- moved rte_intr_handle definition to a EAL private header,
- preserved dumping all info in interrupt tracepoints,
--- lib/eal/common/eal_common_interrupts.c | 2 + lib/eal/common/eal_interrupts.h | 37 +++++++++++++ lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 -------------------------- lib/eal/include/rte_eal_trace.h | 2 + lib/eal/include/rte_interrupts.h | 24 ++++++++- 6 files changed, 63 insertions(+), 75 deletions(-) create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h
lib/eal/common/eal_common_interrupts.c +2 -0
@@ -10,6 +10,8 @@#include <rte_log.h> #include <rte_malloc.h> +#include "eal_interrupts.h" +/* Macros to check for valid interrupt handle */ #define CHECK_VALID_INTR_HANDLE (intr_handle) do { \ if (intr_handle == NULL) { \
lib/eal/common/eal_interrupts.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2014 Intel Corporation +*/ + +#ifndef EAL_INTERRUPTS_H +#define EAL_INTERRUPTS_H + +struct rte_intr_handle { + RTE_STD_C11 + union { +struct { + RTE_STD_C11 + union { +/** VFIO device file descriptor */ +int vfio_dev_fd; +/** UIO cfg file desc for uio_pci_generic */ +int uio_cfg_fd; + }; +int fd;/**< interrupt event file descriptor */ + }; +void *windows_handle;/**< device driver handle */ + }; +uint32_t alloc_flags;/**< flags passed at allocation */ +enum rte_intr_handle_type type;/**< handle type */ +uint32_t max_intr;/**< max interrupt requested */ +uint32_t nb_efd;/**< number of available efd(event fd) */ +uint8_t efd_counter_size;/**< size of efd counter, used for vdev */ +uint16_t nb_intr; +/**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ +int efds[RTE_MAX_RXTX_INTR_VEC_ID ];/**< intr vectors/efds mapping */ +struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID ]; +/**< intr vector epoll event */ +uint16_t vec_list_size; +int *intr_vec;/**< intr vector number array */ +}; + +#endif /* EAL_INTERRUPTS_H */
lib/eal/include/meson.build +0 -1
@@ -49,7 +49,6 @@ headers += files( 'rte_version.h', 'rte_vfio.h', ) -indirect_headers += files('rte_eal_interrupts.h') # special case install the generic headers, since they go in a subdir generic_headers = files(
lib/eal/include/rte_eal_interrupts.h deleted +0 -72
72 lines not on this page · raw message
lib/eal/include/rte_eal_trace.h +2 -0
@@ -19,6 +19,8 @@ extern "C" {#include <rte_interrupts.h> #include <rte_trace_point.h> +#include "eal_interrupts.h" +/* Alarm */ RTE_TRACE_POINT( rte_eal_trace_alarm_set,
lib/eal/include/rte_interrupts.h +22 -2
@@ -35,6 +35,28 @@ struct rte_intr_handle;/** Interrupt instance will be shared between primary and secondary processes. */ #define RTE_INTR_INSTANCE_F_SHARED RTE_BIT32(0) +#define RTE_MAX_RXTX_INTR_VEC_ID 512 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 + +/** +* The interrupt source type, e.g. UIO, VFIO, ALARM etc. +*/ +enum rte_intr_handle_type { +RTE_INTR_HANDLE_UNKNOWN =0 ,/**< generic unknown handle */ +RTE_INTR_HANDLE_UIO ,/**< uio device handle */ +RTE_INTR_HANDLE_UIO_INTX ,/**< uio generic handle */ +RTE_INTR_HANDLE_VFIO_LEGACY ,/**< vfio device handle (legacy) */ +RTE_INTR_HANDLE_VFIO_MSI ,/**< vfio device handle (MSI) */ +RTE_INTR_HANDLE_VFIO_MSIX ,/**< vfio device handle (MSIX) */ +RTE_INTR_HANDLE_ALARM ,/**< alarm handle */ +RTE_INTR_HANDLE_EXT ,/**< external handler */ +RTE_INTR_HANDLE_VDEV ,/**< virtual device */ +RTE_INTR_HANDLE_DEV_EVENT ,/**< device event handle */ +RTE_INTR_HANDLE_VFIO_REQ ,/**< VFIO request handle */ +RTE_INTR_HANDLE_MAX /**< count of elements */ +}; +/** Function to be registered for the specific interrupt */ typedef void (*rte_intr_callback_fn )(void *cb_arg);
@@ -45,8 +67,6 @@ typedef void (*rte_intr_callback_fn)(void *cb_arg);typedef void (*rte_intr_unregister_callback_fn )(struct rte_intr_handle *intr_handle,void *cb_arg); -#include "rte_eal_interrupts.h" -/** * It registers the callback for the specific interrupt. Multiple * callbacks can be registered at the same time.
Signature · 1 line
2.23.0
PATCH v6 8/9 interrupts: rename device specific file descriptor
In reply to David MarchandFrom: Harman Kalra <[email protected]>
VFIO/UIO are mutually exclusive, storing file descriptor in a single field is enough.
---
Changes since v5:
- split from patch5,
--- lib/eal/common/eal_common_interrupts.c | 6 +++--- lib/eal/common/eal_interrupts.h | 8 +------- lib/eal/include/rte_eal_trace.h | 8 ++++---- 3 files changed, 8 insertions(+), 14 deletions(-)
lib/eal/common/eal_common_interrupts.c +3 -3
@@ -72,7 +72,7 @@ struct rte_intr_handle *rte_intr_instance_dup(const struct rte_intr_handle *src) intr_handle =rte_intr_instance_alloc (src->alloc_flags); intr_handle->fd = src->fd; - intr_handle->vfio_dev_fd = src->vfio_dev_fd; + intr_handle->dev_fd = src->dev_fd; intr_handle->type = src->type; intr_handle->max_intr = src->max_intr; intr_handle->nb_efd = src->nb_efd;
@@ -139,7 +139,7 @@ int rte_intr_dev_fd_set(struct rte_intr_handle *intr_handle, int fd) {CHECK_VALID_INTR_HANDLE (intr_handle); - intr_handle->vfio_dev_fd = fd; + intr_handle->dev_fd = fd;return 0 ; fail:
@@ -150,7 +150,7 @@ int rte_intr_dev_fd_get(const struct rte_intr_handle *intr_handle) {CHECK_VALID_INTR_HANDLE (intr_handle); -return intr_handle->vfio_dev_fd; +return intr_handle->dev_fd; fail:return -1 ; }
lib/eal/common/eal_interrupts.h +1 -7
@@ -9,13 +9,7 @@ struct rte_intr_handle {RTE_STD_C11 union {struct { - RTE_STD_C11 - union { -/** VFIO device file descriptor */ -int vfio_dev_fd; -/** UIO cfg file desc for uio_pci_generic */ -int uio_cfg_fd; - }; +int dev_fd;/**< VFIO/UIO cfg device file descriptor */ int fd;/**< interrupt event file descriptor */ };void *windows_handle;/**< device driver handle */
lib/eal/include/rte_eal_trace.h +4 -4
@@ -151,7 +151,7 @@ RTE_TRACE_POINT( RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, rte_intr_callback_fn cb, void *cb_arg, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -164,7 +164,7 @@ RTE_TRACE_POINT( RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, rte_intr_callback_fn cb, void *cb_arg, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -176,7 +176,7 @@ RTE_TRACE_POINT( rte_eal_trace_intr_enable, RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -186,7 +186,7 @@ RTE_TRACE_POINT( rte_eal_trace_intr_disable, RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
Signature · 1 line
2.23.0
PATCH v6 9/9 interrupts: extend event list
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Dynamically allocating the efds and elist array os intr_handle structure, based on size provided by user. Eg size can be MSIX interrupts supported by a PCI device.
---
Changes since v5:
- split from patch5,
--- drivers/bus/pci/linux/pci_vfio.c | 6 ++ drivers/common/cnxk/roc_platform.h | 1 + lib/eal/common/eal_common_interrupts.c | 119 ++++++++++++++++++++++++- lib/eal/common/eal_interrupts.h | 5 +- 4 files changed, 126 insertions(+), 5 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +6 -0
@@ -266,6 +266,12 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)return -1 ; } +/* Reallocate the efds and elist fields of intr_handle based +* on PCI device MSIX size. +*/ +if (rte_intr_event_list_update (dev->intr_handle, irq.count)) +return -1 ; +/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) {
drivers/common/cnxk/roc_platform.h +1 -0
@@ -121,6 +121,7 @@#define plt_intr_instance_alloc rte_intr_instance_alloc#define plt_intr_instance_dup rte_intr_instance_dup#define plt_intr_instance_free rte_intr_instance_free +#define plt_intr_event_list_update rte_intr_event_list_update#define plt_intr_max_intr_get rte_intr_max_intr_get#define plt_intr_max_intr_set rte_intr_max_intr_set#define plt_intr_nb_efd_get rte_intr_nb_efd_get
lib/eal/common/eal_common_interrupts.c +117 -2
165 lines not on this page · raw message
lib/eal/common/eal_interrupts.h +2 -3
@@ -21,9 +21,8 @@ struct rte_intr_handle {uint8_t efd_counter_size;/**< size of efd counter, used for vdev */ uint16_t nb_intr;/**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ -int efds[RTE_MAX_RXTX_INTR_VEC_ID ];/**< intr vectors/efds mapping */ -struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID ]; -/**< intr vector epoll event */ +int *efds;/**< intr vectors/efds mapping */ +struct rte_epoll_event *elist;/**< intr vector epoll event */ uint16_t vec_list_size;int *intr_vec;/**< intr vector number array */ };
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v6 9/9] interrupts: extend event list
Hi David,
With some nits below,
2021-10-24 22:04 (UTC+0200), David Marchand:
Quoted 3 lines
From: Harman Kalra <[email protected]>
Dynamically allocating the efds and elist array os
intr_handle
Typo: "os" -> "of"
Quoted 10 lines
structure, based on size provided by user. Eg size can be MSIX interrupts supported by a PCI device.
Signed-off-by Harman Kalra <[email protected]>Signed-off-by David Marchand <[email protected]>---
Changes since v5:
- split from patch5,---
[...]
Quoted 4 lines
lib/eal/common/eal_common_interrupts.c +0
-0
[...]
lib/eal/common/eal_common_interrupts.c int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle, · line 338
Quoted 11 lines
int
rte_intr_fd_set(struct rte_intr_handle *intr_handle, int fd)lib/eal/common/eal_common_interrupts.c +6
-0@@ -239,6 +330,12 @@ int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle, {CHECK_VALID_INTR_HANDLE (intr_handle); +if (intr_handle->efds ==NULL ) { +RTE_LOG (ERR ,EAL ,"Event fd list not allocated\n" ); + rte_errno =EFAULT ; + goto fail; + } +
Here and below:
The check for nb_intr will already catch not allocated efds, because nb_intr is necessarily 0 in this case.
Quoted 42 lines
lib/eal/common/eal_common_interrupts.c +18
-0if (index >= intr_handle->nb_intr) {RTE_LOG (ERR ,EAL ,"Invalid index %d, max limit %d\n" , index, intr_handle->nb_intr);@@ -256,6 +353,12 @@ int rte_intr_efds_index_set(struct rte_intr_handle *intr_handle, {CHECK_VALID_INTR_HANDLE (intr_handle); +if (intr_handle->efds ==NULL ) { +RTE_LOG (ERR ,EAL ,"Event fd list not allocated\n" ); + rte_errno =EFAULT ; + goto fail; + } +if (index >= intr_handle->nb_intr) {RTE_LOG (ERR ,EAL ,"Invalid size %d, max limit %d\n" , index, intr_handle->nb_intr);@@ -275,6 +378,12 @@ struct rte_epoll_event *rte_intr_elist_index_get( {CHECK_VALID_INTR_HANDLE (intr_handle); +if (intr_handle->elist ==NULL ) { +RTE_LOG (ERR ,EAL ,"Event list not allocated\n" ); + rte_errno =EFAULT ; + goto fail; + } +if (index >= intr_handle->nb_intr) {RTE_LOG (ERR ,EAL ,"Invalid index %d, max limit %d\n" , index, intr_handle->nb_intr);@@ -292,6 +401,12 @@ int rte_intr_elist_index_set(struct rte_intr_handle *intr_handle, {CHECK_VALID_INTR_HANDLE (intr_handle); +if (intr_handle->elist ==NULL ) { +RTE_LOG (ERR ,EAL ,"Event list not allocated\n" ); + rte_errno =EFAULT ; + goto fail; + } +if (index >= intr_handle->nb_intr) {RTE_LOG (ERR ,EAL ,"Invalid index %d, max limit %d\n" , index, intr_handle->nb_intr);
[...]
Re: [dpdk-dev] [PATCH v6 9/9] interrupts: extend event list
Quoted 10 lines · Dmitry Kozlyuk
Quoted 4 lines
lib/eal/common/eal_common_interrupts.c +0
-0[...]
Quoted 5 lines
int
rte_intr_fd_set(struct rte_intr_handle *intr_handle, int fd)lib/eal/common/eal_common_interrupts.c +0
-0@@ -239,6 +330,12 @@ int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle, {CHECK_VALID_INTR_HANDLE (intr_handle);
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c int rte_intr_efds_index_get(const struct rte_intr_handle *intr_handle, · line 338
Quoted 6 lines
lib/eal/common/eal_common_interrupts.c +6
-0+if (intr_handle->efds ==NULL ) { +RTE_LOG (ERR ,EAL ,"Event fd list not allocated\n" ); + rte_errno =EFAULT ; + goto fail; + } +Here and below:
The check fornb_intrwill already catch not allocatedefds, becausenb_intris necessarily 0 in this case.
+1.
Thanks Dmitry.
Signature · 1 line
David Marchand
Hi,
Quoted 268 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Harman Kalra
Sent: Friday, October 22, 2021 11:49 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Harman Kalra <[email protected]>
Subject: [dpdk-dev] [PATCH v5 0/6] makerte_intr_handleinternalMoving struct
rte_intr_handleas an internal structure to avoid any ABI breakages in future. Since this structure defines some static arrays and changing respective macros breaks the ABI. Eg:
CurrentlyRTE_MAX_RXTX_INTR_VEC_IDimposes a limit of maximum 512 MSI-X interrupts that can be defined for a PCI device, while PCI specification allows maximum 2048 MSI-X interrupts that can be used. If some PCI device requires more than 512 vectors, either change theRTE_MAX_RXTX_INTR_VEC_IDlimit or dynamically allocate based on PCI device MSI-X size on probe time. Either way its an ABI breakage.Change already included in 21.11 ABI improvement spreadsheet (item 42):
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Furld
efense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps- 3A__docs.google.com_s&data=04%7C01%7Crasland%40nvidia.com%7C 567d8ee2e3c842a9e59808d9959d822e%7C43083d15727340c1b7db39efd9ccc1 7a%7C0%7C0%7C637705326003996997%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% 7C1000&sdata=7UgxpkEtH%2Fnjk7xo9qELjqWi58XLzzCH2pimeDWLzvc% 3D&reserved=0 preadsheets_d_1betlC000ua5SsSiJIcC54mCCCJnW6voH5Dqv9UxeyfE_edit- 23gid-
3D0&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V- 7JdkxT_Z_SU6RrS37ys4U XudBQ_rrS5LRo&m=7dl3OmXU7QHMmWYB6V1hYJtq1cUkjfhXUwze2Si_48c &s=lh6DEGhR
Bg1shODpAy3RQk-H-0uQx5icRfUBf9dtCp4&e=This series makes struct
rte_intr_handletotally opaque to the outside world by wrapping it inside a .c file and providing get set wrapper APIs to read or manipulate its fields.. Any changes to be made to any of the fields should be done via these get set APIs.
Introduced a neweal_common_interrupts.cwhere all these APIs are defined
and also hides structrte_intr_handledefinition.Details on each patch of the series:
Patch 1: eal/interrupts: implement get set APIs
This patch provides prototypes and implementation of all the new get set APIs. Alloc APIs are implemented to allocate memory for interrupt handle instance. Currently most of the drivers defines interrupt handle instance as static but now it cant be static as size ofrte_intr_handleis unknown to all the drivers. Drivers are expected to allocate interrupt instances during initialization and free these instances during cleanup phase.
This patch also rearranges the headers related to interrupt framework. Epoll related definitions prototypes are moved into a new header i.e.rte_epoll.hand APIs defined inrte_eal_interrupts.hwhich were driver specific are moved torte_interrupts.h(as anyways it was accessible and used outside DPDK library. Later in the seriesrte_eal_interrupts.his removed.Patch 2: eal/interrupts: avoid direct access to interrupt handle Modifying the interrupt framework for linux and freebsd to use these get set alloc APIs as per requirement and avoid accessing the fields directly.
Patch 3: test/interrupt: apply get set interrupt handle APIs Updating interrupt test suite to use interrupt handle APIs.
Patch 4: drivers: remove direct access to interrupt handle fields Modifying all the drivers and libraries which are currently directly accessing the interrupt handle fields. Drivers are expected to allocated the interrupt instance, use get set APIs with the allocated interrupt handle and free it on cleanup.
Patch 5: eal/interrupts: make interrupt handle structure opaque In this patch
rte_eal_interrupt.his removed, structrte_intr_handledefinition is moved to c file to make it completely opaque. As part of interrupt handle allocation, array like efds and elist(which are currently static) are dynamically allocated with default size (RTE_MAX_RXTX_INTR_VEC_ID). Later these arrays can be reallocated as per device requirement using new APIrte_intr_handle_event_list_update(). Eg, on PCI device probing MSIX size can be queried and these arrays can be reallocated accordingly.Patch 6: eal/alarm: introduce alarm fini routine
Introducing alarm fini routine, as the memory allocated for alarm interrupt instance can be freed in alarm fini.Testing performed:
1. Validated the series by running interrupts and alarm test suite.
2. Validate l3fwd power functionality with octeontx2 and i40e intel cards, where interrupts are expected on packet arrival.v1:
* Fixed freebsd compilation failure
* Fixed seg fault in case of memifv2:
* Merged the prototype and implementation patch to 1.
* Restricting allocation of single interrupt instance.
* Removed base APIs, as they were exposing internally allocated memory information.
* Fixed some memory leak issues.
* Marked some library specific APIs as internal.v3:
* Removed flag from instance alloc API, rather auto detect if memory should be allocated using glibc malloc APIs or rte_malloc*
* Added APIs for get/set windows handle.
* Defined macros for repeated checks.v4:
* Rectified some typo in the APIs documentation.
* Better names for some internal variables.v5:
* Reverted back to passing flag to instance alloc API, as with auto detect some multiprocess issues existing in the library were causing tests failure.
* Rebased to top of tree.Harman Kalra (6):
eal/interrupts: implement get set APIs eal/interrupts: avoid direct access to interrupt handle test/interrupt: apply get set interrupt handle APIs
drivers: remove direct access to interrupt handle eal/interrupts: make interrupt handle structure opaque eal/alarm: introduce alarm fini routineMAINTAINERS | 1 + app/test/test_interrupts.c | 163 +++-- drivers/baseband/acc100/rte_acc100_pmd.c | 18 +- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 21 +- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 21 +- drivers/bus/auxiliary/auxiliary_common.c | 2 + drivers/bus/auxiliary/linux/auxiliary.c | 10 + drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 16 +- drivers/bus/fslmc/fslmc_vfio.c | 32 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 20 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 15 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 21 +- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 73 +- drivers/bus/pci/linux/pci_vfio.c | 115 ++- drivers/bus/pci/pci_common.c | 29 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 37 +- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 24 +- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +- drivers/common/cnxk/roc_irq.c | 108 +-- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 +- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +- drivers/common/octeontx2/otx2_irq.c | 117 +-- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 47 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 +- drivers/net/e1000/igb_ethdev.c | 79 +-- drivers/net/ena/ena_ethdev.c | 35 +- drivers/net/enic/enic_main.c | 26 +- drivers/net/failsafe/failsafe.c | 23 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 19 +- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 +- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 +- drivers/net/hns3/hns3_ethdev_vf.c | 64 +- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 +- drivers/net/iavf/iavf_ethdev.c | 42 +- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 +- drivers/net/ice/ice_ethdev.c | 49 +- drivers/net/igc/igc_ethdev.c | 45 +- drivers/net/ionic/ionic_ethdev.c | 17 +- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +- drivers/net/memif/memif_socket.c | 111 ++- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 61 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 53 +- drivers/net/mlx5/linux/mlx5_socket.c | 25 +- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 42 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 26 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 +- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 +- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +- drivers/net/qede/qede_ethdev.c | 16 +- drivers/net/sfc/sfc_intr.c | 30 +- drivers/net/tap/rte_eth_tap.c | 36 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +- drivers/net/thunderx/nicvf_ethdev.c | 12 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 76 +- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 48 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 62 +- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 10 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 45 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 588 +++++++++++++++ lib/eal/common/eal_private.h | 11 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 53 +- lib/eal/freebsd/eal_interrupts.c | 112 ++- lib/eal/include/meson.build | 2 +- lib/eal/include/rte_eal_interrupts.h | 269 ------- lib/eal/include/rte_eal_trace.h | 24 +- lib/eal/include/rte_epoll.h | 118 ++++ lib/eal/include/rte_interrupts.h | 668 +++++++++++++++++- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 37 +- lib/eal/linux/eal_dev.c | 63 +- lib/eal/linux/eal_interrupts.c | 303 +++++--- lib/eal/version.map | 46 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 132 files changed, 3631 insertions(+), 1713 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c delete mode 100644 lib/eal/include/rte_eal_interrupts.h create mode 100644 lib/eal/include/rte_epoll.h
Quoted 2 lines
--
2.18.0
This series is causing this seg fault with MLX5 pmd:
Thread 1 "dpdk-l3fwd-powe" received signal SIGSEGV, Segmentation fault. rte_intr_free_epoll_fd (intr_handle=0x0) at ../lib/eal/linux/eal_interrupts.c:1512
1512 if (__atomic_load_n(&rev->status,
(gdb) bt
#0 rte_intr_free_epoll_fd (intr_handle=0x0) at ../lib/eal/linux/eal_interrupts.c:1512 #1 0x0000555556de7814 in mlx5_rx_intr_vec_disable (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_rxq.c:934 #2 0x0000555556de73da in mlx5_rx_intr_vec_enable (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_rxq.c:836 #3 0x0000555556e04012 in mlx5_dev_start (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_trigger.c:1146 #4 0x0000555555b82da7 in rte_eth_dev_start (port_id=0) at ../lib/ethdev/rte_ethdev.c:1823 #5 0x000055555575e66d in main (argc=7, argv=0x7fffffffe3f0) at ../examples/l3fwd-power/main.c:2811
(gdb) f 1
#1 0x0000555556de7814 in mlx5_rx_intr_vec_disable (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_rxq.c:934
934 rte_intr_free_epoll_fd(intr_handle);
It can be easily reproduced as following:
dpdk-l3fwd-power -n 4 -a 0000:08:00.0,txq_inline_mpw=439,rx_vec_en=1 -a 0000:08:00.,txq_inline_mpw=439,rx_vec_en=1 -c 0xfffffff -- -p 0x3 -P --interrupt-only --parse-ptype --config='(0, 0, 0)(1, 0, 1)(0, 1, 2)(1, 1, 3)(0, 2, 4)(1, 2, 5)(0, 3, 6)(1, 3, 7)'
Kindest regards,
Raslan Darawsheh
Quoted 285 lines · Raslan Darawsheh
Hi,
Quoted 268 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Harman Kalra
Sent: Friday, October 22, 2021 11:49 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; NBU-Contact-Thomas Monjalon <[email protected]>; Harman Kalra <[email protected]>
Subject: [dpdk-dev] [PATCH v5 0/6] makerte_intr_handleinternalMoving struct
rte_intr_handleas an internal structure to avoid any ABI breakages in future. Since this structure defines some static arrays and changing respective macros breaks the ABI. Eg:
CurrentlyRTE_MAX_RXTX_INTR_VEC_IDimposes a limit of maximum 512 MSI-X interrupts that can be defined for a PCI device, while PCI specification allows maximum 2048 MSI-X interrupts that can be used. If some PCI device requires more than 512 vectors, either change theRTE_MAX_RXTX_INTR_VEC_IDlimit or dynamically allocate based on PCI device MSI-X size on probe time. Either way its an ABI breakage.Change already included in 21.11 ABI improvement spreadsheet (item 42):
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Furld
efense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps- 3A__docs.google.com_s&data=04%7C01%7Crasland%40nvidia.com%7C 567d8ee2e3c842a9e59808d9959d822e%7C43083d15727340c1b7db39efd9ccc1 7a%7C0%7C0%7C637705326003996997%7CUnknown%7CTWFpbGZsb3d8eyJ WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% 7C1000&sdata=7UgxpkEtH%2Fnjk7xo9qELjqWi58XLzzCH2pimeDWLzvc% 3D&reserved=0 preadsheets_d_1betlC000ua5SsSiJIcC54mCCCJnW6voH5Dqv9UxeyfE_edit- 23gid-
3D0&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V- 7JdkxT_Z_SU6RrS37ys4U XudBQ_rrS5LRo&m=7dl3OmXU7QHMmWYB6V1hYJtq1cUkjfhXUwze2Si_48c &s=lh6DEGhR
Bg1shODpAy3RQk-H-0uQx5icRfUBf9dtCp4&e=This series makes struct
rte_intr_handletotally opaque to the outside world by wrapping it inside a .c file and providing get set wrapper APIs to read or manipulate its fields.. Any changes to be made to any of the fields should be done via these get set APIs.
Introduced a neweal_common_interrupts.cwhere all these APIs are defined
and also hides structrte_intr_handledefinition.Details on each patch of the series:
Patch 1: eal/interrupts: implement get set APIs
This patch provides prototypes and implementation of all the new get set APIs. Alloc APIs are implemented to allocate memory for interrupt handle instance. Currently most of the drivers defines interrupt handle instance as static but now it cant be static as size ofrte_intr_handleis unknown to all the drivers. Drivers are expected to allocate interrupt instances during initialization and free these instances during cleanup phase.
This patch also rearranges the headers related to interrupt framework. Epoll related definitions prototypes are moved into a new header i.e.rte_epoll.hand APIs defined inrte_eal_interrupts.hwhich were driver specific are moved torte_interrupts.h(as anyways it was accessible and used outside DPDK library. Later in the seriesrte_eal_interrupts.his removed.Patch 2: eal/interrupts: avoid direct access to interrupt handle Modifying the interrupt framework for linux and freebsd to use these get set alloc APIs as per requirement and avoid accessing the fields directly.
Patch 3: test/interrupt: apply get set interrupt handle APIs Updating interrupt test suite to use interrupt handle APIs.
Patch 4: drivers: remove direct access to interrupt handle fields Modifying all the drivers and libraries which are currently directly accessing the interrupt handle fields. Drivers are expected to allocated the interrupt instance, use get set APIs with the allocated interrupt handle and free it on cleanup.
Patch 5: eal/interrupts: make interrupt handle structure opaque In this patch
rte_eal_interrupt.his removed, structrte_intr_handledefinition is moved to c file to make it completely opaque. As part of interrupt handle allocation, array like efds and elist(which are currently static) are dynamically allocated with default size (RTE_MAX_RXTX_INTR_VEC_ID). Later these arrays can be reallocated as per device requirement using new APIrte_intr_handle_event_list_update(). Eg, on PCI device probing MSIX size can be queried and these arrays can be reallocated accordingly.Patch 6: eal/alarm: introduce alarm fini routine
Introducing alarm fini routine, as the memory allocated for alarm interrupt instance can be freed in alarm fini.Testing performed:
1. Validated the series by running interrupts and alarm test suite.
2. Validate l3fwd power functionality with octeontx2 and i40e intel cards, where interrupts are expected on packet arrival.v1:
* Fixed freebsd compilation failure
* Fixed seg fault in case of memifv2:
* Merged the prototype and implementation patch to 1.
* Restricting allocation of single interrupt instance.
* Removed base APIs, as they were exposing internally allocated memory information.
* Fixed some memory leak issues.
* Marked some library specific APIs as internal.v3:
* Removed flag from instance alloc API, rather auto detect if memory should be allocated using glibc malloc APIs or rte_malloc*
* Added APIs for get/set windows handle.
* Defined macros for repeated checks.v4:
* Rectified some typo in the APIs documentation.
* Better names for some internal variables.v5:
* Reverted back to passing flag to instance alloc API, as with auto detect some multiprocess issues existing in the library were causing tests failure.
* Rebased to top of tree.Harman Kalra (6):
eal/interrupts: implement get set APIs eal/interrupts: avoid direct access to interrupt handle test/interrupt: apply get set interrupt handle APIs
drivers: remove direct access to interrupt handle eal/interrupts: make interrupt handle structure opaque eal/alarm: introduce alarm fini routineMAINTAINERS | 1 + app/test/test_interrupts.c | 163 +++-- drivers/baseband/acc100/rte_acc100_pmd.c | 18 +- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 21 +- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 21 +- drivers/bus/auxiliary/auxiliary_common.c | 2 + drivers/bus/auxiliary/linux/auxiliary.c | 10 + drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 16 +- drivers/bus/fslmc/fslmc_vfio.c | 32 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 20 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 15 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 21 +- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 73 +- drivers/bus/pci/linux/pci_vfio.c | 115 ++- drivers/bus/pci/pci_common.c | 29 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 37 +- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 24 +- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +- drivers/common/cnxk/roc_irq.c | 108 +-- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 +- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +- drivers/common/octeontx2/otx2_irq.c | 117 +-- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 47 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 +- drivers/net/e1000/igb_ethdev.c | 79 +-- drivers/net/ena/ena_ethdev.c | 35 +- drivers/net/enic/enic_main.c | 26 +- drivers/net/failsafe/failsafe.c | 23 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 19 +- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 +- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 +- drivers/net/hns3/hns3_ethdev_vf.c | 64 +- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 +- drivers/net/iavf/iavf_ethdev.c | 42 +- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 +- drivers/net/ice/ice_ethdev.c | 49 +- drivers/net/igc/igc_ethdev.c | 45 +- drivers/net/ionic/ionic_ethdev.c | 17 +- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +- drivers/net/memif/memif_socket.c | 111 ++- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 61 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 53 +- drivers/net/mlx5/linux/mlx5_socket.c | 25 +- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 42 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 26 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 +- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 +- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +- drivers/net/qede/qede_ethdev.c | 16 +- drivers/net/sfc/sfc_intr.c | 30 +- drivers/net/tap/rte_eth_tap.c | 36 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +- drivers/net/thunderx/nicvf_ethdev.c | 12 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 76 +- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 48 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 62 +- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 10 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 45 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 588 +++++++++++++++ lib/eal/common/eal_private.h | 11 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 53 +- lib/eal/freebsd/eal_interrupts.c | 112 ++- lib/eal/include/meson.build | 2 +- lib/eal/include/rte_eal_interrupts.h | 269 ------- lib/eal/include/rte_eal_trace.h | 24 +- lib/eal/include/rte_epoll.h | 118 ++++ lib/eal/include/rte_interrupts.h | 668 +++++++++++++++++- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 37 +- lib/eal/linux/eal_dev.c | 63 +- lib/eal/linux/eal_interrupts.c | 303 +++++--- lib/eal/version.map | 46 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 132 files changed, 3631 insertions(+), 1713 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c delete mode 100644 lib/eal/include/rte_eal_interrupts.h create mode 100644 lib/eal/include/rte_epoll.hQuoted 2 lines
--
2.18.0This series is causing this seg fault with MLX5 pmd:
Thread 1 "dpdk-l3fwd-powe" received signal SIGSEGV, Segmentation fault.rte_intr_free_epoll_fd(intr_handle=0x0) at../lib/eal/linux/eal_interrupts.c:1512
1512 if (__atomic_load_n(&rev->status,
(gdb) bt#0 rte_intr_free_epoll_fd (intr_handle=0x0) at ../lib/eal/linux/eal_interrupts.c:1512 #1 0x0000555556de7814 in mlx5_rx_intr_vec_disable (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_rxq.c:934 #2 0x0000555556de73da in mlx5_rx_intr_vec_enable (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_rxq.c:836 #3 0x0000555556e04012 in mlx5_dev_start (dev=0x55555b554a40 <rte_eth_devices>) at ../drivers/net/mlx5/mlx5_trigger.c:1146 #4 0x0000555555b82da7 in rte_eth_dev_start (port_id=0) at ../lib/ethdev/rte_ethdev.c:1823 #5 0x000055555575e66d in main (argc=7, argv=0x7fffffffe3f0) at ../examples/l3fwd-power/main.c:2811
Quoted 8 lines
(gdb) f 1
#10x0000555556de7814inmlx5_rx_intr_vec_disable(dev=0x55555b554a40 <rte_eth_devices>) at../drivers/net/mlx5/mlx5_rxq.c:934
934rte_intr_free_epoll_fd(intr_handle);It can be easily reproduced as following:
dpdk-l3fwd-power -n 4 -a 0000:08:00.0,txq_inline_mpw=439,rx_vec_en=1 -a 0000:08:00.,txq_inline_mpw=439,rx_vec_en=1 -c0xfffffff-- -p0x3-P --interrupt-only --parse-ptype --config='(0, 0, 0)(1, 0, 1)(0, 1, 2)(1, 1, 3)(0, 2, 4)(1, 2, 5)(0, 3, 6)(1, 3, 7)'
That confirms my suspicion on pci bus update that look at RTE_PCI_DRV_NEED_MAPPING.
v7 incoming.
Signature · 1 line
David Marchand
v7 cover make rte_intr_handle internal
In reply to Harman KalraMoving struct rte_intr_handle as an internal structure to avoid any ABI breakages in future. Since this structure defines some static arrays and changing respective macros breaks the ABI. Eg:
Currently RTE_MAX_RXTX_INTR_VEC_ID imposes a limit of maximum 512 MSI-X interrupts that can be defined for a PCI device, while PCI specification allows maximum 2048 MSI-X interrupts that can be used. If some PCI device requires more than 512 vectors, either change the RTE_MAX_RXTX_INTR_VEC_ID limit or dynamically allocate based on PCI device MSI-X size on probe time. Either way its an ABI breakage.
Change already included in 21.11 ABI improvement spreadsheet (item 42):
https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_s
preadsheets_d_1betlC000ua5SsSiJIcC54mCCCJnW6voH5Dqv9UxeyfE_edit-23gid- 3D0&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V-7JdkxT_Z_SU6RrS37ys4U XudBQ_rrS5LRo&m=7dl3OmXU7QHMmWYB6V1hYJtq1cUkjfhXUwze2Si_48c&s=lh6DEGhR Bg1shODpAy3RQk-H-0uQx5icRfUBf9dtCp4&e=
This series makes struct rte_intr_handle totally opaque to the outside world by wrapping it inside a .c file and providing get set wrapper APIs to read or manipulate its fields.. Any changes to be made to any of the fields should be done via these get set APIs.
Introduced a new eal_common_interrupts.c where all these APIs are defined and also hides struct rte_intr_handle definition.
v1:
* Fixed freebsd compilation failure
* Fixed seg fault in case of memif
v2:
* Merged the prototype and implementation patch to 1.
* Restricting allocation of single interrupt instance.
* Removed base APIs, as they were exposing internally allocated memory information.
* Fixed some memory leak issues.
* Marked some library specific APIs as internal.
v3:
* Removed flag from instance alloc API, rather auto detect if memory should be allocated using glibc malloc APIs or rte_malloc*
* Added APIs for get/set windows handle.
* Defined macros for repeated checks.
v4:
* Rectified some typo in the APIs documentation.
* Better names for some internal variables.
v5:
* Reverted back to passing flag to instance alloc API, as with auto detect some multiprocess issues existing in the library were causing tests failure.
* Rebased to top of tree.
v6:
* renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
* changed API and removed need for alloc_flag content exposure (see rte_intr_instance_dup() in patch 1 and 2),
* exported all symbols for Windows,
* fixed leak in unit tests in case of alloc failure,
* split (previously) patch 4 into three patches
* (now) patch 4 only concerns alarm and (previously) patch 6 cleanup bits are squashed in it,
* (now) patch 5 concerns other libraries updates,
* (now) patch 6 concerns drivers updates:
* instance allocation is moved to probing for auxiliary,
* there might be a bug for PCI drivers non requesting RTE_PCI_DRV_NEED_MAPPING, but code is left as v5,
* split (previously) patch 5 into three patches
* (now) patch 7 only hides structure, but keep it in a EAL private header, this makes it possible to keep info in tracepoints,
* (now) patch 8 deals with VFIO/UIO internal fds merge,
* (now) patch 9 extends event list,
v7:
* fixed compilation on FreeBSD,
* removed unused interrupt handle in FreeBSD alarm code,
* fixed interrupt handle allocation for PCI drivers without RTE_PCI_DRV_NEED_MAPPING,
Signature · 153 lines
David Marchand Harman Kalra (9): interrupts: add allocator and accessors interrupts: remove direct access to interrupt handle test/interrupts: remove direct access to interrupt handle alarm: remove direct access to interrupt handle lib: remove direct access to interrupt handle drivers: remove direct access to interrupt handle interrupts: make interrupt handle structure opaque interrupts: rename device specific file descriptor interrupts: extend event list MAINTAINERS | 1 + app/test/test_interrupts.c | 164 +++-- drivers/baseband/acc100/rte_acc100_pmd.c | 14 +- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 24 +- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 24 +- drivers/bus/auxiliary/auxiliary_common.c | 17 +- drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 14 +- drivers/bus/fslmc/fslmc_vfio.c | 30 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 18 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 13 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 20 +- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 69 +- drivers/bus/pci/linux/pci_vfio.c | 108 ++- drivers/bus/pci/pci_common.c | 47 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 35 +- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 23 +- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +- drivers/common/cnxk/roc_irq.c | 107 +-- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 +- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +- drivers/common/octeontx2/otx2_irq.c | 117 ++-- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 48 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 +- drivers/net/e1000/igb_ethdev.c | 79 +-- drivers/net/ena/ena_ethdev.c | 35 +- drivers/net/enic/enic_main.c | 26 +- drivers/net/failsafe/failsafe.c | 21 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 19 +- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 +- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 +- drivers/net/hns3/hns3_ethdev_vf.c | 64 +- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 +- drivers/net/iavf/iavf_ethdev.c | 42 +- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 +- drivers/net/ice/ice_ethdev.c | 49 +- drivers/net/igc/igc_ethdev.c | 45 +- drivers/net/ionic/ionic_ethdev.c | 17 +- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +- drivers/net/memif/memif_socket.c | 108 ++- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 56 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 55 +- drivers/net/mlx5/linux/mlx5_socket.c | 25 +- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 43 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 25 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 +- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 +- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +- drivers/net/qede/qede_ethdev.c | 16 +- drivers/net/sfc/sfc_intr.c | 30 +- drivers/net/tap/rte_eth_tap.c | 33 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 33 +- drivers/net/thunderx/nicvf_ethdev.c | 10 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 80 ++- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 56 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 62 +- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 8 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 21 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 504 ++++++++++++++ lib/eal/common/eal_interrupts.h | 30 + lib/eal/common/eal_private.h | 10 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 35 +- lib/eal/freebsd/eal_interrupts.c | 85 ++- lib/eal/include/meson.build | 2 +- lib/eal/include/rte_eal_interrupts.h | 269 -------- lib/eal/include/rte_eal_trace.h | 10 +- lib/eal/include/rte_epoll.h | 118 ++++ lib/eal/include/rte_interrupts.h | 651 +++++++++++++++++- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 +- lib/eal/linux/eal_dev.c | 57 +- lib/eal/linux/eal_interrupts.c | 304 ++++---- lib/eal/version.map | 45 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 132 files changed, 3453 insertions(+), 1748 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h create mode 100644 lib/eal/include/rte_epoll.h -- 2.23.0
PATCH v7 1/9 interrupts: add allocator and accessors
From: Harman Kalra <[email protected]>
Prototype/Implement get set APIs for interrupt handle fields. User won't be able to access any of the interrupt handle fields directly while should use these get/set APIs to access/manipulate them.
Internal interrupt header i.e. rte_eal_interrupt.h is rearranged, as APIs defined are moved to rte_interrupts.h and epoll specific definitions are moved to a new header rte_epoll.h. Later in the series rte_eal_interrupt.h will be removed.
---
Changes since v5:
- renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
- used a single bit to mark instance as shared (default is private),
- removed rte_intr_instance_copy / rte_intr_instance_alloc_flag_get with a single rte_intr_instance_dup helper,
- made rte_intr_vec_list_alloc alloc_flags-aware,
- exported all symbols for Windows,
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 411 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 207 +------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 627 +++++++++++++++++++++++++ lib/eal/version.map | 45 +- 8 files changed, 1201 insertions(+), 210 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.h
MAINTAINERS +1 -0
@@ -211,6 +211,7 @@ F: app/test/test_memzone.c Interrupt Subsystem M: Harman Kalra <[email protected]> +F: lib/eal/include/rte_epoll.h F: lib/eal/*/*interrupts.* F: app/test/test_interrupts.c
lib/eal/common/eal_common_interrupts.c new file +411 -0
411 lines not on this page · raw message
lib/eal/common/meson.build +1 -0
@@ -15,6 +15,7 @@ sources += files( 'eal_common_errno.c', 'eal_common_fbarray.c', 'eal_common_hexdump.c', + 'eal_common_interrupts.c', 'eal_common_launch.c', 'eal_common_lcore.c', 'eal_common_log.c',
lib/eal/include/meson.build +1 -0
@@ -19,6 +19,7 @@ headers += files( 'rte_eal_memconfig.h', 'rte_eal_trace.h', 'rte_errno.h', + 'rte_epoll.h', 'rte_fbarray.h', 'rte_hexdump.h', 'rte_hypervisor.h',
lib/eal/include/rte_eal_interrupts.h +5 -202
228 lines not on this page · raw message
lib/eal/include/rte_epoll.h new file +118 -0
118 lines not on this page · raw message
lib/eal/include/rte_interrupts.h +627 -0
647 lines not on this page · raw message
lib/eal/version.map +37 -8
67 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH v7 2/9 interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field.
---
Changes since v6:
- fixed compilation on FreeBSD,
Changes since v5:
- used new helper rte_intr_instance_dup,
--- lib/eal/freebsd/eal_interrupts.c | 85 +++++---- lib/eal/linux/eal_interrupts.c | 304 +++++++++++++++++-------------- 2 files changed, 219 insertions(+), 170 deletions(-)
lib/eal/freebsd/eal_interrupts.c +47 -38
@@ -40,7 +40,7 @@ struct rte_intr_callback {struct rte_intr_source {TAILQ_ENTRY (rte_intr_source) next; -struct rte_intr_handle intr_handle;/**< interrupt handle */ +struct rte_intr_handle *intr_handle;/**< interrupt handle */ struct rte_intr_cb_list callbacks;/**< user callbacks */ uint32_t active; };
@@ -60,7 +60,7 @@ static int intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) {/* alarm callbacks are special case */ -if (ih->type ==RTE_INTR_HANDLE_ALARM ) { +if (rte_intr_type_get (ih) ==RTE_INTR_HANDLE_ALARM ) {uint64_t timeout_ns;/* get soonest alarm timeout */
@@ -75,7 +75,7 @@ intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) }else { ke->filter =EVFILT_READ ; } - ke->ident = ih->fd; + ke->ident =rte_intr_fd_get (ih);return 0 ; }
@@ -89,7 +89,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,int ret =0 , add_event =0 ;/* first do parameter checking */ -if (intr_handle ==NULL || intr_handle->fd <0 || cb ==NULL ) { +if (rte_intr_fd_get (intr_handle) <0 || cb ==NULL ) {RTE_LOG (ERR ,EAL ,"Registering with invalid input parameter\n" );return -EINVAL ;
@@ -103,7 +103,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* find the source for this intr_handle */ TAILQ_FOREACH(src, &intr_sources, next) { -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ; }
@@ -112,8 +112,9 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,* thing on the list should be eal_alarm_callback() and we may * be called just to reset the timer. */ -if (src !=NULL && src->intr_handle.type ==RTE_INTR_HANDLE_ALARM && - !TAILQ_EMPTY (&src->callbacks)) { +if (src !=NULL && +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM && + !TAILQ_EMPTY (&src->callbacks)) { callback =NULL ; }else {/* allocate a new interrupt callback entity */
@@ -135,7 +136,14 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; + src->intr_handle =rte_intr_instance_dup (intr_handle); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); + ret = -ENOMEM ; +free (src); + src =NULL ; + goto fail; + }TAILQ_INIT (&src->callbacks);TAILQ_INSERT_TAIL (&intr_sources, src, next); }
@@ -151,7 +159,8 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* add events to the queue. timer events are special as we need to * re-set the timer. */ -if (add_event || src->intr_handle.type ==RTE_INTR_HANDLE_ALARM ) { +if (add_event || +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM ) {struct kevent ke;memset (&ke,0 ,sizeof (ke));
@@ -173,12 +182,11 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,*/ if (errno ==ENODEV )RTE_LOG (DEBUG ,EAL ,"Interrupt handle %d not supported\n" , - src->intr_handle.fd); +rte_intr_fd_get (src->intr_handle));else -RTE_LOG (ERR ,EAL ,"Error adding fd %d " -"kevent, %s\n" , - src->intr_handle.fd, -strerror (errno)); +RTE_LOG (ERR ,EAL ,"Error adding fd %d kevent, %s\n" , +rte_intr_fd_get (src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +221,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -228,7 +236,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -268,7 +276,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -282,7 +290,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -314,7 +322,8 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" , - src->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (src->intr_handle), +strerror (errno));/* removing non-existent even is an expected condition * in some circumstances (e.g. oneshot events). */
@@ -365,17 +374,18 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -386,9 +396,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +415,18 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -427,9 +437,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +450,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)int rte_intr_ack (const struct rte_intr_handle *intr_handle) { -if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV ) +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +472,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_lock (&intr_lock); TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == event_fd) +if (rte_intr_fd_get (src->intr_handle) == event_fd)break ;if (src ==NULL ) {rte_spinlock_unlock (&intr_lock);
@@ -475,7 +484,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_unlock (&intr_lock);/* set the length to be read dor different handle type */ -switch (src->intr_handle.type) { +switch (rte_intr_type_get (src->intr_handle)) {case RTE_INTR_HANDLE_ALARM : bytes_read =0 ; call = true;
@@ -546,7 +555,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)/* mark for deletion from the queue */ ke.flags =EV_DELETE ; -if (intr_source_to_kevent (&src->intr_handle, &ke) <0 ) { +if (intr_source_to_kevent (src->intr_handle, &ke) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot convert to kevent\n" );rte_spinlock_unlock (&intr_lock);return ;
@@ -556,8 +565,8 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)* remove intr file descriptor from wait list. */ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) { -RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" , +rte_intr_fd_get (src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +576,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)TAILQ_REMOVE (&src->callbacks, cb, next);if (cb->ucb_fn) - cb->ucb_fn (&src->intr_handle, cb->cb_arg); + cb->ucb_fn (src->intr_handle, cb->cb_arg);free (cb); } }
lib/eal/linux/eal_interrupts.c +172 -132
754 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH v7 3/9 test/interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Updating the interrupt testsuite to make use of interrupt handle get set APIs.
---
Changes since v5:
- fixed leak on when some interrupt handle can't be allocated,
--- app/test/test_interrupts.c | 164 ++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 66 deletions(-)
app/test/test_interrupts.c +98 -66
@@ -16,7 +16,7 @@/* predefined interrupt handle types */ enum test_interrupt_handle_type { -TEST_INTERRUPT_HANDLE_INVALID , +TEST_INTERRUPT_HANDLE_INVALID =0 ,TEST_INTERRUPT_HANDLE_VALID ,TEST_INTERRUPT_HANDLE_VALID_UIO ,TEST_INTERRUPT_HANDLE_VALID_ALARM ,
@@ -27,7 +27,7 @@ enum test_interrupt_handle_type {/* flag of if callback is called */ static volatile int flag; -static struct rte_intr_handle intr_handles[TEST_INTERRUPT_HANDLE_MAX ]; +static struct rte_intr_handle *intr_handles[TEST_INTERRUPT_HANDLE_MAX ];static enum test_interrupt_handle_type test_intr_type =TEST_INTERRUPT_HANDLE_MAX ;
@@ -50,7 +50,7 @@ static union intr_pipefds pfds;static inline int test_interrupt_handle_sanity_check (struct rte_intr_handle *intr_handle) { -if (!intr_handle || intr_handle->fd <0 ) +if (!intr_handle ||rte_intr_fd_get (intr_handle) <0 )return -1 ;return 0 ;
@@ -62,31 +62,54 @@ test_interrupt_handle_sanity_check(struct rte_intr_handle *intr_handle)static int test_interrupt_init (void ) { +struct rte_intr_handle *test_intr_handle; +int i; +if (pipe (pfds.pipefd) <0 )return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].fd =-1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) { + intr_handles[i] = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (!intr_handles[i]) +return -1 ; + } - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; +if (rte_intr_fd_set (test_intr_handle,-1 )) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].type = -RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; + + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].type = -RTE_INTR_HANDLE_ALARM ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_ALARM )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].type = -RTE_INTR_HANDLE_DEV_EVENT ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_DEV_EVENT )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].fd = pfds.writefd; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].type =RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; +if (rte_intr_fd_set (test_intr_handle, pfds.writefd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ;return 0 ; }
@@ -97,6 +120,10 @@ test_interrupt_init(void)static int test_interrupt_deinit (void ) { +int i; + +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) +rte_intr_instance_free (intr_handles[i]);close (pfds.pipefd[0 ]);close (pfds.pipefd[1 ]);
@@ -125,8 +152,10 @@ test_interrupt_handle_compare(struct rte_intr_handle *intr_handle_l,if (!intr_handle_l || !intr_handle_r)return -1 ; -if (intr_handle_l->fd != intr_handle_r->fd || - intr_handle_l->type != intr_handle_r->type) +if (rte_intr_fd_get (intr_handle_l) != +rte_intr_fd_get (intr_handle_r) || +rte_intr_type_get (intr_handle_l) != +rte_intr_type_get (intr_handle_r))return -1 ;return 0 ;
@@ -178,6 +207,8 @@ static void test_interrupt_callback(void *arg) {struct rte_intr_handle *intr_handle = arg; +struct rte_intr_handle *test_intr_handle; +if (test_intr_type >=TEST_INTERRUPT_HANDLE_MAX ) {printf ("invalid interrupt type\n" ); flag =-1 ;
@@ -198,8 +229,8 @@ test_interrupt_callback(void *arg)return ; } -if (test_interrupt_handle_compare (intr_handle, - &(intr_handles[test_intr_type])) ==0 ) + test_intr_handle = intr_handles[test_intr_type]; +if (test_interrupt_handle_compare (intr_handle, test_intr_handle) ==0 ) flag =1 ; }
@@ -223,7 +254,7 @@ test_interrupt_callback_1(void *arg)static int test_interrupt_enable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_enable (NULL ) ==0 ) {
@@ -233,7 +264,7 @@ test_interrupt_enable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable invalid intr_handle " "successfully\n" );return -1 ;
@@ -241,7 +272,7 @@ test_interrupt_enable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -249,7 +280,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -257,7 +288,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -265,13 +296,13 @@ test_interrupt_enable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_enable (&test_intr_handle) <0 ) { +if (rte_intr_enable (test_intr_handle) <0 ) {printf ("fail to enable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -286,7 +317,7 @@ test_interrupt_enable(void)static int test_interrupt_disable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_disable (NULL ) ==0 ) {
@@ -297,7 +328,7 @@ test_interrupt_disable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable invalid intr_handle " "successfully\n" );return -1 ;
@@ -305,7 +336,7 @@ test_interrupt_disable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -313,7 +344,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -321,7 +352,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -329,13 +360,13 @@ test_interrupt_disable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_disable (&test_intr_handle) <0 ) { +if (rte_intr_disable (test_intr_handle) <0 ) {printf ("fail to disable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -351,13 +382,13 @@ static int test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type) {int count; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle; flag =0 ; test_intr_handle = intr_handles[intr_type]; test_intr_type = intr_type; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("fail to register callback\n" );return -1 ; }
@@ -371,9 +402,9 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)rte_delay_ms (TEST_INTERRUPT_CHECK_INTERVAL );while ((count = -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, - &test_intr_handle)) <0 ) { + test_intr_handle)) <0 ) {if (count != -EAGAIN )return -1 ; }
@@ -396,11 +427,11 @@ static inttest_interrupt (void) {int ret =-1 ; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;if (test_interrupt_init () <0 ) {printf ("fail to initialize for testing interrupt\n" ); -return -1 ; + goto out; }printf ("Check unknown valid interrupt full path\n" );
@@ -445,8 +476,8 @@ test_interrupt(void)/* check if it will fail to register cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with invalid " "intr_handle\n" ); goto out;
@@ -454,7 +485,8 @@ test_interrupt(void)/* check if it will fail to register without callback */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle,NULL , &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle,NULL , + test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with " "null callback\n" ); goto out;
@@ -470,8 +502,8 @@ test_interrupt(void)/* check if it will fail to unregister cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) >0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) >0 ) {printf ("unexpectedly unregister successfully with " "invalid intr_handle\n" ); goto out;
@@ -479,29 +511,29 @@ test_interrupt(void)/* check if it is ok to register the same intr_handle twice */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback_1, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback_1, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback_1\n" ); goto out; }/* check if it will fail to unregister with invalid parameter */ -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)0xff ) !=0 ) {printf ("unexpectedly unregisters successfully with " "invalid arg\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <=0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) <=0 ) {printf ("it fails to unregister test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ) <=0 ) {printf ("it fails to unregister test_interrupt_callback_1 " "for all\n" );
@@ -529,27 +561,27 @@ test_interrupt(void)printf ("Clearing for interrupt tests\n" );/* clear registered callbacks */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 );rte_delay_ms (2 *TEST_INTERRUPT_CHECK_INTERVAL );
Signature · 1 line
2.23.0
PATCH v7 4/9 alarm: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
---
Changes since v6:
- removed unused interrupt handle in FreeBSD alarm code,
Changes since v5:
- split from patch4,
- merged patch6,
- renamed rte_eal_alarm_fini as rte_eal_alarm_cleanup,
--- lib/eal/common/eal_private.h | 10 ++++++++++ lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 35 +++++++++++++++++++++++++++++------ lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 +++++++++++++++++++++++++------- 5 files changed, 66 insertions(+), 13 deletions(-)
lib/eal/common/eal_private.h +10 -0
@@ -163,6 +163,16 @@ int rte_eal_intr_init(void);*/ int rte_eal_alarm_init (void ); +/** +* Alarm mechanism cleanup. +* +* This function is private to EAL. +* +* @return +* 0 on success, negative on error +*/ +void rte_eal_alarm_cleanup (void ); +/** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded.
lib/eal/freebsd/eal.c +1 -0
@@ -975,6 +975,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/freebsd/eal_alarm.c +29 -6
@@ -32,7 +32,6 @@struct alarm_entry {LIST_ENTRY (alarm_entry) next; -struct rte_intr_handle handle;struct timespec time;rte_eal_alarm_callback cb_fn;void *cb_arg;
@@ -43,22 +42,46 @@ struct alarm_entry { static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();static rte_spinlock_t alarm_list_lk =RTE_SPINLOCK_INITIALIZER ; -static struct rte_intr_handle intr_handle = {.fd =-1 }; +static struct rte_intr_handle *intr_handle;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_cleanup (void ) +{ +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) { - intr_handle.type =RTE_INTR_HANDLE_ALARM ; +int fd; + + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + goto error; + } + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error; + +if (rte_intr_fd_set (intr_handle,-1 )) + goto error;/* on FreeBSD, timers don't use fd's, and their identifiers are stored * in separate namespace from fd's, so using any value is OK. however, * EAL interrupts handler expects fd's to be unique, so use an actual fd * to guarantee unique timer identifier. */ - intr_handle.fd =open ("/dev/zero" ,O_RDONLY ); + fd =open ("/dev/zero" ,O_RDONLY ); + +if (rte_intr_fd_set (intr_handle, fd)) + goto error;return 0 ; +error: +rte_intr_instance_free (intr_handle); +return -1 ; } static inline int
@@ -118,7 +141,7 @@ unregister_current_callback(void) ap =LIST_FIRST (&alarm_list);do { - ret =rte_intr_callback_unregister (&intr_handle, + ret =rte_intr_callback_unregister (intr_handle, eal_alarm_callback, &ap->time); }while (ret == -EAGAIN ); }
@@ -136,7 +159,7 @@ register_first_callback(void) ap =LIST_FIRST (&alarm_list);/* register a new callback */ - ret =rte_intr_callback_register (&intr_handle, + ret =rte_intr_callback_register (intr_handle, eal_alarm_callback, &ap->time); }return ret;
lib/eal/linux/eal.c +1 -0
@@ -1368,6 +1368,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/linux/eal_alarm.c +25 -7
@@ -54,22 +54,40 @@ struct alarm_entry { static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();static rte_spinlock_t alarm_list_lk =RTE_SPINLOCK_INITIALIZER ; -static struct rte_intr_handle intr_handle = {.fd =-1 }; +static struct rte_intr_handle *intr_handle;static int handler_registered =0 ;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_cleanup (void ) +{ +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) { - intr_handle.type =RTE_INTR_HANDLE_ALARM ; + + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + goto error; + } + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error; +/* create a timerfd file descriptor */ - intr_handle.fd =timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ); -if (intr_handle.fd ==-1 ) +if (rte_intr_fd_set (intr_handle, +timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ))) goto error; +if (rte_intr_fd_get (intr_handle) ==-1 ) + goto error;return 0 ; error: +rte_intr_instance_free (intr_handle); rte_errno = errno;return -1 ; }
@@ -109,7 +127,7 @@ eal_alarm_callback(void *arg __rte_unused) atime.it_value.tv_sec -= now.tv_sec; atime.it_value.tv_nsec -= now.tv_nsec; -timerfd_settime (intr_handle.fd,0 , &atime,NULL ); +timerfd_settime (rte_intr_fd_get (intr_handle),0 , &atime,NULL ); }rte_spinlock_unlock (&alarm_list_lk); }
@@ -140,7 +158,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)rte_spinlock_lock (&alarm_list_lk);if (!handler_registered) {/* registration can fail, callback can be registered later */ -if (rte_intr_callback_register (&intr_handle, +if (rte_intr_callback_register (intr_handle, eal_alarm_callback,NULL ) ==0 ) handler_registered =1 ; }
@@ -170,7 +188,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg) .tv_nsec = (us % US_PER_S) * NS_PER_US, }, }; - ret |=timerfd_settime (intr_handle.fd,0 , &alarm_time,NULL ); + ret |=timerfd_settime (rte_intr_fd_get (intr_handle),0 , &alarm_time,NULL ); }rte_spinlock_unlock (&alarm_list_lk);
Signature · 1 line
2.23.0
PATCH v7 5/9 lib: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
---
Changes since v5:
- split from patch4,
--- lib/bbdev/rte_bbdev.c | 4 +-- lib/eal/linux/eal_dev.c | 57 ++++++++++++++++++++++++----------------- lib/ethdev/rte_ethdev.c | 14 +++++----- 3 files changed, 43 insertions(+), 32 deletions(-)
lib/bbdev/rte_bbdev.c +2 -2
@@ -1094,7 +1094,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,VALID_QUEUE_OR_RET_ERR (queue_id, dev); intr_handle = dev->intr_handle; -if (!intr_handle || !intr_handle->intr_vec) { +if (intr_handle ==NULL ) {rte_bbdev_log (ERR ,"Device %u intr handle unset\n" , dev_id);return -ENOTSUP ; }
@@ -1105,7 +1105,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,return -ENOTSUP ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); ret =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (ret && (ret != -EEXIST )) { rte_bbdev_log(ERR,
lib/eal/linux/eal_dev.c +34 -23
127 lines not on this page · raw message
lib/ethdev/rte_ethdev.c +7 -7
@@ -4819,13 +4819,13 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; }for (qid =0 ; qid < dev->data->nb_rx_queues; qid++) { - vec = intr_handle->intr_vec[qid]; + vec =rte_intr_vec_list_index_get (intr_handle, qid); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
@@ -4860,15 +4860,15 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -1 ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); efd_idx = (vec >=RTE_INTR_VEC_RXTX_OFFSET ) ? (vec -RTE_INTR_VEC_RXTX_OFFSET ) : vec; - fd = intr_handle->efds[efd_idx]; + fd =rte_intr_efds_index_get (intr_handle, efd_idx);return fd; }
@@ -5046,12 +5046,12 @@ rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
Signature · 1 line
2.23.0
Re: [dpdk-dev] [PATCH v7 5/9] lib: remove direct access to interrupt handle
Quoted 17 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of David Marchand
Sent: Monday, October 25, 2021 9:35 PM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Chautru, Nicolas <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [dpdk-dev] [PATCH v7 5/9] lib: remove direct access to interrupt handleFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
Quoted 7 lines
Signed-off-by Harman Kalra <[email protected]>Signed-off-by David Marchand <[email protected]>---
Changes since v5:
- split from patch4,---
Hi Harman,
When we test dpdk-21.11-rc1, find a bug https://bugs.dpdk.org/show_bug.cgi?id=845, its bad commit id is c2bd9367e18f5b00c1a3c5eb281a512ef52c5dfd/Author: Harman Kalra <[email protected]> Could you pls have a look?
PATCH v7 6/9 drivers: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the drivers access the interrupt handle fields.
---
Changes since v6:
- fixed interrupt handle allocation for drivers without RTE_PCI_DRV_NEED_MAPPING,
Changes since v5:
- moved instance allocation to probing for auxiliary,
- fixed dev_irq_register() return value sign on error for drivers/common/cnxk/roc_irq.c,
--- drivers/baseband/acc100/rte_acc100_pmd.c | 14 +-- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 24 ++-- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 24 ++-- drivers/bus/auxiliary/auxiliary_common.c | 17 ++- drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 ++++- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 14 ++- drivers/bus/fslmc/fslmc_vfio.c | 30 +++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 18 ++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 13 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 20 +-- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 69 +++++++---- drivers/bus/pci/linux/pci_vfio.c | 102 +++++++++------ drivers/bus/pci/pci_common.c | 47 +++++-- drivers/bus/pci/pci_common_uio.c | 21 ++-- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 35 ++++-- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 23 ++-- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +-- drivers/common/cnxk/roc_irq.c | 107 +++++++++------- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +++--- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 48 +++++-- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +-- drivers/common/octeontx2/otx2_irq.c | 117 ++++++++++-------- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 ++- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +++-- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 48 ++++--- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 ++-- drivers/net/e1000/igb_ethdev.c | 79 ++++++------ drivers/net/ena/ena_ethdev.c | 35 +++--- drivers/net/enic/enic_main.c | 26 ++-- drivers/net/failsafe/failsafe.c | 21 +++- drivers/net/failsafe/failsafe_intr.c | 43 ++++--- drivers/net/failsafe/failsafe_ops.c | 19 ++- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 ++--- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 ++++----- drivers/net/hns3/hns3_ethdev_vf.c | 64 +++++----- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 ++++---- drivers/net/iavf/iavf_ethdev.c | 42 +++---- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 ++-- drivers/net/ice/ice_ethdev.c | 49 ++++---- drivers/net/igc/igc_ethdev.c | 45 ++++--- drivers/net/ionic/ionic_ethdev.c | 17 +-- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +++++----- drivers/net/memif/memif_socket.c | 108 +++++++++++----- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 56 +++++++-- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 ++- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 ++++--- drivers/net/mlx5/linux/mlx5_os.c | 55 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 25 ++-- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 43 ++++--- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 25 ++-- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 ++--- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 ++--- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +++--- drivers/net/qede/qede_ethdev.c | 16 +-- drivers/net/sfc/sfc_intr.c | 30 ++--- drivers/net/tap/rte_eth_tap.c | 33 +++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 33 ++--- drivers/net/thunderx/nicvf_ethdev.c | 10 ++ drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +++--- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 80 ++++++------ drivers/net/virtio/virtio_ethdev.c | 21 ++-- .../net/virtio/virtio_user/virtio_user_dev.c | 56 +++++---- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 ++++--- drivers/raw/ifpga/ifpga_rawdev.c | 62 +++++++--- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 8 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 21 ++-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 ++++--- lib/ethdev/ethdev_pci.h | 2 +- 111 files changed, 1673 insertions(+), 1183 deletions(-)
drivers/baseband/acc100/rte_acc100_pmd.c +7 -7
@@ -720,8 +720,8 @@ acc100_intr_enable(struct rte_bbdev *dev)struct acc100_device *d = dev->data->dev_private;/* Only MSI are currently supported */ -if (dev->intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSI || - dev->intr_handle->type ==RTE_INTR_HANDLE_UIO ) { +if (rte_intr_type_get (dev->intr_handle) ==RTE_INTR_HANDLE_VFIO_MSI || +rte_intr_type_get (dev->intr_handle) ==RTE_INTR_HANDLE_UIO ) { ret =allocate_info_ring (dev);if (ret <0 ) {
@@ -1098,8 +1098,8 @@ acc100_queue_intr_enable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =1 ;
@@ -1111,8 +1111,8 @@ acc100_queue_intr_disable(struct rte_bbdev *dev, uint16_t queue_id) {struct acc100_queue *q = dev->data->queues[queue_id].queue_private; -if (dev->intr_handle->type !=RTE_INTR_HANDLE_VFIO_MSI && - dev->intr_handle->type !=RTE_INTR_HANDLE_UIO ) +if (rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_VFIO_MSI && +rte_intr_type_get (dev->intr_handle) !=RTE_INTR_HANDLE_UIO )return -ENOTSUP ; q->irq_enable =0 ;
@@ -4185,7 +4185,7 @@ static int acc100_pci_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke ACC100 device initialization function */
drivers/baseband/fpga_5gnr_fec/rte_fpga_5gnr_fec.c +12 -12
@@ -743,17 +743,17 @@ fpga_intr_enable(struct rte_bbdev *dev)* It ensures that callback function assigned to that descriptor will * invoked when any FPGA queue issues interrupt. */ -for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) { +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + } + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -1880,7 +1880,7 @@ fpga_5gnr_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +12 -12
@@ -1014,17 +1014,17 @@ fpga_intr_enable(struct rte_bbdev *dev)* It ensures that callback function assigned to that descriptor will * invoked when any FPGA queue issues interrupt. */ -for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) - dev->intr_handle->efds[i] = dev->intr_handle->fd; - -if (!dev->intr_handle->intr_vec) { - dev->intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->num_queues *sizeof (int ),0 ); -if (!dev->intr_handle->intr_vec) { -rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , - dev->data->num_queues); -return -ENOMEM ; - } +for (i =0 ; i <FPGA_NUM_INTR_VEC ; ++i) { +if (rte_intr_efds_index_set (dev->intr_handle, i, +rte_intr_fd_get (dev->intr_handle))) +return -rte_errno; + } + +if (rte_intr_vec_list_alloc (dev->intr_handle,"intr_vec" , + dev->data->num_queues)) { +rte_bbdev_log (ERR ,"Failed to allocate %u vectors" , + dev->data->num_queues); +return -ENOMEM ; } ret =rte_intr_enable (dev->intr_handle);
@@ -2370,7 +2370,7 @@ fpga_lte_fec_probe(struct rte_pci_driver *pci_drv,/* Fill HW specific part of device structure */ bbdev->device = &pci_dev->device; - bbdev->intr_handle = &pci_dev->intr_handle; + bbdev->intr_handle = pci_dev->intr_handle; bbdev->data->socket_id = pci_dev->device.numa_node;/* Invoke FEC FPGA device initialization function */
drivers/bus/auxiliary/auxiliary_common.c +15 -2
@@ -121,15 +121,27 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv,return -EINVAL ; } +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +AUXILIARY_LOG (ERR ,"Could not allocate interrupt instance for device %s" , + dev->name); +return -ENOMEM ; + } + dev->driver = drv;AUXILIARY_LOG (INFO ,"Probe auxiliary driver: %s device: %s (NUMA node %i)" , drv->driver.name, dev->name, dev->device.numa_node); ret = drv->probe (drv, dev); -if (ret !=0 ) +if (ret !=0 ) { dev->driver =NULL ; -else +rte_intr_instance_free (dev->intr_handle); + dev->intr_handle =NULL ; + }else { dev->device.driver = &drv->driver; + }return ret; }
@@ -320,6 +332,7 @@ auxiliary_unplug(struct rte_device *dev)if (ret ==0 ) {rte_auxiliary_remove_device (adev);rte_devargs_remove (dev->devargs); +rte_intr_instance_free (adev->intr_handle);free (adev); }return ret;
drivers/bus/auxiliary/rte_bus_auxiliary.h +1 -1
@@ -115,7 +115,7 @@ struct rte_auxiliary_device {RTE_TAILQ_ENTRY (rte_auxiliary_device) next;/**< Next probed device. */ struct rte_device device;/**< Inherit core device */ char name[RTE_DEV_NAME_MAX_LEN +1 ];/**< ASCII device name */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_auxiliary_driver *driver;/**< Device driver */ };
drivers/bus/dpaa/dpaa_bus.c +25 -3
@@ -172,6 +172,15 @@ dpaa_create_device_list(void) dev->device.bus = &rte_dpaa_bus.bus; +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + cfg = &dpaa_netcfg->port_cfg[i]; fman_intf = cfg->fman_if;
@@ -214,6 +223,15 @@ dpaa_create_device_list(void) goto cleanup; } +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA_BUS_LOG (ERR ,"Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } + dev->device_type =FSL_DPAA_CRYPTO ; dev->id.dev_id = rte_dpaa_bus.device_count + i;
@@ -247,6 +265,7 @@ dpaa_clean_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_dpaa_bus.device_list, next, tdev) {TAILQ_REMOVE (&rte_dpaa_bus.device_list, dev, next); +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -559,8 +578,11 @@ static int rte_dpaa_setup_intr(struct rte_intr_handle *intr_handle)return errno; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_EXT ; +if (rte_intr_fd_set (intr_handle, fd)) +return rte_errno; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_EXT )) +return rte_errno;return 0 ; }
@@ -612,7 +634,7 @@ rte_dpaa_bus_probe(void) TAILQ_FOREACH(dev, &rte_dpaa_bus.device_list, next) {if (dev->device_type ==FSL_DPAA_ETH ) { - ret =rte_dpaa_setup_intr (&dev->intr_handle); + ret =rte_dpaa_setup_intr (dev->intr_handle);if (ret)DPAA_BUS_ERR ("Error setting up interrupt.\n" ); }
drivers/bus/dpaa/rte_dpaa_bus.h +1 -1
@@ -98,7 +98,7 @@ struct rte_dpaa_device { };struct rte_dpaa_driver *driver;struct dpaa_device_id id; -struct rte_intr_handle intr_handle; +struct rte_intr_handle *intr_handle;enum rte_dpaa_type device_type;/**< Ethernet or crypto type device */ char name[RTE_ETH_NAME_MAX_LEN ]; };
drivers/bus/fslmc/fslmc_bus.c +13 -1
@@ -47,6 +47,7 @@ cleanup_fslmc_device_list(void) RTE_TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, t_dev) {TAILQ_REMOVE (&rte_fslmc_bus.device_list, dev, next); +rte_intr_instance_free (dev->intr_handle);free (dev); dev =NULL ; }
@@ -160,6 +161,15 @@ scan_one_fslmc_device(char *dev_name) dev->device.bus = &rte_fslmc_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + ret = -ENOMEM ; + goto cleanup; + } +/* Parse the device name and ID */ t_ptr =strtok (dup_dev_name,"." );if (!t_ptr) {
@@ -220,8 +230,10 @@ scan_one_fslmc_device(char *dev_name) cleanup:if (dup_dev_name)free (dup_dev_name); -if (dev) +if (dev) { +rte_intr_instance_free (dev->intr_handle);free (dev); + }return ret; }
drivers/bus/fslmc/fslmc_vfio.c +19 -11
@@ -599,7 +599,7 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index)int len, ret;char irq_set_buf[IRQ_SET_BUF_LEN ];struct vfio_irq_set *irq_set; -int *fd_ptr; +int *fd_ptr, vfio_dev_fd; len =sizeof (irq_set_buf);
@@ -611,12 +611,14 @@ int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index) irq_set->index = index; irq_set->start =0 ; fd_ptr = (int *)&irq_set->data; - *fd_ptr = intr_handle->fd; + *fd_ptr =rte_intr_fd_get (intr_handle); - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret) {DPAA2_BUS_ERR ("Error:dpaa2 SET IRQs fd=%d, err = %d(%s)" , - intr_handle->fd, errno,strerror (errno)); +rte_intr_fd_get (intr_handle), errno, +strerror (errno));return ret; }
@@ -627,7 +629,7 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) {struct vfio_irq_set *irq_set;char irq_set_buf[IRQ_SET_BUF_LEN ]; -int len, ret; +int len, ret, vfio_dev_fd; len =sizeof (struct vfio_irq_set );
@@ -638,11 +640,12 @@ int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index) irq_set->start =0 ; irq_set->count =0 ; - ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set); + vfio_dev_fd =rte_intr_dev_fd_get (intr_handle); + ret =ioctl (vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);if (ret)DPAA2_BUS_ERR ("Error disabling dpaa2 interrupts for fd %d" , - intr_handle->fd); +rte_intr_fd_get (intr_handle));return ret; }
@@ -684,9 +687,14 @@ rte_dpaa2_vfio_setup_intr(struct rte_intr_handle *intr_handle,return -1 ; } - intr_handle->fd = fd; - intr_handle->type =RTE_INTR_HANDLE_VFIO_MSI ; - intr_handle->vfio_dev_fd = vfio_dev_fd; +if (rte_intr_fd_set (intr_handle, fd)) +return -rte_errno; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_VFIO_MSI )) +return -rte_errno; + +if (rte_intr_dev_fd_set (intr_handle, vfio_dev_fd)) +return -rte_errno;return 0 ; }
@@ -711,7 +719,7 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev)switch (dev->dev_type) {case DPAA2_ETH : -rte_dpaa2_vfio_setup_intr (&dev->intr_handle, dev_fd, +rte_dpaa2_vfio_setup_intr (dev->intr_handle, dev_fd, device_info.num_irqs);break ;case DPAA2_CON :
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +14 -4
@@ -176,7 +176,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)int threshold =0x3 , timeout =0xFF ; dpio_epoll_fd =epoll_create (1 ); - ret =rte_dpaa2_intr_enable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_enable (dpio_dev->intr_handle,0 );if (ret) {DPAA2_BUS_ERR ("Interrupt registeration failed" );return -1 ;
@@ -195,7 +195,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)qbman_swp_dqrr_thrshld_write (dpio_dev->sw_portal, threshold);qbman_swp_intr_timeout_write (dpio_dev->sw_portal, timeout); - eventfd = dpio_dev->intr_handle.fd; + eventfd =rte_intr_fd_get (dpio_dev->intr_handle); epoll_ev.events =EPOLLIN |EPOLLPRI |EPOLLET ; epoll_ev.data.fd = eventfd;
@@ -213,7 +213,7 @@ static void dpaa2_dpio_intr_deinit(struct dpaa2_dpio_dev *dpio_dev) {int ret; - ret =rte_dpaa2_intr_disable (&dpio_dev->intr_handle,0 ); + ret =rte_dpaa2_intr_disable (dpio_dev->intr_handle,0 );if (ret)DPAA2_BUS_ERR ("DPIO interrupt disable failed" );
@@ -388,6 +388,14 @@ dpaa2_create_dpio_device(int vdev_fd,/* Using single portal for all devices */ dpio_dev->mc_portal =dpaa2_get_mcp_ptr (MC_PORTAL_INDEX ); +/* Allocate interrupt instance */ + dpio_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (!dpio_dev->intr_handle) { +DPAA2_BUS_ERR ("Failed to allocate intr handle" ); + goto err; + } + dpio_dev->dpio =rte_zmalloc (NULL ,sizeof (struct fsl_mc_io ),RTE_CACHE_LINE_SIZE );if (!dpio_dev->dpio) {
@@ -490,7 +498,7 @@ dpaa2_create_dpio_device(int vdev_fd, io_space_count++; dpio_dev->index = io_space_count; -if (rte_dpaa2_vfio_setup_intr (&dpio_dev->intr_handle, vdev_fd,1 )) { +if (rte_dpaa2_vfio_setup_intr (dpio_dev->intr_handle, vdev_fd,1 )) {DPAA2_BUS_ERR ("Fail to setup interrupt for %d" , dpio_dev->hw_id); goto err;
@@ -538,6 +546,7 @@ dpaa2_create_dpio_device(int vdev_fd,rte_free (dpio_dev->dpio); } +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev);/* For each element in the list, cleanup */
@@ -549,6 +558,7 @@ dpaa2_create_dpio_device(int vdev_fd, dpio_dev->token);rte_free (dpio_dev->dpio); } +rte_intr_instance_free (dpio_dev->intr_handle);rte_free (dpio_dev); }
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -1
@@ -116,7 +116,7 @@ struct dpaa2_dpio_dev {uintptr_t qbman_portal_ci_paddr;/**< Physical address of Cache Inhibit Area */ uintptr_t ci_size;/**< Size of the CI region */ -struct rte_intr_handle intr_handle;/* Interrupt related info */ +struct rte_intr_handle *intr_handle;/* Interrupt related info */ int32_t epoll_fd;/**< File descriptor created for interrupt polling */ int32_t hw_id;/**< An unique ID of this DPIO device instance */ struct dpaa2_portal_dqrr dpaa2_held_bufs;
drivers/bus/fslmc/rte_fslmc.h +1 -1
@@ -122,7 +122,7 @@ struct rte_dpaa2_device { };enum rte_dpaa2_dev_type dev_type;/**< Device Type */ uint16_t object_id;/**< DPAA2 Object ID */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_dpaa2_driver *driver;/**< Associated driver */ char name[FSLMC_OBJECT_MAX_LEN ];/**< DPAA2 Object name*/ };
drivers/bus/ifpga/ifpga_bus.c +12 -1
@@ -161,6 +161,14 @@ ifpga_scan_one(struct rte_rawdev *rawdev, afu_dev->id.uuid.uuid_high =0 ; afu_dev->id.port = afu_pr_conf.afu_id.port; +/* Allocate interrupt instance */ + afu_dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (afu_dev->intr_handle ==NULL ) { +IFPGA_BUS_ERR ("Failed to allocate intr handle" ); + goto end; + } +if (rawdev->dev_ops && rawdev->dev_ops->dev_info_get) rawdev->dev_ops->dev_info_get (rawdev, afu_dev,sizeof (*afu_dev));
@@ -189,8 +197,10 @@ ifpga_scan_one(struct rte_rawdev *rawdev,rte_kvargs_free (kvlist);if (path)free (path); -if (afu_dev) +if (afu_dev) { +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev); + }return NULL ; }
@@ -396,6 +406,7 @@ ifpga_unplug(struct rte_device *dev)TAILQ_REMOVE (&ifpga_afu_dev_list, afu_dev, next);rte_devargs_remove (dev->devargs); +rte_intr_instance_free (afu_dev->intr_handle);free (afu_dev);return 0 ;
drivers/bus/ifpga/rte_bus_ifpga.h +1 -1
@@ -79,7 +79,7 @@ struct rte_afu_device {struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< AFU Memory Resource */ struct rte_afu_shared shared; -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_afu_driver *driver;/**< Associated driver */ char path[IFPGA_BUS_BITSTREAM_PATH_MAX_LEN ]; } __rte_packed;
drivers/bus/pci/bsd/pci.c +13 -7
@@ -95,10 +95,10 @@ pci_uio_free_resource(struct rte_pci_device *dev, {rte_free (uio_res); -if (dev->intr_handle.fd) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle)) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -121,13 +121,19 @@ pci_uio_alloc_resource(struct rte_pci_device *dev, }/* save fd if in primary process */ - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { +if (rte_intr_fd_set (dev->intr_handle,open (devname,O_RDWR ))) { +RTE_LOG (WARNING ,EAL ,"Failed to save fd" ); + goto error; + } + +if (rte_intr_fd_get (dev->intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot open %s: %s\n" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO ; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UIO )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/pci/linux/pci.c +2 -2
@@ -645,7 +645,7 @@ int rte_pci_read_config(const struct rte_pci_device *device, void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
@@ -669,7 +669,7 @@ int rte_pci_write_config(const struct rte_pci_device *device, const void *buf, size_t len, off_t offset) { char devname[RTE_DEV_NAME_MAX_LEN] = ""; -const struct rte_intr_handle *intr_handle = &device->intr_handle; +const struct rte_intr_handle *intr_handle = device->intr_handle;switch (device->kdrv) {case RTE_PCI_KDRV_IGB_UIO :
drivers/bus/pci/linux/pci_uio.c +45 -24
138 lines not on this page · raw message
drivers/bus/pci/linux/pci_vfio.c +64 -38
239 lines not on this page · raw message
drivers/bus/pci/pci_common.c +39 -8
67 lines not on this page · raw message
drivers/bus/pci/pci_common_uio.c +13 -8
@@ -90,8 +90,11 @@ pci_uio_map_resource(struct rte_pci_device *dev)struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -207,6 +210,7 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)struct mapped_pci_resource *uio_res;struct mapped_pci_res_list *uio_res_list =RTE_TAILQ_CAST (rte_uio_tailq.head, mapped_pci_res_list); +int uio_cfg_fd;if (dev ==NULL )return ;
@@ -229,12 +233,13 @@ pci_uio_unmap_resource(struct rte_pci_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); + uio_cfg_fd =rte_intr_dev_fd_get (dev->intr_handle); +if (uio_cfg_fd >=0 ) { +close (uio_cfg_fd); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/bus/pci/rte_bus_pci.h +2 -2
@@ -69,12 +69,12 @@ struct rte_pci_device {struct rte_pci_id id;/**< PCI ID. */ struct rte_mem_resource mem_resource[PCI_MAX_RESOURCE ];/**< PCI Memory Resource */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_pci_driver *driver;/**< PCI driver used in probing */ uint16_t max_vfs;/**< sriov enable if not zero */ enum rte_pci_kernel_driver kdrv;/**< Kernel driver passthrough */ char name[PCI_PRI_STR_SIZE +1 ];/**< PCI location (ASCII) */ -struct rte_intr_handle vfio_req_intr_handle; +struct rte_intr_handle *vfio_req_intr_handle;/**< Handler of VFIO request interrupt */ };
drivers/bus/vmbus/linux/vmbus_bus.c +6 -0
@@ -299,6 +299,12 @@ vmbus_scan_one(const char *name) dev->device.devargs =vmbus_devargs_lookup (dev); +/* Allocate interrupt handle instance */ + dev->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (dev->intr_handle ==NULL ) + goto error; +/* device is valid, add in list (sorted) */ VMBUS_LOG (DEBUG ,"Adding vmbus device %s" , name);
drivers/bus/vmbus/linux/vmbus_uio.c +22 -13
@@ -30,9 +30,11 @@ static void *vmbus_map_addr;/* Control interrupts */ void vmbus_uio_irq_control (struct rte_vmbus_device *dev,int32_t onoff) { -if (write (dev->intr_handle.fd, &onoff,sizeof (onoff)) <0 ) { +if (write (rte_intr_fd_get (dev->intr_handle), &onoff, +sizeof (onoff)) <0 ) {VMBUS_LOG (ERR ,"cannot write to %d:%s" , - dev->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (dev->intr_handle), +strerror (errno)); } }
@@ -41,7 +43,8 @@ int vmbus_uio_irq_read(struct rte_vmbus_device *dev)int32_t count;int cc; - cc =read (dev->intr_handle.fd, &count,sizeof (count)); + cc =read (rte_intr_fd_get (dev->intr_handle), &count, +sizeof (count));if (cc < (int )sizeof (count)) {if (cc <0 ) { VMBUS_LOG(ERR, "IRQ read failed %s",
@@ -61,15 +64,15 @@ vmbus_uio_free_resource(struct rte_vmbus_device *dev, {rte_free (uio_res); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } -if (dev->intr_handle.fd >=0 ) { -close (dev->intr_handle.fd); - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_fd_get (dev->intr_handle)); +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); } }
@@ -78,16 +81,22 @@ vmbus_uio_alloc_resource(struct rte_vmbus_device *dev, struct mapped_vmbus_resource **uio_res) {char devname[PATH_MAX ];/* contains the /dev/uioX */ +int fd;/* save fd if in primary process */ snprintf (devname,sizeof (devname),"/dev/uio%u" , dev->uio_num); - dev->intr_handle.fd =open (devname,O_RDWR ); -if (dev->intr_handle.fd <0 ) { + fd =open (devname,O_RDWR ); +if (fd <0 ) {VMBUS_LOG (ERR ,"Cannot open %s: %s" , devname,strerror (errno)); goto error; } - dev->intr_handle.type =RTE_INTR_HANDLE_UIO_INTX ; + +if (rte_intr_fd_set (dev->intr_handle, fd)) + goto error; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UIO_INTX )) + goto error;/* allocate the mapping details for secondary processes*/ *uio_res =rte_zmalloc ("UIO_RES" ,sizeof (**uio_res),0 );
drivers/bus/vmbus/rte_bus_vmbus.h +1 -1
@@ -73,7 +73,7 @@ struct rte_vmbus_device {struct vmbus_channel *primary;/**< VMBUS primary channel */ struct vmbus_mon_page *monitor_page;/**< VMBUS monitor page */ -struct rte_intr_handle intr_handle;/**< Interrupt handle */ +struct rte_intr_handle *intr_handle;/**< Interrupt handle */ struct rte_mem_resource resource[VMBUS_MAX_RESOURCE ]; };
drivers/bus/vmbus/vmbus_common_uio.c +14 -9
@@ -171,9 +171,14 @@ vmbus_uio_map_resource(struct rte_vmbus_device *dev)int ret;/* TODO: handle rescind */ - dev->intr_handle.fd =-1 ; - dev->intr_handle.uio_cfg_fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +if (rte_intr_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_dev_fd_set (dev->intr_handle,-1 )) +return -1 ; + +if (rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ;/* secondary processes - use already recorded details */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -253,12 +258,12 @@ vmbus_uio_unmap_resource(struct rte_vmbus_device *dev)rte_free (uio_res);/* close fd if in primary process */ -close (dev->intr_handle.fd); -if (dev->intr_handle.uio_cfg_fd >=0 ) { -close (dev->intr_handle.uio_cfg_fd); - dev->intr_handle.uio_cfg_fd =-1 ; +close (rte_intr_fd_get (dev->intr_handle)); +if (rte_intr_dev_fd_get (dev->intr_handle) >=0 ) { +close (rte_intr_dev_fd_get (dev->intr_handle)); +rte_intr_dev_fd_set (dev->intr_handle,-1 ); } - dev->intr_handle.fd =-1 ; - dev->intr_handle.type =RTE_INTR_HANDLE_UNKNOWN ; +rte_intr_fd_set (dev->intr_handle,-1 ); +rte_intr_type_set (dev->intr_handle,RTE_INTR_HANDLE_UNKNOWN ); }
drivers/common/cnxk/roc_cpt.c +4 -4
@@ -65,7 +65,7 @@ cpt_lf_register_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -85,7 +85,7 @@ cpt_lf_unregister_misc_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_MISC ;/* Clear err interrupt */
@@ -129,7 +129,7 @@ cpt_lf_register_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int rc, vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
@@ -152,7 +152,7 @@ cpt_lf_unregister_done_irq(struct roc_cpt_lf *lf)struct plt_intr_handle *handle;int vec; - handle = &pci_dev->intr_handle; + handle = pci_dev->intr_handle; vec = lf->msixoff +CPT_LF_INT_VEC_DONE ;
drivers/common/cnxk/roc_dev.c +7 -7
@@ -641,7 +641,7 @@ roc_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -691,7 +691,7 @@ mbox_register_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static int mbox_register_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -724,7 +724,7 @@ mbox_register_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_pf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -755,7 +755,7 @@ mbox_unregister_pf_irq(struct plt_pci_device *pci_dev, struct dev *dev)static void mbox_unregister_vf_irq (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ plt_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -839,7 +839,7 @@ roc_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;int i;plt_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -860,7 +860,7 @@ vf_flr_unregister_irqs(struct plt_pci_device *pci_dev, struct dev *dev)static int vf_flr_register_irqs (struct plt_pci_device *pci_dev,struct dev *dev) { -struct plt_intr_handle *handle = &pci_dev->intr_handle; +struct plt_intr_handle *handle = pci_dev->intr_handle;int i, rc;plt_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1211,7 +1211,7 @@ dev_init(struct dev *dev, struct plt_pci_device *pci_dev)int dev_fini (struct dev *dev,struct plt_pci_device *pci_dev) { -struct plt_intr_handle *intr_handle = &pci_dev->intr_handle; +struct plt_intr_handle *intr_handle = pci_dev->intr_handle;struct mbox *mbox;/* Check if this dev hosts npalf and has 1+ refs */
drivers/common/cnxk/roc_irq.c +62 -45
219 lines not on this page · raw message
drivers/common/cnxk/roc_nix_inl_dev_irq.c +4 -4
@@ -99,7 +99,7 @@ nix_inl_sso_hws_irq(void *param)int nix_inl_sso_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -147,7 +147,7 @@ nix_inl_sso_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_sso_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t ssow_base = inl_dev->ssow_base;uintptr_t sso_base = inl_dev->sso_base;uint16_t sso_msixoff, ssow_msixoff;
@@ -282,7 +282,7 @@ nix_inl_nix_err_irq(void *param)int nix_inl_nix_register_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;int rc;
@@ -331,7 +331,7 @@ nix_inl_nix_register_irqs(struct nix_inl_dev *inl_dev)void nix_inl_nix_unregister_irqs (struct nix_inl_dev *inl_dev) { -struct plt_intr_handle *handle = &inl_dev->pci_dev->intr_handle; +struct plt_intr_handle *handle = inl_dev->pci_dev->intr_handle;uintptr_t nix_base = inl_dev->nix_base;uint16_t msixoff;
drivers/common/cnxk/roc_nix_irq.c +19 -17
@@ -82,7 +82,7 @@ nix_lf_err_irq(void *param)static int nix_lf_register_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -99,7 +99,7 @@ nix_lf_register_err_irq(struct nix *nix)static void nix_lf_unregister_err_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_ERR_INT ;
@@ -131,7 +131,7 @@ nix_lf_ras_irq(void *param)static int nix_lf_register_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int rc, vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -148,7 +148,7 @@ nix_lf_register_ras_irq(struct nix *nix)static void nix_lf_unregister_ras_irq (struct nix *nix) { -struct plt_intr_handle *handle = &nix->pci_dev->intr_handle; +struct plt_intr_handle *handle = nix->pci_dev->intr_handle;int vec; vec = nix->msixoff +NIX_LF_INT_VEC_POISON ;
@@ -300,7 +300,7 @@ roc_nix_register_queue_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;/* Figure out max qintx required */ rqs =PLT_MIN (nix->qints, nix->nb_rx_queues);
@@ -352,7 +352,7 @@ roc_nix_unregister_queue_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_qints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_QINT_START + q;
@@ -382,7 +382,7 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)struct nix *nix; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle; nix->configured_cints =PLT_MIN (nix->cints, nix->nb_rx_queues);
@@ -414,19 +414,19 @@ roc_nix_register_cq_irqs(struct roc_nix *roc_nix)return rc; } -if (!handle->intr_vec) { - handle->intr_vec =plt_zmalloc ( - nix->configured_cints *sizeof (int ),0 ); -if (!handle->intr_vec) { -plt_err ("Failed to allocate %d rx intr_vec" , - nix->configured_cints); -return -ENOMEM ; - } + rc =plt_intr_vec_list_alloc (handle,"cnxk" , + nix->configured_cints); +if (rc) { +plt_err ("Fail to allocate intr vec list, rc=%d" , + rc); +return rc; }/* VFIO vector zero is resereved for misc interrupt so * doing required adjustment. (b13bfab4cd) */ - handle->intr_vec[q] =PLT_INTR_VEC_RXTX_OFFSET + vec; +if (plt_intr_vec_list_index_set (handle, q, +PLT_INTR_VEC_RXTX_OFFSET + vec)) +return -1 ;/* Configure CQE interrupt coalescing parameters */ plt_write64(((CQ_CQE_THRESH_DEFAULT) |
@@ -450,7 +450,7 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)int vec, q; nix =roc_nix_to_nix_priv (roc_nix); - handle = &nix->pci_dev->intr_handle; + handle = nix->pci_dev->intr_handle;for (q =0 ; q < nix->configured_cints; q++) { vec = nix->msixoff +NIX_LF_INT_VEC_CINT_START + q;
@@ -465,6 +465,8 @@ roc_nix_unregister_cq_irqs(struct roc_nix *roc_nix)dev_irq_unregister (handle, nix_lf_cq_irq, &nix->cints_mem[q], vec); } + +plt_intr_vec_list_free (handle);plt_free (nix->cints_mem); }
drivers/common/cnxk/roc_npa.c +1 -1
@@ -710,7 +710,7 @@ npa_lf_init(struct dev *dev, struct plt_pci_device *pci_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/common/cnxk/roc_platform.h +37 -11
68 lines not on this page · raw message
drivers/common/cnxk/roc_sso.c +2 -2
@@ -505,7 +505,7 @@ roc_sso_rsrc_init(struct roc_sso *roc_sso, uint8_t nb_hws, uint16_t nb_hwgrp) goto sso_msix_fail; } - rc =sso_register_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, nb_hws, + rc =sso_register_irqs_priv (roc_sso, sso->pci_dev->intr_handle, nb_hws, nb_hwgrp);if (rc <0 ) {plt_err ("Failed to register SSO LF IRQs" );
@@ -535,7 +535,7 @@ roc_sso_rsrc_fini(struct roc_sso *roc_sso)if (!roc_sso->nb_hws && !roc_sso->nb_hwgrp)return ; -sso_unregister_irqs_priv (roc_sso, &sso->pci_dev->intr_handle, +sso_unregister_irqs_priv (roc_sso, sso->pci_dev->intr_handle, roc_sso->nb_hws, roc_sso->nb_hwgrp);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWS , roc_sso->nb_hws);sso_lf_free (&sso->dev,SSO_LF_TYPE_HWGRP , roc_sso->nb_hwgrp);
drivers/common/cnxk/roc_tim.c +2 -2
@@ -200,7 +200,7 @@ roc_tim_lf_alloc(struct roc_tim *roc_tim, uint8_t ring_id, uint64_t *clk)if (clk) *clk = rsp->tenns_clk; - rc =tim_register_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, + rc =tim_register_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]);if (rc <0 ) {plt_tim_dbg ("Failed to register Ring[%d] IRQ" , ring_id);
@@ -223,7 +223,7 @@ roc_tim_lf_free(struct roc_tim *roc_tim, uint8_t ring_id)struct tim_ring_req *req;int rc = -ENOSPC ; -tim_unregister_irq_priv (roc_tim, &sso->pci_dev->intr_handle, ring_id, +tim_unregister_irq_priv (roc_tim, sso->pci_dev->intr_handle, ring_id, tim->tim_msix_offsets[ring_id]); req =mbox_alloc_msg_tim_lf_free (dev->mbox);
drivers/common/octeontx2/otx2_dev.c +7 -7
@@ -643,7 +643,7 @@ otx2_af_pf_mbox_irq(void *param)static int mbox_register_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i, rc;/* HW clear irq */
@@ -693,7 +693,7 @@ mbox_register_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int mbox_register_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Clear irq */
@@ -726,7 +726,7 @@ mbox_register_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_pf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;/* HW clear irq */
@@ -758,7 +758,7 @@ mbox_unregister_pf_irq(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static void mbox_unregister_vf_irq (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;/* Clear irq */ otx2_write64 (~0ull , dev->bar2 +RVU_VF_INT_ENA_W1C );
@@ -841,7 +841,7 @@ otx2_pf_vf_flr_irq(void *param)static int vf_flr_unregister_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int i;otx2_base_dbg ("Unregister VF FLR interrupts for %s" , pci_dev->name);
@@ -862,7 +862,7 @@ vf_flr_unregister_irqs(struct rte_pci_device *pci_dev, struct otx2_dev *dev)static int vf_flr_register_irqs (struct rte_pci_device *pci_dev,struct otx2_dev *dev) { -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int i, rc;otx2_base_dbg ("Register VF FLR interrupts for %s" , pci_dev->name);
@@ -1039,7 +1039,7 @@ otx2_dev_priv_init(struct rte_pci_device *pci_dev, void *otx2_dev)void otx2_dev_fini (struct rte_pci_device *pci_dev,void *otx2_dev) { -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct otx2_dev *dev = otx2_dev;struct otx2_idev_cfg *idev;struct otx2_mbox *mbox;
drivers/common/octeontx2/otx2_irq.c +68 -49
231 lines not on this page · raw message
drivers/crypto/octeontx2/otx2_cryptodev_hw_access.c +2 -2
@@ -36,7 +36,7 @@ otx2_cpt_lf_err_intr_unregister(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;/* Disable error interrupts */ otx2_write64 (~0ull , base +OTX2_CPT_LF_MISC_INT_ENA_W1C );
@@ -65,7 +65,7 @@ otx2_cpt_lf_err_intr_register(const struct rte_cryptodev *dev, uint16_t msix_off, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (dev->device); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int ret;/* Disable error interrupts */
drivers/event/octeontx2/otx2_evdev_irq.c +6 -6
@@ -29,7 +29,7 @@ sso_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -66,7 +66,7 @@ ssow_lf_register_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -86,7 +86,7 @@ sso_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t ggrp_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = ggrp_msixoff +SSO_LF_INT_VEC_GRP ;
@@ -101,7 +101,7 @@ ssow_lf_unregister_irq(const struct rte_eventdev *event_dev, uint16_t gws_msixoff, uintptr_t base) {struct rte_pci_device *pci_dev =RTE_DEV_TO_PCI (event_dev->dev); -struct rte_intr_handle *handle = &pci_dev->intr_handle; +struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = gws_msixoff +SSOW_LF_INT_VEC_IOP ;
@@ -198,7 +198,7 @@ static int tim_lf_register_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int rc, vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
@@ -226,7 +226,7 @@ static void tim_lf_unregister_irq(struct rte_pci_device *pci_dev, uint16_t tim_msixoff, uintptr_t base) { - struct rte_intr_handle *handle = &pci_dev->intr_handle; + struct rte_intr_handle *handle = pci_dev->intr_handle;int vec; vec = tim_msixoff +TIM_LF_INT_VEC_NRSPERR_INT ;
drivers/mempool/octeontx2/otx2_mempool.c +1 -1
@@ -301,7 +301,7 @@ otx2_npa_lf_init(struct rte_pci_device *pci_dev, void *otx2_dev) lf->pf_func = dev->pf_func; lf->npa_msixoff = npa_msixoff; - lf->intr_handle = &pci_dev->intr_handle; + lf->intr_handle = pci_dev->intr_handle; lf->pci_dev = pci_dev; idev->npa_pf_func = dev->pf_func;
drivers/net/atlantic/atl_ethdev.c +8 -12
@@ -359,7 +359,7 @@ eth_atl_dev_init(struct rte_eth_dev *eth_dev) {struct atl_adapter *adapter = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);int err =0 ;
@@ -478,7 +478,7 @@ atl_dev_start(struct rte_eth_dev *dev) {struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;int status;int err;
@@ -524,10 +524,9 @@ atl_dev_start(struct rte_eth_dev *dev) } } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ;
@@ -607,7 +606,7 @@ atl_dev_stop(struct rte_eth_dev *dev)struct aq_hw_s *hw =ATL_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;PMD_INIT_FUNC_TRACE (); dev->data->dev_started =0 ;
@@ -637,10 +636,7 @@ atl_dev_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -691,7 +687,7 @@ static int atl_dev_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct aq_hw_s *hw;int ret;
drivers/net/avp/avp_ethdev.c +4 -4
@@ -711,7 +711,7 @@ avp_dev_interrupt_handler(void *data) status);/* re-enable UIO interrupt handling */ - ret =rte_intr_ack (&pci_dev->intr_handle); + ret =rte_intr_ack (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to re-enable UIO interrupts, ret=%d\n" , ret);
@@ -730,7 +730,7 @@ avp_dev_enable_interrupts(struct rte_eth_dev *eth_dev)return -EINVAL ;/* enable UIO interrupt handling */ - ret =rte_intr_enable (&pci_dev->intr_handle); + ret =rte_intr_enable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to enable UIO interrupts, ret=%d\n" , ret);
@@ -759,7 +759,7 @@ avp_dev_disable_interrupts(struct rte_eth_dev *eth_dev) RTE_PTR_ADD(registers, RTE_AVP_INTERRUPT_MASK_OFFSET));/* enable UIO interrupt handling */ - ret =rte_intr_disable (&pci_dev->intr_handle); + ret =rte_intr_disable (pci_dev->intr_handle);if (ret <0 ) {PMD_DRV_LOG (ERR ,"Failed to disable UIO interrupts, ret=%d\n" , ret);
@@ -776,7 +776,7 @@ avp_dev_setup_interrupts(struct rte_eth_dev *eth_dev)int ret;/* register a callback handler with UIO for interrupt notifications */ - ret =rte_intr_callback_register (&pci_dev->intr_handle, + ret =rte_intr_callback_register (pci_dev->intr_handle, avp_dev_interrupt_handler, (void *)eth_dev);if (ret <0 ) {
drivers/net/axgbe/axgbe_ethdev.c +6 -6
@@ -313,7 +313,7 @@ axgbe_dev_interrupt_handler(void *param) } }/* Unmask interrupts since disabled after generation */ -rte_intr_ack (&pdata->pci_dev->intr_handle); +rte_intr_ack (pdata->pci_dev->intr_handle); }/*
@@ -374,7 +374,7 @@ axgbe_dev_start(struct rte_eth_dev *dev) }/* enable uio/vfio intr/eventfd mapping */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);/* phy start*/ pdata->phy_if.phy_start (pdata);
@@ -406,7 +406,7 @@ axgbe_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE (); -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);if (rte_bit_relaxed_get32 (AXGBE_STOPPED , &pdata->dev_state))return 0 ;
@@ -2311,7 +2311,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev)return ret; } -rte_intr_callback_register (&pci_dev->intr_handle, +rte_intr_callback_register (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
@@ -2335,8 +2335,8 @@ axgbe_dev_close(struct rte_eth_dev *eth_dev)axgbe_dev_clear_queues (eth_dev);/* disable uio intr before callback unregister */ -rte_intr_disable (&pci_dev->intr_handle); -rte_intr_callback_unregister (&pci_dev->intr_handle, +rte_intr_disable (pci_dev->intr_handle); +rte_intr_callback_unregister (pci_dev->intr_handle, axgbe_dev_interrupt_handler, (void *)eth_dev);
drivers/net/axgbe/axgbe_mdio.c +3 -3
@@ -933,7 +933,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }/* Disable auto-negotiation interrupt */ -rte_intr_disable (&pdata->pci_dev->intr_handle); +rte_intr_disable (pdata->pci_dev->intr_handle);/* Start auto-negotiation in a supported mode */ if (axgbe_use_mode (pdata,AXGBE_MODE_KR )) {
@@ -951,7 +951,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) }else if (axgbe_use_mode (pdata,AXGBE_MODE_SGMII_100 )) {axgbe_set_mode (pdata,AXGBE_MODE_SGMII_100 ); }else { -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);return -EINVAL ; }
@@ -964,7 +964,7 @@ static int __axgbe_phy_config_aneg(struct axgbe_port *pdata) pdata->kx_state =AXGBE_RX_BPA ;/* Re-enable auto-negotiation interrupt */ -rte_intr_enable (&pdata->pci_dev->intr_handle); +rte_intr_enable (pdata->pci_dev->intr_handle);axgbe_an37_enable_interrupts (pdata);axgbe_an_init (pdata);
drivers/net/bnx2x/bnx2x_ethdev.c +5 -5
@@ -134,7 +134,7 @@ bnx2x_interrupt_handler(void *param)PMD_DEBUG_PERIODIC_LOG (INFO , sc,"Interrupt handled" );bnx2x_interrupt_action (dev,1 ); -rte_intr_ack (&sc->pci_dev->intr_handle); +rte_intr_ack (sc->pci_dev->intr_handle); }static void bnx2x_periodic_start (void *param)
@@ -230,10 +230,10 @@ bnx2x_dev_start(struct rte_eth_dev *dev) }if (IS_PF (sc)) { -rte_intr_callback_register (&sc->pci_dev->intr_handle, +rte_intr_callback_register (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev); -if (rte_intr_enable (&sc->pci_dev->intr_handle)) +if (rte_intr_enable (sc->pci_dev->intr_handle))PMD_DRV_LOG (ERR , sc,"rte_intr_enable failed" ); }
@@ -258,8 +258,8 @@ bnx2x_dev_stop(struct rte_eth_dev *dev)bnx2x_dev_rxtx_init_dummy (dev);if (IS_PF (sc)) { -rte_intr_disable (&sc->pci_dev->intr_handle); -rte_intr_callback_unregister (&sc->pci_dev->intr_handle, +rte_intr_disable (sc->pci_dev->intr_handle); +rte_intr_callback_unregister (sc->pci_dev->intr_handle, bnx2x_interrupt_handler, (void *)dev);/* stop the periodic callout */
drivers/net/bnxt/bnxt_ethdev.c +14 -19
@@ -729,7 +729,7 @@ static int bnxt_alloc_prev_ring_stats(struct bnxt *bp)static int bnxt_start_nic (struct bnxt *bp) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (bp->eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;uint32_t intr_vector =0 ;uint32_t queue_id, base =BNXT_MISC_VEC_ID ;uint32_t vec =BNXT_MISC_VEC_ID ;
@@ -846,26 +846,24 @@ static int bnxt_start_nic(struct bnxt *bp)return rc; } -if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - bp->eth_dev->data->nb_rx_queues * -sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_dp_is_en (intr_handle)) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + bp->eth_dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec" , bp->eth_dev->data->nb_rx_queues); rc = -ENOMEM ; goto err_out; } -PMD_DRV_LOG (DEBUG ,"intr_handle->intr_vec = %p " -"intr_handle->nb_efd = %d intr_handle->max_intr = %d\n" , - intr_handle->intr_vec, intr_handle->nb_efd, - intr_handle->max_intr); +PMD_DRV_LOG (DEBUG ,"intr_handle->nb_efd = %d " +"intr_handle->max_intr = %d\n" , +rte_intr_nb_efd_get (intr_handle), +rte_intr_max_intr_get (intr_handle));for (queue_id =0 ; queue_id < bp->eth_dev->data->nb_rx_queues; queue_id++) { - intr_handle->intr_vec[queue_id] = - vec +BNXT_RX_VEC_START ; -if (vec < base + intr_handle->nb_efd -1 ) +rte_intr_vec_list_index_set (intr_handle, + queue_id, vec +BNXT_RX_VEC_START ); +if (vec < base +rte_intr_nb_efd_get (intr_handle) + -1 ) vec++; } }
@@ -1473,7 +1471,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev) {struct bnxt *bp = eth_dev->data->dev_private;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct rte_eth_link link;int ret;
@@ -1515,10 +1513,7 @@ static int bnxt_dev_stop(struct rte_eth_dev *eth_dev)/* Clean queue intr-vector mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);bnxt_hwrm_port_clr_stats (bp);bnxt_free_tx_mbufs (bp);
drivers/net/bnxt/bnxt_irq.c +2 -2
@@ -67,7 +67,7 @@ void bnxt_int_handler(void *param)int bnxt_free_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
@@ -170,7 +170,7 @@ int bnxt_setup_int(struct bnxt *bp)int bnxt_request_int (struct bnxt *bp) { -struct rte_intr_handle *intr_handle = &bp->pdev->intr_handle; +struct rte_intr_handle *intr_handle = bp->pdev->intr_handle;struct bnxt_irq *irq = bp->irq_tbl;int rc =0 ;
drivers/net/dpaa/dpaa_ethdev.c +31 -17
100 lines not on this page · raw message
drivers/net/dpaa2/dpaa2_ethdev.c +5 -5
@@ -1145,7 +1145,7 @@ dpaa2_dev_start(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle; dpaa2_dev = container_of(rdev, struct rte_dpaa2_device, device); - intr_handle = &dpaa2_dev->intr_handle; + intr_handle = dpaa2_dev->intr_handle;PMD_INIT_FUNC_TRACE ();
@@ -1216,8 +1216,8 @@ dpaa2_dev_start(struct rte_eth_dev *dev) }/* if the interrupts were configured on this devices*/ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/* Registering LSC interrupt handler */ rte_intr_callback_register(intr_handle, dpaa2_interrupt_handler,
@@ -1256,8 +1256,8 @@ dpaa2_dev_stop(struct rte_eth_dev *dev)PMD_INIT_FUNC_TRACE ();/* reset interrupt callback */ -if (intr_handle && (intr_handle->fd) && - (dev->data->dev_conf.intr_conf.lsc !=0 )) { +if (intr_handle &&rte_intr_fd_get (intr_handle) && + dev->data->dev_conf.intr_conf.lsc !=0 ) {/*disable dpni irqs */ dpaa2_eth_setup_irqs (dev,0 );
drivers/net/e1000/em_ethdev.c +9 -14
@@ -237,7 +237,7 @@ static int eth_em_dev_init(struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct e1000_adapter *adapter =E1000_DEV_PRIVATE (eth_dev->data->dev_private); struct e1000_hw *hw =
@@ -523,7 +523,7 @@ eth_em_start(struct rte_eth_dev *dev)struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret, mask;uint32_t intr_vector =0 ;uint32_t *speeds;
@@ -573,12 +573,10 @@ eth_em_start(struct rte_eth_dev *dev) }if (rte_intr_dp_is_en (intr_handle)) { - intr_handle->intr_vec = -rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" -" intr_vec" , dev->data->nb_rx_queues); +" intr_vec" , dev->data->nb_rx_queues);return -ENOMEM ; }
@@ -716,7 +714,7 @@ eth_em_stop(struct rte_eth_dev *dev)struct rte_eth_link link;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle; dev->data->dev_started =0 ;
@@ -750,10 +748,7 @@ eth_em_stop(struct rte_eth_dev *dev)/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } +rte_intr_vec_list_free (intr_handle);return 0 ; }
@@ -765,7 +760,7 @@ eth_em_close(struct rte_eth_dev *dev)struct e1000_adapter *adapter =E1000_DEV_PRIVATE (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int ret;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -1006,7 +1001,7 @@ eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __rte_unused uint16_t queue {struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;em_rxq_intr_enable (hw);rte_intr_ack (intr_handle);
drivers/net/e1000/igb_ethdev.c +36 -43
215 lines not on this page · raw message
drivers/net/ena/ena_ethdev.c +19 -16
@@ -494,7 +494,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter)static int ena_close (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_adapter *adapter = dev->data->dev_private;int ret =0 ;
@@ -954,7 +954,7 @@ static int ena_stop(struct rte_eth_dev *dev)struct ena_adapter *adapter = dev->data->dev_private;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;/* Cannot free memory in secondary process */
@@ -976,10 +976,9 @@ static int ena_stop(struct rte_eth_dev *dev)rte_intr_disable (intr_handle);rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +/* Cleanup vector list */ +rte_intr_vec_list_free (intr_handle);rte_intr_enable (intr_handle);
@@ -995,7 +994,7 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring)struct ena_adapter *adapter = ring->adapter;struct ena_com_dev *ena_dev = &adapter->ena_dev;struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;struct ena_com_create_io_ctx ctx =/* policy set to _HOST just to satisfy icc compiler */ {ENA_ADMIN_PLACEMENT_POLICY_HOST ,
@@ -1015,7 +1014,10 @@ static int ena_create_io_queue(struct rte_eth_dev *dev, struct ena_ring *ring) ena_qid =ENA_IO_RXQ_IDX (ring->id); ctx.direction =ENA_COM_IO_QUEUE_DIRECTION_RX ;if (rte_intr_dp_is_en (intr_handle)) - ctx.msix_vector = intr_handle->intr_vec[ring->id]; + ctx.msix_vector = +rte_intr_vec_list_index_get (intr_handle, + ring->id); +for (i =0 ; i < ring->ring_size; i++) ring->empty_rx_reqs[i] = i; }
@@ -1824,7 +1826,7 @@ static int eth_ena_dev_init(struct rte_eth_dev *eth_dev) pci_dev->addr.devid, pci_dev->addr.function); - intr_handle = &pci_dev->intr_handle; + intr_handle = pci_dev->intr_handle; adapter->regs = pci_dev->mem_resource[ENA_REGS_BAR ].addr; adapter->dev_mem_base = pci_dev->mem_resource[ENA_MEM_BAR ].addr;
@@ -3112,7 +3114,7 @@ static int ena_parse_devargs(struct ena_adapter *adapter,static int ena_setup_rx_intr (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; +struct rte_intr_handle *intr_handle = pci_dev->intr_handle;int rc;uint16_t vectors_nb, i;bool rx_intr_requested = dev->data->dev_conf.intr_conf.rxq;
@@ -3139,9 +3141,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) goto enable_intr; } - intr_handle->intr_vec =rte_zmalloc ("intr_vec" , - dev->data->nb_rx_queues *sizeof (*intr_handle->intr_vec),0 ); -if (intr_handle->intr_vec ==NULL ) { +/* Allocate the vector list */ +if (rte_intr_vec_list_alloc (intr_handle,"intr_vec" , + dev->data->nb_rx_queues)) {PMD_DRV_LOG (ERR ,"Failed to allocate interrupt vector for %d queues\n" , dev->data->nb_rx_queues);
@@ -3160,7 +3162,9 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) }for (i =0 ; i < vectors_nb; ++i) - intr_handle->intr_vec[i] =RTE_INTR_VEC_RXTX_OFFSET + i; +if (rte_intr_vec_list_index_set (intr_handle, i, +RTE_INTR_VEC_RXTX_OFFSET + i)) + goto disable_intr_efd;rte_intr_enable (intr_handle);return 0 ;
@@ -3168,8 +3172,7 @@ static int ena_setup_rx_intr(struct rte_eth_dev *dev) disable_intr_efd:rte_intr_efd_disable (intr_handle); free_intr_vec: -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; +rte_intr_vec_list_free (intr_handle); enable_intr:rte_intr_enable (intr_handle);return rc;
drivers/net/enic/enic_main.c +13 -13
@@ -448,7 +448,7 @@ enic_intr_handler(void *arg)rte_eth_dev_callback_process (dev,RTE_ETH_EVENT_INTR_LSC ,NULL );enic_log_q_error (enic);/* Re-enable irq in case of INTx */ -rte_intr_ack (&enic->pdev->intr_handle); +rte_intr_ack (enic->pdev->intr_handle); }static int enic_rxq_intr_init (struct enic *enic)
@@ -477,14 +477,16 @@ static int enic_rxq_intr_init(struct enic *enic) " interrupts\n");return err; } - intr_handle->intr_vec =rte_zmalloc ("enic_intr_vec" , - rxq_intr_count *sizeof (int ),0 ); -if (intr_handle->intr_vec ==NULL ) { + +if (rte_intr_vec_list_alloc (intr_handle,"enic_intr_vec" , + rxq_intr_count)) {dev_err (enic,"Failed to allocate intr_vec\n" );return -ENOMEM ; }for (i =0 ; i < rxq_intr_count; i++) - intr_handle->intr_vec[i] = i +ENICPMD_RXQ_INTR_OFFSET ; +if (rte_intr_vec_list_index_set (intr_handle, i, + i +ENICPMD_RXQ_INTR_OFFSET )) +return -rte_errno;return 0 ; }
@@ -494,10 +496,8 @@ static void enic_rxq_intr_deinit(struct enic *enic) intr_handle = enic->rte_dev->intr_handle;rte_intr_efd_disable (intr_handle); -if (intr_handle->intr_vec !=NULL ) { -rte_free (intr_handle->intr_vec); - intr_handle->intr_vec =NULL ; - } + +rte_intr_vec_list_free (intr_handle); }static void enic_prep_wq_for_simple_tx (struct enic *enic,uint16_t queue_idx)
@@ -667,10 +667,10 @@ int enic_enable(struct enic *enic)vnic_dev_enable_wait (enic->vdev);/* Register and enable error interrupt */ -rte_intr_callback_register (&(enic->pdev->intr_handle), +rte_intr_callback_register (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev); -rte_intr_enable (&(enic->pdev->intr_handle)); +rte_intr_enable (enic->pdev->intr_handle);/* Unmask LSC interrupt */ vnic_intr_unmask (&enic->intr[ENICPMD_LSC_INTR_OFFSET ]);
@@ -1111,8 +1111,8 @@ int enic_disable(struct enic *enic) (void )vnic_intr_masked (&enic->intr[i]);/* flush write */ }enic_rxq_intr_deinit (enic); -rte_intr_disable (&enic->pdev->intr_handle); -rte_intr_callback_unregister (&enic->pdev->intr_handle, +rte_intr_disable (enic->pdev->intr_handle); +rte_intr_callback_unregister (enic->pdev->intr_handle, enic_intr_handler, (void *)enic->rte_dev);
drivers/net/failsafe/failsafe.c +17 -4
@@ -264,11 +264,23 @@ fs_eth_dev_create(struct rte_vdev_device *vdev) RTE_ETHER_ADDR_BYTES(mac)); dev->data->dev_flags |=RTE_ETH_DEV_INTR_LSC |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; -PRIV (dev)->intr_handle = (struct rte_intr_handle ){ - .fd =-1 , - .type =RTE_INTR_HANDLE_EXT , - }; + +/* Allocate interrupt instance */ +PRIV (dev)->intr_handle = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_SHARED ); +if (PRIV (dev)->intr_handle ==NULL ) { +ERROR ("Failed to allocate intr handle" ); + goto cancel_alarm; + } + +if (rte_intr_fd_set (PRIV (dev)->intr_handle,-1 )) + goto cancel_alarm; + +if (rte_intr_type_set (PRIV (dev)->intr_handle,RTE_INTR_HANDLE_EXT )) + goto cancel_alarm; +rte_eth_dev_probing_finish (dev); +return 0 ; cancel_alarm:failsafe_hotplug_alarm_cancel (dev);
@@ -297,6 +309,7 @@ fs_rte_eth_free(const char *name)return 0 ;/* port already released */ ret =failsafe_eth_dev_close (dev);rte_eth_dev_release_port (dev); +rte_intr_instance_free (PRIV (dev)->intr_handle);return ret; }
drivers/net/failsafe/failsafe_intr.c +24 -19
84 lines not on this page · raw message
drivers/net/failsafe/failsafe_ops.c +13 -6
@@ -393,15 +393,22 @@ fs_rx_queue_setup(struct rte_eth_dev *dev,* For the time being, fake as if we are using MSIX interrupts, * this will cause rte_intr_efd_enable to allocate an eventfd for us. */ -struct rte_intr_handle intr_handle = { - .type =RTE_INTR_HANDLE_VFIO_MSIX , - .efds = {-1 , }, - }; +struct rte_intr_handle *intr_handle;struct sub_device *sdev;struct rxq *rxq;uint8_t i;int ret; + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) +return -ENOMEM ; + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_VFIO_MSIX )) +return -rte_errno; + +if (rte_intr_efds_index_set (intr_handle,0 ,-1 )) +return -rte_errno; +fs_lock (dev,0 );if (rx_conf->rx_deferred_start) { FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
@@ -435,12 +442,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, rxq->info.nb_desc = nb_rx_desc; rxq->priv =PRIV (dev); rxq->sdev =PRIV (dev)->subs; - ret =rte_intr_efd_enable (&intr_handle,1 ); + ret =rte_intr_efd_enable (intr_handle,1 );if (ret <0 ) {
Lines of this file are not shown. View the raw message.
drivers/net/failsafe/failsafe_private.h +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/hns3/hns3_ethdev.c +27 -30
57 lines not on this page · raw message
drivers/net/hns3/hns3_ethdev_vf.c +32 -32
64 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.c +26 -27
53 lines not on this page · raw message
drivers/net/iavf/iavf_ethdev.c +21 -21
42 lines not on this page · raw message
drivers/net/ice/ice_ethdev.c +24 -25
49 lines not on this page · raw message
drivers/net/igc/igc_ethdev.c +21 -24
45 lines not on this page · raw message
drivers/net/ixgbe/ixgbe_ethdev.c +30 -36
66 lines not on this page · raw message
drivers/net/memif/memif_socket.c +79 -29
108 lines not on this page · raw message
drivers/net/memif/rte_eth_memif.c +44 -12
56 lines not on this page · raw message
drivers/net/mlx4/mlx4_intr.c +28 -19
47 lines not on this page · raw message
drivers/net/mlx5/linux/mlx5_os.c +35 -20
55 lines not on this page · raw message
drivers/net/mlx5/mlx5_rxq.c +24 -19
43 lines not on this page · raw message
drivers/net/octeontx2/otx2_ethdev_irq.c +17 -18
Lines of this file are not shown. View the raw message.
drivers/net/vhost/rte_eth_vhost.c +45 -35
80 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.c +35 -21
56 lines not on this page · raw message
drivers/net/vmxnet3/vmxnet3_ethdev.c +23 -20
43 lines not on this page · raw message
drivers/raw/ifpga/ifpga_rawdev.c +46 -16
62 lines not on this page · raw message
drivers/regex/octeontx2/otx2_regexdev_hw_access.c +2 -2
Lines of this file are not shown. View the raw message.
drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +30 -14
44 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.23.0
Part of the diff is not shown here. View the raw message.
PATCH v7 7/9 interrupts: make interrupt handle structure opaque
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Moving interrupt handle structure definition inside a EAL private header to make its fields totally opaque to the outside world.
---
Changes since v5:
- let rte_intr_handle fields untouched:
- split vfio / uio fd renames in a separate commit,
- split event list update in a separate commit,
- moved rte_intr_handle definition to a EAL private header,
- preserved dumping all info in interrupt tracepoints,
--- lib/eal/common/eal_common_interrupts.c | 2 + lib/eal/common/eal_interrupts.h | 37 +++++++++++++ lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 -------------------------- lib/eal/include/rte_eal_trace.h | 2 + lib/eal/include/rte_interrupts.h | 24 ++++++++- 6 files changed, 63 insertions(+), 75 deletions(-) create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h
lib/eal/common/eal_common_interrupts.c +2 -0
@@ -10,6 +10,8 @@#include <rte_log.h> #include <rte_malloc.h> +#include "eal_interrupts.h" +/* Macros to check for valid interrupt handle */ #define CHECK_VALID_INTR_HANDLE (intr_handle) do { \ if (intr_handle == NULL) { \
lib/eal/common/eal_interrupts.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2010-2014 Intel Corporation +*/ + +#ifndef EAL_INTERRUPTS_H +#define EAL_INTERRUPTS_H + +struct rte_intr_handle { + RTE_STD_C11 + union { +struct { + RTE_STD_C11 + union { +/** VFIO device file descriptor */ +int vfio_dev_fd; +/** UIO cfg file desc for uio_pci_generic */ +int uio_cfg_fd; + }; +int fd;/**< interrupt event file descriptor */ + }; +void *windows_handle;/**< device driver handle */ + }; +uint32_t alloc_flags;/**< flags passed at allocation */ +enum rte_intr_handle_type type;/**< handle type */ +uint32_t max_intr;/**< max interrupt requested */ +uint32_t nb_efd;/**< number of available efd(event fd) */ +uint8_t efd_counter_size;/**< size of efd counter, used for vdev */ +uint16_t nb_intr; +/**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ +int efds[RTE_MAX_RXTX_INTR_VEC_ID ];/**< intr vectors/efds mapping */ +struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID ]; +/**< intr vector epoll event */ +uint16_t vec_list_size; +int *intr_vec;/**< intr vector number array */ +}; + +#endif /* EAL_INTERRUPTS_H */
lib/eal/include/meson.build +0 -1
@@ -49,7 +49,6 @@ headers += files( 'rte_version.h', 'rte_vfio.h', ) -indirect_headers += files('rte_eal_interrupts.h') # special case install the generic headers, since they go in a subdir generic_headers = files(
lib/eal/include/rte_eal_interrupts.h deleted +0 -72
72 lines not on this page · raw message
lib/eal/include/rte_eal_trace.h +2 -0
@@ -19,6 +19,8 @@ extern "C" {#include <rte_interrupts.h> #include <rte_trace_point.h> +#include "eal_interrupts.h" +/* Alarm */ RTE_TRACE_POINT( rte_eal_trace_alarm_set,
lib/eal/include/rte_interrupts.h +22 -2
@@ -35,6 +35,28 @@ struct rte_intr_handle;/** Interrupt instance will be shared between primary and secondary processes. */ #define RTE_INTR_INSTANCE_F_SHARED RTE_BIT32(0) +#define RTE_MAX_RXTX_INTR_VEC_ID 512 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 + +/** +* The interrupt source type, e.g. UIO, VFIO, ALARM etc. +*/ +enum rte_intr_handle_type { +RTE_INTR_HANDLE_UNKNOWN =0 ,/**< generic unknown handle */ +RTE_INTR_HANDLE_UIO ,/**< uio device handle */ +RTE_INTR_HANDLE_UIO_INTX ,/**< uio generic handle */ +RTE_INTR_HANDLE_VFIO_LEGACY ,/**< vfio device handle (legacy) */ +RTE_INTR_HANDLE_VFIO_MSI ,/**< vfio device handle (MSI) */ +RTE_INTR_HANDLE_VFIO_MSIX ,/**< vfio device handle (MSIX) */ +RTE_INTR_HANDLE_ALARM ,/**< alarm handle */ +RTE_INTR_HANDLE_EXT ,/**< external handler */ +RTE_INTR_HANDLE_VDEV ,/**< virtual device */ +RTE_INTR_HANDLE_DEV_EVENT ,/**< device event handle */ +RTE_INTR_HANDLE_VFIO_REQ ,/**< VFIO request handle */ +RTE_INTR_HANDLE_MAX /**< count of elements */ +}; +/** Function to be registered for the specific interrupt */ typedef void (*rte_intr_callback_fn )(void *cb_arg);
@@ -45,8 +67,6 @@ typedef void (*rte_intr_callback_fn)(void *cb_arg);typedef void (*rte_intr_unregister_callback_fn )(struct rte_intr_handle *intr_handle,void *cb_arg); -#include "rte_eal_interrupts.h" -/** * It registers the callback for the specific interrupt. Multiple * callbacks can be registered at the same time.
Signature · 1 line
2.23.0
PATCH v7 8/9 interrupts: rename device specific file descriptor
In reply to David MarchandFrom: Harman Kalra <[email protected]>
VFIO/UIO are mutually exclusive, storing file descriptor in a single field is enough.
---
Changes since v5:
- split from patch5,
--- lib/eal/common/eal_common_interrupts.c | 6 +++--- lib/eal/common/eal_interrupts.h | 8 +------- lib/eal/include/rte_eal_trace.h | 8 ++++---- 3 files changed, 8 insertions(+), 14 deletions(-)
lib/eal/common/eal_common_interrupts.c +3 -3
@@ -72,7 +72,7 @@ struct rte_intr_handle *rte_intr_instance_dup(const struct rte_intr_handle *src) intr_handle =rte_intr_instance_alloc (src->alloc_flags); intr_handle->fd = src->fd; - intr_handle->vfio_dev_fd = src->vfio_dev_fd; + intr_handle->dev_fd = src->dev_fd; intr_handle->type = src->type; intr_handle->max_intr = src->max_intr; intr_handle->nb_efd = src->nb_efd;
@@ -139,7 +139,7 @@ int rte_intr_dev_fd_set(struct rte_intr_handle *intr_handle, int fd) {CHECK_VALID_INTR_HANDLE (intr_handle); - intr_handle->vfio_dev_fd = fd; + intr_handle->dev_fd = fd;return 0 ; fail:
@@ -150,7 +150,7 @@ int rte_intr_dev_fd_get(const struct rte_intr_handle *intr_handle) {CHECK_VALID_INTR_HANDLE (intr_handle); -return intr_handle->vfio_dev_fd; +return intr_handle->dev_fd; fail:return -1 ; }
lib/eal/common/eal_interrupts.h +1 -7
@@ -9,13 +9,7 @@ struct rte_intr_handle {RTE_STD_C11 union {struct { - RTE_STD_C11 - union { -/** VFIO device file descriptor */ -int vfio_dev_fd; -/** UIO cfg file desc for uio_pci_generic */ -int uio_cfg_fd; - }; +int dev_fd;/**< VFIO/UIO cfg device file descriptor */ int fd;/**< interrupt event file descriptor */ };void *windows_handle;/**< device driver handle */
lib/eal/include/rte_eal_trace.h +4 -4
@@ -151,7 +151,7 @@ RTE_TRACE_POINT( RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, rte_intr_callback_fn cb, void *cb_arg, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -164,7 +164,7 @@ RTE_TRACE_POINT( RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, rte_intr_callback_fn cb, void *cb_arg, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -176,7 +176,7 @@ RTE_TRACE_POINT( rte_eal_trace_intr_enable, RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
@@ -186,7 +186,7 @@ RTE_TRACE_POINT( rte_eal_trace_intr_disable, RTE_TRACE_POINT_ARGS(const struct rte_intr_handle *handle, int rc),rte_trace_point_emit_int (rc); -rte_trace_point_emit_int (handle->vfio_dev_fd); +rte_trace_point_emit_int (handle->dev_fd);rte_trace_point_emit_int (handle->fd);rte_trace_point_emit_int (handle->type);rte_trace_point_emit_u32 (handle->max_intr);
Signature · 1 line
2.23.0
PATCH v7 9/9 interrupts: extend event list
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Dynamically allocating the efds and elist array of intr_handle structure, based on size provided by user. Eg size can be MSIX interrupts supported by a PCI device.
---
Changes since v6:
- removed unneeded checks on elist/efds array initialisation,
Changes since v5:
- split from patch5,
--- drivers/bus/pci/linux/pci_vfio.c | 6 ++ drivers/common/cnxk/roc_platform.h | 1 + lib/eal/common/eal_common_interrupts.c | 95 +++++++++++++++++++++++++- lib/eal/common/eal_interrupts.h | 5 +- 4 files changed, 102 insertions(+), 5 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +6 -0
@@ -266,6 +266,12 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)return -1 ; } +/* Reallocate the efds and elist fields of intr_handle based +* on PCI device MSIX size. +*/ +if (rte_intr_event_list_update (dev->intr_handle, irq.count)) +return -1 ; +/* if this vector cannot be used with eventfd, fail if we explicitly * specified interrupt type, otherwise continue */ if ((irq.flags &VFIO_IRQ_INFO_EVENTFD ) ==0 ) {
drivers/common/cnxk/roc_platform.h +1 -0
@@ -121,6 +121,7 @@#define plt_intr_instance_alloc rte_intr_instance_alloc#define plt_intr_instance_dup rte_intr_instance_dup#define plt_intr_instance_free rte_intr_instance_free +#define plt_intr_event_list_update rte_intr_event_list_update#define plt_intr_max_intr_get rte_intr_max_intr_get#define plt_intr_max_intr_set rte_intr_max_intr_set#define plt_intr_nb_efd_get rte_intr_nb_efd_get
lib/eal/common/eal_common_interrupts.c +93 -2
117 lines not on this page · raw message
lib/eal/common/eal_interrupts.h +2 -3
@@ -21,9 +21,8 @@ struct rte_intr_handle {uint8_t efd_counter_size;/**< size of efd counter, used for vdev */ uint16_t nb_intr;/**< Max vector count, default RTE_MAX_RXTX_INTR_VEC_ID */ -int efds[RTE_MAX_RXTX_INTR_VEC_ID ];/**< intr vectors/efds mapping */ -struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID ]; -/**< intr vector epoll event */ +int *efds;/**< intr vectors/efds mapping */ +struct rte_epoll_event *elist;/**< intr vector epoll event */ uint16_t vec_list_size;int *intr_vec;/**< intr vector number array */ };
Signature · 1 line
2.23.0
v8 cover make rte_intr_handle internal
In reply to Harman KalraMoving struct rte_intr_handle as an internal structure to avoid any ABI breakages in future. Since this structure defines some static arrays and changing respective macros breaks the ABI. Eg:
Currently RTE_MAX_RXTX_INTR_VEC_ID imposes a limit of maximum 512 MSI-X interrupts that can be defined for a PCI device, while PCI specification allows maximum 2048 MSI-X interrupts that can be used. If some PCI device requires more than 512 vectors, either change the RTE_MAX_RXTX_INTR_VEC_ID limit or dynamically allocate based on PCI device MSI-X size on probe time. Either way its an ABI breakage.
Change already included in 21.11 ABI improvement spreadsheet (item 42):
https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_s
preadsheets_d_1betlC000ua5SsSiJIcC54mCCCJnW6voH5Dqv9UxeyfE_edit-23gid- 3D0&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=5ESHPj7V-7JdkxT_Z_SU6RrS37ys4U XudBQ_rrS5LRo&m=7dl3OmXU7QHMmWYB6V1hYJtq1cUkjfhXUwze2Si_48c&s=lh6DEGhR Bg1shODpAy3RQk-H-0uQx5icRfUBf9dtCp4&e=
This series makes struct rte_intr_handle totally opaque to the outside world by wrapping it inside a .c file and providing get set wrapper APIs to read or manipulate its fields.. Any changes to be made to any of the fields should be done via these get set APIs.
Introduced a new eal_common_interrupts.c where all these APIs are defined and also hides struct rte_intr_handle definition.
v1:
* Fixed freebsd compilation failure
* Fixed seg fault in case of memif
v2:
* Merged the prototype and implementation patch to 1.
* Restricting allocation of single interrupt instance.
* Removed base APIs, as they were exposing internally allocated memory information.
* Fixed some memory leak issues.
* Marked some library specific APIs as internal.
v3:
* Removed flag from instance alloc API, rather auto detect if memory should be allocated using glibc malloc APIs or rte_malloc*
* Added APIs for get/set windows handle.
* Defined macros for repeated checks.
v4:
* Rectified some typo in the APIs documentation.
* Better names for some internal variables.
v5:
* Reverted back to passing flag to instance alloc API, as with auto detect some multiprocess issues existing in the library were causing tests failure.
* Rebased to top of tree.
v6:
* renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
* changed API and removed need for alloc_flag content exposure (see rte_intr_instance_dup() in patch 1 and 2),
* exported all symbols for Windows,
* fixed leak in unit tests in case of alloc failure,
* split (previously) patch 4 into three patches
* (now) patch 4 only concerns alarm and (previously) patch 6 cleanup bits are squashed in it,
* (now) patch 5 concerns other libraries updates,
* (now) patch 6 concerns drivers updates:
* instance allocation is moved to probing for auxiliary,
* there might be a bug for PCI drivers non requesting RTE_PCI_DRV_NEED_MAPPING, but code is left as v5,
* split (previously) patch 5 into three patches
* (now) patch 7 only hides structure, but keep it in a EAL private header, this makes it possible to keep info in tracepoints,
* (now) patch 8 deals with VFIO/UIO internal fds merge,
* (now) patch 9 extends event list,
v7:
* fixed compilation on FreeBSD,
* removed unused interrupt handle in FreeBSD alarm code,
* fixed interrupt handle allocation for PCI drivers without RTE_PCI_DRV_NEED_MAPPING,
v8:
* lowered logs level to DEBUG in sanity checks,
* fixed corner case with vector list access,
Signature · 153 lines
David Marchand Harman Kalra (9): interrupts: add allocator and accessors interrupts: remove direct access to interrupt handle test/interrupts: remove direct access to interrupt handle alarm: remove direct access to interrupt handle lib: remove direct access to interrupt handle drivers: remove direct access to interrupt handle interrupts: make interrupt handle structure opaque interrupts: rename device specific file descriptor interrupts: extend event list MAINTAINERS | 1 + app/test/test_interrupts.c | 164 +++-- drivers/baseband/acc100/rte_acc100_pmd.c | 14 +- .../fpga_5gnr_fec/rte_fpga_5gnr_fec.c | 24 +- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 24 +- drivers/bus/auxiliary/auxiliary_common.c | 17 +- drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 28 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 14 +- drivers/bus/fslmc/fslmc_vfio.c | 30 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 18 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 13 +- drivers/bus/ifpga/rte_bus_ifpga.h | 2 +- drivers/bus/pci/bsd/pci.c | 20 +- drivers/bus/pci/linux/pci.c | 4 +- drivers/bus/pci/linux/pci_uio.c | 69 +- drivers/bus/pci/linux/pci_vfio.c | 108 ++- drivers/bus/pci/pci_common.c | 47 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 6 + drivers/bus/vmbus/linux/vmbus_uio.c | 35 +- drivers/bus/vmbus/rte_bus_vmbus.h | 2 +- drivers/bus/vmbus/vmbus_common_uio.c | 23 +- drivers/common/cnxk/roc_cpt.c | 8 +- drivers/common/cnxk/roc_dev.c | 14 +- drivers/common/cnxk/roc_irq.c | 107 +-- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 8 +- drivers/common/cnxk/roc_nix_irq.c | 36 +- drivers/common/cnxk/roc_npa.c | 2 +- drivers/common/cnxk/roc_platform.h | 49 +- drivers/common/cnxk/roc_sso.c | 4 +- drivers/common/cnxk/roc_tim.c | 4 +- drivers/common/octeontx2/otx2_dev.c | 14 +- drivers/common/octeontx2/otx2_irq.c | 117 ++-- .../octeontx2/otx2_cryptodev_hw_access.c | 4 +- drivers/event/octeontx2/otx2_evdev_irq.c | 12 +- drivers/mempool/octeontx2/otx2_mempool.c | 2 +- drivers/net/atlantic/atl_ethdev.c | 20 +- drivers/net/avp/avp_ethdev.c | 8 +- drivers/net/axgbe/axgbe_ethdev.c | 12 +- drivers/net/axgbe/axgbe_mdio.c | 6 +- drivers/net/bnx2x/bnx2x_ethdev.c | 10 +- drivers/net/bnxt/bnxt_ethdev.c | 33 +- drivers/net/bnxt/bnxt_irq.c | 4 +- drivers/net/dpaa/dpaa_ethdev.c | 48 +- drivers/net/dpaa2/dpaa2_ethdev.c | 10 +- drivers/net/e1000/em_ethdev.c | 23 +- drivers/net/e1000/igb_ethdev.c | 79 +-- drivers/net/ena/ena_ethdev.c | 35 +- drivers/net/enic/enic_main.c | 26 +- drivers/net/failsafe/failsafe.c | 21 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 19 +- drivers/net/failsafe/failsafe_private.h | 2 +- drivers/net/fm10k/fm10k_ethdev.c | 32 +- drivers/net/hinic/hinic_pmd_ethdev.c | 10 +- drivers/net/hns3/hns3_ethdev.c | 57 +- drivers/net/hns3/hns3_ethdev_vf.c | 64 +- drivers/net/hns3/hns3_rxtx.c | 2 +- drivers/net/i40e/i40e_ethdev.c | 53 +- drivers/net/iavf/iavf_ethdev.c | 42 +- drivers/net/iavf/iavf_vchnl.c | 4 +- drivers/net/ice/ice_dcf.c | 10 +- drivers/net/ice/ice_dcf_ethdev.c | 21 +- drivers/net/ice/ice_ethdev.c | 49 +- drivers/net/igc/igc_ethdev.c | 45 +- drivers/net/ionic/ionic_ethdev.c | 17 +- drivers/net/ixgbe/ixgbe_ethdev.c | 66 +- drivers/net/memif/memif_socket.c | 108 ++- drivers/net/memif/memif_socket.h | 4 +- drivers/net/memif/rte_eth_memif.c | 56 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 19 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 55 +- drivers/net/mlx5/linux/mlx5_socket.c | 25 +- drivers/net/mlx5/mlx5.h | 6 +- drivers/net/mlx5/mlx5_rxq.c | 43 +- drivers/net/mlx5/mlx5_trigger.c | 4 +- drivers/net/mlx5/mlx5_txpp.c | 25 +- drivers/net/netvsc/hn_ethdev.c | 4 +- drivers/net/nfp/nfp_common.c | 34 +- drivers/net/nfp/nfp_ethdev.c | 13 +- drivers/net/nfp/nfp_ethdev_vf.c | 13 +- drivers/net/ngbe/ngbe_ethdev.c | 29 +- drivers/net/octeontx2/otx2_ethdev_irq.c | 35 +- drivers/net/qede/qede_ethdev.c | 16 +- drivers/net/sfc/sfc_intr.c | 30 +- drivers/net/tap/rte_eth_tap.c | 33 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 33 +- drivers/net/thunderx/nicvf_ethdev.c | 10 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 38 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 80 ++- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 56 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 62 +- drivers/raw/ntb/ntb.c | 9 +- .../regex/octeontx2/otx2_regexdev_hw_access.c | 4 +- drivers/vdpa/ifc/ifcvf_vdpa.c | 5 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 8 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 21 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 500 ++++++++++++++ lib/eal/common/eal_interrupts.h | 30 + lib/eal/common/eal_private.h | 10 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 35 +- lib/eal/freebsd/eal_interrupts.c | 85 ++- lib/eal/include/meson.build | 2 +- lib/eal/include/rte_eal_interrupts.h | 269 -------- lib/eal/include/rte_eal_trace.h | 10 +- lib/eal/include/rte_epoll.h | 118 ++++ lib/eal/include/rte_interrupts.h | 651 +++++++++++++++++- lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 +- lib/eal/linux/eal_dev.c | 57 +- lib/eal/linux/eal_interrupts.c | 304 ++++---- lib/eal/version.map | 45 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 132 files changed, 3449 insertions(+), 1748 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/common/eal_interrupts.h delete mode 100644 lib/eal/include/rte_eal_interrupts.h create mode 100644 lib/eal/include/rte_epoll.h -- 2.23.0
PATCH v8 1/9 interrupts: add allocator and accessors
From: Harman Kalra <[email protected]>
Prototype/Implement get set APIs for interrupt handle fields. User won't be able to access any of the interrupt handle fields directly while should use these get/set APIs to access/manipulate them.
Internal interrupt header i.e. rte_eal_interrupt.h is rearranged, as APIs defined are moved to rte_interrupts.h and epoll specific definitions are moved to a new header rte_epoll.h. Later in the series rte_eal_interrupt.h will be removed.
---
Changes since v7:
- lowered checks log level to DEBUG,
- removed asserts on vector list size, and fixed check on list size for drivers like mlx5 who expects list is not initialized,
Changes since v5:
- renamed RTE_INTR_INSTANCE_F_UNSHARED as RTE_INTR_INSTANCE_F_PRIVATE,
- used a single bit to mark instance as shared (default is private),
- removed rte_intr_instance_copy / rte_intr_instance_alloc_flag_get with a single rte_intr_instance_dup helper,
- made rte_intr_vec_list_alloc alloc_flags-aware,
- exported all symbols for Windows,
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 407 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 207 +------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 627 +++++++++++++++++++++++++ lib/eal/version.map | 45 +- 8 files changed, 1197 insertions(+), 210 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.h
MAINTAINERS +1 -0
@@ -211,6 +211,7 @@ F: app/test/test_memzone.c Interrupt Subsystem M: Harman Kalra <[email protected]> +F: lib/eal/include/rte_epoll.h F: lib/eal/*/*interrupts.* F: app/test/test_interrupts.c
lib/eal/common/eal_common_interrupts.c new file +407 -0
407 lines not on this page · raw message
lib/eal/common/meson.build +1 -0
@@ -15,6 +15,7 @@ sources += files( 'eal_common_errno.c', 'eal_common_fbarray.c', 'eal_common_hexdump.c', + 'eal_common_interrupts.c', 'eal_common_launch.c', 'eal_common_lcore.c', 'eal_common_log.c',
lib/eal/include/meson.build +1 -0
@@ -19,6 +19,7 @@ headers += files( 'rte_eal_memconfig.h', 'rte_eal_trace.h', 'rte_errno.h', + 'rte_epoll.h', 'rte_fbarray.h', 'rte_hexdump.h', 'rte_hypervisor.h',
lib/eal/include/rte_eal_interrupts.h +5 -202
228 lines not on this page · raw message
lib/eal/include/rte_epoll.h new file +118 -0
118 lines not on this page · raw message
lib/eal/include/rte_interrupts.h +627 -0
647 lines not on this page · raw message
lib/eal/version.map +37 -8
67 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH v8 2/9 interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field.
---
Changes since v6:
- fixed compilation on FreeBSD,
Changes since v5:
- used new helper rte_intr_instance_dup,
--- lib/eal/freebsd/eal_interrupts.c | 85 +++++---- lib/eal/linux/eal_interrupts.c | 304 +++++++++++++++++-------------- 2 files changed, 219 insertions(+), 170 deletions(-)
lib/eal/freebsd/eal_interrupts.c +47 -38
@@ -40,7 +40,7 @@ struct rte_intr_callback {struct rte_intr_source {TAILQ_ENTRY (rte_intr_source) next; -struct rte_intr_handle intr_handle;/**< interrupt handle */ +struct rte_intr_handle *intr_handle;/**< interrupt handle */ struct rte_intr_cb_list callbacks;/**< user callbacks */ uint32_t active; };
@@ -60,7 +60,7 @@ static int intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) {/* alarm callbacks are special case */ -if (ih->type ==RTE_INTR_HANDLE_ALARM ) { +if (rte_intr_type_get (ih) ==RTE_INTR_HANDLE_ALARM ) {uint64_t timeout_ns;/* get soonest alarm timeout */
@@ -75,7 +75,7 @@ intr_source_to_kevent(const struct rte_intr_handle *ih, struct kevent *ke) }else { ke->filter =EVFILT_READ ; } - ke->ident = ih->fd; + ke->ident =rte_intr_fd_get (ih);return 0 ; }
@@ -89,7 +89,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,int ret =0 , add_event =0 ;/* first do parameter checking */ -if (intr_handle ==NULL || intr_handle->fd <0 || cb ==NULL ) { +if (rte_intr_fd_get (intr_handle) <0 || cb ==NULL ) {RTE_LOG (ERR ,EAL ,"Registering with invalid input parameter\n" );return -EINVAL ;
@@ -103,7 +103,7 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* find the source for this intr_handle */ TAILQ_FOREACH(src, &intr_sources, next) { -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ; }
@@ -112,8 +112,9 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,* thing on the list should be eal_alarm_callback() and we may * be called just to reset the timer. */ -if (src !=NULL && src->intr_handle.type ==RTE_INTR_HANDLE_ALARM && - !TAILQ_EMPTY (&src->callbacks)) { +if (src !=NULL && +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM && + !TAILQ_EMPTY (&src->callbacks)) { callback =NULL ; }else {/* allocate a new interrupt callback entity */
@@ -135,7 +136,14 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; + src->intr_handle =rte_intr_instance_dup (intr_handle); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); + ret = -ENOMEM ; +free (src); + src =NULL ; + goto fail; + }TAILQ_INIT (&src->callbacks);TAILQ_INSERT_TAIL (&intr_sources, src, next); }
@@ -151,7 +159,8 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,/* add events to the queue. timer events are special as we need to * re-set the timer. */ -if (add_event || src->intr_handle.type ==RTE_INTR_HANDLE_ALARM ) { +if (add_event || +rte_intr_type_get (src->intr_handle) ==RTE_INTR_HANDLE_ALARM ) {struct kevent ke;memset (&ke,0 ,sizeof (ke));
@@ -173,12 +182,11 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,*/ if (errno ==ENODEV )RTE_LOG (DEBUG ,EAL ,"Interrupt handle %d not supported\n" , - src->intr_handle.fd); +rte_intr_fd_get (src->intr_handle));else -RTE_LOG (ERR ,EAL ,"Error adding fd %d " -"kevent, %s\n" , - src->intr_handle.fd, -strerror (errno)); +RTE_LOG (ERR ,EAL ,"Error adding fd %d kevent, %s\n" , +rte_intr_fd_get (src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +221,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -228,7 +236,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -268,7 +276,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -282,7 +290,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,/* check if the insterrupt source for the fd is existent */ TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == intr_handle->fd) +if (rte_intr_fd_get (src->intr_handle) ==rte_intr_fd_get (intr_handle))break ;/* No interrupt source registered for the fd */
@@ -314,7 +322,8 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle,*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" , - src->intr_handle.fd,strerror (errno)); +rte_intr_fd_get (src->intr_handle), +strerror (errno));/* removing non-existent even is an expected condition * in some circumstances (e.g. oneshot events). */
@@ -365,17 +374,18 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -386,9 +396,8 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +415,18 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)if (intr_handle ==NULL )return -1 ; -if (intr_handle->type ==RTE_INTR_HANDLE_VDEV ) { +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV ) { rc =0 ; goto out; } -if (intr_handle->fd <0 || intr_handle->uio_cfg_fd <0 ) { +if (rte_intr_fd_get (intr_handle) <0 || +rte_intr_dev_fd_get (intr_handle) <0 ) { rc =-1 ; goto out; } -switch (intr_handle->type) { +switch (rte_intr_type_get (intr_handle)) {/* not used at this moment */ case RTE_INTR_HANDLE_ALARM : rc =-1 ;
@@ -427,9 +437,8 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)break ;/* unknown handle type */ default : -RTE_LOG (ERR ,EAL , -"Unknown handle type of fd %d\n" , - intr_handle->fd); +RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +450,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)int rte_intr_ack (const struct rte_intr_handle *intr_handle) { -if (intr_handle && intr_handle->type ==RTE_INTR_HANDLE_VDEV ) +if (rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +472,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_lock (&intr_lock); TAILQ_FOREACH(src, &intr_sources, next) -if (src->intr_handle.fd == event_fd) +if (rte_intr_fd_get (src->intr_handle) == event_fd)break ;if (src ==NULL ) {rte_spinlock_unlock (&intr_lock);
@@ -475,7 +484,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)rte_spinlock_unlock (&intr_lock);/* set the length to be read dor different handle type */ -switch (src->intr_handle.type) { +switch (rte_intr_type_get (src->intr_handle)) {case RTE_INTR_HANDLE_ALARM : bytes_read =0 ; call = true;
@@ -546,7 +555,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)/* mark for deletion from the queue */ ke.flags =EV_DELETE ; -if (intr_source_to_kevent (&src->intr_handle, &ke) <0 ) { +if (intr_source_to_kevent (src->intr_handle, &ke) <0 ) {RTE_LOG (ERR ,EAL ,"Cannot convert to kevent\n" );rte_spinlock_unlock (&intr_lock);return ;
@@ -556,8 +565,8 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)* remove intr file descriptor from wait list. */ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) { -RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, %s\n" , +rte_intr_fd_get (src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +576,7 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)TAILQ_REMOVE (&src->callbacks, cb, next);if (cb->ucb_fn) - cb->ucb_fn (&src->intr_handle, cb->cb_arg); + cb->ucb_fn (src->intr_handle, cb->cb_arg);free (cb); } }
lib/eal/linux/eal_interrupts.c +172 -132
754 lines not on this page · raw message
Signature · 1 line
2.23.0
PATCH v8 3/9 test/interrupts: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Updating the interrupt testsuite to make use of interrupt handle get set APIs.
---
Changes since v5:
- fixed leak on when some interrupt handle can't be allocated,
--- app/test/test_interrupts.c | 164 ++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 66 deletions(-)
app/test/test_interrupts.c +98 -66
@@ -16,7 +16,7 @@/* predefined interrupt handle types */ enum test_interrupt_handle_type { -TEST_INTERRUPT_HANDLE_INVALID , +TEST_INTERRUPT_HANDLE_INVALID =0 ,TEST_INTERRUPT_HANDLE_VALID ,TEST_INTERRUPT_HANDLE_VALID_UIO ,TEST_INTERRUPT_HANDLE_VALID_ALARM ,
@@ -27,7 +27,7 @@ enum test_interrupt_handle_type {/* flag of if callback is called */ static volatile int flag; -static struct rte_intr_handle intr_handles[TEST_INTERRUPT_HANDLE_MAX ]; +static struct rte_intr_handle *intr_handles[TEST_INTERRUPT_HANDLE_MAX ];static enum test_interrupt_handle_type test_intr_type =TEST_INTERRUPT_HANDLE_MAX ;
@@ -50,7 +50,7 @@ static union intr_pipefds pfds;static inline int test_interrupt_handle_sanity_check (struct rte_intr_handle *intr_handle) { -if (!intr_handle || intr_handle->fd <0 ) +if (!intr_handle ||rte_intr_fd_get (intr_handle) <0 )return -1 ;return 0 ;
@@ -62,31 +62,54 @@ test_interrupt_handle_sanity_check(struct rte_intr_handle *intr_handle)static int test_interrupt_init (void ) { +struct rte_intr_handle *test_intr_handle; +int i; +if (pipe (pfds.pipefd) <0 )return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].fd =-1 ; - intr_handles[TEST_INTERRUPT_HANDLE_INVALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) { + intr_handles[i] = +rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (!intr_handles[i]) +return -1 ; + } - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; +if (rte_intr_fd_set (test_intr_handle,-1 )) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ].type = -RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UNKNOWN )) +return -1 ; + + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ].type = -RTE_INTR_HANDLE_ALARM ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_ALARM )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ].type = -RTE_INTR_HANDLE_DEV_EVENT ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; +if (rte_intr_fd_set (test_intr_handle, pfds.readfd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_DEV_EVENT )) +return -1 ; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].fd = pfds.writefd; - intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ].type =RTE_INTR_HANDLE_UIO ; + test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; +if (rte_intr_fd_set (test_intr_handle, pfds.writefd)) +return -1 ; +if (rte_intr_type_set (test_intr_handle,RTE_INTR_HANDLE_UIO )) +return -1 ;return 0 ; }
@@ -97,6 +120,10 @@ test_interrupt_init(void)static int test_interrupt_deinit (void ) { +int i; + +for (i =0 ; i <TEST_INTERRUPT_HANDLE_MAX ; i++) +rte_intr_instance_free (intr_handles[i]);close (pfds.pipefd[0 ]);close (pfds.pipefd[1 ]);
@@ -125,8 +152,10 @@ test_interrupt_handle_compare(struct rte_intr_handle *intr_handle_l,if (!intr_handle_l || !intr_handle_r)return -1 ; -if (intr_handle_l->fd != intr_handle_r->fd || - intr_handle_l->type != intr_handle_r->type) +if (rte_intr_fd_get (intr_handle_l) != +rte_intr_fd_get (intr_handle_r) || +rte_intr_type_get (intr_handle_l) != +rte_intr_type_get (intr_handle_r))return -1 ;return 0 ;
@@ -178,6 +207,8 @@ static void test_interrupt_callback(void *arg) {struct rte_intr_handle *intr_handle = arg; +struct rte_intr_handle *test_intr_handle; +if (test_intr_type >=TEST_INTERRUPT_HANDLE_MAX ) {printf ("invalid interrupt type\n" ); flag =-1 ;
@@ -198,8 +229,8 @@ test_interrupt_callback(void *arg)return ; } -if (test_interrupt_handle_compare (intr_handle, - &(intr_handles[test_intr_type])) ==0 ) + test_intr_handle = intr_handles[test_intr_type]; +if (test_interrupt_handle_compare (intr_handle, test_intr_handle) ==0 ) flag =1 ; }
@@ -223,7 +254,7 @@ test_interrupt_callback_1(void *arg)static int test_interrupt_enable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_enable (NULL ) ==0 ) {
@@ -233,7 +264,7 @@ test_interrupt_enable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable invalid intr_handle " "successfully\n" );return -1 ;
@@ -241,7 +272,7 @@ test_interrupt_enable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -249,7 +280,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -257,7 +288,7 @@ test_interrupt_enable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -265,13 +296,13 @@ test_interrupt_enable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_enable (&test_intr_handle) <0 ) { +if (rte_intr_enable (test_intr_handle) <0 ) {printf ("fail to enable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_enable (&test_intr_handle) ==0 ) { +if (rte_intr_enable (test_intr_handle) ==0 ) {printf ("unexpectedly enable a specific intr_handle " "successfully\n" );return -1 ;
@@ -286,7 +317,7 @@ test_interrupt_enable(void)static int test_interrupt_disable (void ) { -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;/* check with null intr_handle */ if (rte_intr_disable (NULL ) ==0 ) {
@@ -297,7 +328,7 @@ test_interrupt_disable(void)/* check with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable invalid intr_handle " "successfully\n" );return -1 ;
@@ -305,7 +336,7 @@ test_interrupt_disable(void)/* check with valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -313,7 +344,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -321,7 +352,7 @@ test_interrupt_disable(void)/* check with specific valid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -329,13 +360,13 @@ test_interrupt_disable(void)/* check with valid handler and its type */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_CASE1 ]; -if (rte_intr_disable (&test_intr_handle) <0 ) { +if (rte_intr_disable (test_intr_handle) <0 ) {printf ("fail to disable interrupt on a simulated handler\n" );return -1 ; } test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -if (rte_intr_disable (&test_intr_handle) ==0 ) { +if (rte_intr_disable (test_intr_handle) ==0 ) {printf ("unexpectedly disable a specific intr_handle " "successfully\n" );return -1 ;
@@ -351,13 +382,13 @@ static int test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type) {int count; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle; flag =0 ; test_intr_handle = intr_handles[intr_type]; test_intr_type = intr_type; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("fail to register callback\n" );return -1 ; }
@@ -371,9 +402,9 @@ test_interrupt_full_path_check(enum test_interrupt_handle_type intr_type)rte_delay_ms (TEST_INTERRUPT_CHECK_INTERVAL );while ((count = -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, - &test_intr_handle)) <0 ) { + test_intr_handle)) <0 ) {if (count != -EAGAIN )return -1 ; }
@@ -396,11 +427,11 @@ static inttest_interrupt (void) {int ret =-1 ; -struct rte_intr_handle test_intr_handle; +struct rte_intr_handle *test_intr_handle;if (test_interrupt_init () <0 ) {printf ("fail to initialize for testing interrupt\n" ); -return -1 ; + goto out; }printf ("Check unknown valid interrupt full path\n" );
@@ -445,8 +476,8 @@ test_interrupt(void)/* check if it will fail to register cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with invalid " "intr_handle\n" ); goto out;
@@ -454,7 +485,8 @@ test_interrupt(void)/* check if it will fail to register without callback */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle,NULL , &test_intr_handle) ==0 ) { +if (rte_intr_callback_register (test_intr_handle,NULL , + test_intr_handle) ==0 ) {printf ("unexpectedly register successfully with " "null callback\n" ); goto out;
@@ -470,8 +502,8 @@ test_interrupt(void)/* check if it will fail to unregister cb with invalid intr_handle */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_INVALID ]; -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) >0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) >0 ) {printf ("unexpectedly unregister successfully with " "invalid intr_handle\n" ); goto out;
@@ -479,29 +511,29 @@ test_interrupt(void)/* check if it is ok to register the same intr_handle twice */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_register (&test_intr_handle, - test_interrupt_callback_1, &test_intr_handle) <0 ) { +if (rte_intr_callback_register (test_intr_handle, + test_interrupt_callback_1, test_intr_handle) <0 ) {printf ("it fails to register test_interrupt_callback_1\n" ); goto out; }/* check if it will fail to unregister with invalid parameter */ -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)0xff ) !=0 ) {printf ("unexpectedly unregisters successfully with " "invalid arg\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, - test_interrupt_callback, &test_intr_handle) <=0 ) { +if (rte_intr_callback_unregister (test_intr_handle, + test_interrupt_callback, test_intr_handle) <=0 ) {printf ("it fails to unregister test_interrupt_callback\n" ); goto out; } -if (rte_intr_callback_unregister (&test_intr_handle, +if (rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ) <=0 ) {printf ("it fails to unregister test_interrupt_callback_1 " "for all\n" );
@@ -529,27 +561,27 @@ test_interrupt(void)printf ("Clearing for interrupt tests\n" );/* clear registered callbacks */ test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_UIO ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_ALARM ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 ); test_intr_handle = intr_handles[TEST_INTERRUPT_HANDLE_VALID_DEV_EVENT ]; -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback, (void *)-1 ); -rte_intr_callback_unregister (&test_intr_handle, +rte_intr_callback_unregister (test_intr_handle, test_interrupt_callback_1, (void *)-1 );rte_delay_ms (2 *TEST_INTERRUPT_CHECK_INTERVAL );
Signature · 1 line
2.23.0
PATCH v8 4/9 alarm: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
Implementing alarm cleanup routine, where the memory allocated for interrupt instance can be freed.
---
Changes since v6:
- removed unused interrupt handle in FreeBSD alarm code,
Changes since v5:
- split from patch4,
- merged patch6,
- renamed rte_eal_alarm_fini as rte_eal_alarm_cleanup,
--- lib/eal/common/eal_private.h | 10 ++++++++++ lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 35 +++++++++++++++++++++++++++++------ lib/eal/linux/eal.c | 1 + lib/eal/linux/eal_alarm.c | 32 +++++++++++++++++++++++++------- 5 files changed, 66 insertions(+), 13 deletions(-)
lib/eal/common/eal_private.h +10 -0
@@ -163,6 +163,16 @@ int rte_eal_intr_init(void);*/ int rte_eal_alarm_init (void ); +/** +* Alarm mechanism cleanup. +* +* This function is private to EAL. +* +* @return +* 0 on success, negative on error +*/ +void rte_eal_alarm_cleanup (void ); +/** * Function is to check if the kernel module(like, vfio, vfio_iommu_type1, * etc.) loaded.
lib/eal/freebsd/eal.c +1 -0
@@ -975,6 +975,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/freebsd/eal_alarm.c +29 -6
@@ -32,7 +32,6 @@struct alarm_entry {LIST_ENTRY (alarm_entry) next; -struct rte_intr_handle handle;struct timespec time;rte_eal_alarm_callback cb_fn;void *cb_arg;
@@ -43,22 +42,46 @@ struct alarm_entry { static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();static rte_spinlock_t alarm_list_lk =RTE_SPINLOCK_INITIALIZER ; -static struct rte_intr_handle intr_handle = {.fd =-1 }; +static struct rte_intr_handle *intr_handle;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_cleanup (void ) +{ +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) { - intr_handle.type =RTE_INTR_HANDLE_ALARM ; +int fd; + + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + goto error; + } + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error; + +if (rte_intr_fd_set (intr_handle,-1 )) + goto error;/* on FreeBSD, timers don't use fd's, and their identifiers are stored * in separate namespace from fd's, so using any value is OK. however, * EAL interrupts handler expects fd's to be unique, so use an actual fd * to guarantee unique timer identifier. */ - intr_handle.fd =open ("/dev/zero" ,O_RDONLY ); + fd =open ("/dev/zero" ,O_RDONLY ); + +if (rte_intr_fd_set (intr_handle, fd)) + goto error;return 0 ; +error: +rte_intr_instance_free (intr_handle); +return -1 ; } static inline int
@@ -118,7 +141,7 @@ unregister_current_callback(void) ap =LIST_FIRST (&alarm_list);do { - ret =rte_intr_callback_unregister (&intr_handle, + ret =rte_intr_callback_unregister (intr_handle, eal_alarm_callback, &ap->time); }while (ret == -EAGAIN ); }
@@ -136,7 +159,7 @@ register_first_callback(void) ap =LIST_FIRST (&alarm_list);/* register a new callback */ - ret =rte_intr_callback_register (&intr_handle, + ret =rte_intr_callback_register (intr_handle, eal_alarm_callback, &ap->time); }return ret;
lib/eal/linux/eal.c +1 -0
@@ -1368,6 +1368,7 @@ rte_eal_cleanup(void)rte_mp_channel_cleanup ();/* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach (); +rte_eal_alarm_cleanup ();rte_trace_save ();eal_trace_fini ();eal_cleanup_config (internal_conf);
lib/eal/linux/eal_alarm.c +25 -7
@@ -54,22 +54,40 @@ struct alarm_entry { static LIST_HEAD(alarm_list, alarm_entry) alarm_list = LIST_HEAD_INITIALIZER();static rte_spinlock_t alarm_list_lk =RTE_SPINLOCK_INITIALIZER ; -static struct rte_intr_handle intr_handle = {.fd =-1 }; +static struct rte_intr_handle *intr_handle;static int handler_registered =0 ;static void eal_alarm_callback (void *arg); +void +rte_eal_alarm_cleanup (void ) +{ +rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) { - intr_handle.type =RTE_INTR_HANDLE_ALARM ; + + intr_handle =rte_intr_instance_alloc (RTE_INTR_INSTANCE_F_PRIVATE ); +if (intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + goto error; + } + +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error; +/* create a timerfd file descriptor */ - intr_handle.fd =timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ); -if (intr_handle.fd ==-1 ) +if (rte_intr_fd_set (intr_handle, +timerfd_create (CLOCK_MONOTONIC ,TFD_NONBLOCK ))) goto error; +if (rte_intr_fd_get (intr_handle) ==-1 ) + goto error;return 0 ; error: +rte_intr_instance_free (intr_handle); rte_errno = errno;return -1 ; }
@@ -109,7 +127,7 @@ eal_alarm_callback(void *arg __rte_unused) atime.it_value.tv_sec -= now.tv_sec; atime.it_value.tv_nsec -= now.tv_nsec; -timerfd_settime (intr_handle.fd,0 , &atime,NULL ); +timerfd_settime (rte_intr_fd_get (intr_handle),0 , &atime,NULL ); }rte_spinlock_unlock (&alarm_list_lk); }
@@ -140,7 +158,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)rte_spinlock_lock (&alarm_list_lk);if (!handler_registered) {/* registration can fail, callback can be registered later */ -if (rte_intr_callback_register (&intr_handle, +if (rte_intr_callback_register (intr_handle, eal_alarm_callback,NULL ) ==0 ) handler_registered =1 ; }
@@ -170,7 +188,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg) .tv_nsec = (us % US_PER_S) * NS_PER_US, }, }; - ret |=timerfd_settime (intr_handle.fd,0 , &alarm_time,NULL ); + ret |=timerfd_settime (rte_intr_fd_get (intr_handle),0 , &alarm_time,NULL ); }rte_spinlock_unlock (&alarm_list_lk);
Signature · 1 line
2.23.0
PATCH v8 5/9 lib: remove direct access to interrupt handle
In reply to David MarchandFrom: Harman Kalra <[email protected]>
Removing direct access to interrupt handle structure fields, rather use respective get set APIs for the same.
Making changes to all the libraries access the interrupt handle fields.
---
Changes since v5:
- split from patch4,
--- lib/bbdev/rte_bbdev.c | 4 +-- lib/eal/linux/eal_dev.c | 57 ++++++++++++++++++++++++----------------- lib/ethdev/rte_ethdev.c | 14 +++++----- 3 files changed, 43 insertions(+), 32 deletions(-)
lib/bbdev/rte_bbdev.c +2 -2
@@ -1094,7 +1094,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,VALID_QUEUE_OR_RET_ERR (queue_id, dev); intr_handle = dev->intr_handle; -if (!intr_handle || !intr_handle->intr_vec) { +if (intr_handle ==NULL ) {rte_bbdev_log (ERR ,"Device %u intr handle unset\n" , dev_id);return -ENOTSUP ; }
@@ -1105,7 +1105,7 @@ rte_bbdev_queue_intr_ctl(uint16_t dev_id, uint16_t queue_id, int epfd, int op,return -ENOTSUP ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); ret =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (ret && (ret != -EEXIST )) { rte_bbdev_log(ERR,
lib/eal/linux/eal_dev.c +34 -23
127 lines not on this page · raw message
lib/ethdev/rte_ethdev.c +7 -7
@@ -4819,13 +4819,13 @@ rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; }for (qid =0 ; qid < dev->data->nb_rx_queues; qid++) { - vec = intr_handle->intr_vec[qid]; + vec =rte_intr_vec_list_index_get (intr_handle, qid); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
@@ -4860,15 +4860,15 @@ rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id) } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -1 ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); efd_idx = (vec >=RTE_INTR_VEC_RXTX_OFFSET ) ? (vec -RTE_INTR_VEC_RXTX_OFFSET ) : vec; - fd = intr_handle->efds[efd_idx]; + fd =rte_intr_efds_index_get (intr_handle, efd_idx);return fd; }
@@ -5046,12 +5046,12 @@ rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, } intr_handle = dev->intr_handle; -if (!intr_handle->intr_vec) { +if (rte_intr_vec_list_index_get (intr_handle,0 ) <0 ) {RTE_ETHDEV_LOG (ERR ,"Rx Intr vector unset\n" );return -EPERM ; } - vec = intr_handle->intr_vec[queue_id]; + vec =rte_intr_vec_list_index_get (intr_handle, queue_id); rc =rte_intr_rx_ctl (intr_handle, epfd, op, vec, data);if (rc && rc != -EEXIST ) { RTE_ETHDEV_LOG(ERR,
Signature · 1 line
2.23.0