mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-18 18:56:37 +00:00
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 <nbd@nbd.name>
This commit is contained in:
parent
0d5bf53197
commit
3d1ea0d77f
@ -50,7 +50,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
};
|
||||
|
||||
enum gro_result {
|
||||
@@ -2413,6 +2416,26 @@ void netif_napi_add(struct net_device *d
|
||||
@@ -2211,6 +2214,7 @@ struct net_device {
|
||||
struct lock_class_key *qdisc_running_key;
|
||||
bool proto_down;
|
||||
unsigned wol_enabled:1;
|
||||
+ unsigned threaded:1;
|
||||
|
||||
struct list_head net_notifier_list;
|
||||
|
||||
@@ -2413,6 +2417,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 <nbd@nbd.name>
|
||||
____napi_schedule(this_cpu_ptr(&softnet_data), n);
|
||||
}
|
||||
EXPORT_SYMBOL(__napi_schedule_irqoff);
|
||||
@@ -6715,6 +6726,86 @@ static void init_gro_hash(struct napi_st
|
||||
@@ -6715,12 +6726,94 @@ static void init_gro_hash(struct napi_st
|
||||
napi->gro_bitmask = 0;
|
||||
}
|
||||
|
||||
@ -198,7 +206,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
|
||||
int (*poll)(struct napi_struct *, int), int weight)
|
||||
{
|
||||
@@ -6738,6 +6829,7 @@ void netif_napi_add(struct net_device *d
|
||||
if (WARN_ON(test_and_set_bit(NAPI_STATE_LISTED, &napi->state)))
|
||||
return;
|
||||
|
||||
+ if (dev->threaded)
|
||||
+ set_bit(NAPI_STATE_THREADED, &napi->state);
|
||||
INIT_LIST_HEAD(&napi->poll_list);
|
||||
INIT_HLIST_NODE(&napi->napi_hash_node);
|
||||
hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
|
||||
@@ -6738,6 +6831,7 @@ void netif_napi_add(struct net_device *d
|
||||
#ifdef CONFIG_NETPOLL
|
||||
napi->poll_owner = -1;
|
||||
#endif
|
||||
@ -206,7 +222,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
set_bit(NAPI_STATE_SCHED, &napi->state);
|
||||
set_bit(NAPI_STATE_NPSVC, &napi->state);
|
||||
list_add_rcu(&napi->dev_list, &dev->napi_list);
|
||||
@@ -6780,6 +6872,7 @@ void __netif_napi_del(struct napi_struct
|
||||
@@ -6780,6 +6874,7 @@ void __netif_napi_del(struct napi_struct
|
||||
if (!test_and_clear_bit(NAPI_STATE_LISTED, &napi->state))
|
||||
return;
|
||||
|
||||
@ -214,7 +230,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
napi_hash_del(napi);
|
||||
list_del_rcu(&napi->dev_list);
|
||||
napi_free_frags(napi);
|
||||
@@ -6791,53 +6884,19 @@ EXPORT_SYMBOL(__netif_napi_del);
|
||||
@@ -6791,53 +6886,19 @@ EXPORT_SYMBOL(__netif_napi_del);
|
||||
|
||||
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
|
||||
{
|
||||
@ -272,7 +288,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
/* Some drivers may have called napi_schedule
|
||||
* prior to exhausting their budget.
|
||||
*/
|
||||
@@ -11291,6 +11350,10 @@ static int __init net_dev_init(void)
|
||||
@@ -11291,6 +11352,10 @@ static int __init net_dev_init(void)
|
||||
sd->backlog.weight = weight_p;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
};
|
||||
|
||||
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 <nbd@nbd.name>
|
||||
____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 <nbd@nbd.name>
|
||||
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 <nbd@nbd.name>
|
||||
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 <nbd@nbd.name>
|
||||
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 <nbd@nbd.name>
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user