/* * Tehuti Networks(R) Network Driver * Copyright (C) 2007 Tehuti Networks Ltd. All rights reserved * * 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. */ #ifndef _TEHUTI_H #define _TEHUTI_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* Compile Time Switches */ /* start */ #define BDX_TSO #define BDX_LLTX #define BDX_DELAY_WPTR /* #define BDX_MSI */ /* end */ #if !defined CONFIG_PCI_MSI # undef BDX_MSI #endif #define BDX_DEF_MSG_ENABLE (NETIF_MSG_DRV | \ NETIF_MSG_PROBE | \ NETIF_MSG_LINK) /* ioctl ops */ #define BDX_OP_READ 1 #define BDX_OP_WRITE 2 /* RX copy break size */ #define BDX_COPYBREAK 257 #define DRIVER_AUTHOR "Tehuti Networks(R)" #define BDX_DRV_DESC "Tehuti Networks(R) Network Driver" #define BDX_DRV_NAME "tehuti" #define BDX_NIC_NAME "Tehuti 10 Giga TOE SmartNIC" #define BDX_NIC2PORT_NAME "Tehuti 2-Port 10 Giga TOE SmartNIC" #define BDX_DRV_VERSION "7.29.3" #ifdef BDX_MSI # define BDX_MSI_STRING "msi " #else # define BDX_MSI_STRING "" #endif /* netdev tx queue len for Luxor. default value is, btw, 1000 * ifcontig eth1 txqueuelen 3000 - to change it at runtime */ #define BDX_NDEV_TXQ_LEN 3000 #define FIFO_SIZE 4096 #define FIFO_EXTRA_SPACE 1024 #define MIN(x, y) ((x) < (y) ? (x) : (y)) #if BITS_PER_LONG == 64 # define H32_64(x) (u32) ((u64)(x) >> 32) # define L32_64(x) (u32) ((u64)(x) & 0xffffffff) #elif BITS_PER_LONG == 32 # define H32_64(x) 0 # define L32_64(x) ((u32) (x)) #else /* BITS_PER_LONG == ?? */ # error BITS_PER_LONG is undefined. Must be 64 or 32 #endif /* BITS_PER_LONG */ #ifdef __BIG_ENDIAN # define CPU_CHIP_SWAP32(x) swab32(x) # define CPU_CHIP_SWAP16(x) swab16(x) #else # define CPU_CHIP_SWAP32(x) (x) # define CPU_CHIP_SWAP16(x) (x) #endif #define READ_REG(pp, reg) readl(pp->pBdxRegs + reg) #define WRITE_REG(pp, reg, val) writel(val, pp->pBdxRegs + reg) #ifndef DMA_64BIT_MASK # define DMA_64BIT_MASK 0xffffffffffffffffULL #endif #ifndef DMA_32BIT_MASK # define DMA_32BIT_MASK 0x00000000ffffffffULL #endif #ifndef NET_IP_ALIGN # define NET_IP_ALIGN 2 #endif #ifndef NETDEV_TX_OK # define NETDEV_TX_OK 0 #endif #define LUXOR_MAX_PORT 2 #define BDX_MAX_RX_DONE 150 #define BDX_TXF_DESC_SZ 16 #define BDX_MAX_TX_LEVEL (priv->txd_fifo0.m.memsz - 16) #define BDX_MIN_TX_LEVEL 256 #define BDX_NO_UPD_PACKETS 40 struct pci_nic { int port_num; void __iomem *regs; int irq_type; struct bdx_priv *priv[LUXOR_MAX_PORT]; }; enum { IRQ_INTX, IRQ_MSI, IRQ_MSIX }; #define PCK_TH_MULT 128 #define INT_COAL_MULT 2 #define BITS_MASK(nbits) ((1<>nshift)&BITS_MASK(nbits)) #define BITS_SHIFT_MASK(nbits, nshift) (BITS_MASK(nbits)<