]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - include/linux/netdevice.h
[NET]: Make and use skb_get_queue_mapping
[mirror_ubuntu-artful-kernel.git] / include / linux / netdevice.h
index 91cd3f3db5079a06a214b53c98b04ea60dd70c08..6f85db3535e2f5d57628f03dc8f2ed98b6f09083 100644 (file)
@@ -349,6 +349,16 @@ static inline void napi_schedule(struct napi_struct *n)
                __napi_schedule(n);
 }
 
+/* Try to reschedule poll. Called by dev->poll() after napi_complete().  */
+static inline int napi_reschedule(struct napi_struct *napi)
+{
+       if (napi_schedule_prep(napi)) {
+               __napi_schedule(napi);
+               return 1;
+       }
+       return 0;
+}
+
 /**
  *     napi_complete - NAPI processing complete
  *     @n: napi context
@@ -397,6 +407,24 @@ static inline void napi_enable(struct napi_struct *n)
        clear_bit(NAPI_STATE_SCHED, &n->state);
 }
 
+#ifdef CONFIG_SMP
+/**
+ *     napi_synchronize - wait until NAPI is not running
+ *     @n: napi context
+ *
+ * Wait until NAPI is done being scheduled on this context.
+ * Waits till any outstanding processing completes but
+ * does not disable future activations.
+ */
+static inline void napi_synchronize(const struct napi_struct *n)
+{
+       while (test_bit(NAPI_STATE_SCHED, &n->state))
+               msleep(1);
+}
+#else
+# define napi_synchronize(n)   barrier()
+#endif
+
 /*
  *     The DEVICE structure.
  *     Actually, this whole structure is a big mistake.  It mixes I/O
@@ -817,7 +845,7 @@ static inline int dev_parse_header(const struct sk_buff *skb,
 {
        const struct net_device *dev = skb->dev;
 
-       if (!dev->header_ops->parse)
+       if (!dev->header_ops || !dev->header_ops->parse)
                return 0;
        return dev->header_ops->parse(skb, haddr);
 }
@@ -1054,7 +1082,7 @@ extern void netdev_run_todo(void);
  *     dev_put - release reference to device
  *     @dev: network device
  *
- * Hold reference to device to keep it from being freed.
+ * Release reference to device to allow it to be freed.
  */
 static inline void dev_put(struct net_device *dev)
 {
@@ -1065,7 +1093,7 @@ static inline void dev_put(struct net_device *dev)
  *     dev_hold - get reference to device
  *     @dev: network device
  *
- * Release reference to device to allow it to be freed.
+ * Hold reference to device to keep it from being freed.
  */
 static inline void dev_hold(struct net_device *dev)
 {
@@ -1284,6 +1312,7 @@ static inline void netif_rx_complete(struct net_device *dev,
 /**
  *     netif_tx_lock - grab network device transmit lock
  *     @dev: network device
+ *     @cpu: cpu number of lock owner
  *
  * Get network device transmit lock
  */