numam-dpdk/drivers/net/mlx4
Adrien Mazarguil 0a2ae70319 net/mlx4: fix Rx interrupts management
This commit addresses various issues that may lead to undefined behavior
when configuring Rx interrupts.

While failure to create a Rx queue completion channel in rxq_setup()
prevents that queue from being created, existing queues still have theirs.
Since the error handler disables dev_conf.intr_conf.rxq as well, subsequent
calls to rxq_setup() create Rx queues without interrupts. This leads to a
scenario where not all Rx queues support interrupts; missing checks on the
presence of completion channels may crash the application.

Considering that the PMD is not supposed to disable user-provided
configuration parameters (dev_conf.intr_conf.rxq), and that these can
change for subsequent rxq_setup() calls anyway, properly supporting a mixed
mode where not all Rx queues have interrupts enabled is a better approach.

To do so with a minimum set of changes, priv_intr_efd_enable() and
priv_create_intr_vec() are first refactored as a single
priv_rx_intr_vec_enable() function (same for their "disable" counterparts).
Since they had to be used together, there was no point in keeping them
separate.

Remaining changes:

- Always clean up before reconfiguring interrupts to avoid memory leaks.
- Always clean up when closing the device.
- Use malloc()/free() instead of their rte_*() counterparts since there is
  no need to store the vector in huge pages-backed memory.
- Allow more Rx queues than the size of the event file descriptor array as
  long as Rx interrupts are not requested on all of them.
- Properly clean up interrupt handle when disabling Rx interrupts (nb_efd
  and intr_vec reset to 0).
- Check completion channel presence while toggling Rx interrupts on a given
  queue.

Fixes: 9f05a4b818 ("net/mlx4: support user space Rx interrupt event")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Moti Haimovsky <motih@mellanox.com>
2017-07-06 15:00:56 +02:00
..
Makefile drivers/net: remove unused DEPDIRS from makefiles 2017-04-06 20:58:59 +02:00
mlx4_flow.c net/mlx4: use a single drop queue for all drop flows 2017-04-04 19:03:03 +02:00
mlx4_flow.h net/mlx4: use a single drop queue for all drop flows 2017-04-04 19:03:03 +02:00
mlx4.c net/mlx4: fix Rx interrupts management 2017-07-06 15:00:56 +02:00
mlx4.h net/mlx4: fix Rx interrupts with multiple ports 2017-07-06 15:00:56 +02:00
rte_pmd_mlx4_version.map mlx4: move to drivers/net/ 2015-05-22 16:06:22 +02:00