aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic.h
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-04-07 18:50:38 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-08 18:58:24 -0400
commite98e3350c03af4187e1d5fe007c7b460e378990c (patch)
tree5245bf0e0662ab27d1f8b33e629e4b0d118aa189 /drivers/net/netxen/netxen_nic.h
parent577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff)
netxen: code cleanup
o remove unused structure defs. o remove unnecessary includes. o replace enums with specific #defines. o reduce footprint of stats structure. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r--drivers/net/netxen/netxen_nic.h246
1 files changed, 87 insertions, 159 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index c40815169f3..184eb6f76d5 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -34,10 +34,6 @@
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/kernel.h> 35#include <linux/kernel.h>
36#include <linux/types.h> 36#include <linux/types.h>
37#include <linux/compiler.h>
38#include <linux/slab.h>
39#include <linux/delay.h>
40#include <linux/init.h>
41#include <linux/ioport.h> 37#include <linux/ioport.h>
42#include <linux/pci.h> 38#include <linux/pci.h>
43#include <linux/netdevice.h> 39#include <linux/netdevice.h>
@@ -49,18 +45,12 @@
49 45
50#include <linux/ethtool.h> 46#include <linux/ethtool.h>
51#include <linux/mii.h> 47#include <linux/mii.h>
52#include <linux/interrupt.h>
53#include <linux/timer.h> 48#include <linux/timer.h>
54 49
55#include <linux/mm.h>
56#include <linux/mman.h>
57#include <linux/vmalloc.h> 50#include <linux/vmalloc.h>
58 51
59#include <asm/system.h>
60#include <asm/io.h> 52#include <asm/io.h>
61#include <asm/byteorder.h> 53#include <asm/byteorder.h>
62#include <asm/uaccess.h>
63#include <asm/pgtable.h>
64 54
65#include "netxen_nic_hw.h" 55#include "netxen_nic_hw.h"
66 56
@@ -118,6 +108,7 @@
118#define NX_P3_A2 0x30 108#define NX_P3_A2 0x30
119#define NX_P3_B0 0x40 109#define NX_P3_B0 0x40
120#define NX_P3_B1 0x41 110#define NX_P3_B1 0x41
111#define NX_P3_B2 0x42
121 112
122#define NX_IS_REVISION_P2(REVISION) (REVISION <= NX_P2_C1) 113#define NX_IS_REVISION_P2(REVISION) (REVISION <= NX_P2_C1)
123#define NX_IS_REVISION_P3(REVISION) (REVISION >= NX_P3_A0) 114#define NX_IS_REVISION_P3(REVISION) (REVISION >= NX_P3_A0)
@@ -203,18 +194,8 @@
203#define MAX_RCV_DESCRIPTORS_10G 4096 194#define MAX_RCV_DESCRIPTORS_10G 4096
204#define MAX_JUMBO_RCV_DESCRIPTORS 1024 195#define MAX_JUMBO_RCV_DESCRIPTORS 1024
205#define MAX_LRO_RCV_DESCRIPTORS 8 196#define MAX_LRO_RCV_DESCRIPTORS 8
206#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
207#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
208#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
209#define MAX_RCVSTATUS_DESC MAX_RCV_DESCRIPTORS
210#define MAX_EPG_DESCRIPTORS (MAX_CMD_DESCRIPTORS * 8)
211#define NUM_RCV_DESC (MAX_RCV_DESC + MAX_JUMBO_RCV_DESCRIPTORS + \
212 MAX_LRO_RCV_DESCRIPTORS)
213#define MIN_TX_COUNT 4096
214#define MIN_RX_COUNT 4096
215#define NETXEN_CTX_SIGNATURE 0xdee0 197#define NETXEN_CTX_SIGNATURE 0xdee0
216#define NETXEN_RCV_PRODUCER(ringid) (ringid) 198#define NETXEN_RCV_PRODUCER(ringid) (ringid)
217#define MAX_FRAME_SIZE 0x10000 /* 64K MAX size for LSO */
218 199
219#define PHAN_PEG_RCV_INITIALIZED 0xff01 200#define PHAN_PEG_RCV_INITIALIZED 0xff01
220#define PHAN_PEG_RCV_START_INITIALIZE 0xff00 201#define PHAN_PEG_RCV_START_INITIALIZE 0xff00
@@ -384,11 +365,6 @@ struct rcv_desc {
384 365
385/* Note: sizeof(status_desc) should always be a mutliple of 2 */ 366/* Note: sizeof(status_desc) should always be a mutliple of 2 */
386 367
387#define netxen_get_sts_desc_lro_cnt(status_desc) \
388 ((status_desc)->lro & 0x7F)
389#define netxen_get_sts_desc_lro_last_frag(status_desc) \
390 (((status_desc)->lro & 0x80) >> 7)
391
392#define netxen_get_sts_port(sts_data) \ 368#define netxen_get_sts_port(sts_data) \
393 ((sts_data) & 0x0F) 369 ((sts_data) & 0x0F)
394#define netxen_get_sts_status(sts_data) \ 370#define netxen_get_sts_status(sts_data) \
@@ -434,10 +410,6 @@ struct status_desc {
434 }; 410 };
435} __attribute__ ((aligned(16))); 411} __attribute__ ((aligned(16)));
436 412
437enum {
438 NETXEN_RCV_PEG_0 = 0,
439 NETXEN_RCV_PEG_1
440};
441/* The version of the main data structure */ 413/* The version of the main data structure */
442#define NETXEN_BDINFO_VERSION 1 414#define NETXEN_BDINFO_VERSION 1
443 415
@@ -447,85 +419,35 @@ enum {
447/* Max number of Gig ports on a Phantom board */ 419/* Max number of Gig ports on a Phantom board */
448#define NETXEN_MAX_PORTS 4 420#define NETXEN_MAX_PORTS 4
449 421
450typedef enum { 422#define NETXEN_BRDTYPE_P1_BD 0x0000
451 NETXEN_BRDTYPE_P1_BD = 0x0000, 423#define NETXEN_BRDTYPE_P1_SB 0x0001
452 NETXEN_BRDTYPE_P1_SB = 0x0001, 424#define NETXEN_BRDTYPE_P1_SMAX 0x0002
453 NETXEN_BRDTYPE_P1_SMAX = 0x0002, 425#define NETXEN_BRDTYPE_P1_SOCK 0x0003
454 NETXEN_BRDTYPE_P1_SOCK = 0x0003, 426
455 427#define NETXEN_BRDTYPE_P2_SOCK_31 0x0008
456 NETXEN_BRDTYPE_P2_SOCK_31 = 0x0008, 428#define NETXEN_BRDTYPE_P2_SOCK_35 0x0009
457 NETXEN_BRDTYPE_P2_SOCK_35 = 0x0009, 429#define NETXEN_BRDTYPE_P2_SB35_4G 0x000a
458 NETXEN_BRDTYPE_P2_SB35_4G = 0x000a, 430#define NETXEN_BRDTYPE_P2_SB31_10G 0x000b
459 NETXEN_BRDTYPE_P2_SB31_10G = 0x000b, 431#define NETXEN_BRDTYPE_P2_SB31_2G 0x000c
460 NETXEN_BRDTYPE_P2_SB31_2G = 0x000c, 432
461 433#define NETXEN_BRDTYPE_P2_SB31_10G_IMEZ 0x000d
462 NETXEN_BRDTYPE_P2_SB31_10G_IMEZ = 0x000d, 434#define NETXEN_BRDTYPE_P2_SB31_10G_HMEZ 0x000e
463 NETXEN_BRDTYPE_P2_SB31_10G_HMEZ = 0x000e, 435#define NETXEN_BRDTYPE_P2_SB31_10G_CX4 0x000f
464 NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f, 436
465 437#define NETXEN_BRDTYPE_P3_REF_QG 0x0021
466 NETXEN_BRDTYPE_P3_REF_QG = 0x0021, 438#define NETXEN_BRDTYPE_P3_HMEZ 0x0022
467 NETXEN_BRDTYPE_P3_HMEZ = 0x0022, 439#define NETXEN_BRDTYPE_P3_10G_CX4_LP 0x0023
468 NETXEN_BRDTYPE_P3_10G_CX4_LP = 0x0023, 440#define NETXEN_BRDTYPE_P3_4_GB 0x0024
469 NETXEN_BRDTYPE_P3_4_GB = 0x0024, 441#define NETXEN_BRDTYPE_P3_IMEZ 0x0025
470 NETXEN_BRDTYPE_P3_IMEZ = 0x0025, 442#define NETXEN_BRDTYPE_P3_10G_SFP_PLUS 0x0026
471 NETXEN_BRDTYPE_P3_10G_SFP_PLUS = 0x0026, 443#define NETXEN_BRDTYPE_P3_10000_BASE_T 0x0027
472 NETXEN_BRDTYPE_P3_10000_BASE_T = 0x0027, 444#define NETXEN_BRDTYPE_P3_XG_LOM 0x0028
473 NETXEN_BRDTYPE_P3_XG_LOM = 0x0028, 445#define NETXEN_BRDTYPE_P3_4_GB_MM 0x0029
474 NETXEN_BRDTYPE_P3_4_GB_MM = 0x0029, 446#define NETXEN_BRDTYPE_P3_10G_SFP_CT 0x002a
475 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, 447#define NETXEN_BRDTYPE_P3_10G_SFP_QT 0x002b
476 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, 448#define NETXEN_BRDTYPE_P3_10G_CX4 0x0031
477 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, 449#define NETXEN_BRDTYPE_P3_10G_XFP 0x0032
478 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032, 450#define NETXEN_BRDTYPE_P3_10G_TP 0x0080
479 NETXEN_BRDTYPE_P3_10G_TP = 0x0080
480
481} netxen_brdtype_t;
482
483typedef enum {
484 NETXEN_BRDMFG_INVENTEC = 1
485} netxen_brdmfg;
486
487typedef enum {
488 MEM_ORG_128Mbx4 = 0x0, /* DDR1 only */
489 MEM_ORG_128Mbx8 = 0x1, /* DDR1 only */
490 MEM_ORG_128Mbx16 = 0x2, /* DDR1 only */
491 MEM_ORG_256Mbx4 = 0x3,
492 MEM_ORG_256Mbx8 = 0x4,
493 MEM_ORG_256Mbx16 = 0x5,
494 MEM_ORG_512Mbx4 = 0x6,
495 MEM_ORG_512Mbx8 = 0x7,
496 MEM_ORG_512Mbx16 = 0x8,
497 MEM_ORG_1Gbx4 = 0x9,
498 MEM_ORG_1Gbx8 = 0xa,
499 MEM_ORG_1Gbx16 = 0xb,
500 MEM_ORG_2Gbx4 = 0xc,
501 MEM_ORG_2Gbx8 = 0xd,
502 MEM_ORG_2Gbx16 = 0xe,
503 MEM_ORG_128Mbx32 = 0x10002, /* GDDR only */
504 MEM_ORG_256Mbx32 = 0x10005 /* GDDR only */
505} netxen_mn_mem_org_t;
506
507typedef enum {
508 MEM_ORG_512Kx36 = 0x0,
509 MEM_ORG_1Mx36 = 0x1,
510 MEM_ORG_2Mx36 = 0x2
511} netxen_sn_mem_org_t;
512
513typedef enum {
514 MEM_DEPTH_4MB = 0x1,
515 MEM_DEPTH_8MB = 0x2,
516 MEM_DEPTH_16MB = 0x3,
517 MEM_DEPTH_32MB = 0x4,
518 MEM_DEPTH_64MB = 0x5,
519 MEM_DEPTH_128MB = 0x6,
520 MEM_DEPTH_256MB = 0x7,
521 MEM_DEPTH_512MB = 0x8,
522 MEM_DEPTH_1GB = 0x9,
523 MEM_DEPTH_2GB = 0xa,
524 MEM_DEPTH_4GB = 0xb,
525 MEM_DEPTH_8GB = 0xc,
526 MEM_DEPTH_16GB = 0xd,
527 MEM_DEPTH_32GB = 0xe
528} netxen_mem_depth_t;
529 451
530struct netxen_board_info { 452struct netxen_board_info {
531 u32 header_version; 453 u32 header_version;
@@ -676,17 +598,15 @@ struct netxen_new_user_info {
676#define PRIMARY_IMAGE_BAD 0xffffffff 598#define PRIMARY_IMAGE_BAD 0xffffffff
677 599
678/* Flash memory map */ 600/* Flash memory map */
679typedef enum { 601#define NETXEN_CRBINIT_START 0 /* crbinit section */
680 NETXEN_CRBINIT_START = 0, /* Crbinit section */ 602#define NETXEN_BRDCFG_START 0x4000 /* board config */
681 NETXEN_BRDCFG_START = 0x4000, /* board config */ 603#define NETXEN_INITCODE_START 0x6000 /* pegtune code */
682 NETXEN_INITCODE_START = 0x6000, /* pegtune code */ 604#define NETXEN_BOOTLD_START 0x10000 /* bootld */
683 NETXEN_BOOTLD_START = 0x10000, /* bootld */ 605#define NETXEN_IMAGE_START 0x43000 /* compressed image */
684 NETXEN_IMAGE_START = 0x43000, /* compressed image */ 606#define NETXEN_SECONDARY_START 0x200000 /* backup images */
685 NETXEN_SECONDARY_START = 0x200000, /* backup images */ 607#define NETXEN_PXE_START 0x3E0000 /* PXE boot rom */
686 NETXEN_PXE_START = 0x3E0000, /* user defined region */ 608#define NETXEN_USER_START 0x3E8000 /* Firmare info */
687 NETXEN_USER_START = 0x3E8000, /* User defined region for new boards */ 609#define NETXEN_FIXED_START 0x3F0000 /* backup of crbinit */
688 NETXEN_FIXED_START = 0x3F0000 /* backup of crbinit */
689} netxen_flash_map_t;
690 610
691#define NX_FW_VERSION_OFFSET (NETXEN_USER_START+0x408) 611#define NX_FW_VERSION_OFFSET (NETXEN_USER_START+0x408)
692#define NX_FW_SIZE_OFFSET (NETXEN_USER_START+0x40c) 612#define NX_FW_SIZE_OFFSET (NETXEN_USER_START+0x40c)
@@ -708,21 +628,8 @@ typedef enum {
708#define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START) 628#define NETXEN_FLASH_SECONDARY_SIZE (NETXEN_USER_START-NETXEN_SECONDARY_START)
709#define NETXEN_NUM_PRIMARY_SECTORS (0x20) 629#define NETXEN_NUM_PRIMARY_SECTORS (0x20)
710#define NETXEN_NUM_CONFIG_SECTORS (1) 630#define NETXEN_NUM_CONFIG_SECTORS (1)
711#define PFX "NetXen: "
712extern char netxen_nic_driver_name[]; 631extern char netxen_nic_driver_name[];
713 632
714/* Note: Make sure to not call this before adapter->port is valid */
715#if !defined(NETXEN_DEBUG)
716#define DPRINTK(klevel, fmt, args...) do { \
717 } while (0)
718#else
719#define DPRINTK(klevel, fmt, args...) do { \
720 printk(KERN_##klevel PFX "%s: %s: " fmt, __func__,\
721 (adapter != NULL && adapter->netdev != NULL) ? \
722 adapter->netdev->name : NULL, \
723 ## args); } while(0)
724#endif
725
726/* Number of status descriptors to handle per interrupt */ 633/* Number of status descriptors to handle per interrupt */
727#define MAX_STATUS_HANDLE (64) 634#define MAX_STATUS_HANDLE (64)
728 635
@@ -807,20 +714,14 @@ struct netxen_hardware_context {
807#define ETHERNET_FCS_SIZE 4 714#define ETHERNET_FCS_SIZE 4
808 715
809struct netxen_adapter_stats { 716struct netxen_adapter_stats {
810 u64 rcvdbadskb;
811 u64 xmitcalled; 717 u64 xmitcalled;
812 u64 xmitedframes;
813 u64 xmitfinished; 718 u64 xmitfinished;
814 u64 badskblen;
815 u64 nocmddescriptor;
816 u64 polled;
817 u64 rxdropped; 719 u64 rxdropped;
818 u64 txdropped; 720 u64 txdropped;
819 u64 csummed; 721 u64 csummed;
820 u64 no_rcv; 722 u64 no_rcv;
821 u64 rxbytes; 723 u64 rxbytes;
822 u64 txbytes; 724 u64 txbytes;
823 u64 ints;
824}; 725};
825 726
826/* 727/*
@@ -1154,26 +1055,53 @@ typedef struct {
1154 1055
1155#define NX_MAC_EVENT 0x1 1056#define NX_MAC_EVENT 0x1
1156 1057
1157enum { 1058/*
1158 NX_NIC_H2C_OPCODE_START = 0, 1059 * Driver --> Firmware
1159 NX_NIC_H2C_OPCODE_CONFIG_RSS, 1060 */
1160 NX_NIC_H2C_OPCODE_CONFIG_RSS_TBL, 1061#define NX_NIC_H2C_OPCODE_START 0
1161 NX_NIC_H2C_OPCODE_CONFIG_INTR_COALESCE, 1062#define NX_NIC_H2C_OPCODE_CONFIG_RSS 1
1162 NX_NIC_H2C_OPCODE_CONFIG_LED, 1063#define NX_NIC_H2C_OPCODE_CONFIG_RSS_TBL 2
1163 NX_NIC_H2C_OPCODE_CONFIG_PROMISCUOUS, 1064#define NX_NIC_H2C_OPCODE_CONFIG_INTR_COALESCE 3
1164 NX_NIC_H2C_OPCODE_CONFIG_L2_MAC, 1065#define NX_NIC_H2C_OPCODE_CONFIG_LED 4
1165 NX_NIC_H2C_OPCODE_LRO_REQUEST, 1066#define NX_NIC_H2C_OPCODE_CONFIG_PROMISCUOUS 5
1166 NX_NIC_H2C_OPCODE_GET_SNMP_STATS, 1067#define NX_NIC_H2C_OPCODE_CONFIG_L2_MAC 6
1167 NX_NIC_H2C_OPCODE_PROXY_START_REQUEST, 1068#define NX_NIC_H2C_OPCODE_LRO_REQUEST 7
1168 NX_NIC_H2C_OPCODE_PROXY_STOP_REQUEST, 1069#define NX_NIC_H2C_OPCODE_GET_SNMP_STATS 8
1169 NX_NIC_H2C_OPCODE_PROXY_SET_MTU, 1070#define NX_NIC_H2C_OPCODE_PROXY_START_REQUEST 9
1170 NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE, 1071#define NX_NIC_H2C_OPCODE_PROXY_STOP_REQUEST 10
1171 NX_H2P_OPCODE_GET_FINGER_PRINT_REQUEST, 1072#define NX_NIC_H2C_OPCODE_PROXY_SET_MTU 11
1172 NX_H2P_OPCODE_INSTALL_LICENSE_REQUEST, 1073#define NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE 12
1173 NX_H2P_OPCODE_GET_LICENSE_CAPABILITY_REQUEST, 1074#define NX_NIC_H2C_OPCODE_GET_FINGER_PRINT_REQUEST 13
1174 NX_NIC_H2C_OPCODE_GET_NET_STATS, 1075#define NX_NIC_H2C_OPCODE_INSTALL_LICENSE_REQUEST 14
1175 NX_NIC_H2C_OPCODE_LAST 1076#define NX_NIC_H2C_OPCODE_GET_LICENSE_CAPABILITY_REQUEST 15
1176}; 1077#define NX_NIC_H2C_OPCODE_GET_NET_STATS 16
1078#define NX_NIC_H2C_OPCODE_PROXY_UPDATE_P2V 17
1079#define NX_NIC_H2C_OPCODE_CONFIG_IPADDR 18
1080#define NX_NIC_H2C_OPCODE_CONFIG_LOOPBACK 19
1081#define NX_NIC_H2C_OPCODE_PROXY_STOP_DONE 20
1082#define NX_NIC_H2C_OPCODE_GET_LINKEVENT 21
1083#define NX_NIC_C2C_OPCODE 22
1084#define NX_NIC_H2C_OPCODE_LAST 23
1085
1086/*
1087 * Firmware --> Driver
1088 */
1089
1090#define NX_NIC_C2H_OPCODE_START 128
1091#define NX_NIC_C2H_OPCODE_CONFIG_RSS_RESPONSE 129
1092#define NX_NIC_C2H_OPCODE_CONFIG_RSS_TBL_RESPONSE 130
1093#define NX_NIC_C2H_OPCODE_CONFIG_MAC_RESPONSE 131
1094#define NX_NIC_C2H_OPCODE_CONFIG_PROMISCUOUS_RESPONSE 132
1095#define NX_NIC_C2H_OPCODE_CONFIG_L2_MAC_RESPONSE 133
1096#define NX_NIC_C2H_OPCODE_LRO_DELETE_RESPONSE 134
1097#define NX_NIC_C2H_OPCODE_LRO_ADD_FAILURE_RESPONSE 135
1098#define NX_NIC_C2H_OPCODE_GET_SNMP_STATS 136
1099#define NX_NIC_C2H_OPCODE_GET_FINGER_PRINT_REPLY 137
1100#define NX_NIC_C2H_OPCODE_INSTALL_LICENSE_REPLY 138
1101#define NX_NIC_C2H_OPCODE_GET_LICENSE_CAPABILITIES_REPLY 139
1102#define NX_NIC_C2H_OPCODE_GET_NET_STATS_RESPONSE 140
1103#define NX_NIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE 141
1104#define NX_NIC_C2H_OPCODE_LAST 142
1177 1105
1178#define VPORT_MISS_MODE_DROP 0 /* drop all unmatched */ 1106#define VPORT_MISS_MODE_DROP 0 /* drop all unmatched */
1179#define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ 1107#define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */
@@ -1491,7 +1419,7 @@ void netxen_nic_update_cmd_producer(struct netxen_adapter *adapter,
1491 1419
1492#define NETXEN_MAX_SHORT_NAME 32 1420#define NETXEN_MAX_SHORT_NAME 32
1493struct netxen_brdinfo { 1421struct netxen_brdinfo {
1494 netxen_brdtype_t brdtype; /* type of board */ 1422 int brdtype; /* type of board */
1495 long ports; /* max no of physical ports */ 1423 long ports; /* max no of physical ports */
1496 char short_name[NETXEN_MAX_SHORT_NAME]; 1424 char short_name[NETXEN_MAX_SHORT_NAME];
1497}; 1425};