📄 netdev.h
字号:
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2002/01/21 15:47:40 $* $Source: M:/psisrc/stack/incl/rcs/netdev.h $* $Revision: 1.37 $*************************************************************************** File Description: Definitions and Macros for dealing with the* `netdev' structure**************************************************************************/#ifndef _NETDEV_#define _NETDEV_#include "config.h"#include "ccdep.h"#include "std.h"#include "dsu.h"#include "socket.h"#include "q.h"#include "timer.h"#ifdef IGMP_PROTOCOL#include "igmp.h"#endif/* flags for ndp->nd_flags */#define F_N_INITIALIZED 0x0001 /* has been initialized */#define F_N_ONLINE 0x0002 /* device is on line */#define F_N_NONEXISTENT 0x0004 /* no response during probe */#define F_N_PRESERVE_MSG 0x0008 /* Fusion must preseve message pending tx complete -- see note below */#define F_N_B42CAST 0x0010 /* This net uses B42 broadcast */#define F_N_GOING_DOWN 0x0020 /* on its way out */#define F_N_IMMEDIATE 0x0040 /* can't do delayed down -- see note below */#define F_N_MAINT_BUF 0x0080 /* lwq buffers re-allocated from os_maint() *//* NOTE: F_N_IMMEDIATE, if set, means that the Fusion simply submits any outgoing packet to the driver immediately, and upon return from the driver's "start" function, the packet is assumed to have been transmitted and Fusion is free to dispose of the packet. Driver will "block" until the packet is transmitted, then return. There is no need for the driver to call Fusion's transmit completion routine. *//* NOTE: F_N_PRESERVE_MSG, if set, means that when Fusion a packet to the driver, Fusion must not "free" it until it has received a transmit completion notification message from the driver for that packet. Presumably, this is because the driver, rather than copying the data of the message into its own internal buffer, leaves it in place in the message during the transmit operation. This is preferable from a performance standpoint, because it saves a copy *//* NOTE: The F_N_PRESERVE_MSG flag is not used if the F_N_IMMEDIATE flag is set, because there is no possible need for Fusion to preserve messages in that situation *//* It is up to the driver, within the driver intialization routine, to set the F_N_IMMEDIATE and/or F_N_PRESERVE_MSG as appropriate. If F_N_IMMEDIATE flag is not set,then the driver must indicate the limit of how many packets it can accept before FUSION stops submitting them (pending transmit completes). The driver must call the Fusion transmit completion notification routine ("ndq_restart") for each packet that completes transmission. *//* The driver should use the mcaros defined below instead of explicitly referring to these flags, which are simply an internal Fusion implementation. However, for backward compatibility with pre-Fusion-5.5 drivers, which may or may not have had references to the F_N_IMMEDIATE flag, Fusion 5.5 should be backward compatible with these drivers. *//**********************************************************************************//*************** Macros to tell fusion the driver's operating mode ****************//*************** These macros hide the flags from the driver **********************//**********************************************************************************/#define FUSION_IMMEDIATE(n) n->nd_flags |= F_N_IMMEDIATE#define FUSION_NO_IMMEDIATE(n) n->nd_flags &= ~F_N_IMMEDIATE#define FUSION_PENDLIMIT(n,l) n->nd_txpendlimit = l#define FUSION_PRESERVE_MSGS(n) n->nd_flags |= F_N_PRESERVE_MSG#define FUSION_DONT_PRESERVE_MSGS(n) n->nd_flags &= ~F_N_PRESERVE_MSG#define FUSION_PRESERVING_MSGS(n) ( (!(n->nd_flags & F_N_IMMEDIATE)) && \ (n->nd_flags & F_N_PRESERVE_MSG) )/* The following macro can be used in the driver initialization to tell Fusion that it will wait until a packet submitted to it has completed transmission before returning from the function by which the packet is submitted to it. This is equivalent to setting the F_N_IMMEDIATE flag */#define FUSION_DRV_BLOCK_UNTIL_TXCOMPLETE(n) FUSION_IMMEDIATE(n)/* The following macro can be used in the driver initialization to tell Fusion that it will not block (but will notify Fusion when a packet's transmission completes), can accept up to "limit" outgoing packets at a time pending transmit completion, and will copy submitted packets into its internal buffers (so that Fusion need not preserve the packet while transmission complete is pending). */#define FUSION_DRV_TXCOMPLETE_NOTIFY_COPY(n,limit) FUSION_NO_IMMEDIATE(n);\ FUSION_DONT_PRESERVE_MSGS(n);\ FUSION_PENDLIMIT(n,limit) /* The following macro can be used in the driver initialization to tell Fusion that it will not block (but will notify Fusion when a packet's transmission completes, can accept up to "limit" outgoing packets at a time pending transmit completion, and will NOT copy submitted packets into internal buffers (therefore, Fusion must preserve the packets while transmission complete is pending). */#define FUSION_DRV_TXCOMPLETE_NOTIFY_NOCOPY(n,limit) FUSION_NO_IMMEDIATE(n);\ FUSION_PRESERVE_MSGS(n);\ FUSION_PENDLIMIT(n,limit)/*************************************************************************************/ /* The following macro indicates whether or not Fusion requires the driver to call "ndq_restart" for each packet that completes transmission */#define NDQ_NEED_TX_COMPLETE(n) (!( (n->nd_flags) & F_N_IMMEDIATE))#define F_N_LINE_COMING_UP 0x0100 /* device is bringing the line up (PPP)*/#define F_N_IPADDRESS_SET 0x0200 /* IP address has been set */#define F_N_ROUTERADDRESS_SET 0x0400 /* Default router address has been set */#define F_N_CONFIGIP 0x0800 /* Ip dynamically set by PPP provider */#define F_N_AUTH_SERVER 0x1000 /* ppp authenticator */#define F_N_DHCP_CLIENT 0x2000#define F_N_TESTING 0x4000 /* Currently unused by Fusion. Indicates the interface is in the MIB-II testing state. *//* flags for ndp->nd_xflags */#define F_X_MULTI_ENBL 0x0001 /* multicast enabled */#define F_X_MULTI_ADDR 0x0004 /* to communicate KFR that this is multi.route */#define F_X_SHARING_NIC 0x0008 /* We are sharing this NIC (MAC address) with another TCP/IP stack */#define F_X_PPPOE_AC 0x0010 /* enable PPPoE access concentrator on this interface */#define F_X_PPPOE_HOST 0x0020 /* enable PPPoE Host on this interface */#ifdef IGMP_PROTOCOLtypedef struct smulti_addr { struct smulti_addr *next; a48 addr;} multi_addr;typedef struct saddr_list { multi_addr *head; multi_addr *tail;} addr_list;#endif /* IGMP_PROTOCOL */typedef struct st_blk { /* Ethernet Based */ u32 sb_rcnt; /* Receive packet count */ u32 sb_xcnt; /* Transmit packet count */ u32 sb_recnt; /* Receive error count */ u32 sb_xecnt; /* Transmit error count */ u32 sb_jam; /* Jam retry count */#if defined(SNMP) || defined(WANT_NETWORK_STATISTICS) u32 ifInOctets; u32 ifInUcastPkts; u32 ifInNUcastPkts; u32 ifInDiscards; u32 ifInErrors; u32 ifInUnknownProtos; u32 ifOutOctets; u32 ifOutUcastPkts; u32 ifOutNUcastPkts; u32 ifOutDiscards; u32 ifOutErrors;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -