From 3c560ec3eade2c04e5d3d2bd77a461b290b5d6b3 Mon Sep 17 00:00:00 2001 From: Adrien Mazarguil Date: Wed, 14 Jun 2017 13:49:12 +0200 Subject: [PATCH] net/mlx4: fix Rx interrupts with multiple ports Several Ethernet device structures are allocated on top of a common PCI device for mlx4 adapters with multiple ports. These inherit a common interrupt handle from their parent PCI device, which prevents Rx interrupts from working properly on all ports as their configuration is overwritten. Use a local interrupt handle to address this issue. Fixes: 9f05a4b81809 ("net/mlx4: support user space Rx interrupt event") Signed-off-by: Adrien Mazarguil Acked-by: Moti Haimovsky --- drivers/net/mlx4/mlx4.c | 9 +++++++++ drivers/net/mlx4/mlx4.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c index 892d654e7b..b20ceccee9 100644 --- a/drivers/net/mlx4/mlx4.c +++ b/drivers/net/mlx4/mlx4.c @@ -6209,6 +6209,15 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) eth_dev->device->driver = &mlx4_driver.driver; + /* + * Copy and override interrupt handle to prevent it from + * being shared between all ethdev instances of a given PCI + * device. This is required to properly handle Rx interrupts + * on all ports. + */ + priv->intr_handle_dev = *eth_dev->intr_handle; + eth_dev->intr_handle = &priv->intr_handle_dev; + priv->dev = eth_dev; eth_dev->dev_ops = &mlx4_dev_ops; diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h index c46fc23690..b74fbf864a 100644 --- a/drivers/net/mlx4/mlx4.h +++ b/drivers/net/mlx4/mlx4.h @@ -345,6 +345,7 @@ struct priv { unsigned int txqs_n; /* TX queues array size. */ struct rxq *(*rxqs)[]; /* RX queues. */ struct txq *(*txqs)[]; /* TX queues. */ + struct rte_intr_handle intr_handle_dev; /* Device interrupt handler. */ struct rte_intr_handle intr_handle; /* Interrupt handler. */ struct rte_flow_drop *flow_drop_queue; /* Flow drop queue. */ LIST_HEAD(mlx4_flows, rte_flow) flows; -- 2.20.1