interrupt mode for i40e
cover interrupt mode for i40e
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping
2. add api to declare the capability of multiple interrupt vector support
3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF
4. add rx interrupt support in i40e PF and VF
Cunming Liang (11):
eal/linux: vfio map misc intr to vector zero
ixgbe: reserve intr vector zero for misc cause
igb: reserve intr vector zero for misc cause eal/linux: not allow to enable zero intr efd eal/linux: add intr api to report multi-vector capability
ixgbe: fix rx intr compatible issue with PF mbox
ixgbevf: cleanup unnecessary interrupt handler
igb: fix rx intr compatible issue with PF mbox
i40e: add rx interrupt support
i40evf: add rx interrupt support
doc: release note update for intr mode
doc/guides/rel_notes/release_2_2.rst | 2 + drivers/net/e1000/igb_ethdev.c | 63 ++-- drivers/net/i40e/i40e_ethdev.c | 359 +++++++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 17 + drivers/net/i40e/i40e_ethdev_vf.c | 141 +++++++- drivers/net/i40e/i40e_pf.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 144 +++------ .../bsdapp/eal/include/exec-env/rte_interrupts.h | 3 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 35 +- .../linuxapp/eal/include/exec-env/rte_interrupts.h | 16 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 + 11 files changed, 597 insertions(+), 197 deletions(-)
Signature · 1 line
2.4.3
PATCH 1/11 eal/linux: vfio map misc intr to vector zero
During VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ... Qn_fd, misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd, Q0_fd, ... Qn_fd}, always reserve the first vector to misc interrupt.
--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 18 ++++++++++++------ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +12 -6
@@ -300,8 +300,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) { irq_set->index =VFIO_PCI_MSIX_IRQ_INDEX ; irq_set->start =0 ; fd_ptr = (int *) &irq_set->data; -memcpy (fd_ptr, intr_handle->efds,sizeof (intr_handle->efds)); - fd_ptr[intr_handle->max_intr -1 ] = intr_handle->fd; + fd_ptr[MISC_VEC_ID ] = intr_handle->fd; +/* follow up with misc(0) interrupt */ +memcpy (&fd_ptr[RX_VEC_START ], intr_handle->efds, +sizeof (*intr_handle->efds) * intr_handle->nb_efd); ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);
@@ -1068,10 +1070,13 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,struct rte_epoll_event *rev;struct rte_epoll_data *epdata;int epfd_op; +unsigned int efd_idx;int rc =0 ; + efd_idx = (vec >=RX_VEC_START ) ? (vec -RX_VEC_START ) : vec; +if (!intr_handle || intr_handle->nb_efd ==0 || - vec >= intr_handle->nb_efd) { + efd_idx >= intr_handle->nb_efd) {RTE_LOG (ERR ,EAL ,"Wrong intr vector number.\n" );return -EPERM ; }
@@ -1079,7 +1084,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,switch (op) {case RTE_INTR_EVENT_ADD : epfd_op =EPOLL_CTL_ADD ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status !=RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event already been added.\n" );return -EEXIST ;
@@ -1091,7 +1096,8 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, epdata->data = data; epdata->cb_fun = (rte_intr_event_cb_t )eal_intr_proc_rxtx_intr; epdata->cb_arg = (void *)intr_handle; - rc =rte_epoll_ctl (epfd, epfd_op, intr_handle->efds[vec], rev); + rc =rte_epoll_ctl (epfd, epfd_op, + intr_handle->efds[efd_idx], rev);if (!rc)RTE_LOG (DEBUG ,EAL , "efd %d associated with vec %d added on epfd %d"
@@ -1101,7 +1107,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,break ;case RTE_INTR_EVENT_DEL : epfd_op =EPOLL_CTL_DEL ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status ==RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event does not exist.\n" );return -EPERM ;
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +3 -0
@@ -77,6 +77,9 @@ struct rte_epoll_event {struct rte_epoll_data epdata; }; +#define MISC_VEC_ID (0) +#define RX_VEC_START (MISC_VEC_ID + 1) +/** Handle for interrupts. */ struct rte_intr_handle { union {
Signature · 1 line
2.4.3
PATCH 2/11 ixgbe: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +9 -5
@@ -4249,7 +4249,8 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t queue_id, vec =0 ; +uint32_t queue_id, base =MISC_VEC_ID ; +uint32_t vec =MISC_VEC_ID ;uint32_t mask;uint32_t gpie;
@@ -4259,6 +4260,9 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) + vec = base =RX_VEC_START ; +/* setup GPIE for MSI-x mode */ gpie =IXGBE_READ_REG (hw,IXGBE_GPIE ); gpie |= IXGBE_GPIE_MSIX_MODE | IXGBE_GPIE_PBA_SUPPORT |
@@ -4282,23 +4286,23 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)/* by default, 1:1 mapping */ ixgbe_set_ivar_map (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }switch (hw->mac.type) {case ixgbe_mac_82598EB:ixgbe_set_ivar_map (hw,-1 ,IXGBE_IVAR_OTHER_CAUSES_INDEX , - intr_handle->max_intr -1 ); +MISC_VEC_ID );break ;case ixgbe_mac_82599EB:case ixgbe_mac_X540: -ixgbe_set_ivar_map (hw,-1 ,1 , intr_handle->max_intr -1 ); +ixgbe_set_ivar_map (hw,-1 ,1 ,MISC_VEC_ID );break ;default :break ; } -IXGBE_WRITE_REG (hw,IXGBE_EITR (queue_id), +IXGBE_WRITE_REG (hw,IXGBE_EITR (MISC_VEC_ID ),IXGBE_MIN_INTER_INTERRUPT_INTERVAL_DEFAULT &0xFFF );/* set up to autoclear timer, and the vectors */
Signature · 1 line
2.4.3
PATCH 3/11 igb: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
--- drivers/net/e1000/igb_ethdev.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/net/e1000/igb_ethdev.c +14 -5
@@ -4210,7 +4210,10 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)uint32_t tmpval, regval, intr_mask;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vec =0 ; +uint32_t vec =MISC_VEC_ID ; +uint32_t base =MISC_VEC_ID ; +uint32_t misc_shift =0 ; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;/* won't configure msix register if no mapping is done
@@ -4219,6 +4222,11 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) { + vec = base =RX_VEC_START ; + misc_shift =1 ; + } +/* set interrupt vector for other causes */ if (hw->mac.type == e1000_82575) { tmpval =E1000_READ_REG (hw,E1000_CTRL_EXT );
@@ -4247,8 +4255,8 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)E1000_WRITE_REG (hw,E1000_GPIE ,E1000_GPIE_MSIX_MODE |E1000_GPIE_PBA |E1000_GPIE_EIAME |E1000_GPIE_NSICR ); - - intr_mask = (1 << intr_handle->max_intr) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAC );E1000_WRITE_REG (hw,E1000_EIAC , regval | intr_mask);
@@ -4262,14 +4270,15 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)/* use EIAM to auto-mask when MSI-X interrupt * is asserted, this saves a register write for every interrupt */ - intr_mask = (1 << intr_handle->nb_efd) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAM );E1000_WRITE_REG (hw,E1000_EIAM , regval | intr_mask);for (queue_id =0 ; queue_id < dev->data->nb_rx_queues; queue_id++) {eth_igb_assign_msix_vector (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }
Signature · 1 line
2.4.3
PATCH 4/11 eal/linux: not allow to enable zero intr efd
In reply to Cunming LiangThe patch adds condition check to avoid enable nothing. In disable state, both max_intr and nb_efd are zero.
--- lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 8 +++++++- lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -82,8 +82,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
lib/librte_eal/linuxapp/eal/eal_interrupts.c +7 -1
@@ -45,6 +45,7 @@#include <sys/signalfd.h> #include <sys/ioctl.h> #include <sys/eventfd.h> +#include <assert.h> #include <rte_common.h> #include <rte_interrupts.h>
@@ -1132,6 +1133,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)int fd;uint32_t n =RTE_MIN (nb_efd, (uint32_t )RTE_MAX_RXTX_INTR_VEC_ID ); +assert (nb_efd !=0 ); +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) {for (i =0 ; i < n; i++) { fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC );
@@ -1188,5 +1191,8 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)int rte_intr_allow_others (struct rte_intr_handle *intr_handle) { -return !!(intr_handle->max_intr - intr_handle->nb_efd); +if (!rte_intr_dp_is_en (intr_handle)) +return 1 ; +else +return !!(intr_handle->max_intr - intr_handle->nb_efd); }
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -176,8 +176,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
Signature · 1 line
2.4.3
PATCH 5/11 eal/linux: add intr api to report multi-vector capability
In reply to Cunming LiangVFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future. Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead a capability api is more flexible for the condition change.
--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 3 files changed, 26 insertions(+)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +9 -0
@@ -1196,3 +1196,12 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)else return !!(intr_handle->max_intr - intr_handle->nb_efd); } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) +return 1 ; + +return 0 ; +}
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -215,4 +215,14 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
lib/librte_eal/linuxapp/eal/rte_eal_version.map +7 -0
@@ -128,3 +128,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
Signature · 1 line
2.4.3
PATCH 6/11 ixgbe: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 45 +++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +31 -14
@@ -1028,6 +1028,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&(pci_dev->intr_handle), + ixgbe_dev_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&(pci_dev->intr_handle)); +/* enable support intr */ ixgbe_enable_intr (eth_dev);
@@ -1704,17 +1711,19 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }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 ); + dev->data->nb_rx_queues *sizeof (int ),0 );if (intr_handle->intr_vec ==NULL ) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec\n" , dev->data->nb_rx_queues);
@@ -1801,20 +1810,22 @@ ixgbe_dev_start(struct rte_eth_dev *dev) skip_link_setup: -/* check if lsc interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - ixgbe_dev_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )ixgbe_dev_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))ixgbe_dev_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1926,6 +1937,12 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)memset (filter_info->fivetuple_mask,0 ,sizeof (uint32_t ) *IXGBE_5TUPLE_ARRAY_SIZE ); +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 5 lines · Cunming Liang
When ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required.
Can you describe the cases/situations where you would want a device to handle interrupts while not started ?
Thanks.
Signature · 1 line
David Marchand
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 12 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of David Marchand
Sent: Monday, November 02, 2015 4:03 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mboxOn Thu, Sep 24, 2015 at 7:33 AM, Cunming Liang <[email protected]> wrote:
Quoted 8 lines
Quoted 5 lines
When ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required.Can you describe the cases/situations where you would want a device to handle interrupts while not started ?
When PF and VF are both controlled by DPDK process(es).
And user doesn't really want to do any RX/TX through PF - uses PF just to control/configure VF(s).
Quoted 5 lines
Thanks.
--
David Marchand
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 20 lines · Konstantin
Quoted 7 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of David Marchand
Sent: Monday, November 02, 2015 4:03 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 06/11] ixgbe: fix rx intr compatibleissue with PF mbox
Quoted 5 lines
Quoted 1 line · Cunming Liang
When ixgbe runs as a PF, mbox interrupt is prerequisite to make VF
start
Quoted 2 lines
Quoted 2 lines
normally.
And PF sometimes won't 'dev_start', so the mbox interrupt registerduring
Quoted 3 lines
Quoted 2 lines
'
dev_init' is required.
Quoted 8 lines
Quoted 2 lines
Can you describe the cases/situations where you would want a device to handle interrupts while not started ?
When PF and VF are both controlled by DPDK process(es).
And user doesn't really want to do any RX/TX through PF - uses PF just to control/configure VF(s).
Ok, but the user still needs to whitelist the PF (or ensure the PF is not blacklisted) in one of these processes.
Then, the application would do a "partial" initialisation ? If you don't want rx/tx, don't poll the port.
Anyway, this is your code :-)
Signature · 1 line
David Marchand
A message that is not in the archive (sent off-list or not yet received): 2601191342CEEE43887BDE71AB97725836AB862D@irsmsx105.ger.corp.intel.com
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 28 lines
From: David Marchand [mailto:[email protected]]
Sent: Monday, November 02, 2015 4:22 PM
To: Ananyev, Konstantin
Cc: Liang, Cunming; [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mboxQuoted 16 lines · Konstantin
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of David Marchand
Sent: Monday, November 02, 2015 4:03 PM
To: Liang, Cunming
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mboxQuoted 5 lines · Cunming Liang
When ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required.
Quoted 7 lines
Quoted 2 lines
Can you describe the cases/situations where you would want a device to handle interrupts while not started ?
When PF and VF are both controlled by DPDK process(es).
And user doesn't really want to do any RX/TX through PF - uses PF just to control/configure VF(s).Ok, but the user still needs to whitelist the PF (or ensure the PF is not blacklisted) in one of these processes.
Yes, at least dev_init() need to be called for that device.
Quoted 1 line
Then, the application would do a "partial" initialisation ?
Yep, sort of.
Quoted 1 line
If you don't want rx/tx, don't poll the port.
Well, the question is why to add an extra restriction here? Probably user deliberately doesn't want to call dev_start() for PF device - as he doesn't plan to use it for RX/TX.
Or might be dev_stop() was called just to do some re-configuration (allow to TX scattered packets on the PF queues or so).
Or dev_start() for PF has not yet been called.
Why VF should stop working properly because of that?
Konstantin
Quoted 5 lines
Anyway, this is your code :-)
--
David Marchand
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 4 lines · Konstantin
Quoted 1 line
If you don't want rx/tx, don't poll the port.
Well, the question is why to add an extra restriction here?
Well, until I start a port, I would expect it to do nothing.
Probably user deliberately doesn't want to call dev_start() for PF device -
Quoted 6 lines
as he doesn't plan to use it for RX/TX.
Or might bedev_stop()was called just to do some re-configuration (allow to TX scattered packets on the PF queues or so). Ordev_start()for PF has not yet been called.
Why VF should stop working properly because of that?
Why not.
Signature · 1 line
David Marchand
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
If you don't want rx/tx, don't poll the port.
Well, the question is why to add an extra restriction here?
Well, until I start a port, I would expect it to do nothing.
Quoted 8 lines
Quoted 6 lines
Probably user deliberately doesn't want to call
dev_start()for PF device - as he doesn't plan to use it for RX/TX.
Or might bedev_stop()was called just to do some re-configuration (allow to TX scattered packets on the PF queues or so).
Ordev_start()for PF has not yet been called.
Why VF should stop working properly because of that?Why not.
I thought I explained it above.
Basically it means that you can't stop your PF without forcing to stop all VFs first. And you can't start any of your VFs without starting PF first.
I think that adds an unnecessary restrictions and limits systems availability quite significantly. Konstantin
Re: [PATCH v1 06/11] ixgbe: fix rx intr compatible issue with PF mbox
Quoted 1 line · Konstantin
Quoted 1 line
Quoted 1 line
Probably user deliberately doesn't want to call
dev_start()for PF
device -
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
as he doesn't plan to use it for RX/TX.
Or might bedev_stop()was called just to do some re-configuration (allow to TX scattered packets on the PF queues or so). Ordev_start()for PF has not yet been called.
Why VF should stop working properly because of that?Why not.
I thought I explained it above.
Sorry wrong choice of words with this "Why not".
I agree with you for this case.
Signature · 1 line
David Marchand
PATCH 7/11 ixgbevf: cleanup unnecessary interrupt handler
In reply to Cunming LiangAs ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 85 +++++----------------------------------- 1 file changed, 10 insertions(+), 75 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +10 -75
@@ -206,8 +206,6 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf/* For Virtual Function support */ static int eth_ixgbevf_dev_init (struct rte_eth_dev *eth_dev);static int eth_ixgbevf_dev_uninit (struct rte_eth_dev *eth_dev); -static int ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev); -static int ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev);static int ixgbevf_dev_configure (struct rte_eth_dev *dev);static int ixgbevf_dev_start (struct rte_eth_dev *dev);static void ixgbevf_dev_stop (struct rte_eth_dev *dev);
@@ -223,8 +221,6 @@ static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);static void ixgbevf_vlan_offload_set (struct rte_eth_dev *dev,int mask);static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on); -static void ixgbevf_dev_interrupt_handler (struct rte_intr_handle *handle, -void *param);static int ixgbevf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
@@ -2670,30 +2666,6 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev) -{ -uint32_t eicr; -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_interrupt *intr = -IXGBE_DEV_PRIVATE_TO_INTR (dev->data->dev_private); - -/* clear all cause mask */ -ixgbevf_intr_disable (hw); - -/* read-on-clear nic registers here */ - eicr =IXGBE_READ_REG (hw,IXGBE_VTEICR ); -PMD_DRV_LOG (INFO ,"eicr %x" , eicr); - - intr->flags =0 ; - -/* set flag for async link update */ -if (eicr &IXGBE_EICR_LSC ) - intr->flags |=IXGBE_FLAG_NEED_LINK_UPDATE ; - -return 0 ; -} -/** * It gets and then prints the link status. *
@@ -2789,18 +2761,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev) -{ -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -PMD_DRV_LOG (DEBUG ,"enable intr immediately" ); -ixgbevf_intr_enable (hw); -rte_intr_enable (&dev->pci_dev->intr_handle); -return 0 ; -} -/** * Interrupt handler which shall be registered for alarm callback for delayed * handling specific interrupt to wait for the stable nic state. As the
@@ -2863,16 +2823,6 @@ ixgbe_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,ixgbe_dev_interrupt_action (dev); } -static void -ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, -void *param) -{ -struct rte_eth_dev *dev = (struct rte_eth_dev *)param; - -ixgbevf_dev_interrupt_get_status (dev); -ixgbevf_dev_interrupt_action (dev); -} -static int ixgbe_dev_led_on (struct rte_eth_dev *dev) {
@@ -3466,11 +3416,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
@@ -3484,16 +3434,6 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) }ixgbevf_configure_msix (dev); -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) -rte_intr_callback_register (intr_handle, - ixgbevf_dev_interrupt_handler, - (void *)dev); -else -PMD_INIT_LOG (INFO ,"lsc won't enable because of" -" no intr multiplex\n" ); - } -rte_intr_enable (intr_handle);/* Re-enable interrupt for VF */
@@ -3539,7 +3479,6 @@ static void ixgbevf_dev_close(struct rte_eth_dev *dev) {struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct rte_pci_device *pci_dev;PMD_INIT_FUNC_TRACE ();
@@ -3551,12 +3490,6 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)/* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar (hw,0 , hw->mac.addr,0 ,IXGBE_RAH_AV ); - - pci_dev = dev->pci_dev; -if (pci_dev->intr_handle.intr_vec) { -rte_free (pci_dev->intr_handle.intr_vec); - pci_dev->intr_handle.intr_vec =NULL ; - } }static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on)
@@ -4082,7 +4015,8 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask |= (1 << queue_id); + mask |= (1 <<MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);rte_intr_enable (&dev->pci_dev->intr_handle);
@@ -4098,7 +4032,8 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask &= ~(1 << queue_id); + mask &= ~(1 <<MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);return 0 ;
@@ -4234,7 +4169,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t q_idx; -uint32_t vector_idx =0 ; +uint32_t vector_idx =MISC_VEC_ID ;/* won't configure msix register if no mapping is done * between intr vector and event fd.
@@ -4251,7 +4186,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) intr_handle->intr_vec[q_idx] = vector_idx; } -/* Configure VF Rx queue ivar */ +/* Configure VF other cause ivar */ ixgbevf_set_ivar_map (hw,-1 ,1 , vector_idx); }
Signature · 1 line
2.4.3
PATCH 8/11 igb: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen igb runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
--- drivers/net/e1000/igb_ethdev.c | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/net/e1000/igb_ethdev.c +31 -13
@@ -651,6 +651,13 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&(pci_dev->intr_handle), + eth_igb_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&(pci_dev->intr_handle)); +/* enable support intr */ igb_intr_enable (eth_dev);
@@ -929,13 +936,16 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + } -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; - -if (rte_intr_dp_is_en (intr_handle)) { +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 );
@@ -1028,20 +1038,22 @@ eth_igb_start(struct rte_eth_dev *dev) }e1000_setup_link (hw); -/* check if lsc interrupt feature is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - eth_igb_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )eth_igb_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))eth_igb_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1134,6 +1146,12 @@ eth_igb_stop(struct rte_eth_dev *dev) } filter_info->twotuple_mask =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH 9/11 i40e: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e PF non-IOV mode.
Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
--- drivers/net/i40e/i40e_ethdev.c | 319 +++++++++++++++++++++++++++++++++++------ drivers/net/i40e/i40e_ethdev.h | 2 + drivers/net/i40e/i40e_pf.c | 2 + 3 files changed, 282 insertions(+), 41 deletions(-)
drivers/net/i40e/i40e_ethdev.c +278 -41
@@ -39,6 +39,7 @@#include <unistd.h> #include <stdarg.h> #include <inttypes.h> +#include <assert.h> #include <rte_string_fns.h> #include <rte_pci.h>
@@ -174,7 +175,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,bool offset_loaded, uint64_t *offset, uint64_t *stat); -static void i40e_pf_config_irq0 (struct i40e_hw *hw); +static void i40e_pf_config_irq0 (struct i40e_hw *hw,int no_queue);static void i40e_dev_interrupt_handler ( __rte_unused struct rte_intr_handle *handle, void *param); static int i40e_res_pool_init(struct i40e_res_pool_info *pool,
@@ -232,6 +233,10 @@ static int i40e_timesync_read_rx_timestamp(struct rte_eth_dev *dev, uint32_t flags);static int i40e_timesync_read_tx_timestamp (struct rte_eth_dev *dev,struct timespec *timestamp); +static int i40e_dev_rx_queue_intr_enable (struct rte_eth_dev *dev, +uint16_t queue_id); +static int i40e_dev_rx_queue_intr_disable (struct rte_eth_dev *dev, +uint16_t queue_id);static const struct rte_pci_id pci_id_i40e_map[] = { #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
@@ -265,6 +270,10 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .tx_queue_start = i40e_dev_tx_queue_start, .tx_queue_stop = i40e_dev_tx_queue_stop, .rx_queue_setup = i40e_dev_rx_queue_setup, +#ifdef RTE_NEXT_ABI + .rx_queue_intr_enable = i40e_dev_rx_queue_intr_enable, + .rx_queue_intr_disable = i40e_dev_rx_queue_intr_disable, +#endif .rx_queue_release = i40e_dev_rx_queue_release, .rx_queue_count = i40e_dev_rx_queue_count, .rx_descriptor_done = i40e_dev_rx_descriptor_done,
@@ -579,7 +588,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) i40e_dev_interrupt_handler, (void *)dev);/* configure and enable device interrupt */ -i40e_pf_config_irq0 (hw); +i40e_pf_config_irq0 (hw,1 );i40e_pf_enable_irq0 (hw);/* enable uio intr after callback register */
@@ -718,6 +727,8 @@ err:void i40e_vsi_queues_unbind_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi);uint16_t msix_vect = vsi->msix_intr;uint16_t i;
@@ -729,15 +740,26 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi) }if (vsi->type !=I40E_VSI_SRIOV ) { -I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ),0 ); -I40E_WRITE_REG (hw,I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , - msix_vect -1 ),0 ); +if (!rte_intr_allow_others (intr_handle)) { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , +I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); +I40E_WRITE_REG (hw, +I40E_PFINT_ITR0 (I40E_ITR_INDEX_DEFAULT ), +0 ); + }else { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), +I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK ); +I40E_WRITE_REG (hw, +I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , + msix_vect -1 ),0 ); + } }else {uint32_t reg; reg = (hw->func_caps.num_msix_vectors_vf -1 ) * vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg),0 ); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_MASK ); }I40E_WRITE_FLUSH (hw); }
@@ -752,29 +774,26 @@ i40e_calc_itr_interval(int16_t interval)return (interval/2 ); } -void -i40e_vsi_queues_bind_intr (struct i40e_vsi *vsi) +static void +__vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect, +int base_queue,int nb_queue) { +int i;uint32_t val;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); -uint16_t msix_vect = vsi->msix_intr; -int i; - -for (i =0 ; i < vsi->nb_qps; i++) -I40E_WRITE_REG (hw,I40E_QINT_TQCTL (vsi->base_queue + i),0 );/* Bind all RX queues to allocated MSIX interrupt */ -for (i =0 ; i < vsi->nb_qps; i++) { +for (i =0 ; i < nb_queue; i++) { val = (msix_vect <<I40E_QINT_RQCTL_MSIX_INDX_SHIFT ) |I40E_QINT_RQCTL_ITR_INDX_MASK | - ((vsi->base_queue + i +1 ) << -I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | + ((base_queue + i +1 ) << +I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | (0 <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) |I40E_QINT_RQCTL_CAUSE_ENA_MASK ; -if (i == vsi->nb_qps -1 ) +if (i == nb_queue -1 ) val |=I40E_QINT_RQCTL_NEXTQ_INDX_MASK ; -I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i), val); +I40E_WRITE_REG (hw,I40E_QINT_RQCTL (base_queue + i), val); }/* Write first RX queue to Link list register as the head element */
@@ -782,13 +801,26 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)uint16_t interval =i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ); -I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), - (vsi->base_queue << -I40E_PFINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); - -I40E_WRITE_REG (hw,I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , - msix_vect -1 ), interval); +if (msix_vect ==MISC_VEC_ID ) { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , + (base_queue << +I40E_PFINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_PFINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw, +I40E_PFINT_ITR0 (I40E_ITR_INDEX_DEFAULT ), + interval); + }else { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), + (base_queue << +I40E_PFINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw, +I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , + msix_vect -1 ), + interval); + }#ifndef I40E_GLINT_CTL #define I40E_GLINT_CTL 0x0003F800
@@ -796,7 +828,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)#endif /* Disable auto-mask on enabling of all none-zero interrupt */ I40E_WRITE_REG (hw,I40E_GLINT_CTL , -I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK ); +I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK ); }else {uint32_t reg;
@@ -804,34 +836,117 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi) reg = (hw->func_caps.num_msix_vectors_vf -1 ) * vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (vsi->base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); }I40E_WRITE_FLUSH (hw); } +void +i40e_vsi_queues_bind_intr (struct i40e_vsi *vsi) +{ +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +uint16_t msix_vect = vsi->msix_intr; +uint16_t nb_msix =RTE_MIN (vsi->nb_msix, intr_handle->nb_efd); +uint16_t queue_idx =0 ; +int record =0 ; +int i; + +for (i =0 ; i < vsi->nb_qps; i++) { +I40E_WRITE_REG (hw,I40E_QINT_TQCTL (vsi->base_queue + i),0 ); +I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i),0 ); + } + +if (rte_intr_dp_is_en (intr_handle)) { +if (vsi->type ==I40E_VSI_MAIN ) { + queue_idx =0 ; + record =1 ; + }else if (vsi->type ==I40E_VSI_VMDQ2 ) { +struct i40e_vsi *main_vsi = +I40E_DEV_PRIVATE_TO_MAIN_VSI (vsi->adapter); + queue_idx = vsi->base_queue - main_vsi->nb_qps; + record =1 ; + } + } + +for (i =0 ; i < vsi->nb_used_qps; i++) { +if (nb_msix <=1 ) { +if (!rte_intr_allow_others (intr_handle)) +/* allow to share MISC_VEC_ID */ + msix_vect =MISC_VEC_ID ; + +/* no enough msix_vect, map all to one */ +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue + i, + vsi->nb_used_qps - i); +for (; !!record && i < vsi->nb_used_qps; i++) + intr_handle->intr_vec[queue_idx + i] = + msix_vect; +break ; + } +/* 1:1 queue/msix_vect mapping */ +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue + i,1 ); +if (!!record) + intr_handle->intr_vec[queue_idx + i] = msix_vect; + + msix_vect++; + nb_msix--; + } +} +static void i40e_vsi_enable_queues_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi);uint16_t interval =i40e_calc_itr_interval (\ -RTE_LIBRTE_I40E_ITR_INTERVAL ); +RTE_LIBRTE_I40E_ITR_INTERVAL ); +uint16_t msix_intr, i; + +if (!rte_intr_allow_others (intr_handle)) { +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTL0_INTENA_MASK | +I40E_PFINT_DYN_CTL0_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTL0_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTL0_INTERVAL_SHIFT )); +return ; + } -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (vsi->msix_intr -1 ), -I40E_PFINT_DYN_CTLN_INTENA_MASK | -I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | - (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | - (interval <<I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); +for (i =0 ; i < vsi->nb_msix; i++) { + msix_intr = vsi->msix_intr + i; +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ), +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); + } }static void i40e_vsi_disable_queues_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +uint16_t msix_intr, i; -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (vsi->msix_intr -1 ),0 ); +if (!rte_intr_allow_others (intr_handle)) { +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); +return ; + } + +for (i =0 ; i < vsi->nb_msix; i++) { + msix_intr = vsi->msix_intr + i; +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ),0 ); + } } static inline uint8_t
@@ -941,6 +1056,8 @@ i40e_dev_start(struct rte_eth_dev *dev)struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vsi *main_vsi = pf->main_vsi;int ret, i; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +uint32_t intr_vector =0 ; hw->adapter_stopped =0 ;
@@ -952,6 +1069,29 @@ i40e_dev_start(struct rte_eth_dev *dev)return -EINVAL ; } +rte_intr_disable (intr_handle); + +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { + intr_vector = dev->data->nb_rx_queues; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + } + +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) { +PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" +" intr_vec\n" , dev->data->nb_rx_queues); +return -ENOMEM ; + } + } +/* Initialize VSI */ ret =i40e_dev_rxtx_init (pf);if (ret !=I40E_SUCCESS ) {
@@ -960,11 +1100,14 @@ i40e_dev_start(struct rte_eth_dev *dev) }/* Map queues with MSIX interrupt */ + main_vsi->nb_used_qps = dev->data->nb_rx_queues - + pf->nb_cfg_vmdq_vsi *RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM ;i40e_vsi_queues_bind_intr (main_vsi);i40e_vsi_enable_queues_intr (main_vsi);/* Map VMDQ VSI queues with MSIX interrupt */ for (i =0 ; i < pf->nb_cfg_vmdq_vsi; i++) { + pf->vmdq[i].vsi->nb_used_qps =RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM ;i40e_vsi_queues_bind_intr (pf->vmdq[i].vsi);i40e_vsi_enable_queues_intr (pf->vmdq[i].vsi); }
@@ -1001,6 +1144,22 @@ i40e_dev_start(struct rte_eth_dev *dev) goto err_up; } +if (!rte_intr_allow_others (intr_handle)) { +rte_intr_callback_unregister (intr_handle, + i40e_dev_interrupt_handler, + (void *)dev); +/* configure and enable device interrupt */ +i40e_pf_config_irq0 (hw,0 ); +i40e_pf_enable_irq0 (hw); + +if (dev->data->dev_conf.intr_conf.lsc !=0 ) +PMD_INIT_LOG (INFO ,"lsc won't enable because of" +" no intr multiplex\n" ); + } + +/* enable uio intr after callback register */ +rte_intr_enable (intr_handle); +return I40E_SUCCESS ; err_up:
@@ -1016,6 +1175,7 @@ i40e_dev_stop(struct rte_eth_dev *dev)struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);struct i40e_vsi *main_vsi = pf->main_vsi;struct i40e_mirror_rule *p_mirror; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;int i;/* Disable all queues */
@@ -1047,6 +1207,18 @@ i40e_dev_stop(struct rte_eth_dev *dev) } pf->nb_mirror_rule =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + i40e_dev_interrupt_handler, + (void *)dev); + +/* Clean datapath event and queue/vec mapping */ +rte_intr_efd_disable (intr_handle); +if (intr_handle->intr_vec) { +rte_free (intr_handle->intr_vec); + intr_handle->intr_vec =NULL ; + } } static void
@@ -3073,15 +3245,30 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->base_queue =I40E_FDIR_QUEUE_ID ;/* VF has MSIX interrupt in VF range, don't allocate here */ -if (type !=I40E_VSI_SRIOV ) { +if (type ==I40E_VSI_MAIN ) { + ret =i40e_res_pool_alloc (&pf->msix_pool, +RTE_MIN (vsi->nb_qps, +RTE_MAX_RXTX_INTR_VEC_ID )); +if (ret <0 ) { +PMD_DRV_LOG (ERR ,"VSI MAIN %d get heap failed %d" , + vsi->seid, ret); + goto fail_queue_alloc; + } + vsi->msix_intr = ret; + vsi->nb_msix =RTE_MIN (vsi->nb_qps,RTE_MAX_RXTX_INTR_VEC_ID ); + }else if (type !=I40E_VSI_SRIOV ) { ret =i40e_res_pool_alloc (&pf->msix_pool,1 );if (ret <0 ) {PMD_DRV_LOG (ERR ,"VSI %d get heap failed %d" , vsi->seid, ret); goto fail_queue_alloc; } vsi->msix_intr = ret; - }else + vsi->nb_msix =1 ; + }else { vsi->msix_intr =0 ; + vsi->nb_msix =0 ; + } +/* Add VSI */ if (type ==I40E_VSI_MAIN ) {/* For main VSI, no need to add since it's default one */
@@ -3919,7 +4106,7 @@ i40e_pf_enable_irq0(struct i40e_hw *hw) }static void -i40e_pf_config_irq0 (struct i40e_hw *hw) +i40e_pf_config_irq0 (struct i40e_hw *hw,int no_queue) {/* read pending request and disable first */ i40e_pf_disable_irq0 (hw);
@@ -3927,9 +4114,10 @@ i40e_pf_config_irq0(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_PFINT_STAT_CTL0 ,I40E_PFINT_STAT_CTL0_OTHER_ITR_INDX_MASK ); -/* Link no queues with irq0 */ -I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , -I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); +if (no_queue) +/* Link no queues with irq0 */ +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , +I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); } static void
@@ -6298,3 +6486,52 @@ i40e_timesync_read_tx_timestamp(struct rte_eth_dev *dev,return 0 ; } + +static int +i40e_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id) +{ +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint16_t interval = +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ); +uint16_t msix_intr; + + msix_intr = intr_handle->intr_vec[queue_id]; +if (msix_intr ==MISC_VEC_ID ) +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); +else +I40E_WRITE_REG (hw, +I40E_PFINT_DYN_CTLN (msix_intr -RX_VEC_START ), +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); + +rte_intr_enable (&dev->pci_dev->intr_handle); + +return 0 ; +} + +static int +i40e_dev_rx_queue_intr_disable (struct rte_eth_dev *dev,uint16_t queue_id) +{ +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint16_t msix_intr; + + msix_intr = intr_handle->intr_vec[queue_id]; +if (msix_intr ==MISC_VEC_ID ) +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); +else +I40E_WRITE_REG (hw, +I40E_PFINT_DYN_CTLN (msix_intr -RX_VEC_START ), +0 ); + +return 0 ; +}
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -235,6 +235,7 @@ struct i40e_vsi {uint16_t seid;/* The seid of VSI itself */ uint16_t uplink_seid;/* The uplink seid of this VSI */ uint16_t nb_qps;/* Number of queue pairs VSI can occupy */ +uint16_t nb_used_qps;/* Number of queue pairs VSI uses */ uint16_t max_macaddrs;/* Maximum number of MAC addresses */ uint16_t base_queue;/* The first queue index of this VSI */ /*
@@ -243,6 +244,7 @@ struct i40e_vsi {*/ uint16_t vsi_id;uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ +uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ };
drivers/net/i40e/i40e_pf.c +2 -0
@@ -554,6 +554,8 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps;/* Don't care how the TX/RX queue mapping with this vector. * Link all VF RX queues together. Only did mapping work.
Signature · 1 line
2.4.3
PATCH 10/11 i40evf: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF. On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition.
On VF side, one single vector is shared for all the rx queues.
--- drivers/net/i40e/i40e_ethdev.c | 46 +++++++------ drivers/net/i40e/i40e_ethdev.h | 15 ++++ drivers/net/i40e/i40e_ethdev_vf.c | 141 ++++++++++++++++++++++++++++++++++---- drivers/net/i40e/i40e_pf.c | 5 -- 4 files changed, 169 insertions(+), 38 deletions(-)
drivers/net/i40e/i40e_ethdev.c +25 -21
@@ -75,11 +75,6 @@/* Maximun number of VSI */ #define I40E_MAX_NUM_VSIS (384UL) -/* Default queue interrupt throttling time in microseconds */ -#define I40E_ITR_INDEX_DEFAULT 0 -#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ -#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ -#define I40E_PRE_TX_Q_CFG_WAIT_US 10/* 10 us */ /* Mask of PF interrupt causes */
@@ -764,16 +759,6 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)I40E_WRITE_FLUSH (hw); } -static inline uint16_t -i40e_calc_itr_interval (int16_t interval) -{ -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; - -/* Convert to hardware count, as writing each 1 represents 2 us */ -return (interval/2 ); -} -static void __vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect,int base_queue,int nb_queue)
@@ -832,13 +817,24 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, }else {uint32_t reg; -/* num_msix_vectors_vf needs to minus irq0 */ - reg = (hw->func_caps.num_msix_vectors_vf -1 ) * - vsi->user_param + (msix_vect -1 ); +if (msix_vect ==MISC_VEC_ID ) { +I40E_WRITE_REG (hw, +I40E_VPINT_LNKLST0 (vsi->user_param), + (base_queue << +I40E_VPINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); + }else { +/* num_msix_vectors_vf needs to minus irq0 */ + reg = (hw->func_caps.num_msix_vectors_vf -1 ) * + vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), + (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); + } }I40E_WRITE_FLUSH (hw);
@@ -861,6 +857,14 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i),0 ); } +/* VF bind interrupt */ +if (vsi->type ==I40E_VSI_SRIOV ) { +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue, vsi->nb_qps); +return ; + } + +/* PF & VMDq bind interrupt */ if (rte_intr_dp_is_en (intr_handle)) {if (vsi->type ==I40E_VSI_MAIN ) { queue_idx =0 ;
drivers/net/i40e/i40e_ethdev.h +15 -0
@@ -151,6 +151,11 @@ enum i40e_flxpld_layer_idx { (1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD)) +/* Default queue interrupt throttling time in microseconds */ +#define I40E_ITR_INDEX_DEFAULT 0 +#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ +#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ +struct i40e_adapter ;/**
@@ -573,6 +578,16 @@ i40e_align_floor(int n)return 1 << (sizeof (n) *CHAR_BIT -1 -__builtin_clz (n)); } +static inline uint16_t +i40e_calc_itr_interval (int16_t interval) +{ +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + +/* Convert to hardware count, as writing each 1 represents 2 us */ +return (interval /2 ); +} +#define I40E_VALID_FLOW (flow_type) \ ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
drivers/net/i40e/i40e_ethdev_vf.c +129 -12
211 lines not on this page · raw message
drivers/net/i40e/i40e_pf.c +0 -5
@@ -547,11 +547,6 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -if (irqmap->vecmap[0 ].vector_id ==0 ) { -PMD_DRV_LOG (ERR ,"DPDK host don't support use IRQ0" ); - ret =I40E_ERR_PARAM ; - goto send_msg; - }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; vf->vsi->nb_msix = irqmap->num_vectors;
Signature · 1 line
2.4.3
PATCH 11/11 doc: release note update for intr mode
In reply to Cunming Liang--- doc/guides/rel_notes/release_2_2.rst | 2 ++ 1 file changed, 2 insertions(+)
doc/guides/rel_notes/release_2_2.rst +2 -0
@@ -4,10 +4,12 @@ DPDK Release 2.2 New Features ------------ +* Support interrupt mode on i40e Resolved Issues --------------- +* Fix ixgbe/igb rx interrupt compatible issue with mbox Known Issues ------------
Signature · 1 line
2.4.3
v2 cover interrupt mode for i40e
In reply to Cunming Liangv2 change:
- rebase code base
- rework to depend on one previous patch
patch http://dpdk.org/dev/patchwork/patch/7504/
- always set DIS_AUTOMASK_* bit in PF to avoid ENA flag auto-clear
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping
2. add api to declare the capability of multiple interrupt vector support
3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF
4. add rx interrupt support in i40e PF and VF
Cunming Liang (11):
eal/linux: vfio map misc intr to vector zero
ixgbe: reserve intr vector zero for misc cause
igb: reserve intr vector zero for misc cause eal/linux: not allow to enable zero intr efd eal/linux: add intr api to report multi-vector capability
ixgbe: fix rx intr compatible issue with PF mbox
ixgbevf: cleanup unnecessary interrupt handler
igb: fix rx intr compatible issue with PF mbox
i40e: add rx interrupt support
i40evf: add rx interrupt support
doc: release note update for intr mode
doc/guides/rel_notes/release_2_2.rst | 4 + drivers/net/e1000/igb_ethdev.c | 63 +++- drivers/net/i40e/i40e_ethdev.c | 374 +++++++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 17 + drivers/net/i40e/i40e_ethdev_vf.c | 143 +++++++- drivers/net/i40e/i40e_pf.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 144 +++----- .../bsdapp/eal/include/exec-env/rte_interrupts.h | 3 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 35 +- .../linuxapp/eal/include/exec-env/rte_interrupts.h | 16 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 + 11 files changed, 612 insertions(+), 201 deletions(-)
Signature · 1 line
2.4.3
PATCH v2 1/11 eal/linux: vfio map misc intr to vector zero
During VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ... Qn_fd, misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd, Q0_fd, ... Qn_fd}, always reserve the first vector to misc interrupt.
--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 18 ++++++++++++------ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +12 -6
@@ -300,8 +300,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) { irq_set->index =VFIO_PCI_MSIX_IRQ_INDEX ; irq_set->start =0 ; fd_ptr = (int *) &irq_set->data; -memcpy (fd_ptr, intr_handle->efds,sizeof (intr_handle->efds)); - fd_ptr[intr_handle->max_intr -1 ] = intr_handle->fd; + fd_ptr[MISC_VEC_ID ] = intr_handle->fd; +/* follow up with misc(0) interrupt */ +memcpy (&fd_ptr[RX_VEC_START ], intr_handle->efds, +sizeof (*intr_handle->efds) * intr_handle->nb_efd); ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);
@@ -1068,10 +1070,13 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,struct rte_epoll_event *rev;struct rte_epoll_data *epdata;int epfd_op; +unsigned int efd_idx;int rc =0 ; + efd_idx = (vec >=RX_VEC_START ) ? (vec -RX_VEC_START ) : vec; +if (!intr_handle || intr_handle->nb_efd ==0 || - vec >= intr_handle->nb_efd) { + efd_idx >= intr_handle->nb_efd) {RTE_LOG (ERR ,EAL ,"Wrong intr vector number.\n" );return -EPERM ; }
@@ -1079,7 +1084,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,switch (op) {case RTE_INTR_EVENT_ADD : epfd_op =EPOLL_CTL_ADD ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status !=RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event already been added.\n" );return -EEXIST ;
@@ -1091,7 +1096,8 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, epdata->data = data; epdata->cb_fun = (rte_intr_event_cb_t )eal_intr_proc_rxtx_intr; epdata->cb_arg = (void *)intr_handle; - rc =rte_epoll_ctl (epfd, epfd_op, intr_handle->efds[vec], rev); + rc =rte_epoll_ctl (epfd, epfd_op, + intr_handle->efds[efd_idx], rev);if (!rc)RTE_LOG (DEBUG ,EAL , "efd %d associated with vec %d added on epfd %d"
@@ -1101,7 +1107,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,break ;case RTE_INTR_EVENT_DEL : epfd_op =EPOLL_CTL_DEL ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status ==RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event does not exist.\n" );return -EPERM ;
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +3 -0
@@ -77,6 +77,9 @@ struct rte_epoll_event {struct rte_epoll_data epdata; }; +#define MISC_VEC_ID (0) +#define RX_VEC_START (MISC_VEC_ID + 1) +/** Handle for interrupts. */ struct rte_intr_handle { union {
Signature · 1 line
2.4.3
Re: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
Quoted 8 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
Quoted 8 lines
During
VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ...Qn_fd,misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd,Q0_fd, ...Qn_fd}, always reserve the first vector to misc interrupt.Signed-off-by Cunming Liang <[email protected]>
Re: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
In reply to Cunming LiangQuoted 9 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
Quoted 7 lines
During
VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ...Qn_fd,misc_fd}. The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd,Q0_fd, ...Qn_fd}, always reserve the first vector to misc interrupt.Signed-off-by Cunming Liang <[email protected]>
Re: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
In reply to Cunming LiangHi David,
May I ask your help to review the patch related to eal ?
Thanks,
Steve
Quoted 103 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zeroDuring
VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ...Qn_fd,misc_fd}. The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd,Q0_fd, ...Qn_fd}, always reserve the first vector to misc interrupt.Signed-off-by Cunming Liang <[email protected]>--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 18 ++++++++++++------ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 3 +++ 2 files changed, 15 insertions(+), 6 deletions(-)lib/librte_eal/linuxapp/eal/eal_interrupts.c +8
-3@@ -300,8 +300,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) { irq_set->index =VFIO_PCI_MSIX_IRQ_INDEX ; irq_set->start =0 ; fd_ptr = (int *) &irq_set->data; -memcpy (fd_ptr, intr_handle->efds,sizeof (intr_handle->efds)); - fd_ptr[intr_handle->max_intr -1 ] = intr_handle->fd; + fd_ptr[MISC_VEC_ID ] = intr_handle->fd; +/* follow up with misc(0) interrupt */ +memcpy (&fd_ptr[RX_VEC_START ], intr_handle->efds, +sizeof (*intr_handle->efds) * intr_handle->nb_efd); ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);@@ -1068,10 +1070,13 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,int epfd, struct rte_epoll_event *rev;struct rte_epoll_data *epdata;int epfd_op; +unsigned int efd_idx;int rc =0 ; + efd_idx = (vec >=RX_VEC_START ) ? (vec -RX_VEC_START ) : vec; +if (!intr_handle || intr_handle->nb_efd ==0 || - vec >= intr_handle->nb_efd) { + efd_idx >= intr_handle->nb_efd) {RTE_LOG (ERR ,EAL ,"Wrong intr vector number.\n" );return -EPERM ;lib/librte_eal/linuxapp/eal/eal_interrupts.c +1
-1}@@ -1079,7 +1084,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, switch (op) {case RTE_INTR_EVENT_ADD : epfd_op =EPOLL_CTL_ADD ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status !=RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event already been added.\n" );lib/librte_eal/linuxapp/eal/eal_interrupts.c +2
-1return -EEXIST ;@@ -1091,7 +1096,8 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,int epfd, epdata->data = data; epdata->cb_fun = (rte_intr_event_cb_t )eal_intr_proc_rxtx_intr; epdata->cb_arg = (void *)intr_handle; - rc =rte_epoll_ctl (epfd, epfd_op, intr_handle->efds[vec], rev); + rc =rte_epoll_ctl (epfd, epfd_op, + intr_handle->efds[efd_idx], rev);if (!rc) RTE_LOG(DEBUG, EAL,lib/librte_eal/linuxapp/eal/eal_interrupts.c +1
-1"efd %d associated with vec %d added on epfd %d" @@ -1101,7 +1107,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,int epfd, break;case RTE_INTR_EVENT_DEL : epfd_op =EPOLL_CTL_DEL ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status ==RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event does not exist.\n" );lib/librte_eal/linuxapp/eal/eal_interrupts.c +0
-0return -EPERM ;lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +3
-1@@ -77,6 +77,9 @@ struct rte_epoll_event {struct rte_epoll_data epdata; }; +#define MISC_VEC_ID (0) +#define RX_VEC_START (MISC_VEC_ID + 1) +/** Handle for interrupts. */ struct rte_intr_handle { union { --2.4.3
Re: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
In reply to Cunming LiangHello,
On Fri, Oct 30, 2015 at 6:27 AM, Cunming Liang <[email protected]> wrote:
[snip]
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h struct rte_epoll_event { · line 81
Quoted 11 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +1
-0@@ -77,6 +77,9 @@ struct rte_epoll_event {struct rte_epoll_data epdata; }; +#define MISC_VEC_ID (0)
"misc" is not really descriptive ...
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h struct rte_epoll_event {
Quoted 3 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2
-0+#define RX_VEC_START (MISC_VEC_ID + 1) +
Please, prefix these macros properly.
Else, when looking at the driver code, this kind of macros seems to be local to the driver.
Signature · 1 line
David Marchand
Re: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero
Hi David,
Quoted 20 lines · David Marchand
Hello,
On Fri, Oct 30, 2015 at 6:27 AM, Cunming Liang <[email protected]> wrote:
[snip]lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h struct rte_epoll_event { · line 81
Quoted 11 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +1
-0@@ -77,6 +77,9 @@ struct rte_epoll_event {struct rte_epoll_data epdata; }; +#define MISC_VEC_ID (0)"misc" is not really descriptive ...
Quoted 8 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h struct rte_epoll_event {
Quoted 3 lines
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2
-0+#define RX_VEC_START (MISC_VEC_ID + 1) +Please, prefix these macros properly.
Else, when looking at the driver code, this kind of macros seems to be local to the driver.
That makes sense, will fix it in v3. Thanks. /Steve
v3 cover interrupt mode for i40e
In reply to Cunming Liangv3 change:
- rename MISC_VEC_ID and RX_VEC_START
- add bsdapp dummy
- split cleanup and fix patches
- merge doc update along with code change
v2 change:
- rework to depend on one previous patch
patch http://dpdk.org/dev/patchwork/patch/7504/
- always set DIS_AUTOMASK_* bit in PF to avoid ENA flag auto-clear
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping
2. add api to declare the capability of multiple interrupt vector support
3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF
4. add rx interrupt support in i40e PF and VF
Cunming Liang (13):
eal: vfio map misc intr to vector zero
ixgbe: reserve intr vector zero for misc cause
igb: reserve intr vector zero for misc cause eal/linux: not allow to enable zero intr efd
ixgbe: fix efd_enable with zero number
igb: fix efd_enable with zero number
eal: add intr api to report multi-vector capability
ixgbe: fix rx intr compatible issue with PF mbox
ixgbe: fix unnecessary intr_vec free in dev_close
ixgbevf: cleanup unnecessary interrupt handler
igb: fix rx intr compatible issue with PF mbox
i40e: add rx interrupt support
i40evf: add rx interrupt support
doc/guides/rel_notes/release_2_2.rst | 5 + drivers/net/e1000/e1000_ethdev.h | 3 + drivers/net/e1000/igb_ethdev.c | 63 +++- drivers/net/i40e/i40e_ethdev.c | 379 +++++++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 20 ++ drivers/net/i40e/i40e_ethdev_vf.c | 144 +++++++- drivers/net/i40e/i40e_pf.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 144 +++----- drivers/net/ixgbe/ixgbe_ethdev.h | 3 + lib/librte_eal/bsdapp/eal/eal_interrupts.c | 7 + .../bsdapp/eal/include/exec-env/rte_interrupts.h | 16 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 + lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 +- .../linuxapp/eal/include/exec-env/rte_interrupts.h | 15 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 + 15 files changed, 654 insertions(+), 202 deletions(-)
Signature · 1 line
2.4.3
PATCH v3 1/13 eal: vfio map misc intr to vector zero
During VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ... Qn_fd, misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd, Q0_fd, ... Qn_fd}, always reserve the first vector to misc interrupt.
v3 changes:
- rename MISC_VEC_ID to RTE_INTR_VEC_ZERO_OFFSET
- rename RX_VEC_START to RTE_INTR_VEC_RXTX_OFFSET
- add macro definition in bsd header file
--- .../bsdapp/eal/include/exec-env/rte_interrupts.h | 3 +++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 19 +++++++++++++------ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +3 -0
@@ -38,6 +38,9 @@#ifndef _RTE_BSDAPP_INTERRUPTS_H_#define _RTE_BSDAPP_INTERRUPTS_H_ +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 +enum rte_intr_handle_type {RTE_INTR_HANDLE_UNKNOWN =0 , RTE_INTR_HANDLE_UIO, /**< uio device handle */
lib/librte_eal/linuxapp/eal/eal_interrupts.c +13 -6
@@ -301,8 +301,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) { irq_set->index =VFIO_PCI_MSIX_IRQ_INDEX ; irq_set->start =0 ; fd_ptr = (int *) &irq_set->data; -memcpy (fd_ptr, intr_handle->efds,sizeof (intr_handle->efds)); - fd_ptr[intr_handle->max_intr -1 ] = intr_handle->fd; +/* INTR vector offset 0 reserve for non-efds mapping */ + fd_ptr[RTE_INTR_VEC_ZERO_OFFSET ] = intr_handle->fd; +memcpy (&fd_ptr[RTE_INTR_VEC_RXTX_OFFSET ], intr_handle->efds, +sizeof (*intr_handle->efds) * intr_handle->nb_efd); ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);
@@ -1083,10 +1085,14 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,struct rte_epoll_event *rev;struct rte_epoll_data *epdata;int epfd_op; +unsigned int efd_idx;int rc =0 ; + efd_idx = (vec >=RTE_INTR_VEC_RXTX_OFFSET ) ? + (vec -RTE_INTR_VEC_RXTX_OFFSET ) : vec; +if (!intr_handle || intr_handle->nb_efd ==0 || - vec >= intr_handle->nb_efd) { + efd_idx >= intr_handle->nb_efd) {RTE_LOG (ERR ,EAL ,"Wrong intr vector number.\n" );return -EPERM ; }
@@ -1094,7 +1100,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,switch (op) {case RTE_INTR_EVENT_ADD : epfd_op =EPOLL_CTL_ADD ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status !=RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event already been added.\n" );return -EEXIST ;
@@ -1106,7 +1112,8 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, epdata->data = data; epdata->cb_fun = (rte_intr_event_cb_t )eal_intr_proc_rxtx_intr; epdata->cb_arg = (void *)intr_handle; - rc =rte_epoll_ctl (epfd, epfd_op, intr_handle->efds[vec], rev); + rc =rte_epoll_ctl (epfd, epfd_op, + intr_handle->efds[efd_idx], rev);if (!rc)RTE_LOG (DEBUG ,EAL , "efd %d associated with vec %d added on epfd %d"
@@ -1116,7 +1123,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,break ;case RTE_INTR_EVENT_DEL : epfd_op =EPOLL_CTL_DEL ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status ==RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event does not exist.\n" );return -EPERM ;
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -0
@@ -39,6 +39,8 @@#define _RTE_LINUXAPP_INTERRUPTS_H_#define RTE_MAX_RXTX_INTR_VEC_ID 32 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1enum rte_intr_handle_type {RTE_INTR_HANDLE_UNKNOWN =0 ,
Signature · 1 line
2.4.3
PATCH v3 2/13 ixgbe: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
v3 changes:
- macro renaming according to the EAL change
--- drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++++++++++++++-------- drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 2 files changed, 17 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +14 -8
@@ -4478,7 +4478,8 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask |= (1 << queue_id); + mask |= (1 <<IXGBE_MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);rte_intr_enable (&dev->pci_dev->intr_handle);
@@ -4494,7 +4495,8 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask &= ~(1 << queue_id); + mask &= ~(1 <<IXGBE_MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);return 0 ;
@@ -4630,7 +4632,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t q_idx; -uint32_t vector_idx =0 ; +uint32_t vector_idx =IXGBE_MISC_VEC_ID ;/* won't configure msix register if no mapping is done * between intr vector and event fd.
@@ -4662,7 +4664,8 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t queue_id, vec =0 ; +uint32_t queue_id, base =IXGBE_MISC_VEC_ID ; +uint32_t vec =IXGBE_MISC_VEC_ID ;uint32_t mask;uint32_t gpie;
@@ -4672,6 +4675,9 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) + vec = base =IXGBE_RX_VEC_START ; +/* setup GPIE for MSI-x mode */ gpie =IXGBE_READ_REG (hw,IXGBE_GPIE ); gpie |= IXGBE_GPIE_MSIX_MODE | IXGBE_GPIE_PBA_SUPPORT |
@@ -4695,23 +4701,23 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)/* by default, 1:1 mapping */ ixgbe_set_ivar_map (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }switch (hw->mac.type) {case ixgbe_mac_82598EB:ixgbe_set_ivar_map (hw,-1 ,IXGBE_IVAR_OTHER_CAUSES_INDEX , - intr_handle->max_intr -1 ); +IXGBE_MISC_VEC_ID );break ;case ixgbe_mac_82599EB:case ixgbe_mac_X540: -ixgbe_set_ivar_map (hw,-1 ,1 , intr_handle->max_intr -1 ); +ixgbe_set_ivar_map (hw,-1 ,1 ,IXGBE_MISC_VEC_ID );break ;default :break ; } -IXGBE_WRITE_REG (hw,IXGBE_EITR (queue_id), +IXGBE_WRITE_REG (hw,IXGBE_EITR (IXGBE_MISC_VEC_ID ),IXGBE_MIN_INTER_INTERRUPT_INTERVAL_DEFAULT &0xFFF );/* set up to autoclear timer, and the vectors */
drivers/net/ixgbe/ixgbe_ethdev.h +3 -0
@@ -123,6 +123,9 @@#define IXGBE_VF_IRQ_ENABLE_MASK 3/* vf irq enable mask */ #define IXGBE_VF_MAXMSIVECTOR 1 +#define IXGBE_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define IXGBE_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* * Information about the fdir mode. */
Signature · 1 line
2.4.3
PATCH v3 3/13 igb: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
v3 change:
- macro renaming according to the EAL change
--- drivers/net/e1000/e1000_ethdev.h | 3 +++ drivers/net/e1000/igb_ethdev.c | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/e1000/e1000_ethdev.h +3 -0
@@ -132,6 +132,9 @@#define EM_RXD_ALIGN (E1000_ALIGN / sizeof(struct e1000_rx_desc))#define EM_TXD_ALIGN (E1000_ALIGN / sizeof(struct e1000_data_desc)) +#define E1000_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define E1000_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* structure for interrupt relative data */ struct e1000_interrupt {uint32_t flags;
drivers/net/e1000/igb_ethdev.c +14 -5
@@ -4495,7 +4495,10 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)uint32_t tmpval, regval, intr_mask;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vec =0 ; +uint32_t vec =E1000_MISC_VEC_ID ; +uint32_t base =E1000_MISC_VEC_ID ; +uint32_t misc_shift =0 ; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;/* won't configure msix register if no mapping is done
@@ -4504,6 +4507,11 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) { + vec = base =E1000_RX_VEC_START ; + misc_shift =1 ; + } +/* set interrupt vector for other causes */ if (hw->mac.type == e1000_82575) { tmpval =E1000_READ_REG (hw,E1000_CTRL_EXT );
@@ -4532,8 +4540,8 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)E1000_WRITE_REG (hw,E1000_GPIE ,E1000_GPIE_MSIX_MODE |E1000_GPIE_PBA |E1000_GPIE_EIAME |E1000_GPIE_NSICR ); - - intr_mask = (1 << intr_handle->max_intr) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAC );E1000_WRITE_REG (hw,E1000_EIAC , regval | intr_mask);
@@ -4547,14 +4555,15 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)/* use EIAM to auto-mask when MSI-X interrupt * is asserted, this saves a register write for every interrupt */ - intr_mask = (1 << intr_handle->nb_efd) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAM );E1000_WRITE_REG (hw,E1000_EIAM , regval | intr_mask);for (queue_id =0 ; queue_id < dev->data->nb_rx_queues; queue_id++) {eth_igb_assign_msix_vector (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }
Signature · 1 line
2.4.3
PATCH v3 4/13 eal/linux: not allow to enable zero intr efd
In reply to Cunming LiangThe patch adds condition check to avoid enable nothing. In disable state, both max_intr and nb_efd are zero.
--- lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 8 +++++++- lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -85,8 +85,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
lib/librte_eal/linuxapp/eal/eal_interrupts.c +7 -1
@@ -45,6 +45,7 @@#include <sys/signalfd.h> #include <sys/ioctl.h> #include <sys/eventfd.h> +#include <assert.h> #include <rte_common.h> #include <rte_interrupts.h>
@@ -1148,6 +1149,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)int fd;uint32_t n =RTE_MIN (nb_efd, (uint32_t )RTE_MAX_RXTX_INTR_VEC_ID ); +assert (nb_efd !=0 ); +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) {for (i =0 ; i < n; i++) { fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC );
@@ -1204,5 +1207,8 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)int rte_intr_allow_others (struct rte_intr_handle *intr_handle) { -return !!(intr_handle->max_intr - intr_handle->nb_efd); +if (!rte_intr_dp_is_en (intr_handle)) +return 1 ; +else +return !!(intr_handle->max_intr - intr_handle->nb_efd); }
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -176,8 +176,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
Signature · 1 line
2.4.3
PATCH v3 5/13 ixgbe: fix efd_enable with zero number
In reply to Cunming Liang--- drivers/net/ixgbe/ixgbe_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +8 -8
@@ -1975,11 +1975,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
@@ -3862,11 +3862,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
Signature · 1 line
2.4.3
PATCH v3 6/13 igb: fix efd_enable with zero number
In reply to Cunming Liang--- drivers/net/e1000/igb_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/e1000/igb_ethdev.c +4 -4
@@ -1122,11 +1122,11 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle)) { intr_handle->intr_vec =
Signature · 1 line
2.4.3
PATCH v3 7/13 eal: add intr api to report multi-vector capability
In reply to Cunming LiangVFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future. Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead a capability api is more flexible for the condition change.
v3 change:
- add new api dummy in bsdapp
--- lib/librte_eal/bsdapp/eal/eal_interrupts.c | 7 +++++++ lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 6 files changed, 50 insertions(+)
lib/librte_eal/bsdapp/eal/eal_interrupts.c +7 -0
@@ -110,3 +110,10 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)RTE_SET_USED (intr_handle);return 1 ; } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +RTE_SET_USED (intr_handle); +return 0 ; +}
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -122,4 +122,14 @@ int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);*/ int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_BSDAPP_INTERRUPTS_H_ */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +7 -0
@@ -125,3 +125,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
lib/librte_eal/linuxapp/eal/eal_interrupts.c +9 -0
@@ -1212,3 +1212,12 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)else return !!(intr_handle->max_intr - intr_handle->nb_efd); } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) +return 1 ; + +return 0 ; +}
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -215,4 +215,14 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
lib/librte_eal/linuxapp/eal/rte_eal_version.map +7 -0
@@ -128,3 +128,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
Signature · 1 line
2.4.3
PATCH v3 8/13 ixgbe: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
v3 change:
- add doc update follow on the code change
--- doc/guides/rel_notes/release_2_2.rst | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 39 ++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
@@ -152,6 +152,8 @@ Drivers hardware transactional memory support, thread scaling did not work, due to the global ring that is shared by all cores. +* **ixgbe: Fixed PF rx interrupt compatible issue with mbox.** + Libraries ~~~~~~~~~
drivers/net/ixgbe/ixgbe_ethdev.c +28 -11
@@ -1126,6 +1126,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + ixgbe_dev_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ ixgbe_enable_intr (eth_dev);
@@ -1975,7 +1982,10 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) { +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues;if (rte_intr_efd_enable (intr_handle, intr_vector))return -1 ;
@@ -1984,8 +1994,7 @@ ixgbe_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 ); + dev->data->nb_rx_queues *sizeof (int ),0 );if (intr_handle->intr_vec ==NULL ) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec\n" , dev->data->nb_rx_queues);
@@ -2072,20 +2081,22 @@ ixgbe_dev_start(struct rte_eth_dev *dev) skip_link_setup: -/* check if lsc interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - ixgbe_dev_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )ixgbe_dev_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))ixgbe_dev_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -2197,6 +2208,12 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)memset (filter_info->fivetuple_mask,0 ,sizeof (uint32_t ) *IXGBE_5TUPLE_ARRAY_SIZE ); +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v3 9/13 ixgbe: fix unnecessary intr_vec free in dev_close
In reply to Cunming LiangThe intr_vec is free in dev_stop. It's not necessary to check in dev_close.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -7
@@ -3952,7 +3952,6 @@ static void ixgbevf_dev_close(struct rte_eth_dev *dev) {struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct rte_pci_device *pci_dev;PMD_INIT_FUNC_TRACE ();
@@ -3964,12 +3963,6 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)/* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar (hw,0 , hw->mac.addr,0 ,IXGBE_RAH_AV ); - - pci_dev = dev->pci_dev; -if (pci_dev->intr_handle.intr_vec) { -rte_free (pci_dev->intr_handle.intr_vec); - pci_dev->intr_handle.intr_vec =NULL ; - } }static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on)
Signature · 1 line
2.4.3
PATCH v3 10/13 ixgbevf: cleanup unnecessary interrupt handler
In reply to Cunming LiangAs ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 62 +--------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -61
@@ -208,8 +208,6 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf/* For Virtual Function support */ static int eth_ixgbevf_dev_init (struct rte_eth_dev *eth_dev);static int eth_ixgbevf_dev_uninit (struct rte_eth_dev *eth_dev); -static int ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev); -static int ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev);static int ixgbevf_dev_configure (struct rte_eth_dev *dev);static int ixgbevf_dev_start (struct rte_eth_dev *dev);static void ixgbevf_dev_stop (struct rte_eth_dev *dev);
@@ -225,8 +223,6 @@ static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);static void ixgbevf_vlan_offload_set (struct rte_eth_dev *dev,int mask);static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on); -static void ixgbevf_dev_interrupt_handler (struct rte_intr_handle *handle, -void *param);static int ixgbevf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
@@ -3068,30 +3064,6 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev) -{ -uint32_t eicr; -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_interrupt *intr = -IXGBE_DEV_PRIVATE_TO_INTR (dev->data->dev_private); - -/* clear all cause mask */ -ixgbevf_intr_disable (hw); - -/* read-on-clear nic registers here */ - eicr =IXGBE_READ_REG (hw,IXGBE_VTEICR ); -PMD_DRV_LOG (INFO ,"eicr %x" , eicr); - - intr->flags =0 ; - -/* set flag for async link update */ -if (eicr &IXGBE_EICR_LSC ) - intr->flags |=IXGBE_FLAG_NEED_LINK_UPDATE ; - -return 0 ; -} -/** * It gets and then prints the link status. *
@@ -3187,18 +3159,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev) -{ -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -PMD_DRV_LOG (DEBUG ,"enable intr immediately" ); -ixgbevf_intr_enable (hw); -rte_intr_enable (&dev->pci_dev->intr_handle); -return 0 ; -} -/** * Interrupt handler which shall be registered for alarm callback for delayed * handling specific interrupt to wait for the stable nic state. As the
@@ -3261,16 +3221,6 @@ ixgbe_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,ixgbe_dev_interrupt_action (dev); } -static void -ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, -void *param) -{ -struct rte_eth_dev *dev = (struct rte_eth_dev *)param; - -ixgbevf_dev_interrupt_get_status (dev); -ixgbevf_dev_interrupt_action (dev); -} -static int ixgbe_dev_led_on (struct rte_eth_dev *dev) {
@@ -3897,16 +3847,6 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) }ixgbevf_configure_msix (dev); -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) -rte_intr_callback_register (intr_handle, - ixgbevf_dev_interrupt_handler, - (void *)dev); -else -PMD_INIT_LOG (INFO ,"lsc won't enable because of" -" no intr multiplex\n" ); - } -rte_intr_enable (intr_handle);/* Re-enable interrupt for VF */
@@ -4659,7 +4599,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) intr_handle->intr_vec[q_idx] = vector_idx; } -/* Configure VF Rx queue ivar */ +/* Configure VF other cause ivar */ ixgbevf_set_ivar_map (hw,-1 ,1 , vector_idx); }
Signature · 1 line
2.4.3
PATCH v3 11/13 igb: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen igb runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
v3 change:
- add doc update follow on the code change
--- doc/guides/rel_notes/release_2_2.rst | 2 ++ drivers/net/e1000/igb_ethdev.c | 38 ++++++++++++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
@@ -154,6 +154,8 @@ Drivers * **ixgbe: Fixed PF rx interrupt compatible issue with mbox.** +* **igb: Fixed PF rx interrupt compatible issue with mbox.** + Libraries ~~~~~~~~~
drivers/net/e1000/igb_ethdev.c +28 -10
@@ -760,6 +760,13 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + eth_igb_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ igb_intr_enable (eth_dev);
@@ -1122,13 +1129,16 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) { +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues;if (rte_intr_efd_enable (intr_handle, intr_vector))return -1 ; } -if (rte_intr_dp_is_en (intr_handle)) { +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 );
@@ -1221,20 +1231,22 @@ eth_igb_start(struct rte_eth_dev *dev) }e1000_setup_link (hw); -/* check if lsc interrupt feature is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - eth_igb_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )eth_igb_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))eth_igb_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1327,6 +1339,12 @@ eth_igb_stop(struct rte_eth_dev *dev) } filter_info->twotuple_mask =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v3 12/13 i40e: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e PF non-IOV mode.
Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
v3 change:
- macro change according the EAL
- add doc update follow on the code change
v2 change:
- add write flush
- always set DIS_AUTOMASK_
i40e: pf macro
--- doc/guides/rel_notes/release_2_2.rst | 1 + drivers/net/i40e/i40e_ethdev.c | 347 ++++++++++++++++++++++++++++++----- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_pf.c | 2 + 4 files changed, 306 insertions(+), 49 deletions(-)
doc/guides/rel_notes/release_2_2.rst +1 -0
@@ -90,6 +90,7 @@ New Features * **Added port hotplug support to xenvirt.** +* **Added interrupt mode support on i40e.** Resolved Issues ---------------
drivers/net/i40e/i40e_ethdev.c +298 -49
519 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -159,6 +159,9 @@ enum i40e_flxpld_layer_idx { (1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD)) +#define I40E_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define I40E_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +struct i40e_adapter ;/**
@@ -256,6 +259,7 @@ struct i40e_vsi {uint16_t seid;/* The seid of VSI itself */ uint16_t uplink_seid;/* The uplink seid of this VSI */ uint16_t nb_qps;/* Number of queue pairs VSI can occupy */ +uint16_t nb_used_qps;/* Number of queue pairs VSI uses */ uint16_t max_macaddrs;/* Maximum number of MAC addresses */ uint16_t base_queue;/* The first queue index of this VSI */ /*
@@ -264,6 +268,7 @@ struct i40e_vsi {*/ uint16_t vsi_id;uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ +uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/i40e_pf.c +2 -0
@@ -554,6 +554,8 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps;/* Don't care how the TX/RX queue mapping with this vector. * Link all VF RX queues together. Only did mapping work.
Signature · 1 line
2.4.3
PATCH v3 13/13 i40evf: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF. On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition.
On VF side, one single vector is shared for all the rx queues.
v3 changes:
- macro change according to EAL
- rebase on patch http://dpdk.org/dev/patchwork/patch/7790
v2 changes:
- turn on intr only when rxq flag is set
- rework base on patch http://dpdk.org/dev/patchwork/patch/7504/
--- drivers/net/i40e/i40e_ethdev.c | 38 +++++----- drivers/net/i40e/i40e_ethdev.h | 15 ++++ drivers/net/i40e/i40e_ethdev_vf.c | 144 +++++++++++++++++++++++++++++++++++--- drivers/net/i40e/i40e_pf.c | 5 -- 4 files changed, 167 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_ethdev.c +17 -21
@@ -76,11 +76,6 @@/* Maximun number of VSI */ #define I40E_MAX_NUM_VSIS (384UL) -/* Default queue interrupt throttling time in microseconds */ -#define I40E_ITR_INDEX_DEFAULT 0 -#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ -#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ -#define I40E_PRE_TX_Q_CFG_WAIT_US 10/* 10 us */ /* Flow control default timer */
@@ -1099,16 +1094,6 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)I40E_WRITE_FLUSH (hw); } -static inline uint16_t -i40e_calc_itr_interval (int16_t interval) -{ -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; - -/* Convert to hardware count, as writing each 1 represents 2 us */ -return (interval/2 ); -} -static void __vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect,int base_queue,int nb_queue)
@@ -1159,13 +1144,24 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, }else {uint32_t reg; -/* num_msix_vectors_vf needs to minus irq0 */ - reg = (hw->func_caps.num_msix_vectors_vf -1 ) * - vsi->user_param + (msix_vect -1 ); +if (msix_vect ==I40E_MISC_VEC_ID ) { +I40E_WRITE_REG (hw, +I40E_VPINT_LNKLST0 (vsi->user_param), + (base_queue << +I40E_VPINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); + }else { +/* num_msix_vectors_vf needs to minus irq0 */ + reg = (hw->func_caps.num_msix_vectors_vf -1 ) * + vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), + (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); + } }I40E_WRITE_FLUSH (hw);
drivers/net/i40e/i40e_ethdev.h +15 -0
@@ -162,6 +162,11 @@ enum i40e_flxpld_layer_idx {#define I40E_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET#define I40E_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* Default queue interrupt throttling time in microseconds */ +#define I40E_ITR_INDEX_DEFAULT 0 +#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ +#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ +struct i40e_adapter ;/**
@@ -638,6 +643,16 @@ i40e_align_floor(int n)return 1 << (sizeof (n) *CHAR_BIT -1 -__builtin_clz (n)); } +static inline uint16_t +i40e_calc_itr_interval (int16_t interval) +{ +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + +/* Convert to hardware count, as writing each 1 represents 2 us */ +return (interval /2 ); +} +#define I40E_VALID_FLOW (flow_type) \ ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
drivers/net/i40e/i40e_ethdev_vf.c +135 -9
224 lines not on this page · raw message
drivers/net/i40e/i40e_pf.c +0 -5
@@ -547,11 +547,6 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -if (irqmap->vecmap[0 ].vector_id ==0 ) { -PMD_DRV_LOG (ERR ,"DPDK host don't support use IRQ0" ); - ret =I40E_ERR_PARAM ; - goto send_msg; - }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; vf->vsi->nb_msix = irqmap->num_vectors;
Signature · 1 line
2.4.3
v4 cover interrupt mode for i40e
In reply to Cunming Liangv4 change:
- remove redundancy condition check on PF
v3 changes:
- rename MISC_VEC_ID and RX_VEC_START
- add bsdapp dummy
- split cleanup and fix patches
- merge doc update along with code change
v2 changes:
- rework to depend on one previous patch
patch http://dpdk.org/dev/patchwork/patch/7504/
- always set DIS_AUTOMASK_* bit in PF to avoid ENA flag auto-clear
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping
2. add api to declare the capability of multiple interrupt vector support
3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF
4. add rx interrupt support in i40e PF and VF
Cunming Liang (13):
eal: vfio map misc intr to vector zero
ixgbe: reserve intr vector zero for misc cause
igb: reserve intr vector zero for misc cause eal/linux: not allow to enable zero intr efd
ixgbe: fix efd_enable with zero number
igb: fix efd_enable with zero number
eal: add intr api to report multi-vector capability
ixgbe: fix rx intr compatible issue with PF mbox
ixgbe: fix unnecessary intr_vec free in dev_close
ixgbevf: cleanup unnecessary interrupt handler
igb: fix rx intr compatible issue with PF mbox
i40e: add rx interrupt support
i40evf: add rx interrupt support
doc/guides/rel_notes/release_2_2.rst | 5 + drivers/net/e1000/e1000_ethdev.h | 3 + drivers/net/e1000/igb_ethdev.c | 62 +++- drivers/net/i40e/i40e_ethdev.c | 378 +++++++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 20 ++ drivers/net/i40e/i40e_ethdev_vf.c | 144 +++++++- drivers/net/i40e/i40e_pf.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 143 +++----- drivers/net/ixgbe/ixgbe_ethdev.h | 3 + lib/librte_eal/bsdapp/eal/eal_interrupts.c | 7 + .../bsdapp/eal/include/exec-env/rte_interrupts.h | 16 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 + lib/librte_eal/linuxapp/eal/eal_interrupts.c | 36 +- .../linuxapp/eal/include/exec-env/rte_interrupts.h | 15 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 + 15 files changed, 651 insertions(+), 202 deletions(-)
Signature · 1 line
2.4.3
PATCH v4 1/13 eal: vfio map misc intr to vector zero
During VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ... Qn_fd, misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd, Q0_fd, ... Qn_fd}, always reserve the first vector to misc interrupt.
v3 changes:
- rename MISC_VEC_ID to RTE_INTR_VEC_ZERO_OFFSET
- rename RX_VEC_START to RTE_INTR_VEC_RXTX_OFFSET
- add macro definition in bsd header file
--- .../bsdapp/eal/include/exec-env/rte_interrupts.h | 3 +++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 19 +++++++++++++------ .../linuxapp/eal/include/exec-env/rte_interrupts.h | 2 ++ 3 files changed, 18 insertions(+), 6 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +3 -0
@@ -38,6 +38,9 @@#ifndef _RTE_BSDAPP_INTERRUPTS_H_#define _RTE_BSDAPP_INTERRUPTS_H_ +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1 +enum rte_intr_handle_type {RTE_INTR_HANDLE_UNKNOWN =0 , RTE_INTR_HANDLE_UIO, /**< uio device handle */
lib/librte_eal/linuxapp/eal/eal_interrupts.c +13 -6
@@ -301,8 +301,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle) { irq_set->index =VFIO_PCI_MSIX_IRQ_INDEX ; irq_set->start =0 ; fd_ptr = (int *) &irq_set->data; -memcpy (fd_ptr, intr_handle->efds,sizeof (intr_handle->efds)); - fd_ptr[intr_handle->max_intr -1 ] = intr_handle->fd; +/* INTR vector offset 0 reserve for non-efds mapping */ + fd_ptr[RTE_INTR_VEC_ZERO_OFFSET ] = intr_handle->fd; +memcpy (&fd_ptr[RTE_INTR_VEC_RXTX_OFFSET ], intr_handle->efds, +sizeof (*intr_handle->efds) * intr_handle->nb_efd); ret =ioctl (intr_handle->vfio_dev_fd,VFIO_DEVICE_SET_IRQS , irq_set);
@@ -1083,10 +1085,14 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,struct rte_epoll_event *rev;struct rte_epoll_data *epdata;int epfd_op; +unsigned int efd_idx;int rc =0 ; + efd_idx = (vec >=RTE_INTR_VEC_RXTX_OFFSET ) ? + (vec -RTE_INTR_VEC_RXTX_OFFSET ) : vec; +if (!intr_handle || intr_handle->nb_efd ==0 || - vec >= intr_handle->nb_efd) { + efd_idx >= intr_handle->nb_efd) {RTE_LOG (ERR ,EAL ,"Wrong intr vector number.\n" );return -EPERM ; }
@@ -1094,7 +1100,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,switch (op) {case RTE_INTR_EVENT_ADD : epfd_op =EPOLL_CTL_ADD ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status !=RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event already been added.\n" );return -EEXIST ;
@@ -1106,7 +1112,8 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd, epdata->data = data; epdata->cb_fun = (rte_intr_event_cb_t )eal_intr_proc_rxtx_intr; epdata->cb_arg = (void *)intr_handle; - rc =rte_epoll_ctl (epfd, epfd_op, intr_handle->efds[vec], rev); + rc =rte_epoll_ctl (epfd, epfd_op, + intr_handle->efds[efd_idx], rev);if (!rc)RTE_LOG (DEBUG ,EAL , "efd %d associated with vec %d added on epfd %d"
@@ -1116,7 +1123,7 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle, int epfd,break ;case RTE_INTR_EVENT_DEL : epfd_op =EPOLL_CTL_DEL ; - rev = &intr_handle->elist[vec]; + rev = &intr_handle->elist[efd_idx];if (rev->status ==RTE_EPOLL_INVALID ) {RTE_LOG (INFO ,EAL ,"Event does not exist.\n" );return -EPERM ;
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -0
@@ -39,6 +39,8 @@#define _RTE_LINUXAPP_INTERRUPTS_H_#define RTE_MAX_RXTX_INTR_VEC_ID 32 +#define RTE_INTR_VEC_ZERO_OFFSET 0 +#define RTE_INTR_VEC_RXTX_OFFSET 1enum rte_intr_handle_type {RTE_INTR_HANDLE_UNKNOWN =0 ,
Signature · 1 line
2.4.3
Re: [PATCH v4 01/13] eal: vfio map misc intr to vector zero
Quoted 7 lines · Cunming Liang
During
VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ...Qn_fd,misc_fd}.
The vector number of misc is indeterminable which is ugly to some NIC(e.g. i40e, fm10k).
The patch adjusts the order in {misc_fd,Q0_fd, ...Qn_fd}, always reserve the first vector to misc interrupt.
Quoted 7 lines
v3 changes:
- renameMISC_VEC_IDtoRTE_INTR_VEC_ZERO_OFFSET
- renameRX_VEC_STARTtoRTE_INTR_VEC_RXTX_OFFSET
- add macro definition in bsd header fileSigned-off-by Cunming Liang <[email protected]>
Signature · 1 line
David Marchand
PATCH v4 2/13 ixgbe: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
v3 changes:
- macro renaming according to the EAL change
--- drivers/net/ixgbe/ixgbe_ethdev.c | 22 ++++++++++++++-------- drivers/net/ixgbe/ixgbe_ethdev.h | 3 +++ 2 files changed, 17 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +14 -8
@@ -4478,7 +4478,8 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask |= (1 << queue_id); + mask |= (1 <<IXGBE_MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);rte_intr_enable (&dev->pci_dev->intr_handle);
@@ -4494,7 +4495,8 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask &= ~(1 << queue_id); + mask &= ~(1 <<IXGBE_MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);return 0 ;
@@ -4630,7 +4632,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t q_idx; -uint32_t vector_idx =0 ; +uint32_t vector_idx =IXGBE_MISC_VEC_ID ;/* won't configure msix register if no mapping is done * between intr vector and event fd.
@@ -4662,7 +4664,8 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t queue_id, vec =0 ; +uint32_t queue_id, base =IXGBE_MISC_VEC_ID ; +uint32_t vec =IXGBE_MISC_VEC_ID ;uint32_t mask;uint32_t gpie;
@@ -4672,6 +4675,9 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) + vec = base =IXGBE_RX_VEC_START ; +/* setup GPIE for MSI-x mode */ gpie =IXGBE_READ_REG (hw,IXGBE_GPIE ); gpie |= IXGBE_GPIE_MSIX_MODE | IXGBE_GPIE_PBA_SUPPORT |
@@ -4695,23 +4701,23 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)/* by default, 1:1 mapping */ ixgbe_set_ivar_map (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }switch (hw->mac.type) {case ixgbe_mac_82598EB:ixgbe_set_ivar_map (hw,-1 ,IXGBE_IVAR_OTHER_CAUSES_INDEX , - intr_handle->max_intr -1 ); +IXGBE_MISC_VEC_ID );break ;case ixgbe_mac_82599EB:case ixgbe_mac_X540: -ixgbe_set_ivar_map (hw,-1 ,1 , intr_handle->max_intr -1 ); +ixgbe_set_ivar_map (hw,-1 ,1 ,IXGBE_MISC_VEC_ID );break ;default :break ; } -IXGBE_WRITE_REG (hw,IXGBE_EITR (queue_id), +IXGBE_WRITE_REG (hw,IXGBE_EITR (IXGBE_MISC_VEC_ID ),IXGBE_MIN_INTER_INTERRUPT_INTERVAL_DEFAULT &0xFFF );/* set up to autoclear timer, and the vectors */
drivers/net/ixgbe/ixgbe_ethdev.h +3 -0
@@ -123,6 +123,9 @@#define IXGBE_VF_IRQ_ENABLE_MASK 3/* vf irq enable mask */ #define IXGBE_VF_MAXMSIVECTOR 1 +#define IXGBE_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define IXGBE_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* * Information about the fdir mode. */
Signature · 1 line
2.4.3
PATCH v4 3/13 igb: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
v3 change:
- macro renaming according to the EAL change
--- drivers/net/e1000/e1000_ethdev.h | 3 +++ drivers/net/e1000/igb_ethdev.c | 19 ++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/net/e1000/e1000_ethdev.h +3 -0
@@ -132,6 +132,9 @@#define EM_RXD_ALIGN (E1000_ALIGN / sizeof(struct e1000_rx_desc))#define EM_TXD_ALIGN (E1000_ALIGN / sizeof(struct e1000_data_desc)) +#define E1000_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define E1000_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* structure for interrupt relative data */ struct e1000_interrupt {uint32_t flags;
drivers/net/e1000/igb_ethdev.c +14 -5
@@ -4495,7 +4495,10 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)uint32_t tmpval, regval, intr_mask;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vec =0 ; +uint32_t vec =E1000_MISC_VEC_ID ; +uint32_t base =E1000_MISC_VEC_ID ; +uint32_t misc_shift =0 ; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;/* won't configure msix register if no mapping is done
@@ -4504,6 +4507,11 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) { + vec = base =E1000_RX_VEC_START ; + misc_shift =1 ; + } +/* set interrupt vector for other causes */ if (hw->mac.type == e1000_82575) { tmpval =E1000_READ_REG (hw,E1000_CTRL_EXT );
@@ -4532,8 +4540,8 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)E1000_WRITE_REG (hw,E1000_GPIE ,E1000_GPIE_MSIX_MODE |E1000_GPIE_PBA |E1000_GPIE_EIAME |E1000_GPIE_NSICR ); - - intr_mask = (1 << intr_handle->max_intr) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAC );E1000_WRITE_REG (hw,E1000_EIAC , regval | intr_mask);
@@ -4547,14 +4555,15 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)/* use EIAM to auto-mask when MSI-X interrupt * is asserted, this saves a register write for every interrupt */ - intr_mask = (1 << intr_handle->nb_efd) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAM );E1000_WRITE_REG (hw,E1000_EIAM , regval | intr_mask);for (queue_id =0 ; queue_id < dev->data->nb_rx_queues; queue_id++) {eth_igb_assign_msix_vector (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }
Signature · 1 line
2.4.3
PATCH v4 4/13 eal/linux: not allow to enable zero intr efd
In reply to Cunming LiangThe patch adds condition check to avoid enable nothing. In disable state, both max_intr and nb_efd are zero.
--- lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 8 +++++++- lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -85,8 +85,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
lib/librte_eal/linuxapp/eal/eal_interrupts.c +7 -1
@@ -45,6 +45,7 @@#include <sys/signalfd.h> #include <sys/ioctl.h> #include <sys/eventfd.h> +#include <assert.h> #include <rte_common.h> #include <rte_interrupts.h>
@@ -1148,6 +1149,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)int fd;uint32_t n =RTE_MIN (nb_efd, (uint32_t )RTE_MAX_RXTX_INTR_VEC_ID ); +assert (nb_efd !=0 ); +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) {for (i =0 ; i < n; i++) { fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC );
@@ -1204,5 +1207,8 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)int rte_intr_allow_others (struct rte_intr_handle *intr_handle) { -return !!(intr_handle->max_intr - intr_handle->nb_efd); +if (!rte_intr_dp_is_en (intr_handle)) +return 1 ; +else +return !!(intr_handle->max_intr - intr_handle->nb_efd); }
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -176,8 +176,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
Signature · 1 line
2.4.3
Re: [PATCH v4 04/13] eal/linux: not allow to enable zero intr efd
Quoted 5 lines · Cunming Liang
The patch adds condition check to avoid enable nothing. In disable state, both
max_intrandnb_efdare zero.Signed-off-by Cunming Liang <[email protected]>
Signature · 1 line
David Marchand
PATCH v4 5/13 ixgbe: fix efd_enable with zero number
In reply to Cunming Liang--- drivers/net/ixgbe/ixgbe_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +8 -8
@@ -1975,11 +1975,11 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
@@ -3862,11 +3862,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
Signature · 1 line
2.4.3
PATCH v4 6/13 igb: fix efd_enable with zero number
In reply to Cunming Liang--- drivers/net/e1000/igb_ethdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/e1000/igb_ethdev.c +4 -4
@@ -1122,11 +1122,11 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle)) { intr_handle->intr_vec =
Signature · 1 line
2.4.3
PATCH v4 7/13 eal: add intr api to report multi-vector capability
In reply to Cunming LiangVFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future. Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead a capability api is more flexible for the condition change.
v3 change:
- add new api dummy in bsdapp
--- lib/librte_eal/bsdapp/eal/eal_interrupts.c | 7 +++++++ lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/bsdapp/eal/rte_eal_version.map | 7 +++++++ lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 6 files changed, 50 insertions(+)
lib/librte_eal/bsdapp/eal/eal_interrupts.c +7 -0
@@ -110,3 +110,10 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)RTE_SET_USED (intr_handle);return 1 ; } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +RTE_SET_USED (intr_handle); +return 0 ; +}
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -122,4 +122,14 @@ int rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);*/ int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_BSDAPP_INTERRUPTS_H_ */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +7 -0
@@ -125,3 +125,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
lib/librte_eal/linuxapp/eal/eal_interrupts.c +9 -0
@@ -1212,3 +1212,12 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)else return !!(intr_handle->max_intr - intr_handle->nb_efd); } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) +return 1 ; + +return 0 ; +}
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -215,4 +215,14 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
lib/librte_eal/linuxapp/eal/rte_eal_version.map +7 -0
@@ -128,3 +128,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
Signature · 1 line
2.4.3
Re: [PATCH v4 07/13] eal: add intr api to report multi-vector capability
Quoted 7 lines · Cunming Liang
VFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future.
Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead
a capability api is more flexible for the condition change.
Quoted 5 lines
v3 change:
- add new api dummy in bsdappSigned-off-by Cunming Liang <[email protected]>
Signature · 1 line
David Marchand
PATCH v4 8/13 ixgbe: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
v4 change:
- remove redundancy condition check
v3 change:
- add doc update follow on the code change
--- doc/guides/rel_notes/release_2_2.rst | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 38 +++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 11 deletions(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
@@ -152,6 +152,8 @@ Drivers hardware transactional memory support, thread scaling did not work, due to the global ring that is shared by all cores. +* **ixgbe: Fixed PF rx interrupt compatible issue with mbox.** + Libraries ~~~~~~~~~
drivers/net/ixgbe/ixgbe_ethdev.c +27 -11
@@ -1126,6 +1126,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + ixgbe_dev_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ ixgbe_enable_intr (eth_dev);
@@ -1975,7 +1982,9 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) { +if ((rte_intr_cap_multiple (intr_handle) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues;if (rte_intr_efd_enable (intr_handle, intr_vector))return -1 ;
@@ -1984,8 +1993,7 @@ ixgbe_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 ); + dev->data->nb_rx_queues *sizeof (int ),0 );if (intr_handle->intr_vec ==NULL ) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec\n" , dev->data->nb_rx_queues);
@@ -2072,20 +2080,22 @@ ixgbe_dev_start(struct rte_eth_dev *dev) skip_link_setup: -/* check if lsc interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - ixgbe_dev_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )ixgbe_dev_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))ixgbe_dev_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -2197,6 +2207,12 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)memset (filter_info->fivetuple_mask,0 ,sizeof (uint32_t ) *IXGBE_5TUPLE_ARRAY_SIZE ); +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v4 9/13 ixgbe: fix unnecessary intr_vec free in dev_close
In reply to Cunming LiangThe intr_vec is free in dev_stop. It's not necessary to check in dev_close.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +0 -7
@@ -3951,7 +3951,6 @@ static void ixgbevf_dev_close(struct rte_eth_dev *dev) {struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct rte_pci_device *pci_dev;PMD_INIT_FUNC_TRACE ();
@@ -3963,12 +3962,6 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)/* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar (hw,0 , hw->mac.addr,0 ,IXGBE_RAH_AV ); - - pci_dev = dev->pci_dev; -if (pci_dev->intr_handle.intr_vec) { -rte_free (pci_dev->intr_handle.intr_vec); - pci_dev->intr_handle.intr_vec =NULL ; - } }static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on)
Signature · 1 line
2.4.3
PATCH v4 10/13 ixgbevf: cleanup unnecessary interrupt handler
In reply to Cunming LiangAs ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 62 +--------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -61
@@ -208,8 +208,6 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf/* For Virtual Function support */ static int eth_ixgbevf_dev_init (struct rte_eth_dev *eth_dev);static int eth_ixgbevf_dev_uninit (struct rte_eth_dev *eth_dev); -static int ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev); -static int ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev);static int ixgbevf_dev_configure (struct rte_eth_dev *dev);static int ixgbevf_dev_start (struct rte_eth_dev *dev);static void ixgbevf_dev_stop (struct rte_eth_dev *dev);
@@ -225,8 +223,6 @@ static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);static void ixgbevf_vlan_offload_set (struct rte_eth_dev *dev,int mask);static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on); -static void ixgbevf_dev_interrupt_handler (struct rte_intr_handle *handle, -void *param);static int ixgbevf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
@@ -3067,30 +3063,6 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev) -{ -uint32_t eicr; -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_interrupt *intr = -IXGBE_DEV_PRIVATE_TO_INTR (dev->data->dev_private); - -/* clear all cause mask */ -ixgbevf_intr_disable (hw); - -/* read-on-clear nic registers here */ - eicr =IXGBE_READ_REG (hw,IXGBE_VTEICR ); -PMD_DRV_LOG (INFO ,"eicr %x" , eicr); - - intr->flags =0 ; - -/* set flag for async link update */ -if (eicr &IXGBE_EICR_LSC ) - intr->flags |=IXGBE_FLAG_NEED_LINK_UPDATE ; - -return 0 ; -} -/** * It gets and then prints the link status. *
@@ -3186,18 +3158,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev) -{ -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -PMD_DRV_LOG (DEBUG ,"enable intr immediately" ); -ixgbevf_intr_enable (hw); -rte_intr_enable (&dev->pci_dev->intr_handle); -return 0 ; -} -/** * Interrupt handler which shall be registered for alarm callback for delayed * handling specific interrupt to wait for the stable nic state. As the
@@ -3260,16 +3220,6 @@ ixgbe_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,ixgbe_dev_interrupt_action (dev); } -static void -ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, -void *param) -{ -struct rte_eth_dev *dev = (struct rte_eth_dev *)param; - -ixgbevf_dev_interrupt_get_status (dev); -ixgbevf_dev_interrupt_action (dev); -} -static int ixgbe_dev_led_on (struct rte_eth_dev *dev) {
@@ -3896,16 +3846,6 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) }ixgbevf_configure_msix (dev); -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) -rte_intr_callback_register (intr_handle, - ixgbevf_dev_interrupt_handler, - (void *)dev); -else -PMD_INIT_LOG (INFO ,"lsc won't enable because of" -" no intr multiplex\n" ); - } -rte_intr_enable (intr_handle);/* Re-enable interrupt for VF */
@@ -4658,7 +4598,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) intr_handle->intr_vec[q_idx] = vector_idx; } -/* Configure VF Rx queue ivar */ +/* Configure VF other cause ivar */ ixgbevf_set_ivar_map (hw,-1 ,1 , vector_idx); }
Signature · 1 line
2.4.3
PATCH v4 11/13 igb: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen igb runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
v4 change:
- remove redundancy condition check
v3 change:
- add doc update follow on the code change
--- doc/guides/rel_notes/release_2_2.rst | 2 ++ drivers/net/e1000/igb_ethdev.c | 37 ++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-)
doc/guides/rel_notes/release_2_2.rst +2 -0
@@ -154,6 +154,8 @@ Drivers * **ixgbe: Fixed PF rx interrupt compatible issue with mbox.** +* **igb: Fixed PF rx interrupt compatible issue with mbox.** + Libraries ~~~~~~~~~
drivers/net/e1000/igb_ethdev.c +27 -10
@@ -760,6 +760,13 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + eth_igb_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ igb_intr_enable (eth_dev);
@@ -1122,13 +1129,15 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) { +if ((rte_intr_cap_multiple (intr_handle) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues;if (rte_intr_efd_enable (intr_handle, intr_vector))return -1 ; } -if (rte_intr_dp_is_en (intr_handle)) { +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 );
@@ -1221,20 +1230,22 @@ eth_igb_start(struct rte_eth_dev *dev) }e1000_setup_link (hw); -/* check if lsc interrupt feature is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - eth_igb_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )eth_igb_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))eth_igb_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1327,6 +1338,12 @@ eth_igb_stop(struct rte_eth_dev *dev) } filter_info->twotuple_mask =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v4 12/13 i40e: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e PF non-IOV mode.
Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
v4 change:
- remove redundancy condition check
v3 change:
- macro change according the EAL
- add doc update follow on the code change
v2 change:
- add write flush
- always set DIS_AUTOMASK_
--- doc/guides/rel_notes/release_2_2.rst | 1 + drivers/net/i40e/i40e_ethdev.c | 346 ++++++++++++++++++++++++++++++----- drivers/net/i40e/i40e_ethdev.h | 5 + drivers/net/i40e/i40e_pf.c | 2 + 4 files changed, 305 insertions(+), 49 deletions(-)
doc/guides/rel_notes/release_2_2.rst +1 -0
@@ -90,6 +90,7 @@ New Features * **Added port hotplug support to xenvirt.** +* **Added interrupt mode support on i40e.** Resolved Issues ---------------
drivers/net/i40e/i40e_ethdev.c +297 -49
518 lines not on this page · raw message
drivers/net/i40e/i40e_ethdev.h +5 -0
@@ -159,6 +159,9 @@ enum i40e_flxpld_layer_idx { (1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD)) +#define I40E_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET +#define I40E_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +struct i40e_adapter ;/**
@@ -256,6 +259,7 @@ struct i40e_vsi {uint16_t seid;/* The seid of VSI itself */ uint16_t uplink_seid;/* The uplink seid of this VSI */ uint16_t nb_qps;/* Number of queue pairs VSI can occupy */ +uint16_t nb_used_qps;/* Number of queue pairs VSI uses */ uint16_t max_macaddrs;/* Maximum number of MAC addresses */ uint16_t base_queue;/* The first queue index of this VSI */ /*
@@ -264,6 +268,7 @@ struct i40e_vsi {*/ uint16_t vsi_id;uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ +uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ struct i40e_bw_info bw_info;/* VSI bandwidth information */ };
drivers/net/i40e/i40e_pf.c +2 -0
@@ -554,6 +554,8 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps;/* Don't care how the TX/RX queue mapping with this vector. * Link all VF RX queues together. Only did mapping work.
Signature · 1 line
2.4.3
PATCH v4 13/13 i40evf: add rx interrupt support
In reply to Cunming LiangThe patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF. On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition.
On VF side, one single vector is shared for all the rx queues.
v3 changes:
- macro change according to EAL
- rebase on patch http://dpdk.org/dev/patchwork/patch/7790
v2 changes:
- turn on intr only when rxq flag is set
- rework base on patch http://dpdk.org/dev/patchwork/patch/7504/
--- drivers/net/i40e/i40e_ethdev.c | 38 +++++----- drivers/net/i40e/i40e_ethdev.h | 15 ++++ drivers/net/i40e/i40e_ethdev_vf.c | 146 +++++++++++++++++++++++++++++++++++--- drivers/net/i40e/i40e_pf.c | 5 -- 4 files changed, 169 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_ethdev.c +17 -21
@@ -76,11 +76,6 @@/* Maximun number of VSI */ #define I40E_MAX_NUM_VSIS (384UL) -/* Default queue interrupt throttling time in microseconds */ -#define I40E_ITR_INDEX_DEFAULT 0 -#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ -#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ -#define I40E_PRE_TX_Q_CFG_WAIT_US 10/* 10 us */ /* Flow control default timer */
@@ -1099,16 +1094,6 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)I40E_WRITE_FLUSH (hw); } -static inline uint16_t -i40e_calc_itr_interval (int16_t interval) -{ -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; - -/* Convert to hardware count, as writing each 1 represents 2 us */ -return (interval/2 ); -} -static void __vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect,int base_queue,int nb_queue)
@@ -1159,13 +1144,24 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, }else {uint32_t reg; -/* num_msix_vectors_vf needs to minus irq0 */ - reg = (hw->func_caps.num_msix_vectors_vf -1 ) * - vsi->user_param + (msix_vect -1 ); +if (msix_vect ==I40E_MISC_VEC_ID ) { +I40E_WRITE_REG (hw, +I40E_VPINT_LNKLST0 (vsi->user_param), + (base_queue << +I40E_VPINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); + }else { +/* num_msix_vectors_vf needs to minus irq0 */ + reg = (hw->func_caps.num_msix_vectors_vf -1 ) * + vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), + (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); + } }I40E_WRITE_FLUSH (hw);
drivers/net/i40e/i40e_ethdev.h +15 -0
@@ -162,6 +162,11 @@ enum i40e_flxpld_layer_idx {#define I40E_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET#define I40E_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET +/* Default queue interrupt throttling time in microseconds */ +#define I40E_ITR_INDEX_DEFAULT 0 +#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ +#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ +struct i40e_adapter ;/**
@@ -638,6 +643,16 @@ i40e_align_floor(int n)return 1 << (sizeof (n) *CHAR_BIT -1 -__builtin_clz (n)); } +static inline uint16_t +i40e_calc_itr_interval (int16_t interval) +{ +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + +/* Convert to hardware count, as writing each 1 represents 2 us */ +return (interval /2 ); +} +#define I40E_VALID_FLOW (flow_type) \ ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
drivers/net/i40e/i40e_ethdev_vf.c +137 -9
226 lines not on this page · raw message
drivers/net/i40e/i40e_pf.c +0 -5
@@ -547,11 +547,6 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -if (irqmap->vecmap[0 ].vector_id ==0 ) { -PMD_DRV_LOG (ERR ,"DPDK host don't support use IRQ0" ); - ret =I40E_ERR_PARAM ; - goto send_msg; - }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; vf->vsi->nb_msix = irqmap->num_vectors;
Signature · 1 line
2.4.3
Thomas Monjalon
Applied2015-11-04 16:45, Cunming Liang:
Quoted 12 lines
v4 change:
- remove redundancy condition check on PFv3 changes:
- renameMISC_VEC_IDandRX_VEC_START
- add bsdapp dummy
- split cleanup and fix patches
- merge doc update along with code changev2 changes:
- rework to depend on one previous patchpatch http://dpdk.org/dev/patchwork/patch/7504/
Quoted 8 lines
- always set DIS_AUTOMASK_* bit in PF to avoid ENA flag auto-clear
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping
2. add api to declare the capability of multiple interrupt vector support
3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF
4. add rx interrupt support in i40e PF and VF
Applied, thanks
PATCH v2 2/11 ixgbe: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +9 -5
@@ -4275,7 +4275,8 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t queue_id, vec =0 ; +uint32_t queue_id, base =MISC_VEC_ID ; +uint32_t vec =MISC_VEC_ID ;uint32_t mask;uint32_t gpie;
@@ -4285,6 +4286,9 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) + vec = base =RX_VEC_START ; +/* setup GPIE for MSI-x mode */ gpie =IXGBE_READ_REG (hw,IXGBE_GPIE ); gpie |= IXGBE_GPIE_MSIX_MODE | IXGBE_GPIE_PBA_SUPPORT |
@@ -4308,23 +4312,23 @@ ixgbe_configure_msix(struct rte_eth_dev *dev)/* by default, 1:1 mapping */ ixgbe_set_ivar_map (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }switch (hw->mac.type) {case ixgbe_mac_82598EB:ixgbe_set_ivar_map (hw,-1 ,IXGBE_IVAR_OTHER_CAUSES_INDEX , - intr_handle->max_intr -1 ); +MISC_VEC_ID );break ;case ixgbe_mac_82599EB:case ixgbe_mac_X540: -ixgbe_set_ivar_map (hw,-1 ,1 , intr_handle->max_intr -1 ); +ixgbe_set_ivar_map (hw,-1 ,1 ,MISC_VEC_ID );break ;default :break ; } -IXGBE_WRITE_REG (hw,IXGBE_EITR (queue_id), +IXGBE_WRITE_REG (hw,IXGBE_EITR (MISC_VEC_ID ),IXGBE_MIN_INTER_INTERRUPT_INTERVAL_DEFAULT &0xFFF );/* set up to autoclear timer, and the vectors */
Signature · 1 line
2.4.3
PATCH v2 3/11 igb: reserve intr vector zero for misc cause
In reply to Cunming LiangAccording to the VFIO interrupt mapping, the interrupt vector id for rxq starts from RX_VEC_START. It doesn't impact the UIO cases.
--- drivers/net/e1000/igb_ethdev.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/net/e1000/igb_ethdev.c +14 -5
@@ -4213,7 +4213,10 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)uint32_t tmpval, regval, intr_mask;struct e1000_hw *hw =E1000_DEV_PRIVATE_TO_HW (dev->data->dev_private); -uint32_t vec =0 ; +uint32_t vec =MISC_VEC_ID ; +uint32_t base =MISC_VEC_ID ; +uint32_t misc_shift =0 ; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;/* won't configure msix register if no mapping is done
@@ -4222,6 +4225,11 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)if (!rte_intr_dp_is_en (intr_handle))return ; +if (rte_intr_allow_others (intr_handle)) { + vec = base =RX_VEC_START ; + misc_shift =1 ; + } +/* set interrupt vector for other causes */ if (hw->mac.type == e1000_82575) { tmpval =E1000_READ_REG (hw,E1000_CTRL_EXT );
@@ -4250,8 +4258,8 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)E1000_WRITE_REG (hw,E1000_GPIE ,E1000_GPIE_MSIX_MODE |E1000_GPIE_PBA |E1000_GPIE_EIAME |E1000_GPIE_NSICR ); - - intr_mask = (1 << intr_handle->max_intr) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAC );E1000_WRITE_REG (hw,E1000_EIAC , regval | intr_mask);
@@ -4265,14 +4273,15 @@ eth_igb_configure_msix_intr(struct rte_eth_dev *dev)/* use EIAM to auto-mask when MSI-X interrupt * is asserted, this saves a register write for every interrupt */ - intr_mask = (1 << intr_handle->nb_efd) -1 ; + intr_mask =RTE_LEN2MASK (intr_handle->nb_efd, uint32_t) << + misc_shift; regval =E1000_READ_REG (hw,E1000_EIAM );E1000_WRITE_REG (hw,E1000_EIAM , regval | intr_mask);for (queue_id =0 ; queue_id < dev->data->nb_rx_queues; queue_id++) {eth_igb_assign_msix_vector (hw,0 , queue_id, vec); intr_handle->intr_vec[queue_id] = vec; -if (vec < intr_handle->nb_efd -1 ) +if (vec < base + intr_handle->nb_efd -1 ) vec++; }
Signature · 1 line
2.4.3
PATCH v2 4/11 eal/linux: not allow to enable zero intr efd
In reply to Cunming LiangThe patch adds condition check to avoid enable nothing. In disable state, both max_intr and nb_efd are zero.
--- lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h | 3 ++- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 8 +++++++- lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-)
lib/librte_eal/bsdapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -82,8 +82,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
lib/librte_eal/linuxapp/eal/eal_interrupts.c +7 -1
@@ -45,6 +45,7 @@#include <sys/signalfd.h> #include <sys/ioctl.h> #include <sys/eventfd.h> +#include <assert.h> #include <rte_common.h> #include <rte_interrupts.h>
@@ -1132,6 +1133,8 @@ rte_intr_efd_enable(struct rte_intr_handle *intr_handle, uint32_t nb_efd)int fd;uint32_t n =RTE_MIN (nb_efd, (uint32_t )RTE_MAX_RXTX_INTR_VEC_ID ); +assert (nb_efd !=0 ); +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) {for (i =0 ; i < n; i++) { fd =eventfd (0 ,EFD_NONBLOCK |EFD_CLOEXEC );
@@ -1188,5 +1191,8 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle)int rte_intr_allow_others (struct rte_intr_handle *intr_handle) { -return !!(intr_handle->max_intr - intr_handle->nb_efd); +if (!rte_intr_dp_is_en (intr_handle)) +return 1 ; +else +return !!(intr_handle->max_intr - intr_handle->nb_efd); }
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +2 -1
@@ -176,8 +176,9 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_handle,* * @param intr_handle * Pointer to the interrupt handle. -* @param nb_vec +* @param nb_efd * Number of interrupt vector trying to enable. +* The value 0 is not allowed. * @return * - On success, zero. * - On failure, a negative value.
Signature · 1 line
2.4.3
Re: [PATCH v2 04/11] eal/linux: not allow to enable zero intr efd
Quoted 8 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 04/11] eal/linux: not allow to enable zero intr efd
Quoted 4 lines
The patch adds condition check to avoid enable nothing. In disable state, both
max_intrandnb_efdare zero.Signed-off-by Cunming Liang <[email protected]>
PATCH v2 5/11 eal/linux: add intr api to report multi-vector capability
In reply to Cunming LiangVFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future. Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead a capability api is more flexible for the condition change.
--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 3 files changed, 26 insertions(+)
lib/librte_eal/linuxapp/eal/eal_interrupts.c +9 -0
@@ -1196,3 +1196,12 @@ rte_intr_allow_others(struct rte_intr_handle *intr_handle)else return !!(intr_handle->max_intr - intr_handle->nb_efd); } + +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle) +{ +if (intr_handle->type ==RTE_INTR_HANDLE_VFIO_MSIX ) +return 1 ; + +return 0 ; +}
lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h +10 -0
@@ -215,4 +215,14 @@ rte_intr_dp_is_en(struct rte_intr_handle *intr_handle);int rte_intr_allow_others (struct rte_intr_handle *intr_handle); +/** +* The multiple interrupt vector capability of interrupt handle instance. +* It returns zero if no multiple interrupt vector support. +* +* @param intr_handle +* Pointer to the interrupt handle. +*/ +int +rte_intr_cap_multiple (struct rte_intr_handle *intr_handle); +#endif /* _RTE_LINUXAPP_INTERRUPTS_H_ */
lib/librte_eal/linuxapp/eal/rte_eal_version.map +7 -0
@@ -128,3 +128,10 @@ DPDK_2.1 { rte_memzone_free; } DPDK_2.0; + +DPDK_2.2 { + global: + + rte_intr_cap_multiple; + +} DPDK_2.1;
Signature · 1 line
2.4.3
Re: [PATCH v2 05/11] eal/linux: add intr api to report multi-vector capability
Quoted 9 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 05/11] eal/linux: add intr api to report multi-vector capability
Quoted 8 lines
VFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future.
Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead
a capability api is more flexible for the condition change.Signed-off-by Cunming Liang <[email protected]>
Re: [PATCH v2 05/11] eal/linux: add intr api to report multi-vector capability
In reply to Cunming LiangQuoted 7 lines · Cunming Liang
VFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future.
Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead
a capability api is more flexible for the condition change.
Quoted 10 lines
Signed-off-by Cunming Liang <[email protected]>--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 3 files changed, 26 insertions(+)
BSD has wrappers for the rest of this api, please add one for this too.
Signature · 1 line
David Marchand
Re: [PATCH v2 05/11] eal/linux: add intr api to report multi-vector capability
Hi David,
Quoted 20 lines · David Marchand
Quoted 7 lines · Cunming Liang
VFIO allows multiple MSI-X vector, others doesn't, but maybe will allow it in the future.
Device drivers need to be aware of the capability.
It's better to avoid condition check on interrupt type(VFIO) everywhere, instead
a capability api is more flexible for the condition change.Quoted 10 lines
Signed-off-by Cunming Liang <[email protected]>--- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 9 +++++++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 +++++++ 3 files changed, 26 insertions(+)
Quoted 1 line
BSD has wrappers for the rest of this api, please add one for this too.
Yes, you're right. Thanks.
Quoted 1 line
PATCH v2 6/11 ixgbe: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen ixgbe runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 45 +++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 14 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +31 -14
@@ -1032,6 +1032,13 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + ixgbe_dev_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ ixgbe_enable_intr (eth_dev);
@@ -1708,17 +1715,19 @@ ixgbe_dev_start(struct rte_eth_dev *dev)ixgbe_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }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 ); + dev->data->nb_rx_queues *sizeof (int ),0 );if (intr_handle->intr_vec ==NULL ) {PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" " intr_vec\n" , dev->data->nb_rx_queues);
@@ -1805,20 +1814,22 @@ ixgbe_dev_start(struct rte_eth_dev *dev) skip_link_setup: -/* check if lsc interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - ixgbe_dev_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )ixgbe_dev_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))ixgbe_dev_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1930,6 +1941,12 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)memset (filter_info->fivetuple_mask,0 ,sizeof (uint32_t ) *IXGBE_5TUPLE_ARRAY_SIZE ); +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + ixgbe_dev_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v2 7/11 ixgbevf: cleanup unnecessary interrupt handler
In reply to Cunming LiangAs ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
--- drivers/net/ixgbe/ixgbe_ethdev.c | 85 +++++----------------------------------- 1 file changed, 10 insertions(+), 75 deletions(-)
drivers/net/ixgbe/ixgbe_ethdev.c +10 -75
@@ -206,8 +206,6 @@ static void ixgbe_dcb_init(struct ixgbe_hw *hw,struct ixgbe_dcb_config *dcb_conf/* For Virtual Function support */ static int eth_ixgbevf_dev_init (struct rte_eth_dev *eth_dev);static int eth_ixgbevf_dev_uninit (struct rte_eth_dev *eth_dev); -static int ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev); -static int ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev);static int ixgbevf_dev_configure (struct rte_eth_dev *dev);static int ixgbevf_dev_start (struct rte_eth_dev *dev);static void ixgbevf_dev_stop (struct rte_eth_dev *dev);
@@ -223,8 +221,6 @@ static void ixgbevf_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on);static void ixgbevf_vlan_offload_set (struct rte_eth_dev *dev,int mask);static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on); -static void ixgbevf_dev_interrupt_handler (struct rte_intr_handle *handle, -void *param);static int ixgbevf_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id); static int ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
@@ -2681,30 +2677,6 @@ ixgbe_dev_interrupt_get_status(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_get_status (struct rte_eth_dev *dev) -{ -uint32_t eicr; -struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct ixgbe_interrupt *intr = -IXGBE_DEV_PRIVATE_TO_INTR (dev->data->dev_private); - -/* clear all cause mask */ -ixgbevf_intr_disable (hw); - -/* read-on-clear nic registers here */ - eicr =IXGBE_READ_REG (hw,IXGBE_VTEICR ); -PMD_DRV_LOG (INFO ,"eicr %x" , eicr); - - intr->flags =0 ; - -/* set flag for async link update */ -if (eicr &IXGBE_EICR_LSC ) - intr->flags |=IXGBE_FLAG_NEED_LINK_UPDATE ; - -return 0 ; -} -/** * It gets and then prints the link status. *
@@ -2800,18 +2772,6 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev)return 0 ; } -static int -ixgbevf_dev_interrupt_action (struct rte_eth_dev *dev) -{ -struct ixgbe_hw *hw = -IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); - -PMD_DRV_LOG (DEBUG ,"enable intr immediately" ); -ixgbevf_intr_enable (hw); -rte_intr_enable (&dev->pci_dev->intr_handle); -return 0 ; -} -/** * Interrupt handler which shall be registered for alarm callback for delayed * handling specific interrupt to wait for the stable nic state. As the
@@ -2874,16 +2834,6 @@ ixgbe_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle,ixgbe_dev_interrupt_action (dev); } -static void -ixgbevf_dev_interrupt_handler(__rte_unused struct rte_intr_handle *handle, -void *param) -{ -struct rte_eth_dev *dev = (struct rte_eth_dev *)param; - -ixgbevf_dev_interrupt_get_status (dev); -ixgbevf_dev_interrupt_action (dev); -} -static int ixgbe_dev_led_on (struct rte_eth_dev *dev) {
@@ -3492,11 +3442,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }if (rte_intr_dp_is_en (intr_handle) && !intr_handle->intr_vec) { intr_handle->intr_vec =
@@ -3510,16 +3460,6 @@ ixgbevf_dev_start(struct rte_eth_dev *dev) }ixgbevf_configure_msix (dev); -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) -rte_intr_callback_register (intr_handle, - ixgbevf_dev_interrupt_handler, - (void *)dev); -else -PMD_INIT_LOG (INFO ,"lsc won't enable because of" -" no intr multiplex\n" ); - } -rte_intr_enable (intr_handle);/* Re-enable interrupt for VF */
@@ -3565,7 +3505,6 @@ static void ixgbevf_dev_close(struct rte_eth_dev *dev) {struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); -struct rte_pci_device *pci_dev;PMD_INIT_FUNC_TRACE ();
@@ -3577,12 +3516,6 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)/* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar (hw,0 , hw->mac.addr,0 ,IXGBE_RAH_AV ); - - pci_dev = dev->pci_dev; -if (pci_dev->intr_handle.intr_vec) { -rte_free (pci_dev->intr_handle.intr_vec); - pci_dev->intr_handle.intr_vec =NULL ; - } }static void ixgbevf_set_vfta_all (struct rte_eth_dev *dev,bool on)
@@ -4108,7 +4041,8 @@ ixgbevf_dev_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask |= (1 << queue_id); + mask |= (1 <<MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);rte_intr_enable (&dev->pci_dev->intr_handle);
@@ -4124,7 +4058,8 @@ ixgbevf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private); mask =IXGBE_READ_REG (hw,IXGBE_VTEIMS ); - mask &= ~(1 << queue_id); + mask &= ~(1 <<MISC_VEC_ID ); +RTE_SET_USED (queue_id);IXGBE_WRITE_REG (hw,IXGBE_VTEIMS , mask);return 0 ;
@@ -4260,7 +4195,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev)struct ixgbe_hw *hw =IXGBE_DEV_PRIVATE_TO_HW (dev->data->dev_private);uint32_t q_idx; -uint32_t vector_idx =0 ; +uint32_t vector_idx =MISC_VEC_ID ;/* won't configure msix register if no mapping is done * between intr vector and event fd.
@@ -4277,7 +4212,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) intr_handle->intr_vec[q_idx] = vector_idx; } -/* Configure VF Rx queue ivar */ +/* Configure VF other cause ivar */ ixgbevf_set_ivar_map (hw,-1 ,1 , vector_idx); }
Signature · 1 line
2.4.3
Re: [PATCH v2 07/11] ixgbevf: cleanup unnecessary interrupt handler
Quoted 3 lines · Cunming Liang
As ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
Please, can you describe this tiny cleanup ?
Did it trigger some bug ?
Quoted 21 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4
-4@@ -3492,11 +3442,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }
Signature · 1 line
David Marchand
Re: [PATCH v2 07/11] ixgbevf: cleanup unnecessary interrupt handler
Hi David,
Quoted 8 lines · David Marchand
Quoted 3 lines · Cunming Liang
As ixgbe vf doesn't support lsc, the patch removes those unused code. In addition, it does some tiny cleanup.
Please, can you describe this tiny cleanup ?
Did it trigger some bug ?
It causes confusing to enable/allocate efd with a zero number of vector. But this piece of code shall be merged in a different patch. Thanks.
Quoted 22 lines
Quoted 21 lines
drivers/net/ixgbe/ixgbe_ethdev.c +4
-4@@ -3492,11 +3442,11 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)ixgbevf_dev_rxtx_start (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; - -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + }
PATCH v2 8/11 igb: fix rx intr compatible issue with PF mbox
In reply to Cunming LiangWhen igb runs as a PF, mbox interrupt is prerequisite to make VF start normally.
And PF sometimes won't 'dev_start', so the mbox interrupt register during 'dev_init' is required. The patch rolls back the interrupt register for mbox,lsc to the 'dev_init'.
As UIO doesn't support multiple vector, mbox has to occupy the only one.
It adds condition check on 'dev_start', rxq interrupt is not allowed when PF running in IOV mode via UIO.
--- drivers/net/e1000/igb_ethdev.c | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-)
drivers/net/e1000/igb_ethdev.c +31 -13
@@ -650,6 +650,13 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->port_id, pci_dev->id.vendor_id, pci_dev->id.device_id); +rte_intr_callback_register (&pci_dev->intr_handle, + eth_igb_interrupt_handler, + (void *)eth_dev); + +/* enable uio/vfio intr/eventfd mapping */ +rte_intr_enable (&pci_dev->intr_handle); +/* enable support intr */ igb_intr_enable (eth_dev);
@@ -928,13 +935,16 @@ eth_igb_start(struct rte_eth_dev *dev)igb_pf_host_configure (dev);/* check and configure queue intr-vector mapping */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { intr_vector = dev->data->nb_rx_queues; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + } -if (rte_intr_efd_enable (intr_handle, intr_vector)) -return -1 ; - -if (rte_intr_dp_is_en (intr_handle)) { +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 );
@@ -1027,20 +1037,22 @@ eth_igb_start(struct rte_eth_dev *dev) }e1000_setup_link (hw); -/* check if lsc interrupt feature is enabled */ -if (dev->data->dev_conf.intr_conf.lsc !=0 ) { -if (rte_intr_allow_others (intr_handle)) { -rte_intr_callback_register (intr_handle, - eth_igb_interrupt_handler, - (void *)dev); +if (rte_intr_allow_others (intr_handle)) { +/* check if lsc interrupt is enabled */ +if (dev->data->dev_conf.intr_conf.lsc !=0 )eth_igb_lsc_interrupt_setup (dev); - }else + }else { +rte_intr_callback_unregister (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +if (dev->data->dev_conf.intr_conf.lsc !=0 )PMD_INIT_LOG (INFO ,"lsc won't enable because of" " no intr multiplex\n" ); }/* check if rxq interrupt is enabled */ -if (dev->data->dev_conf.intr_conf.rxq !=0 ) +if (dev->data->dev_conf.intr_conf.rxq !=0 && +rte_intr_dp_is_en (intr_handle))eth_igb_rxq_interrupt_setup (dev);/* enable uio/vfio intr/eventfd mapping */
@@ -1133,6 +1145,12 @@ eth_igb_stop(struct rte_eth_dev *dev) } filter_info->twotuple_mask =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + eth_igb_interrupt_handler, + (void *)dev); +/* Clean datapath event and queue/vec mapping */ rte_intr_efd_disable (intr_handle);if (intr_handle->intr_vec !=NULL ) {
Signature · 1 line
2.4.3
PATCH v2 9/11 i40e: add rx interrupt support
In reply to Cunming Liangv2 changes:
- add write flush
- always set DIS_AUTOMASK_* bit
The patch enables rx interrupt support on i40e PF non-IOV mode.
Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
--- drivers/net/i40e/i40e_ethdev.c | 342 +++++++++++++++++++++++++++++++++++------ drivers/net/i40e/i40e_ethdev.h | 2 + drivers/net/i40e/i40e_pf.c | 2 + 3 files changed, 298 insertions(+), 48 deletions(-)
drivers/net/i40e/i40e_ethdev.c +294 -48
@@ -39,6 +39,7 @@#include <unistd.h> #include <stdarg.h> #include <inttypes.h> +#include <assert.h> #include <rte_string_fns.h> #include <rte_pci.h>
@@ -174,7 +175,7 @@ static void i40e_stat_update_48(struct i40e_hw *hw,bool offset_loaded, uint64_t *offset, uint64_t *stat); -static void i40e_pf_config_irq0 (struct i40e_hw *hw); +static void i40e_pf_config_irq0 (struct i40e_hw *hw,bool no_queue);static void i40e_dev_interrupt_handler ( __rte_unused struct rte_intr_handle *handle, void *param); static int i40e_res_pool_init(struct i40e_res_pool_info *pool,
@@ -232,6 +233,10 @@ static int i40e_timesync_read_rx_timestamp(struct rte_eth_dev *dev, uint32_t flags);static int i40e_timesync_read_tx_timestamp (struct rte_eth_dev *dev,struct timespec *timestamp); +static int i40e_dev_rx_queue_intr_enable (struct rte_eth_dev *dev, +uint16_t queue_id); +static int i40e_dev_rx_queue_intr_disable (struct rte_eth_dev *dev, +uint16_t queue_id);static const struct rte_pci_id pci_id_i40e_map[] = { #define RTE_PCI_DEV_ID_DECL_I40E(vend, dev) {RTE_PCI_DEVICE(vend, dev)},
@@ -265,6 +270,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .tx_queue_start = i40e_dev_tx_queue_start, .tx_queue_stop = i40e_dev_tx_queue_stop, .rx_queue_setup = i40e_dev_rx_queue_setup, + .rx_queue_intr_enable = i40e_dev_rx_queue_intr_enable, + .rx_queue_intr_disable = i40e_dev_rx_queue_intr_disable, .rx_queue_release = i40e_dev_rx_queue_release, .rx_queue_count = i40e_dev_rx_queue_count, .rx_descriptor_done = i40e_dev_rx_descriptor_done,
@@ -579,7 +586,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev) i40e_dev_interrupt_handler, (void *)dev);/* configure and enable device interrupt */ -i40e_pf_config_irq0 (hw); +i40e_pf_config_irq0 (hw, TRUE);i40e_pf_enable_irq0 (hw);/* enable uio intr after callback register */
@@ -718,6 +725,8 @@ err:void i40e_vsi_queues_unbind_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi);uint16_t msix_vect = vsi->msix_intr;uint16_t i;
@@ -729,15 +738,26 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi) }if (vsi->type !=I40E_VSI_SRIOV ) { -I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ),0 ); -I40E_WRITE_REG (hw,I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , - msix_vect -1 ),0 ); +if (!rte_intr_allow_others (intr_handle)) { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , +I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); +I40E_WRITE_REG (hw, +I40E_PFINT_ITR0 (I40E_ITR_INDEX_DEFAULT ), +0 ); + }else { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), +I40E_PFINT_LNKLSTN_FIRSTQ_INDX_MASK ); +I40E_WRITE_REG (hw, +I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , + msix_vect -1 ),0 ); + } }else {uint32_t reg; reg = (hw->func_caps.num_msix_vectors_vf -1 ) * vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg),0 ); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_MASK ); }I40E_WRITE_FLUSH (hw); }
@@ -752,29 +772,26 @@ i40e_calc_itr_interval(int16_t interval)return (interval/2 ); } -void -i40e_vsi_queues_bind_intr (struct i40e_vsi *vsi) +static void +__vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect, +int base_queue,int nb_queue) { +int i;uint32_t val;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); -uint16_t msix_vect = vsi->msix_intr; -int i; - -for (i =0 ; i < vsi->nb_qps; i++) -I40E_WRITE_REG (hw,I40E_QINT_TQCTL (vsi->base_queue + i),0 );/* Bind all RX queues to allocated MSIX interrupt */ -for (i =0 ; i < vsi->nb_qps; i++) { +for (i =0 ; i < nb_queue; i++) { val = (msix_vect <<I40E_QINT_RQCTL_MSIX_INDX_SHIFT ) |I40E_QINT_RQCTL_ITR_INDX_MASK | - ((vsi->base_queue + i +1 ) << -I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | + ((base_queue + i +1 ) << +I40E_QINT_RQCTL_NEXTQ_INDX_SHIFT ) | (0 <<I40E_QINT_RQCTL_NEXTQ_TYPE_SHIFT ) |I40E_QINT_RQCTL_CAUSE_ENA_MASK ; -if (i == vsi->nb_qps -1 ) +if (i == nb_queue -1 ) val |=I40E_QINT_RQCTL_NEXTQ_INDX_MASK ; -I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i), val); +I40E_WRITE_REG (hw,I40E_QINT_RQCTL (base_queue + i), val); }/* Write first RX queue to Link list register as the head element */
@@ -782,21 +799,26 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi)uint16_t interval =i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ); -I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), - (vsi->base_queue << -I40E_PFINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); - -I40E_WRITE_REG (hw,I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , - msix_vect -1 ), interval); - -#ifndef I40E_GLINT_CTL -#define I40E_GLINT_CTL 0x0003F800 -#define I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK 0x4 -#endif -/* Disable auto-mask on enabling of all none-zero interrupt */ -I40E_WRITE_REG (hw,I40E_GLINT_CTL , -I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK ); +if (msix_vect ==MISC_VEC_ID ) { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , + (base_queue << +I40E_PFINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_PFINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw, +I40E_PFINT_ITR0 (I40E_ITR_INDEX_DEFAULT ), + interval); + }else { +I40E_WRITE_REG (hw,I40E_PFINT_LNKLSTN (msix_vect -1 ), + (base_queue << +I40E_PFINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_PFINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw, +I40E_PFINT_ITRN (I40E_ITR_INDEX_DEFAULT , + msix_vect -1 ), + interval); + } }else {uint32_t reg;
@@ -804,34 +826,134 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi) reg = (hw->func_caps.num_msix_vectors_vf -1 ) * vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (vsi->base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); }I40E_WRITE_FLUSH (hw); } +void +i40e_vsi_queues_bind_intr (struct i40e_vsi *vsi) +{ +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +uint16_t msix_vect = vsi->msix_intr; +uint16_t nb_msix =RTE_MIN (vsi->nb_msix, intr_handle->nb_efd); +uint16_t queue_idx =0 ; +int record =0 ; +uint32_t val; +int i; + +for (i =0 ; i < vsi->nb_qps; i++) { +I40E_WRITE_REG (hw,I40E_QINT_TQCTL (vsi->base_queue + i),0 ); +I40E_WRITE_REG (hw,I40E_QINT_RQCTL (vsi->base_queue + i),0 ); + } + +/* INTENA flag is not auto-cleared for interrupt */ + val =I40E_READ_REG (hw,I40E_GLINT_CTL ); + val |=I40E_GLINT_CTL_DIS_AUTOMASK_PF0_MASK | +I40E_GLINT_CTL_DIS_AUTOMASK_N_MASK | +I40E_GLINT_CTL_DIS_AUTOMASK_VF0_MASK ; +I40E_WRITE_REG (hw,I40E_GLINT_CTL , val); + +/* VF bind interrupt */ +if (vsi->type ==I40E_VSI_SRIOV ) { +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue, vsi->nb_qps); +return ; + } + +/* PF & VMDq bind interrupt */ +if (rte_intr_dp_is_en (intr_handle)) { +if (vsi->type ==I40E_VSI_MAIN ) { + queue_idx =0 ; + record =1 ; + }else if (vsi->type ==I40E_VSI_VMDQ2 ) { +struct i40e_vsi *main_vsi = +I40E_DEV_PRIVATE_TO_MAIN_VSI (vsi->adapter); + queue_idx = vsi->base_queue - main_vsi->nb_qps; + record =1 ; + } + } + +for (i =0 ; i < vsi->nb_used_qps; i++) { +if (nb_msix <=1 ) { +if (!rte_intr_allow_others (intr_handle)) +/* allow to share MISC_VEC_ID */ + msix_vect =MISC_VEC_ID ; + +/* no enough msix_vect, map all to one */ +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue + i, + vsi->nb_used_qps - i); +for (; !!record && i < vsi->nb_used_qps; i++) + intr_handle->intr_vec[queue_idx + i] = + msix_vect; +break ; + } +/* 1:1 queue/msix_vect mapping */ +__vsi_queues_bind_intr (vsi, msix_vect, + vsi->base_queue + i,1 ); +if (!!record) + intr_handle->intr_vec[queue_idx + i] = msix_vect; + + msix_vect++; + nb_msix--; + } +} +static void i40e_vsi_enable_queues_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi);uint16_t interval =i40e_calc_itr_interval (\ -RTE_LIBRTE_I40E_ITR_INTERVAL ); - -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (vsi->msix_intr -1 ), -I40E_PFINT_DYN_CTLN_INTENA_MASK | -I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | +RTE_LIBRTE_I40E_ITR_INTERVAL ); +uint16_t msix_intr, i; + +if (rte_intr_allow_others (intr_handle)) +for (i =0 ; i < vsi->nb_msix; i++) { + msix_intr = vsi->msix_intr + i; +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ), +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | - (interval <<I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); + } +else +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTL0_INTENA_MASK | +I40E_PFINT_DYN_CTL0_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTL0_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTL0_INTERVAL_SHIFT )); + +I40E_WRITE_FLUSH (hw); }static void i40e_vsi_disable_queues_intr (struct i40e_vsi *vsi) { +struct rte_eth_dev *dev = vsi->adapter->eth_dev; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;struct i40e_hw *hw =I40E_VSI_TO_HW (vsi); +uint16_t msix_intr, i; -I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (vsi->msix_intr -1 ),0 ); +if (rte_intr_allow_others (intr_handle)) +for (i =0 ; i < vsi->nb_msix; i++) { + msix_intr = vsi->msix_intr + i; +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTLN (msix_intr -1 ), +0 ); + } +else +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); + +I40E_WRITE_FLUSH (hw); } static inline uint8_t
@@ -941,6 +1063,8 @@ i40e_dev_start(struct rte_eth_dev *dev)struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private);struct i40e_vsi *main_vsi = pf->main_vsi;int ret, i; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +uint32_t intr_vector =0 ; hw->adapter_stopped =0 ;
@@ -952,6 +1076,29 @@ i40e_dev_start(struct rte_eth_dev *dev)return -EINVAL ; } +rte_intr_disable (intr_handle); + +if (((RTE_ETH_DEV_SRIOV (dev).active && +rte_intr_cap_multiple (intr_handle)) || + !RTE_ETH_DEV_SRIOV (dev).active) && + dev->data->dev_conf.intr_conf.rxq !=0 ) { + intr_vector = dev->data->nb_rx_queues; +if (rte_intr_efd_enable (intr_handle, intr_vector)) +return -1 ; + } + +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) { +PMD_INIT_LOG (ERR ,"Failed to allocate %d rx_queues" +" intr_vec\n" , dev->data->nb_rx_queues); +return -ENOMEM ; + } + } +/* Initialize VSI */ ret =i40e_dev_rxtx_init (pf);if (ret !=I40E_SUCCESS ) {
@@ -960,11 +1107,14 @@ i40e_dev_start(struct rte_eth_dev *dev) }/* Map queues with MSIX interrupt */ + main_vsi->nb_used_qps = dev->data->nb_rx_queues - + pf->nb_cfg_vmdq_vsi *RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM ;i40e_vsi_queues_bind_intr (main_vsi);i40e_vsi_enable_queues_intr (main_vsi);/* Map VMDQ VSI queues with MSIX interrupt */ for (i =0 ; i < pf->nb_cfg_vmdq_vsi; i++) { + pf->vmdq[i].vsi->nb_used_qps =RTE_LIBRTE_I40E_QUEUE_NUM_PER_VM ;i40e_vsi_queues_bind_intr (pf->vmdq[i].vsi);i40e_vsi_enable_queues_intr (pf->vmdq[i].vsi); }
@@ -1001,6 +1151,22 @@ i40e_dev_start(struct rte_eth_dev *dev) goto err_up; } +if (!rte_intr_allow_others (intr_handle)) { +rte_intr_callback_unregister (intr_handle, + i40e_dev_interrupt_handler, + (void *)dev); +/* configure and enable device interrupt */ +i40e_pf_config_irq0 (hw, FALSE); +i40e_pf_enable_irq0 (hw); + +if (dev->data->dev_conf.intr_conf.lsc !=0 ) +PMD_INIT_LOG (INFO ,"lsc won't enable because of" +" no intr multiplex\n" ); + } + +/* enable uio intr after callback register */ +rte_intr_enable (intr_handle); +return I40E_SUCCESS ; err_up:
@@ -1016,6 +1182,7 @@ i40e_dev_stop(struct rte_eth_dev *dev)struct i40e_pf *pf =I40E_DEV_PRIVATE_TO_PF (dev->data->dev_private);struct i40e_vsi *main_vsi = pf->main_vsi;struct i40e_mirror_rule *p_mirror; +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;int i;/* Disable all queues */
@@ -1047,6 +1214,18 @@ i40e_dev_stop(struct rte_eth_dev *dev) } pf->nb_mirror_rule =0 ; +if (!rte_intr_allow_others (intr_handle)) +/* resume to the default handler */ +rte_intr_callback_register (intr_handle, + i40e_dev_interrupt_handler, + (void *)dev); + +/* Clean datapath event and queue/vec mapping */ +rte_intr_efd_disable (intr_handle); +if (intr_handle->intr_vec) { +rte_free (intr_handle->intr_vec); + intr_handle->intr_vec =NULL ; + } } static void
@@ -3073,15 +3252,30 @@ i40e_vsi_setup(struct i40e_pf *pf, vsi->base_queue =I40E_FDIR_QUEUE_ID ;/* VF has MSIX interrupt in VF range, don't allocate here */ -if (type !=I40E_VSI_SRIOV ) { +if (type ==I40E_VSI_MAIN ) { + ret =i40e_res_pool_alloc (&pf->msix_pool, +RTE_MIN (vsi->nb_qps, +RTE_MAX_RXTX_INTR_VEC_ID )); +if (ret <0 ) { +PMD_DRV_LOG (ERR ,"VSI MAIN %d get heap failed %d" , + vsi->seid, ret); + goto fail_queue_alloc; + } + vsi->msix_intr = ret; + vsi->nb_msix =RTE_MIN (vsi->nb_qps,RTE_MAX_RXTX_INTR_VEC_ID ); + }else if (type !=I40E_VSI_SRIOV ) { ret =i40e_res_pool_alloc (&pf->msix_pool,1 );if (ret <0 ) {PMD_DRV_LOG (ERR ,"VSI %d get heap failed %d" , vsi->seid, ret); goto fail_queue_alloc; } vsi->msix_intr = ret; - }else + vsi->nb_msix =1 ; + }else { vsi->msix_intr =0 ; + vsi->nb_msix =0 ; + } +/* Add VSI */ if (type ==I40E_VSI_MAIN ) {/* For main VSI, no need to add since it's default one */
@@ -3919,7 +4113,7 @@ i40e_pf_enable_irq0(struct i40e_hw *hw) }static void -i40e_pf_config_irq0 (struct i40e_hw *hw) +i40e_pf_config_irq0 (struct i40e_hw *hw,bool no_queue) {/* read pending request and disable first */ i40e_pf_disable_irq0 (hw);
@@ -3927,9 +4121,10 @@ i40e_pf_config_irq0(struct i40e_hw *hw)I40E_WRITE_REG (hw,I40E_PFINT_STAT_CTL0 ,I40E_PFINT_STAT_CTL0_OTHER_ITR_INDX_MASK ); -/* Link no queues with irq0 */ -I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , -I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); +if (no_queue) +/* Link no queues with irq0 */ +I40E_WRITE_REG (hw,I40E_PFINT_LNKLST0 , +I40E_PFINT_LNKLST0_FIRSTQ_INDX_MASK ); } static void
@@ -6298,3 +6493,54 @@ i40e_timesync_read_tx_timestamp(struct rte_eth_dev *dev,return 0 ; } + +static int +i40e_dev_rx_queue_intr_enable (struct rte_eth_dev *dev,uint16_t queue_id) +{ +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint16_t interval = +i40e_calc_itr_interval (RTE_LIBRTE_I40E_ITR_INTERVAL ); +uint16_t msix_intr; + + msix_intr = intr_handle->intr_vec[queue_id]; +if (msix_intr ==MISC_VEC_ID ) +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 , +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); +else +I40E_WRITE_REG (hw, +I40E_PFINT_DYN_CTLN (msix_intr -RX_VEC_START ), +I40E_PFINT_DYN_CTLN_INTENA_MASK | +I40E_PFINT_DYN_CTLN_CLEARPBA_MASK | + (0 <<I40E_PFINT_DYN_CTLN_ITR_INDX_SHIFT ) | + (interval << +I40E_PFINT_DYN_CTLN_INTERVAL_SHIFT )); + +I40E_WRITE_FLUSH (hw); +rte_intr_enable (&dev->pci_dev->intr_handle); + +return 0 ; +} + +static int +i40e_dev_rx_queue_intr_disable (struct rte_eth_dev *dev,uint16_t queue_id) +{ +struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle; +struct i40e_hw *hw =I40E_DEV_PRIVATE_TO_HW (dev->data->dev_private); +uint16_t msix_intr; + + msix_intr = intr_handle->intr_vec[queue_id]; +if (msix_intr ==MISC_VEC_ID ) +I40E_WRITE_REG (hw,I40E_PFINT_DYN_CTL0 ,0 ); +else +I40E_WRITE_REG (hw, +I40E_PFINT_DYN_CTLN (msix_intr -RX_VEC_START ), +0 ); +I40E_WRITE_FLUSH (hw); + +return 0 ; +}
drivers/net/i40e/i40e_ethdev.h +2 -0
@@ -240,6 +240,7 @@ struct i40e_vsi {uint16_t seid;/* The seid of VSI itself */ uint16_t uplink_seid;/* The uplink seid of this VSI */ uint16_t nb_qps;/* Number of queue pairs VSI can occupy */ +uint16_t nb_used_qps;/* Number of queue pairs VSI uses */ uint16_t max_macaddrs;/* Maximum number of MAC addresses */ uint16_t base_queue;/* The first queue index of this VSI */ /*
@@ -248,6 +249,7 @@ struct i40e_vsi {*/ uint16_t vsi_id;uint16_t msix_intr;/* The MSIX interrupt binds to VSI */ +uint16_t nb_msix;/* The max number of msix vector */ uint8_t enabled_tc;/* The traffic class enabled */ };
drivers/net/i40e/i40e_pf.c +2 -0
@@ -554,6 +554,8 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; + vf->vsi->nb_msix = irqmap->num_vectors; + vf->vsi->nb_used_qps = vf->vsi->nb_qps;/* Don't care how the TX/RX queue mapping with this vector. * Link all VF RX queues together. Only did mapping work.
Signature · 1 line
2.4.3
Re: [PATCH v2 09/11] i40e: add rx interrupt support
Quoted 13 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 09/11] i40e: add rx interrupt supportv2 changes:
- add write flush
- always set DIS_AUTOMASK_* bit
Quoted 5 lines
The patch enables rx interrupt support on i40e PF non-IOV mode. Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
Signed-off-by Cunming Liang <[email protected]>
Re: [PATCH v2 09/11] i40e: add rx interrupt support
In reply to Cunming LiangQuoted 13 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 09/11] i40e: add rx interrupt supportv2 changes:
- add write flush
- always set DIS_AUTOMASK_* bit
Quoted 6 lines
The patch enables rx interrupt support on i40e PF non-IOV mode. Per queue rx interrupt works on vfio, however on uio, all rx queues share one interrupt vector.
Signed-off-by Cunming Liang <[email protected]>---
Quoted 5 lines
drivers/net/i40e/i40e_ethdev.c | 342 +++++++++++++++++++++++++++++++++++------ drivers/net/i40e/i40e_ethdev.h | 2 + drivers/net/i40e/i40e_pf.c | 2 + 3 files changed, 298 insertions(+), 48 deletions(-)
PATCH v2 10/11 i40evf: add rx interrupt support
In reply to Cunming Liangv2 changes:
- turn on intr only when rxq flag is set
- rework base on patch http://dpdk.org/dev/patchwork/patch/7504/
The patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF. On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition.
On VF side, one single vector is shared for all the rx queues.
--- drivers/net/i40e/i40e_ethdev.c | 38 +++++----- drivers/net/i40e/i40e_ethdev.h | 15 ++++ drivers/net/i40e/i40e_ethdev_vf.c | 143 +++++++++++++++++++++++++++++++++++--- drivers/net/i40e/i40e_pf.c | 5 -- 4 files changed, 166 insertions(+), 35 deletions(-)
drivers/net/i40e/i40e_ethdev.c +17 -21
@@ -75,11 +75,6 @@/* Maximun number of VSI */ #define I40E_MAX_NUM_VSIS (384UL) -/* Default queue interrupt throttling time in microseconds */ -#define I40E_ITR_INDEX_DEFAULT 0 -#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ -#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ -#define I40E_PRE_TX_Q_CFG_WAIT_US 10/* 10 us */ /* Mask of PF interrupt causes */
@@ -762,16 +757,6 @@ i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi)I40E_WRITE_FLUSH (hw); } -static inline uint16_t -i40e_calc_itr_interval (int16_t interval) -{ -if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) - interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; - -/* Convert to hardware count, as writing each 1 represents 2 us */ -return (interval/2 ); -} -static void __vsi_queues_bind_intr (struct i40e_vsi *vsi,uint16_t msix_vect,int base_queue,int nb_queue)
@@ -822,13 +807,24 @@ __vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t msix_vect, }else {uint32_t reg; -/* num_msix_vectors_vf needs to minus irq0 */ - reg = (hw->func_caps.num_msix_vectors_vf -1 ) * - vsi->user_param + (msix_vect -1 ); +if (msix_vect ==MISC_VEC_ID ) { +I40E_WRITE_REG (hw, +I40E_VPINT_LNKLST0 (vsi->user_param), + (base_queue << +I40E_VPINT_LNKLST0_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLST0_FIRSTQ_TYPE_SHIFT )); + }else { +/* num_msix_vectors_vf needs to minus irq0 */ + reg = (hw->func_caps.num_msix_vectors_vf -1 ) * + vsi->user_param + (msix_vect -1 ); -I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), (base_queue << -I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | - (0x0 <<I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); +I40E_WRITE_REG (hw,I40E_VPINT_LNKLSTN (reg), + (base_queue << +I40E_VPINT_LNKLSTN_FIRSTQ_INDX_SHIFT ) | + (0x0 << +I40E_VPINT_LNKLSTN_FIRSTQ_TYPE_SHIFT )); + } }I40E_WRITE_FLUSH (hw);
drivers/net/i40e/i40e_ethdev.h +15 -0
@@ -156,6 +156,11 @@ enum i40e_flxpld_layer_idx { (1ULL << I40E_FILTER_PCTYPE_FCOE_OTHER) | \ (1ULL << I40E_FILTER_PCTYPE_L2_PAYLOAD)) +/* Default queue interrupt throttling time in microseconds */ +#define I40E_ITR_INDEX_DEFAULT 0 +#define I40E_QUEUE_ITR_INTERVAL_DEFAULT 32/* 32 us */ +#define I40E_QUEUE_ITR_INTERVAL_MAX 8160/* 8160 us */ +struct i40e_adapter ;/**
@@ -578,6 +583,16 @@ i40e_align_floor(int n)return 1 << (sizeof (n) *CHAR_BIT -1 -__builtin_clz (n)); } +static inline uint16_t +i40e_calc_itr_interval (int16_t interval) +{ +if (interval <0 || interval >I40E_QUEUE_ITR_INTERVAL_MAX ) + interval =I40E_QUEUE_ITR_INTERVAL_DEFAULT ; + +/* Convert to hardware count, as writing each 1 represents 2 us */ +return (interval /2 ); +} +#define I40E_VALID_FLOW (flow_type) \ ((flow_type) == RTE_ETH_FLOW_FRAG_IPV4 || \ (flow_type) == RTE_ETH_FLOW_NONFRAG_IPV4_TCP || \
drivers/net/i40e/i40e_ethdev_vf.c +134 -9
224 lines not on this page · raw message
drivers/net/i40e/i40e_pf.c +0 -5
@@ -547,11 +547,6 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, goto send_msg; } -if (irqmap->vecmap[0 ].vector_id ==0 ) { -PMD_DRV_LOG (ERR ,"DPDK host don't support use IRQ0" ); - ret =I40E_ERR_PARAM ; - goto send_msg; - }/* This MSIX intr store the intr in VF range */ vf->vsi->msix_intr = irqmap->vecmap[0 ].vector_id; vf->vsi->nb_msix = irqmap->num_vectors;
Signature · 1 line
2.4.3
Re: [PATCH v2 10/11] i40evf: add rx interrupt support
Quoted 13 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 10/11] i40evf: add rx interrupt supportv2 changes:
- turn on intr only when rxq flag is set
- rework base on patch http://dpdk.org/dev/patchwork/patch/7504/
Quoted 8 lines
The patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF.
On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition. On VF side, one single vector is shared for all the rx queues.Signed-off-by Cunming Liang <[email protected]>---
Just note that http://dpdk.org/dev/patchwork/patch/7504/ is already replace by http://dpdk.org/dev/patchwork/patch/7790/ for few code style fix.
Quoted 7 lines
drivers/net/i40e/i40e_ethdev.c | 38 +++++----- drivers/net/i40e/i40e_ethdev.h | 15 ++++ drivers/net/i40e/i40e_ethdev_vf.c | 143 +++++++++++++++++++++++++++++++++++--- drivers/net/i40e/i40e_pf.c | 5 -- 4 files changed, 166 insertions(+), 35 deletions(-)
Re: [PATCH v2 10/11] i40evf: add rx interrupt support
In reply to Cunming LiangQuoted 13 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 10/11] i40evf: add rx interrupt supportv2 changes:
- turn on intr only when rxq flag is set
- rework base on patch http://dpdk.org/dev/patchwork/patch/7504/
Quoted 7 lines
The patch enables rx interrupt support on i40e VF and some necessary change on PF IOV mode to support VF.
On PF side, running in IOV mode via uio won't allow rx interrupt which is exclusive with mbox interrupt in single vector competition.
On VF side, one single vector is shared for all the rx queues.Signed-off-by Cunming Liang <[email protected]>
PATCH 11/11 doc: release note update for intr mode
In reply to Cunming Liang--- doc/guides/rel_notes/release_2_2.rst | 4 ++++ 1 file changed, 4 insertions(+)
doc/guides/rel_notes/release_2_2.rst +4 -0
@@ -23,6 +23,7 @@ New Features * **Added vhost-user multiple queue support.** +* **Added interrupt mode support on i40e.** Resolved Issues ---------------
@@ -72,6 +73,9 @@ Drivers Fixed issue when releasing null control queue. +* **ixgbe: Fixed PF rx interrupt compatible issue with mbox.** + +* **igb: Fixed PF rx interrupt compatible issue with mbox.** Libraries ~~~~~~~~~
Signature · 1 line
2.4.3
Quoted 49 lines
-----Original Message-----
From: Liang, Cunming
Sent: Friday, October 30, 2015 1:28 PM
To: [email protected]
Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming
Subject: [PATCH v2 00/11] interrupt mode for i40ev2 change:
- rebase code base
- rework to depend on one previous patchpatch http://dpdk.org/dev/patchwork/patch/7504/- always set DIS_AUTOMASK_* bit in PF to avoid ENA flag auto-clear
This patch series contains four major parts.
1. always reserve vector zero for misc cause in vfio mapping 2. add api to declare the capability of multiple interrupt vector support 3. fix the rx interrupt compatible issue with mbox in ixgbe/igb IOV-PF 4. add rx interrupt support in i40e PF and VF
Cunming Liang (11):
eal/linux: vfio map misc intr to vector zero
ixgbe: reserve intr vector zero for misc cause
igb: reserve intr vector zero for misc cause eal/linux: not allow to enable zero intr efd eal/linux: add intr api to report multi-vector capability
ixgbe: fix rx intr compatible issue with PF mbox
ixgbevf: cleanup unnecessary interrupt handler
igb: fix rx intr compatible issue with PF mbox
i40e: add rx interrupt support
i40evf: add rx interrupt support
doc: release note update for intr modedoc/guides/rel_notes/release_2_2.rst | 4 + drivers/net/e1000/igb_ethdev.c | 63 +++- drivers/net/i40e/i40e_ethdev.c | 374 +++++++++++++++++---- drivers/net/i40e/i40e_ethdev.h | 17 + drivers/net/i40e/i40e_ethdev_vf.c | 143 +++++++- drivers/net/i40e/i40e_pf.c | 7 +- drivers/net/ixgbe/ixgbe_ethdev.c | 144 +++----- .../bsdapp/eal/include/exec-env/rte_interrupts.h | 3 +- lib/librte_eal/linuxapp/eal/eal_interrupts.c | 35 +- .../linuxapp/eal/include/exec-env/rte_interrupts.h | 16 +- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 7 + 11 files changed, 612 insertions(+), 201 deletions(-)
Quoted 2 lines
--
2.4.3