From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 54F9391BF for ; Fri, 30 Oct 2015 15:23:00 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 30 Oct 2015 07:22:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,218,1444719600"; d="scan'208";a="838879179" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 30 Oct 2015 07:22:35 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 30 Oct 2015 07:22:34 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.248.2; Fri, 30 Oct 2015 07:22:34 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.253]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.47]) with mapi id 14.03.0248.002; Fri, 30 Oct 2015 22:22:32 +0800 From: "Liang, Cunming" To: "David Marchand (david.marchand@6wind.com)" Thread-Topic: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero Thread-Index: AQHREtPJtkYEj5Zqu0uQbowrlFPYyZ6EFYug Date: Fri, 30 Oct 2015 14:22:31 +0000 Message-ID: References: <1443072831-19065-1-git-send-email-cunming.liang@intel.com> <1446182873-28814-1-git-send-email-cunming.liang@intel.com> <1446182873-28814-2-git-send-email-cunming.liang@intel.com> In-Reply-To: <1446182873-28814-2-git-send-email-cunming.liang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Oct 2015 14:23:00 -0000 Hi David, May I ask your help to review the patch related to eal ? Thanks, Steve > -----Original Message----- > From: Liang, Cunming > Sent: Friday, October 30, 2015 1:28 PM > To: dev@dpdk.org > Cc: Zhang, Helin; He, Shaopeng; Wu, Jingjing; Liang, Cunming > Subject: [PATCH v2 01/11] eal/linux: vfio map misc intr to vector zero >=20 > During VFIO_DEVICE_SET_IRQS, the previous order is {Q0_fd, ... Qn_fd, mis= c_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 reserv= e the first > vector to misc interrupt. >=20 > Signed-off-by: Cunming Liang > --- > 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(-) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > index 078318c..8e76a7a 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > @@ -300,8 +300,10 @@ vfio_enable_msix(struct rte_intr_handle *intr_handle= ) > { > irq_set->index =3D VFIO_PCI_MSIX_IRQ_INDEX; > irq_set->start =3D 0; > fd_ptr =3D (int *) &irq_set->data; > - memcpy(fd_ptr, intr_handle->efds, sizeof(intr_handle->efds)); > - fd_ptr[intr_handle->max_intr - 1] =3D intr_handle->fd; > + fd_ptr[MISC_VEC_ID] =3D 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); >=20 > ret =3D ioctl(intr_handle->vfio_dev_fd, VFIO_DEVICE_SET_IRQS, irq_set); >=20 > @@ -1068,10 +1070,13 @@ rte_intr_rx_ctl(struct rte_intr_handle *intr_hand= le, > int epfd, > struct rte_epoll_event *rev; > struct rte_epoll_data *epdata; > int epfd_op; > + unsigned int efd_idx; > int rc =3D 0; >=20 > + efd_idx =3D (vec >=3D RX_VEC_START) ? (vec - RX_VEC_START) : vec; > + > if (!intr_handle || intr_handle->nb_efd =3D=3D 0 || > - vec >=3D intr_handle->nb_efd) { > + efd_idx >=3D 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 =3D EPOLL_CTL_ADD; > - rev =3D &intr_handle->elist[vec]; > + rev =3D &intr_handle->elist[efd_idx]; > if (rev->status !=3D 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 =3D data; > epdata->cb_fun =3D (rte_intr_event_cb_t)eal_intr_proc_rxtx_intr; > epdata->cb_arg =3D (void *)intr_handle; > - rc =3D rte_epoll_ctl(epfd, epfd_op, intr_handle->efds[vec], rev); > + rc =3D 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 =3D EPOLL_CTL_DEL; > - rev =3D &intr_handle->elist[vec]; > + rev =3D &intr_handle->elist[efd_idx]; > if (rev->status =3D=3D RTE_EPOLL_INVALID) { > RTE_LOG(INFO, EAL, "Event does not exist.\n"); > return -EPERM; > diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.= h > b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h > index 45071b7..b8fd318 100644 > --- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h > +++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_interrupts.h > @@ -77,6 +77,9 @@ struct rte_epoll_event { > struct rte_epoll_data epdata; > }; >=20 > +#define MISC_VEC_ID (0) > +#define RX_VEC_START (MISC_VEC_ID + 1) > + > /** Handle for interrupts. */ > struct rte_intr_handle { > union { > -- > 2.4.3