From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8A51A6841 for ; Mon, 4 Sep 2017 04:49:24 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2017 19:49:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,473,1498546800"; d="scan'208";a="125280156" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 03 Sep 2017 19:49:23 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 3 Sep 2017 19:49:22 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Sun, 3 Sep 2017 19:49:18 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.219]) by shsmsx102.ccr.corp.intel.com ([169.254.2.39]) with mapi id 14.03.0319.002; Mon, 4 Sep 2017 10:49:15 +0800 From: "Tan, Jianfeng" To: "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [PATCH v3] eal: add counter size for efd clean Thread-Index: AQHTHH7WzqjlLbA2jUihcPUk/RbwPKKkFk/Q Date: Mon, 4 Sep 2017 02:49:15 +0000 Message-ID: References: <1502636600-46889-1-git-send-email-jingjing.wu@intel.com> <1503540656-104421-1-git-send-email-jingjing.wu@intel.com> In-Reply-To: <1503540656-104421-1-git-send-email-jingjing.wu@intel.com> Accept-Language: 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 Subject: Re: [dpdk-dev] [PATCH v3] eal: add counter size for efd clean X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Sep 2017 02:49:25 -0000 > -----Original Message----- > From: Wu, Jingjing > Sent: Thursday, August 24, 2017 10:11 AM > To: Tan, Jianfeng > Cc: Wu, Jingjing; dev@dpdk.org > Subject: [PATCH v3] eal: add counter size for efd clean >=20 > For virtual device, the rte_intr_handle struct is > initialized by the virtual device driver, including > the event fd assignment. If the event fd need to be > read for clean, an argument is required for the proper > event fd read. >=20 > This patch adds efd_counter_size in rte_intr_handle > struct to tell the rx interrupt process the read size. >=20 > Signed-off-by: Jingjing Wu Reviewed-by: Jianfeng Tan Thanks, Jianfeng > --- >=20 > v3 change: > - rework commit log >=20 > v2 change: > - fix typo and reword commit log >=20 > drivers/net/virtio/virtio_user/virtio_user_dev.c | 2 ++ > lib/librte_eal/linuxapp/eal/eal_interrupts.c | 19 ++++++++++++-= ------ > .../linuxapp/eal/include/exec-env/rte_interrupts.h | 1 + > 3 files changed, 15 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c > b/drivers/net/virtio/virtio_user/virtio_user_dev.c > index 7941271..906d7a2 100644 > --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c > +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c > @@ -270,6 +270,8 @@ virtio_user_fill_intr_handle(struct virtio_user_dev > *dev) > eth_dev->intr_handle->nb_efd =3D dev->max_queue_pairs; > eth_dev->intr_handle->max_intr =3D dev->max_queue_pairs + 1; > eth_dev->intr_handle->type =3D RTE_INTR_HANDLE_VDEV; > + /* For virtio vdev, no need to read counter for clean */ > + eth_dev->intr_handle->efd_counter_size =3D 0; > if (dev->vhostfd >=3D 0) > eth_dev->intr_handle->fd =3D dev->vhostfd; >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > index 3e9ac41..7de39c3 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > @@ -914,7 +914,7 @@ static void > eal_intr_proc_rxtx_intr(int fd, const struct rte_intr_handle *intr_handl= e) > { > union rte_intr_read_buffer buf; > - int bytes_read =3D 1; > + int bytes_read =3D 0; > int nbytes; >=20 > switch (intr_handle->type) { > @@ -930,11 +930,9 @@ eal_intr_proc_rxtx_intr(int fd, const struct > rte_intr_handle *intr_handle) > break; > #endif > case RTE_INTR_HANDLE_VDEV: > - /* for vdev, fd points to: > - * a. eventfd which does not need to read out; > - * b. datapath fd which needs PMD to read out. > - */ > - return; > + bytes_read =3D intr_handle->efd_counter_size; > + /* For vdev, number of bytes to read is set by driver */ > + break; > case RTE_INTR_HANDLE_EXT: > return; > default: > @@ -947,6 +945,8 @@ eal_intr_proc_rxtx_intr(int fd, const struct > rte_intr_handle *intr_handle) > * read out to clear the ready-to-be-read flag > * for epoll_wait. > */ > + if (bytes_read =3D=3D 0) > + return; > do { > nbytes =3D read(fd, &buf, bytes_read); > if (nbytes < 0) { > @@ -1206,7 +1206,12 @@ rte_intr_efd_enable(struct rte_intr_handle > *intr_handle, uint32_t nb_efd) > intr_handle->nb_efd =3D n; > intr_handle->max_intr =3D NB_OTHER_INTR + n; > } else if (intr_handle->type =3D=3D RTE_INTR_HANDLE_VDEV) { > - /* do nothing, and let vdev driver to initialize this struct */ > + /* only check, initialization would be done in vdev driver.*/ > + if (intr_handle->efd_counter_size > > + sizeof(union rte_intr_read_buffer)) { > + RTE_LOG(ERR, EAL, "the efd_counter_size is > oversized"); > + return -EINVAL; > + } > } else { > intr_handle->efds[0] =3D intr_handle->fd; > intr_handle->nb_efd =3D RTE_MIN(nb_efd, 1U); > 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 6daffeb..fd4ea6c 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 > @@ -93,6 +93,7 @@ struct rte_intr_handle { > enum rte_intr_handle_type type; /**< handle type */ > uint32_t max_intr; /**< max interrupt requested */ > uint32_t nb_efd; /**< number of available efd(event fd) *= / > + uint8_t efd_counter_size; /**< size of efd counter, used for vdev > */ > int efds[RTE_MAX_RXTX_INTR_VEC_ID]; /**< intr vectors/efds > mapping */ > struct rte_epoll_event elist[RTE_MAX_RXTX_INTR_VEC_ID]; > /**< intr vector epoll event */ > -- > 2.4.11