From 1eb1d5e0bb1c54ea4ecba3cbb30fe66c91560706 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Fri, 12 Mar 2021 14:45:19 +0100 Subject: kernel: add compatibility with upstream threaded NAPI patch Enable threading if dev->threaded is set. This will be used to bring mt76 back in sync with upstream Signed-off-by: Felix Fietkau (cherry-picked from commit 3d1ea0d77f9d) --- ...net-add-support-for-threaded-NAPI-polling.patch | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/target/linux/generic/pending-5.4/690-net-add-support-for-threaded-NAPI-polling.patch b/target/linux/generic/pending-5.4/690-net-add-support-for-threaded-NAPI-polling.patch index 6d24007b6a..a90bb2c285 100644 --- a/target/linux/generic/pending-5.4/690-net-add-support-for-threaded-NAPI-polling.patch +++ b/target/linux/generic/pending-5.4/690-net-add-support-for-threaded-NAPI-polling.patch @@ -50,7 +50,15 @@ Signed-off-by: Felix Fietkau }; enum gro_result { -@@ -2249,6 +2252,26 @@ void netif_napi_add(struct net_device *d +@@ -2092,6 +2095,7 @@ struct net_device { + struct lock_class_key addr_list_lock_key; + bool proto_down; + unsigned wol_enabled:1; ++ unsigned threaded:1; + }; + #define to_net_dev(d) container_of(d, struct net_device, dev) + +@@ -2249,6 +2253,26 @@ void netif_napi_add(struct net_device *d int (*poll)(struct napi_struct *, int), int weight); /** @@ -111,7 +119,7 @@ Signed-off-by: Felix Fietkau ____napi_schedule(this_cpu_ptr(&softnet_data), n); } EXPORT_SYMBOL(__napi_schedule_irqoff); -@@ -6219,6 +6230,84 @@ static void init_gro_hash(struct napi_st +@@ -6219,9 +6230,89 @@ static void init_gro_hash(struct napi_st napi->gro_bitmask = 0; } @@ -196,7 +204,12 @@ Signed-off-by: Felix Fietkau void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { -@@ -6238,6 +6327,7 @@ void netif_napi_add(struct net_device *d ++ if (dev->threaded) ++ set_bit(NAPI_STATE_THREADED, &napi->state); + INIT_LIST_HEAD(&napi->poll_list); + hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); + napi->timer.function = napi_watchdog; +@@ -6238,6 +6329,7 @@ void netif_napi_add(struct net_device *d #ifdef CONFIG_NETPOLL napi->poll_owner = -1; #endif @@ -204,7 +217,7 @@ Signed-off-by: Felix Fietkau set_bit(NAPI_STATE_SCHED, &napi->state); set_bit(NAPI_STATE_NPSVC, &napi->state); list_add_rcu(&napi->dev_list, &dev->napi_list); -@@ -6278,6 +6368,7 @@ static void flush_gro_hash(struct napi_s +@@ -6278,6 +6370,7 @@ static void flush_gro_hash(struct napi_s void netif_napi_del(struct napi_struct *napi) { might_sleep(); @@ -212,7 +225,7 @@ Signed-off-by: Felix Fietkau if (napi_hash_del(napi)) synchronize_net(); list_del_init(&napi->dev_list); -@@ -6290,50 +6381,18 @@ EXPORT_SYMBOL(netif_napi_del); +@@ -6290,50 +6383,18 @@ EXPORT_SYMBOL(netif_napi_del); static int napi_poll(struct napi_struct *n, struct list_head *repoll) { @@ -267,7 +280,7 @@ Signed-off-by: Felix Fietkau /* Some drivers may have called napi_schedule * prior to exhausting their budget. -@@ -10271,6 +10330,10 @@ static int __init net_dev_init(void) +@@ -10271,6 +10332,10 @@ static int __init net_dev_init(void) sd->backlog.weight = weight_p; } -- cgit v1.2.3