📄 e100.h
字号:
u32 tbd_zero_address; } tbd_sec_addr; union { u16 sec_rec_size; u16 tbd_zero_size; } tbd_sec_size; u16 total_tcp_payload;} tcb_ipcb_t __attribute__ ((__packed__));#ifdef MAX_SKB_FRAGS#define E100_TBD_ARRAY_SIZE (2+MAX_SKB_FRAGS)#else#define E100_TBD_ARRAY_SIZE 2#endif /*MAX_SKB_FRAGS *//* Transmit Command Block (TCB)*/struct _tcb_t { cb_header_t tcb_hdr; u32 tcb_tbd_ptr; /* TBD address */ u16 tcb_cnt; /* Data Bytes In TCB past header */ u8 tcb_thrshld; /* TX Threshold for FIFO Extender */ u8 tcb_tbd_num; union { tcb_ipcb_t ipcb; /* d102 ipcb fields */ tbd_t tbd_array[E100_TBD_ARRAY_SIZE]; } tcbu; /* From here onward we can dump anything we want as long as the * size of the total structure is a multiple of a paragraph * boundary ( i.e. -16 bit aligned ). */ tbd_t *tbd_ptr;#ifdef MAX_SKB_FRAGS u32 tcb_tbd_dflt_ptr; /* TBD address for non-segmented packet */ u32 tcb_tbd_expand_ptr; /* TBD address for segmented packet */#endif /*MAX_SKB_FRAGS */ struct sk_buff *tcb_skb; /* the associated socket buffer */ dma_addr_t tcb_phys; /* phys addr of the TCB */} __attribute__ ((__packed__));#ifndef _TCB_T_#define _TCB_T_typedef struct _tcb_t tcb_t;#endif/* Receive Frame Descriptor (RFD) - will be using the simple model*/struct _rfd_t { /* 8255x */ cb_header_t rfd_header; u32 rfd_rbd_ptr; /* Receive Buffer Descriptor Addr */ u16 rfd_act_cnt; /* Number Of Bytes Received */ u16 rfd_sz; /* Number Of Bytes In RFD */ /* D102 aka Gamla */ u16 vlanid; u8 rcvparserstatus; u8 reserved; u16 securitystatus; u8 checksumstatus; u8 zerocopystatus; u8 pad[8]; /* data should be 16 byte aligned */ u8 data[RFD_DATA_SIZE];} __attribute__ ((__packed__));#ifndef _RFD_T_#define _RFD_T_typedef struct _rfd_t rfd_t;#endif/* Receive Buffer Descriptor (RBD)*/typedef struct _rbd_t { u16 rbd_act_cnt; /* Number Of Bytes Received */ u16 rbd_filler; u32 rbd_lnk_addr; /* Link To Next RBD */ u32 rbd_rcb_addr; /* Receive Buffer Address */ u16 rbd_sz; /* Receive Buffer Size */ u16 rbd_filler1;} rbd_t __attribute__ ((__packed__));#ifdef E100_IDIAG_PRO_SUPPORTtypedef struct { dma_addr_t dma_handle; tcb_t *tcb; rfd_t *rfd;} idiag_e100_diag_loopback_data_t;#define E100_NULL ((u32)0xffffffff)#endif /* E100_IDIAG_PRO_SUPPORT *//* * This structure is used to maintain a FIFO access to a resource that is * maintained as a circular queue. The resource to be maintained is pointed * to by the "data" field in the structure below. In this driver the TCBs', * TBDs' & RFDs' are maintained as a circular queue & are managed thru this * structure. */typedef struct _buf_pool_t { unsigned int head; /* index to first used resource */ unsigned int tail; /* index to last used resource */ void *data; /* points to resource pool */} buf_pool_t;/*Rx skb holding structure*/struct rx_list_elem { struct list_head list_elem; dma_addr_t dma_addr; struct sk_buff *skb;};enum next_cu_cmd_e { RESUME_NO_WAIT = 0, RESUME_WAIT, START_WAIT };enum zlock_state_e { ZLOCK_INITIAL, ZLOCK_READING, ZLOCK_SLEEPING };enum tx_queue_stop_type { LONG_STOP = 0, SHORT_STOP };/* 64 bit aligned size */#define E100_SIZE_64A(X) ((sizeof(X) + 7) & ~0x7)typedef struct _bd_dma_able_t { char selftest[E100_SIZE_64A(self_test_t)]; char stats_counters[E100_SIZE_64A(max_counters_t)];} bd_dma_able_t;/* bit masks for bool parameters */#define PRM_XSUMRX 0x00000001#define PRM_UCODE 0x00000002#define PRM_FC 0x00000004#define PRM_IFS 0x00000008#define PRM_BUNDLE_SMALL 0x00000010#ifdef E100_RX_CONGESTION_CONTROL#define PRM_RX_CONG 0x00000020#endifstruct cfg_params { int e100_speed_duplex; int RxDescriptors; int TxDescriptors; int IntDelay; int BundleMax; int ber;#ifdef E100_RX_CONGESTION_CONTROL int PollingMaxWork;#endif u32 b_params;};#ifdef ETHTOOL_TEST struct ethtool_lpbk_data{ dma_addr_t dma_handle; tcb_t *tcb; rfd_t *rfd;};#endifstruct e100_private {#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) struct list_head list_elem;#endif#ifdef IANS void *iANSreserved; /* reserved for ANS */ iANSsupport_t *iANSdata; unsigned long ans_link_status; unsigned long ans_line_speed; unsigned long ans_dplx_mode;#endif u32 flags; /* board management flags */ u32 tx_per_underrun; /* number of good tx frames per underrun */ unsigned int tx_count; /* count of tx frames, so we can request an interrupt */ u8 tx_thld; /* stores transmit threshold */ u16 eeprom_size; u32 pwa_no; /* PWA: xxxxxx-0xx */ u8 perm_node_address[ETH_ALEN]; struct list_head active_rx_list; /* list of rx buffers */ struct list_head rx_struct_pool; /* pool of rx buffer struct headers */ u16 rfd_size; /* size of the adapter's RFD struct */ int skb_req; /* number of skbs neede by the adapter */ u8 intr_mask; /* mask for interrupt status */ void *dma_able; /* dma allocated structs */ dma_addr_t dma_able_phys; self_test_t *selftest; /* pointer to self test area */ dma_addr_t selftest_phys; /* phys addr of selftest */ max_counters_t *stats_counters; /* pointer to stats table */ dma_addr_t stat_cnt_phys; /* phys addr of stat counter area */ stat_mode_t stat_mode; /* statistics mode: extended, TCO, basic */ scb_t *scb; /* memory mapped ptr to 82557 scb */ tcb_t *last_tcb; /* pointer to last tcb sent */ buf_pool_t tcb_pool; /* adapter's TCB array */ dma_addr_t tcb_phys; /* phys addr of start of TCBs */ u16 cur_line_speed; u16 cur_dplx_mode; struct net_device *device; struct pci_dev *pdev; struct driver_stats drv_stats;#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) u16 sub_ven_id; u16 sub_dev_id;#endif u8 rev_id; /* adapter PCI revision ID */ unsigned long device_type; /* device type from e100_vendor.h */ unsigned int phy_addr; /* address of PHY component */ unsigned int PhyId; /* ID of PHY component */ unsigned int PhyState; /* state for the fix squelch algorithm */ unsigned int PhyDelay; /* delay for the fix squelch algorithm */ /* Lock defintions for the driver */ spinlock_t bd_lock; /* board lock */ spinlock_t bd_non_tx_lock; /* Non transmit command lock */ spinlock_t config_lock; /* config block lock */ spinlock_t mdi_access_lock; /* mdi lock */ struct timer_list watchdog_timer; /* watchdog timer id */ /* non-tx commands parameters */ struct timer_list nontx_timer_id; /* non-tx timer id */ struct list_head non_tx_cmd_list; non_tx_cmd_state_t non_tx_command_state; nxmit_cb_entry_t *same_cmd_entry[CB_MAX_NONTX_CMD]; enum next_cu_cmd_e next_cu_cmd; /* Zero Locking Algorithm data members */ enum zlock_state_e zlock_state; u8 zlock_read_data[16]; /* number of times each value 0-15 was read */ u16 zlock_read_cnt; /* counts number of reads */ ulong zlock_sleep_cnt; /* keeps track of "sleep" time */ u8 config[CB_CFIG_BYTE_COUNT + CB_CFIG_D102_BYTE_COUNT]; /* IFS params */ u8 ifs_state; u8 ifs_value; struct cfg_params params; /* adapter's command line parameters */ struct proc_dir_entry *proc_parent; rwlock_t isolate_lock; int driver_isolated; char *id_string; char *cable_status; char *mdix_status; /* Variables for HWI */ int saved_open_circut; int saved_short_circut; int saved_distance; int saved_i; int saved_same; unsigned char hwi_started; struct timer_list hwi_timer; /* hwi timer id */ /* WOL parameters */ u32 wolsupported; u32 wolopts; u16 ip_lbytes;#ifdef E100_IDIAG_PRO_SUPPORT idiag_e100_diag_loopback_data_t i_loopback;#endif u32 speed_duplex_caps; /* adapter's speed/duplex capabilities */#ifdef E100_RX_CONGESTION_CONTROL struct tasklet_struct polling_tasklet;#endif#ifdef ETHTOOL_TEST struct ethtool_lpbk_data loopback;#endif#ifdef ETHTOOL_PHYS_ID struct timer_list blink_timer; /* led blink timer id */#endif u32 pci_state[16];};#define E100_AUTONEG 0#define E100_SPEED_10_HALF 1#define E100_SPEED_10_FULL 2#define E100_SPEED_100_HALF 3#define E100_SPEED_100_FULL 4/********* function prototypes *************/extern void e100_isolate_driver(struct e100_private *bdp);extern void e100_sw_reset(struct e100_private *bdp, u32 reset_cmd);extern void e100_start_cu(struct e100_private *bdp, tcb_t *tcb);extern void e100_free_non_tx_cmd(struct e100_private *bdp, nxmit_cb_entry_t *non_tx_cmd);extern nxmit_cb_entry_t *e100_alloc_non_tx_cmd(struct e100_private *bdp);extern unsigned char e100_exec_non_cu_cmd(struct e100_private *bdp, nxmit_cb_entry_t *cmd);extern unsigned char e100_selftest(struct e100_private *bdp, u32 *st_timeout, u32 *st_result);extern unsigned char e100_get_link_state(struct e100_private *bdp);extern unsigned char e100_wait_scb(struct e100_private *bdp);#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,2)#ifndef yield /* RH 2.4.18-3 has yield, which is not defined in standard Linux */#define yield() \ do { \ current->policy |= SCHED_YIELD; \ schedule(); \ } while (0) #endif#endif#ifdef IANSextern void e100_tx_notify_start(struct e100_private *bdp);#endifextern void e100_deisolate_driver(struct e100_private *bdp, u8 recover, u8 full_reset);extern unsigned char e100_hw_reset_recover(struct e100_private *bdp, u32 reset_cmd);#ifdef ETHTOOL_TEST#define ROM_TEST_FAIL 0x01#define REGISTER_TEST_FAIL 0x02#define SELF_TEST_FAIL 0x04#define TEST_TIMEOUT 0x08enum test_offsets { E100_EEPROM_TEST_FAIL = 0, E100_CHIP_TIMEOUT, E100_ROM_TEST_FAIL, E100_REG_TEST_FAIL, E100_MAC_TEST_FAIL, E100_LPBK_MAC_FAIL, E100_LPBK_PHY_FAIL, E100_MAX_TEST_RES};#endif#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)extern struct list_head e100_nic_list;static inline void *e100_get_drvdata(struct pci_dev *pcid){ struct e100_private *bdp; struct list_head *pos; for (pos = e100_nic_list.next; pos != &e100_nic_list; pos = pos->next) { bdp = (struct e100_private *) pos; if (bdp->pdev == pcid) return bdp->device; } return NULL;}static inline voide100_set_drvdata(struct pci_dev *pcid, struct net_device *dev){ struct e100_private *bdp; if (dev != NULL) { bdp = dev->priv; list_add(&(bdp->list_elem), &e100_nic_list); } else { dev = e100_get_drvdata(pcid); if (dev != NULL) { bdp = dev->priv; list_del(&(bdp->list_elem)); } }}#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -