s2io.h 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  1. /************************************************************************
  2. * s2io.h: A Linux PCI-X Ethernet driver for Neterion 10GbE Server NIC
  3. * Copyright(c) 2002-2007 Neterion Inc.
  4. * This software may be used and distributed according to the terms of
  5. * the GNU General Public License (GPL), incorporated herein by reference.
  6. * Drivers based on or derived from this code fall under the GPL and must
  7. * retain the authorship, copyright and license notice. This file is not
  8. * a complete program and may only be used when the entire operating
  9. * system is licensed under the GPL.
  10. * See the file COPYING in this distribution for more information.
  11. ************************************************************************/
  12. #ifndef _S2IO_H
  13. #define _S2IO_H
  14. #define TBD 0
  15. #define s2BIT(loc) (0x8000000000000000ULL >> (loc))
  16. #define vBIT(val, loc, sz) (((u64)val) << (64-loc-sz))
  17. #define INV(d) ((d&0xff)<<24) | (((d>>8)&0xff)<<16) | (((d>>16)&0xff)<<8)| ((d>>24)&0xff)
  18. #ifndef BOOL
  19. #define BOOL int
  20. #endif
  21. #ifndef TRUE
  22. #define TRUE 1
  23. #define FALSE 0
  24. #endif
  25. #undef SUCCESS
  26. #define SUCCESS 0
  27. #define FAILURE -1
  28. #define S2IO_MINUS_ONE 0xFFFFFFFFFFFFFFFFULL
  29. #define S2IO_DISABLE_MAC_ENTRY 0xFFFFFFFFFFFFULL
  30. #define S2IO_MAX_PCI_CONFIG_SPACE_REINIT 100
  31. #define S2IO_BIT_RESET 1
  32. #define S2IO_BIT_SET 2
  33. #define CHECKBIT(value, nbit) (value & (1 << nbit))
  34. /* Maximum time to flicker LED when asked to identify NIC using ethtool */
  35. #define MAX_FLICKER_TIME 60000 /* 60 Secs */
  36. /* Maximum outstanding splits to be configured into xena. */
  37. enum {
  38. XENA_ONE_SPLIT_TRANSACTION = 0,
  39. XENA_TWO_SPLIT_TRANSACTION = 1,
  40. XENA_THREE_SPLIT_TRANSACTION = 2,
  41. XENA_FOUR_SPLIT_TRANSACTION = 3,
  42. XENA_EIGHT_SPLIT_TRANSACTION = 4,
  43. XENA_TWELVE_SPLIT_TRANSACTION = 5,
  44. XENA_SIXTEEN_SPLIT_TRANSACTION = 6,
  45. XENA_THIRTYTWO_SPLIT_TRANSACTION = 7
  46. };
  47. #define XENA_MAX_OUTSTANDING_SPLITS(n) (n << 4)
  48. /* OS concerned variables and constants */
  49. #define WATCH_DOG_TIMEOUT 15*HZ
  50. #define EFILL 0x1234
  51. #define ALIGN_SIZE 127
  52. #define PCIX_COMMAND_REGISTER 0x62
  53. /*
  54. * Debug related variables.
  55. */
  56. /* different debug levels. */
  57. #define ERR_DBG 0
  58. #define INIT_DBG 1
  59. #define INFO_DBG 2
  60. #define TX_DBG 3
  61. #define INTR_DBG 4
  62. /* Global variable that defines the present debug level of the driver. */
  63. static int debug_level = ERR_DBG;
  64. /* DEBUG message print. */
  65. #define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args)
  66. /* Protocol assist features of the NIC */
  67. #define L3_CKSUM_OK 0xFFFF
  68. #define L4_CKSUM_OK 0xFFFF
  69. #define S2IO_JUMBO_SIZE 9600
  70. /* Driver statistics maintained by driver */
  71. struct swStat {
  72. unsigned long long single_ecc_errs;
  73. unsigned long long double_ecc_errs;
  74. unsigned long long parity_err_cnt;
  75. unsigned long long serious_err_cnt;
  76. unsigned long long soft_reset_cnt;
  77. unsigned long long fifo_full_cnt;
  78. unsigned long long ring_full_cnt[8];
  79. /* LRO statistics */
  80. unsigned long long clubbed_frms_cnt;
  81. unsigned long long sending_both;
  82. unsigned long long outof_sequence_pkts;
  83. unsigned long long flush_max_pkts;
  84. unsigned long long sum_avg_pkts_aggregated;
  85. unsigned long long num_aggregations;
  86. /* Other statistics */
  87. unsigned long long mem_alloc_fail_cnt;
  88. unsigned long long pci_map_fail_cnt;
  89. unsigned long long watchdog_timer_cnt;
  90. unsigned long long mem_allocated;
  91. unsigned long long mem_freed;
  92. unsigned long long link_up_cnt;
  93. unsigned long long link_down_cnt;
  94. unsigned long long link_up_time;
  95. unsigned long long link_down_time;
  96. /* Transfer Code statistics */
  97. unsigned long long tx_buf_abort_cnt;
  98. unsigned long long tx_desc_abort_cnt;
  99. unsigned long long tx_parity_err_cnt;
  100. unsigned long long tx_link_loss_cnt;
  101. unsigned long long tx_list_proc_err_cnt;
  102. unsigned long long rx_parity_err_cnt;
  103. unsigned long long rx_abort_cnt;
  104. unsigned long long rx_parity_abort_cnt;
  105. unsigned long long rx_rda_fail_cnt;
  106. unsigned long long rx_unkn_prot_cnt;
  107. unsigned long long rx_fcs_err_cnt;
  108. unsigned long long rx_buf_size_err_cnt;
  109. unsigned long long rx_rxd_corrupt_cnt;
  110. unsigned long long rx_unkn_err_cnt;
  111. /* Error/alarm statistics*/
  112. unsigned long long tda_err_cnt;
  113. unsigned long long pfc_err_cnt;
  114. unsigned long long pcc_err_cnt;
  115. unsigned long long tti_err_cnt;
  116. unsigned long long lso_err_cnt;
  117. unsigned long long tpa_err_cnt;
  118. unsigned long long sm_err_cnt;
  119. unsigned long long mac_tmac_err_cnt;
  120. unsigned long long mac_rmac_err_cnt;
  121. unsigned long long xgxs_txgxs_err_cnt;
  122. unsigned long long xgxs_rxgxs_err_cnt;
  123. unsigned long long rc_err_cnt;
  124. unsigned long long prc_pcix_err_cnt;
  125. unsigned long long rpa_err_cnt;
  126. unsigned long long rda_err_cnt;
  127. unsigned long long rti_err_cnt;
  128. unsigned long long mc_err_cnt;
  129. };
  130. /* Xpak releated alarm and warnings */
  131. struct xpakStat {
  132. u64 alarm_transceiver_temp_high;
  133. u64 alarm_transceiver_temp_low;
  134. u64 alarm_laser_bias_current_high;
  135. u64 alarm_laser_bias_current_low;
  136. u64 alarm_laser_output_power_high;
  137. u64 alarm_laser_output_power_low;
  138. u64 warn_transceiver_temp_high;
  139. u64 warn_transceiver_temp_low;
  140. u64 warn_laser_bias_current_high;
  141. u64 warn_laser_bias_current_low;
  142. u64 warn_laser_output_power_high;
  143. u64 warn_laser_output_power_low;
  144. u64 xpak_regs_stat;
  145. u32 xpak_timer_count;
  146. };
  147. /* The statistics block of Xena */
  148. struct stat_block {
  149. /* Tx MAC statistics counters. */
  150. __le32 tmac_data_octets;
  151. __le32 tmac_frms;
  152. __le64 tmac_drop_frms;
  153. __le32 tmac_bcst_frms;
  154. __le32 tmac_mcst_frms;
  155. __le64 tmac_pause_ctrl_frms;
  156. __le32 tmac_ucst_frms;
  157. __le32 tmac_ttl_octets;
  158. __le32 tmac_any_err_frms;
  159. __le32 tmac_nucst_frms;
  160. __le64 tmac_ttl_less_fb_octets;
  161. __le64 tmac_vld_ip_octets;
  162. __le32 tmac_drop_ip;
  163. __le32 tmac_vld_ip;
  164. __le32 tmac_rst_tcp;
  165. __le32 tmac_icmp;
  166. __le64 tmac_tcp;
  167. __le32 reserved_0;
  168. __le32 tmac_udp;
  169. /* Rx MAC Statistics counters. */
  170. __le32 rmac_data_octets;
  171. __le32 rmac_vld_frms;
  172. __le64 rmac_fcs_err_frms;
  173. __le64 rmac_drop_frms;
  174. __le32 rmac_vld_bcst_frms;
  175. __le32 rmac_vld_mcst_frms;
  176. __le32 rmac_out_rng_len_err_frms;
  177. __le32 rmac_in_rng_len_err_frms;
  178. __le64 rmac_long_frms;
  179. __le64 rmac_pause_ctrl_frms;
  180. __le64 rmac_unsup_ctrl_frms;
  181. __le32 rmac_accepted_ucst_frms;
  182. __le32 rmac_ttl_octets;
  183. __le32 rmac_discarded_frms;
  184. __le32 rmac_accepted_nucst_frms;
  185. __le32 reserved_1;
  186. __le32 rmac_drop_events;
  187. __le64 rmac_ttl_less_fb_octets;
  188. __le64 rmac_ttl_frms;
  189. __le64 reserved_2;
  190. __le32 rmac_usized_frms;
  191. __le32 reserved_3;
  192. __le32 rmac_frag_frms;
  193. __le32 rmac_osized_frms;
  194. __le32 reserved_4;
  195. __le32 rmac_jabber_frms;
  196. __le64 rmac_ttl_64_frms;
  197. __le64 rmac_ttl_65_127_frms;
  198. __le64 reserved_5;
  199. __le64 rmac_ttl_128_255_frms;
  200. __le64 rmac_ttl_256_511_frms;
  201. __le64 reserved_6;
  202. __le64 rmac_ttl_512_1023_frms;
  203. __le64 rmac_ttl_1024_1518_frms;
  204. __le32 rmac_ip;
  205. __le32 reserved_7;
  206. __le64 rmac_ip_octets;
  207. __le32 rmac_drop_ip;
  208. __le32 rmac_hdr_err_ip;
  209. __le32 reserved_8;
  210. __le32 rmac_icmp;
  211. __le64 rmac_tcp;
  212. __le32 rmac_err_drp_udp;
  213. __le32 rmac_udp;
  214. __le64 rmac_xgmii_err_sym;
  215. __le64 rmac_frms_q0;
  216. __le64 rmac_frms_q1;
  217. __le64 rmac_frms_q2;
  218. __le64 rmac_frms_q3;
  219. __le64 rmac_frms_q4;
  220. __le64 rmac_frms_q5;
  221. __le64 rmac_frms_q6;
  222. __le64 rmac_frms_q7;
  223. __le16 rmac_full_q3;
  224. __le16 rmac_full_q2;
  225. __le16 rmac_full_q1;
  226. __le16 rmac_full_q0;
  227. __le16 rmac_full_q7;
  228. __le16 rmac_full_q6;
  229. __le16 rmac_full_q5;
  230. __le16 rmac_full_q4;
  231. __le32 reserved_9;
  232. __le32 rmac_pause_cnt;
  233. __le64 rmac_xgmii_data_err_cnt;
  234. __le64 rmac_xgmii_ctrl_err_cnt;
  235. __le32 rmac_err_tcp;
  236. __le32 rmac_accepted_ip;
  237. /* PCI/PCI-X Read transaction statistics. */
  238. __le32 new_rd_req_cnt;
  239. __le32 rd_req_cnt;
  240. __le32 rd_rtry_cnt;
  241. __le32 new_rd_req_rtry_cnt;
  242. /* PCI/PCI-X Write/Read transaction statistics. */
  243. __le32 wr_req_cnt;
  244. __le32 wr_rtry_rd_ack_cnt;
  245. __le32 new_wr_req_rtry_cnt;
  246. __le32 new_wr_req_cnt;
  247. __le32 wr_disc_cnt;
  248. __le32 wr_rtry_cnt;
  249. /* PCI/PCI-X Write / DMA Transaction statistics. */
  250. __le32 txp_wr_cnt;
  251. __le32 rd_rtry_wr_ack_cnt;
  252. __le32 txd_wr_cnt;
  253. __le32 txd_rd_cnt;
  254. __le32 rxd_wr_cnt;
  255. __le32 rxd_rd_cnt;
  256. __le32 rxf_wr_cnt;
  257. __le32 txf_rd_cnt;
  258. /* Tx MAC statistics overflow counters. */
  259. __le32 tmac_data_octets_oflow;
  260. __le32 tmac_frms_oflow;
  261. __le32 tmac_bcst_frms_oflow;
  262. __le32 tmac_mcst_frms_oflow;
  263. __le32 tmac_ucst_frms_oflow;
  264. __le32 tmac_ttl_octets_oflow;
  265. __le32 tmac_any_err_frms_oflow;
  266. __le32 tmac_nucst_frms_oflow;
  267. __le64 tmac_vlan_frms;
  268. __le32 tmac_drop_ip_oflow;
  269. __le32 tmac_vld_ip_oflow;
  270. __le32 tmac_rst_tcp_oflow;
  271. __le32 tmac_icmp_oflow;
  272. __le32 tpa_unknown_protocol;
  273. __le32 tmac_udp_oflow;
  274. __le32 reserved_10;
  275. __le32 tpa_parse_failure;
  276. /* Rx MAC Statistics overflow counters. */
  277. __le32 rmac_data_octets_oflow;
  278. __le32 rmac_vld_frms_oflow;
  279. __le32 rmac_vld_bcst_frms_oflow;
  280. __le32 rmac_vld_mcst_frms_oflow;
  281. __le32 rmac_accepted_ucst_frms_oflow;
  282. __le32 rmac_ttl_octets_oflow;
  283. __le32 rmac_discarded_frms_oflow;
  284. __le32 rmac_accepted_nucst_frms_oflow;
  285. __le32 rmac_usized_frms_oflow;
  286. __le32 rmac_drop_events_oflow;
  287. __le32 rmac_frag_frms_oflow;
  288. __le32 rmac_osized_frms_oflow;
  289. __le32 rmac_ip_oflow;
  290. __le32 rmac_jabber_frms_oflow;
  291. __le32 rmac_icmp_oflow;
  292. __le32 rmac_drop_ip_oflow;
  293. __le32 rmac_err_drp_udp_oflow;
  294. __le32 rmac_udp_oflow;
  295. __le32 reserved_11;
  296. __le32 rmac_pause_cnt_oflow;
  297. __le64 rmac_ttl_1519_4095_frms;
  298. __le64 rmac_ttl_4096_8191_frms;
  299. __le64 rmac_ttl_8192_max_frms;
  300. __le64 rmac_ttl_gt_max_frms;
  301. __le64 rmac_osized_alt_frms;
  302. __le64 rmac_jabber_alt_frms;
  303. __le64 rmac_gt_max_alt_frms;
  304. __le64 rmac_vlan_frms;
  305. __le32 rmac_len_discard;
  306. __le32 rmac_fcs_discard;
  307. __le32 rmac_pf_discard;
  308. __le32 rmac_da_discard;
  309. __le32 rmac_red_discard;
  310. __le32 rmac_rts_discard;
  311. __le32 reserved_12;
  312. __le32 rmac_ingm_full_discard;
  313. __le32 reserved_13;
  314. __le32 rmac_accepted_ip_oflow;
  315. __le32 reserved_14;
  316. __le32 link_fault_cnt;
  317. u8 buffer[20];
  318. struct swStat sw_stat;
  319. struct xpakStat xpak_stat;
  320. };
  321. /* Default value for 'vlan_strip_tag' configuration parameter */
  322. #define NO_STRIP_IN_PROMISC 2
  323. /*
  324. * Structures representing different init time configuration
  325. * parameters of the NIC.
  326. */
  327. #define MAX_TX_FIFOS 8
  328. #define MAX_RX_RINGS 8
  329. #define FIFO_DEFAULT_NUM 5
  330. #define FIFO_UDP_MAX_NUM 2 /* 0 - even, 1 -odd ports */
  331. #define FIFO_OTHER_MAX_NUM 1
  332. #define MAX_RX_DESC_1 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 127 )
  333. #define MAX_RX_DESC_2 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
  334. #define MAX_RX_DESC_3 (MAX_RX_RINGS * MAX_RX_BLOCKS_PER_RING * 85 )
  335. #define MAX_TX_DESC (MAX_AVAILABLE_TXDS)
  336. /* FIFO mappings for all possible number of fifos configured */
  337. static int fifo_map[][MAX_TX_FIFOS] = {
  338. {0, 0, 0, 0, 0, 0, 0, 0},
  339. {0, 0, 0, 0, 1, 1, 1, 1},
  340. {0, 0, 0, 1, 1, 1, 2, 2},
  341. {0, 0, 1, 1, 2, 2, 3, 3},
  342. {0, 0, 1, 1, 2, 2, 3, 4},
  343. {0, 0, 1, 1, 2, 3, 4, 5},
  344. {0, 0, 1, 2, 3, 4, 5, 6},
  345. {0, 1, 2, 3, 4, 5, 6, 7},
  346. };
  347. static u16 fifo_selector[MAX_TX_FIFOS] = {0, 1, 3, 3, 7, 7, 7, 7};
  348. /* Maintains Per FIFO related information. */
  349. struct tx_fifo_config {
  350. #define MAX_AVAILABLE_TXDS 8192
  351. u32 fifo_len; /* specifies len of FIFO upto 8192, ie no of TxDLs */
  352. /* Priority definition */
  353. #define TX_FIFO_PRI_0 0 /*Highest */
  354. #define TX_FIFO_PRI_1 1
  355. #define TX_FIFO_PRI_2 2
  356. #define TX_FIFO_PRI_3 3
  357. #define TX_FIFO_PRI_4 4
  358. #define TX_FIFO_PRI_5 5
  359. #define TX_FIFO_PRI_6 6
  360. #define TX_FIFO_PRI_7 7 /*lowest */
  361. u8 fifo_priority; /* specifies pointer level for FIFO */
  362. /* user should not set twos fifos with same pri */
  363. u8 f_no_snoop;
  364. #define NO_SNOOP_TXD 0x01
  365. #define NO_SNOOP_TXD_BUFFER 0x02
  366. };
  367. /* Maintains per Ring related information */
  368. struct rx_ring_config {
  369. u32 num_rxd; /*No of RxDs per Rx Ring */
  370. #define RX_RING_PRI_0 0 /* highest */
  371. #define RX_RING_PRI_1 1
  372. #define RX_RING_PRI_2 2
  373. #define RX_RING_PRI_3 3
  374. #define RX_RING_PRI_4 4
  375. #define RX_RING_PRI_5 5
  376. #define RX_RING_PRI_6 6
  377. #define RX_RING_PRI_7 7 /* lowest */
  378. u8 ring_priority; /*Specifies service priority of ring */
  379. /* OSM should not set any two rings with same priority */
  380. u8 ring_org; /*Organization of ring */
  381. #define RING_ORG_BUFF1 0x01
  382. #define RX_RING_ORG_BUFF3 0x03
  383. #define RX_RING_ORG_BUFF5 0x05
  384. u8 f_no_snoop;
  385. #define NO_SNOOP_RXD 0x01
  386. #define NO_SNOOP_RXD_BUFFER 0x02
  387. };
  388. /* This structure provides contains values of the tunable parameters
  389. * of the H/W
  390. */
  391. struct config_param {
  392. /* Tx Side */
  393. u32 tx_fifo_num; /*Number of Tx FIFOs */
  394. /* 0-No steering, 1-Priority steering, 2-Default fifo map */
  395. #define NO_STEERING 0
  396. #define TX_PRIORITY_STEERING 0x1
  397. #define TX_DEFAULT_STEERING 0x2
  398. u8 tx_steering_type;
  399. u8 fifo_mapping[MAX_TX_FIFOS];
  400. struct tx_fifo_config tx_cfg[MAX_TX_FIFOS]; /*Per-Tx FIFO config */
  401. u32 max_txds; /*Max no. of Tx buffer descriptor per TxDL */
  402. u64 tx_intr_type;
  403. #define INTA 0
  404. #define MSI_X 2
  405. u8 intr_type;
  406. u8 napi;
  407. /* Specifies if Tx Intr is UTILZ or PER_LIST type. */
  408. /* Rx Side */
  409. u32 rx_ring_num; /*Number of receive rings */
  410. #define MAX_RX_BLOCKS_PER_RING 150
  411. struct rx_ring_config rx_cfg[MAX_RX_RINGS]; /*Per-Rx Ring config */
  412. #define HEADER_ETHERNET_II_802_3_SIZE 14
  413. #define HEADER_802_2_SIZE 3
  414. #define HEADER_SNAP_SIZE 5
  415. #define HEADER_VLAN_SIZE 4
  416. #define MIN_MTU 46
  417. #define MAX_PYLD 1500
  418. #define MAX_MTU (MAX_PYLD+18)
  419. #define MAX_MTU_VLAN (MAX_PYLD+22)
  420. #define MAX_PYLD_JUMBO 9600
  421. #define MAX_MTU_JUMBO (MAX_PYLD_JUMBO+18)
  422. #define MAX_MTU_JUMBO_VLAN (MAX_PYLD_JUMBO+22)
  423. u16 bus_speed;
  424. int max_mc_addr; /* xena=64 herc=256 */
  425. int max_mac_addr; /* xena=16 herc=64 */
  426. int mc_start_offset; /* xena=16 herc=64 */
  427. u8 multiq;
  428. };
  429. /* Structure representing MAC Addrs */
  430. struct mac_addr {
  431. u8 mac_addr[ETH_ALEN];
  432. };
  433. /* Structure that represent every FIFO element in the BAR1
  434. * Address location.
  435. */
  436. struct TxFIFO_element {
  437. u64 TxDL_Pointer;
  438. u64 List_Control;
  439. #define TX_FIFO_LAST_TXD_NUM( val) vBIT(val,0,8)
  440. #define TX_FIFO_FIRST_LIST s2BIT(14)
  441. #define TX_FIFO_LAST_LIST s2BIT(15)
  442. #define TX_FIFO_FIRSTNLAST_LIST vBIT(3,14,2)
  443. #define TX_FIFO_SPECIAL_FUNC s2BIT(23)
  444. #define TX_FIFO_DS_NO_SNOOP s2BIT(31)
  445. #define TX_FIFO_BUFF_NO_SNOOP s2BIT(30)
  446. };
  447. /* Tx descriptor structure */
  448. struct TxD {
  449. u64 Control_1;
  450. /* bit mask */
  451. #define TXD_LIST_OWN_XENA s2BIT(7)
  452. #define TXD_T_CODE (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))
  453. #define TXD_T_CODE_OK(val) (|(val & TXD_T_CODE))
  454. #define GET_TXD_T_CODE(val) ((val & TXD_T_CODE)<<12)
  455. #define TXD_GATHER_CODE (s2BIT(22) | s2BIT(23))
  456. #define TXD_GATHER_CODE_FIRST s2BIT(22)
  457. #define TXD_GATHER_CODE_LAST s2BIT(23)
  458. #define TXD_TCP_LSO_EN s2BIT(30)
  459. #define TXD_UDP_COF_EN s2BIT(31)
  460. #define TXD_UFO_EN s2BIT(31) | s2BIT(30)
  461. #define TXD_TCP_LSO_MSS(val) vBIT(val,34,14)
  462. #define TXD_UFO_MSS(val) vBIT(val,34,14)
  463. #define TXD_BUFFER0_SIZE(val) vBIT(val,48,16)
  464. u64 Control_2;
  465. #define TXD_TX_CKO_CONTROL (s2BIT(5)|s2BIT(6)|s2BIT(7))
  466. #define TXD_TX_CKO_IPV4_EN s2BIT(5)
  467. #define TXD_TX_CKO_TCP_EN s2BIT(6)
  468. #define TXD_TX_CKO_UDP_EN s2BIT(7)
  469. #define TXD_VLAN_ENABLE s2BIT(15)
  470. #define TXD_VLAN_TAG(val) vBIT(val,16,16)
  471. #define TXD_INT_NUMBER(val) vBIT(val,34,6)
  472. #define TXD_INT_TYPE_PER_LIST s2BIT(47)
  473. #define TXD_INT_TYPE_UTILZ s2BIT(46)
  474. #define TXD_SET_MARKER vBIT(0x6,0,4)
  475. u64 Buffer_Pointer;
  476. u64 Host_Control; /* reserved for host */
  477. };
  478. /* Structure to hold the phy and virt addr of every TxDL. */
  479. struct list_info_hold {
  480. dma_addr_t list_phy_addr;
  481. void *list_virt_addr;
  482. };
  483. /* Rx descriptor structure for 1 buffer mode */
  484. struct RxD_t {
  485. u64 Host_Control; /* reserved for host */
  486. u64 Control_1;
  487. #define RXD_OWN_XENA s2BIT(7)
  488. #define RXD_T_CODE (s2BIT(12)|s2BIT(13)|s2BIT(14)|s2BIT(15))
  489. #define RXD_FRAME_PROTO vBIT(0xFFFF,24,8)
  490. #define RXD_FRAME_VLAN_TAG s2BIT(24)
  491. #define RXD_FRAME_PROTO_IPV4 s2BIT(27)
  492. #define RXD_FRAME_PROTO_IPV6 s2BIT(28)
  493. #define RXD_FRAME_IP_FRAG s2BIT(29)
  494. #define RXD_FRAME_PROTO_TCP s2BIT(30)
  495. #define RXD_FRAME_PROTO_UDP s2BIT(31)
  496. #define TCP_OR_UDP_FRAME (RXD_FRAME_PROTO_TCP | RXD_FRAME_PROTO_UDP)
  497. #define RXD_GET_L3_CKSUM(val) ((u16)(val>> 16) & 0xFFFF)
  498. #define RXD_GET_L4_CKSUM(val) ((u16)(val) & 0xFFFF)
  499. u64 Control_2;
  500. #define THE_RXD_MARK 0x3
  501. #define SET_RXD_MARKER vBIT(THE_RXD_MARK, 0, 2)
  502. #define GET_RXD_MARKER(ctrl) ((ctrl & SET_RXD_MARKER) >> 62)
  503. #define MASK_VLAN_TAG vBIT(0xFFFF,48,16)
  504. #define SET_VLAN_TAG(val) vBIT(val,48,16)
  505. #define SET_NUM_TAG(val) vBIT(val,16,32)
  506. };
  507. /* Rx descriptor structure for 1 buffer mode */
  508. struct RxD1 {
  509. struct RxD_t h;
  510. #define MASK_BUFFER0_SIZE_1 vBIT(0x3FFF,2,14)
  511. #define SET_BUFFER0_SIZE_1(val) vBIT(val,2,14)
  512. #define RXD_GET_BUFFER0_SIZE_1(_Control_2) \
  513. (u16)((_Control_2 & MASK_BUFFER0_SIZE_1) >> 48)
  514. u64 Buffer0_ptr;
  515. };
  516. /* Rx descriptor structure for 3 or 2 buffer mode */
  517. struct RxD3 {
  518. struct RxD_t h;
  519. #define MASK_BUFFER0_SIZE_3 vBIT(0xFF,2,14)
  520. #define MASK_BUFFER1_SIZE_3 vBIT(0xFFFF,16,16)
  521. #define MASK_BUFFER2_SIZE_3 vBIT(0xFFFF,32,16)
  522. #define SET_BUFFER0_SIZE_3(val) vBIT(val,8,8)
  523. #define SET_BUFFER1_SIZE_3(val) vBIT(val,16,16)
  524. #define SET_BUFFER2_SIZE_3(val) vBIT(val,32,16)
  525. #define RXD_GET_BUFFER0_SIZE_3(Control_2) \
  526. (u8)((Control_2 & MASK_BUFFER0_SIZE_3) >> 48)
  527. #define RXD_GET_BUFFER1_SIZE_3(Control_2) \
  528. (u16)((Control_2 & MASK_BUFFER1_SIZE_3) >> 32)
  529. #define RXD_GET_BUFFER2_SIZE_3(Control_2) \
  530. (u16)((Control_2 & MASK_BUFFER2_SIZE_3) >> 16)
  531. #define BUF0_LEN 40
  532. #define BUF1_LEN 1
  533. u64 Buffer0_ptr;
  534. u64 Buffer1_ptr;
  535. u64 Buffer2_ptr;
  536. };
  537. /* Structure that represents the Rx descriptor block which contains
  538. * 128 Rx descriptors.
  539. */
  540. struct RxD_block {
  541. #define MAX_RXDS_PER_BLOCK_1 127
  542. struct RxD1 rxd[MAX_RXDS_PER_BLOCK_1];
  543. u64 reserved_0;
  544. #define END_OF_BLOCK 0xFEFFFFFFFFFFFFFFULL
  545. u64 reserved_1; /* 0xFEFFFFFFFFFFFFFF to mark last
  546. * Rxd in this blk */
  547. u64 reserved_2_pNext_RxD_block; /* Logical ptr to next */
  548. u64 pNext_RxD_Blk_physical; /* Buff0_ptr.In a 32 bit arch
  549. * the upper 32 bits should
  550. * be 0 */
  551. };
  552. #define SIZE_OF_BLOCK 4096
  553. #define RXD_MODE_1 0 /* One Buffer mode */
  554. #define RXD_MODE_3B 1 /* Two Buffer mode */
  555. /* Structure to hold virtual addresses of Buf0 and Buf1 in
  556. * 2buf mode. */
  557. struct buffAdd {
  558. void *ba_0_org;
  559. void *ba_1_org;
  560. void *ba_0;
  561. void *ba_1;
  562. };
  563. /* Structure which stores all the MAC control parameters */
  564. /* This structure stores the offset of the RxD in the ring
  565. * from which the Rx Interrupt processor can start picking
  566. * up the RxDs for processing.
  567. */
  568. struct rx_curr_get_info {
  569. u32 block_index;
  570. u32 offset;
  571. u32 ring_len;
  572. };
  573. struct rx_curr_put_info {
  574. u32 block_index;
  575. u32 offset;
  576. u32 ring_len;
  577. };
  578. /* This structure stores the offset of the TxDl in the FIFO
  579. * from which the Tx Interrupt processor can start picking
  580. * up the TxDLs for send complete interrupt processing.
  581. */
  582. struct tx_curr_get_info {
  583. u32 offset;
  584. u32 fifo_len;
  585. };
  586. struct tx_curr_put_info {
  587. u32 offset;
  588. u32 fifo_len;
  589. };
  590. struct rxd_info {
  591. void *virt_addr;
  592. dma_addr_t dma_addr;
  593. };
  594. /* Structure that holds the Phy and virt addresses of the Blocks */
  595. struct rx_block_info {
  596. void *block_virt_addr;
  597. dma_addr_t block_dma_addr;
  598. struct rxd_info *rxds;
  599. };
  600. /* Data structure to represent a LRO session */
  601. struct lro {
  602. struct sk_buff *parent;
  603. struct sk_buff *last_frag;
  604. u8 *l2h;
  605. struct iphdr *iph;
  606. struct tcphdr *tcph;
  607. u32 tcp_next_seq;
  608. __be32 tcp_ack;
  609. int total_len;
  610. int frags_len;
  611. int sg_num;
  612. int in_use;
  613. __be16 window;
  614. u16 vlan_tag;
  615. u32 cur_tsval;
  616. __be32 cur_tsecr;
  617. u8 saw_ts;
  618. } ____cacheline_aligned;
  619. /* Ring specific structure */
  620. struct ring_info {
  621. /* The ring number */
  622. int ring_no;
  623. /* per-ring buffer counter */
  624. u32 rx_bufs_left;
  625. #define MAX_LRO_SESSIONS 32
  626. struct lro lro0_n[MAX_LRO_SESSIONS];
  627. u8 lro;
  628. /* copy of sp->rxd_mode flag */
  629. int rxd_mode;
  630. /* Number of rxds per block for the rxd_mode */
  631. int rxd_count;
  632. /* copy of sp pointer */
  633. struct s2io_nic *nic;
  634. /* copy of sp->dev pointer */
  635. struct net_device *dev;
  636. /* copy of sp->pdev pointer */
  637. struct pci_dev *pdev;
  638. /* Per ring napi struct */
  639. struct napi_struct napi;
  640. unsigned long interrupt_count;
  641. /*
  642. * Place holders for the virtual and physical addresses of
  643. * all the Rx Blocks
  644. */
  645. struct rx_block_info rx_blocks[MAX_RX_BLOCKS_PER_RING];
  646. int block_count;
  647. int pkt_cnt;
  648. /*
  649. * Put pointer info which indictes which RxD has to be replenished
  650. * with a new buffer.
  651. */
  652. struct rx_curr_put_info rx_curr_put_info;
  653. /*
  654. * Get pointer info which indictes which is the last RxD that was
  655. * processed by the driver.
  656. */
  657. struct rx_curr_get_info rx_curr_get_info;
  658. /* interface MTU value */
  659. unsigned mtu;
  660. /* Buffer Address store. */
  661. struct buffAdd **ba;
  662. /* per-Ring statistics */
  663. unsigned long rx_packets;
  664. unsigned long rx_bytes;
  665. } ____cacheline_aligned;
  666. /* Fifo specific structure */
  667. struct fifo_info {
  668. /* FIFO number */
  669. int fifo_no;
  670. /* Maximum TxDs per TxDL */
  671. int max_txds;
  672. /* Place holder of all the TX List's Phy and Virt addresses. */
  673. struct list_info_hold *list_info;
  674. /*
  675. * Current offset within the tx FIFO where driver would write
  676. * new Tx frame
  677. */
  678. struct tx_curr_put_info tx_curr_put_info;
  679. /*
  680. * Current offset within tx FIFO from where the driver would start freeing
  681. * the buffers
  682. */
  683. struct tx_curr_get_info tx_curr_get_info;
  684. #define FIFO_QUEUE_START 0
  685. #define FIFO_QUEUE_STOP 1
  686. int queue_state;
  687. /* copy of sp->dev pointer */
  688. struct net_device *dev;
  689. /* copy of multiq status */
  690. u8 multiq;
  691. /* Per fifo lock */
  692. spinlock_t tx_lock;
  693. /* Per fifo UFO in band structure */
  694. u64 *ufo_in_band_v;
  695. struct s2io_nic *nic;
  696. } ____cacheline_aligned;
  697. /* Information related to the Tx and Rx FIFOs and Rings of Xena
  698. * is maintained in this structure.
  699. */
  700. struct mac_info {
  701. /* tx side stuff */
  702. /* logical pointer of start of each Tx FIFO */
  703. struct TxFIFO_element __iomem *tx_FIFO_start[MAX_TX_FIFOS];
  704. /* Fifo specific structure */
  705. struct fifo_info fifos[MAX_TX_FIFOS];
  706. /* Save virtual address of TxD page with zero DMA addr(if any) */
  707. void *zerodma_virt_addr;
  708. /* rx side stuff */
  709. /* Ring specific structure */
  710. struct ring_info rings[MAX_RX_RINGS];
  711. u16 rmac_pause_time;
  712. u16 mc_pause_threshold_q0q3;
  713. u16 mc_pause_threshold_q4q7;
  714. void *stats_mem; /* orignal pointer to allocated mem */
  715. dma_addr_t stats_mem_phy; /* Physical address of the stat block */
  716. u32 stats_mem_sz;
  717. struct stat_block *stats_info; /* Logical address of the stat block */
  718. };
  719. /* structure representing the user defined MAC addresses */
  720. struct usr_addr {
  721. char addr[ETH_ALEN];
  722. int usage_cnt;
  723. };
  724. /* Default Tunable parameters of the NIC. */
  725. #define DEFAULT_FIFO_0_LEN 4096
  726. #define DEFAULT_FIFO_1_7_LEN 512
  727. #define SMALL_BLK_CNT 30
  728. #define LARGE_BLK_CNT 100
  729. /*
  730. * Structure to keep track of the MSI-X vectors and the corresponding
  731. * argument registered against each vector
  732. */
  733. #define MAX_REQUESTED_MSI_X 9
  734. struct s2io_msix_entry
  735. {
  736. u16 vector;
  737. u16 entry;
  738. void *arg;
  739. u8 type;
  740. #define MSIX_ALARM_TYPE 1
  741. #define MSIX_RING_TYPE 2
  742. u8 in_use;
  743. #define MSIX_REGISTERED_SUCCESS 0xAA
  744. };
  745. struct msix_info_st {
  746. u64 addr;
  747. u64 data;
  748. };
  749. /* These flags represent the devices temporary state */
  750. enum s2io_device_state_t
  751. {
  752. __S2IO_STATE_LINK_TASK=0,
  753. __S2IO_STATE_CARD_UP
  754. };
  755. /* Structure representing one instance of the NIC */
  756. struct s2io_nic {
  757. int rxd_mode;
  758. /*
  759. * Count of packets to be processed in a given iteration, it will be indicated
  760. * by the quota field of the device structure when NAPI is enabled.
  761. */
  762. int pkts_to_process;
  763. struct net_device *dev;
  764. struct mac_info mac_control;
  765. struct config_param config;
  766. struct pci_dev *pdev;
  767. void __iomem *bar0;
  768. void __iomem *bar1;
  769. #define MAX_MAC_SUPPORTED 16
  770. #define MAX_SUPPORTED_MULTICASTS MAX_MAC_SUPPORTED
  771. struct mac_addr def_mac_addr[256];
  772. struct net_device_stats stats;
  773. int high_dma_flag;
  774. int device_enabled_once;
  775. char name[60];
  776. /* Timer that handles I/O errors/exceptions */
  777. struct timer_list alarm_timer;
  778. /* Space to back up the PCI config space */
  779. u32 config_space[256 / sizeof(u32)];
  780. #define PROMISC 1
  781. #define ALL_MULTI 2
  782. #define MAX_ADDRS_SUPPORTED 64
  783. u16 usr_addr_count;
  784. u16 mc_addr_count;
  785. struct usr_addr usr_addrs[256];
  786. u16 m_cast_flg;
  787. u16 all_multi_pos;
  788. u16 promisc_flg;
  789. /* Id timer, used to blink NIC to physically identify NIC. */
  790. struct timer_list id_timer;
  791. /* Restart timer, used to restart NIC if the device is stuck and
  792. * a schedule task that will set the correct Link state once the
  793. * NIC's PHY has stabilized after a state change.
  794. */
  795. struct work_struct rst_timer_task;
  796. struct work_struct set_link_task;
  797. /* Flag that can be used to turn on or turn off the Rx checksum
  798. * offload feature.
  799. */
  800. int rx_csum;
  801. /* Below variables are used for fifo selection to transmit a packet */
  802. u16 fifo_selector[MAX_TX_FIFOS];
  803. /* Total fifos for tcp packets */
  804. u8 total_tcp_fifos;
  805. /*
  806. * Beginning index of udp for udp packets
  807. * Value will be equal to
  808. * (tx_fifo_num - FIFO_UDP_MAX_NUM - FIFO_OTHER_MAX_NUM)
  809. */
  810. u8 udp_fifo_idx;
  811. u8 total_udp_fifos;
  812. /*
  813. * Beginning index of fifo for all other packets
  814. * Value will be equal to (tx_fifo_num - FIFO_OTHER_MAX_NUM)
  815. */
  816. u8 other_fifo_idx;
  817. struct napi_struct napi;
  818. /* after blink, the adapter must be restored with original
  819. * values.
  820. */
  821. u64 adapt_ctrl_org;
  822. /* Last known link state. */
  823. u16 last_link_state;
  824. #define LINK_DOWN 1
  825. #define LINK_UP 2
  826. int task_flag;
  827. unsigned long long start_time;
  828. struct vlan_group *vlgrp;
  829. int vlan_strip_flag;
  830. #define MSIX_FLG 0xA5
  831. int num_entries;
  832. struct msix_entry *entries;
  833. int msi_detected;
  834. wait_queue_head_t msi_wait;
  835. struct s2io_msix_entry *s2io_entries;
  836. char desc[MAX_REQUESTED_MSI_X][25];
  837. int avail_msix_vectors; /* No. of MSI-X vectors granted by system */
  838. struct msix_info_st msix_info[0x3f];
  839. #define XFRAME_I_DEVICE 1
  840. #define XFRAME_II_DEVICE 2
  841. u8 device_type;
  842. unsigned long clubbed_frms_cnt;
  843. unsigned long sending_both;
  844. u8 lro;
  845. u16 lro_max_aggr_per_sess;
  846. volatile unsigned long state;
  847. u64 general_int_mask;
  848. #define VPD_STRING_LEN 80
  849. u8 product_name[VPD_STRING_LEN];
  850. u8 serial_num[VPD_STRING_LEN];
  851. };
  852. #define RESET_ERROR 1;
  853. #define CMD_ERROR 2;
  854. /* OS related system calls */
  855. #ifndef readq
  856. static inline u64 readq(void __iomem *addr)
  857. {
  858. u64 ret = 0;
  859. ret = readl(addr + 4);
  860. ret <<= 32;
  861. ret |= readl(addr);
  862. return ret;
  863. }
  864. #endif
  865. #ifndef writeq
  866. static inline void writeq(u64 val, void __iomem *addr)
  867. {
  868. writel((u32) (val), addr);
  869. writel((u32) (val >> 32), (addr + 4));
  870. }
  871. #endif
  872. /*
  873. * Some registers have to be written in a particular order to
  874. * expect correct hardware operation. The macro SPECIAL_REG_WRITE
  875. * is used to perform such ordered writes. Defines UF (Upper First)
  876. * and LF (Lower First) will be used to specify the required write order.
  877. */
  878. #define UF 1
  879. #define LF 2
  880. static inline void SPECIAL_REG_WRITE(u64 val, void __iomem *addr, int order)
  881. {
  882. u32 ret;
  883. if (order == LF) {
  884. writel((u32) (val), addr);
  885. ret = readl(addr);
  886. writel((u32) (val >> 32), (addr + 4));
  887. ret = readl(addr + 4);
  888. } else {
  889. writel((u32) (val >> 32), (addr + 4));
  890. ret = readl(addr + 4);
  891. writel((u32) (val), addr);
  892. ret = readl(addr);
  893. }
  894. }
  895. /* Interrupt related values of Xena */
  896. #define ENABLE_INTRS 1
  897. #define DISABLE_INTRS 2
  898. /* Highest level interrupt blocks */
  899. #define TX_PIC_INTR (0x0001<<0)
  900. #define TX_DMA_INTR (0x0001<<1)
  901. #define TX_MAC_INTR (0x0001<<2)
  902. #define TX_XGXS_INTR (0x0001<<3)
  903. #define TX_TRAFFIC_INTR (0x0001<<4)
  904. #define RX_PIC_INTR (0x0001<<5)
  905. #define RX_DMA_INTR (0x0001<<6)
  906. #define RX_MAC_INTR (0x0001<<7)
  907. #define RX_XGXS_INTR (0x0001<<8)
  908. #define RX_TRAFFIC_INTR (0x0001<<9)
  909. #define MC_INTR (0x0001<<10)
  910. #define ENA_ALL_INTRS ( TX_PIC_INTR | \
  911. TX_DMA_INTR | \
  912. TX_MAC_INTR | \
  913. TX_XGXS_INTR | \
  914. TX_TRAFFIC_INTR | \
  915. RX_PIC_INTR | \
  916. RX_DMA_INTR | \
  917. RX_MAC_INTR | \
  918. RX_XGXS_INTR | \
  919. RX_TRAFFIC_INTR | \
  920. MC_INTR )
  921. /* Interrupt masks for the general interrupt mask register */
  922. #define DISABLE_ALL_INTRS 0xFFFFFFFFFFFFFFFFULL
  923. #define TXPIC_INT_M s2BIT(0)
  924. #define TXDMA_INT_M s2BIT(1)
  925. #define TXMAC_INT_M s2BIT(2)
  926. #define TXXGXS_INT_M s2BIT(3)
  927. #define TXTRAFFIC_INT_M s2BIT(8)
  928. #define PIC_RX_INT_M s2BIT(32)
  929. #define RXDMA_INT_M s2BIT(33)
  930. #define RXMAC_INT_M s2BIT(34)
  931. #define MC_INT_M s2BIT(35)
  932. #define RXXGXS_INT_M s2BIT(36)
  933. #define RXTRAFFIC_INT_M s2BIT(40)
  934. /* PIC level Interrupts TODO*/
  935. /* DMA level Inressupts */
  936. #define TXDMA_PFC_INT_M s2BIT(0)
  937. #define TXDMA_PCC_INT_M s2BIT(2)
  938. /* PFC block interrupts */
  939. #define PFC_MISC_ERR_1 s2BIT(0) /* Interrupt to indicate FIFO full */
  940. /* PCC block interrupts. */
  941. #define PCC_FB_ECC_ERR vBIT(0xff, 16, 8) /* Interrupt to indicate
  942. PCC_FB_ECC Error. */
  943. #define RXD_GET_VLAN_TAG(Control_2) (u16)(Control_2 & MASK_VLAN_TAG)
  944. /*
  945. * Prototype declaration.
  946. */
  947. static int __devinit s2io_init_nic(struct pci_dev *pdev,
  948. const struct pci_device_id *pre);
  949. static void __devexit s2io_rem_nic(struct pci_dev *pdev);
  950. static int init_shared_mem(struct s2io_nic *sp);
  951. static void free_shared_mem(struct s2io_nic *sp);
  952. static int init_nic(struct s2io_nic *nic);
  953. static int rx_intr_handler(struct ring_info *ring_data, int budget);
  954. static void s2io_txpic_intr_handle(struct s2io_nic *sp);
  955. static void tx_intr_handler(struct fifo_info *fifo_data);
  956. static void s2io_handle_errors(void * dev_id);
  957. static int s2io_starter(void);
  958. static void s2io_closer(void);
  959. static void s2io_tx_watchdog(struct net_device *dev);
  960. static void s2io_set_multicast(struct net_device *dev);
  961. static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp);
  962. static void s2io_link(struct s2io_nic * sp, int link);
  963. static void s2io_reset(struct s2io_nic * sp);
  964. static int s2io_poll_msix(struct napi_struct *napi, int budget);
  965. static int s2io_poll_inta(struct napi_struct *napi, int budget);
  966. static void s2io_init_pci(struct s2io_nic * sp);
  967. static int do_s2io_prog_unicast(struct net_device *dev, u8 *addr);
  968. static void s2io_alarm_handle(unsigned long data);
  969. static irqreturn_t
  970. s2io_msix_ring_handle(int irq, void *dev_id);
  971. static irqreturn_t
  972. s2io_msix_fifo_handle(int irq, void *dev_id);
  973. static irqreturn_t s2io_isr(int irq, void *dev_id);
  974. static int verify_xena_quiescence(struct s2io_nic *sp);
  975. static const struct ethtool_ops netdev_ethtool_ops;
  976. static void s2io_set_link(struct work_struct *work);
  977. static int s2io_set_swapper(struct s2io_nic * sp);
  978. static void s2io_card_down(struct s2io_nic *nic);
  979. static int s2io_card_up(struct s2io_nic *nic);
  980. static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
  981. int bit_state);
  982. static int s2io_add_isr(struct s2io_nic * sp);
  983. static void s2io_rem_isr(struct s2io_nic * sp);
  984. static void restore_xmsi_data(struct s2io_nic *nic);
  985. static void do_s2io_store_unicast_mc(struct s2io_nic *sp);
  986. static void do_s2io_restore_unicast_mc(struct s2io_nic *sp);
  987. static u64 do_s2io_read_unicast_mc(struct s2io_nic *sp, int offset);
  988. static int do_s2io_add_mc(struct s2io_nic *sp, u8 *addr);
  989. static int do_s2io_add_mac(struct s2io_nic *sp, u64 addr, int offset);
  990. static int do_s2io_delete_unicast_mc(struct s2io_nic *sp, u64 addr);
  991. static int s2io_club_tcp_session(struct ring_info *ring_data, u8 *buffer,
  992. u8 **tcp, u32 *tcp_len, struct lro **lro, struct RxD_t *rxdp,
  993. struct s2io_nic *sp);
  994. static void clear_lro_session(struct lro *lro);
  995. static void queue_rx_frame(struct sk_buff *skb, u16 vlan_tag);
  996. static void update_L3L4_header(struct s2io_nic *sp, struct lro *lro);
  997. static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
  998. struct sk_buff *skb, u32 tcp_len);
  999. static int rts_ds_steer(struct s2io_nic *nic, u8 ds_codepoint, u8 ring);
  1000. static pci_ers_result_t s2io_io_error_detected(struct pci_dev *pdev,
  1001. pci_channel_state_t state);
  1002. static pci_ers_result_t s2io_io_slot_reset(struct pci_dev *pdev);
  1003. static void s2io_io_resume(struct pci_dev *pdev);
  1004. #define s2io_tcp_mss(skb) skb_shinfo(skb)->gso_size
  1005. #define s2io_udp_mss(skb) skb_shinfo(skb)->gso_size
  1006. #define s2io_offload_type(skb) skb_shinfo(skb)->gso_type
  1007. #define S2IO_PARM_INT(X, def_val) \
  1008. static unsigned int X = def_val;\
  1009. module_param(X , uint, 0);
  1010. #endif /* _S2IO_H */