make rte_intr_handle internal
Subsystems (6)
PATCH v2 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 | 9 ++ 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 | 15 ++- 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 | 5 + 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 | 106 +++++++++------- 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 | 21 +++- 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 | 54 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 24 ++-- 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 | 34 +++-- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 75 ++++++----- 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 | 45 ++++++- lib/eal/include/rte_eal_trace.h | 24 +--- lib/eal/linux/eal_alarm.c | 29 +++-- lib/eal/linux/eal_dev.c | 63 ++++++---- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +-- 117 files changed, 1808 insertions(+), 1213 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 ) {
@@ -1096,8 +1098,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 ;
@@ -1109,8 +1112,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 ;
@@ -4178,7 +4182,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
@@ -743,16 +743,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);
@@ -1879,7 +1878,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
@@ -1014,16 +1014,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);
@@ -2369,7 +2368,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 +9 -0
@@ -39,6 +39,13 @@ 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_ALLOC_TRAD_HEAP ); +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 +74,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_ALLOC_TRAD_HEAP ); +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_ALLOC_TRAD_HEAP ); +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 +14 -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,14 @@ 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_ALLOC_TRAD_HEAP ); +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 +230,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_ALLOC_DPDK_ALLOCATOR ); +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_ALLOC_TRAD_HEAP ); +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_ALLOC_TRAD_HEAP ); +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_ALLOC_TRAD_HEAP ); +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 +5 -0
@@ -297,6 +297,11 @@ 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_ALLOC_TRAD_HEAP ); +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
@@ -29,9 +29,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)); } }
@@ -40,7 +42,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",
@@ -60,15 +63,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 ); } }
@@ -77,16 +81,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
@@ -149,9 +149,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 )
@@ -223,12 +229,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
@@ -62,7 +62,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 */
@@ -82,7 +82,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 */
@@ -126,7 +126,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 ;
@@ -149,7 +149,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);
@@ -1176,7 +1176,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 -43
219 lines not on this page · raw message
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
@@ -491,7 +491,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" );
@@ -521,7 +521,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 (roc_sso,SSO_LF_TYPE_HWS , roc_sso->nb_hws);sso_lf_free (roc_sso,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
@@ -360,7 +360,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 ;
@@ -479,7 +479,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;
@@ -525,10 +525,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 ;
@@ -608,7 +607,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 ;
@@ -638,10 +637,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 ; }
@@ -692,7 +688,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);
@@ -404,7 +404,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 ;
@@ -2323,7 +2323,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",
@@ -2347,8 +2347,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)
@@ -234,10 +234,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" ); }
@@ -262,8 +262,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
@@ -735,7 +735,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 ;
@@ -847,26 +847,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++; } }
@@ -1479,7 +1477,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;
@@ -1521,10 +1519,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
@@ -1157,7 +1157,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 ();
@@ -1228,8 +1228,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,
@@ -1268,8 +1268,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 =
@@ -525,7 +525,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;
@@ -575,12 +575,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 ; }
@@ -718,7 +716,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 ;
@@ -752,10 +750,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 ; }
@@ -767,7 +762,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 )
@@ -1008,7 +1003,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
@@ -473,7 +473,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 ;
@@ -947,7 +947,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 */
@@ -969,10 +969,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);
@@ -988,7 +987,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 ,
@@ -1008,7 +1007,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; }
@@ -1665,7 +1667,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;
@@ -2817,7 +2819,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;
@@ -2844,9 +2846,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);
@@ -2865,7 +2867,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 ;
@@ -2873,8 +2877,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 ]);
@@ -1112,8 +1112,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_ALLOC_DPDK_ALLOCATOR ); +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 +15 -6
@@ -398,15 +398,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_ALLOC_TRAD_HEAP ); +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) {
@@ -440,12 +447,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),
@@ -458,10 +465,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, } }fs_unlock (dev,0 ); +rte_intr_instance_free (intr_handle);return 0 ; free_rxq:fs_rx_queue_release (rxq);fs_unlock (dev,0 ); +rte_intr_instance_free (intr_handle);return ret; }
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)/* default 1:1 map from queue ID to interrupt vector ID */ -#define Q2V (pci_dev, queue_id) ((pci_dev)->intr_handle.intr_vec[queue_id]) +#define Q2V (pci_dev, queue_id) \ + (rte_intr_vec_list_index_get((pci_dev)->intr_handle, queue_id))/* First 64 Logical ports for PF/VMDQ, second 64 for Flow director */ #define MAX_LPORT_NUM 128
@@ -690,7 +691,7 @@ fm10k_dev_rx_init(struct rte_eth_dev *dev)struct fm10k_hw *hw =FM10K_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct fm10k_macvlan_filter_info *macvlan;struct rte_pci_device *pdev =RTE_ETH_DEV_TO_PCI (dev); -struct rte_intr_handle *intr_handle = &pdev->intr_handle;
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 +36 -18
54 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 +45 -30
75 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 +39 -6
45 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 v2 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 | 189 ++++++++++++++++++++++++- lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 ---------- lib/eal/include/rte_interrupts.h | 24 +++- 5 files changed, 212 insertions(+), 81 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 +184 -5
276 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 -3
@@ -33,9 +33,27 @@ struct rte_intr_handle;/** Allocate interrupt instance using DPDK memory management APIs */ #define RTE_INTR_ALLOC_DPDK_ALLOCATOR 0x00000001 -#define RTE_INTR_HANDLE_DEFAULT_SIZE 1 - -#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
PATCH v2 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 | 10 +++++++++- 5 files changed, 29 insertions(+), 1 deletion(-)
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
@@ -973,6 +973,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 +9 -1
@@ -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 ) {
@@ -68,7 +75,8 @@ rte_eal_alarm_init(void) goto error; } -rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM ); +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error;/* create a timerfd file descriptor */ if (rte_intr_fd_set(intr_handle,
Signature · 1 line
2.18.0
Quoted 19 lines · On Thu, 26 Aug 2021 20:27:19 +0530 Harman Kalra <[email protected]> wrote:
Moving 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://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=
Quoted 6 lines
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.
I agree rte_intr_handle and eth_devices structure needs to be hidden. But there does not appear to be an API to check if device supports receive interrupt mode.
There is:
RTE_ETH_DEV_INTR_LSC - link state
RTE_ETH_DEV_INTR_RMV - interrupt on removal
but no
RTE_ETH_DEV_INTR_RXQ - device supports rxq interrupt
There should be a new flag reported by devices, and the intr_conf should be checked in rte_eth_dev_configure
Doing this would require fixes many drivers and there is risk of exposing existing sematic bugs in applications.
code
Hi Stephen
Thanks for your suggestion on RTE_ETH_DEV_INTR_RXQ . Please see my comments inline.
Quoted 28 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, October 5, 2021 9:38 PM
To: Harman Kalra <[email protected]>
Cc: [email protected]
Subject: [EXT] Re: [dpdk-dev] [RFC 0/7] makerte_intr_handleinternalExternal Email
----------------------------------------------------------------------
Quoted 6 lines · On Thu, 26 Aug 2021 20:27:19 +0530 Harman Kalra <[email protected]> wrote:
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.I agree
rte_intr_handleandeth_devicesstructure needs to be hidden. But there does not appear to be an API to check if device supports receive interrupt mode.There is:
RTE_ETH_DEV_INTR_LSC- link state
RTE_ETH_DEV_INTR_RMV- interrupt on removal
Quoted 10 lines
but no
RTE_ETH_DEV_INTR_RXQ- device supports rxq interruptThere should be a new flag reported by devices, and the
intr_confshould be checked inrte_eth_dev_configureDoing this would require fixes many drivers and there is risk of exposing existing sematic bugs in applications.
Yes, currently "intr_conf.rxq" is checked by respective drivers which supports queue interrupts and enable them if set. But driver doesn't expose if they are capable of supporting rxq interrupts, just like LSC and RMV.
RTE_ETH_DEV_INTR_RXQ should be introduces and set by capable drivers in " dev_info.dev_flags" and applications
like l3fwd-power which sets " intr_conf.rxq" should check this flag.
I will add this enhancement to my TODO list and will send it as a new series.
Thanks
Harman
Quoted 2 lines
code
v3 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.
Details on each patch of the series:
Patch 1: malloc: introduce malloc is ready API
This patch introduces a new API which tells if DPDK memory subsystem is initialized and rte_malloc* APIs are ready to be used. If rte_malloc* are setup, memory for interrupt instance is allocated using rte_malloc else using traditional heap APIs.
Patch 2: 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 of rte_intr_handle is 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.h and APIs defined in rte_eal_interrupts.h which were driver specific are moved to rte_interrupts.h (as anyways it was accessible and used outside DPDK library. Later in the series rte_eal_interrupts.h is removed.
Patch 3: 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 4: test/interrupt: apply get set interrupt handle APIs Updating interrupt test suite to use interrupt handle APIs.
Patch 5: 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 6: eal/interrupts: make interrupt handle structure opaque In this patch rte_eal_interrupt.h is removed, struct rte_intr_handle definition 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 API rte_intr_handle_event_list_update(). Eg, on PCI device probing MSIX size can be queried and these arrays can be reallocated accordingly.
Patch 7: 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 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.
Harman Kalra (7):
malloc: introduce malloc is ready API 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 routine
MAINTAINERS | 1 + app/test/test_interrupts.c | 162 +++-- 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 | 9 + drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 26 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 15 +- drivers/bus/fslmc/fslmc_vfio.c | 32 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 19 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 14 +- 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 | 27 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 5 + 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 | 22 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 21 +- 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 | 59 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 18 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 51 +- drivers/net/mlx5/linux/mlx5_socket.c | 24 +- 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 | 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 | 35 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +- drivers/net/thunderx/nicvf_ethdev.c | 11 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 34 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 75 +- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 47 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 61 +- 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 | 9 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 586 ++++++++++++++++ lib/eal/common/eal_private.h | 11 + lib/eal/common/malloc_heap.c | 16 +- lib/eal/common/malloc_heap.h | 3 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 52 +- lib/eal/freebsd/eal_interrupts.c | 92 ++- 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 | 650 +++++++++++++++++- 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 | 287 +++++--- lib/eal/version.map | 47 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 134 files changed, 3568 insertions(+), 1709 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
Signature · 1 line
2.18.0
PATCH v3 1/7 malloc: introduce malloc is ready API
Implementing a new API get the state if DPDK memory management APIs are initialized.
One of the use case of this API is while allocating an interrupt instance, if malloc APIs are ready memory for interrupt handles should be allocated via rte_malloc_* APIs else glibc malloc APIs are used. Eg. Alarm subsystem is initialised before DPDK memory infra setup and it allocates an interrupt handle.
--- lib/eal/common/malloc_heap.c | 16 +++++++++++++++- lib/eal/common/malloc_heap.h | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-)
lib/eal/common/malloc_heap.c +15 -1
@@ -36,6 +36,8 @@#define CONST_MAX (a, b) (a > b ? a : b)/* RTE_MAX is not a constant */ #define EXTERNAL_HEAP_MIN_SOCKET_ID (CONST_MAX((1 << 8), RTE_MAX_NUMA_NODES)) +static bool malloc_ready; +static unsigned check_hugepage_sz (unsigned flags,uint64_t hugepage_sz) {
@@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void) {struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();
@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (!ret) + malloc_ready = true; + +return ret; +} + +bool +rte_malloc_is_ready (void ) +{ +return malloc_ready == true; }
lib/eal/common/malloc_heap.h +3 -0
@@ -96,4 +96,7 @@ malloc_socket_to_heap_id(unsigned int socket_id);int rte_eal_malloc_heap_init (void ); +bool +rte_malloc_is_ready (void ); +#endif /* MALLOC_HEAP_H_ */
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v3 1/7] malloc: introduce malloc is ready API
18/10/2021 21:37, Harman Kalra:
Quoted 9 lines
lib/eal/common/malloc_heap.c +1
-0@@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void) {struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();
lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1377
Quoted 7 lines
lib/eal/common/malloc_heap.c +3
-1@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (!ret)
Style: It should be "if (ret == 0)" because ret is not a bool.
Quoted 13 lines
lib/eal/common/malloc_heap.c +9
-0+ malloc_ready = true; + +return ret; +} + +bool +rte_malloc_is_ready (void ) +{ +return malloc_ready == true; }
lib/eal/common/malloc_heap.h malloc_socket_to_heap_id(unsigned int socket_id); · line 98
Quoted 3 lines
lib/eal/common/malloc_heap.h +0
-0@@ -96,4 +96,7 @@ malloc_socket_to_heap_id(unsigned int socket_id);int rte_eal_malloc_heap_init (void );
Please insert a comment here to document what we can expect.
Quoted 2 lines
lib/eal/common/malloc_heap.h +2
-0+bool +rte_malloc_is_ready (void );
PATCH v3 2/7 eal/interrupts: implement get set APIs
In reply to Harman KalraPrototype/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.
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 410 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 209 +-------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 622 ++++++++++++++++++++++++- lib/eal/version.map | 47 +- 8 files changed, 1195 insertions(+), 214 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.h
MAINTAINERS +1 -0
@@ -210,6 +210,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 +410 -0
410 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 +6 -203
229 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 +620 -2
648 lines not on this page · raw message
lib/eal/version.map +38 -9
66 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIs
2021-10-19 01:07 (UTC+0530), Harman Kalra:
[...]
lib/eal/common/eal_common_interrupts.c line 27
Quoted 4 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+struct rte_intr_handle *rte_intr_instance_alloc (void ) +{ +struct rte_intr_handle *intr_handle; +bool mem_allocator;
This name is not very descriptive; what would "mem_allocator is false" mean? How about "is_rte_memory"?
Quoted 31 lines
lib/eal/common/eal_common_interrupts.c new file +31
-0+ +/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle =rte_zmalloc (NULL ,sizeof (struct rte_intr_handle ), +0 ); +else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle )); +if (!intr_handle) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + rte_errno =ENOMEM ; +return NULL ; + } + + intr_handle->nb_intr =RTE_MAX_RXTX_INTR_VEC_ID ; + intr_handle->mem_allocator = mem_allocator; + +return intr_handle; +} + +int rte_intr_instance_copy (struct rte_intr_handle *intr_handle, +const struct rte_intr_handle *src) +{ +uint16_t nb_intr; + +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (src ==NULL ) { +RTE_LOG (ERR ,EAL ,"Source interrupt instance unallocated\n" ); + rte_errno =EINVAL ; + goto fail;
lib/eal/common/eal_common_interrupts.c line 68
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+ } + + intr_handle->fd = src->fd; + intr_handle->vfio_dev_fd = src->vfio_dev_fd; + intr_handle->type = src->type; + intr_handle->max_intr = src->max_intr; + intr_handle->nb_efd = src->nb_efd; + intr_handle->efd_counter_size = src->efd_counter_size; + + nb_intr =RTE_MIN (src->nb_intr, intr_handle->nb_intr);
Truncating copy is error-prone.
It should be either a reallocation (in the future) or an error (now).
lib/eal/common/eal_common_interrupts.c line 79
Quoted 11 lines
lib/eal/common/eal_common_interrupts.c new file +11
-0+memcpy (intr_handle->efds, src->efds, nb_intr); +memcpy (intr_handle->elist, src->elist, nb_intr); + +return 0 ; +fail: +return -rte_errno; +} + +void rte_intr_instance_free (struct rte_intr_handle *intr_handle) +{ +if (intr_handle->mem_allocator)
This function should accept NULL and be a no-op in such case.
Quoted 4 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+rte_free (intr_handle); + else +free (intr_handle ); +}
[...]
Quoted 9 lines
lib/eal/common/eal_common_interrupts.c new file +9
-0+void *rte_intr_instance_windows_handle_get (struct rte_intr_handle *intr_handle) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +return intr_handle->windows_handle; +fail: +return NULL ; +} +
lib/eal/common/eal_common_interrupts.c line 403
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+int rte_intr_instance_windows_handle_set (struct rte_intr_handle *intr_handle, +void *windows_handle) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (!windows_handle) { +RTE_LOG (ERR ,EAL ,"Windows handle should not be NULL\n" ); + rte_errno =EINVAL ; + goto fail; + }
Thanks for adding this API, but please remove the check. It is possible that the API user will pass NULL to reset the state (also NULL is not the only invalid value for a Windows handle). There is no check for Unix FD, neither should be here.
Quoted 7 lines
lib/eal/common/eal_common_interrupts.c new file +7
-0+ + intr_handle->windows_handle = windows_handle; + +return 0 ; +fail: +return -rte_errno; +}
[...]
lib/eal/include/rte_eal_interrupts.h struct rte_intr_handle { · line 56
Quoted 6 lines
lib/eal/include/rte_eal_interrupts.h +1
-1@@ -79,191 +53,20 @@ struct rte_intr_handle { };int fd;/**< interrupt event file descriptor */ }; -void *handle;/**< device driver handle (Windows) */ +void *windows_handle;/**< device driver handle (Windows) */
I guess Windows can be dropped from the comment since it's now in the name.
Quoted 16 lines
lib/eal/include/rte_eal_interrupts.h +5
-1}; +bool mem_allocator;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 */ +/**< intr vector epoll event */ +uint16_t vec_list_size;int *intr_vec;/**< intr vector number array */ };
[...]
Quoted 4 lines
lib/eal/include/rte_interrupts.h +0
-0
[...]
Quoted 5 lines
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * It allocates memory for interrupt instance. API takes flag as an argument
Not anymore. Please update the description.
Quoted 15 lines
+ * which define from where memory should be allocated i.e. using DPDK memory
+ * management library APIs or normal heap allocation.
+ * Default memory allocation for event fds and event list array is done which
+ * can be realloced later as per the requirement.
+ *
+ * This function should be called from application or driver, before calling any
+ * of the interrupt APIs.
+ *
+ * @param flags
+ * Memory allocation from DPDK allocator or normal allocation
+ *
+ * @return
+ * - On success, address of first interrupt handle.
+ * - On failure, NULL.
+ */
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 212
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+__rte_experimental +struct rte_intr_handle * +rte_intr_instance_alloc (void ); + +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* This API is used to free the memory allocated for event fds. event lists +* and interrupt handle array.
It's simpler and more future-proof to just say "interrupt handle resources" instead of enumerating them.
Quoted 3 lines
+ *
+ * @paramintr_handle
+ * Base address of interrupt handle array.
It's not an array anymore.
[...]
Quoted 3 lines
+/**
+ * @internal
+ * This API is used to set the event list array index with the given elist
"Event list array" sound like an array of lists,
while it is really an array of scalar elements.
"Event data array"? TBH, I don't know how it's usually named in Unices.
Quoted 29 lines
+ * instance.
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ * @param index
+ * elist array index to be set
+ * @param elist
+ * event list instance of structrte_epoll_event
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +16
-0+__rte_internal +int +rte_intr_elist_index_set (struct rte_intr_handle *intr_handle,int index, +struct rte_epoll_event elist); + +/** +* @internal +* Returns the address of elist instance of event list array at a given index. +* +* @param intr_handle +* pointer to the interrupt handle. +* @param index +* elist array index to be returned +* +* @return +* - On success, elist
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 657
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+* - On failure, a negative value. +*/ +__rte_internal +struct rte_epoll_event * +rte_intr_elist_index_get (struct rte_intr_handle *intr_handle,int index); + +/** +* @internal +* Allocates the memory of interrupt vector list array, with size defining the +* no of elements required in the array.
Typo: "no" -> "number".
[...]
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 753
Quoted 4 lines
lib/eal/include/rte_interrupts.h +4
-0+ +/** +* @internal +* This API returns the windows handle of the given interrupt instance.
Typo: "windows" -> "Windows" here and below.
Quoted 58 lines
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ *
+ * @return
+ * - On success, windows handle.
+ * - On failure, NULL.
+ */lib/eal/include/rte_interrupts.h +22
-0+__rte_internal +void * +rte_intr_instance_windows_handle_get (struct rte_intr_handle *intr_handle); + +/** +* @internal +* This API set the windows handle for the given interrupt instance. +* +* @param intr_handle +* pointer to the interrupt handle. +* @param windows_handle +* windows handle to be set. +* +* @return +* - On success, zero +* - On failure, a negative value. +*/ +__rte_internal +int +rte_intr_instance_windows_handle_set (struct rte_intr_handle *intr_handle, +void *windows_handle); + #ifdef __cplusplus }#endif lib/eal/version.map +1
-9@@ -109,18 +109,10 @@ DPDK_22 { rte_hexdump; rte_hypervisor_get; rte_hypervisor_get_name; # WINDOWS_NO_EXPORT - rte_intr_allow_others; rte_intr_callback_register; rte_intr_callback_unregister; - rte_intr_cap_multiple; - rte_intr_disable; - rte_intr_dp_is_en; - rte_intr_efd_disable; - rte_intr_efd_enable; rte_intr_enable; - rte_intr_free_epoll_fd; - rte_intr_rx_ctl; - rte_intr_tls_epfd; + rte_intr_disable; rte_keepalive_create; # WINDOWS_NO_EXPORT rte_keepalive_dispatch_pings; # WINDOWS_NO_EXPORT rte_keepalive_mark_alive; # WINDOWS_NO_EXPORT
lib/eal/version.map EXPERIMENTAL { · line 418
Quoted 7 lines
lib/eal/version.map +4
-0@@ -420,6 +412,14 @@ EXPERIMENTAL { # added in 21.08 rte_power_monitor_multi; # WINDOWS_NO_EXPORT + + # added in 21.11 + rte_intr_fd_set; # WINDOWS_NO_EXPORT + rte_intr_fd_get; # WINDOWS_NO_EXPORT
OK, these are not feasible on Windows.
lib/eal/version.map EXPERIMENTAL { · line 422
Quoted 4 lines
lib/eal/version.map +4
-0+ rte_intr_type_set; # WINDOWS_NO_EXPORT + rte_intr_type_get; # WINDOWS_NO_EXPORT + rte_intr_instance_alloc; # WINDOWS_NO_EXPORT + rte_intr_instance_free; # WINDOWS_NO_EXPORT
No, these *are* needed on Windows.
Quoted 7 lines
lib/eal/version.map +0
-0}; INTERNAL {@@ -430,4 +430,33 @@ INTERNAL { rte_mem_map; rte_mem_page_size; rte_mem_unmap;
lib/eal/version.map INTERNAL { · line 442
Quoted 10 lines
lib/eal/version.map +10
-0+ rte_intr_cap_multiple; + rte_intr_dp_is_en; + rte_intr_efd_disable; + rte_intr_efd_enable; + rte_intr_free_epoll_fd; + rte_intr_rx_ctl; + rte_intr_allow_others; + rte_intr_tls_epfd; + rte_intr_dev_fd_set; # WINDOWS_NO_EXPORT + rte_intr_dev_fd_get; # WINDOWS_NO_EXPORT
OK.
lib/eal/version.map INTERNAL { · line 446
Quoted 4 lines
lib/eal/version.map +4
-0+ rte_intr_instance_copy; # WINDOWS_NO_EXPORT + rte_intr_event_list_update; # WINDOWS_NO_EXPORT + rte_intr_max_intr_set; # WINDOWS_NO_EXPORT + rte_intr_max_intr_get; # WINDOWS_NO_EXPORT
These are needed on Windows.
lib/eal/version.map INTERNAL { · line 451
Quoted 5 lines
lib/eal/version.map +5
-0+ rte_intr_nb_efd_set; # WINDOWS_NO_EXPORT + rte_intr_nb_efd_get; # WINDOWS_NO_EXPORT + rte_intr_nb_intr_get; # WINDOWS_NO_EXPORT + rte_intr_efds_index_set; # WINDOWS_NO_EXPORT + rte_intr_efds_index_get; # WINDOWS_NO_EXPORT
OK.
lib/eal/version.map INTERNAL { · line 453
Quoted 2 lines
lib/eal/version.map +2
-0+ rte_intr_elist_index_set; # WINDOWS_NO_EXPORT + rte_intr_elist_index_get; # WINDOWS_NO_EXPORT
These are needed on Windows.
lib/eal/version.map INTERNAL { · line 455
Quoted 2 lines
lib/eal/version.map +2
-0+ rte_intr_efd_counter_size_set; # WINDOWS_NO_EXPORT + rte_intr_efd_counter_size_get; # WINDOWS_NO_EXPORT
OK.
lib/eal/version.map INTERNAL { · line 459
Quoted 4 lines
lib/eal/version.map +4
-0+ rte_intr_vec_list_alloc; # WINDOWS_NO_EXPORT + rte_intr_vec_list_index_set; # WINDOWS_NO_EXPORT + rte_intr_vec_list_index_get; # WINDOWS_NO_EXPORT + rte_intr_vec_list_free; # WINDOWS_NO_EXPORT
These are needed on Windows.
Quoted 3 lines
lib/eal/version.map +2
-0+ rte_intr_instance_windows_handle_get; + rte_intr_instance_windows_handle_set; };
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Hi Dmitry,
Thanks for reviewing. Please find my responses inline.
Quoted 13 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Tuesday, October 19, 2021 3:38 AM
To: Harman Kalra <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; [email protected]
Subject: [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIsExternal Email
----------------------------------------------------------------------
2021-10-19 01:07 (UTC+0530), Harman Kalra:
[...]
Quoted 7 lines
lib/eal/common/eal_common_interrupts.c line 27
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+struct rte_intr_handle *rte_intr_instance_alloc (void ) { +struct rte_intr_handle *intr_handle; +bool mem_allocator;This name is not very descriptive; what would "
mem_allocatoris false" mean?
How about "is_rte_memory"?
Sure, will make it "is_rte_memory"
Quoted 31 lines
lib/eal/common/eal_common_interrupts.c
Quoted 6 lines
lib/eal/common/eal_common_interrupts.c new file +5
-0+ +/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),Quoted 13 lines
lib/eal/common/eal_common_interrupts.c new file +13
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle )); +if (!intr_handle) { +RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + rte_errno =ENOMEM ; +return NULL ; + } + + intr_handle->nb_intr =RTE_MAX_RXTX_INTR_VEC_ID ; + intr_handle->mem_allocator = mem_allocator; + +return intr_handle;lib/eal/common/eal_common_interrupts.c
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+} + +int rte_intr_instance_copy (struct rte_intr_handle *intr_handle, +const struct rte_intr_handle *src) { +uint16_t nb_intr; + +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (src ==NULL ) { + RTE_LOG(ERR, EAL, "Source interrupt instanceunallocated\n");
Quoted 15 lines
lib/eal/common/eal_common_interrupts.c line 68
Quoted 12 lines
lib/eal/common/eal_common_interrupts.c new file +12
-0+ rte_errno =EINVAL ; + goto fail; + } + + intr_handle->fd = src->fd; + intr_handle->vfio_dev_fd = src->vfio_dev_fd; + intr_handle->type = src->type; + intr_handle->max_intr = src->max_intr; + intr_handle->nb_efd = src->nb_efd; + intr_handle->efd_counter_size = src->efd_counter_size; + + nb_intr =RTE_MIN (src->nb_intr, intr_handle->nb_intr);Truncating copy is error-prone.
It should be either a reallocation (in the future) or an error (now).
Actually in patch 6, I have made lot of changes to this API wrt nb_intr, where efds/elist arrays are reallocated based on src->nb_intr and make intr_handle->nb_intr equal to src->nb_intr. I think those changes can be moved from patch 6 to patch 2.
Quoted 13 lines
lib/eal/common/eal_common_interrupts.c line 79
Quoted 11 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+memcpy (intr_handle->efds, src->efds, nb_intr); +memcpy (intr_handle->elist, src->elist, nb_intr); + +return 0 ; +fail: +return -rte_errno; +} + +void rte_intr_instance_free (struct rte_intr_handle *intr_handle) { +if (intr_handle->mem_allocator)This function should accept NULL and be a no-op in such case.
Ack.
Quoted 25 lines
Quoted 5 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+rte_free (intr_handle); + else +free (intr_handle ); +}[...]
lib/eal/common/eal_common_interrupts.c
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+void *rte_intr_instance_windows_handle_get (struct rte_intr_handle +*intr_handle) { +CHECK_VALID_INTR_HANDLE (intr_handle); + +return intr_handle->windows_handle; +fail: +return NULL ; +} + +int rte_intr_instance_windows_handle_set(struct rte_intr_handle
*intr_handle,lib/eal/common/eal_common_interrupts.c
Quoted 6 lines
lib/eal/common/eal_common_interrupts.c new file +6
-0+ void *windows_handle) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (!windows_handle) { + RTE_LOG(ERR, EAL, "Windows handle should not beNULL\n");
Quoted 8 lines
lib/eal/common/eal_common_interrupts.c line 59
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ rte_errno =EINVAL ; + goto fail; + }Thanks for adding this API, but please remove the check.
It is possible that the API user will pass NULL to reset the state (also NULL is not the only invalid value for a Windows handle).
There is no check for Unix FD, neither should be here.
Sure, will remove the check.
Quoted 18 lines
Quoted 8 lines
lib/eal/common/eal_common_interrupts.c new file +7
-0+ + intr_handle->windows_handle = windows_handle; + +return 0 ; +fail: +return -rte_errno; +}[...]
lib/eal/include/rte_eal_interrupts.h struct rte_intr_handle { · line 56
Quoted 6 lines
lib/eal/include/rte_eal_interrupts.h +1
-1@@ -79,191 +53,20 @@ struct rte_intr_handle { };int fd;/**< interrupt event file descriptor */ }; -void *handle;/**< device driver handle (Windows) */ +void *windows_handle;/**< device driver handle (Windows) */
Quoted 2 lines
I guess Windows can be dropped from the comment since it's now in the name.
Ack.
Quoted 28 lines
lib/eal/include/rte_eal_interrupts.h struct rte_intr_handle {
Quoted 7 lines
lib/eal/include/rte_eal_interrupts.h +1
-0}; +bool mem_allocator;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 */
Review struct rte_intr_handle { · line 64
Quoted 2 lines
(quoted diff) +2
-0+ uint16_t nb_intr; + /**< Max vector count, default
RTE_MAX_RXTX_INTR_VEC_ID*/Review struct rte_intr_handle { · line 65
Quoted 1 line
(quoted diff) +0
-0int efds[RTE_MAX_RXTX_INTR_VEC_ID]; /**< intr vectors/efdsmapping */
Quoted 7 lines
lib/eal/include/rte_eal_interrupts.h +2
-1struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID ]; -/**< intr vector epoll event */ +/**< intr vector epoll event */ +uint16_t vec_list_size;int *intr_vec;/**< intr vector number array */ };[...]
Quoted 5 lines
lib/eal/include/rte_interrupts.h +0
-0[...]
Quoted 8 lines
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle);
Quoted 6 lines
lib/eal/include/rte_interrupts.h +6
-0+/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* It allocates memory for interrupt instance. API takes flag as an +argument Not anymore. Please update the description.
Ack.
Quoted 25 lines
Quoted 25 lines
+ * which define from where memory should be allocated i.e. using DPDK
lib/eal/include/rte_interrupts.h +23
-0+memory +* management library APIs or normal heap allocation. +* Default memory allocation for event fds and event list array is +done which +* can be realloced later as per the requirement. +* +* This function should be called from application or driver, before +calling any +* of the interrupt APIs. +* +* @param flags +* Memory allocation from DPDK allocator or normal allocation +* +* @return +* - On success, address of first interrupt handle. +* - On failure, NULL. +*/ +__rte_experimental +struct rte_intr_handle * +rte_intr_instance_alloc (void ); + +/** +* @warning
Quoted 8 lines
Quoted 5 lines
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * This API is used to free the memory allocated for event fds. event +lists
+ * and interrupt handle array.It's simpler and more future-proof to just say "interrupt handle resources" instead of enumerating them.
Sure, will reword it.
Quoted 6 lines
Quoted 4 lines
+ *
+ * @paramintr_handle
+ * Base address of interrupt handle array.It's not an array anymore.
Ack.
Quoted 46 lines
[...]
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle);
Quoted 4 lines
lib/eal/include/rte_interrupts.h +4
-0+/** +* @internal +* This API is used to set the event list array index with the given +elist "Event list array" sound like an array of lists, while it is really an array of scalar elements.
"Event data array"? TBH, I don't know how it's usually named in Unices.Quoted 35 lines
+ * instance.
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ * @param index
+ * elist array index to be set
+ * @param elist
+ * event list instance of structrte_epoll_event
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +22
-0+__rte_internal +int +rte_intr_elist_index_set (struct rte_intr_handle *intr_handle,int index, +struct rte_epoll_event elist); + +/** +* @internal +* Returns the address of elist instance of event list array at a given index. +* +* @param intr_handle +* pointer to the interrupt handle. +* @param index +* elist array index to be returned +* +* @return +* - On success, elist +* - On failure, a negative value. +*/ +__rte_internal +struct rte_epoll_event * +rte_intr_elist_index_get (struct rte_intr_handle *intr_handle,int +index);
Quoted 8 lines
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 657
Quoted 6 lines
lib/eal/include/rte_interrupts.h +6
-0+ +/** +* @internal +* Allocates the memory of interrupt vector list array, with size +defining the +* no of elements required in the array. Typo: "no" -> "number".
Ack.
Quoted 71 lines
[...]
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 753
Quoted 4 lines
lib/eal/include/rte_interrupts.h +4
-0+ +/** +* @internal +* This API returns the windows handle of the given interrupt instance. Typo: "windows" -> "Windows" here and below.
Quoted 19 lines
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ *
+ * @return
+ * - On success, windows handle.
+ * - On failure, NULL.
+ */lib/eal/include/rte_interrupts.h +11
-0+__rte_internal +void * +rte_intr_instance_windows_handle_get (struct rte_intr_handle +*intr_handle); + +/** +* @internal +* This API set the windows handle for the given interrupt instance. +* +* @param intr_handle +* pointer to the interrupt handle. lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle);
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+* @param windows_handle +* windows handle to be set. +* +* @return +* - On success, zero +* - On failure, a negative value. +*/ +__rte_internal +int +rte_intr_instance_windows_handle_set(struct rte_intr_handle
*intr_handle,Quoted 19 lines
lib/eal/include/rte_interrupts.h +2
-0+ void *windows_handle); + #ifdef __cplusplus }#endif lib/eal/version.map index renamed from lib/eal/version.map +0
-0
38f7de83e1..0ef77c3b40100644lib/eal/version.map +0
-4@@ -109,18 +109,10 @@ DPDK_22 { rte_hexdump; rte_hypervisor_get; rte_hypervisor_get_name; # WINDOWS_NO_EXPORT - rte_intr_allow_others; rte_intr_callback_register; rte_intr_callback_unregister; - rte_intr_cap_multiple; - rte_intr_disable; - rte_intr_dp_is_en;lib/eal/version.map DPDK_22 { · line 118
Quoted 10 lines
lib/eal/version.map +1
-5- rte_intr_efd_disable; - rte_intr_efd_enable; rte_intr_enable; - rte_intr_free_epoll_fd; - rte_intr_rx_ctl; - rte_intr_tls_epfd; + rte_intr_disable; rte_keepalive_create; # WINDOWS_NO_EXPORT rte_keepalive_dispatch_pings; # WINDOWS_NO_EXPORT rte_keepalive_mark_alive; # WINDOWS_NO_EXPORT @@ -420,6+412,14 @@
Quoted 2 lines
EXPERIMENTAL {
Quoted 8 lines
lib/eal/version.map EXPERIMENTAL { · line 418
Quoted 6 lines
lib/eal/version.map +4
-0# added in 21.08 rte_power_monitor_multi; # WINDOWS_NO_EXPORT + + # added in 21.11 + rte_intr_fd_set; # WINDOWS_NO_EXPORT + rte_intr_fd_get; # WINDOWS_NO_EXPORTOK, these are not feasible on Windows.
Ack.
Quoted 7 lines
lib/eal/version.map EXPERIMENTAL { · line 422
Quoted 5 lines
lib/eal/version.map +4
-0+ rte_intr_type_set; # WINDOWS_NO_EXPORT + rte_intr_type_get; # WINDOWS_NO_EXPORT + rte_intr_instance_alloc; # WINDOWS_NO_EXPORT + rte_intr_instance_free; # WINDOWS_NO_EXPORTNo, these *are* needed on Windows.
Ack.
Quoted 21 lines
Quoted 8 lines
};
INTERNAL {
lib/eal/version.map +0
-0@@ -430,4 +430,33 @@ INTERNAL { rte_mem_map; rte_mem_page_size; rte_mem_unmap;lib/eal/version.map INTERNAL { · line 442
Quoted 10 lines
lib/eal/version.map +10
-0+ rte_intr_cap_multiple; + rte_intr_dp_is_en; + rte_intr_efd_disable; + rte_intr_efd_enable; + rte_intr_free_epoll_fd; + rte_intr_rx_ctl; + rte_intr_allow_others; + rte_intr_tls_epfd; + rte_intr_dev_fd_set; # WINDOWS_NO_EXPORT + rte_intr_dev_fd_get; # WINDOWS_NO_EXPORTOK.
Quoted 6 lines
lib/eal/version.map INTERNAL { · line 446
Quoted 4 lines
lib/eal/version.map +4
-0+ rte_intr_instance_copy; # WINDOWS_NO_EXPORT + rte_intr_event_list_update; # WINDOWS_NO_EXPORT + rte_intr_max_intr_set; # WINDOWS_NO_EXPORT + rte_intr_max_intr_get; # WINDOWS_NO_EXPORTThese are needed on Windows.
Ack.
Quoted 9 lines
lib/eal/version.map INTERNAL { · line 451
Quoted 6 lines
lib/eal/version.map +5
-0+ rte_intr_nb_efd_set; # WINDOWS_NO_EXPORT + rte_intr_nb_efd_get; # WINDOWS_NO_EXPORT + rte_intr_nb_intr_get; # WINDOWS_NO_EXPORT + rte_intr_efds_index_set; # WINDOWS_NO_EXPORT + rte_intr_efds_index_get; # WINDOWS_NO_EXPORTOK.
Quoted 4 lines
lib/eal/version.map INTERNAL { · line 453
Quoted 2 lines
lib/eal/version.map +2
-0+ rte_intr_elist_index_set; # WINDOWS_NO_EXPORT + rte_intr_elist_index_get; # WINDOWS_NO_EXPORTThese are needed on Windows.
Ack.
Quoted 6 lines
lib/eal/version.map INTERNAL { · line 455
Quoted 3 lines
lib/eal/version.map +2
-0+ rte_intr_efd_counter_size_set; # WINDOWS_NO_EXPORT + rte_intr_efd_counter_size_get; # WINDOWS_NO_EXPORTOK.
Quoted 6 lines
lib/eal/version.map INTERNAL { · line 459
Quoted 4 lines
lib/eal/version.map +4
-0+ rte_intr_vec_list_alloc; # WINDOWS_NO_EXPORT + rte_intr_vec_list_index_set; # WINDOWS_NO_EXPORT + rte_intr_vec_list_index_get; # WINDOWS_NO_EXPORT + rte_intr_vec_list_free; # WINDOWS_NO_EXPORTThese are needed on Windows.
Ack.
Quoted 4 lines
Quoted 4 lines
lib/eal/version.map +2
-0+ rte_intr_instance_windows_handle_get; + rte_intr_instance_windows_handle_set; };
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Quoted 11 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Harman Kalra
Sent: Tuesday, October 19, 2021 2:21 PM
To: Dmitry Kozlyuk <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
[...]
Quoted 10 lines
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + nb_intr = RTE_MIN(src->nb_intr, intr_handle->nb_intr);Truncating copy is error-prone.
It should be either a reallocation (in the future) or an error (now).Actually in patch 6, I have made lot of changes to this API wrt
nb_intr, where efds/elist arrays are reallocated based onsrc->nb_intrand makeintr_handle->nb_intrequal tosrc->nb_intr. I think those changes can be moved from patch 6 to patch 2.
Hi Dmitry,
I have addressed all your comments in V4, kindly review.
Regarding this particular comment, I have not made any changes as I already explained in my previous reply that patch 6 takes care of realloc based on nb_intr, I thought those changes can be moved from patch 6 to 2, but it's not possible because till patch 5, arrays efds, elist are kept as static arrays to avoid build breakage. While in patch 6 I made these arrays as pointers and dynamically allocated memory for them.
Thanks
Harman
[...]
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +1
-0+memcpy (intr_handle->efds, src->efds, nb_intr);
Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIs
In reply to Harman Kalralib/eal/common/eal_common_interrupts.c line 35
Quoted 7 lines · On Tue, 19 Oct 2021 01:07:02 +0530 Harman Kalra <[email protected]> wrote:
lib/eal/common/eal_common_interrupts.c new file +7
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle =rte_zmalloc (NULL ,sizeof (struct rte_intr_handle ), +0 ); +else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));
This is problematic way to do this.
The reason to use rte_malloc vs malloc should be determined by usage.
If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie rte_malloc). If it is not shared then then use regular malloc.
But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Either:
intr_handle is not allowed to be used in secondary.
Then always use malloc().
Or.
intr_handle can be used by both primary and secondary. Then always use rte_malloc().
Any code path that allocates intr_handle before pool is ready is broken.
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Quoted 36 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, October 19, 2021 4:27 AM
To: Harman Kalra <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIsExternal Email
----------------------------------------------------------------------
lib/eal/common/eal_common_interrupts.c
Quoted 4 lines · On Tue, 19 Oct 2021 01:07:02 +0530 Harman Kalra <[email protected]> wrote:
lib/eal/common/eal_common_interrupts.c new file +4
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));This is problematic way to do this.
The reason to userte_mallocvs malloc should be determined by usage.If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie
rte_malloc). If it is not shared then then use regular malloc.But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Quoted 8 lines
Either:
intr_handleis not allowed to be used in secondary.
Then always usemalloc().
Or.
intr_handlecan be used by both primary and secondary. Then always userte_malloc().
Any code path that allocatesintr_handlebefore pool is ready is broken.
Hi Stephan,
Till V2, I implemented this API in a way where user of the API can choose If he wants intr handle to be allocated using malloc or rte_malloc by passing a flag arg to the rte_intr_instanc_alloc API. User of the API will best know if the intr handle is to be shared with secondary or not.
But after some discussions and suggestions from the community we decided to drop that flag argument and auto detect on whether rte_malloc APIs are ready to be used and thereafter make all further allocations via rte_malloc. Currently alarm subsystem (or any driver doing allocation in constructor) gets interrupt instance allocated using glibc malloc that too because rte_malloc* is not ready by rte_eal_alarm_init(), while all further consumers gets instance allocated via rte_malloc.
I think this should not cause any issue in primary/secondary model as all interrupt
instance pointer will be shared. Infact to avoid any surprises of primary/secondary not working we thought of making all allocations via rte_malloc.
David, Thomas, Dmitry, please add if I missed anything.
Can we please conclude on this series APIs as API freeze deadline (rc1) is very near.
Thanks
Harman
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
19/10/2021 10:32, Harman Kalra:
Quoted 31 lines
From: Stephen Hemminger <[email protected]>
Quoted 21 lines
lib/eal/common/eal_common_interrupts.c
Quoted 4 lines · On Tue, 19 Oct 2021 01:07:02 +0530 Harman Kalra <[email protected]> wrote:
lib/eal/common/eal_common_interrupts.c new file +4
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));This is problematic way to do this.
The reason to userte_mallocvs malloc should be determined by usage.If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie
rte_malloc). If it is not shared then then use regular malloc.But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Quoted 8 lines
Either:
intr_handleis not allowed to be used in secondary.
Then always usemalloc().
Or.
intr_handlecan be used by both primary and secondary. Then always userte_malloc().
Any code path that allocatesintr_handlebefore pool is ready is broken.
Quoted 6 lines
Hi Stephan,
Till V2, I implemented this API in a way where user of the API can choose If he wants intr handle to be allocated using malloc or
rte_mallocby passing a flag arg to therte_intr_instanc_allocAPI. User of the API will best know if the intr handle is to be shared with secondary or not.
Yes the caller should know, but it makes usage more difficult. Using rte_malloc always is simpler.
Quoted 7 lines
But after some discussions and suggestions from the community we decided to drop that flag argument and auto detect on whether
rte_mallocAPIs are ready to be used and thereafter make all further allocations viarte_malloc. Currently alarm subsystem (or any driver doing allocation in constructor) gets interrupt instance allocated using glibc malloc that too because rte_malloc* is not ready byrte_eal_alarm_init(), while all further consumers gets instance allocated viarte_malloc.
Yes the general case is to allocate after rte_malloc is ready. Anyway a constructor should not allocate complicate things.
Quoted 3 lines
I think this should not cause any issue in primary/secondary model as all interrupt
instance pointer will be shared. Infact to avoid any surprises of primary/secondary not working we thought of making all allocations viarte_malloc.
Yes
Quoted 1 line
David, Thomas, Dmitry, please add if I missed anything.
I understand Stephen's concern but I think this choice is a good compromise. Ideally we should avoid doing real stuff in constructors.
Quoted 1 line
Can we please conclude on this series APIs as API freeze deadline (rc1) is very near.
I vote for keeping this design.
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
In reply to Harman Kalra2021-10-19 08:32 (UTC+0000), Harman Kalra:
Quoted 51 lines
Quoted 35 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, October 19, 2021 4:27 AM
To: Harman Kalra <[email protected]>
Cc: [email protected]; Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; [email protected]; [email protected]
Subject: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIsExternal Email
----------------------------------------------------------------------
lib/eal/common/eal_common_interrupts.c
Quoted 4 lines · On Tue, 19 Oct 2021 01:07:02 +0530 Harman Kalra <[email protected]> wrote:
lib/eal/common/eal_common_interrupts.c new file +4
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));This is problematic way to do this.
The reason to userte_mallocvs malloc should be determined by usage.If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie
rte_malloc). If it is not shared then then use regular malloc.But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Quoted 8 lines
Either:
intr_handleis not allowed to be used in secondary.
Then always usemalloc().
Or.
intr_handlecan be used by both primary and secondary. Then always userte_malloc().
Any code path that allocatesintr_handlebefore pool is ready is broken.Hi Stephan,
Till V2, I implemented this API in a way where user of the API can choose If he wants intr handle to be allocated using malloc or
rte_mallocby passing a flag arg to therte_intr_instanc_allocAPI. User of the API will best know if the intr handle is to be shared with secondary or not.
Quoted 7 lines
But after some discussions and suggestions from the community we decided to drop that flag argument and auto detect on whether
rte_mallocAPIs are ready to be used and thereafter make all further allocations viarte_malloc. Currently alarm subsystem (or any driver doing allocation in constructor) gets interrupt instance allocated using glibc malloc that too because rte_malloc* is not ready byrte_eal_alarm_init(), while all further consumers gets instance allocated viarte_malloc.
Just as a comment, bus scanning is the real issue, not the alarms. Alarms could be initialized after the memory management
(but it's irrelevant because their handle is not accessed from the outside). However, MM needs to know bus IOVA requirements to initialize, which is usually determined by at least bus device requirements.
Quoted 2 lines
I think this should not cause any issue in primary/secondary model as all interrupt
instance pointer will be shared.
What do you mean? Aren't we discussing the issue
that those allocated early are not shared?
Quoted 2 lines
Infact to avoid any surprises of primary/secondary
not working we thought of making all allocations viarte_malloc.
I don't see why anyone would not make them shared.
In order to only use rte_malloc(), we need:
1. In bus drivers, move handle allocation from scan to probe stage.
2. In EAL, move alarm initialization to after the MM.
It all can be done later with v3 design---but there are out-of-tree drivers. We need to force them to make step 1 at some point.
I see two options:
a) Right now have an external API that only works with rte_malloc() and internal API with autodetection. Fix DPDK and drop internal API.
b) Have external API with autodetection. Fix DPDK.
At the next ABI breakage drop autodetection and libc-malloc.
Quoted 3 lines
David, Thomas, Dmitry, please add if I missed anything.
Can we please conclude on this series APIs as API freeze deadline (rc1) is very near.
I support v3 design with no options and autodetection, because that's the interface we want in the end. Implementation can be improved later.
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Quoted 85 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Wednesday, October 20, 2021 9:01 PM
To: Harman Kalra <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; [email protected]; Ray Kinsella <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIsQuoted 29 lines
Quoted 20 lines
lib/eal/common/eal_common_interrupts.c
Quoted 5 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));This is problematic way to do this.
The reason to userte_mallocvs malloc should be determined by usage.If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie
rte_malloc). If it is not shared then then use regular malloc.But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Quoted 8 lines
Either:
intr_handleis not allowed to be used in secondary.
Then always usemalloc().
Or.
intr_handlecan be used by both primary and secondary. Then always userte_malloc().
Any code path that allocatesintr_handlebefore pool is ready is broken.Quoted 6 lines
Hi Stephan,
Till V2, I implemented this API in a way where user of the API can choose If he wants intr handle to be allocated using malloc or
rte_mallocby passing a flag arg to therte_intr_instanc_allocAPI. User of the API will best know if the intr handle is to be shared withsecondary or not.
Quoted 4 lines
But after some discussions and suggestions from the community we decided to drop that flag argument and auto detect on whether
rte_mallocAPIs are ready to be used and thereafter make all furtherallocations via
rte_malloc.Quoted 4 lines
Currently alarm subsystem (or any driver doing allocation in constructor) gets interrupt instance allocated using glibc malloc that too because rte_malloc* is not ready by
rte_eal_alarm_init(), while all further consumers gets instance allocated viarte_malloc.Just as a comment, bus scanning is the real issue, not the alarms. Alarms could be initialized after the memory management (but it's irrelevant because their handle is not accessed from the outside).
However, MM needs to know bus IOVA requirements to initialize, which is usually determined by at least bus device requirements.Quoted 2 lines
I think this should not cause any issue in primary/secondary model as
all interrupt instance pointer will be shared.What do you mean? Aren't we discussing the issue that those allocated early are not shared?
Quoted 2 lines
Infact to avoid any surprises of primary/secondary not working we thought of making all allocations via
rte_malloc.I don't see why anyone would not make them shared.
In order to only userte_malloc(), we need:
1. In bus drivers, move handle allocation from scan to probe stage.
2. In EAL, move alarm initialization to after the MM.
It all can be done later with v3 design---but there are out-of-tree drivers. We need to force them to make step 1 at some point.
I see two options:
a) Right now have an external API that only works withrte_malloc()and internal API with autodetection. Fix DPDK and drop internal API.
b) Have external API with autodetection. Fix DPDK.
At the next ABI breakage drop autodetection and libc-malloc.
Quoted 8 lines
Quoted 3 lines
David, Thomas, Dmitry, please add if I missed anything.
Can we please conclude on this series APIs as API freeze deadline (rc1) is
very near.
I support v3 design with no options and autodetection, because that's the interface we want in the end.
Implementation can be improved later.
Hi All,
I came across 2 issues introduced with auto detection mechanism.
1. In case of primary secondary model. Primary application is started which makes lots of allocations via rte_malloc*
Secondary side:
a. Secondary starts, in its "rte_eal_init()" it makes some allocation via rte_*, and in one of the allocation
request for heap expand is made as current memseg got exhausted. (malloc_heap_alloc_on_heap_id ()->
alloc_more_mem_on_socket()->try_expand_heap())
b. A request to primary for heap expand is sent. Please note secondary holds the spinlock while making
the request. (malloc_heap_alloc_on_heap_id ()->rte_spinlock_lock(&(heap->lock));)
Primary side:
a. Primary receives the request, install a new hugepage and setups up the heap (handle_alloc_request()) b. To inform all the secondaries about the new memseg, primary sends a sync notice where it sets up an
alarm (rte_mp_request_async ()->mp_request_async()).
c. Inside alarm setup API, we register an interrupt callback.
d. Inside rte_intr_callback_register(), a new interrupt instance allocation is requested for "src->intr_handle" e. Since memory management is detected as up, inside "rte_intr_instance_alloc()", call to "rte_zmalloc" for
allocating memory and further inside "malloc_heap_alloc_on_heap_id()", primary will experience a deadlock while taking up the spinlock because this spinlock is already hold by secondary.
2. "eal_flags_file_prefix_autotest" is failing because the spawned process by this tests are expected to cleanup their hugepage traces from respective directories (eg /dev/hugepage).
a. Inside eal_cleanup, rte_free()->malloc_heap_free(), where element to be freed is added to the free list and checked if nearby elements can be joined together and form a big free chunk (malloc_elem_free()). b. If this free chunk is big enough than the hugepage size, respective hugepage can be uninstalled after making sure no allocation from this hugepage exists. (malloc_heap_free()->malloc_heap_free_pages()->eal_memalloc_free_seg())
But because of interrupt allocations made for pci intr handles (used for VFIO) and other driver specific interrupt handles are not cleaned up in "rte_eal_cleanup()", these hugepage files are not removed and test fails.
There could be more such issues, I think we should firstly fix the DPDK.
1. Memory management should be made independent and should be the first thing to come up in rte_eal_init()
2. rte_eal_cleanup() should be exactly opposite to rte_eal_init(), just like bus_probe, we should have bus_remove to clean up all the memory allocations.
Regarding this IRQ series, I would like to fall back to our original design i.e. rte_intr_instance_alloc() should take an argument whether its memory should be allocated using glibc malloc or rte_malloc*. Decision for allocation (malloc or rte_malloc) can be made on fact that in the existing code is the interrupt handle is shared? Eg. a. In case of alarm intr_handle was global entry and not confined to any structure, so this can be allocated from normal malloc.
b. PCI device, had static entry for intr_handle inside "struct rte_pci_device" and memory for struct rte_pci_device is via normal malloc, so it intr_handle can also be malloc'ed
c. Some driver with intr_handle inside its priv structure, and this priv structure gets allocated via rte_malloc, so Intr_handle can also be rte_malloc.
Later once DPDK is fixed up, this argument can be removed and all allocations can be via rte_malloc family without any auto detection.
David, Dmitry, Thomas, Stephan, please share your views....
Thanks
Harman
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
2021-10-21 09:16 (UTC+0000), Harman Kalra:
Quoted 123 lines
Quoted 83 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Wednesday, October 20, 2021 9:01 PM
To: Harman Kalra <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; [email protected]; Ray Kinsella <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIsQuoted 29 lines
Quoted 20 lines
lib/eal/common/eal_common_interrupts.c
Quoted 5 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+/* Detect if DPDK malloc APIs are ready to be used. */ + mem_allocator =rte_malloc_is_ready (); +if (mem_allocator) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));This is problematic way to do this.
The reason to userte_mallocvs malloc should be determined by usage.If the pointer will be shared between primary/secondary process then it has to be in hugepages (ie
rte_malloc). If it is not shared then then use regular malloc.But what you have done is created a method which will be a latent bug for anyone using primary/secondary process.
Quoted 8 lines
Either:
intr_handleis not allowed to be used in secondary.
Then always usemalloc().
Or.
intr_handlecan be used by both primary and secondary. Then always userte_malloc().
Any code path that allocatesintr_handlebefore pool is ready is broken.Quoted 6 lines
Hi Stephan,
Till V2, I implemented this API in a way where user of the API can choose If he wants intr handle to be allocated using malloc or
rte_mallocby passing a flag arg to therte_intr_instanc_allocAPI. User of the API will best know if the intr handle is to be shared withsecondary or not.
Quoted 4 lines
But after some discussions and suggestions from the community we decided to drop that flag argument and auto detect on whether
rte_mallocAPIs are ready to be used and thereafter make all furtherallocations via
rte_malloc.Quoted 4 lines
Currently alarm subsystem (or any driver doing allocation in constructor) gets interrupt instance allocated using glibc malloc that too because rte_malloc* is not ready by
rte_eal_alarm_init(), while all further consumers gets instance allocated viarte_malloc.Just as a comment, bus scanning is the real issue, not the alarms. Alarms could be initialized after the memory management (but it's irrelevant because their handle is not accessed from the outside).
However, MM needs to know bus IOVA requirements to initialize, which is usually determined by at least bus device requirements.Quoted 2 lines
I think this should not cause any issue in primary/secondary model as
all interrupt instance pointer will be shared.What do you mean? Aren't we discussing the issue that those allocated early are not shared?
Quoted 2 lines
Infact to avoid any surprises of primary/secondary not working we thought of making all allocations via
rte_malloc.I don't see why anyone would not make them shared.
In order to only userte_malloc(), we need:
1. In bus drivers, move handle allocation from scan to probe stage.
2. In EAL, move alarm initialization to after the MM.
It all can be done later with v3 design---but there are out-of-tree drivers. We need to force them to make step 1 at some point.
I see two options:
a) Right now have an external API that only works withrte_malloc()and internal API with autodetection. Fix DPDK and drop internal API.
b) Have external API with autodetection. Fix DPDK.
At the next ABI breakage drop autodetection and libc-malloc.Quoted 8 lines
Quoted 3 lines
David, Thomas, Dmitry, please add if I missed anything.
Can we please conclude on this series APIs as API freeze deadline (rc1) is
very near.
I support v3 design with no options and autodetection, because that's the interface we want in the end.
Implementation can be improved later.Hi All,
I came across 2 issues introduced with auto detection mechanism.
1. In case of primary secondary model. Primary application is started which makes lots of allocations via rte_malloc*Secondary side:
a. Secondary starts, in its "rte_eal_init()" it makes some allocation via rte_*, and in one of the allocation
request for heap expand is made as current memseg got exhausted. (malloc_heap_alloc_on_heap_id()->
alloc_more_mem_on_socket()->try_expand_heap())
b. A request to primary for heap expand is sent. Please note secondary holds the spinlock while making
the request. (malloc_heap_alloc_on_heap_id()->rte_spinlock_lock(&(heap->lock));)Primary side:
a. Primary receives the request, install a new hugepage and setups up the heap (handle_alloc_request()) b. To inform all the secondaries about the new memseg, primary sends a sync notice where it sets up an
alarm (rte_mp_request_async()->mp_request_async()).
c. Inside alarm setup API, we register an interrupt callback.
d. Insiderte_intr_callback_register(), a new interrupt instance allocation is requested for "src->intr_handle" e. Since memory management is detected as up, inside "rte_intr_instance_alloc()", call to "rte_zmalloc" for
allocating memory and further inside "malloc_heap_alloc_on_heap_id()", primary will experience a deadlock while taking up the spinlock because this spinlock is already hold by secondary.2. "
eal_flags_file_prefix_autotest" is failing because the spawned process by this tests are expected to cleanup their hugepage traces from respective directories (eg/dev/hugepage).
a. Insideeal_cleanup, rte_free()->malloc_heap_free(), where element to be freed is added to the free list and checked if nearby elements can be joined together and form a big free chunk (malloc_elem_free()). b. If this free chunk is big enough than the hugepage size, respective hugepage can be uninstalled after making sure no allocation from this hugepage exists. (malloc_heap_free()->malloc_heap_free_pages()->eal_memalloc_free_seg())
Quoted 2 lines
But because of interrupt allocations made for pci intr handles (used for VFIO) and other driver specific interrupt handles are not cleaned up in "
rte_eal_cleanup()", these hugepage files are not removed and test fails.
Sad to hear. But it's a great and thorough analysis.
Quoted 2 lines
There could be more such issues, I think we should firstly fix the DPDK.
1. Memory management should be made independent and should be the first thing to come up inrte_eal_init()
As I have explained, buses must be able to report IOVA requirement at this point (get_iommu_class() bus method).
Either scan() must complete before that
or get_iommu_class() must be able to work before scan() is called.
Quoted 2 lines
2.
rte_eal_cleanup()should be exactly opposite torte_eal_init(), just likebus_probe, we should havebus_removeto clean up all the memory allocations.
Yes. For most buses it will be just "unplug each device". In fact, EAL could do it with unplug(), but it is not mandatory.
Quoted 3 lines
Regarding this IRQ series, I would like to fall back to our original design i.e.
rte_intr_instance_alloc()should take an argument whether its memory should be allocated using glibc malloc or rte_malloc*.
Seems there's no other option to make it on time.
Quoted 11 lines
Decision for allocation
(malloc orrte_malloc) can be made on fact that in the existing code is the interrupt handle is shared? Eg. a. In case of alarmintr_handlewas global entry and not confined to any structure, so this can be allocated from normal malloc.
b. PCI device, had static entry forintr_handleinside "structrte_pci_device" and memory for structrte_pci_deviceis via normal malloc, so itintr_handlecan also be malloc'ed
c. Some driver withintr_handleinside its priv structure, and this priv structure gets allocated viarte_malloc, soIntr_handlecan also berte_malloc.Later once DPDK is fixed up, this argument can be removed and all allocations can be via
rte_mallocfamily without any auto detection.
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Quoted 47 lines · Dmitry Kozlyuk
Quoted 31 lines
Hi All,
I came across 2 issues introduced with auto detection mechanism.
1. In case of primary secondary model. Primary application is started which makes lots of allocations via rte_malloc*Secondary side:
a. Secondary starts, in its "rte_eal_init()" it makes some allocation via rte_*, and in one of the allocation
request for heap expand is made as current memseg got exhausted. (malloc_heap_alloc_on_heap_id()->
alloc_more_mem_on_socket()->try_expand_heap())
b. A request to primary for heap expand is sent. Please note secondary holds the spinlock while making
the request. (malloc_heap_alloc_on_heap_id()->rte_spinlock_lock(&(heap->lock));)Primary side:
a. Primary receives the request, install a new hugepage and setups up the heap (handle_alloc_request()) b. To inform all the secondaries about the new memseg, primary sends a sync notice where it sets up an
alarm (rte_mp_request_async()->mp_request_async()).
c. Inside alarm setup API, we register an interrupt callback.
d. Insiderte_intr_callback_register(), a new interrupt instance allocation is requested for "src->intr_handle" e. Since memory management is detected as up, inside "rte_intr_instance_alloc()", call to "rte_zmalloc" for
allocating memory and further inside "malloc_heap_alloc_on_heap_id()", primary will experience a deadlock while taking up the spinlock because this spinlock is already hold by secondary.2. "
eal_flags_file_prefix_autotest" is failing because the spawned process by this tests are expected to cleanup their hugepage traces from respective directories (eg/dev/hugepage).
a. Insideeal_cleanup, rte_free()->malloc_heap_free(), where element to be freed is added to the free list and checked if nearby elements can be joined together and form a big free chunk (malloc_elem_free()). b. If this free chunk is big enough than the hugepage size, respective hugepage can be uninstalled after making sure no allocation from this hugepage exists. (malloc_heap_free()->malloc_heap_free_pages()->eal_memalloc_free_seg())Quoted 2 lines
But because of interrupt allocations made for pci intr handles (used for VFIO) and other driver specific interrupt handles are not cleaned up in "
rte_eal_cleanup()", these hugepage files are not removed and test fails.Sad to hear. But it's a great and thorough analysis.
Quoted 2 lines
There could be more such issues, I think we should firstly fix the DPDK.
1. Memory management should be made independent and should be the first thing to come up inrte_eal_init()As I have explained, buses must be able to report IOVA requirement at this point (
get_iommu_class()bus method).
Eitherscan()must complete before that
orget_iommu_class()must be able to work beforescan()is called.Quoted 2 lines
2.
rte_eal_cleanup()should be exactly opposite torte_eal_init(), just likebus_probe, we should havebus_removeto clean up all the memory allocations.
Quoted 8 lines
Yes. For most buses it will be just "unplug each device". In fact, EAL could do it with
unplug(), but it is not mandatory.Quoted 3 lines
Regarding this IRQ series, I would like to fall back to our original design i.e.
rte_intr_instance_alloc()should take an argument whether its memory should be allocated using glibc malloc or rte_malloc*.Seems there's no other option to make it on time.
- Sorry, my memory is too short, did we describe where we need to share rte_intr_handle objects?
I spent some time looking at uses of rte_intr_handle objects.
In many cases intr_handle objects are referenced in malloc() objects. The cases where rte_intr_handle are shared is in per device private bits in drivers.
A intr_handle often contains fds.
For them to be used in mp setups, there needs to be a big machinery with SCM_RIGHTS but I see only 3 drivers which actually reference this.
So if intr_handle fds are accessed by multiple processes, their content probably makes no sense wrt fds.
From these two hints, I think we are going backwards, and the main usecase is that those rte_intr_instance objects are not used in mp. I even think they are never accessed from other processes. But I am not sure.
- Seeing how time it short for rc1, I am ok withrte_intr_instance_alloc() taking a flag argument.
And we can still go back on this API later.
Can we agree on the flag name?rte_malloc() interest is that it makes objects shared for mp, so how about RTE_INTR_INSTANCE_F_SHARED ?
Signature · 1 line
David Marchand
Re: [dpdk-dev] [EXT] Re: [PATCH v3 2/7] eal/interrupts: implement get set APIs
Hi Dmitry, David
Please find responses inline.
Quoted 56 lines
-----Original Message-----
From: David Marchand <[email protected]>
Sent: Thursday, October 21, 2021 7:03 PM
To: Dmitry Kozlyuk <[email protected]>; Harman Kalra <[email protected]>
Cc: Stephen Hemminger <[email protected]>; Thomas Monjalon <[email protected]>; [email protected]; Ray Kinsella <[email protected]>
Subject: Re: [EXT] Re: [dpdk-dev] [PATCH v3 2/7] eal/interrupts: implement get set APIsQuoted 10 lines · Dmitry Kozlyuk
Quoted 10 lines
Hi All,
I came across 2 issues introduced with auto detection mechanism.
1. In case of primary secondary model. Primary application is started which makes lots of allocations via rte_malloc*Secondary side:
a. Secondary starts, in its "rte_eal_init()" it makes some
allocation via rte_*, and in one of the allocation request for heap expandis made as current memseg got exhausted. (
malloc_heap_alloc_on_heap_id()->Quoted 7 lines
Quoted 7 lines
alloc_more_mem_on_socket()->try_expand_heap())
b. A request to primary for heap expand is sent. Please note
secondary holds the spinlock while making the request. (malloc_heap_alloc_on_heap_id()->rte_spinlock_lock(&(heap->lock));)Primary side:
a. Primary receives the request, install a new hugepage and setups upthe heap (
handle_alloc_request())Quoted 5 lines
Quoted 2 lines
b. To inform all the secondaries about the new memseg, primary
sends a sync notice where it sets up an alarm (rte_mp_request_async()-
mp_request_async()).Quoted 2 lines
c. Inside alarm setup API, we register an interrupt callback. d. Inside
rte_intr_callback_register(), a new interrupt instance allocationis requested for "
src->intr_handle"Quoted 3 lines
Quoted 3 lines
e. Since memory management is detected as up, inside
"rte_intr_instance_alloc()", call to "rte_zmalloc" for allocating memory and further inside "malloc_heap_alloc_on_heap_id()", primarywill experience a deadlock while taking up the spinlock because this spinlock is already hold by secondary.
Quoted 4 lines
Quoted 4 lines
2. "
eal_flags_file_prefix_autotest" is failing because the spawned process by this tests are expected to cleanup their hugepage traces fromrespective directories (eg
/dev/hugepage).Quoted 2 lines
Quoted 2 lines
a. Inside
eal_cleanup, rte_free()->malloc_heap_free(), where element to be freed is added to the free list and checked if nearby elements canbe joined together and form a big free chunk (
malloc_elem_free()).Quoted 4 lines
Quoted 4 lines
b. If this free chunk is big enough than the hugepage size, respective hugepage can be uninstalled after making sure no allocation from this hugepage exists. (malloc_heap_free()->malloc_heap_free_pages()-
Quoted 8 lines
Quoted 5 lines
eal_memalloc_free_segQuoted 4 lines
())
But because of interrupt allocations made for pci intr handles (used for VFIO) and other driver specific interrupt handles are not cleaned up in
"
rte_eal_cleanup()", these hugepage files are not removed and test fails.Quoted 2 lines
Sad to hear. But it's a great and thorough analysis.
Sad but a good learning, atleast we identified areas to be worked upon.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
There could be more such issues, I think we should firstly fix the DPDK.
1. Memory management should be made independent and should be the first thing to come up inrte_eal_init()
Quoted 11 lines
Quoted 7 lines
As I have explained, buses must be able to report IOVA requirement at this point (
get_iommu_class()bus method).
Eitherscan()must complete before that orget_iommu_class()must be able to work beforescan()is called.Quoted 2 lines
2.
rte_eal_cleanup()should be exactly opposite torte_eal_init(), just likebus_probe, we should havebus_removeto clean up all thememory allocations.
Quoted 3 lines
Yes. For most buses it will be just "unplug each device". In fact, EAL could do it with
unplug(), but it is not mandatory.
I implemented a rough bus_remove which was similar to unplug, faced some issue. Not sure but some drivers might not be supporting hotplug, for them unplug might be a challenge.
Quoted 10 lines
Quoted 4 lines
Quoted 4 lines
Regarding this IRQ series, I would like to fall back to our original design i.e.
rte_intr_instance_alloc()should take an argument whether itsmemory should be allocated using glibc malloc or rte_malloc*.
Quoted 2 lines
Seems there's no other option to make it on time.
- Sorry, my memory is too short, did we describe where we need to share
rte_intr_handleobjects?
Intr handle objects are shared in very few drivers.
Quoted 7 lines
I spent some time looking at uses of
rte_intr_handleobjects.In many cases
intr_handleobjects are referenced inmalloc()objects. The cases whererte_intr_handleare shared is in per device private bits in drivers.
Yes, in V2 design I allocated memory using glibc malloc for such instances by passing respective flag.
Quoted 5 lines
A
intr_handleoften contains fds.
For them to be used in mp setups, there needs to be a big machinery withSCM_RIGHTSbut I see only 3 drivers which actually reference this. So ifintr_handlefds are accessed by multiple processes, their content probably makes no sense wrt fds.
Those drivers will allocate using SHARED flag.
Quoted 11 lines
From these two hints, I think we are going backwards, and the main usecase is that those
rte_intr_instanceobjects are not used in mp.
I even think they are never accessed from other processes.
But I am not sure.- Seeing how time it short for rc1, I am ok with
rte_intr_instance_alloc()taking a flag argument.
And we can still go back on this API later.
Sure, I will revert back to original design and send V5 by tomorrow.
Quoted 4 lines
Can we agree on the flag name?
rte_malloc()interest is that it makes objects shared for mp, so how aboutRTE_INTR_INSTANCE_F_SHARED?
Yeah, it sounds good:RTE_INTR_INSTANCE_F_SHARED - rte_mallocRTE_INTR_INSTANCE_F_PRIVATE - malloc
Thanks David, Dmitry, Thomas, Stephan for reviewing the series thoroughly and providing inputs to improvise it.
Thanks
Harman
Quoted 4 lines
--
David Marchand
PATCH v3 3/7 eal/interrupts: avoid direct access to interrupt handle
In reply to Harman KalraMaking changes to the interrupt framework to use interrupt handle APIs to get/set any field. Direct access to any of the fields should be avoided to avoid any ABI breakage in future.
--- lib/eal/freebsd/eal_interrupts.c | 92 ++++++---- lib/eal/linux/eal_interrupts.c | 287 +++++++++++++++++++------------ 2 files changed, 234 insertions(+), 145 deletions(-)
lib/eal/freebsd/eal_interrupts.c +58 -34
@@ -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,8 @@ 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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 || + cb ==NULL ) {RTE_LOG (ERR ,EAL ,"Registering with invalid input parameter\n" );return -EINVAL ;
@@ -103,7 +104,8 @@ 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 +114,8 @@ 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,9 +137,18 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); + src->intr_handle =rte_intr_instance_alloc (); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ; + }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&intr_sources, src, + next); + } } }
@@ -151,7 +162,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 +185,13 @@ 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)); +"kevent, %s\n" , +rte_intr_fd_get ( + src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +226,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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -228,7 +241,8 @@ 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 +282,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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -282,7 +296,8 @@ 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 +329,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 +381,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 ;
@@ -388,7 +405,7 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +423,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 ;
@@ -429,7 +447,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +459,8 @@ 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 (intr_handle && +rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +482,8 @@ 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 +495,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 +566,8 @@ 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 ;
@@ -557,7 +578,9 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +"%s\n" , +rte_intr_fd_get ( + src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +590,8 @@ 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 +176 -111
748 lines not on this page · raw message
Signature · 1 line
2.18.0
PATCH v3 4/7 test/interrupt: apply get set interrupt handle APIs
In reply to Harman KalraUpdating the interrupt testsuite to make use of interrupt handle get set APIs.
--- app/test/test_interrupts.c | 162 ++++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 65 deletions(-)
app/test/test_interrupts.c +97 -65
@@ -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 (); +if (!intr_handles[i]) +return -1 ; + } + + 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 ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + 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 ; - 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_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,7 +427,7 @@ 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" );
@@ -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.18.0
PATCH v3 5/7 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 | 9 ++ drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 26 +++- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 15 ++- drivers/bus/fslmc/fslmc_vfio.c | 32 +++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 19 ++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 14 ++- 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 | 27 +++- drivers/bus/pci/pci_common_uio.c | 21 ++-- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 5 + 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 | 22 +++- drivers/net/failsafe/failsafe_intr.c | 43 ++++--- drivers/net/failsafe/failsafe_ops.c | 21 +++- 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 | 59 +++++++-- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 18 ++- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 ++++--- drivers/net/mlx5/linux/mlx5_os.c | 51 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 24 ++-- 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 | 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 | 35 ++++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +++-- drivers/net/thunderx/nicvf_ethdev.c | 11 ++ drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 34 +++-- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 75 ++++++----- drivers/net/virtio/virtio_ethdev.c | 21 ++-- .../net/virtio/virtio_user/virtio_user_dev.c | 47 ++++--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 ++++--- drivers/raw/ifpga/ifpga_rawdev.c | 61 ++++++--- 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 | 9 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 ++-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 ++++--- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/freebsd/eal_alarm.c | 45 ++++++- lib/eal/include/rte_eal_trace.h | 24 +--- lib/eal/linux/eal_alarm.c | 29 +++-- lib/eal/linux/eal_dev.c | 63 ++++++---- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +-- 118 files changed, 1791 insertions(+), 1217 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 ) {
@@ -1097,8 +1099,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 ;
@@ -1110,8 +1113,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 ;
@@ -4184,7 +4188,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
@@ -743,16 +743,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);
@@ -1879,7 +1878,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
@@ -1014,16 +1014,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);
@@ -2369,7 +2368,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 +9 -0
@@ -39,6 +39,13 @@ 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 (); +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 +74,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 +23 -3
@@ -172,6 +172,14 @@ dpaa_create_device_list(void) dev->device.bus = &rte_dpaa_bus.bus; +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +222,14 @@ dpaa_create_device_list(void) goto cleanup; } +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +263,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 +576,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 +632,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 +14 -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,14 @@ scan_one_fslmc_device(char *dev_name) dev->device.bus = &rte_fslmc_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +230,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 +15 -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,13 @@ 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 (); +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 +497,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 +545,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 +558,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 +13 -1
@@ -161,6 +161,13 @@ 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 (); +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 +196,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 +406,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 +25 -2
@@ -230,6 +230,22 @@ 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 (); +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 (); +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 +269,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 +316,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 +5 -0
@@ -299,6 +299,11 @@ vmbus_scan_one(const char *name) dev->device.devargs =vmbus_devargs_lookup (dev); +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +65 -43
222 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
@@ -360,7 +360,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 ;
@@ -479,7 +479,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;
@@ -525,10 +525,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 ;
@@ -608,7 +607,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 ;
@@ -638,10 +637,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 ; }
@@ -692,7 +688,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);
@@ -404,7 +404,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 ;
@@ -2323,7 +2323,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",
@@ -2347,8 +2347,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)
@@ -234,10 +234,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" ); }
@@ -262,8 +262,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
@@ -735,7 +735,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 ;
@@ -847,26 +847,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++; } }
@@ -1479,7 +1477,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;
@@ -1521,10 +1519,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
@@ -1153,7 +1153,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 ();
@@ -1224,8 +1224,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,
@@ -1264,8 +1264,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 =
@@ -525,7 +525,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;
@@ -575,12 +575,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 ; }
@@ -718,7 +716,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 ;
@@ -752,10 +750,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 ; }
@@ -767,7 +762,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 )
@@ -1008,7 +1003,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
@@ -473,7 +473,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 ;
@@ -945,7 +945,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 */
@@ -967,10 +967,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);
@@ -986,7 +985,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 ,
@@ -1006,7 +1005,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; }
@@ -1663,7 +1665,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;
@@ -2815,7 +2817,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;
@@ -2842,9 +2844,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);
@@ -2863,7 +2865,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 ;
@@ -2871,8 +2875,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 ]);
@@ -1112,8 +1112,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 +18 -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 (); +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 +309,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 +15 -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 (); +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 ); 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),
@@ -453,10 +460,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, } }fs_unlock (dev,0 ); +rte_intr_instance_free (intr_handle);return 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 +47 -12
59 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 +33 -18
51 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 +45 -30
75 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.c +32 -15
47 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 +45 -16
61 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
lib/eal/freebsd/eal_alarm.c +39 -6
45 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 v3 6/7 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 | 194 +++++++++++++++++++++++-- lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 --------- lib/eal/include/rte_interrupts.h | 30 +++- 5 files changed, 221 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 +185 -9
272 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 +29 -1
@@ -25,7 +25,35 @@ extern "C" {/** Interrupt handle */ struct rte_intr_handle ; -#include "rte_eal_interrupts.h" +/** Interrupt instance allocation flags +* @see rte_intr_instance_alloc +*/ +/** Allocate interrupt instance from traditional heap */ +#define RTE_INTR_ALLOC_TRAD_HEAP 0x00000000 +/** Allocate interrupt instance using DPDK memory management APIs */ +#define RTE_INTR_ALLOC_DPDK_ALLOCATOR 0x00000001 + +#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
PATCH v3 7/7 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 | 10 +++++++++- 5 files changed, 29 insertions(+), 1 deletion(-)
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 +9 -1
@@ -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 ) {
@@ -68,7 +75,8 @@ rte_eal_alarm_init(void) goto error; } -rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM ); +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error;/* create a timerfd file descriptor */ if (rte_intr_fd_set(intr_handle,
Signature · 1 line
2.18.0
v4 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.
Details on each patch of the series:
Patch 1: malloc: introduce malloc is ready API
This patch introduces a new API which tells if DPDK memory subsystem is initialized and rte_malloc* APIs are ready to be used. If rte_malloc* are setup, memory for interrupt instance is allocated using rte_malloc else using traditional heap APIs.
Patch 2: 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 of rte_intr_handle is 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.h and APIs defined in rte_eal_interrupts.h which were driver specific are moved to rte_interrupts.h (as anyways it was accessible and used outside DPDK library. Later in the series rte_eal_interrupts.h is removed.
Patch 3: 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 4: test/interrupt: apply get set interrupt handle APIs Updating interrupt test suite to use interrupt handle APIs.
Patch 5: 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 6: eal/interrupts: make interrupt handle structure opaque In this patch rte_eal_interrupt.h is removed, struct rte_intr_handle definition 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 API rte_intr_handle_event_list_update(). Eg, on PCI device probing MSIX size can be queried and these arrays can be reallocated accordingly.
Patch 7: 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 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.
Harman Kalra (7):
malloc: introduce malloc is ready API 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 routine
MAINTAINERS | 1 + app/test/test_interrupts.c | 162 +++-- 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 | 9 + drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 26 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 15 +- drivers/bus/fslmc/fslmc_vfio.c | 32 +- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 19 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 14 +- 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 | 27 +- drivers/bus/pci/pci_common_uio.c | 21 +- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 5 + 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 | 22 +- drivers/net/failsafe/failsafe_intr.c | 43 +- drivers/net/failsafe/failsafe_ops.c | 21 +- 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 | 59 +- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 18 +- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 +- drivers/net/mlx5/linux/mlx5_os.c | 51 +- drivers/net/mlx5/linux/mlx5_socket.c | 24 +- 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 | 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 | 35 +- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +- drivers/net/thunderx/nicvf_ethdev.c | 11 + drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 34 +- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +- drivers/net/vhost/rte_eth_vhost.c | 75 +- drivers/net/virtio/virtio_ethdev.c | 21 +- .../net/virtio/virtio_user/virtio_user_dev.c | 47 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 +- drivers/raw/ifpga/ifpga_rawdev.c | 61 +- 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 | 9 + drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 +- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 +- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/common/eal_common_interrupts.c | 585 ++++++++++++++++ lib/eal/common/eal_private.h | 11 + lib/eal/common/malloc_heap.c | 19 +- lib/eal/common/malloc_heap.h | 3 + lib/eal/common/meson.build | 1 + lib/eal/freebsd/eal.c | 1 + lib/eal/freebsd/eal_alarm.c | 52 +- lib/eal/freebsd/eal_interrupts.c | 92 ++- 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 | 648 +++++++++++++++++- 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 | 287 +++++--- lib/eal/version.map | 47 +- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +- 134 files changed, 3568 insertions(+), 1709 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
Signature · 1 line
2.18.0
PATCH v4 1/7 malloc: introduce malloc is ready API
Implementing a new API get the state if DPDK memory management APIs are initialized.
One of the use case of this API is while allocating an interrupt instance, if malloc APIs are ready memory for interrupt handles should be allocated via rte_malloc_* APIs else glibc malloc APIs are used. Eg. Alarm subsystem is initialised before DPDK memory infra setup and it allocates an interrupt handle.
--- lib/eal/common/malloc_heap.c | 16 +++++++++++++++- lib/eal/common/malloc_heap.h | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
lib/eal/common/malloc_heap.c +15 -1
@@ -36,6 +36,8 @@#define CONST_MAX (a, b) (a > b ? a : b)/* RTE_MAX is not a constant */ #define EXTERNAL_HEAP_MIN_SOCKET_ID (CONST_MAX((1 << 8), RTE_MAX_NUMA_NODES)) +static bool malloc_ready; +static unsigned check_hugepage_sz (unsigned flags,uint64_t hugepage_sz) {
@@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void) {struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();
@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (ret ==0 ) + malloc_ready = true; + +return ret; +} + +bool +rte_malloc_is_ready (void ) +{ +return malloc_ready == true; }
lib/eal/common/malloc_heap.h +6 -0
@@ -96,4 +96,10 @@ malloc_socket_to_heap_id(unsigned int socket_id);int rte_eal_malloc_heap_init (void ); +/* This API is used to know if DPDK memory subsystem is setup and its +* corresponding APIs are ready to be used. +*/ +bool +rte_malloc_is_ready (void ); +#endif /* MALLOC_HEAP_H_ */
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v4 1/7] malloc: introduce malloc is ready API
2021-10-20 00:05 (UTC+0530), Harman Kalra:
[...]
lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1372
Quoted 13 lines
static unsigned
check_hugepage_sz(unsigned flags, uint64_t hugepage_sz){lib/eal/common/malloc_heap.c +1
-0@@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void) {struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;
A secondary process exits here...
lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1378
Quoted 6 lines
lib/eal/common/malloc_heap.c +4
-1/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (ret ==0 ) + malloc_ready = true;
...and never knows that malloc is ready. But malloc is always ready for a secondary process.
Re: [dpdk-dev] [PATCH v4 1/7] malloc: introduce malloc is ready API
2021-10-20 01:01 (UTC+0300), Dmitry Kozlyuk:
Quoted 18 lines
2021-10-20 00:05 (UTC+0530), Harman Kalra:
[...]lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1372
Quoted 13 lines
static unsigned
check_hugepage_sz(unsigned flags, uint64_t hugepage_sz){lib/eal/common/malloc_heap.c +1
-0@@ -1328,6 +1330,7 @@ rte_eal_malloc_heap_init(void) {struct rte_mem_config *mcfg =rte_eal_get_configuration ()->mem_config;unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;A secondary process exits here...
Quoted 9 lines
lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1378
Quoted 6 lines
lib/eal/common/malloc_heap.c +4
-1/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (ret ==0 ) + malloc_ready = true;...and never knows that malloc is ready. But malloc is always ready for a secondary process.
That is, before returning 0 above for a secondary process malloc_ready should be set unconditionally.
Re: [dpdk-dev] [EXT] Re: [PATCH v4 1/7] malloc: introduce malloc is ready API
Quoted 41 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Wednesday, October 20, 2021 3:34 AM
To: Harman Kalra <[email protected]>
Cc: [email protected]; Anatoly Burakov <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v4 1/7] malloc: introduce malloc is ready APIExternal Email
----------------------------------------------------------------------
2021-10-20 01:01 (UTC+0300), Dmitry Kozlyuk:Quoted 17 lines
2021-10-20 00:05 (UTC+0530), Harman Kalra:
[...]Quoted 4 lines
static unsigned
check_hugepage_sz(unsigned flags, uint64_t hugepage_sz){ @@
-1328,6 +1330,7 @@rte_eal_malloc_heap_init(void){
structrte_mem_config*mcfg = rte_eal_get_configuration()-
mem_config;lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1372
Quoted 7 lines
lib/eal/common/malloc_heap.c +1
-0unsigned int i; +int ret;const struct internal_config *internal_conf =eal_get_internal_configuration ();@@ -1369,5 +1372,16 @@ rte_eal_malloc_heap_init(void)return 0 ;A secondary process exits here...
Quoted 9 lines
lib/eal/common/malloc_heap.c rte_eal_malloc_heap_init(void) · line 1378
Quoted 6 lines
lib/eal/common/malloc_heap.c +4
-1/* add all IOVA-contiguous areas to the heap */ -return rte_memseg_contig_walk (malloc_add_seg,NULL ); + ret =rte_memseg_contig_walk (malloc_add_seg,NULL ); + +if (ret ==0 ) + malloc_ready = true;...and never knows that malloc is ready. But malloc is always ready for a secondary process.
Quoted 2 lines
That is, before returning 0 above for a secondary process
malloc_readyshould be set unconditionally.
Yes, thanks for catching this, I will fix it V5.
PATCH v4 2/7 eal/interrupts: implement get set APIs
In reply to Harman KalraPrototype/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.
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 406 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 209 +-------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 621 ++++++++++++++++++++++++- lib/eal/version.map | 47 +- 8 files changed, 1190 insertions(+), 214 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.h
MAINTAINERS +1 -0
@@ -210,6 +210,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 +406 -0
406 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 +6 -203
229 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 +619 -2
647 lines not on this page · raw message
lib/eal/version.map +38 -9
68 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v4 2/7] eal/interrupts: implement get set APIs
Quoted 11 lines · Harman Kalra
lib/eal/version.map +0
-1@@ -109,18 +109,10 @@ DPDK_22 { rte_hexdump; rte_hypervisor_get; rte_hypervisor_get_name; # WINDOWS_NO_EXPORT - rte_intr_allow_others; rte_intr_callback_register; rte_intr_callback_unregister;
lib/eal/version.map DPDK_22 { · line 115
Quoted 10 lines
lib/eal/version.map +1
-8- rte_intr_cap_multiple; - rte_intr_disable; - rte_intr_dp_is_en; - rte_intr_efd_disable; - rte_intr_efd_enable; rte_intr_enable; - rte_intr_free_epoll_fd; - rte_intr_rx_ctl; - rte_intr_tls_epfd; + rte_intr_disable;
Please sort symbols alphabetically, this patch moves rte_intr_disable after rte_intr_enable.
Quoted 43 lines
lib/eal/version.map +30
-0rte_keepalive_create; # WINDOWS_NO_EXPORT rte_keepalive_dispatch_pings; # WINDOWS_NO_EXPORT rte_keepalive_mark_alive; # WINDOWS_NO_EXPORT@@ -420,12 +412,49 @@ EXPERIMENTAL { # added in 21.08 rte_power_monitor_multi; # WINDOWS_NO_EXPORT + + # added in 21.11 + rte_intr_fd_get; # WINDOWS_NO_EXPORT + rte_intr_fd_set; # WINDOWS_NO_EXPORT + rte_intr_instance_alloc; + rte_intr_instance_free; + rte_intr_type_get; + rte_intr_type_set; }; INTERNAL { global: rte_firmware_read; + rte_intr_allow_others; + rte_intr_cap_multiple; + rte_intr_dev_fd_get; # WINDOWS_NO_EXPORT + rte_intr_dev_fd_set; # WINDOWS_NO_EXPORT + rte_intr_dp_is_en; + rte_intr_efd_counter_size_set; # WINDOWS_NO_EXPORT + rte_intr_efd_counter_size_get; # WINDOWS_NO_EXPORT + rte_intr_efd_disable; + rte_intr_efd_enable; + rte_intr_efds_index_get; # WINDOWS_NO_EXPORT + rte_intr_efds_index_set; # WINDOWS_NO_EXPORT + rte_intr_elist_index_get; + rte_intr_elist_index_set; + rte_intr_event_list_update; + rte_intr_free_epoll_fd; + rte_intr_instance_copy; + rte_intr_instance_windows_handle_get; + rte_intr_instance_windows_handle_set; + rte_intr_max_intr_get; + rte_intr_max_intr_set; + rte_intr_nb_efd_get; # WINDOWS_NO_EXPORT + rte_intr_nb_efd_set; # WINDOWS_NO_EXPORT
lib/eal/version.map EXPERIMENTAL { · line 460
Quoted 10 lines
lib/eal/version.map +7
-0+ rte_intr_nb_intr_get; # WINDOWS_NO_EXPORT + rte_intr_rx_ctl; + rte_intr_tls_epfd; + rte_intr_vec_list_alloc; + rte_intr_vec_list_free; + rte_intr_vec_list_index_get; + rte_intr_vec_list_index_set; rte_mem_lock; rte_mem_map; rte_mem_page_size;
I see at least one link issue on Windows:
FAILED: lib/rte_ethdev-22.dll
"clang" -Wl,/MACHINE:X64 -Wl,/OUT:lib/rte_ethdev-22.dll lib/librte_ethdev.a.p/ethdev_ethdev_private.c.obj lib/librte_ethdev.a.p/ethdev_ethdev_profile.c.obj lib/librte_ethdev.a.p/ethdev_ethdev_trace_points.c.obj lib/librte_ethdev.a.p/ethdev_rte_class_eth.c.obj lib/librte_ethdev.a.p/ethdev_rte_ethdev.c.objlib/librte_ethdev.a.p/ethdev_rte_flow.c.objlib/librte_ethdev.a.p/ethdev_rte_mtr.c.objlib/librte_ethdev.a.p/ethdev_rte_tm.c.obj "-Wl,/nologo" "-Wl,/release"
"-Wl,/nologo" "-Wl,/OPT:REF" "-Wl,/DLL"
"-Wl,/IMPLIB:lib\rte_ethdev.lib" "lib\rte_eal.lib"
"lib\rte_kvargs.lib" "lib\rte_net.lib" "lib\rte_mbuf.lib"
"lib\rte_mempool.lib" "lib\rte_ring.lib" "lib\rte_meter.lib"
"lib\rte_telemetry.lib" "-Wl,/def:C:\Users\builder\jenkins\workspace\Windows-Compile-DPDK-Meson\dpdk\build\lib\rte_ethdev_exports.def" "-ldbghelp" "-lsetupapi" "-lws2_32" "-lmincore" "-lkernel32"
"-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32" "-loleaut32"
"-luuid" "-lcomdlg32" "-ladvapi32"
Creating library lib\rte_ethdev.lib and object lib\rte_ethdev.exp
ethdev_rte_ethdev.c.obj : error LNK2019: unresolved external symbolrte_intr_efds_index_get referenced in functionrte_eth_dev_rx_intr_ctl_q_get_fd
lib\rte_ethdev-22.dll : fatal error LNK1120: 1 unresolved externals
AFAIU, eal_common_interrupts.c hosts those new symbols and this file is compiled for Windows (from common/meson.build update), so all intr symbols are available.
There is no reason to filter interrupts symbols for Windows, is there?
Signature · 1 line
David Marchand
Re: [dpdk-dev] [PATCH v4 2/7] eal/interrupts: implement get set APIs
2021-10-20 08:14 (UTC+0200), David Marchand:
Quoted 7 lines
[...]
AFAIU,
eal_common_interrupts.chosts those new symbols and this file is compiled for Windows (from common/meson.build update), so all intr symbols are available.There is no reason to filter interrupts symbols for Windows, is there?
There is no technical reason.
I suggested not exporting those that make no sense on Windows. If this creates complications, let's export them all.
Re: [dpdk-dev] [PATCH v4 2/7] eal/interrupts: implement get set APIs
In reply to Harman KalraHello Harman,
This patch looks good to me, there are just some tiny comments inline.
2021-10-20 00:05 (UTC+0530), Harman Kalra:
lib/eal/common/eal_common_interrupts.c line 22
Quoted 9 lines
[...]
lib/eal/common/eal_common_interrupts.c new file +8
-0+/* Macros to check for valid port */ +#define CHECK_VALID_INTR_HANDLE (intr_handle) do { \ + if (intr_handle == NULL) { \ + RTE_LOG(ERR, EAL, "Interrupt instance unallocated\n"); \ + rte_errno = EINVAL; \ + goto fail; \ + } \ +} while (0)
In most cases "goto fail" could be "return -rte_errno". How about this (feel free to ignore)?
#define CHECK_VALID_INTR_HANDLE_RET(intr_handle) do { \
CHECK_VALID_INTR_HANDLE(intr_handle); \
fail: \
return -rte_errno; \
} while (0)Quoted 11 lines
[...]
lib/eal/common/eal_common_interrupts.c new file +9
-0+struct rte_intr_handle *rte_intr_instance_alloc (void ) +{ +struct rte_intr_handle *intr_handle; +bool is_rte_memory; + +/* Detect if DPDK malloc APIs are ready to be used. */ + is_rte_memory =rte_malloc_is_ready (); +if (is_rte_memory) + intr_handle = rte_zmalloc(NULL, sizeof(struct
rte_intr_handle),
lib/eal/common/eal_common_interrupts.c line 35
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ 0); + else + intr_handle =calloc (1 ,sizeof (struct rte_intr_handle ));
Nit: sizeof(*intr_handle).
lib/eal/common/eal_common_interrupts.c line 36
Quoted 1 line
lib/eal/common/eal_common_interrupts.c new file +1
-0+if (!intr_handle) {
intr_handle == NULL
Quoted 11 lines
lib/eal/common/eal_common_interrupts.c new file +11
-0+RTE_LOG (ERR ,EAL ,"Fail to allocate intr_handle\n" ); + rte_errno =ENOMEM ; +return NULL ; + } + + intr_handle->nb_intr =RTE_MAX_RXTX_INTR_VEC_ID ; + intr_handle->is_rte_memory = is_rte_memory; + +return intr_handle; +} +
[...]
lib/eal/common/eal_common_interrupts.c line 79
Quoted 4 lines
lib/eal/common/eal_common_interrupts.c new file +4
-0+ +void rte_intr_instance_free (struct rte_intr_handle *intr_handle) +{ +if (intr_handle) {
intr_handle != NULL
Quoted 6 lines
lib/eal/common/eal_common_interrupts.c new file +6
-0+if (intr_handle->is_rte_memory) +rte_free (intr_handle); +else +free (intr_handle); + } +}
[...]
lib/eal/common/eal_common_interrupts.c line 289
Quoted 9 lines
lib/eal/common/eal_common_interrupts.c new file +9
-0+ +int rte_intr_elist_index_set (struct rte_intr_handle *intr_handle, +int index,struct rte_epoll_event elist) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (index >= intr_handle->nb_intr) { +RTE_LOG (ERR ,EAL ,"Invalid size %d, max limit %d\n" , index, + intr_handle->nb_intr);
Which "size"?
Quoted 11 lines
lib/eal/common/eal_common_interrupts.c new file +11
-0+ rte_errno =ERANGE ; + goto fail; + } + + intr_handle->elist[index] = elist; + +return 0 ; +fail: +return -rte_errno; +} +
[...]
lib/eal/common/eal_common_interrupts.c line 340
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+int rte_intr_vec_list_index_get (const struct rte_intr_handle *intr_handle, +int index) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (!intr_handle->intr_vec) { +RTE_LOG (ERR ,EAL ,"Intr vector list not allocated\n" ); + rte_errno =ENOTSUP ; + goto fail; + }
Can be RTE_ASSERT(), because vec_list_size will be 0 in this case.
Quoted 13 lines
lib/eal/common/eal_common_interrupts.c new file +13
-0+ +if (index > intr_handle->vec_list_size) { +RTE_LOG (ERR ,EAL ,"Index %d greater than vec list size %d\n" , + index, intr_handle->vec_list_size); + rte_errno =ERANGE ; + goto fail; + } + +return intr_handle->intr_vec[index]; +fail: +return -rte_errno; +} +
lib/eal/common/eal_common_interrupts.c line 363
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+int rte_intr_vec_list_index_set (struct rte_intr_handle *intr_handle, +int index,int vec) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (!intr_handle->intr_vec) { +RTE_LOG (ERR ,EAL ,"Intr vector list not allocated\n" ); + rte_errno =ENOTSUP ; + goto fail; + }
Same here.
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+ +if (index > intr_handle->vec_list_size) { +RTE_LOG (ERR ,EAL ,"Index %d greater than vec list size %d\n" , + index, intr_handle->vec_list_size); + rte_errno =ERANGE ; + goto fail; + } + + intr_handle->intr_vec[index] = vec; +
lib/eal/common/eal_common_interrupts.c line 383
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c new file +10
-0+return 0 ; +fail: +return -rte_errno; +} + +void rte_intr_vec_list_free (struct rte_intr_handle *intr_handle) +{ +if (intr_handle) { +rte_free (intr_handle->intr_vec); + intr_handle->intr_vec =NULL ;
intr_handle->vec_list_size = 0;
Quoted 3 lines
lib/eal/common/eal_common_interrupts.c new file +3
-0+ } +} +
[...]
Quoted 1 line
lib/eal/include/rte_interrupts.h +0
-0
[...]
Quoted 8 lines
+/**
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice
+ *
+ * It allocates memory for interrupt instance. API auto detects if memory
+ * for the instance should be allocated using DPDK memory management library
+ * APIs or normal heap allocation, based on if DPDK memory subsystem is
+ * initialized and ready to be used.
This is too much implementation detail and not very specific from user PoV. Suggestion:
After rte_eal_init() has finished, it allocates from DDPK heap, otherwise it allocates from normal heap. In particular, it allocates from the normal heap during initial bus scanning.
See also my reply to v3 regarding allocation.
Quoted 3 lines
+ *
+ * Default memory allocation for event fds and epoll event array is done which
+ * can be realloced later as per the requirement.
BTW, why do this?
Quoted 6 lines
+ *
+ * This function should be called from application or driver, before calling any
+ * of the interrupt APIs.
+ *
+ * @return
+ * - On success, address of first interrupt handle.
Not "first".
Quoted 4 lines
+ * - On failure, NULL.
+ */lib/eal/include/rte_interrupts.h +2
-0+__rte_experimental +struct rte_intr_handle *
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 213
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+rte_intr_instance_alloc (void); + +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* This API is used to free the memory allocated for interrupt handle resources. +* +* @param intr_handle +* Base address of interrupt handle array.
Not "array".
Quoted 11 lines
+ *
+ */lib/eal/include/rte_interrupts.h +9
-0+__rte_experimental +void +rte_intr_instance_free (struct rte_intr_handle *intr_handle); + +/** +* @warning +* @b EXPERIMENTAL: this API may change without prior notice +* +* This API is used to set the fd field of interrupt handle with user provided
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 234
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+* file descriptor. +* +* @param intr_handle +* pointer to the interrupt handle. +* @param fd +* file descriptor value provided by user. +* +* @return +* - On success, zero. +* - On failure, a negative value.
+ "and rte_errno is set" here and in other places.
[...]
Quoted 3 lines
+/**
+ * @internal
+ * This API is used to populate interrupt handle, with src handler fields.
Comma is not needed.
Quoted 3 lines
+ *
+ * @paramintr_handle
+ * Start address of interrupt handles
It's a single handle.
Quoted 12 lines
+ * @param src
+ * Source interrupt handle to be cloned.
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +5
-0+__rte_internal +int +rte_intr_instance_copy (struct rte_intr_handle *intr_handle, +const struct rte_intr_handle *src); +
[...]
Quoted 9 lines
+/**
+ * @internal
+ * This API is used to set the event fd counter size field of interrupt handle
+ * with user provided efd counter size.
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ * @paramefd_counter_size
+ * size of efd counter, used for vdev
No need to mention vdev.
Quoted 10 lines
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +5
-0+__rte_internal +int +rte_intr_efd_counter_size_set (struct rte_intr_handle *intr_handle, +uint8_t efd_counter_size); +
[...]
Quoted 3 lines
+/**
+ * @internal
+ * Freeing the memory allocated for interrupt vector list array.
"Freeing" -> "Frees"
Quoted 9 lines
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ *
+ * @return
+ * - On success, zero
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +1
-0+__rte_internal
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 734
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+void +rte_intr_vec_list_free (struct rte_intr_handle *intr_handle); + +/** +* @internal +* Reallocates the size efds and elist array based on size provided by user. +* By default efds and elist array are allocated with default size +* RTE_MAX_RXTX_INTR_VEC_ID on interrupt handle array creation. Later on device +* probe, device may have capability of more interrupts than +* RTE_MAX_RXTX_INTR_VEC_ID. Hence using this API, PMDs can reallocate the
"Hence" word is unexpected, I think it should be removed.
Quoted 15 lines
+ * arrays as per the max interrupts capability of device.
+ *
+ * @paramintr_handle
+ * pointer to the interrupt handle.
+ * @param size
+ * efds and elist array size.
+ *
+ * @return
+ * - On success, zero
+ * - On failure, a negative value.
+ */lib/eal/include/rte_interrupts.h +4
-0+__rte_internal +int +rte_intr_event_list_update (struct rte_intr_handle *intr_handle,int size); +
[...]
PATCH v4 3/7 eal/interrupts: avoid direct access to interrupt handle
In reply to Harman KalraMaking changes to the interrupt framework to use interrupt handle APIs to get/set any field. Direct access to any of the fields should be avoided to avoid any ABI breakage in future.
--- lib/eal/freebsd/eal_interrupts.c | 92 ++++++---- lib/eal/linux/eal_interrupts.c | 287 +++++++++++++++++++------------ 2 files changed, 234 insertions(+), 145 deletions(-)
lib/eal/freebsd/eal_interrupts.c +58 -34
@@ -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,8 @@ 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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 || + cb ==NULL ) {RTE_LOG (ERR ,EAL ,"Registering with invalid input parameter\n" );return -EINVAL ;
@@ -103,7 +104,8 @@ 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 +114,8 @@ 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,9 +137,18 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); + src->intr_handle =rte_intr_instance_alloc (); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ; + }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&intr_sources, src, + next); + } } }
@@ -151,7 +162,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 +185,13 @@ 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)); +"kevent, %s\n" , +rte_intr_fd_get ( + src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +226,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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -228,7 +241,8 @@ 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 +282,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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;
@@ -282,7 +296,8 @@ 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 +329,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 +381,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 ;
@@ -388,7 +405,7 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +423,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 ;
@@ -429,7 +447,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +459,8 @@ 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 (intr_handle && +rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +482,8 @@ 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 +495,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 +566,8 @@ 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 ;
@@ -557,7 +578,9 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +"%s\n" , +rte_intr_fd_get ( + src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +590,8 @@ 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 +176 -111
748 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v4 3/7] eal/interrupts: avoid direct access to interrupt handle
2021-10-20 00:05 (UTC+0530), Harman Kalra:
Quoted 3 lines
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field. Direct access to any of the fields should be avoided to avoid any ABI breakage in future.
I get and accept the point why EAL also should use the API. However, mentioning ABI is still a wrong wording.
There is no ABI between EAL structures and EAL functions by definition of ABI.
Quoted 8 lines
Signed-off-by Harman Kalra <[email protected]>--- lib/eal/freebsd/eal_interrupts.c | 92 ++++++---- lib/eal/linux/eal_interrupts.c | 287 +++++++++++++++++++------------ 2 files changed, 234 insertions(+), 145 deletions(-)lib/eal/freebsd/eal_interrupts.c +0
-0
[...]
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle, · line 144
Quoted 12 lines
lib/eal/freebsd/eal_interrupts.c +5
-3@@ -135,9 +137,18 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); + src->intr_handle =rte_intr_instance_alloc (); +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ;
goto fail?
Quoted 10 lines
lib/eal/freebsd/eal_interrupts.c +7
-0+ }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&intr_sources, src, + next); + } } }
[...]
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle, · line 229
Quoted 6 lines
lib/eal/freebsd/eal_interrupts.c +1
-1@@ -213,7 +226,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 (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {
The handle is checked for NULL inside the accessor, here and in other places:
grep -R 'intr_handle == NULL ||' lib/eal
Quoted 5 lines
lib/eal/freebsd/eal_interrupts.c +0
-0RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;lib/eal/linux/eal_interrupts.c +0
-0
[...]
Re: [dpdk-dev] [EXT] Re: [PATCH v4 3/7] eal/interrupts: avoid direct access to interrupt handle
Quoted 15 lines
-----Original Message-----
From: Dmitry Kozlyuk <[email protected]>
Sent: Wednesday, October 20, 2021 2:58 AM
To: Harman Kalra <[email protected]>
Cc: [email protected]; Bruce Richardson <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [PATCH v4 3/7] eal/interrupts: avoid direct access to interrupt handleExternal Email
----------------------------------------------------------------------
2021-10-20 00:05 (UTC+0530), Harman Kalra:
Quoted 8 lines
Quoted 3 lines
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field. Direct access to any of the fields should be avoided to avoid any ABI breakage in future.
I get and accept the point why EAL also should use the API. However, mentioning ABI is still a wrong wording.
There is no ABI between EAL structures and EAL functions by definition of ABI.
Sure, I will reword the commit message without ABI inclusion.
Quoted 23 lines
Quoted 10 lines
Signed-off-by Harman Kalra <[email protected]>--- lib/eal/freebsd/eal_interrupts.c | 92 ++++++---- lib/eal/linux/eal_interrupts.c | 287 +++++++++++++++++++------------ 2 files changed, 234 insertions(+), 145 deletions(-)lib/eal/freebsd/eal_interrupts.c +0
-0[...]
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct
Quoted 1 line
lib/eal/freebsd/eal_interrupts.c +0
-0@@ -135,9 +137,18 @@ rte_intr_callback_register(const struct
rte_intr_handle*intr_handle,lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
Quoted 9 lines
lib/eal/freebsd/eal_interrupts.c +3
-3ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); + src->intr_handle =rte_intr_instance_alloc (); +if (src->intr_handle ==NULL ) { + RTE_LOG(ERR, EAL, "Can not createintr instance\n");
Quoted 4 lines
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct · line 144
Quoted 2 lines
lib/eal/freebsd/eal_interrupts.c +2
-0+free (callback); + ret = -ENOMEM ;goto fail?
I think goto not required, as we not setting wake_thread = 1 here, API will just return error after unlocking the spinlock and trace.
Quoted 16 lines
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
Quoted 7 lines
lib/eal/freebsd/eal_interrupts.c +5
-0+ }else { +rte_intr_instance_copy (src- intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); + TAILQ_INSERT_TAIL(&intr_sources,src,
Quoted 5 lines
lib/eal/freebsd/eal_interrupts.c +2
-0+ next); + } } }[...]
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_unregister_pending(const struct
Quoted 1 line
lib/eal/freebsd/eal_interrupts.c +0
-0@@ -213,7 +226,7 @@ rte_intr_callback_unregister_pending(const struct
rte_intr_handle*intr_handle,
Quoted 8 lines
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle, · line 229
Quoted 5 lines
lib/eal/freebsd/eal_interrupts.c +1
-1struct rte_intr_callback *cb, *next;/* do parameter checking first */ -if (intr_handle ==NULL || intr_handle->fd <0 ) { +if (intr_handle ==NULL ||rte_intr_fd_get (intr_handle) <0 ) {The handle is checked for NULL inside the accessor, here and in other places:
grep -R 'intr_handle== NULL ||' lib/eal
Ack, I will remove these NULL checks.
Quoted 8 lines
Quoted 7 lines
lib/eal/freebsd/eal_interrupts.c +0
-0RTE_LOG (ERR ,EAL ,"Unregistering with invalid input parameter\n" );return -EINVAL ;lib/eal/linux/eal_interrupts.c +0
-0[...]
Re: [dpdk-dev] [EXT] Re: [PATCH v4 3/7] eal/interrupts: avoid direct access to interrupt handle
2021-10-20 09:25 (UTC+0000), Harman Kalra:
Quoted 16 lines
[...]
Quoted 15 lines
Quoted 2 lines
lib/eal/freebsd/eal_interrupts.c +0
-0[...]
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct
Quoted 1 line
lib/eal/freebsd/eal_interrupts.c +0
-0@@ -135,9 +137,18 @@ rte_intr_callback_register(const struct
rte_intr_handle*intr_handle,lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
Quoted 9 lines
lib/eal/freebsd/eal_interrupts.c +3
-3ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); + src->intr_handle =rte_intr_instance_alloc (); +if (src->intr_handle ==NULL ) { + RTE_LOG(ERR, EAL, "Can not createintr instance\n");
Quoted 7 lines
Quoted 4 lines
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct · line 144
Quoted 2 lines
lib/eal/freebsd/eal_interrupts.c +2
-0+free (callback); + ret = -ENOMEM ;goto fail?
I think goto not required, as we not setting
wake_thread= 1 here, API will just return error after unlocking the spinlock and trace.
Just to emphasize, we're talking about FreeBSD implementation. There is no "wake_thread" variable there, so "goto fail" is needed. Your consideration would be valid for similar code in Linux EAL.
PATCH v4 4/7 test/interrupt: apply get set interrupt handle APIs
In reply to Harman KalraUpdating the interrupt testsuite to make use of interrupt handle get set APIs.
--- app/test/test_interrupts.c | 162 ++++++++++++++++++++++--------------- 1 file changed, 97 insertions(+), 65 deletions(-)
app/test/test_interrupts.c +97 -65
@@ -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 (); +if (!intr_handles[i]) +return -1 ; + } + + 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 ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + 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 ; - 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_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,7 +427,7 @@ 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" );
@@ -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.18.0
PATCH v4 5/7 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 | 9 ++ drivers/bus/auxiliary/rte_bus_auxiliary.h | 2 +- drivers/bus/dpaa/dpaa_bus.c | 26 +++- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_bus.c | 15 ++- drivers/bus/fslmc/fslmc_vfio.c | 32 +++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 19 ++- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/bus/fslmc/rte_fslmc.h | 2 +- drivers/bus/ifpga/ifpga_bus.c | 14 ++- 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 | 27 +++- drivers/bus/pci/pci_common_uio.c | 21 ++-- drivers/bus/pci/rte_bus_pci.h | 4 +- drivers/bus/vmbus/linux/vmbus_bus.c | 5 + 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 | 22 +++- drivers/net/failsafe/failsafe_intr.c | 43 ++++--- drivers/net/failsafe/failsafe_ops.c | 21 +++- 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 | 59 +++++++-- drivers/net/memif/rte_eth_memif.h | 2 +- drivers/net/mlx4/mlx4.c | 18 ++- drivers/net/mlx4/mlx4.h | 2 +- drivers/net/mlx4/mlx4_intr.c | 47 ++++--- drivers/net/mlx5/linux/mlx5_os.c | 51 +++++--- drivers/net/mlx5/linux/mlx5_socket.c | 24 ++-- 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 | 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 | 35 ++++-- drivers/net/tap/rte_eth_tap.h | 2 +- drivers/net/tap/tap_intr.c | 32 +++-- drivers/net/thunderx/nicvf_ethdev.c | 11 ++ drivers/net/thunderx/nicvf_struct.h | 2 +- drivers/net/txgbe/txgbe_ethdev.c | 34 +++-- drivers/net/txgbe/txgbe_ethdev_vf.c | 33 +++-- drivers/net/vhost/rte_eth_vhost.c | 75 ++++++----- drivers/net/virtio/virtio_ethdev.c | 21 ++-- .../net/virtio/virtio_user/virtio_user_dev.c | 47 ++++--- drivers/net/vmxnet3/vmxnet3_ethdev.c | 43 ++++--- drivers/raw/ifpga/ifpga_rawdev.c | 61 ++++++--- 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 | 9 ++ drivers/vdpa/mlx5/mlx5_vdpa.h | 4 +- drivers/vdpa/mlx5/mlx5_vdpa_event.c | 22 ++-- drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 44 ++++--- lib/bbdev/rte_bbdev.c | 4 +- lib/eal/freebsd/eal_alarm.c | 45 ++++++- lib/eal/include/rte_eal_trace.h | 24 +--- lib/eal/linux/eal_alarm.c | 29 +++-- lib/eal/linux/eal_dev.c | 63 ++++++---- lib/ethdev/ethdev_pci.h | 2 +- lib/ethdev/rte_ethdev.c | 14 +-- 118 files changed, 1791 insertions(+), 1217 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 ) {
@@ -1097,8 +1099,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 ;
@@ -1110,8 +1113,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 ;
@@ -4184,7 +4188,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
@@ -743,16 +743,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);
@@ -1879,7 +1878,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
@@ -1014,16 +1014,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);
@@ -2369,7 +2368,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 +9 -0
@@ -39,6 +39,13 @@ 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 (); +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 +74,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 +23 -3
@@ -172,6 +172,14 @@ dpaa_create_device_list(void) dev->device.bus = &rte_dpaa_bus.bus; +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +222,14 @@ dpaa_create_device_list(void) goto cleanup; } +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +263,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 +576,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 +632,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 +14 -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,14 @@ scan_one_fslmc_device(char *dev_name) dev->device.bus = &rte_fslmc_bus.bus; +/* Allocate interrupt instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +230,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 +15 -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,13 @@ 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 (); +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 +497,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 +545,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 +558,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 +13 -1
@@ -161,6 +161,13 @@ 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 (); +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 +196,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 +406,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 +25 -2
@@ -230,6 +230,22 @@ 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 (); +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 (); +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 +269,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 +316,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 +5 -0
@@ -299,6 +299,11 @@ vmbus_scan_one(const char *name) dev->device.devargs =vmbus_devargs_lookup (dev); +/* Allocate interrupt handle instance */ + dev->intr_handle =rte_intr_instance_alloc (); +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 +65 -43
222 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
@@ -360,7 +360,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 ;
@@ -479,7 +479,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;
@@ -525,10 +525,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 ;
@@ -608,7 +607,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 ;
@@ -638,10 +637,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 ; }
@@ -692,7 +688,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);
@@ -404,7 +404,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 ;
@@ -2323,7 +2323,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",
@@ -2347,8 +2347,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)
@@ -234,10 +234,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" ); }
@@ -262,8 +262,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
@@ -735,7 +735,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 ;
@@ -847,26 +847,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++; } }
@@ -1479,7 +1477,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;
@@ -1521,10 +1519,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
@@ -1153,7 +1153,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 ();
@@ -1224,8 +1224,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,
@@ -1264,8 +1264,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 =
@@ -525,7 +525,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;
@@ -575,12 +575,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 ; }
@@ -718,7 +716,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 ;
@@ -752,10 +750,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 ; }
@@ -767,7 +762,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 )
@@ -1008,7 +1003,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
@@ -473,7 +473,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 ;
@@ -945,7 +945,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 */
@@ -967,10 +967,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);
@@ -986,7 +985,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 ,
@@ -1006,7 +1005,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; }
@@ -1663,7 +1665,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;
@@ -2815,7 +2817,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;
@@ -2842,9 +2844,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);
@@ -2863,7 +2865,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 ;
@@ -2871,8 +2875,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 ]);
@@ -1112,8 +1112,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 +18 -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 (); +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 +309,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 +15 -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 (); +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 ); 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),
@@ -453,10 +460,12 @@ fs_rx_queue_setup(struct rte_eth_dev *dev, } }fs_unlock (dev,0 ); +rte_intr_instance_free (intr_handle);return 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 +47 -12
59 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 +33 -18
51 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 +45 -30
75 lines not on this page · raw message
drivers/net/virtio/virtio_user/virtio_user_dev.c +32 -15
47 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 +45 -16
61 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
lib/eal/freebsd/eal_alarm.c +39 -6
45 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.
Re: [dpdk-dev] [PATCH v4 5/7] drivers: remove direct access to interrupt handle
Quoted 3 lines
-----Original Message-----
From: Harman Kalra <[email protected]>
Sent: Wednesday, October 20, 2021 3:36 AM
[...]
Quoted 9 lines
Subject: [PATCH v4 5/7] drivers: remove direct access to interrupt handle
Removing 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.
Signed-off-by Harman Kalra <[email protected]>---
For net/enic,
Thanks.
-Hyong
PATCH v4 6/7 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 | 197 +++++++++++++++++++++++-- lib/eal/include/meson.build | 1 - lib/eal/include/rte_eal_interrupts.h | 72 --------- lib/eal/include/rte_interrupts.h | 30 +++- 5 files changed, 224 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 +188 -9
275 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 +29 -1
@@ -25,7 +25,35 @@ extern "C" {/** Interrupt handle */ struct rte_intr_handle ; -#include "rte_eal_interrupts.h" +/** Interrupt instance allocation flags +* @see rte_intr_instance_alloc +*/ +/** Allocate interrupt instance from traditional heap */ +#define RTE_INTR_ALLOC_TRAD_HEAP 0x00000000 +/** Allocate interrupt instance using DPDK memory management APIs */ +#define RTE_INTR_ALLOC_DPDK_ALLOCATOR 0x00000001 + +#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
PATCH v4 7/7 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 | 10 +++++++++- 5 files changed, 29 insertions(+), 1 deletion(-)
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 +9 -1
@@ -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 ) {
@@ -68,7 +75,8 @@ rte_eal_alarm_init(void) goto error; } -rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM ); +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error;/* create a timerfd file descriptor */ if (rte_intr_fd_set(intr_handle,
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v4 7/7] eal/alarm: introduce alarm fini routine
2021-10-20 00:05 (UTC+0530), Harman Kalra:
Quoted 19 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 | 10 +++++++++- 5 files changed, 29 insertions(+), 1 deletion(-)lib/eal/common/eal_private.h +0
-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 174
Quoted 10 lines
lib/eal/common/eal_private.h +9
-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 +*/
The comment does not match the function.
Quoted 5 lines
lib/eal/common/eal_private.h +2
-0+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_alarm.c static rte_spinlock_t alarm_list_lk = RTE_SPINLOCK_INITIALIZER; · line 52
Quoted 12 lines
lib/eal/freebsd/eal_alarm.c +4
-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)
intr_handle != NULL
Quoted 6 lines
lib/eal/freebsd/eal_alarm.c +3
-0+rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {
[...]
lib/eal/linux/eal_alarm.c static struct rte_intr_handle *intr_handle; · line 64
Quoted 12 lines
lib/eal/linux/eal_alarm.c +4
-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)
Ditto.
Quoted 7 lines
lib/eal/linux/eal_alarm.c +3
-0+rte_intr_instance_free (intr_handle); +} +int rte_eal_alarm_init (void ) {
lib/eal/linux/eal_alarm.c rte_eal_alarm_init(void) · line 82
Quoted 9 lines
lib/eal/linux/eal_alarm.c +2
-1@@ -68,7 +75,8 @@ rte_eal_alarm_init(void) goto error; } -rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM ); +if (rte_intr_type_set (intr_handle,RTE_INTR_HANDLE_ALARM )) + goto error;/* create a timerfd file descriptor */ if (rte_intr_fd_set(intr_handle,
This belongs to a patch 5/7, doesn't it?
v5 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.
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 of rte_intr_handle is 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.h and APIs defined in rte_eal_interrupts.h which were driver specific are moved to rte_interrupts.h (as anyways it was accessible and used outside DPDK library. Later in the series rte_eal_interrupts.h is 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.h is removed, struct rte_intr_handle definition 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 API rte_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 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.
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 routine
MAINTAINERS | 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
Signature · 1 line
2.18.0
PATCH v5 1/6 eal/interrupts: implement get set APIs
Prototype/Implement get set APIs for interrupt handle fields. User wont 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.
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 421 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 209 +------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 648 ++++++++++++++++++++++++- lib/eal/version.map | 46 +- 8 files changed, 1232 insertions(+), 213 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 +421 -0
421 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 +6 -203
229 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 +646 -2
674 lines not on this page · raw message
lib/eal/version.map +38 -8
68 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v5 1/6] eal/interrupts: implement get set APIs
2021-10-23 02:19 (UTC+0530), Harman Kalra:
Quoted 5 lines
Prototype/Implement get set APIs for interrupt handle fields. User wont be able to access any of the interrupt handle fields directly while should use these get/set APIs to access/manipulate them.
Quoted 7 lines
Internal interrupt header i.e.
rte_eal_interrupt.his rearranged, as APIs defined are moved torte_interrupts.hand epoll specific definitions are moved to a new headerrte_epoll.h. Later in the seriesrte_eal_interrupt.hwill be removed.Signed-off-by Harman Kalra <[email protected]>Acked-by Ray Kinsella <[email protected]>
Hi Harman,
After fixing some comment below feel free to add:
Quoted 26 lines
--- MAINTAINERS | 1 + lib/eal/common/eal_common_interrupts.c | 421 ++++++++++++++++ lib/eal/common/meson.build | 1 + lib/eal/include/meson.build | 1 + lib/eal/include/rte_eal_interrupts.h | 209 +------- lib/eal/include/rte_epoll.h | 118 +++++ lib/eal/include/rte_interrupts.h | 648 ++++++++++++++++++++++++- lib/eal/version.map | 46 +- 8 files changed, 1232 insertions(+), 213 deletions(-) create mode 100644 lib/eal/common/eal_common_interrupts.c create mode 100644 lib/eal/include/rte_epoll.hMAINTAINERS +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 line 257
Quoted 8 lines
lib/eal/common/eal_common_interrupts.c +7
-0+int rte_intr_efds_index_get (const struct rte_intr_handle *intr_handle, +int index) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +if (index >= intr_handle->nb_intr) { + RTE_LOG(ERR, EAL, "Invalid size %d, max limit %d\n", index,
"size" -> "index"
Quoted 9 lines
lib/eal/common/eal_common_interrupts.c +9
-0+ intr_handle->nb_intr); + rte_errno =EINVAL ; + goto fail; + } + +return intr_handle->efds[index]; +fail: +return -rte_errno; +}
lib/eal/common/eal_common_interrupts.c line 330
Quoted 10 lines
lib/eal/common/eal_common_interrupts.c +8
-0+int rte_intr_vec_list_alloc (struct rte_intr_handle *intr_handle, +const char *name,int size) +{ +CHECK_VALID_INTR_HANDLE (intr_handle); + +/* Vector list already allocated */ +if (intr_handle->intr_vec !=NULL ) +return 0 ;
What if size > intr_handle->vec_list_size?
Quoted 40 lines
lib/eal/common/eal_common_interrupts.c +21
-0+ +if (size > intr_handle->nb_intr) { +RTE_LOG (ERR ,EAL ,"Invalid size %d, max limit %d\n" , size, + intr_handle->nb_intr); + rte_errno =ERANGE ; + goto fail; + } + + intr_handle->intr_vec =rte_zmalloc (name, size *sizeof (int ),0 ); +if (intr_handle->intr_vec ==NULL ) { +RTE_LOG (ERR ,EAL ,"Failed to allocate %d intr_vec" , size); + rte_errno =ENOMEM ; + goto fail; + } + + intr_handle->vec_list_size = size; + +return 0 ; +fail: +return -rte_errno; +}lib/eal/include/rte_interrupts.h +3
-0@@ -5,8 +5,11 @@#ifndef _RTE_INTERRUPTS_H_#define _RTE_INTERRUPTS_H_ +#include <stdbool.h> +#include <rte_common.h> #include <rte_compat.h> +#include <rte_epoll.h> /** * @file
lib/eal/include/rte_interrupts.h extern "C" { · line 34
Quoted 10 lines
lib/eal/include/rte_interrupts.h +7
-0@@ -22,6 +25,16 @@ extern "C" {/** Interrupt handle */ struct rte_intr_handle ; +/** Interrupt instance allocation flags +* @see rte_intr_instance_alloc +*/ +/** Interrupt instance would not be shared within primary secondary process. */ +#define RTE_INTR_INSTANCE_F_UNSHARED 0x00000001 +/** Interrupt instance could be shared within primary secondary process. */ +#define RTE_INTR_INSTANCE_F_SHARED 0x00000002
Nits:
"would not" -> "will not"
"could" -> "will be"
"within primary secondary process" ->
"between primary and secondary processes"
You previously suggested PRIVATE instead of UNSHARED, it sounded better, but no strog opinion.
Quoted 4 lines
[...]
+/**
+ * @internal
+ * This API is used to populate interrupt handle with src handler fields.
"handler" -> "handle"
Quoted 22 lines
+ *
+ * @paramintr_handle
+ * Interrupt handle pointer.
+ * @param src
+ * Source interrupt handle to be cloned.
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value andrte_errnois set.
+ */lib/eal/include/rte_interrupts.h +10
-0+__rte_internal +int +rte_intr_instance_copy (struct rte_intr_handle *intr_handle, +const struct rte_intr_handle *src); +/** +* @internal +* This API returns the sources from where memory is allocated for interrupt +* instance. +* +* @param intr_handle
lib/eal/include/rte_interrupts.h int rte_intr_disable(const struct rte_intr_handle *intr_handle); · line 775
Quoted 10 lines
lib/eal/include/rte_interrupts.h +10
-0+* pointer to the interrupt handle. +* +* @return +* - On success, 1 corresponds to memory allocated via DPDK allocator APIs +* - On success, 0 corresponds to memory allocated from traditional heap. +* - On failure, negative value. +*/ +__rte_internal +int +rte_intr_instance_alloc_flag_get (const struct rte_intr_handle *intr_handle);
It returns flags passed on allow,
so return value type and description is inaccurate. Should be uint32_t and a reference to the flag constants.
PATCH v5 2/6 eal/interrupts: avoid direct access to interrupt handle
In reply to Harman KalraMaking changes to the interrupt framework to use interrupt handle APIs to get/set any field.
--- lib/eal/freebsd/eal_interrupts.c | 112 ++++++++---- lib/eal/linux/eal_interrupts.c | 303 +++++++++++++++++++------------ 2 files changed, 268 insertions(+), 147 deletions(-)
lib/eal/freebsd/eal_interrupts.c +77 -35
@@ -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 ; }
@@ -86,10 +86,11 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, {struct rte_intr_callback *callback;struct rte_intr_source *src; -int ret =0 , add_event =0 ; +int ret =0 , add_event =0 , is_rte_memory;/* 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 +104,8 @@ 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 +114,8 @@ 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,9 +137,36 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle, ret = -ENOMEM ; goto fail; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&intr_sources, src, next); +/* src->interrupt instance memory allocated +* depends on from where intr_handle memory +* is allocated. +*/ + is_rte_memory = + !!(rte_intr_instance_alloc_flag_get ( + intr_handle) &RTE_INTR_INSTANCE_F_SHARED ); +if (is_rte_memory ==0 ) + src->intr_handle = +rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_UNSHARED ); +else if (is_rte_memory ==1 ) + src->intr_handle = +rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_SHARED ); +else +RTE_LOG (ERR ,EAL ,"Failed to get mem allocator\n" ); + +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ; + goto fail; + }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&intr_sources, src, + next); + } } }
@@ -151,7 +180,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 +203,13 @@ 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)); +"kevent, %s\n" , +rte_intr_fd_get ( + src->intr_handle), +strerror (errno)); ret = -errno; goto fail; }
@@ -213,7 +244,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 +259,8 @@ 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 +300,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 +314,8 @@ 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 +347,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 +399,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 ;
@@ -388,7 +423,7 @@ rte_intr_enable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -406,17 +441,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 ;
@@ -429,7 +465,7 @@ rte_intr_disable(const struct rte_intr_handle *intr_handle)default :RTE_LOG (ERR ,EAL ,"Unknown handle type of fd %d\n" , - intr_handle->fd); +rte_intr_fd_get (intr_handle)); rc =-1 ;break ; }
@@ -441,7 +477,8 @@ 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 (intr_handle && +rte_intr_type_get (intr_handle) ==RTE_INTR_HANDLE_VDEV )return 0 ;return -1 ;
@@ -463,7 +500,8 @@ 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 +513,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 +584,8 @@ 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 ;
@@ -557,7 +596,9 @@ eal_intr_process_interrupts(struct kevent *events, int nfds)*/ if (kevent (kq, &ke,1 ,NULL ,0 ,NULL ) <0 ) {RTE_LOG (ERR ,EAL ,"Error removing fd %d kevent, " -"%s\n" , src->intr_handle.fd, +"%s\n" , +rte_intr_fd_get ( + src->intr_handle),strerror (errno));/* removing non-existent even is an expected * condition in some circumstances
@@ -567,7 +608,8 @@ 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 +191 -112
770 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [dpdk-dev] [PATCH v5 2/6] eal/interrupts: avoid direct access to interrupt handle
2021-10-23 02:19 (UTC+0530), Harman Kalra:
Quoted 18 lines
Making changes to the interrupt framework to use interrupt handle APIs to get/set any field.
Signed-off-by Harman Kalra <[email protected]>--- lib/eal/freebsd/eal_interrupts.c | 112 ++++++++---- lib/eal/linux/eal_interrupts.c | 303 +++++++++++++++++++------------ 2 files changed, 268 insertions(+), 147 deletions(-)lib/eal/freebsd/eal_interrupts.c +7
-0+/* src->interrupt instance memory allocated +* depends on from where intr_handle memory +* is allocated. +*/ + is_rte_memory = + !!(rte_intr_instance_alloc_flag_get ( + intr_handle) &RTE_INTR_INSTANCE_F_SHARED );
lib/eal/freebsd/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle, · line 156
Quoted 10 lines
lib/eal/freebsd/eal_interrupts.c +10
-0+if (is_rte_memory ==0 ) + src->intr_handle = +rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_UNSHARED ); +else if (is_rte_memory ==1 ) + src->intr_handle = +rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_SHARED ); +else +RTE_LOG (ERR ,EAL ,"Failed to get mem allocator\n" );
Why not just get the flags and use them as-is to allocate a new instance? If you care to use only these flags even if there are others, a mask can be used.
Quoted 33 lines
lib/eal/freebsd/eal_interrupts.c +13
-0+ +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ; + goto fail; + }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&intr_sources, src, + next); + } } }lib/eal/linux/eal_interrupts.c +4
-6@@ -522,12 +547,35 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,free (callback); ret = -ENOMEM ; }else { - src->intr_handle = *intr_handle; -TAILQ_INIT (&src->callbacks); -TAILQ_INSERT_TAIL (&(src->callbacks), callback, next); -TAILQ_INSERT_TAIL (&intr_sources, src, next); - wake_thread =1 ; - ret =0 ; +/* src->interrupt instance memory allocated depends on +* from where intr_handle memory is allocated. +*/ + is_rte_memory =
lib/eal/linux/eal_interrupts.c rte_intr_callback_register(const struct rte_intr_handle *intr_handle, · line 563
Quoted 10 lines
lib/eal/linux/eal_interrupts.c +10
-0+ !!(rte_intr_instance_alloc_flag_get (intr_handle) & +RTE_INTR_INSTANCE_F_SHARED ); +if (is_rte_memory ==0 ) + src->intr_handle =rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_UNSHARED ); +else if (is_rte_memory ==1 ) + src->intr_handle =rte_intr_instance_alloc ( +RTE_INTR_INSTANCE_F_SHARED ); +else +RTE_LOG (ERR ,EAL ,"Failed to get mem allocator\n" );
Likewise.
Quoted 18 lines
lib/eal/linux/eal_interrupts.c +15
-0+ +if (src->intr_handle ==NULL ) { +RTE_LOG (ERR ,EAL ,"Can not create intr instance\n" ); +free (callback); + ret = -ENOMEM ; + }else { +rte_intr_instance_copy (src->intr_handle, + intr_handle); +TAILQ_INIT (&src->callbacks); +TAILQ_INSERT_TAIL (&(src->callbacks), callback, + next); +TAILQ_INSERT_TAIL (&intr_sources, src, next); + wake_thread =1 ; + ret =0 ; + } } }
[...]
lib/eal/linux/eal_interrupts.c rte_intr_enable(const struct rte_intr_handle *intr_handle) · line 816
Quoted 3 lines
lib/eal/linux/eal_interrupts.c +2
-0+if (intr_handle &&rte_intr_type_get (intr_handle) == +RTE_INTR_HANDLE_VDEV )return 0 ;
Nit: you have removed intr_handle condition everywhere except here.
PATCH v5 3/6 test/interrupt: apply get set interrupt handle APIs
In reply to Harman KalraUpdating the interrupt testsuite to make use of interrupt handle get set APIs.
--- app/test/test_interrupts.c | 163 ++++++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 65 deletions(-)
app/test/test_interrupts.c +98 -65
@@ -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,55 @@ 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_UNSHARED ); +if (!intr_handles[i]) +return -1 ; + } + + 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 ].fd = pfds.readfd; - intr_handles[TEST_INTERRUPT_HANDLE_VALID ].type = -RTE_INTR_HANDLE_UNKNOWN ; + 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 ; - 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_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 +121,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 +153,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 +208,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 +230,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 +255,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 +265,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 +273,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 +281,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 +289,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 +297,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 +318,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 +329,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 +337,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 +345,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 +353,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 +361,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 +383,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 +403,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,7 +428,7 @@ 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" );
@@ -445,8 +477,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 +486,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 +503,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 +512,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 +562,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.18.0