kernel: refresh patches

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
CN_SZTL 2020-08-23 02:10:34 +08:00
parent 6d5483c956
commit 14459b8a3d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
11 changed files with 97 additions and 128 deletions

View File

@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1412,6 +1412,7 @@ enum netdev_priv_flags {
@@ -1415,6 +1415,7 @@ enum netdev_priv_flags {
IFF_PHONY_HEADROOM = 1<<26,
IFF_MACSEC = 1<<27,
IFF_L3MDEV_RX_HANDLER = 1<<28,
@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1442,6 +1443,7 @@ enum netdev_priv_flags {
@@ -1445,6 +1446,7 @@ enum netdev_priv_flags {
#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
#define IFF_MACSEC IFF_MACSEC
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* struct net_device - The DEVICE structure.
@@ -1728,6 +1730,11 @@ struct net_device {
@@ -1731,6 +1733,11 @@ struct net_device {
const struct xfrmdev_ops *xfrmdev_ops;
#endif
@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
const struct header_ops *header_ops;
unsigned int flags;
@@ -1802,6 +1809,10 @@ struct net_device {
@@ -1805,6 +1812,10 @@ struct net_device {
struct mpls_dev __rcu *mpls_ptr;
#endif
@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3008,10 +3008,20 @@ static int xmit_one(struct sk_buff *skb,
@@ -3009,10 +3009,20 @@ static int xmit_one(struct sk_buff *skb,
#endif
dev_queue_xmit_nit(skb, dev);

View File

@ -44,7 +44,7 @@
+ bool "Enables kernel network stack path for Shortcut Forwarding Engine
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3006,7 +3006,16 @@ static int xmit_one(struct sk_buff *skb,
@@ -3007,7 +3007,16 @@ static int xmit_one(struct sk_buff *skb,
#else
if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
#endif
@ -61,7 +61,7 @@
#ifdef CONFIG_ETHERNET_PACKET_MANGLE
if (!dev->eth_mangle_tx ||
@@ -4321,6 +4330,11 @@ void netdev_rx_handler_unregister(struct
@@ -4322,6 +4331,11 @@ void netdev_rx_handler_unregister(struct
}
EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
@ -73,7 +73,7 @@
/*
* Limit the use of PFMEMALLOC reserves to those protocols that implement
* the special handling of PFMEMALLOC skbs.
@@ -4368,6 +4382,9 @@ static int __netif_receive_skb_core(stru
@@ -4369,6 +4383,9 @@ static int __netif_receive_skb_core(stru
bool deliver_exact = false;
int ret = NET_RX_DROP;
__be16 type;
@ -83,7 +83,7 @@
net_timestamp_check(!netdev_tstamp_prequeue, skb);
@@ -4394,6 +4411,16 @@ another_round:
@@ -4395,6 +4412,16 @@ another_round:
goto out;
}

View File

@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1514,6 +1514,7 @@ enum netdev_priv_flags {
@@ -1517,6 +1517,7 @@ enum netdev_priv_flags {
IFF_FAILOVER_SLAVE = 1<<28,
IFF_L3MDEV_RX_HANDLER = 1<<29,
IFF_LIVE_RENAME_OK = 1<<30,
@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1546,6 +1547,7 @@ enum netdev_priv_flags {
@@ -1549,6 +1550,7 @@ enum netdev_priv_flags {
#define IFF_FAILOVER_SLAVE IFF_FAILOVER_SLAVE
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
#define IFF_LIVE_RENAME_OK IFF_LIVE_RENAME_OK
@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* struct net_device - The DEVICE structure.
@@ -1846,6 +1848,11 @@ struct net_device {
@@ -1849,6 +1851,11 @@ struct net_device {
const struct tlsdev_ops *tlsdev_ops;
#endif
@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
const struct header_ops *header_ops;
unsigned int flags;
@@ -1928,6 +1935,10 @@ struct net_device {
@@ -1931,6 +1938,10 @@ struct net_device {
struct mpls_dev __rcu *mpls_ptr;
#endif
@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3259,10 +3259,20 @@ static int xmit_one(struct sk_buff *skb,
@@ -3260,10 +3260,20 @@ static int xmit_one(struct sk_buff *skb,
#endif
dev_queue_xmit_nit(skb, dev);

View File

@ -44,7 +44,7 @@
+ bool "Enables kernel network stack path for Shortcut Forwarding Engine
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3257,7 +3257,16 @@ static int xmit_one(struct sk_buff *skb,
@@ -3258,7 +3258,16 @@ static int xmit_one(struct sk_buff *skb,
#else
if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
#endif
@ -61,7 +61,7 @@
#ifdef CONFIG_ETHERNET_PACKET_MANGLE
if (!dev->eth_mangle_tx ||
@@ -4753,6 +4762,11 @@ void netdev_rx_handler_unregister(struct
@@ -4754,6 +4763,11 @@ void netdev_rx_handler_unregister(struct
}
EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
@ -73,7 +73,7 @@
/*
* Limit the use of PFMEMALLOC reserves to those protocols that implement
* the special handling of PFMEMALLOC skbs.
@@ -4802,6 +4816,9 @@ static int __netif_receive_skb_core(stru
@@ -4803,6 +4817,9 @@ static int __netif_receive_skb_core(stru
bool deliver_exact = false;
int ret = NET_RX_DROP;
__be16 type;
@ -83,7 +83,7 @@
net_timestamp_check(!netdev_tstamp_prequeue, skb);
@@ -4842,6 +4859,16 @@ another_round:
@@ -4843,6 +4860,16 @@ another_round:
goto out;
}

View File

@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1400,6 +1400,7 @@ enum netdev_priv_flags {
@@ -1402,6 +1402,7 @@ enum netdev_priv_flags {
IFF_PHONY_HEADROOM = 1<<26,
IFF_MACSEC = 1<<27,
IFF_L3MDEV_RX_HANDLER = 1<<28,
@ -23,7 +23,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
#define IFF_802_1Q_VLAN IFF_802_1Q_VLAN
@@ -1430,6 +1431,7 @@ enum netdev_priv_flags {
@@ -1432,6 +1433,7 @@ enum netdev_priv_flags {
#define IFF_RXFH_CONFIGURED IFF_RXFH_CONFIGURED
#define IFF_MACSEC IFF_MACSEC
#define IFF_L3MDEV_RX_HANDLER IFF_L3MDEV_RX_HANDLER
@ -31,7 +31,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/**
* struct net_device - The DEVICE structure.
@@ -1716,6 +1718,11 @@ struct net_device {
@@ -1718,6 +1720,11 @@ struct net_device {
const struct ndisc_ops *ndisc_ops;
#endif
@ -43,7 +43,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
const struct header_ops *header_ops;
unsigned int flags;
@@ -1788,6 +1795,10 @@ struct net_device {
@@ -1790,6 +1797,10 @@ struct net_device {
struct mpls_dev __rcu *mpls_ptr;
#endif
@ -101,7 +101,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
help
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2976,10 +2976,20 @@ static int xmit_one(struct sk_buff *skb,
@@ -2977,10 +2977,20 @@ static int xmit_one(struct sk_buff *skb,
#endif
dev_queue_xmit_nit(skb, dev);

View File

@ -47,7 +47,7 @@ Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
+ bool "Enables kernel network stack path for Shortcut Forwarding Engine"
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2974,7 +2974,16 @@ static int xmit_one(struct sk_buff *skb, struct net_device *dev,
@@ -2975,7 +2975,16 @@ static int xmit_one(struct sk_buff *skb,
#else
if (!list_empty(&ptype_all) || !list_empty(&dev->ptype_all))
#endif
@ -64,7 +64,7 @@ Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
#ifdef CONFIG_ETHERNET_PACKET_MANGLE
if (!dev->eth_mangle_tx ||
@@ -4126,6 +4134,11 @@ void netdev_rx_handler_unregister(struct net_device *dev)
@@ -4127,6 +4136,11 @@ void netdev_rx_handler_unregister(struct
}
EXPORT_SYMBOL_GPL(netdev_rx_handler_unregister);
@ -76,7 +76,7 @@ Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
/*
* Limit the use of PFMEMALLOC reserves to those protocols that implement
* the special handling of PFMEMALLOC skbs.
@@ -4174,6 +4187,10 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc)
@@ -4175,6 +4189,10 @@ static int __netif_receive_skb_core(stru
int ret = NET_RX_DROP;
__be16 type;
@ -87,7 +87,7 @@ Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
net_timestamp_check(!netdev_tstamp_prequeue, skb);
trace_netif_receive_skb(skb);
@@ -4199,6 +4216,14 @@ another_round:
@@ -4200,6 +4218,14 @@ another_round:
goto out;
}

View File

@ -24,8 +24,6 @@ Signed-off-by: Murat Sezgin <msezgin@codeaurora.org>
net/bridge/br_if.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h
index 0911c8c..4473f62 100644
--- a/include/linux/if_bridge.h
+++ b/include/linux/if_bridge.h
@@ -52,6 +52,7 @@ struct br_ip_list {
@ -36,11 +34,9 @@ index 0911c8c..4473f62 100644
typedef int br_should_route_hook_t(struct sk_buff *skb);
extern br_should_route_hook_t __rcu *br_should_route_hook;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index ed0dd33..342b2d9 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -655,3 +655,28 @@ void br_port_flags_change(struct net_bridge_port *p, unsigned long mask)
@@ -654,3 +654,28 @@ void br_port_flags_change(struct net_bri
if (mask & BR_AUTO_MASK)
nbp_update_port_count(br);
}
@ -69,6 +65,3 @@ index ed0dd33..342b2d9 100644
+ u64_stats_update_end(&stats->syncp);
+}
+EXPORT_SYMBOL_GPL(br_dev_update_stats);
--
2.7.4

View File

@ -20,8 +20,6 @@ Signed-off-by: Zhi Chen <zhichen@codeaurora.org>
net/netfilter/nf_conntrack_netlink.c | 19 ++++++
6 files changed, 139 insertions(+), 1 deletion(-)
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 12d967b..c2b98b6 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -70,6 +70,10 @@ struct nf_ct_event {
@ -35,7 +33,7 @@ index 12d967b..c2b98b6 100644
struct nf_ct_event_notifier {
int (*fcn)(unsigned int events, struct nf_ct_event *item);
};
@@ -78,6 +82,7 @@ int nf_conntrack_register_notifier(struct net *net,
@@ -78,6 +82,7 @@ int nf_conntrack_register_notifier(struc
struct nf_ct_event_notifier *nb);
void nf_conntrack_unregister_notifier(struct net *net,
struct nf_ct_event_notifier *nb);
@ -43,7 +41,7 @@ index 12d967b..c2b98b6 100644
void nf_ct_deliver_cached_events(struct nf_conn *ct);
int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
@@ -86,11 +91,13 @@ int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
@@ -86,11 +91,13 @@ int nf_conntrack_eventmask_report(unsign
static inline void
nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
{
@ -71,7 +69,7 @@ index 12d967b..c2b98b6 100644
return nf_conntrack_eventmask_report(1 << event, ct, portid, report);
}
@@ -114,10 +123,12 @@ nf_conntrack_event_report(enum ip_conntrack_events event, struct nf_conn *ct,
@@ -114,10 +123,12 @@ nf_conntrack_event_report(enum ip_conntr
static inline int
nf_conntrack_event(enum ip_conntrack_events event, struct nf_conn *ct)
{
@ -84,8 +82,6 @@ index 12d967b..c2b98b6 100644
return nf_conntrack_eventmask_report(1 << event, ct, 0, 0);
}
diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h
index e469e85..1d31db8 100644
--- a/include/net/netns/conntrack.h
+++ b/include/net/netns/conntrack.h
@@ -86,7 +86,11 @@ struct netns_ct {
@ -100,8 +96,6 @@ index e469e85..1d31db8 100644
struct nf_exp_event_notifier __rcu *nf_expect_event_cb;
struct nf_ip_net nf_ct_proto;
#if defined(CONFIG_NF_CONNTRACK_LABELS)
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig
index 63073be..08d7aab 100644
--- a/net/netfilter/Kconfig
+++ b/net/netfilter/Kconfig
@@ -136,6 +136,14 @@ config NF_CONNTRACK_TIMEOUT
@ -119,11 +113,9 @@ index 63073be..08d7aab 100644
config NF_CONNTRACK_TIMESTAMP
bool 'Connection tracking timestamping'
depends on NETFILTER_ADVANCED
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 6bd1508..9b81c7c 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1998,6 +1998,10 @@ int nf_conntrack_init_net(struct net *net)
@@ -2077,6 +2077,10 @@ int nf_conntrack_init_net(struct net *ne
ret = nf_conntrack_proto_pernet_init(net);
if (ret < 0)
goto err_proto;
@ -134,8 +126,6 @@ index 6bd1508..9b81c7c 100644
return 0;
err_proto:
diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
index da9df2d..e0e2a8f 100644
--- a/net/netfilter/nf_conntrack_ecache.c
+++ b/net/netfilter/nf_conntrack_ecache.c
@@ -18,6 +18,9 @@
@ -148,7 +138,7 @@ index da9df2d..e0e2a8f 100644
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
@@ -117,6 +120,38 @@ static void ecache_work(struct work_struct *work)
@@ -117,6 +120,38 @@ static void ecache_work(struct work_stru
schedule_delayed_work(&ctnet->ecache_dwork, delay);
}
@ -187,7 +177,7 @@ index da9df2d..e0e2a8f 100644
int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
u32 portid, int report)
{
@@ -171,10 +206,52 @@ int nf_conntrack_eventmask_report(unsigned int eventmask, struct nf_conn *ct,
@@ -171,10 +206,52 @@ out_unlock:
rcu_read_unlock();
return ret;
}
@ -240,7 +230,7 @@ index da9df2d..e0e2a8f 100644
void nf_ct_deliver_cached_events(struct nf_conn *ct)
{
struct net *net = nf_ct_net(ct);
@@ -225,6 +302,7 @@ void nf_ct_deliver_cached_events(struct nf_conn *ct)
@@ -225,6 +302,7 @@ void nf_ct_deliver_cached_events(struct
out_unlock:
rcu_read_unlock();
}
@ -248,7 +238,7 @@ index da9df2d..e0e2a8f 100644
EXPORT_SYMBOL_GPL(nf_ct_deliver_cached_events);
void nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -257,6 +335,12 @@ void nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -257,6 +335,12 @@ out_unlock:
rcu_read_unlock();
}
@ -261,7 +251,7 @@ index da9df2d..e0e2a8f 100644
int nf_conntrack_register_notifier(struct net *net,
struct nf_ct_event_notifier *new)
{
@@ -277,8 +361,15 @@ int nf_conntrack_register_notifier(struct net *net,
@@ -277,8 +361,15 @@ out_unlock:
mutex_unlock(&nf_ct_ecache_mutex);
return ret;
}
@ -277,16 +267,14 @@ index da9df2d..e0e2a8f 100644
void nf_conntrack_unregister_notifier(struct net *net,
struct nf_ct_event_notifier *new)
{
@@ -291,6 +382,7 @@ void nf_conntrack_unregister_notifier(struct net *net,
RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, NULL);
@@ -292,6 +383,7 @@ void nf_conntrack_unregister_notifier(st
mutex_unlock(&nf_ct_ecache_mutex);
/* synchronize_rcu() is called from ctnetlink_exit. */
}
+#endif
EXPORT_SYMBOL_GPL(nf_conntrack_unregister_notifier);
int nf_ct_expect_register_notifier(struct net *net,
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 04111c1..8c741f7 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -28,6 +28,11 @@
@ -299,9 +287,9 @@ index 04111c1..8c741f7 100644
+#endif
+
#include <linux/slab.h>
#include <linux/siphash.h>
#include <linux/netfilter.h>
@@ -615,14 +620,22 @@ static size_t ctnetlink_nlmsg_size(const struct nf_conn *ct)
@@ -618,14 +623,22 @@ static size_t ctnetlink_nlmsg_size(const
;
}
@ -324,7 +312,7 @@ index 04111c1..8c741f7 100644
struct nf_conn *ct = item->ct;
struct sk_buff *skb;
unsigned int type;
@@ -3260,9 +3273,15 @@ static int ctnetlink_stat_exp_cpu(struct net *net, struct sock *ctnl,
@@ -3288,9 +3301,15 @@ static int ctnetlink_stat_exp_cpu(struct
}
#ifdef CONFIG_NF_CONNTRACK_EVENTS
@ -340,6 +328,3 @@ index 04111c1..8c741f7 100644
static struct nf_exp_event_notifier ctnl_notifier_exp = {
.fcn = ctnetlink_expect_event,
--
2.7.4

View File

@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
enum gro_result {
@@ -2093,6 +2096,26 @@ void netif_napi_add(struct net_device *d
@@ -2098,6 +2101,26 @@ void netif_napi_add(struct net_device *d
int (*poll)(struct napi_struct *, int), int weight);
/**
@ -79,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
* @napi: NAPI context
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -160,6 +160,7 @@ static DEFINE_SPINLOCK(offload_lock);
@@ -163,6 +163,7 @@ static DEFINE_SPINLOCK(offload_lock);
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
struct list_head ptype_all __read_mostly; /* Taps */
static struct list_head offload_base __read_mostly;
@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int netif_rx_internal(struct sk_buff *skb);
static int call_netdevice_notifiers_info(unsigned long val,
@@ -5237,6 +5238,11 @@ void __napi_schedule(struct napi_struct
@@ -5247,6 +5248,11 @@ void __napi_schedule(struct napi_struct
{
unsigned long flags;
@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
local_irq_save(flags);
____napi_schedule(this_cpu_ptr(&softnet_data), n);
local_irq_restore(flags);
@@ -5284,6 +5290,11 @@ EXPORT_SYMBOL(napi_schedule_prep);
@@ -5294,6 +5300,11 @@ EXPORT_SYMBOL(napi_schedule_prep);
*/
void __napi_schedule_irqoff(struct napi_struct *n)
{
@ -111,7 +111,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
____napi_schedule(this_cpu_ptr(&softnet_data), n);
}
EXPORT_SYMBOL(__napi_schedule_irqoff);
@@ -5521,6 +5532,82 @@ static enum hrtimer_restart napi_watchdo
@@ -5531,6 +5542,82 @@ static enum hrtimer_restart napi_watchdo
return HRTIMER_NORESTART;
}
@ -194,7 +194,7 @@ 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)
{
@@ -5540,6 +5627,7 @@ void netif_napi_add(struct net_device *d
@@ -5550,6 +5637,7 @@ void netif_napi_add(struct net_device *d
#ifdef CONFIG_NETPOLL
napi->poll_owner = -1;
#endif
@ -202,7 +202,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
set_bit(NAPI_STATE_SCHED, &napi->state);
napi_hash_add(napi);
}
@@ -5565,6 +5653,7 @@ EXPORT_SYMBOL(napi_disable);
@@ -5575,6 +5663,7 @@ EXPORT_SYMBOL(napi_disable);
void netif_napi_del(struct napi_struct *napi)
{
might_sleep();
@ -210,7 +210,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (napi_hash_del(napi))
synchronize_net();
list_del_init(&napi->dev_list);
@@ -5578,48 +5667,18 @@ EXPORT_SYMBOL(netif_napi_del);
@@ -5588,49 +5677,19 @@ EXPORT_SYMBOL(netif_napi_del);
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
{
@ -224,7 +224,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
have = netpoll_poll_lock(n);
- weight = n->weight;
-
+ work = __napi_poll(n, &do_repoll);
- /* This NAPI_STATE_SCHED test is for avoiding a race
- * with netpoll's poll_napi(). Only the entity which
- * obtains the lock and sees NAPI_STATE_SCHED set will
@ -240,8 +241,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- WARN_ON_ONCE(work > weight);
-
- if (likely(work < weight))
- goto out_unlock;
+ work = __napi_poll(n, &do_repoll);
+ if (!do_repoll)
goto out_unlock;
- /* Drivers must not modify the NAPI state if they
- * consume the entire weight. In such cases this code
@ -250,8 +251,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- */
- if (unlikely(napi_disable_pending(n))) {
- napi_complete(n);
+ if (!do_repoll)
goto out_unlock;
- goto out_unlock;
- }
-
- if (n->gro_list) {
@ -260,10 +260,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- */
- napi_gro_flush(n, HZ >= 1000);
- }
-
/* Some drivers may have called napi_schedule
* prior to exhausting their budget.
@@ -8855,6 +8914,10 @@ static int __init net_dev_init(void)
*/
@@ -8865,6 +8924,10 @@ static int __init net_dev_init(void)
sd->backlog.weight = weight_p;
}

View File

@ -50,7 +50,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
enum gro_result {
@@ -2230,6 +2233,26 @@ void netif_napi_add(struct net_device *d
@@ -2235,6 +2238,26 @@ void netif_napi_add(struct net_device *d
int (*poll)(struct napi_struct *, int), int weight);
/**
@ -79,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
* @napi: NAPI context
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -160,6 +160,7 @@ static DEFINE_SPINLOCK(offload_lock);
@@ -163,6 +163,7 @@ static DEFINE_SPINLOCK(offload_lock);
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
struct list_head ptype_all __read_mostly; /* Taps */
static struct list_head offload_base __read_mostly;
@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int netif_rx_internal(struct sk_buff *skb);
static int call_netdevice_notifiers_info(unsigned long val,
@@ -5891,6 +5892,11 @@ void __napi_schedule(struct napi_struct
@@ -5901,6 +5902,11 @@ void __napi_schedule(struct napi_struct
{
unsigned long flags;
@ -99,7 +99,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
local_irq_save(flags);
____napi_schedule(this_cpu_ptr(&softnet_data), n);
local_irq_restore(flags);
@@ -5938,6 +5944,11 @@ EXPORT_SYMBOL(napi_schedule_prep);
@@ -5948,6 +5954,11 @@ EXPORT_SYMBOL(napi_schedule_prep);
*/
void __napi_schedule_irqoff(struct napi_struct *n)
{
@ -111,7 +111,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
____napi_schedule(this_cpu_ptr(&softnet_data), n);
}
EXPORT_SYMBOL(__napi_schedule_irqoff);
@@ -6186,6 +6197,82 @@ static void init_gro_hash(struct napi_st
@@ -6196,6 +6207,82 @@ static void init_gro_hash(struct napi_st
napi->gro_bitmask = 0;
}
@ -194,7 +194,7 @@ 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)
{
@@ -6204,6 +6291,7 @@ void netif_napi_add(struct net_device *d
@@ -6214,6 +6301,7 @@ void netif_napi_add(struct net_device *d
#ifdef CONFIG_NETPOLL
napi->poll_owner = -1;
#endif
@ -202,7 +202,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
set_bit(NAPI_STATE_SCHED, &napi->state);
napi_hash_add(napi);
}
@@ -6242,6 +6330,7 @@ static void flush_gro_hash(struct napi_s
@@ -6252,6 +6340,7 @@ static void flush_gro_hash(struct napi_s
void netif_napi_del(struct napi_struct *napi)
{
might_sleep();
@ -210,7 +210,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (napi_hash_del(napi))
synchronize_net();
list_del_init(&napi->dev_list);
@@ -6254,48 +6343,18 @@ EXPORT_SYMBOL(netif_napi_del);
@@ -6264,49 +6353,19 @@ EXPORT_SYMBOL(netif_napi_del);
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
{
@ -224,7 +224,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
have = netpoll_poll_lock(n);
- weight = n->weight;
-
+ work = __napi_poll(n, &do_repoll);
- /* This NAPI_STATE_SCHED test is for avoiding a race
- * with netpoll's poll_napi(). Only the entity which
- * obtains the lock and sees NAPI_STATE_SCHED set will
@ -240,8 +241,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- WARN_ON_ONCE(work > weight);
-
- if (likely(work < weight))
- goto out_unlock;
+ work = __napi_poll(n, &do_repoll);
+ if (!do_repoll)
goto out_unlock;
- /* Drivers must not modify the NAPI state if they
- * consume the entire weight. In such cases this code
@ -250,8 +251,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- */
- if (unlikely(napi_disable_pending(n))) {
- napi_complete(n);
+ if (!do_repoll)
goto out_unlock;
- goto out_unlock;
- }
-
- if (n->gro_bitmask) {
@ -260,10 +260,11 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- */
- napi_gro_flush(n, HZ >= 1000);
- }
-
/* Some drivers may have called napi_schedule
* prior to exhausting their budget.
@@ -9895,6 +9954,10 @@ static int __init net_dev_init(void)
*/
@@ -9905,6 +9964,10 @@ static int __init net_dev_init(void)
sd->backlog.weight = weight_p;
}

View File

@ -26,7 +26,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -340,6 +340,7 @@ struct napi_struct {
@@ -326,6 +326,7 @@ struct napi_struct {
struct list_head dev_list;
struct hlist_node napi_hash_node;
unsigned int napi_id;
@ -34,23 +34,15 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
};
enum {
@@ -350,6 +351,7 @@ enum {
@@ -334,6 +335,7 @@ enum {
NAPI_STATE_NPSVC, /* Netpoll - don't dequeue from poll_list */
NAPI_STATE_HASHED, /* In NAPI hash (busy polling possible) */
NAPI_STATE_NO_BUSY_POLL,/* Do not add in napi_hash, no busy polling */
NAPI_STATE_IN_BUSY_POLL,/* sk_busy_loop() owns this NAPI */
+ NAPI_STATE_THREADED, /* Use threaded NAPI */
};
enum {
@@ -360,6 +362,7 @@ enum {
NAPIF_STATE_HASHED = BIT(NAPI_STATE_HASHED),
NAPIF_STATE_NO_BUSY_POLL = BIT(NAPI_STATE_NO_BUSY_POLL),
NAPIF_STATE_IN_BUSY_POLL = BIT(NAPI_STATE_IN_BUSY_POLL),
+ NAPIF_STATE_THREADED = BIT(NAPI_STATE_THREADED),
};
enum gro_result {
@@ -2249,6 +2252,26 @@ void netif_napi_add(struct net_device *d
@@ -2101,6 +2103,26 @@ void netif_napi_add(struct net_device *d
int (*poll)(struct napi_struct *, int), int weight);
/**
@ -79,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
* @napi: NAPI context
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -156,6 +156,7 @@ static DEFINE_SPINLOCK(offload_lock);
@@ -159,6 +159,7 @@ static DEFINE_SPINLOCK(offload_lock);
struct list_head ptype_base[PTYPE_HASH_SIZE] __read_mostly;
struct list_head ptype_all __read_mostly; /* Taps */
static struct list_head offload_base __read_mostly;
@ -87,7 +79,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static int netif_rx_internal(struct sk_buff *skb);
static int call_netdevice_notifiers_info(unsigned long val,
@@ -5910,6 +5911,11 @@ void __napi_schedule(struct napi_struct
@@ -5001,6 +5002,11 @@ void __napi_schedule(struct napi_struct
{
unsigned long flags;
@ -99,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
local_irq_save(flags);
____napi_schedule(this_cpu_ptr(&softnet_data), n);
local_irq_restore(flags);
@@ -5957,6 +5963,11 @@ EXPORT_SYMBOL(napi_schedule_prep);
@@ -5015,6 +5021,11 @@ EXPORT_SYMBOL(__napi_schedule);
*/
void __napi_schedule_irqoff(struct napi_struct *n)
{
@ -111,8 +103,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
____napi_schedule(this_cpu_ptr(&softnet_data), n);
}
EXPORT_SYMBOL(__napi_schedule_irqoff);
@@ -6218,6 +6229,84 @@ static void init_gro_hash(struct napi_st
napi->gro_bitmask = 0;
@@ -5187,6 +5198,84 @@ static enum hrtimer_restart napi_watchdo
return HRTIMER_NORESTART;
}
+static int __napi_poll(struct napi_struct *n, bool *repoll)
@ -196,15 +188,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)
{
@@ -6238,6 +6327,7 @@ void netif_napi_add(struct net_device *d
#ifdef CONFIG_NETPOLL
@@ -5207,6 +5296,7 @@ void netif_napi_add(struct net_device *d
spin_lock_init(&napi->poll_lock);
napi->poll_owner = -1;
#endif
+ INIT_WORK(&napi->work, napi_workfn);
set_bit(NAPI_STATE_SCHED, &napi->state);
napi_hash_add(napi);
}
@@ -6276,6 +6366,7 @@ static void flush_gro_hash(struct napi_s
@@ -5232,6 +5322,7 @@ EXPORT_SYMBOL(napi_disable);
void netif_napi_del(struct napi_struct *napi)
{
might_sleep();
@ -212,7 +204,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (napi_hash_del(napi))
synchronize_net();
list_del_init(&napi->dev_list);
@@ -6288,50 +6379,18 @@ EXPORT_SYMBOL(netif_napi_del);
@@ -5245,47 +5336,18 @@ EXPORT_SYMBOL(netif_napi_del);
static int napi_poll(struct napi_struct *n, struct list_head *repoll)
{
@ -240,11 +232,12 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- }
-
- WARN_ON_ONCE(work > weight);
-
- if (likely(work < weight))
- goto out_unlock;
+ work = __napi_poll(n, &do_repoll);
- if (likely(work < weight))
+ if (!do_repoll)
goto out_unlock;
-
- /* Drivers must not modify the NAPI state if they
- * consume the entire weight. In such cases this code
- * still "owns" the NAPI instance and therefore can
@ -252,22 +245,18 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- */
- if (unlikely(napi_disable_pending(n))) {
- napi_complete(n);
+ if (!do_repoll)
goto out_unlock;
- goto out_unlock;
- }
-
- if (n->gro_bitmask) {
- if (n->gro_list) {
- /* flush too old packets
- * If HZ < 1000, flush all packets.
- */
- napi_gro_flush(n, HZ >= 1000);
- }
-
- gro_normal_list(n);
}
/* Some drivers may have called napi_schedule
* prior to exhausting their budget.
@@ -10264,6 +10323,10 @@ static int __init net_dev_init(void)
@@ -8498,6 +8560,10 @@ static int __init net_dev_init(void)
sd->backlog.weight = weight_p;
}
@ -280,7 +269,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
/* The loopback device is special if any other network devices
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -442,6 +442,52 @@ static ssize_t proto_down_store(struct d
@@ -432,6 +432,52 @@ static ssize_t proto_down_store(struct d
}
NETDEVICE_SHOW_RW(proto_down, fmt_dec);
@ -333,7 +322,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
static ssize_t phys_port_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -532,6 +578,7 @@ static struct attribute *net_class_attrs
@@ -527,6 +573,7 @@ static struct attribute *net_class_attrs
&dev_attr_flags.attr,
&dev_attr_tx_queue_len.attr,
&dev_attr_gro_flush_timeout.attr,