s2io.h 31 KB

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