diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2014-03-14 23:48:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-03-17 15:47:22 -0400 |
commit | b6bacd550c33124ea76291bd84ac42c8d30767eb (patch) | |
tree | 19a5fb4f432141125a0bbc16254f8e83b57f3645 /net/core | |
parent | ff6076314339e079806d9d2f3de9c9b768e94db1 (diff) |
netpoll: Don't drop all received packets.
Change the strategy of netpoll from dropping all packets received
during netpoll_poll_dev to calling napi poll with a budget of 0
(to avoid processing drivers rx queue), and to ignore packets received
with netif_rx (those will safely be placed on the backlog queue).
All of the netpoll supporting drivers have been reviewed to ensure
either thay use netif_rx or that a budget of 0 is supported by their
napi poll routine and that a budget of 0 will not process the drivers
rx queues.
Not dropping packets makes NETPOLL_RX_DROP unnecesary so it is removed.
npinfo->rx_flags is removed as rx_flags with just the NETPOLL_RX_ENABLED
flag becomes just a redundant mirror of list_empty(&npinfo->rx_np).
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/netpoll.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index ef83a2530e98..793dc04d2f19 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -51,8 +51,6 @@ static atomic_t trapped; | |||
51 | DEFINE_STATIC_SRCU(netpoll_srcu); | 51 | DEFINE_STATIC_SRCU(netpoll_srcu); |
52 | 52 | ||
53 | #define USEC_PER_POLL 50 | 53 | #define USEC_PER_POLL 50 |
54 | #define NETPOLL_RX_ENABLED 1 | ||
55 | #define NETPOLL_RX_DROP 2 | ||
56 | 54 | ||
57 | #define MAX_SKB_SIZE \ | 55 | #define MAX_SKB_SIZE \ |
58 | (sizeof(struct ethhdr) + \ | 56 | (sizeof(struct ethhdr) + \ |
@@ -193,7 +191,8 @@ static void netpoll_poll_dev(struct net_device *dev) | |||
193 | { | 191 | { |
194 | const struct net_device_ops *ops; | 192 | const struct net_device_ops *ops; |
195 | struct netpoll_info *ni = rcu_dereference_bh(dev->npinfo); | 193 | struct netpoll_info *ni = rcu_dereference_bh(dev->npinfo); |
196 | int budget = 16; | 194 | bool rx_processing = netpoll_rx_processing(ni); |
195 | int budget = rx_processing? 16 : 0; | ||
197 | 196 | ||
198 | /* Don't do any rx activity if the dev_lock mutex is held | 197 | /* Don't do any rx activity if the dev_lock mutex is held |
199 | * the dev_open/close paths use this to block netpoll activity | 198 | * the dev_open/close paths use this to block netpoll activity |
@@ -207,8 +206,8 @@ static void netpoll_poll_dev(struct net_device *dev) | |||
207 | return; | 206 | return; |
208 | } | 207 | } |
209 | 208 | ||
210 | ni->rx_flags |= NETPOLL_RX_DROP; | 209 | if (rx_processing) |
211 | atomic_inc(&trapped); | 210 | atomic_inc(&trapped); |
212 | 211 | ||
213 | ops = dev->netdev_ops; | 212 | ops = dev->netdev_ops; |
214 | if (!ops->ndo_poll_controller) { | 213 | if (!ops->ndo_poll_controller) { |
@@ -221,8 +220,8 @@ static void netpoll_poll_dev(struct net_device *dev) | |||
221 | 220 | ||
222 | poll_napi(dev, budget); | 221 | poll_napi(dev, budget); |
223 | 222 | ||
224 | atomic_dec(&trapped); | 223 | if (rx_processing) |
225 | ni->rx_flags &= ~NETPOLL_RX_DROP; | 224 | atomic_dec(&trapped); |
226 | 225 | ||
227 | up(&ni->dev_lock); | 226 | up(&ni->dev_lock); |
228 | 227 | ||
@@ -1050,7 +1049,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) | |||
1050 | goto out; | 1049 | goto out; |
1051 | } | 1050 | } |
1052 | 1051 | ||
1053 | npinfo->rx_flags = 0; | ||
1054 | INIT_LIST_HEAD(&npinfo->rx_np); | 1052 | INIT_LIST_HEAD(&npinfo->rx_np); |
1055 | 1053 | ||
1056 | spin_lock_init(&npinfo->rx_lock); | 1054 | spin_lock_init(&npinfo->rx_lock); |
@@ -1076,7 +1074,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev, gfp_t gfp) | |||
1076 | 1074 | ||
1077 | if (np->rx_skb_hook) { | 1075 | if (np->rx_skb_hook) { |
1078 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 1076 | spin_lock_irqsave(&npinfo->rx_lock, flags); |
1079 | npinfo->rx_flags |= NETPOLL_RX_ENABLED; | ||
1080 | list_add_tail(&np->rx, &npinfo->rx_np); | 1077 | list_add_tail(&np->rx, &npinfo->rx_np); |
1081 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | 1078 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); |
1082 | } | 1079 | } |
@@ -1258,8 +1255,6 @@ void __netpoll_cleanup(struct netpoll *np) | |||
1258 | if (!list_empty(&npinfo->rx_np)) { | 1255 | if (!list_empty(&npinfo->rx_np)) { |
1259 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 1256 | spin_lock_irqsave(&npinfo->rx_lock, flags); |
1260 | list_del(&np->rx); | 1257 | list_del(&np->rx); |
1261 | if (list_empty(&npinfo->rx_np)) | ||
1262 | npinfo->rx_flags &= ~NETPOLL_RX_ENABLED; | ||
1263 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | 1258 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); |
1264 | } | 1259 | } |
1265 | 1260 | ||