2 * INET An implementation of the TCP/IP protocol suite for the LINUX
3 * operating system. INET is implemented using the BSD Socket
4 * interface as the means of communication with the user level.
6 * Definitions for the Interfaces handler.
8 * Version: @(#)dev.h 1.0.10 08/12/93
10 * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
11 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * Corey Minyard <wf-rch!minyard@relay.EU.net>
13 * Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>
14 * Alan Cox, <Alan.Cox@linux.org>
15 * Bjorn Ekwall. <bj0rn@blox.se>
16 * Pekka Riikonen <priikone@poseidon.pspt.fi>
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version
21 * 2 of the License, or (at your option) any later version.
23 * Moved to /usr/include/linux for NET3
25 #ifndef _LINUX_NETDEVICE_H
26 #define _LINUX_NETDEVICE_H
29 #include <linux/if_ether.h>
30 #include <linux/if_packet.h>
32 #include <asm/atomic.h>
33 #include <asm/cache.h>
34 #include <asm/byteorder.h>
37 #include <linux/config.h>
38 #ifdef CONFIG_NET_PROFILE
39 #include <net/profile.h>
45 #define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
46 functions are available. */
48 #define NET_XMIT_SUCCESS 0
49 #define NET_XMIT_DROP 1 /* skb dropped */
50 #define NET_XMIT_CN 2 /* congestion notification */
51 #define NET_XMIT_POLICED 3 /* skb is shot by police */
52 #define NET_XMIT_BYPASS 4 /* packet does not leave via dequeue;
53 (TC use only - dev_queue_xmit
54 returns this as NET_XMIT_SUCCESS) */
56 /* Backlog congestion levels */
57 #define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
58 #define NET_RX_DROP 1 /* packet dropped */
59 #define NET_RX_CN_LOW 2 /* storm alert, just in case */
60 #define NET_RX_CN_MOD 3 /* Storm on its way! */
61 #define NET_RX_CN_HIGH 4 /* The storm is here */
62 #define NET_RX_BAD 5 /* packet dropped due to kernel error */
64 #define net_xmit_errno(e) ((e) != NET_XMIT_CN ? -ENOBUFS : 0)
68 #define MAX_ADDR_LEN 8 /* Largest hardware address length */
71 * Compute the worst case header length according to the protocols
75 #if !defined(CONFIG_AX25) && !defined(CONFIG_AX25_MODULE) && !defined(CONFIG_TR)
76 #define LL_MAX_HEADER 32
78 #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
79 #define LL_MAX_HEADER 96
81 #define LL_MAX_HEADER 48
85 #if !defined(CONFIG_NET_IPIP) && \
86 !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE)
87 #define MAX_HEADER LL_MAX_HEADER
89 #define MAX_HEADER (LL_MAX_HEADER + 48)
93 * Network device statistics. Akin to the 2.0 ether stats but
97 struct net_device_stats
99 unsigned long rx_packets; /* total packets received */
100 unsigned long tx_packets; /* total packets transmitted */
101 unsigned long rx_bytes; /* total bytes received */
102 unsigned long tx_bytes; /* total bytes transmitted */
103 unsigned long rx_errors; /* bad packets received */
104 unsigned long tx_errors; /* packet transmit problems */
105 unsigned long rx_dropped; /* no space in linux buffers */
106 unsigned long tx_dropped; /* no space available in linux */
107 unsigned long multicast; /* multicast packets received */
108 unsigned long collisions;
110 /* detailed rx_errors: */
111 unsigned long rx_length_errors;
112 unsigned long rx_over_errors; /* receiver ring buff overflow */
113 unsigned long rx_crc_errors; /* recved pkt with crc error */
114 unsigned long rx_frame_errors; /* recv'd frame alignment error */
115 unsigned long rx_fifo_errors; /* recv'r fifo overrun */
116 unsigned long rx_missed_errors; /* receiver missed packet */
118 /* detailed tx_errors */
119 unsigned long tx_aborted_errors;
120 unsigned long tx_carrier_errors;
121 unsigned long tx_fifo_errors;
122 unsigned long tx_heartbeat_errors;
123 unsigned long tx_window_errors;
126 unsigned long rx_compressed;
127 unsigned long tx_compressed;
131 /* Media selection options. */
144 extern const char *if_port_text[];
146 #include <linux/cache.h>
147 #include <linux/skbuff.h>
153 struct netif_rx_stats
157 unsigned time_squeeze;
159 unsigned fastroute_hit;
160 unsigned fastroute_success;
161 unsigned fastroute_defer;
162 unsigned fastroute_deferred_out;
163 unsigned fastroute_latency_reduction;
164 unsigned cpu_collision;
165 } ____cacheline_aligned;
167 extern struct netif_rx_stats netdev_rx_stat[];
171 * We tag multicasts with these structures.
176 struct dev_mc_list *next;
177 __u8 dmi_addr[MAX_ADDR_LEN];
178 unsigned char dmi_addrlen;
185 struct hh_cache *hh_next; /* Next entry */
186 atomic_t hh_refcnt; /* number of users */
187 unsigned short hh_type; /* protocol identifier, f.e ETH_P_IP
188 * NOTE: For VLANs, this will be the
189 * encapuslated type. --BLG
191 int hh_len; /* length of header */
192 int (*hh_output)(struct sk_buff *skb);
194 /* cached hardware header; allow for machine alignment needs. */
195 unsigned long hh_data[16/sizeof(unsigned long)];
198 /* These flag bits are private to the generic network queueing
199 * layer, they may not be explicitly referenced by any other
207 __LINK_STATE_PRESENT,
209 __LINK_STATE_NOCARRIER,
210 __LINK_STATE_RX_SCHED
215 * This structure holds at boot time configured netdevice settings. They
216 * are then used in the device probing.
218 struct netdev_boot_setup {
222 #define NETDEV_BOOT_SETUP_MAX 8
226 * The DEVICE structure.
227 * Actually, this whole structure is a big mistake. It mixes I/O
228 * data with strictly "high-level" data, and it has to know about
229 * almost every data structure used in the INET module.
231 * FIXME: cleanup struct net_device such that network protocol info
239 * This is the first field of the "visible" part of this structure
240 * (i.e. as seen by users in the "Space.c" file). It is the name
246 * I/O specific fields
247 * FIXME: Merge these and struct ifmap into one
249 unsigned long rmem_end; /* shmem "recv" end */
250 unsigned long rmem_start; /* shmem "recv" start */
251 unsigned long mem_end; /* shared mem end */
252 unsigned long mem_start; /* shared mem start */
253 unsigned long base_addr; /* device I/O address */
254 unsigned int irq; /* device IRQ number */
257 * Some hardware also needs these fields, but they are not
258 * part of the usual set specified in Space.c.
261 unsigned char if_port; /* Selectable AUI, TP,..*/
262 unsigned char dma; /* DMA channel */
266 struct net_device *next;
268 /* The device initialization function. Called only once. */
269 int (*init)(struct net_device *dev);
271 /* ------- Fields preinitialized in Space.c finish here ------- */
273 struct net_device *next_sched;
275 /* Interface index. Unique device identifier */
280 struct net_device_stats* (*get_stats)(struct net_device *dev);
281 struct iw_statistics* (*get_wireless_stats)(struct net_device *dev);
283 /* List of functions to handle Wireless Extensions (instead of ioctl).
284 * See <net/iw_handler.h> for details. Jean II */
285 struct iw_handler_def * wireless_handlers;
288 * This marks the end of the "visible" part of the structure. All
289 * fields hereafter are internal to the system, and may change at
290 * will (read: may be cleaned up at will).
293 /* These may be needed for future network-power-down code. */
294 unsigned long trans_start; /* Time (in jiffies) of last Tx */
295 unsigned long last_rx; /* Time of last Rx */
297 unsigned short flags; /* interface flags (a la BSD) */
298 unsigned short gflags;
299 unsigned short priv_flags; /* Like 'flags' but invisible to userspace. */
300 unsigned short unused_alignment_fixer; /* Because we need priv_flags,
301 * and we want to be 32-bit aligned.
304 unsigned mtu; /* interface MTU value */
305 unsigned short type; /* interface hardware type */
306 unsigned short hard_header_len; /* hardware hdr length */
307 void *priv; /* pointer to private data */
309 struct net_device *master; /* Pointer to master device of a group,
310 * which this device is member of.
313 /* Interface address info. */
314 unsigned char broadcast[MAX_ADDR_LEN]; /* hw bcast add */
315 unsigned char dev_addr[MAX_ADDR_LEN]; /* hw address */
316 unsigned char addr_len; /* hardware address length */
318 struct dev_mc_list *mc_list; /* Multicast mac addresses */
319 int mc_count; /* Number of installed mcasts */
324 struct timer_list watchdog_timer;
326 /* Protocol specific pointers */
328 void *atalk_ptr; /* AppleTalk link */
329 void *ip_ptr; /* IPv4 specific data */
330 void *dn_ptr; /* DECnet specific data */
331 void *ip6_ptr; /* IPv6 specific data */
332 void *ec_ptr; /* Econet specific data */
334 struct list_head poll_list; /* Link to poll list */
339 struct Qdisc *qdisc_sleeping;
340 struct Qdisc *qdisc_list;
341 struct Qdisc *qdisc_ingress;
342 unsigned long tx_queue_len; /* Max frames per queue allowed */
344 /* hard_start_xmit synchronizer */
345 spinlock_t xmit_lock;
346 /* cpu id of processor entered to hard_start_xmit or -1,
347 if nobody entered there.
350 /* device queue lock */
351 spinlock_t queue_lock;
352 /* Number of references to this device */
354 /* The flag marking that device is unregistered, but held by an user */
357 /* Net device features */
359 #define NETIF_F_SG 1 /* Scatter/gather IO. */
360 #define NETIF_F_IP_CSUM 2 /* Can checksum only TCP/UDP over IPv4. */
361 #define NETIF_F_NO_CSUM 4 /* Does not require checksum. F.e. loopack. */
362 #define NETIF_F_HW_CSUM 8 /* Can checksum all the packets. */
363 #define NETIF_F_DYNALLOC 16 /* Self-dectructable device. */
364 #define NETIF_F_HIGHDMA 32 /* Can DMA to high memory. */
365 #define NETIF_F_FRAGLIST 64 /* Scatter/gather IO. */
366 #define NETIF_F_HW_VLAN_TX 128 /* Transmit VLAN hw acceleration */
367 #define NETIF_F_HW_VLAN_RX 256 /* Receive VLAN hw acceleration */
368 #define NETIF_F_HW_VLAN_FILTER 512 /* Receive filtering on VLAN */
369 #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */
371 /* Called after device is detached from network. */
372 void (*uninit)(struct net_device *dev);
373 /* Called after last user reference disappears. */
374 void (*destructor)(struct net_device *dev);
376 /* Pointers to interface service routines. */
377 int (*open)(struct net_device *dev);
378 int (*stop)(struct net_device *dev);
379 int (*hard_start_xmit) (struct sk_buff *skb,
380 struct net_device *dev);
381 #define HAVE_NETDEV_POLL
382 int (*poll) (struct net_device *dev, int *quota);
383 int (*hard_header) (struct sk_buff *skb,
384 struct net_device *dev,
389 int (*rebuild_header)(struct sk_buff *skb);
390 #define HAVE_MULTICAST
391 void (*set_multicast_list)(struct net_device *dev);
392 #define HAVE_SET_MAC_ADDR
393 int (*set_mac_address)(struct net_device *dev,
395 #define HAVE_PRIVATE_IOCTL
396 int (*do_ioctl)(struct net_device *dev,
397 struct ifreq *ifr, int cmd);
398 #define HAVE_SET_CONFIG
399 int (*set_config)(struct net_device *dev,
401 #define HAVE_HEADER_CACHE
402 int (*hard_header_cache)(struct neighbour *neigh,
403 struct hh_cache *hh);
404 void (*header_cache_update)(struct hh_cache *hh,
405 struct net_device *dev,
406 unsigned char * haddr);
407 #define HAVE_CHANGE_MTU
408 int (*change_mtu)(struct net_device *dev, int new_mtu);
410 #define HAVE_TX_TIMEOUT
411 void (*tx_timeout) (struct net_device *dev);
413 void (*vlan_rx_register)(struct net_device *dev,
414 struct vlan_group *grp);
415 void (*vlan_rx_add_vid)(struct net_device *dev,
417 void (*vlan_rx_kill_vid)(struct net_device *dev,
420 int (*hard_header_parse)(struct sk_buff *skb,
421 unsigned char *haddr);
422 int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
423 int (*accept_fastpath)(struct net_device *, struct dst_entry*);
425 /* open/release and usage marking */
426 struct module *owner;
429 struct net_bridge_port *br_port;
431 #ifdef CONFIG_NET_FASTROUTE
432 #define NETDEV_FASTROUTE_HMASK 0xF
433 /* Semi-private data. Keep it at the end of device struct. */
434 rwlock_t fastpath_lock;
435 struct dst_entry *fastpath[NETDEV_FASTROUTE_HMASK+1];
437 #ifdef CONFIG_NET_DIVERT
438 /* this will get initialized at each interface type init routine */
439 struct divert_blk *divert;
440 #endif /* CONFIG_NET_DIVERT */
446 unsigned short type; /* This is really htons(ether_type). */
447 struct net_device *dev; /* NULL is wildcarded here */
448 int (*func) (struct sk_buff *, struct net_device *,
449 struct packet_type *);
450 void *data; /* Private to the packet type */
451 struct packet_type *next;
455 #include <linux/interrupt.h>
456 #include <linux/notifier.h>
458 extern struct net_device loopback_dev; /* The loopback */
459 extern struct net_device *dev_base; /* All devices */
460 extern rwlock_t dev_base_lock; /* Device list lock */
462 extern int netdev_boot_setup_add(char *name, struct ifmap *map);
463 extern int netdev_boot_setup_check(struct net_device *dev);
464 extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
465 extern void dev_add_pack(struct packet_type *pt);
466 extern void dev_remove_pack(struct packet_type *pt);
467 extern int dev_get(const char *name);
468 extern struct net_device *dev_get_by_name(const char *name);
469 extern struct net_device *__dev_get_by_name(const char *name);
470 extern struct net_device *dev_alloc(const char *name, int *err);
471 extern int dev_alloc_name(struct net_device *dev, const char *name);
472 extern int dev_open(struct net_device *dev);
473 extern int dev_close(struct net_device *dev);
474 extern int dev_queue_xmit(struct sk_buff *skb);
475 extern int register_netdevice(struct net_device *dev);
476 extern int unregister_netdevice(struct net_device *dev);
477 extern int register_netdevice_notifier(struct notifier_block *nb);
478 extern int unregister_netdevice_notifier(struct notifier_block *nb);
479 extern int dev_new_index(void);
480 extern struct net_device *dev_get_by_index(int ifindex);
481 extern struct net_device *__dev_get_by_index(int ifindex);
482 extern int dev_restart(struct net_device *dev);
484 typedef int gifconf_func_t(struct net_device * dev, char * bufptr, int len);
485 extern int register_gifconf(unsigned int family, gifconf_func_t * gifconf);
486 static inline int unregister_gifconf(unsigned int family)
488 return register_gifconf(family, 0);
492 * Incoming packets are placed on per-cpu queues so that
493 * no locking is needed.
501 struct sk_buff_head input_pkt_queue;
502 struct list_head poll_list;
503 struct net_device *output_queue;
504 struct sk_buff *completion_queue;
506 struct net_device blog_dev; /* Sorry. 8) */
507 } ____cacheline_aligned;
510 extern struct softnet_data softnet_data[NR_CPUS];
512 #define HAVE_NETIF_QUEUE
514 static inline void __netif_schedule(struct net_device *dev)
516 if (!test_and_set_bit(__LINK_STATE_SCHED, &dev->state)) {
518 int cpu = smp_processor_id();
520 local_irq_save(flags);
521 dev->next_sched = softnet_data[cpu].output_queue;
522 softnet_data[cpu].output_queue = dev;
523 cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
524 local_irq_restore(flags);
528 static inline void netif_schedule(struct net_device *dev)
530 if (!test_bit(__LINK_STATE_XOFF, &dev->state))
531 __netif_schedule(dev);
534 static inline void netif_start_queue(struct net_device *dev)
536 clear_bit(__LINK_STATE_XOFF, &dev->state);
539 static inline void netif_wake_queue(struct net_device *dev)
541 if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
542 __netif_schedule(dev);
545 static inline void netif_stop_queue(struct net_device *dev)
547 set_bit(__LINK_STATE_XOFF, &dev->state);
550 static inline int netif_queue_stopped(struct net_device *dev)
552 return test_bit(__LINK_STATE_XOFF, &dev->state);
555 static inline int netif_running(struct net_device *dev)
557 return test_bit(__LINK_STATE_START, &dev->state);
561 /* Use this variant when it is known for sure that it
562 * is executing from interrupt context.
564 static inline void dev_kfree_skb_irq(struct sk_buff *skb)
566 if (atomic_dec_and_test(&skb->users)) {
567 int cpu =smp_processor_id();
570 local_irq_save(flags);
571 skb->next = softnet_data[cpu].completion_queue;
572 softnet_data[cpu].completion_queue = skb;
573 cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
574 local_irq_restore(flags);
578 /* Use this variant in places where it could be invoked
579 * either from interrupt or non-interrupt context.
581 static inline void dev_kfree_skb_any(struct sk_buff *skb)
584 dev_kfree_skb_irq(skb);
589 #define HAVE_NETIF_RX 1
590 extern int netif_rx(struct sk_buff *skb);
591 #define HAVE_NETIF_RECEIVE_SKB 1
592 extern int netif_receive_skb(struct sk_buff *skb);
593 extern int dev_ioctl(unsigned int cmd, void *);
594 extern int dev_change_flags(struct net_device *, unsigned);
595 extern void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
597 extern void dev_init(void);
599 extern int netdev_nit;
601 /* Post buffer to the network code from _non interrupt_ context.
602 * see net/core/dev.c for netif_rx description.
604 static inline int netif_rx_ni(struct sk_buff *skb)
606 int err = netif_rx(skb);
607 if (softirq_pending(smp_processor_id()))
612 static inline void dev_init_buffers(struct net_device *dev)
614 /* WILL BE REMOVED IN 2.5.0 */
617 extern int netdev_finish_unregister(struct net_device *dev);
619 static inline void dev_put(struct net_device *dev)
621 if (atomic_dec_and_test(&dev->refcnt))
622 netdev_finish_unregister(dev);
625 #define __dev_put(dev) atomic_dec(&(dev)->refcnt)
626 #define dev_hold(dev) atomic_inc(&(dev)->refcnt)
628 /* Carrier loss detection, dial on demand. The functions netif_carrier_on
629 * and _off may be called from IRQ context, but it is caller
630 * who is responsible for serialization of these calls.
633 static inline int netif_carrier_ok(struct net_device *dev)
635 return !test_bit(__LINK_STATE_NOCARRIER, &dev->state);
638 extern void __netdev_watchdog_up(struct net_device *dev);
640 static inline void netif_carrier_on(struct net_device *dev)
642 clear_bit(__LINK_STATE_NOCARRIER, &dev->state);
643 if (netif_running(dev))
644 __netdev_watchdog_up(dev);
647 static inline void netif_carrier_off(struct net_device *dev)
649 set_bit(__LINK_STATE_NOCARRIER, &dev->state);
653 static inline int netif_device_present(struct net_device *dev)
655 return test_bit(__LINK_STATE_PRESENT, &dev->state);
658 static inline void netif_device_detach(struct net_device *dev)
660 if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) &&
661 netif_running(dev)) {
662 netif_stop_queue(dev);
666 static inline void netif_device_attach(struct net_device *dev)
668 if (!test_and_set_bit(__LINK_STATE_PRESENT, &dev->state) &&
669 netif_running(dev)) {
670 netif_wake_queue(dev);
671 __netdev_watchdog_up(dev);
676 * Network interface message level settings
678 #define HAVE_NETIF_MSG 1
681 NETIF_MSG_DRV = 0x0001,
682 NETIF_MSG_PROBE = 0x0002,
683 NETIF_MSG_LINK = 0x0004,
684 NETIF_MSG_TIMER = 0x0008,
685 NETIF_MSG_IFDOWN = 0x0010,
686 NETIF_MSG_IFUP = 0x0020,
687 NETIF_MSG_RX_ERR = 0x0040,
688 NETIF_MSG_TX_ERR = 0x0080,
689 NETIF_MSG_TX_QUEUED = 0x0100,
690 NETIF_MSG_INTR = 0x0200,
691 NETIF_MSG_TX_DONE = 0x0400,
692 NETIF_MSG_RX_STATUS = 0x0800,
693 NETIF_MSG_PKTDATA = 0x1000,
694 NETIF_MSG_HW = 0x2000,
695 NETIF_MSG_WOL = 0x4000,
698 #define netif_msg_drv(p) ((p)->msg_enable & NETIF_MSG_DRV)
699 #define netif_msg_probe(p) ((p)->msg_enable & NETIF_MSG_PROBE)
700 #define netif_msg_link(p) ((p)->msg_enable & NETIF_MSG_LINK)
701 #define netif_msg_timer(p) ((p)->msg_enable & NETIF_MSG_TIMER)
702 #define netif_msg_ifdown(p) ((p)->msg_enable & NETIF_MSG_IFDOWN)
703 #define netif_msg_ifup(p) ((p)->msg_enable & NETIF_MSG_IFUP)
704 #define netif_msg_rx_err(p) ((p)->msg_enable & NETIF_MSG_RX_ERR)
705 #define netif_msg_tx_err(p) ((p)->msg_enable & NETIF_MSG_TX_ERR)
706 #define netif_msg_tx_queued(p) ((p)->msg_enable & NETIF_MSG_TX_QUEUED)
707 #define netif_msg_intr(p) ((p)->msg_enable & NETIF_MSG_INTR)
708 #define netif_msg_tx_done(p) ((p)->msg_enable & NETIF_MSG_TX_DONE)
709 #define netif_msg_rx_status(p) ((p)->msg_enable & NETIF_MSG_RX_STATUS)
710 #define netif_msg_pktdata(p) ((p)->msg_enable & NETIF_MSG_PKTDATA)
711 #define netif_msg_hw(p) ((p)->msg_enable & NETIF_MSG_HW)
712 #define netif_msg_wol(p) ((p)->msg_enable & NETIF_MSG_WOL)
714 /* Schedule rx intr now? */
716 static inline int netif_rx_schedule_prep(struct net_device *dev)
718 return netif_running(dev) &&
719 !test_and_set_bit(__LINK_STATE_RX_SCHED, &dev->state);
722 /* Add interface to tail of rx poll list. This assumes that _prep has
723 * already been called and returned 1.
726 static inline void __netif_rx_schedule(struct net_device *dev)
729 int cpu = smp_processor_id();
731 local_irq_save(flags);
733 list_add_tail(&dev->poll_list, &softnet_data[cpu].poll_list);
735 dev->quota += dev->weight;
737 dev->quota = dev->weight;
738 __cpu_raise_softirq(cpu, NET_RX_SOFTIRQ);
739 local_irq_restore(flags);
742 /* Try to reschedule poll. Called by irq handler. */
744 static inline void netif_rx_schedule(struct net_device *dev)
746 if (netif_rx_schedule_prep(dev))
747 __netif_rx_schedule(dev);
750 /* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().
751 * Do not inline this?
753 static inline int netif_rx_reschedule(struct net_device *dev, int undo)
755 if (netif_rx_schedule_prep(dev)) {
757 int cpu = smp_processor_id();
761 local_irq_save(flags);
762 list_add_tail(&dev->poll_list, &softnet_data[cpu].poll_list);
763 __cpu_raise_softirq(cpu, NET_RX_SOFTIRQ);
764 local_irq_restore(flags);
770 /* Remove interface from poll list: it must be in the poll list
771 * on current cpu. This primitive is called by dev->poll(), when
772 * it completes the work. The device cannot be out of poll list at this
773 * moment, it is BUG().
775 static inline void netif_rx_complete(struct net_device *dev)
779 local_irq_save(flags);
780 if (!test_bit(__LINK_STATE_RX_SCHED, &dev->state)) BUG();
781 list_del(&dev->poll_list);
782 clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
783 local_irq_restore(flags);
786 /* These functions live elsewhere (drivers/net/net_init.c, but related) */
788 extern void ether_setup(struct net_device *dev);
789 extern void fddi_setup(struct net_device *dev);
790 extern void tr_setup(struct net_device *dev);
791 extern void fc_setup(struct net_device *dev);
792 extern void fc_freedev(struct net_device *dev);
793 /* Support for loadable net-drivers */
794 extern int register_netdev(struct net_device *dev);
795 extern void unregister_netdev(struct net_device *dev);
796 /* Functions used for multicast support */
797 extern void dev_mc_upload(struct net_device *dev);
798 extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
799 extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
800 extern void dev_mc_discard(struct net_device *dev);
801 extern void dev_set_promiscuity(struct net_device *dev, int inc);
802 extern void dev_set_allmulti(struct net_device *dev, int inc);
803 extern void netdev_state_change(struct net_device *dev);
804 /* Load a device via the kmod */
805 extern void dev_load(const char *name);
806 extern void dev_mcast_init(void);
807 extern int netdev_register_fc(struct net_device *dev, void (*stimul)(struct net_device *dev));
808 extern void netdev_unregister_fc(int bit);
809 extern int netdev_max_backlog;
811 extern unsigned long netdev_fc_xoff;
812 extern atomic_t netdev_dropping;
813 extern int netdev_set_master(struct net_device *dev, struct net_device *master);
814 extern struct sk_buff * skb_checksum_help(struct sk_buff *skb);
815 #ifdef CONFIG_NET_FASTROUTE
816 extern int netdev_fastroute;
817 extern int netdev_fastroute_obstacles;
818 extern void dev_clear_fastroute(struct net_device *dev);
822 #endif /* __KERNEL__ */
824 #endif /* _LINUX_DEV_H */