diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 9b24cc7a54d1..97edb3215a5a 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/rculist.h> | 43 | #include <linux/rculist.h> |
44 | #include <linux/dmaengine.h> | 44 | #include <linux/dmaengine.h> |
45 | #include <linux/workqueue.h> | 45 | #include <linux/workqueue.h> |
46 | #include <linux/dynamic_queue_limits.h> | ||
46 | 47 | ||
47 | #include <linux/ethtool.h> | 48 | #include <linux/ethtool.h> |
48 | #include <net/net_namespace.h> | 49 | #include <net/net_namespace.h> |
@@ -541,7 +542,6 @@ struct netdev_queue { | |||
541 | */ | 542 | */ |
542 | struct net_device *dev; | 543 | struct net_device *dev; |
543 | struct Qdisc *qdisc; | 544 | struct Qdisc *qdisc; |
544 | unsigned long state; | ||
545 | struct Qdisc *qdisc_sleeping; | 545 | struct Qdisc *qdisc_sleeping; |
546 | #ifdef CONFIG_SYSFS | 546 | #ifdef CONFIG_SYSFS |
547 | struct kobject kobj; | 547 | struct kobject kobj; |
@@ -564,6 +564,12 @@ struct netdev_queue { | |||
564 | * (/sys/class/net/DEV/Q/trans_timeout) | 564 | * (/sys/class/net/DEV/Q/trans_timeout) |
565 | */ | 565 | */ |
566 | unsigned long trans_timeout; | 566 | unsigned long trans_timeout; |
567 | |||
568 | unsigned long state; | ||
569 | |||
570 | #ifdef CONFIG_BQL | ||
571 | struct dql dql; | ||
572 | #endif | ||
567 | } ____cacheline_aligned_in_smp; | 573 | } ____cacheline_aligned_in_smp; |
568 | 574 | ||
569 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) | 575 | static inline int netdev_queue_numa_node_read(const struct netdev_queue *q) |
@@ -1862,6 +1868,15 @@ static inline int netif_xmit_frozen_or_stopped(const struct netdev_queue *dev_qu | |||
1862 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, | 1868 | static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, |
1863 | unsigned int bytes) | 1869 | unsigned int bytes) |
1864 | { | 1870 | { |
1871 | #ifdef CONFIG_BQL | ||
1872 | dql_queued(&dev_queue->dql, bytes); | ||
1873 | if (unlikely(dql_avail(&dev_queue->dql) < 0)) { | ||
1874 | set_bit(__QUEUE_STATE_STACK_XOFF, &dev_queue->state); | ||
1875 | if (unlikely(dql_avail(&dev_queue->dql) >= 0)) | ||
1876 | clear_bit(__QUEUE_STATE_STACK_XOFF, | ||
1877 | &dev_queue->state); | ||
1878 | } | ||
1879 | #endif | ||
1865 | } | 1880 | } |
1866 | 1881 | ||
1867 | static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) | 1882 | static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) |
@@ -1872,6 +1887,18 @@ static inline void netdev_sent_queue(struct net_device *dev, unsigned int bytes) | |||
1872 | static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, | 1887 | static inline void netdev_tx_completed_queue(struct netdev_queue *dev_queue, |
1873 | unsigned pkts, unsigned bytes) | 1888 | unsigned pkts, unsigned bytes) |
1874 | { | 1889 | { |
1890 | #ifdef CONFIG_BQL | ||
1891 | if (likely(bytes)) { | ||
1892 | dql_completed(&dev_queue->dql, bytes); | ||
1893 | if (unlikely(test_bit(__QUEUE_STATE_STACK_XOFF, | ||
1894 | &dev_queue->state) && | ||
1895 | dql_avail(&dev_queue->dql) >= 0)) { | ||
1896 | if (test_and_clear_bit(__QUEUE_STATE_STACK_XOFF, | ||
1897 | &dev_queue->state)) | ||
1898 | netif_schedule_queue(dev_queue); | ||
1899 | } | ||
1900 | } | ||
1901 | #endif | ||
1875 | } | 1902 | } |
1876 | 1903 | ||
1877 | static inline void netdev_completed_queue(struct net_device *dev, | 1904 | static inline void netdev_completed_queue(struct net_device *dev, |
@@ -1882,6 +1909,9 @@ static inline void netdev_completed_queue(struct net_device *dev, | |||
1882 | 1909 | ||
1883 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) | 1910 | static inline void netdev_tx_reset_queue(struct netdev_queue *q) |
1884 | { | 1911 | { |
1912 | #ifdef CONFIG_BQL | ||
1913 | dql_reset(&q->dql); | ||
1914 | #endif | ||
1885 | } | 1915 | } |
1886 | 1916 | ||
1887 | static inline void netdev_reset_queue(struct net_device *dev_queue) | 1917 | static inline void netdev_reset_queue(struct net_device *dev_queue) |