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 5D9BF255 for ; Thu, 29 Jan 2015 03:22:26 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 28 Jan 2015 18:22:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="446775058" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by FMSMGA003.fm.intel.com with ESMTP; 28 Jan 2015 18:08:36 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 29 Jan 2015 10:22:22 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.253]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0195.001; Thu, 29 Jan 2015 10:22:21 +0800 From: "Qiu, Michael" To: "Zhou, Danny" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v1 1/5] ethdev: add rx interrupt enable/disable functions Thread-Index: AQHQOt/+Ae46oo6AGkGs7rHNSiUpNQ== Date: Thu, 29 Jan 2015 02:22:20 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CCD9CD@SHSMSX101.ccr.corp.intel.com> References: <1422438631-7853-1-git-send-email-danny.zhou@intel.com> <1422438631-7853-2-git-send-email-danny.zhou@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 v1 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, 29 Jan 2015 02:22:27 -0000 On 1/28/2015 5:51 PM, Danny Zhou wrote:=0A= =0A= Commit log is better for others to review the patch I think, it's=0A= helpful for others to understand your patch.=0A= =0A= > Signed-off-by: Danny Zhou =0A= > ---=0A= > lib/librte_ether/rte_ethdev.c | 45 ++++++++++++++++++++++++++++++++++=0A= > lib/librte_ether/rte_ethdev.h | 57 +++++++++++++++++++++++++++++++++++++= ++++++=0A= > 2 files changed, 102 insertions(+)=0A= >=0A= > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c=0A= > index ea3a1fb..dd66cd9 100644=0A= > --- a/lib/librte_ether/rte_ethdev.c=0A= > +++ b/lib/librte_ether/rte_ethdev.c=0A= > @@ -2825,6 +2825,51 @@ _rte_eth_dev_callback_process(struct rte_eth_dev *= dev,=0A= > }=0A= > rte_spinlock_unlock(&rte_eth_dev_cb_lock);=0A= > }=0A= > +=0A= > +int=0A= > +rte_eth_dev_rx_queue_intr_enable(uint8_t port_id,=0A= > + uint16_t queue_id)=0A= > +{=0A= > + struct rte_eth_dev *dev;=0A= > +=0A= > + if (port_id >=3D nb_ports) {=0A= > + PMD_DEBUG_TRACE("Invalid port_id=3D%d\n", port_id);=0A= > + return (-ENODEV);=0A= > + }=0A= > +=0A= > + dev =3D &rte_eth_devices[port_id];=0A= > + if (dev =3D=3D NULL) {=0A= > + PMD_DEBUG_TRACE("Invalid port device\n");=0A= > + return (-ENODEV);=0A= > + }=0A= > +=0A= > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_enable, -ENOTSUP);=0A= > + (*dev->dev_ops->rx_queue_intr_enable)(dev, queue_id);=0A= =0A= As callback function rx_queue_intr_enabl() has a return value, I think=0A= it better to do a check, although all your implement always return a=0A= value of zero.=0A= =0A= BTW, better to add a blank line before last return.=0A= =0A= Thanks,=0A= Michael=0A= > + return 0;=0A= > +}=0A= > +=0A= > +int=0A= > +rte_eth_dev_rx_queue_intr_disable(uint8_t port_id,=0A= > + uint16_t queue_id)=0A= > +{=0A= > + struct rte_eth_dev *dev;=0A= > +=0A= > + if (port_id >=3D nb_ports) {=0A= > + PMD_DEBUG_TRACE("Invalid port_id=3D%d\n", port_id);=0A= > + return (-ENODEV);=0A= > + }=0A= > +=0A= > + dev =3D &rte_eth_devices[port_id];=0A= > + if (dev =3D=3D NULL) {=0A= > + PMD_DEBUG_TRACE("Invalid port device\n");=0A= > + return (-ENODEV);=0A= > + }=0A= > +=0A= > + FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_queue_intr_disable, -ENOTSUP);=0A= > + (*dev->dev_ops->rx_queue_intr_disable)(dev, queue_id);=0A= > + return 0;=0A= > +}=0A= > +=0A= > #ifdef RTE_NIC_BYPASS=0A= > int rte_eth_dev_bypass_init(uint8_t port_id)=0A= > {=0A= > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.= h=0A= > index 1200c1c..c080039 100644=0A= > --- a/lib/librte_ether/rte_ethdev.h=0A= > +++ b/lib/librte_ether/rte_ethdev.h=0A= > @@ -848,6 +848,8 @@ struct rte_eth_fdir {=0A= > struct rte_intr_conf {=0A= > /** enable/disable lsc interrupt. 0 (default) - disable, 1 enable */=0A= > uint16_t lsc;=0A= > + /** enable/disable rxq interrupt. 0 (default) - disable, 1 enable */=0A= > + uint16_t rxq;=0A= > };=0A= > =0A= > /**=0A= > @@ -1108,6 +1110,14 @@ typedef int (*eth_tx_queue_setup_t)(struct rte_eth= _dev *dev,=0A= > const struct rte_eth_txconf *tx_conf);=0A= > /**< @internal Setup a transmit queue of an Ethernet device. */=0A= > =0A= > +typedef int (*eth_rx_enable_intr_t)(struct rte_eth_dev *dev,=0A= > + uint16_t rx_queue_id);=0A= > +/**< @internal Enable interrupt of a receive queue of an Ethernet device= . */=0A= > +=0A= > +typedef int (*eth_rx_disable_intr_t)(struct rte_eth_dev *dev,=0A= > + uint16_t rx_queue_id);=0A= > +/**< @internal Disable interrupt of a receive queue of an Ethernet devic= e. */=0A= > +=0A= > typedef void (*eth_queue_release_t)(void *queue);=0A= > /**< @internal Release memory resources allocated by given RX/TX queue. = */=0A= > =0A= > @@ -1444,6 +1454,8 @@ struct eth_dev_ops {=0A= > eth_queue_start_t tx_queue_start;/**< Start TX for a queue.*/= =0A= > eth_queue_stop_t tx_queue_stop;/**< Stop TX for a queue.*/=0A= > eth_rx_queue_setup_t rx_queue_setup;/**< Set up device RX queue.*= /=0A= > + eth_rx_enable_intr_t rx_queue_intr_enable; /**< Enable Rx queue i= nterrupt. */=0A= > + eth_rx_disable_intr_t rx_queue_intr_disable; /**< Disable Rx queue= interrupt.*/=0A= > eth_queue_release_t rx_queue_release;/**< Release RX queue.*/=0A= > eth_rx_queue_count_t rx_queue_count; /**< Get Rx queue count. */= =0A= > eth_rx_descriptor_done_t rx_descriptor_done; /**< Check rxd DD bit *= /=0A= > @@ -2810,6 +2822,51 @@ void _rte_eth_dev_callback_process(struct rte_eth_= dev *dev,=0A= > enum rte_eth_event_type event);=0A= > =0A= > /**=0A= > + * When there is no rx packet coming in Rx Queue for a long time, we can= =0A= > + * sleep lcore related to RX Queue for power saving, and enable rx inter= rupt=0A= > + * to be triggered when rx packect arrives.=0A= > + *=0A= > + * The rte_eth_dev_rx_queue_intr_enable() function enables rx queue=0A= > + * interrupt on specific rx queue of a port.=0A= > + *=0A= > + * @param port_id=0A= > + * The port identifier of the Ethernet device.=0A= > + * @param queue_id=0A= > + * The index of the receive queue from which to retrieve input packets= .=0A= > + * The value must be in the range [0, nb_rx_queue - 1] previously supp= lied=0A= > + * to rte_eth_dev_configure().=0A= > + * @return=0A= > + * - (0) if successful.=0A= > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support=0A= > + * that operation.=0A= > + * - (-ENODEV) if *port_id* invalid.=0A= > + */=0A= > +int rte_eth_dev_rx_queue_intr_enable(uint8_t port_id,=0A= > + uint16_t queue_id);=0A= > +=0A= > +/**=0A= > + * When lcore wakes up from rx interrupt indicating packet coming, disab= le rx=0A= > + * interrupt and returns to polling mode.=0A= > + *=0A= > + * The rte_eth_dev_rx_queue_intr_disable() function disables rx queue=0A= > + * interrupt on specific rx queue of a port.=0A= > + *=0A= > + * @param port_id=0A= > + * The port identifier of the Ethernet device.=0A= > + * @param queue_id=0A= > + * The index of the receive queue from which to retrieve input packets= .=0A= > + * The value must be in the range [0, nb_rx_queue - 1] previously supp= lied=0A= > + * to rte_eth_dev_configure().=0A= > + * @return=0A= > + * - (0) if successful.=0A= > + * - (-ENOTSUP) if underlying hardware OR driver doesn't support=0A= > + * that operation.=0A= > + * - (-ENODEV) if *port_id* invalid.=0A= > + */=0A= > +int rte_eth_dev_rx_queue_intr_disable(uint8_t port_id,=0A= > + uint16_t queue_id);=0A= > +=0A= > +/**=0A= > * Turn on the LED on the Ethernet device.=0A= > * This function turns on the LED on the Ethernet device.=0A= > *=0A= =0A=