diff options
-rw-r--r-- | include/linux/netdevice.h | 55 | ||||
-rw-r--r-- | net/core/dev.c | 64 |
2 files changed, 69 insertions, 50 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 950dc55e5192..40ccf8cc4239 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -598,20 +598,7 @@ DECLARE_PER_CPU(struct softnet_data,softnet_data); | |||
598 | 598 | ||
599 | #define HAVE_NETIF_QUEUE | 599 | #define HAVE_NETIF_QUEUE |
600 | 600 | ||
601 | static inline void __netif_schedule(struct net_device *dev) | 601 | extern void __netif_schedule(struct net_device *dev); |
602 | { | ||
603 | if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) { | ||
604 | unsigned long flags; | ||
605 | struct softnet_data *sd; | ||
606 | |||
607 | local_irq_save(flags); | ||
608 | sd = &__get_cpu_var(softnet_data); | ||
609 | dev->next_sched = sd->output_queue; | ||
610 | sd->output_queue = dev; | ||
611 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | ||
612 | local_irq_restore(flags); | ||
613 | } | ||
614 | } | ||
615 | 602 | ||
616 | static inline void netif_schedule(struct net_device *dev) | 603 | static inline void netif_schedule(struct net_device *dev) |
617 | { | 604 | { |
@@ -675,13 +662,7 @@ static inline void dev_kfree_skb_irq(struct sk_buff *skb) | |||
675 | /* Use this variant in places where it could be invoked | 662 | /* Use this variant in places where it could be invoked |
676 | * either from interrupt or non-interrupt context. | 663 | * either from interrupt or non-interrupt context. |
677 | */ | 664 | */ |
678 | static inline void dev_kfree_skb_any(struct sk_buff *skb) | 665 | extern void dev_kfree_skb_any(struct sk_buff *skb); |
679 | { | ||
680 | if (in_irq() || irqs_disabled()) | ||
681 | dev_kfree_skb_irq(skb); | ||
682 | else | ||
683 | dev_kfree_skb(skb); | ||
684 | } | ||
685 | 666 | ||
686 | #define HAVE_NETIF_RX 1 | 667 | #define HAVE_NETIF_RX 1 |
687 | extern int netif_rx(struct sk_buff *skb); | 668 | extern int netif_rx(struct sk_buff *skb); |
@@ -768,22 +749,9 @@ static inline int netif_device_present(struct net_device *dev) | |||
768 | return test_bit(__LINK_STATE_PRESENT, &dev->state); | 749 | return test_bit(__LINK_STATE_PRESENT, &dev->state); |
769 | } | 750 | } |
770 | 751 | ||
771 | static inline void netif_device_detach(struct net_device *dev) | 752 | extern void netif_device_detach(struct net_device *dev); |
772 | { | ||
773 | if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && | ||
774 | netif_running(dev)) { | ||
775 | netif_stop_queue(dev); | ||
776 | } | ||
777 | } | ||
778 | 753 | ||
779 | static inline void netif_device_attach(struct net_device *dev) | 754 | extern void netif_device_attach(struct net_device *dev); |
780 | { | ||
781 | if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && | ||
782 | netif_running(dev)) { | ||
783 | netif_wake_queue(dev); | ||
784 | __netdev_watchdog_up(dev); | ||
785 | } | ||
786 | } | ||
787 | 755 | ||
788 | /* | 756 | /* |
789 | * Network interface message level settings | 757 | * Network interface message level settings |
@@ -851,20 +819,7 @@ static inline int netif_rx_schedule_prep(struct net_device *dev) | |||
851 | * already been called and returned 1. | 819 | * already been called and returned 1. |
852 | */ | 820 | */ |
853 | 821 | ||
854 | static inline void __netif_rx_schedule(struct net_device *dev) | 822 | extern void __netif_rx_schedule(struct net_device *dev); |
855 | { | ||
856 | unsigned long flags; | ||
857 | |||
858 | local_irq_save(flags); | ||
859 | dev_hold(dev); | ||
860 | list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); | ||
861 | if (dev->quota < 0) | ||
862 | dev->quota += dev->weight; | ||
863 | else | ||
864 | dev->quota = dev->weight; | ||
865 | __raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||
866 | local_irq_restore(flags); | ||
867 | } | ||
868 | 823 | ||
869 | /* Try to reschedule poll. Called by irq handler. */ | 824 | /* Try to reschedule poll. Called by irq handler. */ |
870 | 825 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index a3ab11f34153..434220d093aa 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1080,6 +1080,70 @@ void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) | |||
1080 | rcu_read_unlock(); | 1080 | rcu_read_unlock(); |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | |||
1084 | void __netif_schedule(struct net_device *dev) | ||
1085 | { | ||
1086 | if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) { | ||
1087 | unsigned long flags; | ||
1088 | struct softnet_data *sd; | ||
1089 | |||
1090 | local_irq_save(flags); | ||
1091 | sd = &__get_cpu_var(softnet_data); | ||
1092 | dev->next_sched = sd->output_queue; | ||
1093 | sd->output_queue = dev; | ||
1094 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | ||
1095 | local_irq_restore(flags); | ||
1096 | } | ||
1097 | } | ||
1098 | EXPORT_SYMBOL(__netif_schedule); | ||
1099 | |||
1100 | void __netif_rx_schedule(struct net_device *dev) | ||
1101 | { | ||
1102 | unsigned long flags; | ||
1103 | |||
1104 | local_irq_save(flags); | ||
1105 | dev_hold(dev); | ||
1106 | list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list); | ||
1107 | if (dev->quota < 0) | ||
1108 | dev->quota += dev->weight; | ||
1109 | else | ||
1110 | dev->quota = dev->weight; | ||
1111 | __raise_softirq_irqoff(NET_RX_SOFTIRQ); | ||
1112 | local_irq_restore(flags); | ||
1113 | } | ||
1114 | EXPORT_SYMBOL(__netif_rx_schedule); | ||
1115 | |||
1116 | void dev_kfree_skb_any(struct sk_buff *skb) | ||
1117 | { | ||
1118 | if (in_irq() || irqs_disabled()) | ||
1119 | dev_kfree_skb_irq(skb); | ||
1120 | else | ||
1121 | dev_kfree_skb(skb); | ||
1122 | } | ||
1123 | EXPORT_SYMBOL(dev_kfree_skb_any); | ||
1124 | |||
1125 | |||
1126 | /* Hot-plugging. */ | ||
1127 | void netif_device_detach(struct net_device *dev) | ||
1128 | { | ||
1129 | if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && | ||
1130 | netif_running(dev)) { | ||
1131 | netif_stop_queue(dev); | ||
1132 | } | ||
1133 | } | ||
1134 | EXPORT_SYMBOL(netif_device_detach); | ||
1135 | |||
1136 | void netif_device_attach(struct net_device *dev) | ||
1137 | { | ||
1138 | if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) && | ||
1139 | netif_running(dev)) { | ||
1140 | netif_wake_queue(dev); | ||
1141 | __netdev_watchdog_up(dev); | ||
1142 | } | ||
1143 | } | ||
1144 | EXPORT_SYMBOL(netif_device_attach); | ||
1145 | |||
1146 | |||
1083 | /* | 1147 | /* |
1084 | * Invalidate hardware checksum when packet is to be mangled, and | 1148 | * Invalidate hardware checksum when packet is to be mangled, and |
1085 | * complete checksum manually on outgoing path. | 1149 | * complete checksum manually on outgoing path. |