Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1 | /* bnx2x.h: Broadcom Everest network driver. |
| 2 | * |
Eilon Greenstein | d05c26c | 2009-01-17 23:26:13 -0800 | [diff] [blame] | 3 | * Copyright (c) 2007-2009 Broadcom Corporation |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation. |
| 8 | * |
Eilon Greenstein | 24e3fce | 2008-06-12 14:30:28 -0700 | [diff] [blame] | 9 | * Maintained by: Eilon Greenstein <eilong@broadcom.com> |
| 10 | * Written by: Eliezer Tamir |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 11 | * Based on code from Michael Chan's bnx2 driver |
| 12 | */ |
| 13 | |
| 14 | #ifndef BNX2X_H |
| 15 | #define BNX2X_H |
| 16 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 17 | /* compilation time flags */ |
| 18 | |
| 19 | /* define this to make the driver freeze on error to allow getting debug info |
| 20 | * (you will need to reboot afterwards) */ |
| 21 | /* #define BNX2X_STOP_ON_ERROR */ |
| 22 | |
Eilon Greenstein | 0c6671b | 2009-01-14 21:26:51 -0800 | [diff] [blame] | 23 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
| 24 | #define BCM_VLAN 1 |
| 25 | #endif |
| 26 | |
| 27 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 28 | #define BNX2X_MULTI_QUEUE |
| 29 | |
| 30 | #define BNX2X_NEW_NAPI |
| 31 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 32 | /* error/debug prints */ |
| 33 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 34 | #define DRV_MODULE_NAME "bnx2x" |
| 35 | #define PFX DRV_MODULE_NAME ": " |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 36 | |
| 37 | /* for messages that are currently off */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 38 | #define BNX2X_MSG_OFF 0 |
| 39 | #define BNX2X_MSG_MCP 0x010000 /* was: NETIF_MSG_HW */ |
| 40 | #define BNX2X_MSG_STATS 0x020000 /* was: NETIF_MSG_TIMER */ |
| 41 | #define BNX2X_MSG_NVM 0x040000 /* was: NETIF_MSG_HW */ |
| 42 | #define BNX2X_MSG_DMAE 0x080000 /* was: NETIF_MSG_HW */ |
Eliezer Tamir | f141064 | 2008-02-28 11:51:50 -0800 | [diff] [blame] | 43 | #define BNX2X_MSG_SP 0x100000 /* was: NETIF_MSG_INTR */ |
| 44 | #define BNX2X_MSG_FP 0x200000 /* was: NETIF_MSG_INTR */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 45 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 46 | #define DP_LEVEL KERN_NOTICE /* was: KERN_DEBUG */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 47 | |
| 48 | /* regular debug print */ |
| 49 | #define DP(__mask, __fmt, __args...) do { \ |
| 50 | if (bp->msglevel & (__mask)) \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 51 | printk(DP_LEVEL "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ |
Eilon Greenstein | 6378c02 | 2008-08-13 15:59:25 -0700 | [diff] [blame] | 52 | bp->dev ? (bp->dev->name) : "?", ##__args); \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 53 | } while (0) |
| 54 | |
| 55 | /* errors debug print */ |
| 56 | #define BNX2X_DBG_ERR(__fmt, __args...) do { \ |
| 57 | if (bp->msglevel & NETIF_MSG_PROBE) \ |
| 58 | printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ |
Eilon Greenstein | 6378c02 | 2008-08-13 15:59:25 -0700 | [diff] [blame] | 59 | bp->dev ? (bp->dev->name) : "?", ##__args); \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 60 | } while (0) |
| 61 | |
| 62 | /* for errors (never masked) */ |
| 63 | #define BNX2X_ERR(__fmt, __args...) do { \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 64 | printk(KERN_ERR "[%s:%d(%s)]" __fmt, __func__, __LINE__, \ |
Eilon Greenstein | 6378c02 | 2008-08-13 15:59:25 -0700 | [diff] [blame] | 65 | bp->dev ? (bp->dev->name) : "?", ##__args); \ |
Eliezer Tamir | f141064 | 2008-02-28 11:51:50 -0800 | [diff] [blame] | 66 | } while (0) |
| 67 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 68 | /* before we have a dev->name use dev_info() */ |
| 69 | #define BNX2X_DEV_INFO(__fmt, __args...) do { \ |
| 70 | if (bp->msglevel & NETIF_MSG_PROBE) \ |
| 71 | dev_info(&bp->pdev->dev, __fmt, ##__args); \ |
| 72 | } while (0) |
| 73 | |
| 74 | |
| 75 | #ifdef BNX2X_STOP_ON_ERROR |
| 76 | #define bnx2x_panic() do { \ |
| 77 | bp->panic = 1; \ |
| 78 | BNX2X_ERR("driver assert\n"); \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 79 | bnx2x_int_disable(bp); \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 80 | bnx2x_panic_dump(bp); \ |
| 81 | } while (0) |
| 82 | #else |
| 83 | #define bnx2x_panic() do { \ |
| 84 | BNX2X_ERR("driver assert\n"); \ |
| 85 | bnx2x_panic_dump(bp); \ |
| 86 | } while (0) |
| 87 | #endif |
| 88 | |
| 89 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 90 | #define U64_LO(x) (u32)(((u64)(x)) & 0xffffffff) |
| 91 | #define U64_HI(x) (u32)(((u64)(x)) >> 32) |
| 92 | #define HILO_U64(hi, lo) ((((u64)(hi)) << 32) + (lo)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 93 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 94 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 95 | #define REG_ADDR(bp, offset) (bp->regview + offset) |
| 96 | |
| 97 | #define REG_RD(bp, offset) readl(REG_ADDR(bp, offset)) |
| 98 | #define REG_RD8(bp, offset) readb(REG_ADDR(bp, offset)) |
| 99 | #define REG_RD64(bp, offset) readq(REG_ADDR(bp, offset)) |
| 100 | |
| 101 | #define REG_WR(bp, offset, val) writel((u32)val, REG_ADDR(bp, offset)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 102 | #define REG_WR8(bp, offset, val) writeb((u8)val, REG_ADDR(bp, offset)) |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 103 | #define REG_WR16(bp, offset, val) writew((u16)val, REG_ADDR(bp, offset)) |
| 104 | #define REG_WR32(bp, offset, val) REG_WR(bp, offset, val) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 105 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 106 | #define REG_RD_IND(bp, offset) bnx2x_reg_rd_ind(bp, offset) |
| 107 | #define REG_WR_IND(bp, offset, val) bnx2x_reg_wr_ind(bp, offset, val) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 108 | |
Yaniv Rosner | c18487e | 2008-06-23 20:27:52 -0700 | [diff] [blame] | 109 | #define REG_RD_DMAE(bp, offset, valp, len32) \ |
| 110 | do { \ |
| 111 | bnx2x_read_dmae(bp, offset, len32);\ |
| 112 | memcpy(valp, bnx2x_sp(bp, wb_data[0]), len32 * 4); \ |
| 113 | } while (0) |
| 114 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 115 | #define REG_WR_DMAE(bp, offset, valp, len32) \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 116 | do { \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 117 | memcpy(bnx2x_sp(bp, wb_data[0]), valp, len32 * 4); \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 118 | bnx2x_write_dmae(bp, bnx2x_sp_mapping(bp, wb_data), \ |
| 119 | offset, len32); \ |
| 120 | } while (0) |
| 121 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 122 | #define SHMEM_ADDR(bp, field) (bp->common.shmem_base + \ |
| 123 | offsetof(struct shmem_region, field)) |
| 124 | #define SHMEM_RD(bp, field) REG_RD(bp, SHMEM_ADDR(bp, field)) |
| 125 | #define SHMEM_WR(bp, field, val) REG_WR(bp, SHMEM_ADDR(bp, field), val) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 126 | |
Eilon Greenstein | 345b5d5 | 2008-08-13 15:58:12 -0700 | [diff] [blame] | 127 | #define EMAC_RD(bp, reg) REG_RD(bp, emac_base + reg) |
Eilon Greenstein | 3196a88 | 2008-08-13 15:58:49 -0700 | [diff] [blame] | 128 | #define EMAC_WR(bp, reg, val) REG_WR(bp, emac_base + reg, val) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 129 | |
| 130 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 131 | /* fast path */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 132 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 133 | struct sw_rx_bd { |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 134 | struct sk_buff *skb; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 135 | DECLARE_PCI_UNMAP_ADDR(mapping) |
| 136 | }; |
| 137 | |
| 138 | struct sw_tx_bd { |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 139 | struct sk_buff *skb; |
| 140 | u16 first_bd; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 141 | }; |
| 142 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 143 | struct sw_rx_page { |
| 144 | struct page *page; |
| 145 | DECLARE_PCI_UNMAP_ADDR(mapping) |
| 146 | }; |
| 147 | |
| 148 | |
| 149 | /* MC hsi */ |
| 150 | #define BCM_PAGE_SHIFT 12 |
| 151 | #define BCM_PAGE_SIZE (1 << BCM_PAGE_SHIFT) |
| 152 | #define BCM_PAGE_MASK (~(BCM_PAGE_SIZE - 1)) |
| 153 | #define BCM_PAGE_ALIGN(addr) (((addr) + BCM_PAGE_SIZE - 1) & BCM_PAGE_MASK) |
| 154 | |
| 155 | #define PAGES_PER_SGE_SHIFT 0 |
| 156 | #define PAGES_PER_SGE (1 << PAGES_PER_SGE_SHIFT) |
Eilon Greenstein | 4f40f2c | 2009-01-14 21:24:17 -0800 | [diff] [blame] | 157 | #define SGE_PAGE_SIZE PAGE_SIZE |
| 158 | #define SGE_PAGE_SHIFT PAGE_SHIFT |
| 159 | #define SGE_PAGE_ALIGN(addr) PAGE_ALIGN(addr) |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 160 | |
| 161 | /* SGE ring related macros */ |
| 162 | #define NUM_RX_SGE_PAGES 2 |
| 163 | #define RX_SGE_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge)) |
| 164 | #define MAX_RX_SGE_CNT (RX_SGE_CNT - 2) |
Eilon Greenstein | 3347162 | 2008-08-13 15:59:08 -0700 | [diff] [blame] | 165 | /* RX_SGE_CNT is promised to be a power of 2 */ |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 166 | #define RX_SGE_MASK (RX_SGE_CNT - 1) |
| 167 | #define NUM_RX_SGE (RX_SGE_CNT * NUM_RX_SGE_PAGES) |
| 168 | #define MAX_RX_SGE (NUM_RX_SGE - 1) |
| 169 | #define NEXT_SGE_IDX(x) ((((x) & RX_SGE_MASK) == \ |
| 170 | (MAX_RX_SGE_CNT - 1)) ? (x) + 3 : (x) + 1) |
| 171 | #define RX_SGE(x) ((x) & MAX_RX_SGE) |
| 172 | |
| 173 | /* SGE producer mask related macros */ |
| 174 | /* Number of bits in one sge_mask array element */ |
| 175 | #define RX_SGE_MASK_ELEM_SZ 64 |
| 176 | #define RX_SGE_MASK_ELEM_SHIFT 6 |
| 177 | #define RX_SGE_MASK_ELEM_MASK ((u64)RX_SGE_MASK_ELEM_SZ - 1) |
| 178 | |
| 179 | /* Creates a bitmask of all ones in less significant bits. |
| 180 | idx - index of the most significant bit in the created mask */ |
| 181 | #define RX_SGE_ONES_MASK(idx) \ |
| 182 | (((u64)0x1 << (((idx) & RX_SGE_MASK_ELEM_MASK) + 1)) - 1) |
| 183 | #define RX_SGE_MASK_ELEM_ONE_MASK ((u64)(~0)) |
| 184 | |
| 185 | /* Number of u64 elements in SGE mask array */ |
| 186 | #define RX_SGE_MASK_LEN ((NUM_RX_SGE_PAGES * RX_SGE_CNT) / \ |
| 187 | RX_SGE_MASK_ELEM_SZ) |
| 188 | #define RX_SGE_MASK_LEN_MASK (RX_SGE_MASK_LEN - 1) |
| 189 | #define NEXT_SGE_MASK_ELEM(el) (((el) + 1) & RX_SGE_MASK_LEN_MASK) |
| 190 | |
| 191 | |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 192 | struct bnx2x_eth_q_stats { |
| 193 | u32 total_bytes_received_hi; |
| 194 | u32 total_bytes_received_lo; |
| 195 | u32 total_bytes_transmitted_hi; |
| 196 | u32 total_bytes_transmitted_lo; |
| 197 | u32 total_unicast_packets_received_hi; |
| 198 | u32 total_unicast_packets_received_lo; |
| 199 | u32 total_multicast_packets_received_hi; |
| 200 | u32 total_multicast_packets_received_lo; |
| 201 | u32 total_broadcast_packets_received_hi; |
| 202 | u32 total_broadcast_packets_received_lo; |
| 203 | u32 total_unicast_packets_transmitted_hi; |
| 204 | u32 total_unicast_packets_transmitted_lo; |
| 205 | u32 total_multicast_packets_transmitted_hi; |
| 206 | u32 total_multicast_packets_transmitted_lo; |
| 207 | u32 total_broadcast_packets_transmitted_hi; |
| 208 | u32 total_broadcast_packets_transmitted_lo; |
| 209 | u32 valid_bytes_received_hi; |
| 210 | u32 valid_bytes_received_lo; |
| 211 | |
| 212 | u32 error_bytes_received_hi; |
| 213 | u32 error_bytes_received_lo; |
| 214 | u32 etherstatsoverrsizepkts_hi; |
| 215 | u32 etherstatsoverrsizepkts_lo; |
| 216 | u32 no_buff_discard_hi; |
| 217 | u32 no_buff_discard_lo; |
| 218 | |
| 219 | u32 driver_xoff; |
| 220 | u32 rx_err_discard_pkt; |
| 221 | u32 rx_skb_alloc_failed; |
| 222 | u32 hw_csum_err; |
| 223 | }; |
| 224 | |
| 225 | #define BNX2X_NUM_Q_STATS 11 |
| 226 | #define Q_STATS_OFFSET32(stat_name) \ |
| 227 | (offsetof(struct bnx2x_eth_q_stats, stat_name) / 4) |
| 228 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 229 | struct bnx2x_fastpath { |
| 230 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 231 | struct napi_struct napi; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 232 | |
| 233 | struct host_status_block *status_blk; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 234 | dma_addr_t status_blk_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 235 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 236 | struct eth_tx_db_data *hw_tx_prods; |
| 237 | dma_addr_t tx_prods_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 238 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 239 | struct sw_tx_bd *tx_buf_ring; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 240 | |
| 241 | struct eth_tx_bd *tx_desc_ring; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 242 | dma_addr_t tx_desc_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 243 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 244 | struct sw_rx_bd *rx_buf_ring; /* BDs mappings ring */ |
| 245 | struct sw_rx_page *rx_page_ring; /* SGE pages mappings ring */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 246 | |
| 247 | struct eth_rx_bd *rx_desc_ring; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 248 | dma_addr_t rx_desc_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 249 | |
| 250 | union eth_rx_cqe *rx_comp_ring; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 251 | dma_addr_t rx_comp_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 252 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 253 | /* SGE ring */ |
| 254 | struct eth_rx_sge *rx_sge_ring; |
| 255 | dma_addr_t rx_sge_mapping; |
| 256 | |
| 257 | u64 sge_mask[RX_SGE_MASK_LEN]; |
| 258 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 259 | int state; |
| 260 | #define BNX2X_FP_STATE_CLOSED 0 |
| 261 | #define BNX2X_FP_STATE_IRQ 0x80000 |
| 262 | #define BNX2X_FP_STATE_OPENING 0x90000 |
| 263 | #define BNX2X_FP_STATE_OPEN 0xa0000 |
| 264 | #define BNX2X_FP_STATE_HALTING 0xb0000 |
| 265 | #define BNX2X_FP_STATE_HALTED 0xc0000 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 266 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 267 | u8 index; /* number in fp array */ |
| 268 | u8 cl_id; /* eth client id */ |
| 269 | u8 sb_id; /* status block number in HW */ |
| 270 | #define FP_IDX(fp) (fp->index) |
| 271 | #define FP_CL_ID(fp) (fp->cl_id) |
| 272 | #define BP_CL_ID(bp) (bp->fp[0].cl_id) |
| 273 | #define FP_SB_ID(fp) (fp->sb_id) |
| 274 | #define CNIC_SB_ID 0 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 275 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 276 | u16 tx_pkt_prod; |
| 277 | u16 tx_pkt_cons; |
| 278 | u16 tx_bd_prod; |
| 279 | u16 tx_bd_cons; |
| 280 | u16 *tx_cons_sb; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 281 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 282 | u16 fp_c_idx; |
| 283 | u16 fp_u_idx; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 284 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 285 | u16 rx_bd_prod; |
| 286 | u16 rx_bd_cons; |
| 287 | u16 rx_comp_prod; |
| 288 | u16 rx_comp_cons; |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 289 | u16 rx_sge_prod; |
| 290 | /* The last maximal completed SGE */ |
| 291 | u16 last_max_sge; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 292 | u16 *rx_cons_sb; |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 293 | u16 *rx_bd_cons_sb; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 294 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 295 | unsigned long tx_pkt, |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 296 | rx_pkt, |
Yitchak Gertner | 66e855f | 2008-08-13 15:49:05 -0700 | [diff] [blame] | 297 | rx_calls; |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 298 | /* TPA related */ |
| 299 | struct sw_rx_bd tpa_pool[ETH_MAX_AGGREGATION_QUEUES_E1H]; |
| 300 | u8 tpa_state[ETH_MAX_AGGREGATION_QUEUES_E1H]; |
| 301 | #define BNX2X_TPA_START 1 |
| 302 | #define BNX2X_TPA_STOP 2 |
| 303 | u8 disable_tpa; |
| 304 | #ifdef BNX2X_STOP_ON_ERROR |
| 305 | u64 tpa_queue_used; |
| 306 | #endif |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 307 | |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 308 | struct tstorm_per_client_stats old_tclient; |
| 309 | struct ustorm_per_client_stats old_uclient; |
| 310 | struct xstorm_per_client_stats old_xclient; |
| 311 | struct bnx2x_eth_q_stats eth_q_stats; |
| 312 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 313 | char name[IFNAMSIZ]; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 314 | struct bnx2x *bp; /* parent */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 315 | }; |
| 316 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 317 | #define bnx2x_fp(bp, nr, var) (bp->fp[nr].var) |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 318 | |
Eilon Greenstein | 237907c | 2009-01-14 06:42:44 +0000 | [diff] [blame] | 319 | #define BNX2X_HAS_WORK(fp) (bnx2x_has_rx_work(fp) || bnx2x_has_tx_work(fp)) |
Vladislav Zolotarov | da5a662 | 2008-08-13 15:50:00 -0700 | [diff] [blame] | 320 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 321 | |
| 322 | /* MC hsi */ |
| 323 | #define MAX_FETCH_BD 13 /* HW max BDs per packet */ |
| 324 | #define RX_COPY_THRESH 92 |
| 325 | |
| 326 | #define NUM_TX_RINGS 16 |
| 327 | #define TX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_tx_bd)) |
| 328 | #define MAX_TX_DESC_CNT (TX_DESC_CNT - 1) |
| 329 | #define NUM_TX_BD (TX_DESC_CNT * NUM_TX_RINGS) |
| 330 | #define MAX_TX_BD (NUM_TX_BD - 1) |
| 331 | #define MAX_TX_AVAIL (MAX_TX_DESC_CNT * NUM_TX_RINGS - 2) |
| 332 | #define NEXT_TX_IDX(x) ((((x) & MAX_TX_DESC_CNT) == \ |
| 333 | (MAX_TX_DESC_CNT - 1)) ? (x) + 2 : (x) + 1) |
| 334 | #define TX_BD(x) ((x) & MAX_TX_BD) |
| 335 | #define TX_BD_POFF(x) ((x) & MAX_TX_DESC_CNT) |
| 336 | |
| 337 | /* The RX BD ring is special, each bd is 8 bytes but the last one is 16 */ |
| 338 | #define NUM_RX_RINGS 8 |
| 339 | #define RX_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_rx_bd)) |
| 340 | #define MAX_RX_DESC_CNT (RX_DESC_CNT - 2) |
| 341 | #define RX_DESC_MASK (RX_DESC_CNT - 1) |
| 342 | #define NUM_RX_BD (RX_DESC_CNT * NUM_RX_RINGS) |
| 343 | #define MAX_RX_BD (NUM_RX_BD - 1) |
| 344 | #define MAX_RX_AVAIL (MAX_RX_DESC_CNT * NUM_RX_RINGS - 2) |
| 345 | #define NEXT_RX_IDX(x) ((((x) & RX_DESC_MASK) == \ |
| 346 | (MAX_RX_DESC_CNT - 1)) ? (x) + 3 : (x) + 1) |
| 347 | #define RX_BD(x) ((x) & MAX_RX_BD) |
| 348 | |
| 349 | /* As long as CQE is 4 times bigger than BD entry we have to allocate |
| 350 | 4 times more pages for CQ ring in order to keep it balanced with |
| 351 | BD ring */ |
| 352 | #define NUM_RCQ_RINGS (NUM_RX_RINGS * 4) |
| 353 | #define RCQ_DESC_CNT (BCM_PAGE_SIZE / sizeof(union eth_rx_cqe)) |
| 354 | #define MAX_RCQ_DESC_CNT (RCQ_DESC_CNT - 1) |
| 355 | #define NUM_RCQ_BD (RCQ_DESC_CNT * NUM_RCQ_RINGS) |
| 356 | #define MAX_RCQ_BD (NUM_RCQ_BD - 1) |
| 357 | #define MAX_RCQ_AVAIL (MAX_RCQ_DESC_CNT * NUM_RCQ_RINGS - 2) |
| 358 | #define NEXT_RCQ_IDX(x) ((((x) & MAX_RCQ_DESC_CNT) == \ |
| 359 | (MAX_RCQ_DESC_CNT - 1)) ? (x) + 2 : (x) + 1) |
| 360 | #define RCQ_BD(x) ((x) & MAX_RCQ_BD) |
| 361 | |
| 362 | |
Eilon Greenstein | 3347162 | 2008-08-13 15:59:08 -0700 | [diff] [blame] | 363 | /* This is needed for determining of last_max */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 364 | #define SUB_S16(a, b) (s16)((s16)(a) - (s16)(b)) |
| 365 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 366 | #define __SGE_MASK_SET_BIT(el, bit) \ |
| 367 | do { \ |
| 368 | el = ((el) | ((u64)0x1 << (bit))); \ |
| 369 | } while (0) |
| 370 | |
| 371 | #define __SGE_MASK_CLEAR_BIT(el, bit) \ |
| 372 | do { \ |
| 373 | el = ((el) & (~((u64)0x1 << (bit)))); \ |
| 374 | } while (0) |
| 375 | |
| 376 | #define SGE_MASK_SET_BIT(fp, idx) \ |
| 377 | __SGE_MASK_SET_BIT(fp->sge_mask[(idx) >> RX_SGE_MASK_ELEM_SHIFT], \ |
| 378 | ((idx) & RX_SGE_MASK_ELEM_MASK)) |
| 379 | |
| 380 | #define SGE_MASK_CLEAR_BIT(fp, idx) \ |
| 381 | __SGE_MASK_CLEAR_BIT(fp->sge_mask[(idx) >> RX_SGE_MASK_ELEM_SHIFT], \ |
| 382 | ((idx) & RX_SGE_MASK_ELEM_MASK)) |
| 383 | |
| 384 | |
| 385 | /* used on a CID received from the HW */ |
| 386 | #define SW_CID(x) (le32_to_cpu(x) & \ |
| 387 | (COMMON_RAMROD_ETH_RX_CQE_CID >> 7)) |
| 388 | #define CQE_CMD(x) (le32_to_cpu(x) >> \ |
| 389 | COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT) |
| 390 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 391 | #define BD_UNMAP_ADDR(bd) HILO_U64(le32_to_cpu((bd)->addr_hi), \ |
| 392 | le32_to_cpu((bd)->addr_lo)) |
| 393 | #define BD_UNMAP_LEN(bd) (le16_to_cpu((bd)->nbytes)) |
| 394 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 395 | |
| 396 | #define DPM_TRIGER_TYPE 0x40 |
| 397 | #define DOORBELL(bp, cid, val) \ |
| 398 | do { \ |
| 399 | writel((u32)val, (bp)->doorbells + (BCM_PAGE_SIZE * cid) + \ |
| 400 | DPM_TRIGER_TYPE); \ |
| 401 | } while (0) |
| 402 | |
| 403 | |
| 404 | /* TX CSUM helpers */ |
| 405 | #define SKB_CS_OFF(skb) (offsetof(struct tcphdr, check) - \ |
| 406 | skb->csum_offset) |
| 407 | #define SKB_CS(skb) (*(u16 *)(skb_transport_header(skb) + \ |
| 408 | skb->csum_offset)) |
| 409 | |
| 410 | #define pbd_tcp_flags(skb) (ntohl(tcp_flag_word(tcp_hdr(skb)))>>16 & 0xff) |
| 411 | |
| 412 | #define XMIT_PLAIN 0 |
| 413 | #define XMIT_CSUM_V4 0x1 |
| 414 | #define XMIT_CSUM_V6 0x2 |
| 415 | #define XMIT_CSUM_TCP 0x4 |
| 416 | #define XMIT_GSO_V4 0x8 |
| 417 | #define XMIT_GSO_V6 0x10 |
| 418 | |
| 419 | #define XMIT_CSUM (XMIT_CSUM_V4 | XMIT_CSUM_V6) |
| 420 | #define XMIT_GSO (XMIT_GSO_V4 | XMIT_GSO_V6) |
| 421 | |
| 422 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 423 | /* stuff added to make the code fit 80Col */ |
| 424 | |
| 425 | #define CQE_TYPE(cqe_fp_flags) ((cqe_fp_flags) & ETH_FAST_PATH_RX_CQE_TYPE) |
| 426 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 427 | #define TPA_TYPE_START ETH_FAST_PATH_RX_CQE_START_FLG |
| 428 | #define TPA_TYPE_END ETH_FAST_PATH_RX_CQE_END_FLG |
| 429 | #define TPA_TYPE(cqe_fp_flags) ((cqe_fp_flags) & \ |
| 430 | (TPA_TYPE_START | TPA_TYPE_END)) |
| 431 | |
Eilon Greenstein | 1adcd8b | 2008-08-13 15:48:29 -0700 | [diff] [blame] | 432 | #define ETH_RX_ERROR_FALGS ETH_FAST_PATH_RX_CQE_PHY_DECODE_ERR_FLG |
| 433 | |
| 434 | #define BNX2X_IP_CSUM_ERR(cqe) \ |
| 435 | (!((cqe)->fast_path_cqe.status_flags & \ |
| 436 | ETH_FAST_PATH_RX_CQE_IP_XSUM_NO_VALIDATION_FLG) && \ |
| 437 | ((cqe)->fast_path_cqe.type_error_flags & \ |
| 438 | ETH_FAST_PATH_RX_CQE_IP_BAD_XSUM_FLG)) |
| 439 | |
| 440 | #define BNX2X_L4_CSUM_ERR(cqe) \ |
| 441 | (!((cqe)->fast_path_cqe.status_flags & \ |
| 442 | ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG) && \ |
| 443 | ((cqe)->fast_path_cqe.type_error_flags & \ |
| 444 | ETH_FAST_PATH_RX_CQE_L4_BAD_XSUM_FLG)) |
| 445 | |
| 446 | #define BNX2X_RX_CSUM_OK(cqe) \ |
| 447 | (!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe))) |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 448 | |
| 449 | #define BNX2X_RX_SUM_FIX(cqe) \ |
| 450 | ((le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & \ |
| 451 | PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == \ |
| 452 | (1 << PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT)) |
| 453 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 454 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 455 | #define FP_USB_FUNC_OFF (2 + 2*HC_USTORM_SB_NUM_INDICES) |
| 456 | #define FP_CSB_FUNC_OFF (2 + 2*HC_CSTORM_SB_NUM_INDICES) |
| 457 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 458 | #define U_SB_ETH_RX_CQ_INDEX HC_INDEX_U_ETH_RX_CQ_CONS |
| 459 | #define U_SB_ETH_RX_BD_INDEX HC_INDEX_U_ETH_RX_BD_CONS |
| 460 | #define C_SB_ETH_TX_CQ_INDEX HC_INDEX_C_ETH_TX_CQ_CONS |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 461 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 462 | #define BNX2X_RX_SB_INDEX \ |
| 463 | (&fp->status_blk->u_status_block.index_values[U_SB_ETH_RX_CQ_INDEX]) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 464 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 465 | #define BNX2X_RX_SB_BD_INDEX \ |
| 466 | (&fp->status_blk->u_status_block.index_values[U_SB_ETH_RX_BD_INDEX]) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 467 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 468 | #define BNX2X_RX_SB_INDEX_NUM \ |
| 469 | (((U_SB_ETH_RX_CQ_INDEX << \ |
| 470 | USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER_SHIFT) & \ |
| 471 | USTORM_ETH_ST_CONTEXT_CONFIG_CQE_SB_INDEX_NUMBER) | \ |
| 472 | ((U_SB_ETH_RX_BD_INDEX << \ |
| 473 | USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER_SHIFT) & \ |
| 474 | USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 475 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 476 | #define BNX2X_TX_SB_INDEX \ |
| 477 | (&fp->status_blk->c_status_block.index_values[C_SB_ETH_TX_CQ_INDEX]) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 478 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 479 | |
| 480 | /* end of fast path */ |
| 481 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 482 | /* common */ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 483 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 484 | struct bnx2x_common { |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 485 | |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 486 | u32 chip_id; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 487 | /* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 488 | #define CHIP_ID(bp) (bp->common.chip_id & 0xfffffff0) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 489 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 490 | #define CHIP_NUM(bp) (bp->common.chip_id >> 16) |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 491 | #define CHIP_NUM_57710 0x164e |
| 492 | #define CHIP_NUM_57711 0x164f |
| 493 | #define CHIP_NUM_57711E 0x1650 |
| 494 | #define CHIP_IS_E1(bp) (CHIP_NUM(bp) == CHIP_NUM_57710) |
| 495 | #define CHIP_IS_57711(bp) (CHIP_NUM(bp) == CHIP_NUM_57711) |
| 496 | #define CHIP_IS_57711E(bp) (CHIP_NUM(bp) == CHIP_NUM_57711E) |
| 497 | #define CHIP_IS_E1H(bp) (CHIP_IS_57711(bp) || \ |
| 498 | CHIP_IS_57711E(bp)) |
| 499 | #define IS_E1H_OFFSET CHIP_IS_E1H(bp) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 500 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 501 | #define CHIP_REV(bp) (bp->common.chip_id & 0x0000f000) |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 502 | #define CHIP_REV_Ax 0x00000000 |
| 503 | /* assume maximum 5 revisions */ |
| 504 | #define CHIP_REV_IS_SLOW(bp) (CHIP_REV(bp) > 0x00005000) |
| 505 | /* Emul versions are A=>0xe, B=>0xc, C=>0xa, D=>8, E=>6 */ |
| 506 | #define CHIP_REV_IS_EMUL(bp) ((CHIP_REV_IS_SLOW(bp)) && \ |
| 507 | !(CHIP_REV(bp) & 0x00001000)) |
| 508 | /* FPGA versions are A=>0xf, B=>0xd, C=>0xb, D=>9, E=>7 */ |
| 509 | #define CHIP_REV_IS_FPGA(bp) ((CHIP_REV_IS_SLOW(bp)) && \ |
| 510 | (CHIP_REV(bp) & 0x00001000)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 511 | |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 512 | #define CHIP_TIME(bp) ((CHIP_REV_IS_EMUL(bp)) ? 2000 : \ |
| 513 | ((CHIP_REV_IS_FPGA(bp)) ? 200 : 1)) |
| 514 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 515 | #define CHIP_METAL(bp) (bp->common.chip_id & 0x00000ff0) |
| 516 | #define CHIP_BOND_ID(bp) (bp->common.chip_id & 0x0000000f) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 517 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 518 | int flash_size; |
| 519 | #define NVRAM_1MB_SIZE 0x20000 /* 1M bit in bytes */ |
| 520 | #define NVRAM_TIMEOUT_COUNT 30000 |
| 521 | #define NVRAM_PAGE_SIZE 256 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 522 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 523 | u32 shmem_base; |
| 524 | |
| 525 | u32 hw_config; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 526 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 527 | u32 bc_ver; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | |
| 531 | /* end of common */ |
| 532 | |
| 533 | /* port */ |
| 534 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 535 | struct nig_stats { |
| 536 | u32 brb_discard; |
| 537 | u32 brb_packet; |
| 538 | u32 brb_truncate; |
| 539 | u32 flow_ctrl_discard; |
| 540 | u32 flow_ctrl_octets; |
| 541 | u32 flow_ctrl_packet; |
| 542 | u32 mng_discard; |
| 543 | u32 mng_octet_inp; |
| 544 | u32 mng_octet_out; |
| 545 | u32 mng_packet_inp; |
| 546 | u32 mng_packet_out; |
| 547 | u32 pbf_octets; |
| 548 | u32 pbf_packet; |
| 549 | u32 safc_inp; |
| 550 | u32 egress_mac_pkt0_lo; |
| 551 | u32 egress_mac_pkt0_hi; |
| 552 | u32 egress_mac_pkt1_lo; |
| 553 | u32 egress_mac_pkt1_hi; |
| 554 | }; |
| 555 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 556 | struct bnx2x_port { |
| 557 | u32 pmf; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 558 | |
Yaniv Rosner | c18487e | 2008-06-23 20:27:52 -0700 | [diff] [blame] | 559 | u32 link_config; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 560 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 561 | u32 supported; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 562 | /* link settings - missing defines */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 563 | #define SUPPORTED_2500baseX_Full (1 << 15) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 564 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 565 | u32 advertising; |
| 566 | /* link settings - missing defines */ |
| 567 | #define ADVERTISED_2500baseX_Full (1 << 15) |
| 568 | |
| 569 | u32 phy_addr; |
Yaniv Rosner | c18487e | 2008-06-23 20:27:52 -0700 | [diff] [blame] | 570 | |
| 571 | /* used to synchronize phy accesses */ |
| 572 | struct mutex phy_mutex; |
| 573 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 574 | u32 port_stx; |
| 575 | |
| 576 | struct nig_stats old_nig_stats; |
| 577 | }; |
| 578 | |
| 579 | /* end of port */ |
| 580 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 581 | |
| 582 | enum bnx2x_stats_event { |
| 583 | STATS_EVENT_PMF = 0, |
| 584 | STATS_EVENT_LINK_UP, |
| 585 | STATS_EVENT_UPDATE, |
| 586 | STATS_EVENT_STOP, |
| 587 | STATS_EVENT_MAX |
| 588 | }; |
| 589 | |
| 590 | enum bnx2x_stats_state { |
| 591 | STATS_STATE_DISABLED = 0, |
| 592 | STATS_STATE_ENABLED, |
| 593 | STATS_STATE_MAX |
| 594 | }; |
| 595 | |
| 596 | struct bnx2x_eth_stats { |
| 597 | u32 total_bytes_received_hi; |
| 598 | u32 total_bytes_received_lo; |
| 599 | u32 total_bytes_transmitted_hi; |
| 600 | u32 total_bytes_transmitted_lo; |
| 601 | u32 total_unicast_packets_received_hi; |
| 602 | u32 total_unicast_packets_received_lo; |
| 603 | u32 total_multicast_packets_received_hi; |
| 604 | u32 total_multicast_packets_received_lo; |
| 605 | u32 total_broadcast_packets_received_hi; |
| 606 | u32 total_broadcast_packets_received_lo; |
| 607 | u32 total_unicast_packets_transmitted_hi; |
| 608 | u32 total_unicast_packets_transmitted_lo; |
| 609 | u32 total_multicast_packets_transmitted_hi; |
| 610 | u32 total_multicast_packets_transmitted_lo; |
| 611 | u32 total_broadcast_packets_transmitted_hi; |
| 612 | u32 total_broadcast_packets_transmitted_lo; |
| 613 | u32 valid_bytes_received_hi; |
| 614 | u32 valid_bytes_received_lo; |
| 615 | |
| 616 | u32 error_bytes_received_hi; |
| 617 | u32 error_bytes_received_lo; |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 618 | u32 etherstatsoverrsizepkts_hi; |
| 619 | u32 etherstatsoverrsizepkts_lo; |
| 620 | u32 no_buff_discard_hi; |
| 621 | u32 no_buff_discard_lo; |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 622 | |
| 623 | u32 rx_stat_ifhcinbadoctets_hi; |
| 624 | u32 rx_stat_ifhcinbadoctets_lo; |
| 625 | u32 tx_stat_ifhcoutbadoctets_hi; |
| 626 | u32 tx_stat_ifhcoutbadoctets_lo; |
| 627 | u32 rx_stat_dot3statsfcserrors_hi; |
| 628 | u32 rx_stat_dot3statsfcserrors_lo; |
| 629 | u32 rx_stat_dot3statsalignmenterrors_hi; |
| 630 | u32 rx_stat_dot3statsalignmenterrors_lo; |
| 631 | u32 rx_stat_dot3statscarriersenseerrors_hi; |
| 632 | u32 rx_stat_dot3statscarriersenseerrors_lo; |
| 633 | u32 rx_stat_falsecarriererrors_hi; |
| 634 | u32 rx_stat_falsecarriererrors_lo; |
| 635 | u32 rx_stat_etherstatsundersizepkts_hi; |
| 636 | u32 rx_stat_etherstatsundersizepkts_lo; |
| 637 | u32 rx_stat_dot3statsframestoolong_hi; |
| 638 | u32 rx_stat_dot3statsframestoolong_lo; |
| 639 | u32 rx_stat_etherstatsfragments_hi; |
| 640 | u32 rx_stat_etherstatsfragments_lo; |
| 641 | u32 rx_stat_etherstatsjabbers_hi; |
| 642 | u32 rx_stat_etherstatsjabbers_lo; |
| 643 | u32 rx_stat_maccontrolframesreceived_hi; |
| 644 | u32 rx_stat_maccontrolframesreceived_lo; |
| 645 | u32 rx_stat_bmac_xpf_hi; |
| 646 | u32 rx_stat_bmac_xpf_lo; |
| 647 | u32 rx_stat_bmac_xcf_hi; |
| 648 | u32 rx_stat_bmac_xcf_lo; |
| 649 | u32 rx_stat_xoffstateentered_hi; |
| 650 | u32 rx_stat_xoffstateentered_lo; |
| 651 | u32 rx_stat_xonpauseframesreceived_hi; |
| 652 | u32 rx_stat_xonpauseframesreceived_lo; |
| 653 | u32 rx_stat_xoffpauseframesreceived_hi; |
| 654 | u32 rx_stat_xoffpauseframesreceived_lo; |
| 655 | u32 tx_stat_outxonsent_hi; |
| 656 | u32 tx_stat_outxonsent_lo; |
| 657 | u32 tx_stat_outxoffsent_hi; |
| 658 | u32 tx_stat_outxoffsent_lo; |
| 659 | u32 tx_stat_flowcontroldone_hi; |
| 660 | u32 tx_stat_flowcontroldone_lo; |
| 661 | u32 tx_stat_etherstatscollisions_hi; |
| 662 | u32 tx_stat_etherstatscollisions_lo; |
| 663 | u32 tx_stat_dot3statssinglecollisionframes_hi; |
| 664 | u32 tx_stat_dot3statssinglecollisionframes_lo; |
| 665 | u32 tx_stat_dot3statsmultiplecollisionframes_hi; |
| 666 | u32 tx_stat_dot3statsmultiplecollisionframes_lo; |
| 667 | u32 tx_stat_dot3statsdeferredtransmissions_hi; |
| 668 | u32 tx_stat_dot3statsdeferredtransmissions_lo; |
| 669 | u32 tx_stat_dot3statsexcessivecollisions_hi; |
| 670 | u32 tx_stat_dot3statsexcessivecollisions_lo; |
| 671 | u32 tx_stat_dot3statslatecollisions_hi; |
| 672 | u32 tx_stat_dot3statslatecollisions_lo; |
| 673 | u32 tx_stat_etherstatspkts64octets_hi; |
| 674 | u32 tx_stat_etherstatspkts64octets_lo; |
| 675 | u32 tx_stat_etherstatspkts65octetsto127octets_hi; |
| 676 | u32 tx_stat_etherstatspkts65octetsto127octets_lo; |
| 677 | u32 tx_stat_etherstatspkts128octetsto255octets_hi; |
| 678 | u32 tx_stat_etherstatspkts128octetsto255octets_lo; |
| 679 | u32 tx_stat_etherstatspkts256octetsto511octets_hi; |
| 680 | u32 tx_stat_etherstatspkts256octetsto511octets_lo; |
| 681 | u32 tx_stat_etherstatspkts512octetsto1023octets_hi; |
| 682 | u32 tx_stat_etherstatspkts512octetsto1023octets_lo; |
| 683 | u32 tx_stat_etherstatspkts1024octetsto1522octets_hi; |
| 684 | u32 tx_stat_etherstatspkts1024octetsto1522octets_lo; |
| 685 | u32 tx_stat_etherstatspktsover1522octets_hi; |
| 686 | u32 tx_stat_etherstatspktsover1522octets_lo; |
| 687 | u32 tx_stat_bmac_2047_hi; |
| 688 | u32 tx_stat_bmac_2047_lo; |
| 689 | u32 tx_stat_bmac_4095_hi; |
| 690 | u32 tx_stat_bmac_4095_lo; |
| 691 | u32 tx_stat_bmac_9216_hi; |
| 692 | u32 tx_stat_bmac_9216_lo; |
| 693 | u32 tx_stat_bmac_16383_hi; |
| 694 | u32 tx_stat_bmac_16383_lo; |
| 695 | u32 tx_stat_dot3statsinternalmactransmiterrors_hi; |
| 696 | u32 tx_stat_dot3statsinternalmactransmiterrors_lo; |
| 697 | u32 tx_stat_bmac_ufl_hi; |
| 698 | u32 tx_stat_bmac_ufl_lo; |
| 699 | |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 700 | u32 pause_frames_received_hi; |
| 701 | u32 pause_frames_received_lo; |
| 702 | u32 pause_frames_sent_hi; |
| 703 | u32 pause_frames_sent_lo; |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 704 | |
| 705 | u32 etherstatspkts1024octetsto1522octets_hi; |
| 706 | u32 etherstatspkts1024octetsto1522octets_lo; |
| 707 | u32 etherstatspktsover1522octets_hi; |
| 708 | u32 etherstatspktsover1522octets_lo; |
| 709 | |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 710 | u32 brb_drop_hi; |
| 711 | u32 brb_drop_lo; |
| 712 | u32 brb_truncate_hi; |
| 713 | u32 brb_truncate_lo; |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 714 | |
| 715 | u32 mac_filter_discard; |
| 716 | u32 xxoverflow_discard; |
| 717 | u32 brb_truncate_discard; |
| 718 | u32 mac_discard; |
| 719 | |
| 720 | u32 driver_xoff; |
Yitchak Gertner | 66e855f | 2008-08-13 15:49:05 -0700 | [diff] [blame] | 721 | u32 rx_err_discard_pkt; |
| 722 | u32 rx_skb_alloc_failed; |
| 723 | u32 hw_csum_err; |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 724 | |
| 725 | u32 nig_timer_max; |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 726 | }; |
| 727 | |
Eilon Greenstein | de832a5 | 2009-02-12 08:36:33 +0000 | [diff] [blame] | 728 | #define BNX2X_NUM_STATS 41 |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 729 | #define STATS_OFFSET32(stat_name) \ |
| 730 | (offsetof(struct bnx2x_eth_stats, stat_name) / 4) |
| 731 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 732 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 733 | #define MAX_CONTEXT 16 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 734 | |
| 735 | union cdu_context { |
| 736 | struct eth_context eth; |
| 737 | char pad[1024]; |
| 738 | }; |
| 739 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 740 | #define MAX_DMAE_C 8 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 741 | |
| 742 | /* DMA memory not used in fastpath */ |
| 743 | struct bnx2x_slowpath { |
| 744 | union cdu_context context[MAX_CONTEXT]; |
| 745 | struct eth_stats_query fw_stats; |
| 746 | struct mac_configuration_cmd mac_config; |
| 747 | struct mac_configuration_cmd mcast_config; |
| 748 | |
| 749 | /* used by dmae command executer */ |
| 750 | struct dmae_command dmae[MAX_DMAE_C]; |
| 751 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 752 | u32 stats_comp; |
| 753 | union mac_stats mac_stats; |
| 754 | struct nig_stats nig_stats; |
| 755 | struct host_port_stats port_stats; |
| 756 | struct host_func_stats func_stats; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 757 | |
| 758 | u32 wb_comp; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 759 | u32 wb_data[4]; |
| 760 | }; |
| 761 | |
| 762 | #define bnx2x_sp(bp, var) (&bp->slowpath->var) |
| 763 | #define bnx2x_sp_mapping(bp, var) \ |
| 764 | (bp->slowpath_mapping + offsetof(struct bnx2x_slowpath, var)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 765 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 766 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 767 | /* attn group wiring */ |
| 768 | #define MAX_DYNAMIC_ATTN_GRPS 8 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 769 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 770 | struct attn_route { |
| 771 | u32 sig[4]; |
| 772 | }; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 773 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 774 | struct bnx2x { |
| 775 | /* Fields used in the tx and intr/napi performance paths |
| 776 | * are grouped together in the beginning of the structure |
| 777 | */ |
| 778 | struct bnx2x_fastpath fp[MAX_CONTEXT]; |
| 779 | void __iomem *regview; |
| 780 | void __iomem *doorbells; |
Eilon Greenstein | a5f67a04 | 2009-01-14 21:28:13 -0800 | [diff] [blame] | 781 | #define BNX2X_DB_SIZE (16*BCM_PAGE_SIZE) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 782 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 783 | struct net_device *dev; |
| 784 | struct pci_dev *pdev; |
| 785 | |
| 786 | atomic_t intr_sem; |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 787 | struct msix_entry msix_table[MAX_CONTEXT+1]; |
Eilon Greenstein | 8badd27 | 2009-02-12 08:36:15 +0000 | [diff] [blame] | 788 | #define INT_MODE_INTx 1 |
| 789 | #define INT_MODE_MSI 2 |
| 790 | #define INT_MODE_MSIX 3 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 791 | |
| 792 | int tx_ring_size; |
| 793 | |
| 794 | #ifdef BCM_VLAN |
| 795 | struct vlan_group *vlgrp; |
| 796 | #endif |
| 797 | |
| 798 | u32 rx_csum; |
Eilon Greenstein | 437cf2f | 2008-09-03 14:38:00 -0700 | [diff] [blame] | 799 | u32 rx_buf_size; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 800 | #define ETH_OVREHEAD (ETH_HLEN + 8) /* 8 for CRC + VLAN */ |
| 801 | #define ETH_MIN_PACKET_SIZE 60 |
| 802 | #define ETH_MAX_PACKET_SIZE 1500 |
| 803 | #define ETH_MAX_JUMBO_PACKET_SIZE 9600 |
| 804 | |
Eilon Greenstein | 0f00846 | 2009-02-12 08:36:18 +0000 | [diff] [blame] | 805 | /* Max supported alignment is 256 (8 shift) */ |
| 806 | #define BNX2X_RX_ALIGN_SHIFT ((L1_CACHE_SHIFT < 8) ? \ |
| 807 | L1_CACHE_SHIFT : 8) |
| 808 | #define BNX2X_RX_ALIGN (1 << BNX2X_RX_ALIGN_SHIFT) |
| 809 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 810 | struct host_def_status_block *def_status_blk; |
| 811 | #define DEF_SB_ID 16 |
| 812 | u16 def_c_idx; |
| 813 | u16 def_u_idx; |
| 814 | u16 def_x_idx; |
| 815 | u16 def_t_idx; |
| 816 | u16 def_att_idx; |
| 817 | u32 attn_state; |
| 818 | struct attn_route attn_group[MAX_DYNAMIC_ATTN_GRPS]; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 819 | |
| 820 | /* slow path ring */ |
| 821 | struct eth_spe *spq; |
| 822 | dma_addr_t spq_mapping; |
| 823 | u16 spq_prod_idx; |
| 824 | struct eth_spe *spq_prod_bd; |
| 825 | struct eth_spe *spq_last_bd; |
| 826 | u16 *dsb_sp_prod; |
| 827 | u16 spq_left; /* serialize spq */ |
| 828 | /* used to synchronize spq accesses */ |
| 829 | spinlock_t spq_lock; |
| 830 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 831 | /* Flags for marking that there is a STAT_QUERY or |
| 832 | SET_MAC ramrod pending */ |
| 833 | u8 stats_pending; |
| 834 | u8 set_mac_pending; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 835 | |
Eilon Greenstein | 3347162 | 2008-08-13 15:59:08 -0700 | [diff] [blame] | 836 | /* End of fields used in the performance code paths */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 837 | |
| 838 | int panic; |
| 839 | int msglevel; |
| 840 | |
| 841 | u32 flags; |
| 842 | #define PCIX_FLAG 1 |
| 843 | #define PCI_32BIT_FLAG 2 |
Eilon Greenstein | 1c06328 | 2009-02-12 08:36:43 +0000 | [diff] [blame] | 844 | #define ONE_PORT_FLAG 4 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 845 | #define NO_WOL_FLAG 8 |
| 846 | #define USING_DAC_FLAG 0x10 |
| 847 | #define USING_MSIX_FLAG 0x20 |
Eilon Greenstein | 8badd27 | 2009-02-12 08:36:15 +0000 | [diff] [blame] | 848 | #define USING_MSI_FLAG 0x40 |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 849 | #define TPA_ENABLE_FLAG 0x80 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 850 | #define NO_MCP_FLAG 0x100 |
| 851 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) |
Eilon Greenstein | 0c6671b | 2009-01-14 21:26:51 -0800 | [diff] [blame] | 852 | #define HW_VLAN_TX_FLAG 0x400 |
| 853 | #define HW_VLAN_RX_FLAG 0x800 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 854 | |
| 855 | int func; |
| 856 | #define BP_PORT(bp) (bp->func % PORT_MAX) |
| 857 | #define BP_FUNC(bp) (bp->func) |
| 858 | #define BP_E1HVN(bp) (bp->func >> 1) |
| 859 | #define BP_L_ID(bp) (BP_E1HVN(bp) << 2) |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 860 | |
| 861 | int pm_cap; |
| 862 | int pcie_cap; |
| 863 | |
Eilon Greenstein | 1cf167f | 2009-01-14 21:22:18 -0800 | [diff] [blame] | 864 | struct delayed_work sp_task; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 865 | struct work_struct reset_task; |
| 866 | |
| 867 | struct timer_list timer; |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 868 | int current_interval; |
| 869 | |
| 870 | u16 fw_seq; |
| 871 | u16 fw_drv_pulse_wr_seq; |
| 872 | u32 func_stx; |
| 873 | |
| 874 | struct link_params link_params; |
| 875 | struct link_vars link_vars; |
| 876 | |
| 877 | struct bnx2x_common common; |
| 878 | struct bnx2x_port port; |
| 879 | |
Eilon Greenstein | 8a1c38d | 2009-02-12 08:36:40 +0000 | [diff] [blame] | 880 | struct cmng_struct_per_port cmng; |
| 881 | u32 vn_weight_sum; |
| 882 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 883 | u32 mf_config; |
| 884 | u16 e1hov; |
| 885 | u8 e1hmf; |
Eilon Greenstein | 3196a88 | 2008-08-13 15:58:49 -0700 | [diff] [blame] | 886 | #define IS_E1HMF(bp) (bp->e1hmf != 0) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 887 | |
Eliezer Tamir | f141064 | 2008-02-28 11:51:50 -0800 | [diff] [blame] | 888 | u8 wol; |
| 889 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 890 | int rx_ring_size; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 891 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 892 | u16 tx_quick_cons_trip_int; |
| 893 | u16 tx_quick_cons_trip; |
| 894 | u16 tx_ticks_int; |
| 895 | u16 tx_ticks; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 896 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 897 | u16 rx_quick_cons_trip_int; |
| 898 | u16 rx_quick_cons_trip; |
| 899 | u16 rx_ticks_int; |
| 900 | u16 rx_ticks; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 901 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 902 | u32 lin_cnt; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 903 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 904 | int state; |
| 905 | #define BNX2X_STATE_CLOSED 0x0 |
| 906 | #define BNX2X_STATE_OPENING_WAIT4_LOAD 0x1000 |
| 907 | #define BNX2X_STATE_OPENING_WAIT4_PORT 0x2000 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 908 | #define BNX2X_STATE_OPEN 0x3000 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 909 | #define BNX2X_STATE_CLOSING_WAIT4_HALT 0x4000 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 910 | #define BNX2X_STATE_CLOSING_WAIT4_DELETE 0x5000 |
| 911 | #define BNX2X_STATE_CLOSING_WAIT4_UNLOAD 0x6000 |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 912 | #define BNX2X_STATE_DISABLED 0xd000 |
| 913 | #define BNX2X_STATE_DIAG 0xe000 |
| 914 | #define BNX2X_STATE_ERROR 0xf000 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 915 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 916 | int multi_mode; |
| 917 | int num_rx_queues; |
| 918 | int num_tx_queues; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 919 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 920 | u32 rx_mode; |
| 921 | #define BNX2X_RX_MODE_NONE 0 |
| 922 | #define BNX2X_RX_MODE_NORMAL 1 |
| 923 | #define BNX2X_RX_MODE_ALLMULTI 2 |
| 924 | #define BNX2X_RX_MODE_PROMISC 3 |
| 925 | #define BNX2X_MAX_MULTICAST 64 |
| 926 | #define BNX2X_MAX_EMUL_MULTI 16 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 927 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 928 | dma_addr_t def_status_blk_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 929 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 930 | struct bnx2x_slowpath *slowpath; |
| 931 | dma_addr_t slowpath_mapping; |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 932 | |
| 933 | #ifdef BCM_ISCSI |
| 934 | void *t1; |
| 935 | dma_addr_t t1_mapping; |
| 936 | void *t2; |
| 937 | dma_addr_t t2_mapping; |
| 938 | void *timers; |
| 939 | dma_addr_t timers_mapping; |
| 940 | void *qm; |
| 941 | dma_addr_t qm_mapping; |
| 942 | #endif |
| 943 | |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 944 | int dmae_ready; |
| 945 | /* used to synchronize dmae accesses */ |
| 946 | struct mutex dmae_mutex; |
| 947 | struct dmae_command init_dmae; |
| 948 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 949 | /* used to synchronize stats collecting */ |
| 950 | int stats_state; |
| 951 | /* used by dmae command loader */ |
| 952 | struct dmae_command stats_dmae; |
| 953 | int executer_idx; |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 954 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 955 | u16 stats_counter; |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 956 | struct bnx2x_eth_stats eth_stats; |
| 957 | |
| 958 | struct z_stream_s *strm; |
| 959 | void *gunzip_buf; |
| 960 | dma_addr_t gunzip_mapping; |
| 961 | int gunzip_outlen; |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 962 | #define FW_BUF_SIZE 0x8000 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 963 | |
| 964 | }; |
| 965 | |
| 966 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 967 | #define BNX2X_MAX_QUEUES(bp) (IS_E1HMF(bp) ? (MAX_CONTEXT / E1HVN_MAX) : \ |
| 968 | MAX_CONTEXT) |
| 969 | #define BNX2X_NUM_QUEUES(bp) max(bp->num_rx_queues, bp->num_tx_queues) |
| 970 | #define is_multi(bp) (BNX2X_NUM_QUEUES(bp) > 1) |
Eilon Greenstein | 3196a88 | 2008-08-13 15:58:49 -0700 | [diff] [blame] | 971 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 972 | #define for_each_rx_queue(bp, var) \ |
| 973 | for (var = 0; var < bp->num_rx_queues; var++) |
| 974 | #define for_each_tx_queue(bp, var) \ |
| 975 | for (var = 0; var < bp->num_tx_queues; var++) |
| 976 | #define for_each_queue(bp, var) \ |
| 977 | for (var = 0; var < BNX2X_NUM_QUEUES(bp); var++) |
Eilon Greenstein | 3196a88 | 2008-08-13 15:58:49 -0700 | [diff] [blame] | 978 | #define for_each_nondefault_queue(bp, var) \ |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 979 | for (var = 1; var < BNX2X_NUM_QUEUES(bp); var++) |
Eilon Greenstein | 3196a88 | 2008-08-13 15:58:49 -0700 | [diff] [blame] | 980 | |
| 981 | |
Yaniv Rosner | c18487e | 2008-06-23 20:27:52 -0700 | [diff] [blame] | 982 | void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32); |
| 983 | void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr, |
| 984 | u32 len32); |
Eilon Greenstein | 4acac6a | 2009-02-12 08:36:52 +0000 | [diff] [blame] | 985 | int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port); |
Eilon Greenstein | 17de50b | 2008-08-13 15:56:59 -0700 | [diff] [blame] | 986 | int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port); |
Eilon Greenstein | 4acac6a | 2009-02-12 08:36:52 +0000 | [diff] [blame] | 987 | int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port); |
Yaniv Rosner | c18487e | 2008-06-23 20:27:52 -0700 | [diff] [blame] | 988 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 989 | static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, |
| 990 | int wait) |
| 991 | { |
| 992 | u32 val; |
| 993 | |
| 994 | do { |
| 995 | val = REG_RD(bp, reg); |
| 996 | if (val == expected) |
| 997 | break; |
| 998 | ms -= wait; |
| 999 | msleep(wait); |
| 1000 | |
| 1001 | } while (ms > 0); |
| 1002 | |
| 1003 | return val; |
| 1004 | } |
| 1005 | |
| 1006 | |
| 1007 | /* load/unload mode */ |
| 1008 | #define LOAD_NORMAL 0 |
| 1009 | #define LOAD_OPEN 1 |
| 1010 | #define LOAD_DIAG 2 |
| 1011 | #define UNLOAD_NORMAL 0 |
| 1012 | #define UNLOAD_CLOSE 1 |
| 1013 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 1014 | |
Eilon Greenstein | ad8d394 | 2008-06-23 20:29:02 -0700 | [diff] [blame] | 1015 | /* DMAE command defines */ |
| 1016 | #define DMAE_CMD_SRC_PCI 0 |
| 1017 | #define DMAE_CMD_SRC_GRC DMAE_COMMAND_SRC |
| 1018 | |
| 1019 | #define DMAE_CMD_DST_PCI (1 << DMAE_COMMAND_DST_SHIFT) |
| 1020 | #define DMAE_CMD_DST_GRC (2 << DMAE_COMMAND_DST_SHIFT) |
| 1021 | |
| 1022 | #define DMAE_CMD_C_DST_PCI 0 |
| 1023 | #define DMAE_CMD_C_DST_GRC (1 << DMAE_COMMAND_C_DST_SHIFT) |
| 1024 | |
| 1025 | #define DMAE_CMD_C_ENABLE DMAE_COMMAND_C_TYPE_ENABLE |
| 1026 | |
| 1027 | #define DMAE_CMD_ENDIANITY_NO_SWAP (0 << DMAE_COMMAND_ENDIANITY_SHIFT) |
| 1028 | #define DMAE_CMD_ENDIANITY_B_SWAP (1 << DMAE_COMMAND_ENDIANITY_SHIFT) |
| 1029 | #define DMAE_CMD_ENDIANITY_DW_SWAP (2 << DMAE_COMMAND_ENDIANITY_SHIFT) |
| 1030 | #define DMAE_CMD_ENDIANITY_B_DW_SWAP (3 << DMAE_COMMAND_ENDIANITY_SHIFT) |
| 1031 | |
| 1032 | #define DMAE_CMD_PORT_0 0 |
| 1033 | #define DMAE_CMD_PORT_1 DMAE_COMMAND_PORT |
| 1034 | |
| 1035 | #define DMAE_CMD_SRC_RESET DMAE_COMMAND_SRC_RESET |
| 1036 | #define DMAE_CMD_DST_RESET DMAE_COMMAND_DST_RESET |
| 1037 | #define DMAE_CMD_E1HVN_SHIFT DMAE_COMMAND_E1HVN_SHIFT |
| 1038 | |
| 1039 | #define DMAE_LEN32_RD_MAX 0x80 |
| 1040 | #define DMAE_LEN32_WR_MAX 0x400 |
| 1041 | |
| 1042 | #define DMAE_COMP_VAL 0xe0d0d0ae |
| 1043 | |
| 1044 | #define MAX_DMAE_C_PER_PORT 8 |
| 1045 | #define INIT_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \ |
| 1046 | BP_E1HVN(bp)) |
| 1047 | #define PMF_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \ |
| 1048 | E1HVN_MAX) |
| 1049 | |
| 1050 | |
Eliezer Tamir | 2504795 | 2008-02-28 11:50:16 -0800 | [diff] [blame] | 1051 | /* PCIE link and speed */ |
| 1052 | #define PCICFG_LINK_WIDTH 0x1f00000 |
| 1053 | #define PCICFG_LINK_WIDTH_SHIFT 20 |
| 1054 | #define PCICFG_LINK_SPEED 0xf0000 |
| 1055 | #define PCICFG_LINK_SPEED_SHIFT 16 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1056 | |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 1057 | |
Eilon Greenstein | d3d4f49 | 2009-02-12 08:36:27 +0000 | [diff] [blame] | 1058 | #define BNX2X_NUM_TESTS 7 |
Yitchak Gertner | bb2a0f7 | 2008-06-23 20:33:36 -0700 | [diff] [blame] | 1059 | |
| 1060 | #define BNX2X_MAC_LOOPBACK 0 |
| 1061 | #define BNX2X_PHY_LOOPBACK 1 |
| 1062 | #define BNX2X_MAC_LOOPBACK_FAILED 1 |
| 1063 | #define BNX2X_PHY_LOOPBACK_FAILED 2 |
| 1064 | #define BNX2X_LOOPBACK_FAILED (BNX2X_MAC_LOOPBACK_FAILED | \ |
| 1065 | BNX2X_PHY_LOOPBACK_FAILED) |
Eliezer Tamir | 96fc178 | 2008-02-28 11:57:55 -0800 | [diff] [blame] | 1066 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 1067 | |
| 1068 | #define STROM_ASSERT_ARRAY_SIZE 50 |
| 1069 | |
Eliezer Tamir | 96fc178 | 2008-02-28 11:57:55 -0800 | [diff] [blame] | 1070 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1071 | /* must be used on a CID before placing it on a HW ring */ |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 1072 | #define HW_CID(bp, x) ((BP_PORT(bp) << 23) | (BP_E1HVN(bp) << 17) | x) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1073 | |
Vladislav Zolotarov | 7a9b255 | 2008-06-23 20:34:36 -0700 | [diff] [blame] | 1074 | #define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe)) |
| 1075 | #define MAX_SP_DESC_CNT (SP_DESC_CNT - 1) |
| 1076 | |
| 1077 | |
| 1078 | #define BNX2X_BTR 3 |
| 1079 | #define MAX_SPQ_PENDING 8 |
| 1080 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1081 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1082 | /* CMNG constants |
| 1083 | derived from lab experiments, and not from system spec calculations !!! */ |
| 1084 | #define DEF_MIN_RATE 100 |
| 1085 | /* resolution of the rate shaping timer - 100 usec */ |
| 1086 | #define RS_PERIODIC_TIMEOUT_USEC 100 |
| 1087 | /* resolution of fairness algorithm in usecs - |
Eilon Greenstein | 3347162 | 2008-08-13 15:59:08 -0700 | [diff] [blame] | 1088 | coefficient for calculating the actual t fair */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1089 | #define T_FAIR_COEF 10000000 |
| 1090 | /* number of bytes in single QM arbitration cycle - |
Eilon Greenstein | 3347162 | 2008-08-13 15:59:08 -0700 | [diff] [blame] | 1091 | coefficient for calculating the fairness timer */ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1092 | #define QM_ARB_BYTES 40000 |
| 1093 | #define FAIR_MEM 2 |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1094 | |
| 1095 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1096 | #define ATTN_NIG_FOR_FUNC (1L << 8) |
| 1097 | #define ATTN_SW_TIMER_4_FUNC (1L << 9) |
| 1098 | #define GPIO_2_FUNC (1L << 10) |
| 1099 | #define GPIO_3_FUNC (1L << 11) |
| 1100 | #define GPIO_4_FUNC (1L << 12) |
| 1101 | #define ATTN_GENERAL_ATTN_1 (1L << 13) |
| 1102 | #define ATTN_GENERAL_ATTN_2 (1L << 14) |
| 1103 | #define ATTN_GENERAL_ATTN_3 (1L << 15) |
| 1104 | #define ATTN_GENERAL_ATTN_4 (1L << 13) |
| 1105 | #define ATTN_GENERAL_ATTN_5 (1L << 14) |
| 1106 | #define ATTN_GENERAL_ATTN_6 (1L << 15) |
| 1107 | |
| 1108 | #define ATTN_HARD_WIRED_MASK 0xff00 |
| 1109 | #define ATTENTION_ID 4 |
| 1110 | |
| 1111 | |
| 1112 | /* stuff added to make the code fit 80Col */ |
| 1113 | |
| 1114 | #define BNX2X_PMF_LINK_ASSERT \ |
| 1115 | GENERAL_ATTEN_OFFSET(LINK_SYNC_ATTENTION_BIT_FUNC_0 + BP_FUNC(bp)) |
| 1116 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1117 | #define BNX2X_MC_ASSERT_BITS \ |
| 1118 | (GENERAL_ATTEN_OFFSET(TSTORM_FATAL_ASSERT_ATTENTION_BIT) | \ |
| 1119 | GENERAL_ATTEN_OFFSET(USTORM_FATAL_ASSERT_ATTENTION_BIT) | \ |
| 1120 | GENERAL_ATTEN_OFFSET(CSTORM_FATAL_ASSERT_ATTENTION_BIT) | \ |
| 1121 | GENERAL_ATTEN_OFFSET(XSTORM_FATAL_ASSERT_ATTENTION_BIT)) |
| 1122 | |
| 1123 | #define BNX2X_MCP_ASSERT \ |
| 1124 | GENERAL_ATTEN_OFFSET(MCP_FATAL_ASSERT_ATTENTION_BIT) |
| 1125 | |
| 1126 | #define BNX2X_DOORQ_ASSERT \ |
| 1127 | AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT |
| 1128 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1129 | #define BNX2X_GRC_TIMEOUT GENERAL_ATTEN_OFFSET(LATCHED_ATTN_TIMEOUT_GRC) |
| 1130 | #define BNX2X_GRC_RSV (GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCR) | \ |
| 1131 | GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCT) | \ |
| 1132 | GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCN) | \ |
| 1133 | GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCU) | \ |
| 1134 | GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCP) | \ |
| 1135 | GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RSVD_GRC)) |
| 1136 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1137 | #define HW_INTERRUT_ASSERT_SET_0 \ |
| 1138 | (AEU_INPUTS_ATTN_BITS_TSDM_HW_INTERRUPT | \ |
| 1139 | AEU_INPUTS_ATTN_BITS_TCM_HW_INTERRUPT | \ |
| 1140 | AEU_INPUTS_ATTN_BITS_TSEMI_HW_INTERRUPT | \ |
| 1141 | AEU_INPUTS_ATTN_BITS_PBF_HW_INTERRUPT) |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1142 | #define HW_PRTY_ASSERT_SET_0 (AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR | \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1143 | AEU_INPUTS_ATTN_BITS_PARSER_PARITY_ERROR | \ |
| 1144 | AEU_INPUTS_ATTN_BITS_TSDM_PARITY_ERROR | \ |
| 1145 | AEU_INPUTS_ATTN_BITS_SEARCHER_PARITY_ERROR |\ |
| 1146 | AEU_INPUTS_ATTN_BITS_TSEMI_PARITY_ERROR) |
| 1147 | #define HW_INTERRUT_ASSERT_SET_1 \ |
| 1148 | (AEU_INPUTS_ATTN_BITS_QM_HW_INTERRUPT | \ |
| 1149 | AEU_INPUTS_ATTN_BITS_TIMERS_HW_INTERRUPT | \ |
| 1150 | AEU_INPUTS_ATTN_BITS_XSDM_HW_INTERRUPT | \ |
| 1151 | AEU_INPUTS_ATTN_BITS_XCM_HW_INTERRUPT | \ |
| 1152 | AEU_INPUTS_ATTN_BITS_XSEMI_HW_INTERRUPT | \ |
| 1153 | AEU_INPUTS_ATTN_BITS_USDM_HW_INTERRUPT | \ |
| 1154 | AEU_INPUTS_ATTN_BITS_UCM_HW_INTERRUPT | \ |
| 1155 | AEU_INPUTS_ATTN_BITS_USEMI_HW_INTERRUPT | \ |
| 1156 | AEU_INPUTS_ATTN_BITS_UPB_HW_INTERRUPT | \ |
| 1157 | AEU_INPUTS_ATTN_BITS_CSDM_HW_INTERRUPT | \ |
| 1158 | AEU_INPUTS_ATTN_BITS_CCM_HW_INTERRUPT) |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1159 | #define HW_PRTY_ASSERT_SET_1 (AEU_INPUTS_ATTN_BITS_PBCLIENT_PARITY_ERROR |\ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1160 | AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR | \ |
| 1161 | AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR | \ |
| 1162 | AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR | \ |
| 1163 | AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR |\ |
| 1164 | AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR |\ |
| 1165 | AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR | \ |
| 1166 | AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR | \ |
| 1167 | AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR | \ |
| 1168 | AEU_INPUTS_ATTN_BITS_UPB_PARITY_ERROR | \ |
| 1169 | AEU_INPUTS_ATTN_BITS_CSDM_PARITY_ERROR) |
| 1170 | #define HW_INTERRUT_ASSERT_SET_2 \ |
| 1171 | (AEU_INPUTS_ATTN_BITS_CSEMI_HW_INTERRUPT | \ |
| 1172 | AEU_INPUTS_ATTN_BITS_CDU_HW_INTERRUPT | \ |
| 1173 | AEU_INPUTS_ATTN_BITS_DMAE_HW_INTERRUPT | \ |
| 1174 | AEU_INPUTS_ATTN_BITS_PXPPCICLOCKCLIENT_HW_INTERRUPT |\ |
| 1175 | AEU_INPUTS_ATTN_BITS_MISC_HW_INTERRUPT) |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1176 | #define HW_PRTY_ASSERT_SET_2 (AEU_INPUTS_ATTN_BITS_CSEMI_PARITY_ERROR | \ |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1177 | AEU_INPUTS_ATTN_BITS_PXP_PARITY_ERROR | \ |
| 1178 | AEU_INPUTS_ATTN_BITS_PXPPCICLOCKCLIENT_PARITY_ERROR |\ |
| 1179 | AEU_INPUTS_ATTN_BITS_CFC_PARITY_ERROR | \ |
| 1180 | AEU_INPUTS_ATTN_BITS_CDU_PARITY_ERROR | \ |
| 1181 | AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR | \ |
| 1182 | AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR) |
| 1183 | |
| 1184 | |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 1185 | #define MULTI_FLAGS(bp) \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1186 | (TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \ |
| 1187 | TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \ |
| 1188 | TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \ |
| 1189 | TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \ |
Eilon Greenstein | 555f6c7 | 2009-02-12 08:36:11 +0000 | [diff] [blame] | 1190 | (bp->multi_mode << \ |
| 1191 | TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT)) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1192 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1193 | #define MULTI_MASK 0x7f |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1194 | |
| 1195 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1196 | #define DEF_USB_FUNC_OFF (2 + 2*HC_USTORM_DEF_SB_NUM_INDICES) |
| 1197 | #define DEF_CSB_FUNC_OFF (2 + 2*HC_CSTORM_DEF_SB_NUM_INDICES) |
| 1198 | #define DEF_XSB_FUNC_OFF (2 + 2*HC_XSTORM_DEF_SB_NUM_INDICES) |
| 1199 | #define DEF_TSB_FUNC_OFF (2 + 2*HC_TSTORM_DEF_SB_NUM_INDICES) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1200 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1201 | #define C_DEF_SB_SP_INDEX HC_INDEX_DEF_C_ETH_SLOW_PATH |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1202 | |
| 1203 | #define BNX2X_SP_DSB_INDEX \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1204 | (&bp->def_status_blk->c_def_status_block.index_values[C_DEF_SB_SP_INDEX]) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1205 | |
| 1206 | |
| 1207 | #define CAM_IS_INVALID(x) \ |
| 1208 | (x.target_table_entry.flags == TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE) |
| 1209 | |
| 1210 | #define CAM_INVALIDATE(x) \ |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1211 | (x.target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE) |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1212 | |
| 1213 | |
Eilon Greenstein | 34f80b0 | 2008-06-23 20:33:01 -0700 | [diff] [blame] | 1214 | /* Number of u32 elements in MC hash array */ |
| 1215 | #define MC_HASH_SIZE 8 |
| 1216 | #define MC_HASH_OFFSET(bp, i) (BAR_TSTRORM_INTMEM + \ |
| 1217 | TSTORM_APPROXIMATE_MATCH_MULTICAST_FILTERING_OFFSET(BP_FUNC(bp)) + i*4) |
| 1218 | |
| 1219 | |
| 1220 | #ifndef PXP2_REG_PXP2_INT_STS |
| 1221 | #define PXP2_REG_PXP2_INT_STS PXP2_REG_PXP2_INT_STS_0 |
| 1222 | #endif |
| 1223 | |
Eliezer Tamir | a2fbb9e | 2007-11-15 20:09:02 +0200 | [diff] [blame] | 1224 | /* MISC_REG_RESET_REG - this is here for the hsi to work don't touch */ |
| 1225 | |
| 1226 | #endif /* bnx2x.h */ |