|
|
1.1 ! root 1: /******************************************************************************* ! 2: ! 3: Intel(R) 82576 Virtual Function Linux driver ! 4: Copyright(c) 1999 - 2008 Intel Corporation. ! 5: ! 6: This program is free software; you can redistribute it and/or modify it ! 7: under the terms and conditions of the GNU General Public License, ! 8: version 2, as published by the Free Software Foundation. ! 9: ! 10: This program is distributed in the hope it will be useful, but WITHOUT ! 11: ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! 12: FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for ! 13: more details. ! 14: ! 15: You should have received a copy of the GNU General Public License along with ! 16: this program; if not, write to the Free Software Foundation, Inc., ! 17: 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. ! 18: ! 19: The full GNU General Public License is included in this distribution in ! 20: the file called "COPYING". ! 21: ! 22: Contact Information: ! 23: Linux NICS <[email protected]> ! 24: e1000-devel Mailing List <[email protected]> ! 25: Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 ! 26: ! 27: *******************************************************************************/ ! 28: ! 29: FILE_LICENCE ( GPL2_ONLY ); ! 30: ! 31: /* Linux PRO/1000 Ethernet Driver main header file */ ! 32: ! 33: #ifndef _IGBVF_H_ ! 34: #define _IGBVF_H_ ! 35: ! 36: #include "igbvf_vf.h" ! 37: ! 38: /* Forward declarations */ ! 39: struct igbvf_info; ! 40: struct igbvf_adapter; ! 41: ! 42: /* Interrupt defines */ ! 43: #define IGBVF_START_ITR 648 /* ~6000 ints/sec */ ! 44: ! 45: /* Tx/Rx descriptor defines */ ! 46: #define IGBVF_DEFAULT_TXD 256 ! 47: #define IGBVF_MAX_TXD 4096 ! 48: #define IGBVF_MIN_TXD 80 ! 49: ! 50: #define IGBVF_DEFAULT_RXD 256 ! 51: #define IGBVF_MAX_RXD 4096 ! 52: #define IGBVF_MIN_RXD 80 ! 53: ! 54: #define IGBVF_MIN_ITR_USECS 10 /* 100000 irq/sec */ ! 55: #define IGBVF_MAX_ITR_USECS 10000 /* 100 irq/sec */ ! 56: ! 57: /* RX descriptor control thresholds. ! 58: * PTHRESH - MAC will consider prefetch if it has fewer than this number of ! 59: * descriptors available in its onboard memory. ! 60: * Setting this to 0 disables RX descriptor prefetch. ! 61: * HTHRESH - MAC will only prefetch if there are at least this many descriptors ! 62: * available in host memory. ! 63: * If PTHRESH is 0, this should also be 0. ! 64: * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back ! 65: * descriptors until either it has this many to write back, or the ! 66: * ITR timer expires. ! 67: */ ! 68: #define IGBVF_RX_PTHRESH 16 ! 69: #define IGBVF_RX_HTHRESH 8 ! 70: #define IGBVF_RX_WTHRESH 1 ! 71: ! 72: #define IGBVF_TX_PTHRESH 8 ! 73: #define IGBVF_TX_HTHRESH 1 ! 74: #define IGBVF_TX_WTHRESH 1 ! 75: ! 76: /* this is the size past which hardware will drop packets when setting LPE=0 */ ! 77: #define MAXIMUM_ETHERNET_VLAN_SIZE 1522 ! 78: ! 79: #define IGBVF_FC_PAUSE_TIME 0x0680 /* 858 usec */ ! 80: ! 81: /* How many Tx Descriptors do we need to call netif_wake_queue ? */ ! 82: #define IGBVF_TX_QUEUE_WAKE 32 ! 83: /* How many Rx Buffers do we bundle into one write to the hardware ? */ ! 84: #define IGBVF_RX_BUFFER_WRITE 16 /* Must be power of 2 */ ! 85: ! 86: #define AUTO_ALL_MODES 0 ! 87: #define IGBVF_EEPROM_APME 0x0400 ! 88: ! 89: #define IGBVF_MNG_VLAN_NONE (-1) ! 90: ! 91: enum igbvf_boards { ! 92: board_vf, ! 93: }; ! 94: ! 95: struct igbvf_queue_stats { ! 96: u64 packets; ! 97: u64 bytes; ! 98: }; ! 99: ! 100: /* ! 101: * wrappers around a pointer to a socket buffer, ! 102: * so a DMA handle can be stored along with the buffer ! 103: */ ! 104: struct igbvf_buffer { ! 105: #if 0 ! 106: dma_addr_t dma; ! 107: dma_addr_t page_dma; ! 108: struct sk_buff *skb; ! 109: union { ! 110: /* Tx */ ! 111: struct { ! 112: unsigned long time_stamp; ! 113: u16 length; ! 114: u16 next_to_watch; ! 115: }; ! 116: /* Rx */ ! 117: struct { ! 118: struct page *page; ! 119: unsigned int page_offset; ! 120: }; ! 121: }; ! 122: struct page *page; ! 123: #endif ! 124: }; ! 125: ! 126: struct igbvf_ring { ! 127: #if 0 ! 128: struct igbvf_adapter *adapter; /* backlink */ ! 129: void *desc; /* pointer to ring memory */ ! 130: dma_addr_t dma; /* phys address of ring */ ! 131: unsigned int size; /* length of ring in bytes */ ! 132: unsigned int count; /* number of desc. in ring */ ! 133: ! 134: u16 next_to_use; ! 135: u16 next_to_clean; ! 136: ! 137: u16 head; ! 138: u16 tail; ! 139: ! 140: /* array of buffer information structs */ ! 141: struct igbvf_buffer *buffer_info; ! 142: struct napi_struct napi; ! 143: ! 144: char name[IFNAMSIZ + 5]; ! 145: u32 eims_value; ! 146: u32 itr_val; ! 147: u16 itr_register; ! 148: int set_itr; ! 149: ! 150: struct sk_buff *rx_skb_top; ! 151: ! 152: struct igbvf_queue_stats stats; ! 153: #endif ! 154: }; ! 155: ! 156: /* board specific private data structure */ ! 157: struct igbvf_adapter { ! 158: #if 0 ! 159: struct timer_list watchdog_timer; ! 160: struct timer_list blink_timer; ! 161: ! 162: struct work_struct reset_task; ! 163: struct work_struct watchdog_task; ! 164: ! 165: const struct igbvf_info *ei; ! 166: ! 167: struct vlan_group *vlgrp; ! 168: u32 bd_number; ! 169: u32 rx_buffer_len; ! 170: u32 polling_interval; ! 171: u16 mng_vlan_id; ! 172: u16 link_speed; ! 173: u16 link_duplex; ! 174: ! 175: spinlock_t tx_queue_lock; /* prevent concurrent tail updates */ ! 176: ! 177: /* track device up/down/testing state */ ! 178: unsigned long state; ! 179: ! 180: /* Interrupt Throttle Rate */ ! 181: u32 itr; ! 182: u32 itr_setting; ! 183: u16 tx_itr; ! 184: u16 rx_itr; ! 185: ! 186: /* ! 187: * Tx ! 188: */ ! 189: struct igbvf_ring *tx_ring /* One per active queue */ ! 190: ____cacheline_aligned_in_smp; ! 191: ! 192: unsigned long tx_queue_len; ! 193: unsigned int restart_queue; ! 194: u32 txd_cmd; ! 195: ! 196: bool detect_tx_hung; ! 197: u8 tx_timeout_factor; ! 198: ! 199: unsigned int total_tx_bytes; ! 200: unsigned int total_tx_packets; ! 201: unsigned int total_rx_bytes; ! 202: unsigned int total_rx_packets; ! 203: ! 204: /* Tx stats */ ! 205: u32 tx_timeout_count; ! 206: u32 tx_fifo_head; ! 207: u32 tx_head_addr; ! 208: u32 tx_fifo_size; ! 209: u32 tx_dma_failed; ! 210: ! 211: /* ! 212: * Rx ! 213: */ ! 214: struct igbvf_ring *rx_ring; ! 215: ! 216: /* Rx stats */ ! 217: u64 hw_csum_err; ! 218: u64 hw_csum_good; ! 219: u64 rx_hdr_split; ! 220: u32 alloc_rx_buff_failed; ! 221: u32 rx_dma_failed; ! 222: ! 223: unsigned int rx_ps_hdr_size; ! 224: u32 max_frame_size; ! 225: u32 min_frame_size; ! 226: ! 227: /* OS defined structs */ ! 228: struct net_device *netdev; ! 229: struct pci_dev *pdev; ! 230: struct net_device_stats net_stats; ! 231: spinlock_t stats_lock; /* prevent concurrent stats updates */ ! 232: ! 233: /* structs defined in e1000_hw.h */ ! 234: struct e1000_hw hw; ! 235: ! 236: /* The VF counters don't clear on read so we have to get a base ! 237: * count on driver start up and always subtract that base on ! 238: * on the first update, thus the flag.. ! 239: */ ! 240: struct e1000_vf_stats stats; ! 241: u64 zero_base; ! 242: ! 243: struct igbvf_ring test_tx_ring; ! 244: struct igbvf_ring test_rx_ring; ! 245: u32 test_icr; ! 246: ! 247: u32 msg_enable; ! 248: struct msix_entry *msix_entries; ! 249: int int_mode; ! 250: u32 eims_enable_mask; ! 251: u32 eims_other; ! 252: u32 int_counter0; ! 253: u32 int_counter1; ! 254: ! 255: u32 eeprom_wol; ! 256: u32 wol; ! 257: u32 pba; ! 258: ! 259: bool fc_autoneg; ! 260: ! 261: unsigned long led_status; ! 262: ! 263: unsigned int flags; ! 264: unsigned long last_reset; ! 265: u32 *config_space; ! 266: #endif ! 267: /* OS defined structs */ ! 268: struct net_device *netdev; ! 269: struct pci_device *pdev; ! 270: struct net_device_stats net_stats; ! 271: ! 272: /* structs defined in e1000_hw.h */ ! 273: struct e1000_hw hw; ! 274: ! 275: u32 min_frame_size; ! 276: u32 max_frame_size; ! 277: ! 278: u32 max_hw_frame_size; ! 279: ! 280: #define NUM_TX_DESC 8 ! 281: #define NUM_RX_DESC 8 ! 282: ! 283: struct io_buffer *tx_iobuf[NUM_TX_DESC]; ! 284: struct io_buffer *rx_iobuf[NUM_RX_DESC]; ! 285: ! 286: union e1000_adv_tx_desc *tx_base; ! 287: union e1000_adv_rx_desc *rx_base; ! 288: ! 289: uint32_t tx_ring_size; ! 290: uint32_t rx_ring_size; ! 291: ! 292: uint32_t tx_head; ! 293: uint32_t tx_tail; ! 294: uint32_t tx_fill_ctr; ! 295: ! 296: uint32_t rx_curr; ! 297: ! 298: uint32_t ioaddr; ! 299: uint32_t irqno; ! 300: ! 301: uint32_t tx_int_delay; ! 302: uint32_t tx_abs_int_delay; ! 303: uint32_t txd_cmd; ! 304: }; ! 305: ! 306: struct igbvf_info { ! 307: enum e1000_mac_type mac; ! 308: unsigned int flags; ! 309: u32 pba; ! 310: void (*init_ops)(struct e1000_hw *); ! 311: s32 (*get_variants)(struct igbvf_adapter *); ! 312: }; ! 313: ! 314: /* hardware capability, feature, and workaround flags */ ! 315: #define IGBVF_FLAG_RX_CSUM_DISABLED (1 << 0) ! 316: ! 317: #define IGBVF_DESC_UNUSED(R) \ ! 318: ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \ ! 319: (R)->next_to_clean - (R)->next_to_use - 1) ! 320: ! 321: #define IGBVF_RX_DESC_ADV(R, i) \ ! 322: (&(((union e1000_adv_rx_desc *)((R).desc))[i])) ! 323: #define IGBVF_TX_DESC_ADV(R, i) \ ! 324: (&(((union e1000_adv_tx_desc *)((R).desc))[i])) ! 325: #define IGBVF_TX_CTXTDESC_ADV(R, i) \ ! 326: (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i])) ! 327: ! 328: enum igbvf_state_t { ! 329: __IGBVF_TESTING, ! 330: __IGBVF_RESETTING, ! 331: __IGBVF_DOWN ! 332: }; ! 333: ! 334: enum latency_range { ! 335: lowest_latency = 0, ! 336: low_latency = 1, ! 337: bulk_latency = 2, ! 338: latency_invalid = 255 ! 339: }; ! 340: ! 341: extern char igbvf_driver_name[]; ! 342: extern const char igbvf_driver_version[]; ! 343: ! 344: extern void igbvf_check_options(struct igbvf_adapter *adapter); ! 345: extern void igbvf_set_ethtool_ops(struct net_device *netdev); ! 346: #ifdef ETHTOOL_OPS_COMPAT ! 347: extern int ethtool_ioctl(struct ifreq *ifr); ! 348: #endif ! 349: ! 350: extern int igbvf_up(struct igbvf_adapter *adapter); ! 351: extern void igbvf_down(struct igbvf_adapter *adapter); ! 352: extern void igbvf_reinit_locked(struct igbvf_adapter *adapter); ! 353: extern void igbvf_reset(struct igbvf_adapter *adapter); ! 354: extern int igbvf_setup_rx_resources(struct igbvf_adapter *adapter); ! 355: extern int igbvf_setup_tx_resources(struct igbvf_adapter *adapter); ! 356: extern void igbvf_free_rx_resources(struct igbvf_adapter *adapter); ! 357: extern void igbvf_free_tx_resources(struct igbvf_adapter *adapter); ! 358: extern void igbvf_update_stats(struct igbvf_adapter *adapter); ! 359: extern void igbvf_set_interrupt_capability(struct igbvf_adapter *adapter); ! 360: extern void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter); ! 361: ! 362: extern unsigned int copybreak; ! 363: ! 364: static inline u32 __er32(struct e1000_hw *hw, unsigned long reg) ! 365: { ! 366: return readl(hw->hw_addr + reg); ! 367: } ! 368: ! 369: static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val) ! 370: { ! 371: writel(val, hw->hw_addr + reg); ! 372: } ! 373: #define er32(reg) E1000_READ_REG(hw, E1000_##reg) ! 374: #define ew32(reg,val) E1000_WRITE_REG(hw, E1000_##reg, (val)) ! 375: #define e1e_flush() er32(STATUS) ! 376: ! 377: #endif /* _IGBVF_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.