1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25#ifndef _LINUX_NETDEVICE_H
26#define _LINUX_NETDEVICE_H
27
28#include <linux/if.h>
29#include <linux/if_ether.h>
30#include <linux/if_packet.h>
31
32#include <asm/atomic.h>
33#include <asm/cache.h>
34#include <asm/byteorder.h>
35
36#ifdef __KERNEL__
37#include <linux/config.h>
38#include <linux/device.h>
39#include <linux/percpu.h>
40
41struct divert_blk;
42struct vlan_group;
43struct ethtool_ops;
44
45
46#define SET_ETHTOOL_OPS(netdev,ops) \
47 ( (netdev)->ethtool_ops = (ops) )
48
49#define HAVE_ALLOC_NETDEV
50
51#define HAVE_FREE_NETDEV
52
53#define NET_XMIT_SUCCESS 0
54#define NET_XMIT_DROP 1
55#define NET_XMIT_CN 2
56#define NET_XMIT_POLICED 3
57#define NET_XMIT_BYPASS 4
58
59
60
61
62#define NET_RX_SUCCESS 0
63#define NET_RX_DROP 1
64#define NET_RX_CN_LOW 2
65#define NET_RX_CN_MOD 3
66#define NET_RX_CN_HIGH 4
67#define NET_RX_BAD 5
68
69#define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
70
71#endif
72
73#define MAX_ADDR_LEN 32
74
75
76
77
78
79
80#if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR)
81#define LL_MAX_HEADER 32
82#else
83#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
84#define LL_MAX_HEADER 96
85#else
86#define LL_MAX_HEADER 48
87#endif
88#endif
89
90#if !defined(CONFIG_NET_IPIP) && \
91 !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE)
92#define MAX_HEADER LL_MAX_HEADER
93#else
94#define MAX_HEADER (LL_MAX_HEADER + 48)
95#endif
96
97
98
99
100
101
102struct net_device_stats
103{
104 unsigned long rx_packets;
105 unsigned long tx_packets;
106 unsigned long rx_bytes;
107 unsigned long tx_bytes;
108 unsigned long rx_errors;
109 unsigned long tx_errors;
110 unsigned long rx_dropped;
111 unsigned long tx_dropped;
112 unsigned long multicast;
113 unsigned long collisions;
114
115
116 unsigned long rx_length_errors;
117 unsigned long rx_over_errors;
118 unsigned long rx_crc_errors;
119 unsigned long rx_frame_errors;
120 unsigned long rx_fifo_errors;
121 unsigned long rx_missed_errors;
122
123
124 unsigned long tx_aborted_errors;
125 unsigned long tx_carrier_errors;
126 unsigned long tx_fifo_errors;
127 unsigned long tx_heartbeat_errors;
128 unsigned long tx_window_errors;
129
130
131 unsigned long rx_compressed;
132 unsigned long tx_compressed;
133};
134
135
136
137enum {
138 IF_PORT_UNKNOWN = 0,
139 IF_PORT_10BASE2,
140 IF_PORT_10BASET,
141 IF_PORT_AUI,
142 IF_PORT_100BASET,
143 IF_PORT_100BASETX,
144 IF_PORT_100BASEFX
145};
146
147#ifdef __KERNEL__
148
149#include <linux/cache.h>
150#include <linux/skbuff.h>
151
152struct neighbour;
153struct neigh_parms;
154struct sk_buff;
155
156struct netif_rx_stats
157{
158 unsigned total;
159 unsigned dropped;
160 unsigned time_squeeze;
161 unsigned throttled;
162 unsigned fastroute_hit;
163 unsigned fastroute_success;
164 unsigned fastroute_defer;
165 unsigned fastroute_deferred_out;
166 unsigned fastroute_latency_reduction;
167 unsigned cpu_collision;
168};
169
170DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
171
172
173
174
175
176
177struct dev_mc_list
178{
179 struct dev_mc_list *next;
180 __u8 dmi_addr[MAX_ADDR_LEN];
181 unsigned char dmi_addrlen;
182 int dmi_users;
183 int dmi_gusers;
184};
185
186struct hh_cache
187{
188 struct hh_cache *hh_next;
189 atomic_t hh_refcnt;
190 unsigned short hh_type;
191
192
193
194 int hh_len;
195 int (*hh_output)(struct sk_buff *skb);
196 rwlock_t hh_lock;
197
198
199#define HH_DATA_MOD 16
200#define HH_DATA_OFF(__len) \
201 (HH_DATA_MOD - ((__len) & (HH_DATA_MOD - 1)))
202#define HH_DATA_ALIGN(__len) \
203 (((__len)+(HH_DATA_MOD-1))&~(HH_DATA_MOD - 1))
204 unsigned long hh_data[HH_DATA_ALIGN(LL_MAX_HEADER) / sizeof(long)];
205};
206
207
208
209
210
211
212
213
214
215#define LL_RESERVED_SPACE(dev) \
216 (((dev)->hard_header_len&~(HH_DATA_MOD - 1)) + HH_DATA_MOD)
217
218
219
220
221
222
223enum netdev_state_t
224{
225 __LINK_STATE_XOFF=0,
226 __LINK_STATE_START,
227 __LINK_STATE_PRESENT,
228 __LINK_STATE_SCHED,
229 __LINK_STATE_NOCARRIER,
230 __LINK_STATE_RX_SCHED,
231 __LINK_STATE_LINKWATCH_PENDING
232};
233
234
235
236
237
238
239struct netdev_boot_setup {
240 char name[IFNAMSIZ];
241 struct ifmap map;
242};
243#define NETDEV_BOOT_SETUP_MAX 8
244
245
246
247
248
249
250
251
252
253
254
255
256struct net_device
257{
258
259
260
261
262
263
264 char name[IFNAMSIZ];
265
266
267
268
269
270 unsigned long mem_end;
271 unsigned long mem_start;
272 unsigned long base_addr;
273 unsigned int irq;
274
275
276
277
278
279
280 unsigned char if_port;
281 unsigned char dma;
282
283 unsigned long state;
284
285 struct net_device *next;
286
287
288 int (*init)(struct net_device *dev);
289
290
291
292 struct net_device *next_sched;
293
294
295 int ifindex;
296 int iflink;
297
298
299 struct net_device_stats* (*get_stats)(struct net_device *dev);
300 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
301
302
303
304 struct iw_handler_def * wireless_handlers;
305
306 struct ethtool_ops *ethtool_ops;
307
308
309
310
311
312
313
314
315 unsigned long trans_start;
316 unsigned long last_rx;
317
318 unsigned short flags;
319 unsigned short gflags;
320 unsigned short priv_flags;
321 unsigned short unused_alignment_fixer;
322
323
324
325 unsigned mtu;
326 unsigned short type;
327 unsigned short hard_header_len;
328 void *priv;
329
330 struct net_device *master;
331
332
333
334
335 unsigned char broadcast[MAX_ADDR_LEN];
336 unsigned char dev_addr[MAX_ADDR_LEN];
337 unsigned char addr_len;
338
339 struct dev_mc_list *mc_list;
340 int mc_count;
341 int promiscuity;
342 int allmulti;
343
344 int watchdog_timeo;
345 struct timer_list watchdog_timer;
346
347
348
349 void *atalk_ptr;
350 void *ip_ptr;
351 void *dn_ptr;
352 void *ip6_ptr;
353 void *ec_ptr;
354 void *ax25_ptr;
355
356 struct list_head poll_list;
357 int quota;
358 int weight;
359
360 struct Qdisc *qdisc;
361 struct Qdisc *qdisc_sleeping;
362 struct Qdisc *qdisc_list;
363 struct Qdisc *qdisc_ingress;
364 unsigned long tx_queue_len;
365
366
367 spinlock_t xmit_lock;
368
369
370
371 int xmit_lock_owner;
372
373 spinlock_t queue_lock;
374
375 atomic_t refcnt;
376
377 struct list_head todo_list;
378
379
380 enum { NETREG_UNINITIALIZED=0,
381 NETREG_REGISTERING,
382 NETREG_REGISTERED,
383 NETREG_UNREGISTERING,
384 NETREG_UNREGISTERED,
385 NETREG_RELEASED,
386 } reg_state;
387
388
389 int features;
390#define NETIF_F_SG 1
391#define NETIF_F_IP_CSUM 2
392#define NETIF_F_NO_CSUM 4
393#define NETIF_F_HW_CSUM 8
394#define NETIF_F_HIGHDMA 32
395#define NETIF_F_FRAGLIST 64
396#define NETIF_F_HW_VLAN_TX 128
397#define NETIF_F_HW_VLAN_RX 256
398#define NETIF_F_HW_VLAN_FILTER 512
399#define NETIF_F_VLAN_CHALLENGED 1024
400#define NETIF_F_TSO 2048
401
402
403 void (*uninit)(struct net_device *dev);
404
405 void (*destructor)(struct net_device *dev);
406
407
408 int (*open)(struct net_device *dev);
409 int (*stop)(struct net_device *dev);
410 int (*hard_start_xmit) (struct sk_buff *skb,
411 struct net_device *dev);
412#define HAVE_NETDEV_POLL
413 int (*poll) (struct net_device *dev, int *quota);
414 int (*hard_header) (struct sk_buff *skb,
415 struct net_device *dev,
416 unsigned short type,
417 void *daddr,
418 void *saddr,
419 unsigned len);
420 int (*rebuild_header)(struct sk_buff *skb);
421#define HAVE_MULTICAST
422 void (*set_multicast_list)(struct net_device *dev);
423#define HAVE_SET_MAC_ADDR
424 int (*set_mac_address)(struct net_device *dev,
425 void *addr);
426#define HAVE_PRIVATE_IOCTL
427 int (*do_ioctl)(struct net_device *dev,
428 struct ifreq *ifr, int cmd);
429#define HAVE_SET_CONFIG
430 int (*set_config)(struct net_device *dev,
431 struct ifmap *map);
432#define HAVE_HEADER_CACHE
433 int (*hard_header_cache)(struct neighbour *neigh,
434 struct hh_cache *hh);
435 void (*header_cache_update)(struct hh_cache *hh,
436 struct net_device *dev,
437 unsigned char * haddr);
438#define HAVE_CHANGE_MTU
439 int (*change_mtu)(struct net_device *dev, int new_mtu);
440
441#define HAVE_TX_TIMEOUT
442 void (*tx_timeout) (struct net_device *dev);
443
444 void (*vlan_rx_register)(struct net_device *dev,
445 struct vlan_group *grp);
446 void (*vlan_rx_add_vid)(struct net_device *dev,
447 unsigned short vid);
448 void (*vlan_rx_kill_vid)(struct net_device *dev,
449 unsigned short vid);
450
451 int (*hard_header_parse)(struct sk_buff *skb,
452 unsigned char *haddr);
453 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
454 int (*accept_fastpath)(struct net_device *, struct dst_entry*);
455
456
457 struct net_bridge_port *br_port;
458
459#ifdef CONFIG_NET_FASTROUTE
460#define NETDEV_FASTROUTE_HMASK 0xF
461
462 rwlock_t fastpath_lock;
463 struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1];
464#endif
465#ifdef CONFIG_NET_DIVERT
466
467 struct divert_blk *divert;
468#endif
469
470
471 struct class_device class_dev;
472 struct net_device_stats* (*last_stats)(struct net_device *);
473};
474
475#define SET_MODULE_OWNER(dev) do { } while (0)
476
477
478
479#define SET_NETDEV_DEV(net, pdev) ((net)->class_dev.dev = (pdev))
480
481struct packet_type {
482 unsigned short type;
483 struct net_device *dev;
484 int (*func) (struct sk_buff *, struct net_device *,
485 struct packet_type *);
486 void *af_packet_priv;
487 struct list_head list;
488};
489
490#include <linux/interrupt.h>
491#include <linux/notifier.h>
492
493extern struct net_device loopback_dev;
494extern struct net_device *dev_base;
495extern rwlock_t dev_base_lock;
496
497extern int netdev_boot_setup_add(char *name, struct ifmap *map);
498extern int netdev_boot_setup_check(struct net_device *dev);
499extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
500extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
501extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
502extern void dev_add_pack(struct packet_type *pt);
503extern void dev_remove_pack(struct packet_type *pt);
504extern void __dev_remove_pack(struct packet_type *pt);
505extern int __dev_get(const char *name);
506static inline int __deprecated dev_get(const char *name)
507{
508 return __dev_get(name);
509}
510extern struct net_device *dev_get_by_flags(unsigned short flags,
511 unsigned short mask);
512extern struct net_device *__dev_get_by_flags(unsigned short flags,
513 unsigned short mask);
514extern struct net_device *dev_get_by_name(const char *name);
515extern struct net_device *__dev_get_by_name(const char *name);
516extern struct net_device *__dev_alloc(const char *name, int *err);
517static inline __deprecated struct net_device *dev_alloc(const char *name, int *err)
518{
519 return __dev_alloc(name, err);
520}
521extern int dev_alloc_name(struct net_device *dev, const char *name);
522extern int dev_open(struct net_device *dev);
523extern int dev_close(struct net_device *dev);
524extern int dev_queue_xmit(struct sk_buff *skb);
525extern int register_netdevice(struct net_device *dev);
526extern int unregister_netdevice(struct net_device *dev);
527extern void free_netdev(struct net_device *dev);
528extern void synchronize_net(void);
529extern int register_netdevice_notifier(struct notifier_block *nb);
530extern int unregister_netdevice_notifier(struct notifier_block *nb);
531extern int call_netdevice_notifiers(unsigned long val, void *v);
532extern int dev_new_index(void);
533extern struct net_device *dev_get_by_index(int ifindex);
534extern struct net_device *__dev_get_by_index(int ifindex);
535extern int dev_restart(struct net_device *dev);
536
537typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
538extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
539static inline int unregister_gifconf(unsigned int family)
540{
541 return register_gifconf(family, 0);
542}
543
544
545
546
547
548
549struct softnet_data
550{
551 int throttle;
552 int cng_level;
553 int avg_blog;
554 struct sk_buff_head input_pkt_queue;
555 struct list_head poll_list;
556 struct net_device *output_queue;
557 struct sk_buff *completion_queue;
558
559 struct net_device backlog_dev;
560};
561
562DECLARE_PER_CPU(struct softnet_data,softnet_data);
563
564#define HAVE_NETIF_QUEUE
565
566static inline void __netif_schedule(struct net_device *dev)
567{
568 if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) {
569 unsigned long flags;
570 struct softnet_data *sd;
571
572 local_irq_save(flags);
573 sd = &__get_cpu_var(softnet_data);
574 dev->next_sched = sd->output_queue;
575 sd->output_queue = dev;
576 raise_softirq_irqoff(NET_TX_SOFTIRQ);
577 local_irq_restore(flags);
578 }
579}
580
581static inline void netif_schedule(struct net_device *dev)
582{
583 if (!test_bit(__LINK_STATE_XOFF, &dev->state))
584 __netif_schedule(dev);
585}
586
587static inline void netif_start_queue(struct net_device *dev)
588{
589 clear_bit(__LINK_STATE_XOFF, &dev->state);
590}
591
592static inline void netif_wake_queue(struct net_device *dev)
593{
594 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
595 __netif_schedule(dev);
596}
597
598static inline void netif_stop_queue(struct net_device *dev)
599{
600 set_bit(__LINK_STATE_XOFF, &dev->state);
601}
602
603static inline int netif_queue_stopped(const struct net_device *dev)
604{
605 return test_bit(__LINK_STATE_XOFF, &dev->state);
606}
607
608static inline int netif_running(const struct net_device *dev)
609{
610 return test_bit(__LINK_STATE_START, &dev->state);
611}
612
613
614
615
616
617static inline void dev_kfree_skb_irq(struct sk_buff *skb)
618{
619 if (atomic_dec_and_test(&skb->users)) {
620 struct softnet_data *sd;
621 unsigned long flags;
622
623 local_irq_save(flags);
624 sd = &__get_cpu_var(softnet_data);
625 skb->next = sd->completion_queue;
626 sd->completion_queue = skb;
627 raise_softirq_irqoff(NET_TX_SOFTIRQ);
628 local_irq_restore(flags);
629 }
630}
631
632
633
634
635static inline void dev_kfree_skb_any(struct sk_buff *skb)
636{
637 if (in_irq() || irqs_disabled())
638 dev_kfree_skb_irq(skb);
639 else
640 dev_kfree_skb(skb);
641}
642
643#define HAVE_NETIF_RX 1
644extern int netif_rx(struct sk_buff *skb);
645#define HAVE_NETIF_RECEIVE_SKB 1
646extern int netif_receive_skb(struct sk_buff *skb);
647extern int dev_ioctl(unsigned int cmd, void *);
648extern int dev_ethtool(struct ifreq *);
649extern unsigned dev_get_flags(const struct net_device *);
650extern int dev_change_flags(struct net_device *, unsigned);
651extern int dev_set_mtu(struct net_device *, int);
652extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
653
654extern void dev_init(void);
655
656extern int netdev_nit;
657
658
659
660
661static inline int netif_rx_ni(struct sk_buff *skb)
662{
663 int err = netif_rx(skb);
664 if (softirq_pending(smp_processor_id()))
665 do_softirq();
666 return err;
667}
668
669
670extern void netdev_run_todo(void);
671
672static inline void dev_put(struct net_device *dev)
673{
674 atomic_dec(&dev->refcnt);
675}
676
677#define __dev_put(dev) atomic_dec(&(dev)->refcnt)
678#define dev_hold(dev) atomic_inc(&(dev)->refcnt)
679
680
681
682
683
684
685extern void linkwatch_fire_event(struct net_device *dev);
686
687static inline int netif_carrier_ok(const struct net_device *dev)
688{
689 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
690}
691
692extern void __netdev_watchdog_up(struct net_device *dev);
693
694static inline void netif_carrier_on(struct net_device *dev)
695{
696 if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state))
697 linkwatch_fire_event(dev);
698 if (netif_running(dev))
699 __netdev_watchdog_up(dev);
700}
701
702static inline void netif_carrier_off(struct net_device *dev)
703{
704 if (!test_and_set_bit(__LINK_STATE_NOCARRIER, &dev->state))
705 linkwatch_fire_event(dev);
706}
707
708
709static inline int netif_device_present(struct net_device *dev)
710{
711 return test_bit(__LINK_STATE_PRESENT, &dev->state);
712}
713
714static inline void netif_device_detach(struct net_device *dev)
715{
716 if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
717 netif_running(dev)) {
718 netif_stop_queue(dev);
719 }
720}
721
722static inline void netif_device_attach(struct net_device *dev)
723{
724 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
725 netif_running(dev)) {
726 netif_wake_queue(dev);
727 __netdev_watchdog_up(dev);
728 }
729}
730
731
732
733
734#define HAVE_NETIF_MSG 1
735
736enum {
737 NETIF_MSG_DRV = 0x0001,
738 NETIF_MSG_PROBE = 0x0002,
739 NETIF_MSG_LINK = 0x0004,
740 NETIF_MSG_TIMER = 0x0008,
741 NETIF_MSG_IFDOWN = 0x0010,
742 NETIF_MSG_IFUP = 0x0020,
743 NETIF_MSG_RX_ERR = 0x0040,
744 NETIF_MSG_TX_ERR = 0x0080,
745 NETIF_MSG_TX_QUEUED = 0x0100,
746 NETIF_MSG_INTR = 0x0200,
747 NETIF_MSG_TX_DONE = 0x0400,
748 NETIF_MSG_RX_STATUS = 0x0800,
749 NETIF_MSG_PKTDATA = 0x1000,
750 NETIF_MSG_HW = 0x2000,
751 NETIF_MSG_WOL = 0x4000,
752};
753
754#define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV)
755#define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE)
756#define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK)
757#define netif_msg_timer(p) ((p)->msg_enable & NETIF_MSG_TIMER)
758#define netif_msg_ifdown(p) ((p)->msg_enable & NETIF_MSG_IFDOWN)
759#define netif_msg_ifup(p) ((p)->msg_enable & NETIF_MSG_IFUP)
760#define netif_msg_rx_err(p) ((p)->msg_enable & NETIF_MSG_RX_ERR)
761#define netif_msg_tx_err(p) ((p)->msg_enable & NETIF_MSG_TX_ERR)
762#define netif_msg_tx_queued(p) ((p)->msg_enable & NETIF_MSG_TX_QUEUED)
763#define netif_msg_intr(p) ((p)->msg_enable & NETIF_MSG_INTR)
764#define netif_msg_tx_done(p) ((p)->msg_enable & NETIF_MSG_TX_DONE)
765#define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS)
766#define netif_msg_pktdata(p) ((p)->msg_enable & NETIF_MSG_PKTDATA)
767#define netif_msg_hw(p) ((p)->msg_enable & NETIF_MSG_HW)
768#define netif_msg_wol(p) ((p)->msg_enable & NETIF_MSG_WOL)
769
770
771
772static inline int netif_rx_schedule_prep(struct net_device *dev)
773{
774 return netif_running(dev) &&
775 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
776}
777
778
779
780
781
782static inline void __netif_rx_schedule(struct net_device *dev)
783{
784 unsigned long flags;
785
786 local_irq_save(flags);
787 dev_hold(dev);
788 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
789 if (dev->quota < 0)
790 dev->quota += dev->weight;
791 else
792 dev->quota = dev->weight;
793 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
794 local_irq_restore(flags);
795}
796
797
798
799static inline void netif_rx_schedule(struct net_device *dev)
800{
801 if (netif_rx_schedule_prep(dev))
802 __netif_rx_schedule(dev);
803}
804
805
806
807
808static inline int netif_rx_reschedule(struct net_device *dev, int undo)
809{
810 if (netif_rx_schedule_prep(dev)) {
811 unsigned long flags;
812
813 dev->quota += undo;
814
815 local_irq_save(flags);
816 list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);
817 __raise_softirq_irqoff(NET_RX_SOFTIRQ);
818 local_irq_restore(flags);
819 return 1;
820 }
821 return 0;
822}
823
824
825
826
827
828
829static inline void netif_rx_complete(struct net_device *dev)
830{
831 unsigned long flags;
832
833 local_irq_save(flags);
834 if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
835 list_del(&dev->poll_list);
836 smp_mb__before_clear_bit();
837 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
838 local_irq_restore(flags);
839}
840
841static inline void netif_poll_disable(struct net_device *dev)
842{
843 while (test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state)) {
844
845 current->state = TASK_INTERRUPTIBLE;
846 schedule_timeout(1);
847 }
848}
849
850static inline void netif_poll_enable(struct net_device *dev)
851{
852 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
853}
854
855
856
857
858static inline void __netif_rx_complete(struct net_device *dev)
859{
860 if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
861 list_del(&dev->poll_list);
862 smp_mb__before_clear_bit();
863 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
864}
865
866static inline void netif_tx_disable(struct net_device *dev)
867{
868 spin_lock_bh(&dev->xmit_lock);
869 netif_stop_queue(dev);
870 spin_unlock_bh(&dev->xmit_lock);
871}
872
873
874
875extern void ether_setup(struct net_device *dev);
876extern void fddi_setup(struct net_device *dev);
877extern void tr_setup(struct net_device *dev);
878extern void fc_setup(struct net_device *dev);
879extern void fc_freedev(struct net_device *dev);
880
881extern struct net_device *alloc_netdev(int sizeof_priv, const char *name,
882 void (*setup)(struct net_device *));
883extern int register_netdev(struct net_device *dev);
884extern void unregister_netdev(struct net_device *dev);
885
886extern void dev_mc_upload(struct net_device *dev);
887extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
888extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
889extern void dev_mc_discard(struct net_device *dev);
890extern void dev_set_promiscuity(struct net_device *dev, int inc);
891extern void dev_set_allmulti(struct net_device *dev, int inc);
892extern void netdev_state_change(struct net_device *dev);
893
894extern void dev_load(const char *name);
895extern void dev_mcast_init(void);
896extern int netdev_register_fc(struct net_device *dev, void (*stimul)(struct net_device *dev));
897extern void netdev_unregister_fc(int bit);
898extern int netdev_max_backlog;
899extern int weight_p;
900extern unsigned long netdev_fc_xoff;
901extern atomic_t netdev_dropping;
902extern int netdev_set_master(struct net_device *dev, struct net_device *master);
903extern struct sk_buff * skb_checksum_help(struct sk_buff *skb);
904#ifdef CONFIG_NET_FASTROUTE
905extern int netdev_fastroute;
906extern int netdev_fastroute_obstacles;
907extern void dev_clear_fastroute(struct net_device *dev);
908#endif
909
910#ifdef CONFIG_SYSCTL
911extern char *net_sysctl_strdup(const char *s);
912#endif
913
914#endif
915
916#endif
917