linux-bk/drivers/net/e1000/e1000.h
<<
>>
Prefs
   1/*******************************************************************************
   2
   3  
   4  Copyright(c) 1999 - 2002 Intel Corporation. All rights reserved.
   5  
   6  This program is free software; you can redistribute it and/or modify it 
   7  under the terms of the GNU General Public License as published by the Free 
   8  Software Foundation; either version 2 of the License, or (at your option) 
   9  any later version.
  10  
  11  This program is distributed in the hope that it will be useful, but WITHOUT 
  12  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
  13  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for 
  14  more details.
  15  
  16  You should have received a copy of the GNU General Public License along with
  17  this program; if not, write to the Free Software Foundation, Inc., 59 
  18  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  19  
  20  The full GNU General Public License is included in this distribution in the
  21  file called LICENSE.
  22  
  23  Contact Information:
  24  Linux NICS <linux.nics@intel.com>
  25  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  26
  27*******************************************************************************/
  28
  29
  30/* Linux PRO/1000 Ethernet Driver main header file */
  31
  32#ifndef _E1000_H_
  33#define _E1000_H_
  34
  35#include <linux/stddef.h>
  36#include <linux/config.h>
  37#include <linux/module.h>
  38#include <linux/types.h>
  39#include <asm/byteorder.h>
  40#include <linux/init.h>
  41#include <linux/mm.h>
  42#include <linux/errno.h>
  43#include <linux/ioport.h>
  44#include <linux/pci.h>
  45#include <linux/kernel.h>
  46#include <linux/netdevice.h>
  47#include <linux/etherdevice.h>
  48#include <linux/skbuff.h>
  49#include <linux/delay.h>
  50#include <linux/timer.h>
  51#include <linux/slab.h>
  52#include <linux/interrupt.h>
  53#include <linux/string.h>
  54#include <linux/pagemap.h>
  55#include <asm/bitops.h>
  56#include <asm/io.h>
  57#include <asm/irq.h>
  58#include <linux/capability.h>
  59#include <linux/in.h>
  60#include <linux/ip.h>
  61#include <linux/tcp.h>
  62#include <linux/udp.h>
  63#include <net/pkt_sched.h>
  64#include <linux/list.h>
  65#include <linux/reboot.h>
  66#include <net/checksum.h>
  67#include <linux/tqueue.h>
  68#include <linux/ethtool.h>
  69#include <linux/if_vlan.h>
  70
  71#define BAR_0           0
  72#define BAR_1           1
  73#define BAR_5           5
  74#define PCI_DMA_64BIT   0xffffffffffffffffULL
  75#define PCI_DMA_32BIT   0x00000000ffffffffULL
  76
  77
  78struct e1000_adapter;
  79
  80#include "e1000_hw.h"
  81
  82#if DBG
  83#define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args)
  84#else
  85#define E1000_DBG(args...)
  86#endif
  87
  88#define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
  89
  90#define E1000_MAX_INTR 10
  91
  92/* Supported Rx Buffer Sizes */
  93#define E1000_RXBUFFER_2048  2048
  94#define E1000_RXBUFFER_4096  4096
  95#define E1000_RXBUFFER_8192  8192
  96#define E1000_RXBUFFER_16384 16384
  97
  98/* How many Tx Descriptors do we need to call netif_wake_queue ? */
  99#define E1000_TX_QUEUE_WAKE     16
 100/* How many Rx Buffers do we bundle into one write to the hardware ? */
 101#define E1000_RX_BUFFER_WRITE   16
 102
 103#define E1000_JUMBO_PBA      0x00000028
 104#define E1000_DEFAULT_PBA    0x00000030
 105
 106#define AUTO_ALL_MODES       0
 107
 108/* only works for sizes that are powers of 2 */
 109#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
 110
 111/* wrapper around a pointer to a socket buffer,
 112 * so a DMA handle can be stored along with the buffer */
 113struct e1000_buffer {
 114        struct sk_buff *skb;
 115        uint64_t dma;
 116        unsigned long length;
 117        unsigned long time_stamp;
 118};
 119
 120struct e1000_desc_ring {
 121        /* pointer to the descriptor ring memory */
 122        void *desc;
 123        /* physical address of the descriptor ring */
 124        dma_addr_t dma;
 125        /* length of descriptor ring in bytes */
 126        unsigned int size;
 127        /* number of descriptors in the ring */
 128        unsigned int count;
 129        /* next descriptor to associate a buffer with */
 130        unsigned int next_to_use;
 131        /* next descriptor to check for DD status bit */
 132        unsigned int next_to_clean;
 133        /* array of buffer information structs */
 134        struct e1000_buffer *buffer_info;
 135};
 136
 137#define E1000_DESC_UNUSED(R) \
 138((((R)->next_to_clean + (R)->count) - ((R)->next_to_use + 1)) % ((R)->count))
 139
 140#define E1000_GET_DESC(R, i, type)      (&(((struct type *)((R).desc))[i]))
 141#define E1000_RX_DESC(R, i)             E1000_GET_DESC(R, i, e1000_rx_desc)
 142#define E1000_TX_DESC(R, i)             E1000_GET_DESC(R, i, e1000_tx_desc)
 143#define E1000_CONTEXT_DESC(R, i)        E1000_GET_DESC(R, i, e1000_context_desc)
 144
 145/* board specific private data structure */
 146
 147struct e1000_adapter {
 148        struct timer_list watchdog_timer;
 149        struct timer_list phy_info_timer;
 150#ifdef CONFIG_PROC_FS
 151        struct list_head proc_list_head;
 152#endif
 153        struct vlan_group *vlgrp;
 154        char *id_string;
 155        uint32_t bd_number;
 156        uint32_t rx_buffer_len;
 157        uint32_t part_num;
 158        uint32_t wol;
 159        uint16_t link_speed;
 160        uint16_t link_duplex;
 161        spinlock_t stats_lock;
 162        atomic_t irq_sem;
 163        struct tq_struct tx_timeout_task;
 164
 165        struct timer_list blink_timer;
 166        unsigned long led_status;
 167
 168        /* TX */
 169        struct e1000_desc_ring tx_ring;
 170        uint32_t txd_cmd;
 171        uint32_t tx_int_delay;
 172        uint32_t tx_abs_int_delay;
 173        int max_data_per_txd;
 174
 175        /* RX */
 176        struct e1000_desc_ring rx_ring;
 177        uint64_t hw_csum_err;
 178        uint64_t hw_csum_good;
 179        uint32_t rx_int_delay;
 180        uint32_t rx_abs_int_delay;
 181        boolean_t rx_csum;
 182
 183        /* OS defined structs */
 184        struct net_device *netdev;
 185        struct pci_dev *pdev;
 186        struct net_device_stats net_stats;
 187
 188        /* structs defined in e1000_hw.h */
 189        struct e1000_hw hw;
 190        struct e1000_hw_stats stats;
 191        struct e1000_phy_info phy_info;
 192        struct e1000_phy_stats phy_stats;
 193
 194
 195
 196        uint32_t pci_state[16];
 197};
 198#endif /* _E1000_H_ */
 199
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.