⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 netdevice.h

📁 sparc硬件平台上的红外协议
💻 H
字号:
/** INET        An implementation of the TCP/IP protocol suite for the LINUX*        operating system.  INET is implemented using the  BSD Socket*        interface as the means of communication with the user level.**        Definitions for the Interfaces handler.** Version:    @(#)dev.h    1.0.10    08/12/93** Authors:    Ross Biro*        Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>*        Corey Minyard <wf-rch!minyard@relay.EU.net>*        Donald J. Becker, <becker@cesdis.gsfc.nasa.gov>*        Alan Cox, <Alan.Cox@linux.org>*        Bjorn Ekwall. <bj0rn@blox.se>*              Pekka Riikonen <priikone@poseidon.pspt.fi>**        This program is free software; you can redistribute it and/or*        modify it under the terms of the GNU General Public License*        as published by the Free Software Foundation; either version*        2 of the License, or (at your option) any later version.**        Moved to /usr/include/linux for NET3*/#ifndef _NETDEVICE_H#define _NETDEVICE_H#include <sys/time.h>#include <time.h>#include "../../public/pub_emmi.h"#include "types.h"/* source back-compat hooks */#define SET_ETHTOOL_OPS(netdev,ops) \( (netdev)->ethtool_ops = (ops) )#define HAVE_ALLOC_NETDEV        /* feature macro: alloc_xxxdevfunctions are available. */#define HAVE_FREE_NETDEV        /* free_netdev() */#define HAVE_NETDEV_PRIV        /* netdev_priv() */#define NET_XMIT_SUCCESS    0#define NET_XMIT_DROP        1    /* skb dropped            */#define NET_XMIT_CN        2    /* congestion notification    */#define NET_XMIT_POLICED    3    /* skb is shot by police    */#define NET_XMIT_BYPASS        4    /* packet does not leave via dequeue;(TC use only - dev_queue_xmitreturns this as NET_XMIT_SUCCESS) *//* Backlog congestion levels */#define NET_RX_SUCCESS        0   /* keep 'em coming, baby */#define NET_RX_DROP        1  /* packet dropped */#define NET_RX_CN_LOW        2   /* storm alert, just in case */#define NET_RX_CN_MOD        3   /* Storm on its way! */#define NET_RX_CN_HIGH        4   /* The storm is here */#define NET_RX_BAD        5  /* packet dropped due to kernel error *//* NET_XMIT_CN is special. It does not guarantee that this packet is lost. It* indicates that the device will soon be dropping packets, or already drops* some packets of the same priority; prompting us to send less aggressively. */#define net_xmit_eval(e)    ((e) == NET_XMIT_CN? 0 : (e))#define net_xmit_errno(e)    ((e) != NET_XMIT_CN ? -ENOBUFS : 0)#define MAX_ADDR_LEN    32        /* Largest hardware address length *//* Driver transmit return codes */#define NETDEV_TX_OK 0        /* driver took care of packet */#define NETDEV_TX_BUSY 1    /* driver tx path was busy*/#define NETDEV_TX_LOCKED -1    /* driver tx lock was already taken *//**    Compute the worst case header length according to the protocols*    used.*/#define LL_MAX_HEADER    48#define MAX_HEADER LL_MAX_HEADER//	struct net_device_subqueue//	{//	/* Give a control state for each queue.  This struct may contain//	* per-queue locks in the future.//		*///	    unsigned long   state;//	};/**    Network device statistics. Akin to the 2.0 ether stats but*    with byte counters.*/struct net_device_stats{    unsigned long    rx_packets;        /* total packets received    */    unsigned long    tx_packets;        /* total packets transmitted    */    unsigned long    rx_bytes;        /* total bytes received     */    unsigned long    tx_bytes;        /* total bytes transmitted    */    unsigned long    rx_errors;        /* bad packets received        */    unsigned long    tx_errors;        /* packet transmit problems    */    unsigned long    rx_dropped;        /* no space in linux buffers    */    unsigned long    tx_dropped;        /* no space available in linux    */    unsigned long    multicast;        /* multicast packets received    */    unsigned long    collisions;	    /* detailed rx_errors: */    unsigned long    rx_length_errors;    unsigned long    rx_over_errors;        /* receiver ring buff overflow    */    unsigned long    rx_crc_errors;        /* recved pkt with crc error    */    unsigned long    rx_frame_errors;    /* recv'd frame alignment error */    unsigned long    rx_fifo_errors;        /* recv'r fifo overrun        */    unsigned long    rx_missed_errors;    /* receiver missed packet    */	    /* detailed tx_errors */    unsigned long    tx_aborted_errors;    unsigned long    tx_carrier_errors;    unsigned long    tx_fifo_errors;    unsigned long    tx_heartbeat_errors;    unsigned long    tx_window_errors;        /* for cslip etc */    unsigned long    rx_compressed;    unsigned long    tx_compressed;};/* Media selection options. */enum {	IF_PORT_UNKNOWN = 0,        IF_PORT_10BASE2,        IF_PORT_10BASET,        IF_PORT_AUI,        IF_PORT_100BASET,        IF_PORT_100BASETX,        IF_PORT_100BASEFX};//	struct netif_rx_stats//	{//	    unsigned total;//	    unsigned dropped;//	    unsigned time_squeeze;//	    unsigned cpu_collision;//	};//	struct dev_addr_list{    struct dev_addr_list    *next;    __u8            da_addr[MAX_ADDR_LEN];    __u8            da_addrlen;    __u8            da_synced;    int            da_users;    int            da_gusers;};/**    We tag multicasts with these structures.*///	//	#define dev_mc_list    dev_addr_list//	#define dmi_addr    da_addr//	#define dmi_addrlen    da_addrlen//	#define dmi_users    da_users//	#define dmi_gusers    da_gusers/* Reserve HH_DATA_MOD byte aligned hard_header_len, but at least that much.* Alternative is:*   dev->hard_header_len ? (dev->hard_header_len +*                           (HH_DATA_MOD - 1)) & ~(HH_DATA_MOD - 1) : 0** We could use other alignment values, but we must maintain the* relationship HH alignment <= LL alignment.*//* These flag bits are private to the generic network queueing* layer, they may not be explicitly referenced by any other* code.*/enum netdev_state_t{    __LINK_STATE_XOFF=0,		__LINK_STATE_START,		__LINK_STATE_PRESENT,		__LINK_STATE_SCHED,		__LINK_STATE_NOCARRIER,		__LINK_STATE_RX_SCHED,		__LINK_STATE_LINKWATCH_PENDING,		__LINK_STATE_DORMANT,		__LINK_STATE_QDISC_RUNNING,};/** This structure holds at boot time configured netdevice settings. They* are then used in the device probing. */#define NETDEV_BOOT_SETUP_MAX 8struct sk_buff;/**    The DEVICE structure.*    Actually, this whole structure is a big mistake.  It mixes I/O*    data with strictly "high-level" data, and it has to know about*    almost every data structure used in the INET module.**    FIXME: cleanup struct net_device such that network protocol info*    moves out.*/#define IFNAMSIZ 16struct net_device{	/** This is the first field of the "visible" part of this structure* (i.e. as seen by users in the "Space.c" file).  It is the name* the interface.	*///	    char            name[IFNAMSIZ];	    /*	*    I/O specific fields	*    FIXME: Merge these and struct ifmap into one	*/    unsigned long        base_addr;    /* device I/O address    */    unsigned int        irq;        /* device IRQ number    *///	    unsigned long        state;	    /* The device initialization function. Called only once. *///	    int            (*init)(struct net_device *dev);		    /* Net device features *///	    unsigned long        features;	//	    struct net_device    *next_sched;	    /* Interface index. Unique device identifier    *///	    int            ifindex;//	    int            iflink;		//	    struct net_device_stats* (*get_stats)(struct net_device *dev);//	    struct net_device_stats    stats;//	    unsigned int        flags;    /* interface flags (a la BSD)    *///	    unsigned short        gflags;//		unsigned short          priv_flags; /* Like 'flags' but invisible to userspace. *///	    unsigned short        padded;    /* How much padding added by alloc_netdev() */	//	    unsigned char        operstate; /* RFC2863 operstate *///	    unsigned char        link_mode; /* mapping policy to operstate */	//	    unsigned        mtu;    /* interface MTU value        *///	    unsigned short        type;    /* interface hardware type    *///	    unsigned short        hard_header_len;    /* hardware hdr length    */	//												  struct net_device    *master; /* Pointer to master device of a group,																			* which this device is member of.											  */											  											  /* Interface address info. *///												  unsigned char        perm_addr[MAX_ADDR_LEN]; /* permanent hw address */											//												  unsigned short          dev_id;        /* for shared network cards *///	unsigned char        addr_len;  //												  struct dev_addr_list    *uc_list;    /* Secondary unicast mac addresses *///												  int            uc_count;    /* Number of installed ucasts    *///												  int            uc_promisc;//												  struct dev_addr_list    *mc_list;    /* Multicast mac addresses    *///												  int            mc_count;    /* Number of installed mcasts    *///												  int            promiscuity;//												  int            allmulti;											  											  											  /* Protocol specific pointers */											  											  void             *atalk_ptr;    /* AppleTalk link     *///												  void            *ip_ptr;    /* IPv4 specific data    */  //												  void                    *dn_ptr;        /* DECnet specific data *///												  void                    *ip6_ptr;       /* IPv6 specific data *///												  void            *ec_ptr;    /* Econet specific data    *///												  void            *ax25_ptr;    /* AX.25 specific data */											  											  																			/*																			* Cache line mostly used on receive path (including eth_type_trans())											  */											  											  /* Link to poll list    */											  //												  int            (*poll) (struct net_device *dev, int *quota);//												  int            quota;//												  int            weight;//												  unsigned long        last_rx;    /* Time of last Rx    */											  /* Interface address info used in eth_type_trans() */											  unsigned char        dev_addr[MAX_ADDR_LEN];    /* hw address, (before bcast 											  because most packets are unicast) */											  //												  unsigned char        broadcast[MAX_ADDR_LEN];    /* hw bcast add    */											  																							   /*																							   * Cache line mostly used on queue transmit path (qdisc)											  */											  /* device queue lock */											  //												  unsigned long        tx_queue_len;    /* Max frames per queue allowed */											  											  																					/*																					* One part is mostly used on xmit path (device)																																										 cpu id of processor entered to hard_start_xmit or -1,																					 if nobody entered there.											  */											  void            *priv;    /* pointer to private data    */											  int            (*hard_start_xmit) (struct sk_buff *skb,												  struct net_device *dev);											  /* These may be needed for future network-power-down code. */											  //unsigned long        trans_start;    /* Time (in jiffies) of last Tx    *///												  time_t        trans_start;//												  int            watchdog_timeo; /* used by dev_watchdog() */											  																			 /*																			 * refcnt is a very hot point, so align it on SMP											  */											  /* Number of references to this device */											  											  											  											  //												  struct net_device    *link_watch_next;											  											  /* register/unregister state machine *///												  enum { NETREG_UNINITIALIZED=0,//													  NETREG_REGISTERED,    /* completed register_netdevice *///													  NETREG_UNREGISTERING,    /* called unregister_netdevice *///													  NETREG_UNREGISTERED,    /* completed unregister todo *///													  NETREG_RELEASED,        /* called free_netdev *///												  } reg_state;											  											  /* Called after device is detached from network. *///												  void            (*uninit)(struct net_device *dev);											  /* Called after last user reference disappears. *///												  void            (*destructor)(struct net_device *dev);											  											  /* Pointers to interface service routines.    */											  int            (*open)(struct net_device *dev);											  int            (*stop)(void);											  											  											  											  /* The TX queue control structures *///												  unsigned int            egress_subqueue_count;};//	#define    NETDEV_ALIGN        32//	#define    NETDEV_ALIGN_CONST    (NETDEV_ALIGN - 1)static inline void *netdev_priv(const struct net_device *dev){    return dev->priv;}//	#define SET_MODULE_OWNER(dev) do { } while (0)/* Set the sysfs physical device reference for the network logical device* if set prior to registration will cause a symlink during initialization.*///	#define SET_NETDEV_DEV(net, pdev)    ((net)->dev.parent = (pdev))//	extern struct net_device        loopback_dev;        /* The loopback *///	extern int        dev_alloc_name(struct net_device *dev, const char *name);//	extern int        dev_open(struct net_device *dev);//	extern int        dev_close(struct net_device *dev);#endif    /* _LINUX_DEV_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -