From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 560C8B4FA for ; Thu, 19 Feb 2015 08:58:45 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Feb 2015 23:58:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,607,1418112000"; d="scan'208";a="680219887" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by fmsmga002.fm.intel.com with ESMTP; 18 Feb 2015 23:58:41 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 19 Feb 2015 15:58:41 +0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.161]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.209]) with mapi id 14.03.0195.001; Thu, 19 Feb 2015 15:58:39 +0800 From: "Zhou, Danny" To: Neil Horman Thread-Topic: [dpdk-dev] [PATCH v3 1/5] ethdev: add rx interrupt enable/disable functions Thread-Index: AQHQSsoHZkkoByKWW0WmA3MJhUHH95z3nL3w Date: Thu, 19 Feb 2015 07:58:38 +0000 Message-ID: References: <1424180839-24483-1-git-send-email-danny.zhou@intel.com> <1424180839-24483-2-git-send-email-danny.zhou@intel.com> <20150217155436.GC6309@neilslaptop.think-freely.org> In-Reply-To: <20150217155436.GC6309@neilslaptop.think-freely.org> 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 v3 1/5] ethdev: add rx interrupt enable/disable functions 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: Thu, 19 Feb 2015 07:58:46 -0000 > -----Original Message----- > From: Neil Horman [mailto:nhorman@tuxdriver.com] > Sent: Tuesday, February 17, 2015 11:55 PM > To: Zhou, Danny > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 1/5] ethdev: add rx interrupt enable/di= sable functions >=20 > On Tue, Feb 17, 2015 at 09:47:15PM +0800, Zhou Danny wrote: > > v3 changes > > - Add return value for interrupt enable/disable functions > > > > Add two dev_ops functions to enable and disable rx queue interrupts > > > > Signed-off-by: Danny Zhou > > Tested-by: Yong Liu > > --- > > lib/librte_ether/rte_ethdev.c | 43 ++++++++++++++++++++++++++++++++ > > lib/librte_ether/rte_ethdev.h | 57 +++++++++++++++++++++++++++++++++++= ++++++++ > > 2 files changed, 100 insertions(+) > > > > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethde= v.c > > index ea3a1fb..d27469a 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -2825,6 +2825,49 @@ _rte_eth_dev_callback_process(struct rte_eth_dev= *dev, > > } > > rte_spinlock_unlock(&rte_eth_dev_cb_lock); > > } > > + > > +int > > +rte_eth_dev_rx_queue_intr_enable(uint8_t port_id, > > + uint16_t queue_id) > > +{ > > + struct rte_eth_dev *dev; > > + > > + if (port_id >=3D nb_ports) { > > + PMD_DEBUG_TRACE("Invalid port_id=3D%d\n", port_id); > > + return (-ENODEV); > > + } > > + > > + dev =3D &rte_eth_devices[port_id]; > > + if (dev =3D=3D NULL) { > > + PMD_DEBUG_TRACE("Invalid port device\n"); > > + return (-ENODEV); > > + } > > + > > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP); > > + return (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id); > > +} > > + > > +int > > +rte_eth_dev_rx_queue_intr_disable(uint8_t port_id, > > + uint16_t queue_id) > > +{ > > + struct rte_eth_dev *dev; > > + > > + if (port_id >=3D nb_ports) { > > + PMD_DEBUG_TRACE("Invalid port_id=3D%d\n", port_id); > > + return (-ENODEV); > > + } > > + > > + dev =3D &rte_eth_devices[port_id]; > > + if (dev =3D=3D NULL) { > > + PMD_DEBUG_TRACE("Invalid port device\n"); > > + return (-ENODEV); > > + } > > + > > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP); > > + return (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id); > > +} > > + > > #ifdef RTE_NIC_BYPASS > > int rte_eth_dev_bypass_init(uint8_t port_id) > > { > > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethde= v.h > > index 84160c3..0f320a9 100644 > > --- a/lib/librte_ether/rte_ethdev.h > > +++ b/lib/librte_ether/rte_ethdev.h > > @@ -848,6 +848,8 @@ struct rte_eth_fdir { > > struct rte_intr_conf { > > /** enable/disable lsc interrupt. 0 (default) - disable, 1 enable */ > > uint16_t lsc; > > + /** enable/disable rxq interrupt. 0 (default) - disable, 1 enable */ > > + uint16_t rxq; > > }; > > > > /** > > @@ -1109,6 +1111,14 @@ typedef int (*eth_tx_queue_setup_t)(struct rte_e= th_dev *dev, > > const struct rte_eth_txconf *tx_conf); > > /**< @internal Setup a transmit queue of an Ethernet device. */ > > > > +typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev, > > + uint16_t rx_queue_id); > > +/**< @internal Enable interrupt of a receive queue of an Ethernet devi= ce. */ > > + > > +typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev, > > + uint16_t rx_queue_id); > > +/**< @internal Disable interrupt of a receive queue of an Ethernet dev= ice. */ > > + > > typedef void (*eth_queue_release_t)(void *queue); > > /**< @internal Release memory resources allocated by given RX/TX queue= . */ > > > > @@ -1445,6 +1455,8 @@ struct eth_dev_ops { > > eth_queue_start_t tx_queue_start;/**< Start TX for a queue.*= / > > eth_queue_stop_t tx_queue_stop;/**< Stop TX for a queue.*/ > > eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue= .*/ > > + eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue= interrupt. */ > > + eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx que= ue interrupt.*/ > Put these at the end of eth_dev_ops if you want to avoid breaking ABI I purposely add those two APIs at current position to ensure all rxq relate= d APIs are declared together in eth_dev_ops. Anyway, moving them to the end is ok to me for the reason o= f ABI, though the code looks a little bit ugly. >=20 > > eth_queue_release_t rx_queue_release;/**< Release RX queue.*/ > > eth_rx_queue_count_t rx_queue_count; /**< Get Rx queue count. *= / > > eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit= */ > > @@ -2811,6 +2823,51 @@ void _rte_eth_dev_callback_process(struct rte_et= h_dev *dev, > > enum rte_eth_event_type event); > > > > /** > > + * When there is no rx packet coming in Rx Queue for a long time, we c= an > > + * sleep lcore related to RX Queue for power saving, and enable rx int= errupt > > + * to be triggered when rx packect arrives. > > + * > > + * The rte_eth_dev_rx_queue_intr_enable() function enables rx queue > > + * interrupt on specific rx queue of a port. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @param queue_id > > + * The index of the receive queue from which to retrieve input packe= ts. > > + * The value must be in the range [0, nb_rx_queue - 1] previously su= pplied > > + * to rte_eth_dev_configure(). > > + * @return > > + * - (0) if successful. > > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support > > + * that operation. > > + * - (-ENODEV) if *port_id* invalid. > > + */ > > +int rte_eth_dev_rx_queue_intr_enable(uint8_t port_id, > > + uint16_t queue_id); > > + > > +/** > > + * When lcore wakes up from rx interrupt indicating packet coming, dis= able rx > > + * interrupt and returns to polling mode. > > + * > > + * The rte_eth_dev_rx_queue_intr_disable() function disables rx queue > > + * interrupt on specific rx queue of a port. > > + * > > + * @param port_id > > + * The port identifier of the Ethernet device. > > + * @param queue_id > > + * The index of the receive queue from which to retrieve input packe= ts. > > + * The value must be in the range [0, nb_rx_queue - 1] previously su= pplied > > + * to rte_eth_dev_configure(). > > + * @return > > + * - (0) if successful. > > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support > > + * that operation. > > + * - (-ENODEV) if *port_id* invalid. > > + */ > > +int rte_eth_dev_rx_queue_intr_disable(uint8_t port_id, > > + uint16_t queue_id); > > + > > +/** > > * Turn on the LED on the Ethernet device. > > * This function turns on the LED on the Ethernet device. > > * > > -- > > 1.8.1.4 > > > >