diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 136 |
1 files changed, 65 insertions, 71 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 59324b1693d6..e8598b809228 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -239,49 +239,39 @@ extern unsigned long long netxen_dma_mask; | |||
239 | 239 | ||
240 | typedef u32 netxen_ctx_msg; | 240 | typedef u32 netxen_ctx_msg; |
241 | 241 | ||
242 | #define _netxen_set_bits(config_word, start, bits, val) {\ | ||
243 | unsigned long long mask = (((1ULL << (bits)) - 1) << (start)); \ | ||
244 | unsigned long long value = (val); \ | ||
245 | (config_word) &= ~mask; \ | ||
246 | (config_word) |= (((value) << (start)) & mask); \ | ||
247 | } | ||
248 | |||
249 | #define netxen_set_msg_peg_id(config_word, val) \ | 242 | #define netxen_set_msg_peg_id(config_word, val) \ |
250 | _netxen_set_bits(config_word, 0, 2, val) | 243 | ((config_word) &= ~3, (config_word) |= val & 3) |
251 | #define netxen_set_msg_privid(config_word) \ | 244 | #define netxen_set_msg_privid(config_word) \ |
252 | set_bit(2, (unsigned long*)&config_word) | 245 | ((config_word) |= 1 << 2) |
253 | #define netxen_set_msg_count(config_word, val) \ | 246 | #define netxen_set_msg_count(config_word, val) \ |
254 | _netxen_set_bits(config_word, 3, 15, val) | 247 | ((config_word) &= ~(0x7fff<<3), (config_word) |= (val & 0x7fff) << 3) |
255 | #define netxen_set_msg_ctxid(config_word, val) \ | 248 | #define netxen_set_msg_ctxid(config_word, val) \ |
256 | _netxen_set_bits(config_word, 18, 10, val) | 249 | ((config_word) &= ~(0x3ff<<18), (config_word) |= (val & 0x3ff) << 18) |
257 | #define netxen_set_msg_opcode(config_word, val) \ | 250 | #define netxen_set_msg_opcode(config_word, val) \ |
258 | _netxen_set_bits(config_word, 28, 4, val) | 251 | ((config_word) &= ~(0xf<<24), (config_word) |= (val & 0xf) << 24) |
259 | 252 | ||
260 | struct netxen_rcv_context { | 253 | struct netxen_rcv_context { |
261 | u32 rcv_ring_addr_lo; | 254 | __le64 rcv_ring_addr; |
262 | u32 rcv_ring_addr_hi; | 255 | __le32 rcv_ring_size; |
263 | u32 rcv_ring_size; | 256 | __le32 rsrvd; |
264 | u32 rsrvd; | ||
265 | }; | 257 | }; |
266 | 258 | ||
267 | struct netxen_ring_ctx { | 259 | struct netxen_ring_ctx { |
268 | 260 | ||
269 | /* one command ring */ | 261 | /* one command ring */ |
270 | u64 cmd_consumer_offset; | 262 | __le64 cmd_consumer_offset; |
271 | u32 cmd_ring_addr_lo; | 263 | __le64 cmd_ring_addr; |
272 | u32 cmd_ring_addr_hi; | 264 | __le32 cmd_ring_size; |
273 | u32 cmd_ring_size; | 265 | __le32 rsrvd; |
274 | u32 rsrvd; | ||
275 | 266 | ||
276 | /* three receive rings */ | 267 | /* three receive rings */ |
277 | struct netxen_rcv_context rcv_ctx[3]; | 268 | struct netxen_rcv_context rcv_ctx[3]; |
278 | 269 | ||
279 | /* one status ring */ | 270 | /* one status ring */ |
280 | u32 sts_ring_addr_lo; | 271 | __le64 sts_ring_addr; |
281 | u32 sts_ring_addr_hi; | 272 | __le32 sts_ring_size; |
282 | u32 sts_ring_size; | ||
283 | 273 | ||
284 | u32 ctx_id; | 274 | __le32 ctx_id; |
285 | } __attribute__ ((aligned(64))); | 275 | } __attribute__ ((aligned(64))); |
286 | 276 | ||
287 | /* | 277 | /* |
@@ -305,81 +295,85 @@ struct netxen_ring_ctx { | |||
305 | ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) | 295 | ((cmd_desc)->port_ctxid |= ((var) & 0x0F)) |
306 | 296 | ||
307 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ | 297 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ |
308 | _netxen_set_bits((cmd_desc)->flags_opcode, 0, 7, val) | 298 | ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x7f), \ |
299 | (cmd_desc)->flags_opcode |= cpu_to_le16((val) & 0x7f)) | ||
309 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ | 300 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ |
310 | _netxen_set_bits((cmd_desc)->flags_opcode, 7, 6, val) | 301 | ((cmd_desc)->flags_opcode &= ~cpu_to_le16(0x3f<<7), \ |
302 | (cmd_desc)->flags_opcode |= cpu_to_le16((val) & (0x3f<<7))) | ||
311 | 303 | ||
312 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ | 304 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ |
313 | _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 0, 8, val); | 305 | ((cmd_desc)->num_of_buffers_total_length &= ~cpu_to_le32(0xff), \ |
306 | (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32((val) & 0xff)) | ||
314 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | 307 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ |
315 | _netxen_set_bits((cmd_desc)->num_of_buffers_total_length, 8, 24, val); | 308 | ((cmd_desc)->num_of_buffers_total_length &= cpu_to_le32(0xff), \ |
309 | (cmd_desc)->num_of_buffers_total_length |= cpu_to_le32(val << 24)) | ||
316 | 310 | ||
317 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | 311 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ |
318 | (((cmd_desc)->flags_opcode >> 7) & 0x003F) | 312 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003F) |
319 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | 313 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ |
320 | (((cmd_desc)->num_of_buffers_total_length >> 8) & 0x0FFFFFF) | 314 | (le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) |
321 | 315 | ||
322 | struct cmd_desc_type0 { | 316 | struct cmd_desc_type0 { |
323 | u8 tcp_hdr_offset; /* For LSO only */ | 317 | u8 tcp_hdr_offset; /* For LSO only */ |
324 | u8 ip_hdr_offset; /* For LSO only */ | 318 | u8 ip_hdr_offset; /* For LSO only */ |
325 | /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */ | 319 | /* Bit pattern: 0-6 flags, 7-12 opcode, 13-15 unused */ |
326 | u16 flags_opcode; | 320 | __le16 flags_opcode; |
327 | /* Bit pattern: 0-7 total number of segments, | 321 | /* Bit pattern: 0-7 total number of segments, |
328 | 8-31 Total size of the packet */ | 322 | 8-31 Total size of the packet */ |
329 | u32 num_of_buffers_total_length; | 323 | __le32 num_of_buffers_total_length; |
330 | union { | 324 | union { |
331 | struct { | 325 | struct { |
332 | u32 addr_low_part2; | 326 | __le32 addr_low_part2; |
333 | u32 addr_high_part2; | 327 | __le32 addr_high_part2; |
334 | }; | 328 | }; |
335 | u64 addr_buffer2; | 329 | __le64 addr_buffer2; |
336 | }; | 330 | }; |
337 | 331 | ||
338 | u16 reference_handle; /* changed to u16 to add mss */ | 332 | __le16 reference_handle; /* changed to u16 to add mss */ |
339 | u16 mss; /* passed by NDIS_PACKET for LSO */ | 333 | __le16 mss; /* passed by NDIS_PACKET for LSO */ |
340 | /* Bit pattern 0-3 port, 0-3 ctx id */ | 334 | /* Bit pattern 0-3 port, 0-3 ctx id */ |
341 | u8 port_ctxid; | 335 | u8 port_ctxid; |
342 | u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ | 336 | u8 total_hdr_length; /* LSO only : MAC+IP+TCP Hdr size */ |
343 | u16 conn_id; /* IPSec offoad only */ | 337 | __le16 conn_id; /* IPSec offoad only */ |
344 | 338 | ||
345 | union { | 339 | union { |
346 | struct { | 340 | struct { |
347 | u32 addr_low_part3; | 341 | __le32 addr_low_part3; |
348 | u32 addr_high_part3; | 342 | __le32 addr_high_part3; |
349 | }; | 343 | }; |
350 | u64 addr_buffer3; | 344 | __le64 addr_buffer3; |
351 | }; | 345 | }; |
352 | union { | 346 | union { |
353 | struct { | 347 | struct { |
354 | u32 addr_low_part1; | 348 | __le32 addr_low_part1; |
355 | u32 addr_high_part1; | 349 | __le32 addr_high_part1; |
356 | }; | 350 | }; |
357 | u64 addr_buffer1; | 351 | __le64 addr_buffer1; |
358 | }; | 352 | }; |
359 | 353 | ||
360 | u16 buffer1_length; | 354 | __le16 buffer1_length; |
361 | u16 buffer2_length; | 355 | __le16 buffer2_length; |
362 | u16 buffer3_length; | 356 | __le16 buffer3_length; |
363 | u16 buffer4_length; | 357 | __le16 buffer4_length; |
364 | 358 | ||
365 | union { | 359 | union { |
366 | struct { | 360 | struct { |
367 | u32 addr_low_part4; | 361 | __le32 addr_low_part4; |
368 | u32 addr_high_part4; | 362 | __le32 addr_high_part4; |
369 | }; | 363 | }; |
370 | u64 addr_buffer4; | 364 | __le64 addr_buffer4; |
371 | }; | 365 | }; |
372 | 366 | ||
373 | u64 unused; | 367 | __le64 unused; |
374 | 368 | ||
375 | } __attribute__ ((aligned(64))); | 369 | } __attribute__ ((aligned(64))); |
376 | 370 | ||
377 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ | 371 | /* Note: sizeof(rcv_desc) should always be a mutliple of 2 */ |
378 | struct rcv_desc { | 372 | struct rcv_desc { |
379 | u16 reference_handle; | 373 | __le16 reference_handle; |
380 | u16 reserved; | 374 | __le16 reserved; |
381 | u32 buffer_length; /* allocated buffer length (usually 2K) */ | 375 | __le32 buffer_length; /* allocated buffer length (usually 2K) */ |
382 | u64 addr_buffer; | 376 | __le64 addr_buffer; |
383 | }; | 377 | }; |
384 | 378 | ||
385 | /* opcode field in status_desc */ | 379 | /* opcode field in status_desc */ |
@@ -405,36 +399,36 @@ struct rcv_desc { | |||
405 | (((status_desc)->lro & 0x80) >> 7) | 399 | (((status_desc)->lro & 0x80) >> 7) |
406 | 400 | ||
407 | #define netxen_get_sts_port(status_desc) \ | 401 | #define netxen_get_sts_port(status_desc) \ |
408 | ((status_desc)->status_desc_data & 0x0F) | 402 | (le64_to_cpu((status_desc)->status_desc_data) & 0x0F) |
409 | #define netxen_get_sts_status(status_desc) \ | 403 | #define netxen_get_sts_status(status_desc) \ |
410 | (((status_desc)->status_desc_data >> 4) & 0x0F) | 404 | ((le64_to_cpu((status_desc)->status_desc_data) >> 4) & 0x0F) |
411 | #define netxen_get_sts_type(status_desc) \ | 405 | #define netxen_get_sts_type(status_desc) \ |
412 | (((status_desc)->status_desc_data >> 8) & 0x0F) | 406 | ((le64_to_cpu((status_desc)->status_desc_data) >> 8) & 0x0F) |
413 | #define netxen_get_sts_totallength(status_desc) \ | 407 | #define netxen_get_sts_totallength(status_desc) \ |
414 | (((status_desc)->status_desc_data >> 12) & 0xFFFF) | 408 | ((le64_to_cpu((status_desc)->status_desc_data) >> 12) & 0xFFFF) |
415 | #define netxen_get_sts_refhandle(status_desc) \ | 409 | #define netxen_get_sts_refhandle(status_desc) \ |
416 | (((status_desc)->status_desc_data >> 28) & 0xFFFF) | 410 | ((le64_to_cpu((status_desc)->status_desc_data) >> 28) & 0xFFFF) |
417 | #define netxen_get_sts_prot(status_desc) \ | 411 | #define netxen_get_sts_prot(status_desc) \ |
418 | (((status_desc)->status_desc_data >> 44) & 0x0F) | 412 | ((le64_to_cpu((status_desc)->status_desc_data) >> 44) & 0x0F) |
419 | #define netxen_get_sts_owner(status_desc) \ | 413 | #define netxen_get_sts_owner(status_desc) \ |
420 | (((status_desc)->status_desc_data >> 56) & 0x03) | 414 | ((le64_to_cpu((status_desc)->status_desc_data) >> 56) & 0x03) |
421 | #define netxen_get_sts_opcode(status_desc) \ | 415 | #define netxen_get_sts_opcode(status_desc) \ |
422 | (((status_desc)->status_desc_data >> 58) & 0x03F) | 416 | ((le64_to_cpu((status_desc)->status_desc_data) >> 58) & 0x03F) |
423 | 417 | ||
424 | #define netxen_clear_sts_owner(status_desc) \ | 418 | #define netxen_clear_sts_owner(status_desc) \ |
425 | ((status_desc)->status_desc_data &= \ | 419 | ((status_desc)->status_desc_data &= \ |
426 | ~(((unsigned long long)3) << 56 )) | 420 | ~cpu_to_le64(((unsigned long long)3) << 56 )) |
427 | #define netxen_set_sts_owner(status_desc, val) \ | 421 | #define netxen_set_sts_owner(status_desc, val) \ |
428 | ((status_desc)->status_desc_data |= \ | 422 | ((status_desc)->status_desc_data |= \ |
429 | (((unsigned long long)((val) & 0x3)) << 56 )) | 423 | cpu_to_le64(((unsigned long long)((val) & 0x3)) << 56 )) |
430 | 424 | ||
431 | struct status_desc { | 425 | struct status_desc { |
432 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length | 426 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length |
433 | 28-43 reference_handle, 44-47 protocol, 48-52 unused | 427 | 28-43 reference_handle, 44-47 protocol, 48-52 unused |
434 | 53-55 desc_cnt, 56-57 owner, 58-63 opcode | 428 | 53-55 desc_cnt, 56-57 owner, 58-63 opcode |
435 | */ | 429 | */ |
436 | u64 status_desc_data; | 430 | __le64 status_desc_data; |
437 | u32 hash_value; | 431 | __le32 hash_value; |
438 | u8 hash_type; | 432 | u8 hash_type; |
439 | u8 msg_type; | 433 | u8 msg_type; |
440 | u8 unused; | 434 | u8 unused; |
@@ -1005,9 +999,9 @@ void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, int port, | |||
1005 | void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, | 999 | void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, int port, |
1006 | long enable); | 1000 | long enable); |
1007 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg, | 1001 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, long reg, |
1008 | __le32 * readval); | 1002 | __u32 * readval); |
1009 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, | 1003 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, |
1010 | long reg, __le32 val); | 1004 | long reg, __u32 val); |
1011 | 1005 | ||
1012 | /* Functions available from netxen_nic_hw.c */ | 1006 | /* Functions available from netxen_nic_hw.c */ |
1013 | int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); | 1007 | int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); |