aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
diff options
context:
space:
mode:
authorTariq Toukan <tariqt@mellanox.com>2017-07-02 13:17:42 +0300
committerSaeed Mahameed <saeedm@mellanox.com>2017-09-03 06:34:09 +0300
commita8c2eb15797a0f0bf17734d365da7bdc3e263155 (patch)
tree155add1ef705830009a464619d4965608f97d99d /drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
parentnet/mlx5e: Use kernel's mechanism to avoid missing NAPIs (diff)
downloadlinux-dev-a8c2eb15797a0f0bf17734d365da7bdc3e263155.tar.xz
linux-dev-a8c2eb15797a0f0bf17734d365da7bdc3e263155.zip
net/mlx5e: Stop NAPI when irq balancer changes affinity
NAPI context keeps rescheduling on same CPU as long as it's busy. This doesn't give the oppurtunity for changes in irq affinities to take effect. Fix that by calling napi_complete_done() upon a change in affinity. This would stop the NAPI and reschedule it on the new CPU. Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
index 92d9aa1cddd6..e906b754415c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
@@ -30,8 +30,20 @@
* SOFTWARE.
*/
+#include <linux/irq.h>
#include "en.h"
+static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c)
+{
+ int current_cpu = smp_processor_id();
+ const struct cpumask *aff;
+ struct irq_data *idata;
+
+ idata = irq_desc_get_irq_data(c->irq_desc);
+ aff = irq_data_get_affinity_mask(idata);
+ return cpumask_test_cpu(current_cpu, aff);
+}
+
int mlx5e_napi_poll(struct napi_struct *napi, int budget)
{
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
@@ -51,8 +63,12 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
busy |= c->rq.post_wqes(&c->rq);
- if (busy)
- return budget;
+ if (busy) {
+ if (likely(mlx5e_channel_no_affinity_change(c)))
+ return budget;
+ if (work_done == budget)
+ work_done--;
+ }
if (unlikely(!napi_complete_done(napi, work_done)))
return work_done;