diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-04-07 18:50:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-08 18:58:27 -0400 |
commit | 3bf26ce3f4cc3c9e0d0478b4016c6113a16faaf1 (patch) | |
tree | 8478804493b6e749a6e61870c8c3b5b9549469ad /drivers/net/netxen/netxen_nic.h | |
parent | 56a007871a6689db80e19f63fe6dc3692daa2a6f (diff) |
netxen: async link event handling
Add support for asynchronous events from firmware,
received over one of the rx rings.
Add support for event based phy interrupts, enhanced links
status reporting from firmware.
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.h | 108 |
1 files changed, 79 insertions, 29 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 7e208b31a27e..f4d7e2db700b 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -354,6 +354,7 @@ struct rcv_desc { | |||
354 | /* opcode field in status_desc */ | 354 | /* opcode field in status_desc */ |
355 | #define NETXEN_NIC_RXPKT_DESC 0x04 | 355 | #define NETXEN_NIC_RXPKT_DESC 0x04 |
356 | #define NETXEN_OLD_RXPKT_DESC 0x3f | 356 | #define NETXEN_OLD_RXPKT_DESC 0x3f |
357 | #define NETXEN_NIC_RESPONSE_DESC 0x05 | ||
357 | 358 | ||
358 | /* for status field in status_desc */ | 359 | /* for status field in status_desc */ |
359 | #define STATUS_NEED_CKSUM (1) | 360 | #define STATUS_NEED_CKSUM (1) |
@@ -363,8 +364,11 @@ struct rcv_desc { | |||
363 | #define STATUS_OWNER_HOST (0x1ULL << 56) | 364 | #define STATUS_OWNER_HOST (0x1ULL << 56) |
364 | #define STATUS_OWNER_PHANTOM (0x2ULL << 56) | 365 | #define STATUS_OWNER_PHANTOM (0x2ULL << 56) |
365 | 366 | ||
366 | /* Note: sizeof(status_desc) should always be a mutliple of 2 */ | 367 | /* Status descriptor: |
367 | 368 | 0-3 port, 4-7 status, 8-11 type, 12-27 total_length | |
369 | 28-43 reference_handle, 44-47 protocol, 48-52 pkt_offset | ||
370 | 53-55 desc_cnt, 56-57 owner, 58-63 opcode | ||
371 | */ | ||
368 | #define netxen_get_sts_port(sts_data) \ | 372 | #define netxen_get_sts_port(sts_data) \ |
369 | ((sts_data) & 0x0F) | 373 | ((sts_data) & 0x0F) |
370 | #define netxen_get_sts_status(sts_data) \ | 374 | #define netxen_get_sts_status(sts_data) \ |
@@ -379,35 +383,13 @@ struct rcv_desc { | |||
379 | (((sts_data) >> 44) & 0x0F) | 383 | (((sts_data) >> 44) & 0x0F) |
380 | #define netxen_get_sts_pkt_offset(sts_data) \ | 384 | #define netxen_get_sts_pkt_offset(sts_data) \ |
381 | (((sts_data) >> 48) & 0x1F) | 385 | (((sts_data) >> 48) & 0x1F) |
386 | #define netxen_get_sts_desc_cnt(sts_data) \ | ||
387 | (((sts_data) >> 53) & 0x7) | ||
382 | #define netxen_get_sts_opcode(sts_data) \ | 388 | #define netxen_get_sts_opcode(sts_data) \ |
383 | (((sts_data) >> 58) & 0x03F) | 389 | (((sts_data) >> 58) & 0x03F) |
384 | 390 | ||
385 | struct status_desc { | 391 | struct status_desc { |
386 | /* Bit pattern: 0-3 port, 4-7 status, 8-11 type, 12-27 total_length | 392 | __le64 status_desc_data[2]; |
387 | 28-43 reference_handle, 44-47 protocol, 48-52 pkt_offset | ||
388 | 53-55 desc_cnt, 56-57 owner, 58-63 opcode | ||
389 | */ | ||
390 | __le64 status_desc_data; | ||
391 | union { | ||
392 | struct { | ||
393 | __le32 hash_value; | ||
394 | u8 hash_type; | ||
395 | u8 msg_type; | ||
396 | u8 unused; | ||
397 | union { | ||
398 | /* Bit pattern: 0-6 lro_count indicates frag | ||
399 | * sequence, 7 last_frag indicates last frag | ||
400 | */ | ||
401 | u8 lro; | ||
402 | |||
403 | /* chained buffers */ | ||
404 | u8 nr_frags; | ||
405 | }; | ||
406 | }; | ||
407 | struct { | ||
408 | __le16 frag_handles[4]; | ||
409 | }; | ||
410 | }; | ||
411 | } __attribute__ ((aligned(16))); | 393 | } __attribute__ ((aligned(16))); |
412 | 394 | ||
413 | /* The version of the main data structure */ | 395 | /* The version of the main data structure */ |
@@ -1114,6 +1096,66 @@ typedef struct { | |||
1114 | #define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ | 1096 | #define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ |
1115 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ | 1097 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ |
1116 | 1098 | ||
1099 | #define NX_FW_CAPABILITY_LINK_NOTIFICATION (1 << 5) | ||
1100 | #define NX_FW_CAPABILITY_SWITCHING (1 << 6) | ||
1101 | |||
1102 | /* module types */ | ||
1103 | #define LINKEVENT_MODULE_NOT_PRESENT 1 | ||
1104 | #define LINKEVENT_MODULE_OPTICAL_UNKNOWN 2 | ||
1105 | #define LINKEVENT_MODULE_OPTICAL_SRLR 3 | ||
1106 | #define LINKEVENT_MODULE_OPTICAL_LRM 4 | ||
1107 | #define LINKEVENT_MODULE_OPTICAL_SFP_1G 5 | ||
1108 | #define LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE 6 | ||
1109 | #define LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN 7 | ||
1110 | #define LINKEVENT_MODULE_TWINAX 8 | ||
1111 | |||
1112 | #define LINKSPEED_10GBPS 10000 | ||
1113 | #define LINKSPEED_1GBPS 1000 | ||
1114 | #define LINKSPEED_100MBPS 100 | ||
1115 | #define LINKSPEED_10MBPS 10 | ||
1116 | |||
1117 | #define LINKSPEED_ENCODED_10MBPS 0 | ||
1118 | #define LINKSPEED_ENCODED_100MBPS 1 | ||
1119 | #define LINKSPEED_ENCODED_1GBPS 2 | ||
1120 | |||
1121 | #define LINKEVENT_AUTONEG_DISABLED 0 | ||
1122 | #define LINKEVENT_AUTONEG_ENABLED 1 | ||
1123 | |||
1124 | #define LINKEVENT_HALF_DUPLEX 0 | ||
1125 | #define LINKEVENT_FULL_DUPLEX 1 | ||
1126 | |||
1127 | #define LINKEVENT_LINKSPEED_MBPS 0 | ||
1128 | #define LINKEVENT_LINKSPEED_ENCODED 1 | ||
1129 | |||
1130 | /* firmware response header: | ||
1131 | * 63:58 - message type | ||
1132 | * 57:56 - owner | ||
1133 | * 55:53 - desc count | ||
1134 | * 52:48 - reserved | ||
1135 | * 47:40 - completion id | ||
1136 | * 39:32 - opcode | ||
1137 | * 31:16 - error code | ||
1138 | * 15:00 - reserved | ||
1139 | */ | ||
1140 | #define netxen_get_nic_msgtype(msg_hdr) \ | ||
1141 | ((msg_hdr >> 58) & 0x3F) | ||
1142 | #define netxen_get_nic_msg_compid(msg_hdr) \ | ||
1143 | ((msg_hdr >> 40) & 0xFF) | ||
1144 | #define netxen_get_nic_msg_opcode(msg_hdr) \ | ||
1145 | ((msg_hdr >> 32) & 0xFF) | ||
1146 | #define netxen_get_nic_msg_errcode(msg_hdr) \ | ||
1147 | ((msg_hdr >> 16) & 0xFFFF) | ||
1148 | |||
1149 | typedef struct { | ||
1150 | union { | ||
1151 | struct { | ||
1152 | u64 hdr; | ||
1153 | u64 body[7]; | ||
1154 | }; | ||
1155 | u64 words[8]; | ||
1156 | }; | ||
1157 | } nx_fw_msg_t; | ||
1158 | |||
1117 | typedef struct { | 1159 | typedef struct { |
1118 | __le64 qhdr; | 1160 | __le64 qhdr; |
1119 | __le64 req_hdr; | 1161 | __le64 req_hdr; |
@@ -1177,15 +1219,21 @@ struct netxen_adapter { | |||
1177 | 1219 | ||
1178 | u8 mc_enabled; | 1220 | u8 mc_enabled; |
1179 | u8 max_mc_count; | 1221 | u8 max_mc_count; |
1222 | u16 resv2; | ||
1223 | u32 resv3; | ||
1224 | |||
1225 | u8 has_link_events; | ||
1226 | u8 resv1; | ||
1180 | u16 tx_context_id; | 1227 | u16 tx_context_id; |
1181 | u16 mtu; | 1228 | u16 mtu; |
1182 | u16 is_up; | 1229 | u16 is_up; |
1230 | |||
1183 | u16 link_speed; | 1231 | u16 link_speed; |
1184 | u16 link_duplex; | 1232 | u16 link_duplex; |
1185 | u16 link_autoneg; | 1233 | u16 link_autoneg; |
1186 | u16 resv1; | 1234 | u16 module_type; |
1187 | 1235 | ||
1188 | u32 resv2; | 1236 | u32 capabilities; |
1189 | u32 flags; | 1237 | u32 flags; |
1190 | u32 irq; | 1238 | u32 irq; |
1191 | u32 temp; | 1239 | u32 temp; |
@@ -1398,6 +1446,8 @@ void netxen_p3_free_mac_list(struct netxen_adapter *adapter); | |||
1398 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); | 1446 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); |
1399 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); | 1447 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); |
1400 | int netxen_config_rss(struct netxen_adapter *adapter, int enable); | 1448 | int netxen_config_rss(struct netxen_adapter *adapter, int enable); |
1449 | int netxen_linkevent_request(struct netxen_adapter *adapter, int enable); | ||
1450 | void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup); | ||
1401 | 1451 | ||
1402 | int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); | 1452 | int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); |
1403 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | 1453 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); |