fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / via-velocity.h
index 2175b86..b9e114d 100644 (file)
@@ -29,7 +29,9 @@
 
 #define VELOCITY_NAME          "via-velocity"
 #define VELOCITY_FULL_DRV_NAM  "VIA Networking Velocity Family Gigabit Ethernet Adapter Driver"
-#define VELOCITY_VERSION       "1.13"
+#define VELOCITY_VERSION       "1.14"
+
+#define VELOCITY_IO_SIZE       256
 
 #define PKT_BUF_SZ          1540
 
@@ -37,7 +39,6 @@
 #define OPTION_DEFAULT      { [0 ... MAX_UNITS-1] = -1}
 
 #define REV_ID_VT6110       (0)
-#define DEVICE_ID           (0x3119)
 
 #define BYTE_REG_BITS_ON(x,p)       do { writeb(readb((p))|(x),(p));} while (0)
 #define WORD_REG_BITS_ON(x,p)       do { writew(readw((p))|(x),(p));} while (0)
@@ -245,7 +246,7 @@ struct tdesc1 {
 struct td_buf {
        u32 pa_low;
        u16 pa_high;
-       u16 bufsize:14; 
+       u16 bufsize:14;
        u16 reserved:1;
        u16 queue:1;
 } __attribute__ ((__packed__));
@@ -261,25 +262,6 @@ struct velocity_rd_info {
        dma_addr_t skb_dma;
 };
 
-/**
- *     alloc_rd_info           -       allocate an rd info block
- *
- *     Alocate and initialize a receive info structure used for keeping
- *     track of kernel side information related to each receive
- *     descriptor we are using
- */
-
-static inline struct velocity_rd_info *alloc_rd_info(void)
-{
-       struct velocity_rd_info *ptr;
-       if ((ptr = kmalloc(sizeof(struct velocity_rd_info), GFP_ATOMIC)) == NULL)
-               return NULL;
-       else {
-               memset(ptr, 0, sizeof(struct velocity_rd_info));
-               return ptr;
-       }
-}
-
 /*
  *     Used to track transmit side buffers.
  */
@@ -292,10 +274,10 @@ struct velocity_td_info {
        dma_addr_t buf_dma;
 };
 
-enum {
+enum  velocity_owner {
        OWNED_BY_HOST = 0,
        OWNED_BY_NIC = 1
-} velocity_owner;
+};
 
 
 /*
@@ -308,7 +290,7 @@ enum {
 #define TX_QUEUE_NO         4
 
 #define MAX_HW_MIB_COUNTER  32
-#define VELOCITY_MIN_MTU    (1514-14)
+#define VELOCITY_MIN_MTU    (64)
 #define VELOCITY_MAX_MTU    (9000)
 
 /*
@@ -1192,7 +1174,6 @@ enum chip_type {
 struct velocity_info_tbl {
        enum chip_type chip_id;
        char *name;
-       int io_size;
        int txqueue;
        u32 flags;
 };
@@ -1271,7 +1252,7 @@ enum velocity_cam_type {
  *     provided mask buffer.
  */
 
-static inline void mac_get_cam_mask(struct mac_regs * regs, u8 * mask, enum velocity_cam_type cam_type)
+static inline void mac_get_cam_mask(struct mac_regs __iomem * regs, u8 * mask, enum velocity_cam_type cam_type)
 {
        int i;
        /* Select CAM mask */
@@ -1303,7 +1284,7 @@ static inline void mac_get_cam_mask(struct mac_regs * regs, u8 * mask, enum velo
  *     Store a new mask into a CAM
  */
 
-static inline void mac_set_cam_mask(struct mac_regs * regs, u8 * mask, enum velocity_cam_type cam_type)
+static inline void mac_set_cam_mask(struct mac_regs __iomem * regs, u8 * mask, enum velocity_cam_type cam_type)
 {
        int i;
        /* Select CAM mask */
@@ -1320,7 +1301,7 @@ static inline void mac_set_cam_mask(struct mac_regs * regs, u8 * mask, enum velo
        /* disable CAMEN */
        writeb(0, &regs->CAMADDR);
 
-       /* Select CAM mask */
+       /* Select mar */
        BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, &regs->CAMCR);
 }
 
@@ -1334,7 +1315,7 @@ static inline void mac_set_cam_mask(struct mac_regs * regs, u8 * mask, enum velo
  *     Load an address or vlan tag into a CAM
  */
 
-static inline void mac_set_cam(struct mac_regs * regs, int idx, u8 *addr, enum velocity_cam_type cam_type)
+static inline void mac_set_cam(struct mac_regs __iomem * regs, int idx, u8 *addr, enum velocity_cam_type cam_type)
 {
        int i;
 
@@ -1361,7 +1342,7 @@ static inline void mac_set_cam(struct mac_regs * regs, int idx, u8 *addr, enum v
 
        writeb(0, &regs->CAMADDR);
 
-       /* Select CAM mask */
+       /* Select mar */
        BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, &regs->CAMCR);
 }
 
@@ -1376,7 +1357,7 @@ static inline void mac_set_cam(struct mac_regs * regs, int idx, u8 *addr, enum v
  *     the caller. VLAN tags are 2 bytes the address cam entries are 6.
  */
 
-static inline void mac_get_cam(struct mac_regs * regs, int idx, u8 *addr, enum velocity_cam_type cam_type)
+static inline void mac_get_cam(struct mac_regs __iomem * regs, int idx, u8 *addr, enum velocity_cam_type cam_type)
 {
        int i;
 
@@ -1402,7 +1383,7 @@ static inline void mac_get_cam(struct mac_regs * regs, int idx, u8 *addr, enum v
 
        writeb(0, &regs->CAMADDR);
 
-       /* Select CAM mask */
+       /* Select mar */
        BYTE_REG_BITS_SET(CAMCR_PS_MAR, CAMCR_PS1 | CAMCR_PS0, &regs->CAMCR);
 }
 
@@ -1415,7 +1396,7 @@ static inline void mac_get_cam(struct mac_regs * regs, int idx, u8 *addr, enum v
  *     the rest of the logic from the result of sleep/wakeup
  */
 
-inline static void mac_wol_reset(struct mac_regs * regs)
+static inline void mac_wol_reset(struct mac_regs __iomem * regs)
 {
 
        /* Turn off SWPTAG right after leaving power mode */
@@ -1734,17 +1715,12 @@ struct velocity_opt {
 };
 
 struct velocity_info {
-       struct velocity_info *next;
-       struct velocity_info *prev;
+       struct list_head list;
 
        struct pci_dev *pdev;
        struct net_device *dev;
        struct net_device_stats stats;
 
-#if CONFIG_PM
-       u32 pci_state[16];
-#endif
-
        dma_addr_t rd_pool_dma;
        dma_addr_t td_pool_dma[TX_QUEUE_NO];
 
@@ -1754,10 +1730,9 @@ struct velocity_info {
        u8 ip_addr[4];
        enum chip_type chip_id;
 
-       struct mac_regs * mac_regs;
+       struct mac_regs __iomem * mac_regs;
        unsigned long memaddr;
        unsigned long ioaddr;
-       u32 io_size;
 
        u8 rev_id;
 
@@ -1772,7 +1747,8 @@ struct velocity_info {
        struct velocity_td_info *td_infos[TX_QUEUE_NO];
 
        int rd_curr;
-       int rd_used;
+       int rd_dirty;
+       u32 rd_filled;
        struct rx_desc *rd_ring;
        struct velocity_rd_info *rd_info;       /* It's an array */
 
@@ -1793,7 +1769,6 @@ struct velocity_info {
        u8 mCAMmask[(MCAM_SIZE / 8)];
 
        spinlock_t lock;
-       spinlock_t xmit_lock;
 
        int wol_opts;
        u8 wol_passwd[6];
@@ -1817,7 +1792,7 @@ struct velocity_info {
  *     CHECK ME: locking
  */
 
-inline static int velocity_get_ip(struct velocity_info *vptr)
+static inline int velocity_get_ip(struct velocity_info *vptr)
 {
        struct in_device *in_dev = (struct in_device *) vptr->dev->ip_ptr;
        struct in_ifaddr *ifa;
@@ -1867,7 +1842,7 @@ static inline void velocity_update_hw_mibs(struct velocity_info *vptr)
 
 static inline void init_flow_control_register(struct velocity_info *vptr)
 {
-       struct mac_regs * regs = vptr->mac_regs;
+       struct mac_regs __iomem * regs = vptr->mac_regs;
 
        /* Set {XHITH1, XHITH0, XLTH1, XLTH0} in FlowCR1 to {1, 0, 1, 1}
           depend on RD=64, and Turn on XNOEN in FlowCR1 */