* [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-10-26 7:35 ` Liang, Cunming
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 2/7] e1000: separate lsc and rxq interrupt function Yong Liu
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
Enable rx interrupt support on e1000 PF non-IOV mode.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 912f5dd..99beb9c 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -81,6 +81,7 @@ static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
static int eth_em_flow_ctrl_set(struct rte_eth_dev *dev,
struct rte_eth_fc_conf *fc_conf);
static int eth_em_interrupt_setup(struct rte_eth_dev *dev);
+static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
static int eth_em_interrupt_action(struct rte_eth_dev *dev);
static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
@@ -107,6 +108,7 @@ static void em_vlan_hw_strip_disable(struct rte_eth_dev *dev);
static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
*/
+static void em_rxq_intr_enable(struct e1000_hw *hw);
static int eth_em_led_on(struct rte_eth_dev *dev);
static int eth_em_led_off(struct rte_eth_dev *dev);
@@ -608,6 +610,9 @@ eth_em_start(struct rte_eth_dev *dev)
return ret;
}
}
+ /* check if rxq interrupt is enabled */
+ if (dev->data->dev_conf.intr_conf.rxq != 0)
+ eth_em_rxq_interrupt_setup(dev);
adapter->stopped = 0;
@@ -1276,6 +1281,39 @@ eth_em_interrupt_setup(struct rte_eth_dev *dev)
return (0);
}
+/* It clears the interrupt causes and enables the interrupt.
+ * It will be called once only during nic initialized.
+ *
+ * @param dev
+ * Pointer to struct rte_eth_dev.
+ *
+ * @return
+ * - On success, zero.
+ * - On failure, a negative value.
+ */
+static int
+eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev)
+{
+ struct e1000_hw *hw =
+ E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ E1000_READ_REG(hw, E1000_ICR);
+ em_rxq_intr_enable(hw);
+ return 0;
+}
+
+/* It enable receive packet interrupt.
+ * @param hw
+ * Pointer to struct e1000_hw
+ *
+ * @return
+ */
+static void
+em_rxq_intr_enable(struct e1000_hw *hw)
+{
+ E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_RXT0);
+}
+
/*
* It reads ICR and gets interrupt causes, check it and set a bit flag
* to update link status.
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support Yong Liu
@ 2015-10-26 7:35 ` Liang, Cunming
2015-10-27 14:48 ` Liu, Yong
0 siblings, 1 reply; 11+ messages in thread
From: Liang, Cunming @ 2015-10-26 7:35 UTC (permalink / raw)
To: Yong Liu, dev
Hi Yong,
On 9/25/2015 4:28 PM, Yong Liu wrote:
> From: Marvin Liu <yong.liu@intel.com>
>
> Enable rx interrupt support on e1000 PF non-IOV mode.
As I know, e1000 hasn't IOV mode. It's not necessary to mention PF
non-IOV mode or not.
In addition, it's necessary to mention the patch series is to support
uio/vfio or both? To allow physical/emulation or both?
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index 912f5dd..99beb9c 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -81,6 +81,7 @@ static int eth_em_flow_ctrl_get(struct rte_eth_dev *dev,
> static int eth_em_flow_ctrl_set(struct rte_eth_dev *dev,
> struct rte_eth_fc_conf *fc_conf);
> static int eth_em_interrupt_setup(struct rte_eth_dev *dev);
> +static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
> static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
> static int eth_em_interrupt_action(struct rte_eth_dev *dev);
> static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
> @@ -107,6 +108,7 @@ static void em_vlan_hw_strip_disable(struct rte_eth_dev *dev);
> static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on);
> */
> +static void em_rxq_intr_enable(struct e1000_hw *hw);
> static int eth_em_led_on(struct rte_eth_dev *dev);
> static int eth_em_led_off(struct rte_eth_dev *dev);
>
> @@ -608,6 +610,9 @@ eth_em_start(struct rte_eth_dev *dev)
> return ret;
> }
> }
> + /* check if rxq interrupt is enabled */
> + if (dev->data->dev_conf.intr_conf.rxq != 0)
> + eth_em_rxq_interrupt_setup(dev);
>
> adapter->stopped = 0;
>
> @@ -1276,6 +1281,39 @@ eth_em_interrupt_setup(struct rte_eth_dev *dev)
> return (0);
> }
>
> +/* It clears the interrupt causes and enables the interrupt.
Comments start from next line of '/*' or '/**'?
> + * It will be called once only during nic initialized.
> + *
> + * @param dev
> + * Pointer to struct rte_eth_dev.
> + *
> + * @return
> + * - On success, zero.
> + * - On failure, a negative value.
> + */
> +static int
> +eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev)
> +{
> + struct e1000_hw *hw =
> + E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + E1000_READ_REG(hw, E1000_ICR);
> + em_rxq_intr_enable(hw);
> + return 0;
> +}
> +
> +/* It enable receive packet interrupt.
The same.
> + * @param hw
> + * Pointer to struct e1000_hw
> + *
> + * @return
> + */
> +static void
> +em_rxq_intr_enable(struct e1000_hw *hw)
> +{
> + E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_RXT0);
To make sure post-write be finished immediately, E1000_WRITE_FLUSH()
shall add behind.
> +}
> +
> /*
> * It reads ICR and gets interrupt causes, check it and set a bit flag
> * to update link status.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support
2015-10-26 7:35 ` Liang, Cunming
@ 2015-10-27 14:48 ` Liu, Yong
0 siblings, 0 replies; 11+ messages in thread
From: Liu, Yong @ 2015-10-27 14:48 UTC (permalink / raw)
To: Liang, Cunming, dev
Thanks Cunming, I'll send out v2 patch.
> -----Original Message-----
> From: Liang, Cunming
> Sent: Monday, October 26, 2015 3:36 PM
> To: Liu, Yong; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support
>
> Hi Yong,
>
> On 9/25/2015 4:28 PM, Yong Liu wrote:
> > From: Marvin Liu <yong.liu@intel.com>
> >
> > Enable rx interrupt support on e1000 PF non-IOV mode.
> As I know, e1000 hasn't IOV mode. It's not necessary to mention PF
> non-IOV mode or not.
> In addition, it's necessary to mention the patch series is to support
> uio/vfio or both? To allow physical/emulation or both?
> >
The patch work with uio and vfio+msi mode. It support both physical device and qemu emulated device.
This information will be added into cover letter.
> > Signed-off-by: Marvin Liu <yong.liu@intel.com>
> >
> > diff --git a/drivers/net/e1000/em_ethdev.c
> b/drivers/net/e1000/em_ethdev.c
> > index 912f5dd..99beb9c 100644
> > --- a/drivers/net/e1000/em_ethdev.c
> > +++ b/drivers/net/e1000/em_ethdev.c
> > @@ -81,6 +81,7 @@ static int eth_em_flow_ctrl_get(struct rte_eth_dev
> *dev,
> > static int eth_em_flow_ctrl_set(struct rte_eth_dev *dev,
> > struct rte_eth_fc_conf *fc_conf);
> > static int eth_em_interrupt_setup(struct rte_eth_dev *dev);
> > +static int eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev);
> > static int eth_em_interrupt_get_status(struct rte_eth_dev *dev);
> > static int eth_em_interrupt_action(struct rte_eth_dev *dev);
> > static void eth_em_interrupt_handler(struct rte_intr_handle *handle,
> > @@ -107,6 +108,7 @@ static void em_vlan_hw_strip_disable(struct
> rte_eth_dev *dev);
> > static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
> > uint16_t vlan_id, int on);
> > */
> > +static void em_rxq_intr_enable(struct e1000_hw *hw);
> > static int eth_em_led_on(struct rte_eth_dev *dev);
> > static int eth_em_led_off(struct rte_eth_dev *dev);
> >
> > @@ -608,6 +610,9 @@ eth_em_start(struct rte_eth_dev *dev)
> > return ret;
> > }
> > }
> > + /* check if rxq interrupt is enabled */
> > + if (dev->data->dev_conf.intr_conf.rxq != 0)
> > + eth_em_rxq_interrupt_setup(dev);
> >
> > adapter->stopped = 0;
> >
> > @@ -1276,6 +1281,39 @@ eth_em_interrupt_setup(struct rte_eth_dev *dev)
> > return (0);
> > }
> >
> > +/* It clears the interrupt causes and enables the interrupt.
> Comments start from next line of '/*' or '/**'?
> > + * It will be called once only during nic initialized.
> > + *
> > + * @param dev
> > + * Pointer to struct rte_eth_dev.
> > + *
> > + * @return
> > + * - On success, zero.
> > + * - On failure, a negative value.
> > + */
> > +static int
> > +eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev)
> > +{
> > + struct e1000_hw *hw =
> > + E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> > +
> > + E1000_READ_REG(hw, E1000_ICR);
> > + em_rxq_intr_enable(hw);
> > + return 0;
> > +}
> > +
> > +/* It enable receive packet interrupt.
> The same.
> > + * @param hw
> > + * Pointer to struct e1000_hw
> > + *
> > + * @return
> > + */
> > +static void
> > +em_rxq_intr_enable(struct e1000_hw *hw)
> > +{
> > + E1000_WRITE_REG(hw, E1000_IMS, E1000_IMS_RXT0);
> To make sure post-write be finished immediately, E1000_WRITE_FLUSH()
> shall add behind.
Thanks, will added into v2 patch.
> > +}
> > +
> > /*
> > * It reads ICR and gets interrupt causes, check it and set a bit flag
> > * to update link status.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 2/7] e1000: separate lsc and rxq interrupt function
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 3/7] e1000: add ethdev rxq enable and disable function Yong Liu
` (4 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
Separate lsc and rxq interrupt for they have different interrupt handlers.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 99beb9c..e86c039 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -108,11 +108,13 @@ static void em_vlan_hw_strip_disable(struct rte_eth_dev *dev);
static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
*/
+static void em_lsc_intr_disable(struct e1000_hw *hw);
static void em_rxq_intr_enable(struct e1000_hw *hw);
+static void em_rxq_intr_disable(struct e1000_hw *hw);
+
static int eth_em_led_on(struct rte_eth_dev *dev);
static int eth_em_led_off(struct rte_eth_dev *dev);
-static void em_intr_disable(struct e1000_hw *hw);
static int em_get_rx_buffer_size(struct e1000_hw *hw);
static void eth_em_rar_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr,
uint32_t index, uint32_t pool);
@@ -640,7 +642,9 @@ eth_em_stop(struct rte_eth_dev *dev)
struct rte_eth_link link;
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- em_intr_disable(hw);
+ em_rxq_intr_disable(hw);
+ em_lsc_intr_disable(hw);
+
e1000_reset_hw(hw);
if (hw->mac.type >= e1000_82544)
E1000_WRITE_REG(hw, E1000_WUC, 0);
@@ -1254,12 +1258,6 @@ eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask)
}
}
-static void
-em_intr_disable(struct e1000_hw *hw)
-{
- E1000_WRITE_REG(hw, E1000_IMC, ~0);
-}
-
/**
* It enables the interrupt mask and then enable the interrupt.
*
@@ -1302,6 +1300,31 @@ eth_em_rxq_interrupt_setup(struct rte_eth_dev *dev)
return 0;
}
+/* It disabled lsc interrupt.
+ * @param hw
+ * Pointer to struct e1000_hw
+ *
+ * @return
+ */
+static void
+em_lsc_intr_disable(struct e1000_hw *hw)
+{
+ E1000_WRITE_REG(hw, E1000_IMC, E1000_IMS_LSC);
+}
+
+/* It disabled receive packet interrupt.
+ * @param hw
+ * Pointer to struct e1000_hw
+ *
+ * @return
+ */
+static void
+em_rxq_intr_disable(struct e1000_hw *hw)
+{
+ E1000_READ_REG(hw, E1000_ICR);
+ E1000_WRITE_REG(hw, E1000_IMC, E1000_IMS_RXT0);
+}
+
/* It enable receive packet interrupt.
* @param hw
* Pointer to struct e1000_hw
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 3/7] e1000: add ethdev rxq enable and disable function
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 1/7] e1000: add rx interrupt support Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 2/7] e1000: separate lsc and rxq interrupt function Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-10-26 7:37 ` Liang, Cunming
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 4/7] e1000: add rxq interrupt handler Yong Liu
` (3 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
Implement rxq interrupt related functions in eth_dev_ops structure.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index e86c039..2b67b62 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -108,6 +108,9 @@ static void em_vlan_hw_strip_disable(struct rte_eth_dev *dev);
static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
uint16_t vlan_id, int on);
*/
+
+static int eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
+static int eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
static void em_lsc_intr_disable(struct e1000_hw *hw);
static void em_rxq_intr_enable(struct e1000_hw *hw);
static void em_rxq_intr_disable(struct e1000_hw *hw);
@@ -163,6 +166,8 @@ static const struct eth_dev_ops eth_em_ops = {
.rx_descriptor_done = eth_em_rx_descriptor_done,
.tx_queue_setup = eth_em_tx_queue_setup,
.tx_queue_release = eth_em_tx_queue_release,
+ .rx_queue_intr_enable = eth_em_rx_queue_intr_enable,
+ .rx_queue_intr_disable = eth_em_rx_queue_intr_disable,
.dev_led_on = eth_em_led_on,
.dev_led_off = eth_em_led_off,
.flow_ctrl_get = eth_em_flow_ctrl_get,
@@ -891,6 +896,27 @@ eth_em_stats_reset(struct rte_eth_dev *dev)
memset(hw_stats, 0, sizeof(*hw_stats));
}
+static int
+eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __attribute__((__unused__))uint16_t queue_id)
+{
+ struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ em_rxq_intr_enable(hw);
+ rte_intr_enable(&(dev->pci_dev->intr_handle));
+
+ return 0;
+}
+
+static int
+eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __attribute__((__unused__))uint16_t queue_id)
+{
+ struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ em_rxq_intr_disable(hw);
+
+ return 0;
+}
+
static uint32_t
em_get_max_pktlen(const struct e1000_hw *hw)
{
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v1 3/7] e1000: add ethdev rxq enable and disable function
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 3/7] e1000: add ethdev rxq enable and disable function Yong Liu
@ 2015-10-26 7:37 ` Liang, Cunming
0 siblings, 0 replies; 11+ messages in thread
From: Liang, Cunming @ 2015-10-26 7:37 UTC (permalink / raw)
To: Yong Liu, dev
On 9/25/2015 4:28 PM, Yong Liu wrote:
> From: Marvin Liu <yong.liu@intel.com>
>
> Implement rxq interrupt related functions in eth_dev_ops structure.
>
> Signed-off-by: Marvin Liu <yong.liu@intel.com>
>
> diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
> index e86c039..2b67b62 100644
> --- a/drivers/net/e1000/em_ethdev.c
> +++ b/drivers/net/e1000/em_ethdev.c
> @@ -108,6 +108,9 @@ static void em_vlan_hw_strip_disable(struct rte_eth_dev *dev);
> static void eth_em_vlan_filter_set(struct rte_eth_dev *dev,
> uint16_t vlan_id, int on);
> */
> +
> +static int eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
> +static int eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
> static void em_lsc_intr_disable(struct e1000_hw *hw);
> static void em_rxq_intr_enable(struct e1000_hw *hw);
> static void em_rxq_intr_disable(struct e1000_hw *hw);
> @@ -163,6 +166,8 @@ static const struct eth_dev_ops eth_em_ops = {
> .rx_descriptor_done = eth_em_rx_descriptor_done,
> .tx_queue_setup = eth_em_tx_queue_setup,
> .tx_queue_release = eth_em_tx_queue_release,
> + .rx_queue_intr_enable = eth_em_rx_queue_intr_enable,
> + .rx_queue_intr_disable = eth_em_rx_queue_intr_disable,
> .dev_led_on = eth_em_led_on,
> .dev_led_off = eth_em_led_off,
> .flow_ctrl_get = eth_em_flow_ctrl_get,
> @@ -891,6 +896,27 @@ eth_em_stats_reset(struct rte_eth_dev *dev)
> memset(hw_stats, 0, sizeof(*hw_stats));
> }
>
> +static int
> +eth_em_rx_queue_intr_enable(struct rte_eth_dev *dev, __attribute__((__unused__))uint16_t queue_id)
Suggest to use __rte_unused instead of __attribute__((__unused__)).
> +{
> + struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + em_rxq_intr_enable(hw);
> + rte_intr_enable(&(dev->pci_dev->intr_handle));
> +
> + return 0;
> +}
> +
> +static int
> +eth_em_rx_queue_intr_disable(struct rte_eth_dev *dev, __attribute__((__unused__))uint16_t queue_id)
The same.
> +{
> + struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +
> + em_rxq_intr_disable(hw);
> +
> + return 0;
> +}
> +
> static uint32_t
> em_get_max_pktlen(const struct e1000_hw *hw)
> {
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 4/7] e1000: add rxq interrupt handler
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
` (2 preceding siblings ...)
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 3/7] e1000: add ethdev rxq enable and disable function Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 5/7] e1000: check lsc and rxq not enable in the same time Yong Liu
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
When datapath rxq interupt is enabled, enable device rxq.
After device stopped, remove the interrupt handler.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 2b67b62..5d94b55 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -501,7 +501,9 @@ eth_em_start(struct rte_eth_dev *dev)
E1000_DEV_PRIVATE(dev->data->dev_private);
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
int ret, mask;
+ uint32_t intr_vector = 0;
PMD_INIT_FUNC_TRACE();
@@ -537,6 +539,26 @@ eth_em_start(struct rte_eth_dev *dev)
/* Configure for OS presence */
em_init_manageability(hw);
+ 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_dp_is_en(intr_handle)) {
+ intr_handle->intr_vec =
+ rte_zmalloc("intr_vec",
+ 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);
+ return -ENOMEM;
+ }
+
+ /* enable rx interrupt */
+ em_rxq_intr_enable(hw);
+ }
+
eth_em_tx_init(dev);
ret = eth_em_rx_init(dev);
@@ -621,6 +643,8 @@ eth_em_start(struct rte_eth_dev *dev)
if (dev->data->dev_conf.intr_conf.rxq != 0)
eth_em_rxq_interrupt_setup(dev);
+ rte_intr_enable(intr_handle);
+
adapter->stopped = 0;
PMD_INIT_LOG(DEBUG, "<<");
@@ -646,6 +670,7 @@ eth_em_stop(struct rte_eth_dev *dev)
{
struct rte_eth_link link;
struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_intr_handle *intr_handle = &dev->pci_dev->intr_handle;
em_rxq_intr_disable(hw);
em_lsc_intr_disable(hw);
@@ -662,6 +687,12 @@ eth_em_stop(struct rte_eth_dev *dev)
/* clear the recorded link status */
memset(&link, 0, sizeof(link));
rte_em_dev_atomic_write_link_status(dev, &link);
+ /* Clean datapath event and queue/vec mapping */
+ rte_intr_efd_disable(intr_handle);
+ if (intr_handle->intr_vec != NULL) {
+ rte_free(intr_handle->intr_vec);
+ intr_handle->intr_vec = NULL;
+ }
}
static void
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 5/7] e1000: check lsc and rxq not enable in the same time
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
` (3 preceding siblings ...)
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 4/7] e1000: add rxq interrupt handler Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 6/7] e1000: lsc interrupt setup only enable itself Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 7/7] l3fwd-power: disable interrupt when wake up from sleep Yong Liu
6 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
e1000 only support one type of interrupt cause, so remove lsc interrupt
handler if rxq enabled.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 5d94b55..920d814 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -630,14 +630,22 @@ eth_em_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) {
- ret = eth_em_interrupt_setup(dev);
- if (ret) {
- PMD_INIT_LOG(ERR, "Unable to setup interrupts");
- em_dev_clear_queues(dev);
- return ret;
- }
+ if (rte_intr_allow_others(intr_handle)) {
+ /* check if lsc interrupt is enabled */
+ if (dev->data->dev_conf.intr_conf.lsc != 0)
+ ret = eth_em_interrupt_setup(dev);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Unable to setup interrupts");
+ em_dev_clear_queues(dev);
+ return ret;
+ }
+ } else {
+ rte_intr_callback_unregister(intr_handle,
+ eth_em_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)
@@ -687,6 +695,13 @@ eth_em_stop(struct rte_eth_dev *dev)
/* clear the recorded link status */
memset(&link, 0, sizeof(link));
rte_em_dev_atomic_write_link_status(dev, &link);
+
+ if (!rte_intr_allow_others(intr_handle))
+ /* resume to the default handler */
+ rte_intr_callback_register(intr_handle,
+ eth_em_interrupt_handler,
+ (void *)dev);
+
/* Clean datapath event and queue/vec mapping */
rte_intr_efd_disable(intr_handle);
if (intr_handle->intr_vec != NULL) {
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 6/7] e1000: lsc interrupt setup only enable itself
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
` (4 preceding siblings ...)
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 5/7] e1000: check lsc and rxq not enable in the same time Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 7/7] l3fwd-power: disable interrupt when wake up from sleep Yong Liu
6 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
Only mask lsc interrupt bit when setup device interrupt.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 920d814..4e2ebf1 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -1343,11 +1343,14 @@ eth_em_vlan_offload_set(struct rte_eth_dev *dev, int mask)
static int
eth_em_interrupt_setup(struct rte_eth_dev *dev)
{
+ uint32_t regval;
struct e1000_hw *hw =
E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- E1000_WRITE_REG(hw, E1000_IMS, E1000_ICR_LSC);
- rte_intr_enable(&(dev->pci_dev->intr_handle));
+ /* clear interrupt */
+ E1000_READ_REG(hw, E1000_ICR);
+ regval = E1000_READ_REG(hw, E1000_IMS);
+ E1000_WRITE_REG(hw, E1000_IMS, regval | E1000_ICR_LSC);
return (0);
}
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v1 7/7] l3fwd-power: disable interrupt when wake up from sleep
2015-09-25 8:28 [dpdk-dev] [PATCH v1 0/7] interrupt mode for e1000 Yong Liu
` (5 preceding siblings ...)
2015-09-25 8:28 ` [dpdk-dev] [PATCH v1 6/7] e1000: lsc interrupt setup only enable itself Yong Liu
@ 2015-09-25 8:28 ` Yong Liu
6 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-09-25 8:28 UTC (permalink / raw)
To: dev
From: Marvin Liu <yong.liu@intel.com>
e1000 device interrupt can't be auto-clear. So disble interrupt when
thread wake-up.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 8bb88ce..9175989 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -798,6 +798,7 @@ sleep_until_rx_interrupt(int num)
port_id = ((uintptr_t)data) >> CHAR_BIT;
queue_id = ((uintptr_t)data) &
RTE_LEN2MASK(CHAR_BIT, uint8_t);
+ rte_eth_dev_rx_intr_disable(port_id, queue_id);
RTE_LOG(INFO, L3FWD_POWER,
"lcore %u is waked up from rx interrupt on"
" port %d queue %d\n",
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread