diff mbox

[dpdk-dev] net/i40e: fix wrong handle when enable interrupt

Message ID 1486670573-5447-1-git-send-email-qi.z.zhang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Zhang, Qi Z Feb. 9, 2017, 8:02 p.m. UTC
In i40e_dev_interrupt_handler, when call rte_intr_enable,
We should parse dev->intr_handle but not intr_handle.
intr_handle is the copy of dev->intr_handle when
it is registered, but parameter of dev->intr_handle is
possible to be modifed later in i40e driver.

Fixes: 2ce7a1ed09fc ("net/i40e: localize mapping of ethdev to PCI device")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ferruh Yigit Feb. 10, 2017, 10:03 a.m. UTC | #1
On 2/9/2017 8:02 PM, Qi Zhang wrote:
> In i40e_dev_interrupt_handler, when call rte_intr_enable,
> We should parse dev->intr_handle but not intr_handle.
> intr_handle is the copy of dev->intr_handle when
> it is registered, but parameter of dev->intr_handle is
> possible to be modifed later in i40e driver.

If dev->intr_handle modified, shouldn't driver unregister old one and
register new interrupt handle?

Registering one handle but using another in handler function seems wrong.

> 
> Fixes: 2ce7a1ed09fc ("net/i40e: localize mapping of ethdev to PCI device")
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

<...>
diff mbox

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4492bcc..1032d0f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -5770,7 +5770,7 @@  i40e_dev_handle_aq_msg(struct rte_eth_dev *dev)
  *  void
  */
 static void
-i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
+i40e_dev_interrupt_handler(__rte_unused struct rte_intr_handle *intr_handle,
 			   void *param)
 {
 	struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
@@ -5817,7 +5817,7 @@  i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
 done:
 	/* Enable interrupt */
 	i40e_pf_enable_irq0(hw);
-	rte_intr_enable(intr_handle);
+	rte_intr_enable(dev->intr_handle);
 }
 
 static int