tehuti.h
来自「linux 内核源代码」· C头文件 代码 · 共 565 行 · 第 1/2 页
H
565 行
/* * 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 <linux/module.h>#include <linux/kernel.h>#include <linux/netdevice.h>#include <linux/etherdevice.h>#include <linux/pci.h>#include <linux/delay.h>#include <linux/ethtool.h>#include <linux/mii.h>#include <linux/crc32.h>#include <linux/uaccess.h>#include <linux/in.h>#include <linux/ip.h>#include <linux/tcp.h>#include <linux/sched.h>#include <linux/tty.h>#include <linux/if_vlan.h>#include <linux/version.h>#include <linux/interrupt.h>#include <linux/vmalloc.h>#include <asm/byteorder.h>/* 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 40struct 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<<nbits)-1)#define GET_BITS_SHIFT(x, nbits, nshift) (((x)>>nshift)&BITS_MASK(nbits))#define BITS_SHIFT_MASK(nbits, nshift) (BITS_MASK(nbits)<<nshift)#define BITS_SHIFT_VAL(x, nbits, nshift) (((x)&BITS_MASK(nbits))<<nshift)#define BITS_SHIFT_CLEAR(x, nbits, nshift) \ ((x)&(~BITS_SHIFT_MASK(nbits, nshift)))#define GET_INT_COAL(x) GET_BITS_SHIFT(x, 15, 0)#define GET_INT_COAL_RC(x) GET_BITS_SHIFT(x, 1, 15)#define GET_RXF_TH(x) GET_BITS_SHIFT(x, 4, 16)#define GET_PCK_TH(x) GET_BITS_SHIFT(x, 4, 20)#define INT_REG_VAL(coal, coal_rc, rxf_th, pck_th) \ ((coal)|((coal_rc)<<15)|((rxf_th)<<16)|((pck_th)<<20))struct fifo { dma_addr_t da; /* physical address of fifo (used by HW) */ char *va; /* virtual address of fifo (used by SW) */ u32 rptr, wptr; /* cached values of RPTR and WPTR registers, they're 32 bits on both 32 and 64 archs */ u16 reg_CFG0, reg_CFG1; u16 reg_RPTR, reg_WPTR; u16 memsz; /* memory size allocated for fifo */ u16 size_mask; u16 pktsz; /* skb packet size to allocate */ u16 rcvno; /* number of buffers that come from this RXF */};struct txf_fifo { struct fifo m; /* minimal set of variables used by all fifos */};struct txd_fifo { struct fifo m; /* minimal set of variables used by all fifos */};struct rxf_fifo { struct fifo m; /* minimal set of variables used by all fifos */};struct rxd_fifo { struct fifo m; /* minimal set of variables used by all fifos */};struct rx_map { u64 dma; struct sk_buff *skb;};struct rxdb { int *stack; struct rx_map *elems; int nelem; int top;};union bdx_dma_addr { dma_addr_t dma; struct sk_buff *skb;};/* Entry in the db. * if len == 0 addr is dma * if len != 0 addr is skb */struct tx_map { union bdx_dma_addr addr; int len;};/* tx database - implemented as circular fifo buffer*/struct txdb { struct tx_map *start; /* points to the first element */ struct tx_map *end; /* points just AFTER the last element */ struct tx_map *rptr; /* points to the next element to read */ struct tx_map *wptr; /* points to the next element to write */ int size; /* number of elements in the db */};/*Internal stats structure*/struct bdx_stats { u64 InUCast; /* 0x7200 */ u64 InMCast; /* 0x7210 */ u64 InBCast; /* 0x7220 */ u64 InPkts; /* 0x7230 */ u64 InErrors; /* 0x7240 */ u64 InDropped; /* 0x7250 */ u64 FrameTooLong; /* 0x7260 */ u64 FrameSequenceErrors; /* 0x7270 */ u64 InVLAN; /* 0x7280 */ u64 InDroppedDFE; /* 0x7290 */ u64 InDroppedIntFull; /* 0x72A0 */ u64 InFrameAlignErrors; /* 0x72B0 */ /* 0x72C0-0x72E0 RSRV */ u64 OutUCast; /* 0x72F0 */ u64 OutMCast; /* 0x7300 */ u64 OutBCast; /* 0x7310 */ u64 OutPkts; /* 0x7320 */ /* 0x7330-0x7360 RSRV */ u64 OutVLAN; /* 0x7370 */ u64 InUCastOctects; /* 0x7380 */ u64 OutUCastOctects; /* 0x7390 */ /* 0x73A0-0x73B0 RSRV */ u64 InBCastOctects; /* 0x73C0 */ u64 OutBCastOctects; /* 0x73D0 */ u64 InOctects; /* 0x73E0 */ u64 OutOctects; /* 0x73F0 */};struct bdx_priv { void __iomem *pBdxRegs; struct net_device *ndev; struct napi_struct napi; /* RX FIFOs: 1 for data (full) descs, and 2 for free descs */ struct rxd_fifo rxd_fifo0; struct rxf_fifo rxf_fifo0; struct rxdb *rxdb; /* rx dbs to store skb pointers */ int napi_stop; struct vlan_group *vlgrp; /* Tx FIFOs: 1 for data desc, 1 for empty (acks) desc */ struct txd_fifo txd_fifo0; struct txf_fifo txf_fifo0; struct txdb txdb; int tx_level;#ifdef BDX_DELAY_WPTR int tx_update_mark; int tx_noupd;#endif spinlock_t tx_lock; /* NETIF_F_LLTX mode */ /* rarely used */ u8 port; u32 msg_enable; int stats_flag; struct bdx_stats hw_stats; struct net_device_stats net_stats; struct pci_dev *pdev; struct pci_nic *nic;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?