diff options
author | Scott Bardone <sbardone@chelsio.com> | 2005-06-23 01:40:19 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-23 01:40:19 -0400 |
commit | 559fb51ba7e66fe298b8355fabde1275b7def35f (patch) | |
tree | e1de3eb86ea5e6ac8c5f27dc32140a0c2aacc51e /drivers/net/chelsio/common.h | |
parent | a5324343955997d1439f26518ddac567cd5d134b (diff) |
Update Chelsio gige net driver.
- Use extern prefix for functions required.
- Removed a lot of wrappers, including t1_read/write_reg_4.
- Removed various macros, using native kernel calls now.
- Enumerated various #defines.
- Removed a lot of shared code which is not currently used in "NIC only" mode.
- Removed dead code.
Documentation/networking/cxgb.txt:
- Updated release notes for version 2.1.1
drivers/net/chelsio/ch_ethtool.h
- removed file, no longer using ETHTOOL namespace.
drivers/net/chelsio/common.h
- moved code from osdep.h to common.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cphy.h
- removed dead code.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/cxgb2.c
- use DMA_{32,64}BIT_MASK in include/linux/dma-mapping.h.
- removed unused code.
- use printk message for link info resembling drivers/net/mii.c.
- no longer using the MODULE_xxx namespace.
- no longer using "pci_" namespace.
- no longer using ETHTOOL namespace.
drivers/net/chelsio/cxgb2.h
- removed file, merged into common.h
drivers/net/chelsio/elmer0.h
- removed dead code.
- added various enums.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/espi.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
drivers/net/chelsio/espi.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/gmac.h
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/mv88x201x.c
- changes to sync with Chelsio TOT.
drivers/net/chelsio/osdep.h
- removed file, consolidation. osdep was used to translate wrapper functions
since our code supports multiple OSs. removed wrappers.
drivers/net/chelsio/pm3393.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/regs.h
- added a few register entries for future and current feature support.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/sge.c
- rewrote large portion of scatter-gather engine to stabilize
performance.
- using u8/u16/u32 kernel types instead of __u8/__u16/__u32 compiler
types.
drivers/net/chelsio/sge.h
- rewrote large portion of scatter-gather engine to stabilize
performance.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/subr.c
- merged tp.c into subr.c
- removed various macros, using native kernel calls now.
- removed a lot of wrappers, including t1_read/write_reg_4.
- removed unused code.
drivers/net/chelsio/suni1x10gexp_regs.h
- modified copyright and authorship of file.
- added comment to #endif indicating which symbol it closes.
drivers/net/chelsio/tp.c
- removed file, merged into subr.c.
drivers/net/chelsio/tp.h
- removed file.
include/linux/pci_ids.h
- patched to include PCI_VENDOR_ID_CHELSIO 0x1425, removed define from
our code.
Diffstat (limited to 'drivers/net/chelsio/common.h')
-rw-r--r-- | drivers/net/chelsio/common.h | 259 |
1 files changed, 152 insertions, 107 deletions
diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h index 017684ff48dc..f09348802b46 100644 --- a/drivers/net/chelsio/common.h +++ b/drivers/net/chelsio/common.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /***************************************************************************** | 1 | /***************************************************************************** |
2 | * * | 2 | * * |
3 | * File: common.h * | 3 | * File: common.h * |
4 | * $Revision: 1.5 $ * | 4 | * $Revision: 1.21 $ * |
5 | * $Date: 2005/03/23 07:41:27 $ * | 5 | * $Date: 2005/06/22 00:43:25 $ * |
6 | * Description: * | 6 | * Description: * |
7 | * part of the Chelsio 10Gb Ethernet Driver. * | 7 | * part of the Chelsio 10Gb Ethernet Driver. * |
8 | * * | 8 | * * |
@@ -36,74 +36,101 @@ | |||
36 | * * | 36 | * * |
37 | ****************************************************************************/ | 37 | ****************************************************************************/ |
38 | 38 | ||
39 | #ifndef CHELSIO_COMMON_H | 39 | #ifndef _CXGB_COMMON_H_ |
40 | #define CHELSIO_COMMON_H | 40 | #define _CXGB_COMMON_H_ |
41 | |||
42 | #include <linux/config.h> | ||
43 | #include <linux/module.h> | ||
44 | #include <linux/netdevice.h> | ||
45 | #include <linux/types.h> | ||
46 | #include <linux/delay.h> | ||
47 | #include <linux/pci.h> | ||
48 | #include <linux/ethtool.h> | ||
49 | #include <linux/mii.h> | ||
50 | #include <linux/crc32.h> | ||
51 | #include <linux/init.h> | ||
52 | #include <asm/io.h> | ||
53 | #include <linux/pci_ids.h> | ||
54 | |||
55 | #define DRV_DESCRIPTION "Chelsio 10Gb Ethernet Driver" | ||
56 | #define DRV_NAME "cxgb" | ||
57 | #define DRV_VERSION "2.1.1" | ||
58 | #define PFX DRV_NAME ": " | ||
59 | |||
60 | #define CH_ERR(fmt, ...) printk(KERN_ERR PFX fmt, ## __VA_ARGS__) | ||
61 | #define CH_WARN(fmt, ...) printk(KERN_WARNING PFX fmt, ## __VA_ARGS__) | ||
62 | #define CH_ALERT(fmt, ...) printk(KERN_ALERT PFX fmt, ## __VA_ARGS__) | ||
63 | |||
64 | #define CH_DEVICE(devid, ssid, idx) \ | ||
65 | { PCI_VENDOR_ID_CHELSIO, devid, PCI_ANY_ID, ssid, 0, 0, idx } | ||
66 | |||
67 | #define SUPPORTED_PAUSE (1 << 13) | ||
68 | #define SUPPORTED_LOOPBACK (1 << 15) | ||
69 | |||
70 | #define ADVERTISED_PAUSE (1 << 13) | ||
71 | #define ADVERTISED_ASYM_PAUSE (1 << 14) | ||
72 | |||
73 | typedef struct adapter adapter_t; | ||
74 | |||
75 | void t1_elmer0_ext_intr(adapter_t *adapter); | ||
76 | void t1_link_changed(adapter_t *adapter, int port_id, int link_status, | ||
77 | int speed, int duplex, int fc); | ||
78 | |||
79 | struct t1_rx_mode { | ||
80 | struct net_device *dev; | ||
81 | u32 idx; | ||
82 | struct dev_mc_list *list; | ||
83 | }; | ||
84 | |||
85 | #define t1_rx_mode_promisc(rm) (rm->dev->flags & IFF_PROMISC) | ||
86 | #define t1_rx_mode_allmulti(rm) (rm->dev->flags & IFF_ALLMULTI) | ||
87 | #define t1_rx_mode_mc_cnt(rm) (rm->dev->mc_count) | ||
88 | |||
89 | static inline u8 *t1_get_next_mcaddr(struct t1_rx_mode *rm) | ||
90 | { | ||
91 | u8 *addr = 0; | ||
41 | 92 | ||
42 | #define DIMOF(x) (sizeof(x)/sizeof(x[0])) | 93 | if (rm->idx++ < rm->dev->mc_count) { |
94 | addr = rm->list->dmi_addr; | ||
95 | rm->list = rm->list->next; | ||
96 | } | ||
97 | return addr; | ||
98 | } | ||
99 | |||
100 | #define MAX_NPORTS 4 | ||
43 | 101 | ||
44 | #define NMTUS 8 | 102 | #define SPEED_INVALID 0xffff |
45 | #define MAX_NPORTS 4 | 103 | #define DUPLEX_INVALID 0xff |
46 | #define TCB_SIZE 128 | ||
47 | 104 | ||
48 | enum { | 105 | enum { |
49 | CHBT_BOARD_7500, | ||
50 | CHBT_BOARD_8000, | ||
51 | CHBT_BOARD_CHT101, | ||
52 | CHBT_BOARD_CHT110, | ||
53 | CHBT_BOARD_CHT210, | ||
54 | CHBT_BOARD_CHT204, | ||
55 | CHBT_BOARD_N110, | 106 | CHBT_BOARD_N110, |
56 | CHBT_BOARD_N210, | 107 | CHBT_BOARD_N210 |
57 | CHBT_BOARD_COUGAR, | ||
58 | CHBT_BOARD_6800, | ||
59 | CHBT_BOARD_SIMUL | ||
60 | }; | 108 | }; |
61 | 109 | ||
62 | enum { | 110 | enum { |
63 | CHBT_TERM_FPGA, | ||
64 | CHBT_TERM_T1, | 111 | CHBT_TERM_T1, |
65 | CHBT_TERM_T2, | 112 | CHBT_TERM_T2 |
66 | CHBT_TERM_T3 | ||
67 | }; | 113 | }; |
68 | 114 | ||
69 | enum { | 115 | enum { |
70 | CHBT_MAC_CHELSIO_A, | ||
71 | CHBT_MAC_IXF1010, | ||
72 | CHBT_MAC_PM3393, | 116 | CHBT_MAC_PM3393, |
73 | CHBT_MAC_VSC7321, | ||
74 | CHBT_MAC_DUMMY | ||
75 | }; | 117 | }; |
76 | 118 | ||
77 | enum { | 119 | enum { |
78 | CHBT_PHY_88E1041, | ||
79 | CHBT_PHY_88E1111, | ||
80 | CHBT_PHY_88X2010, | 120 | CHBT_PHY_88X2010, |
81 | CHBT_PHY_XPAK, | ||
82 | CHBT_PHY_MY3126, | ||
83 | CHBT_PHY_DUMMY | ||
84 | }; | 121 | }; |
85 | 122 | ||
86 | enum { | 123 | enum { |
87 | PAUSE_RX = 1, | 124 | PAUSE_RX = 1 << 0, |
88 | PAUSE_TX = 2, | 125 | PAUSE_TX = 1 << 1, |
89 | PAUSE_AUTONEG = 4 | 126 | PAUSE_AUTONEG = 1 << 2 |
90 | }; | 127 | }; |
91 | 128 | ||
92 | /* Revisions of T1 chip */ | 129 | /* Revisions of T1 chip */ |
93 | #define TERM_T1A 0 | 130 | enum { |
94 | #define TERM_T1B 1 | 131 | TERM_T1A = 0, |
95 | #define TERM_T2 3 | 132 | TERM_T1B = 1, |
96 | 133 | TERM_T2 = 3 | |
97 | struct tp_params { | ||
98 | unsigned int pm_size; | ||
99 | unsigned int cm_size; | ||
100 | unsigned int pm_rx_base; | ||
101 | unsigned int pm_tx_base; | ||
102 | unsigned int pm_rx_pg_size; | ||
103 | unsigned int pm_tx_pg_size; | ||
104 | unsigned int pm_rx_num_pgs; | ||
105 | unsigned int pm_tx_num_pgs; | ||
106 | unsigned int use_5tuple_mode; | ||
107 | }; | 134 | }; |
108 | 135 | ||
109 | struct sge_params { | 136 | struct sge_params { |
@@ -118,17 +145,7 @@ struct sge_params { | |||
118 | unsigned int polling; | 145 | unsigned int polling; |
119 | }; | 146 | }; |
120 | 147 | ||
121 | struct mc5_params { | 148 | struct chelsio_pci_params { |
122 | unsigned int mode; /* selects MC5 width */ | ||
123 | unsigned int nservers; /* size of server region */ | ||
124 | unsigned int nroutes; /* size of routing region */ | ||
125 | }; | ||
126 | |||
127 | /* Default MC5 region sizes */ | ||
128 | #define DEFAULT_SERVER_REGION_LEN 256 | ||
129 | #define DEFAULT_RT_REGION_LEN 1024 | ||
130 | |||
131 | struct pci_params { | ||
132 | unsigned short speed; | 149 | unsigned short speed; |
133 | unsigned char width; | 150 | unsigned char width; |
134 | unsigned char is_pcix; | 151 | unsigned char is_pcix; |
@@ -136,31 +153,14 @@ struct pci_params { | |||
136 | 153 | ||
137 | struct adapter_params { | 154 | struct adapter_params { |
138 | struct sge_params sge; | 155 | struct sge_params sge; |
139 | struct mc5_params mc5; | 156 | struct chelsio_pci_params pci; |
140 | struct tp_params tp; | ||
141 | struct pci_params pci; | ||
142 | 157 | ||
143 | const struct board_info *brd_info; | 158 | const struct board_info *brd_info; |
144 | 159 | ||
145 | unsigned short mtus[NMTUS]; | 160 | unsigned int nports; /* # of ethernet ports */ |
146 | unsigned int nports; /* # of ethernet ports */ | ||
147 | unsigned int stats_update_period; | 161 | unsigned int stats_update_period; |
148 | unsigned short chip_revision; | 162 | unsigned short chip_revision; |
149 | unsigned char chip_version; | 163 | unsigned char chip_version; |
150 | unsigned char is_asic; | ||
151 | }; | ||
152 | |||
153 | struct pci_err_cnt { | ||
154 | unsigned int master_parity_err; | ||
155 | unsigned int sig_target_abort; | ||
156 | unsigned int rcv_target_abort; | ||
157 | unsigned int rcv_master_abort; | ||
158 | unsigned int sig_sys_err; | ||
159 | unsigned int det_parity_err; | ||
160 | unsigned int pio_parity_err; | ||
161 | unsigned int wf_parity_err; | ||
162 | unsigned int rf_parity_err; | ||
163 | unsigned int cf_parity_err; | ||
164 | }; | 164 | }; |
165 | 165 | ||
166 | struct link_config { | 166 | struct link_config { |
@@ -175,8 +175,60 @@ struct link_config { | |||
175 | unsigned char autoneg; /* autonegotiating? */ | 175 | unsigned char autoneg; /* autonegotiating? */ |
176 | }; | 176 | }; |
177 | 177 | ||
178 | #define SPEED_INVALID 0xffff | 178 | struct cmac; |
179 | #define DUPLEX_INVALID 0xff | 179 | struct cphy; |
180 | |||
181 | struct port_info { | ||
182 | struct net_device *dev; | ||
183 | struct cmac *mac; | ||
184 | struct cphy *phy; | ||
185 | struct link_config link_config; | ||
186 | struct net_device_stats netstats; | ||
187 | }; | ||
188 | |||
189 | struct sge; | ||
190 | struct peespi; | ||
191 | |||
192 | struct adapter { | ||
193 | u8 *regs; | ||
194 | struct pci_dev *pdev; | ||
195 | unsigned long registered_device_map; | ||
196 | unsigned long open_device_map; | ||
197 | unsigned long flags; | ||
198 | |||
199 | const char *name; | ||
200 | int msg_enable; | ||
201 | u32 mmio_len; | ||
202 | |||
203 | struct work_struct ext_intr_handler_task; | ||
204 | struct adapter_params params; | ||
205 | |||
206 | struct vlan_group *vlan_grp; | ||
207 | |||
208 | /* Terminator modules. */ | ||
209 | struct sge *sge; | ||
210 | struct peespi *espi; | ||
211 | |||
212 | struct port_info port[MAX_NPORTS]; | ||
213 | struct work_struct stats_update_task; | ||
214 | struct timer_list stats_update_timer; | ||
215 | |||
216 | struct semaphore mib_mutex; | ||
217 | spinlock_t tpi_lock; | ||
218 | spinlock_t work_lock; | ||
219 | /* guards async operations */ | ||
220 | spinlock_t async_lock ____cacheline_aligned; | ||
221 | u32 slow_intr_mask; | ||
222 | }; | ||
223 | |||
224 | enum { /* adapter flags */ | ||
225 | FULL_INIT_DONE = 1 << 0, | ||
226 | TSO_CAPABLE = 1 << 2, | ||
227 | TCP_CSUM_CAPABLE = 1 << 3, | ||
228 | UDP_CSUM_CAPABLE = 1 << 4, | ||
229 | VLAN_ACCEL_CAPABLE = 1 << 5, | ||
230 | RX_CSUM_ENABLED = 1 << 6, | ||
231 | }; | ||
180 | 232 | ||
181 | struct mdio_ops; | 233 | struct mdio_ops; |
182 | struct gmac; | 234 | struct gmac; |
@@ -205,19 +257,8 @@ struct board_info { | |||
205 | const char *desc; | 257 | const char *desc; |
206 | }; | 258 | }; |
207 | 259 | ||
208 | #include "osdep.h" | ||
209 | |||
210 | #ifndef PCI_VENDOR_ID_CHELSIO | ||
211 | #define PCI_VENDOR_ID_CHELSIO 0x1425 | ||
212 | #endif | ||
213 | |||
214 | extern struct pci_device_id t1_pci_tbl[]; | 260 | extern struct pci_device_id t1_pci_tbl[]; |
215 | 261 | ||
216 | static inline int t1_is_asic(const adapter_t *adapter) | ||
217 | { | ||
218 | return adapter->params.is_asic; | ||
219 | } | ||
220 | |||
221 | static inline int adapter_matches_type(const adapter_t *adapter, | 262 | static inline int adapter_matches_type(const adapter_t *adapter, |
222 | int version, int revision) | 263 | int version, int revision) |
223 | { | 264 | { |
@@ -245,25 +286,29 @@ static inline unsigned int core_ticks_per_usec(const adapter_t *adap) | |||
245 | return board_info(adap)->clock_core / 1000000; | 286 | return board_info(adap)->clock_core / 1000000; |
246 | } | 287 | } |
247 | 288 | ||
248 | int t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); | 289 | extern int t1_tpi_write(adapter_t *adapter, u32 addr, u32 value); |
249 | int t1_tpi_read(adapter_t *adapter, u32 addr, u32 *value); | 290 | extern int t1_tpi_read(adapter_t *adapter, u32 addr, u32 *value); |
250 | 291 | ||
251 | void t1_interrupts_enable(adapter_t *adapter); | 292 | extern void t1_interrupts_enable(adapter_t *adapter); |
252 | void t1_interrupts_disable(adapter_t *adapter); | 293 | extern void t1_interrupts_disable(adapter_t *adapter); |
253 | void t1_interrupts_clear(adapter_t *adapter); | 294 | extern void t1_interrupts_clear(adapter_t *adapter); |
254 | int elmer0_ext_intr_handler(adapter_t *adapter); | 295 | extern int elmer0_ext_intr_handler(adapter_t *adapter); |
255 | int t1_slow_intr_handler(adapter_t *adapter); | 296 | extern int t1_slow_intr_handler(adapter_t *adapter); |
256 | 297 | ||
257 | int t1_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); | 298 | extern int t1_link_start(struct cphy *phy, struct cmac *mac, struct link_config *lc); |
258 | const struct board_info *t1_get_board_info(unsigned int board_id); | 299 | extern const struct board_info *t1_get_board_info(unsigned int board_id); |
259 | const struct board_info *t1_get_board_info_from_ids(unsigned int devid, | 300 | extern const struct board_info *t1_get_board_info_from_ids(unsigned int devid, |
260 | unsigned short ssid); | 301 | unsigned short ssid); |
261 | int t1_seeprom_read(adapter_t *adapter, u32 addr, u32 *data); | 302 | extern int t1_seeprom_read(adapter_t *adapter, u32 addr, u32 *data); |
262 | int t1_get_board_rev(adapter_t *adapter, const struct board_info *bi, | 303 | extern int t1_get_board_rev(adapter_t *adapter, const struct board_info *bi, |
263 | struct adapter_params *p); | 304 | struct adapter_params *p); |
264 | int t1_init_hw_modules(adapter_t *adapter); | 305 | extern int t1_init_hw_modules(adapter_t *adapter); |
265 | int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi); | 306 | extern int t1_init_sw_modules(adapter_t *adapter, const struct board_info *bi); |
266 | void t1_free_sw_modules(adapter_t *adapter); | 307 | extern void t1_free_sw_modules(adapter_t *adapter); |
267 | void t1_fatal_err(adapter_t *adapter); | 308 | extern void t1_fatal_err(adapter_t *adapter); |
268 | #endif | 309 | |
310 | extern void t1_tp_set_udp_checksum_offload(adapter_t *adapter, int enable); | ||
311 | extern void t1_tp_set_tcp_checksum_offload(adapter_t *adapter, int enable); | ||
312 | extern void t1_tp_set_ip_checksum_offload(adapter_t *adapter, int enable); | ||
269 | 313 | ||
314 | #endif /* _CXGB_COMMON_H_ */ | ||