aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/netdevice.h18
-rw-r--r--include/net/sch_generic.h1
-rw-r--r--include/net/sctp/user.h2
-rw-r--r--include/net/sock.h2
-rw-r--r--include/net/xfrm.h7
5 files changed, 21 insertions, 9 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1e6af4f174b6..b0813c3286b1 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -319,21 +319,29 @@ struct napi_struct {
319enum 319enum
320{ 320{
321 NAPI_STATE_SCHED, /* Poll is scheduled */ 321 NAPI_STATE_SCHED, /* Poll is scheduled */
322 NAPI_STATE_DISABLE, /* Disable pending */
322}; 323};
323 324
324extern void FASTCALL(__napi_schedule(struct napi_struct *n)); 325extern void FASTCALL(__napi_schedule(struct napi_struct *n));
325 326
327static inline int napi_disable_pending(struct napi_struct *n)
328{
329 return test_bit(NAPI_STATE_DISABLE, &n->state);
330}
331
326/** 332/**
327 * napi_schedule_prep - check if napi can be scheduled 333 * napi_schedule_prep - check if napi can be scheduled
328 * @n: napi context 334 * @n: napi context
329 * 335 *
330 * Test if NAPI routine is already running, and if not mark 336 * Test if NAPI routine is already running, and if not mark
331 * it as running. This is used as a condition variable 337 * it as running. This is used as a condition variable
332 * insure only one NAPI poll instance runs 338 * insure only one NAPI poll instance runs. We also make
339 * sure there is no pending NAPI disable.
333 */ 340 */
334static inline int napi_schedule_prep(struct napi_struct *n) 341static inline int napi_schedule_prep(struct napi_struct *n)
335{ 342{
336 return !test_and_set_bit(NAPI_STATE_SCHED, &n->state); 343 return !napi_disable_pending(n) &&
344 !test_and_set_bit(NAPI_STATE_SCHED, &n->state);
337} 345}
338 346
339/** 347/**
@@ -389,8 +397,10 @@ static inline void napi_complete(struct napi_struct *n)
389 */ 397 */
390static inline void napi_disable(struct napi_struct *n) 398static inline void napi_disable(struct napi_struct *n)
391{ 399{
400 set_bit(NAPI_STATE_DISABLE, &n->state);
392 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state)) 401 while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
393 msleep(1); 402 msleep(1);
403 clear_bit(NAPI_STATE_DISABLE, &n->state);
394} 404}
395 405
396/** 406/**
@@ -1268,7 +1278,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
1268static inline int netif_rx_schedule_prep(struct net_device *dev, 1278static inline int netif_rx_schedule_prep(struct net_device *dev,
1269 struct napi_struct *napi) 1279 struct napi_struct *napi)
1270{ 1280{
1271 return netif_running(dev) && napi_schedule_prep(napi); 1281 return napi_schedule_prep(napi);
1272} 1282}
1273 1283
1274/* Add interface to tail of rx poll list. This assumes that _prep has 1284/* Add interface to tail of rx poll list. This assumes that _prep has
@@ -1277,7 +1287,6 @@ static inline int netif_rx_schedule_prep(struct net_device *dev,
1277static inline void __netif_rx_schedule(struct net_device *dev, 1287static inline void __netif_rx_schedule(struct net_device *dev,
1278 struct napi_struct *napi) 1288 struct napi_struct *napi)
1279{ 1289{
1280 dev_hold(dev);
1281 __napi_schedule(napi); 1290 __napi_schedule(napi);
1282} 1291}
1283 1292
@@ -1308,7 +1317,6 @@ static inline void __netif_rx_complete(struct net_device *dev,
1308 struct napi_struct *napi) 1317 struct napi_struct *napi)
1309{ 1318{
1310 __napi_complete(napi); 1319 __napi_complete(napi);
1311 dev_put(dev);
1312} 1320}
1313 1321
1314/* Remove interface from poll list: it must be in the poll list 1322/* Remove interface from poll list: it must be in the poll list
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c9265518a378..4c3b35153c37 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -325,7 +325,6 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask)
325 n->tc_verd = SET_TC_VERD(n->tc_verd, 0); 325 n->tc_verd = SET_TC_VERD(n->tc_verd, 0);
326 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd); 326 n->tc_verd = CLR_TC_OK2MUNGE(n->tc_verd);
327 n->tc_verd = CLR_TC_MUNGED(n->tc_verd); 327 n->tc_verd = CLR_TC_MUNGED(n->tc_verd);
328 n->iif = skb->iif;
329 } 328 }
330 return n; 329 return n;
331} 330}
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 00848b641f59..954090b1e354 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -450,7 +450,7 @@ enum sctp_sn_type {
450 SCTP_SHUTDOWN_EVENT, 450 SCTP_SHUTDOWN_EVENT,
451 SCTP_PARTIAL_DELIVERY_EVENT, 451 SCTP_PARTIAL_DELIVERY_EVENT,
452 SCTP_ADAPTATION_INDICATION, 452 SCTP_ADAPTATION_INDICATION,
453 SCTP_AUTHENTICATION_EVENT, 453 SCTP_AUTHENTICATION_INDICATION,
454}; 454};
455 455
456/* Notification error codes used to fill up the error fields in some 456/* Notification error codes used to fill up the error fields in some
diff --git a/include/net/sock.h b/include/net/sock.h
index 67e35c7e230c..6e1542da33a1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -944,7 +944,7 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
944 return err; 944 return err;
945 945
946 rcu_read_lock_bh(); 946 rcu_read_lock_bh();
947 filter = sk->sk_filter; 947 filter = rcu_dereference(sk->sk_filter);
948 if (filter) { 948 if (filter) {
949 unsigned int pkt_len = sk_run_filter(skb, filter->insns, 949 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
950 filter->len); 950 filter->len);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 58dfa82889aa..1dd20cf17982 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1188,10 +1188,15 @@ static inline int xfrm_aevent_is_on(void)
1188 return ret; 1188 return ret;
1189} 1189}
1190 1190
1191static inline int xfrm_alg_len(struct xfrm_algo *alg)
1192{
1193 return sizeof(*alg) + ((alg->alg_key_len + 7) / 8);
1194}
1195
1191#ifdef CONFIG_XFRM_MIGRATE 1196#ifdef CONFIG_XFRM_MIGRATE
1192static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig) 1197static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
1193{ 1198{
1194 return (struct xfrm_algo *)kmemdup(orig, sizeof(*orig) + orig->alg_key_len, GFP_KERNEL); 1199 return kmemdup(orig, xfrm_alg_len(orig), GFP_KERNEL);
1195} 1200}
1196 1201
1197static inline void xfrm_states_put(struct xfrm_state **states, int n) 1202static inline void xfrm_states_put(struct xfrm_state **states, int n)