diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-01-21 04:39:51 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-21 04:39:51 -0500 |
commit | 198030782cedf25391e67e7c88b04f87a5eb6563 (patch) | |
tree | 5b7368c6bf052bcb4bb273497a57900720d36f51 /drivers/net/netxen | |
parent | 4ec71fa2d2c3f1040348f2604f4b8ccc833d1c2e (diff) | |
parent | 92181f190b649f7ef2b79cbf5c00f26ccc66da2a (diff) |
Merge branch 'x86/mm' into core/percpu
Conflicts:
arch/x86/mm/fault.c
Diffstat (limited to 'drivers/net/netxen')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 146 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 50 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 31 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 97 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_init.c | 105 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 210 |
6 files changed, 354 insertions, 285 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index f8e601c51da..c11c568fd7d 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -308,27 +308,16 @@ struct netxen_ring_ctx { | |||
308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ | 308 | #define netxen_set_cmd_desc_ctxid(cmd_desc, var) \ |
309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) | 309 | ((cmd_desc)->port_ctxid |= ((var) << 4 & 0xF0)) |
310 | 310 | ||
311 | #define netxen_set_cmd_desc_flags(cmd_desc, val) \ | 311 | #define netxen_set_tx_port(_desc, _port) \ |
312 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 312 | (_desc)->port_ctxid = ((_port) & 0xf) | (((_port) << 4) & 0xf0) |
313 | ~cpu_to_le16(0x7f)) | cpu_to_le16((val) & 0x7f) | 313 | |
314 | #define netxen_set_cmd_desc_opcode(cmd_desc, val) \ | 314 | #define netxen_set_tx_flags_opcode(_desc, _flags, _opcode) \ |
315 | (cmd_desc)->flags_opcode = ((cmd_desc)->flags_opcode & \ | 315 | (_desc)->flags_opcode = \ |
316 | ~cpu_to_le16((u16)0x3f << 7)) | cpu_to_le16(((val) & 0x3f) << 7) | 316 | cpu_to_le16(((_flags) & 0x7f) | (((_opcode) & 0x3f) << 7)) |
317 | 317 | ||
318 | #define netxen_set_cmd_desc_num_of_buff(cmd_desc, val) \ | 318 | #define netxen_set_tx_frags_len(_desc, _frags, _len) \ |
319 | (cmd_desc)->num_of_buffers_total_length = \ | 319 | (_desc)->num_of_buffers_total_length = \ |
320 | ((cmd_desc)->num_of_buffers_total_length & \ | 320 | cpu_to_le32(((_frags) & 0xff) | (((_len) & 0xffffff) << 8)) |
321 | ~cpu_to_le32(0xff)) | cpu_to_le32((val) & 0xff) | ||
322 | #define netxen_set_cmd_desc_totallength(cmd_desc, val) \ | ||
323 | (cmd_desc)->num_of_buffers_total_length = \ | ||
324 | ((cmd_desc)->num_of_buffers_total_length & \ | ||
325 | ~cpu_to_le32((u32)0xffffff << 8)) | \ | ||
326 | cpu_to_le32(((val) & 0xffffff) << 8) | ||
327 | |||
328 | #define netxen_get_cmd_desc_opcode(cmd_desc) \ | ||
329 | ((le16_to_cpu((cmd_desc)->flags_opcode) >> 7) & 0x003f) | ||
330 | #define netxen_get_cmd_desc_totallength(cmd_desc) \ | ||
331 | ((le32_to_cpu((cmd_desc)->num_of_buffers_total_length) >> 8) & 0xffffff) | ||
332 | 321 | ||
333 | struct cmd_desc_type0 { | 322 | struct cmd_desc_type0 { |
334 | u8 tcp_hdr_offset; /* For LSO only */ | 323 | u8 tcp_hdr_offset; /* For LSO only */ |
@@ -510,7 +499,8 @@ typedef enum { | |||
510 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, | 499 | NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, |
511 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, | 500 | NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, |
512 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, | 501 | NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, |
513 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 | 502 | NETXEN_BRDTYPE_P3_10G_XFP = 0x0032, |
503 | NETXEN_BRDTYPE_P3_10G_TP = 0x0080 | ||
514 | 504 | ||
515 | } netxen_brdtype_t; | 505 | } netxen_brdtype_t; |
516 | 506 | ||
@@ -757,7 +747,7 @@ extern char netxen_nic_driver_name[]; | |||
757 | */ | 747 | */ |
758 | struct netxen_skb_frag { | 748 | struct netxen_skb_frag { |
759 | u64 dma; | 749 | u64 dma; |
760 | u32 length; | 750 | ulong length; |
761 | }; | 751 | }; |
762 | 752 | ||
763 | #define _netxen_set_bits(config_word, start, bits, val) {\ | 753 | #define _netxen_set_bits(config_word, start, bits, val) {\ |
@@ -783,13 +773,7 @@ struct netxen_skb_frag { | |||
783 | struct netxen_cmd_buffer { | 773 | struct netxen_cmd_buffer { |
784 | struct sk_buff *skb; | 774 | struct sk_buff *skb; |
785 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; | 775 | struct netxen_skb_frag frag_array[MAX_BUFFERS_PER_CMD + 1]; |
786 | u32 total_length; | 776 | u32 frag_count; |
787 | u32 mss; | ||
788 | u16 port; | ||
789 | u8 cmd; | ||
790 | u8 frag_count; | ||
791 | unsigned long time_stamp; | ||
792 | u32 state; | ||
793 | }; | 777 | }; |
794 | 778 | ||
795 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ | 779 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ |
@@ -876,7 +860,6 @@ struct nx_host_rds_ring { | |||
876 | u32 skb_size; | 860 | u32 skb_size; |
877 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ | 861 | struct netxen_rx_buffer *rx_buf_arr; /* rx buffers for receive */ |
878 | struct list_head free_list; | 862 | struct list_head free_list; |
879 | int begin_alloc; | ||
880 | }; | 863 | }; |
881 | 864 | ||
882 | /* | 865 | /* |
@@ -995,31 +978,31 @@ struct netxen_recv_context { | |||
995 | */ | 978 | */ |
996 | 979 | ||
997 | typedef struct { | 980 | typedef struct { |
998 | u64 host_phys_addr; /* Ring base addr */ | 981 | __le64 host_phys_addr; /* Ring base addr */ |
999 | u32 ring_size; /* Ring entries */ | 982 | __le32 ring_size; /* Ring entries */ |
1000 | u16 msi_index; | 983 | __le16 msi_index; |
1001 | u16 rsvd; /* Padding */ | 984 | __le16 rsvd; /* Padding */ |
1002 | } nx_hostrq_sds_ring_t; | 985 | } nx_hostrq_sds_ring_t; |
1003 | 986 | ||
1004 | typedef struct { | 987 | typedef struct { |
1005 | u64 host_phys_addr; /* Ring base addr */ | 988 | __le64 host_phys_addr; /* Ring base addr */ |
1006 | u64 buff_size; /* Packet buffer size */ | 989 | __le64 buff_size; /* Packet buffer size */ |
1007 | u32 ring_size; /* Ring entries */ | 990 | __le32 ring_size; /* Ring entries */ |
1008 | u32 ring_kind; /* Class of ring */ | 991 | __le32 ring_kind; /* Class of ring */ |
1009 | } nx_hostrq_rds_ring_t; | 992 | } nx_hostrq_rds_ring_t; |
1010 | 993 | ||
1011 | typedef struct { | 994 | typedef struct { |
1012 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 995 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
1013 | u32 capabilities[4]; /* Flag bit vector */ | 996 | __le32 capabilities[4]; /* Flag bit vector */ |
1014 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 997 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
1015 | u32 host_rds_crb_mode; /* RDS crb usage */ | 998 | __le32 host_rds_crb_mode; /* RDS crb usage */ |
1016 | /* These ring offsets are relative to data[0] below */ | 999 | /* These ring offsets are relative to data[0] below */ |
1017 | u32 rds_ring_offset; /* Offset to RDS config */ | 1000 | __le32 rds_ring_offset; /* Offset to RDS config */ |
1018 | u32 sds_ring_offset; /* Offset to SDS config */ | 1001 | __le32 sds_ring_offset; /* Offset to SDS config */ |
1019 | u16 num_rds_rings; /* Count of RDS rings */ | 1002 | __le16 num_rds_rings; /* Count of RDS rings */ |
1020 | u16 num_sds_rings; /* Count of SDS rings */ | 1003 | __le16 num_sds_rings; /* Count of SDS rings */ |
1021 | u16 rsvd1; /* Padding */ | 1004 | __le16 rsvd1; /* Padding */ |
1022 | u16 rsvd2; /* Padding */ | 1005 | __le16 rsvd2; /* Padding */ |
1023 | u8 reserved[128]; /* reserve space for future expansion*/ | 1006 | u8 reserved[128]; /* reserve space for future expansion*/ |
1024 | /* MUST BE 64-bit aligned. | 1007 | /* MUST BE 64-bit aligned. |
1025 | The following is packed: | 1008 | The following is packed: |
@@ -1029,24 +1012,24 @@ typedef struct { | |||
1029 | } nx_hostrq_rx_ctx_t; | 1012 | } nx_hostrq_rx_ctx_t; |
1030 | 1013 | ||
1031 | typedef struct { | 1014 | typedef struct { |
1032 | u32 host_producer_crb; /* Crb to use */ | 1015 | __le32 host_producer_crb; /* Crb to use */ |
1033 | u32 rsvd1; /* Padding */ | 1016 | __le32 rsvd1; /* Padding */ |
1034 | } nx_cardrsp_rds_ring_t; | 1017 | } nx_cardrsp_rds_ring_t; |
1035 | 1018 | ||
1036 | typedef struct { | 1019 | typedef struct { |
1037 | u32 host_consumer_crb; /* Crb to use */ | 1020 | __le32 host_consumer_crb; /* Crb to use */ |
1038 | u32 interrupt_crb; /* Crb to use */ | 1021 | __le32 interrupt_crb; /* Crb to use */ |
1039 | } nx_cardrsp_sds_ring_t; | 1022 | } nx_cardrsp_sds_ring_t; |
1040 | 1023 | ||
1041 | typedef struct { | 1024 | typedef struct { |
1042 | /* These ring offsets are relative to data[0] below */ | 1025 | /* These ring offsets are relative to data[0] below */ |
1043 | u32 rds_ring_offset; /* Offset to RDS config */ | 1026 | __le32 rds_ring_offset; /* Offset to RDS config */ |
1044 | u32 sds_ring_offset; /* Offset to SDS config */ | 1027 | __le32 sds_ring_offset; /* Offset to SDS config */ |
1045 | u32 host_ctx_state; /* Starting State */ | 1028 | __le32 host_ctx_state; /* Starting State */ |
1046 | u32 num_fn_per_port; /* How many PCI fn share the port */ | 1029 | __le32 num_fn_per_port; /* How many PCI fn share the port */ |
1047 | u16 num_rds_rings; /* Count of RDS rings */ | 1030 | __le16 num_rds_rings; /* Count of RDS rings */ |
1048 | u16 num_sds_rings; /* Count of SDS rings */ | 1031 | __le16 num_sds_rings; /* Count of SDS rings */ |
1049 | u16 context_id; /* Handle for context */ | 1032 | __le16 context_id; /* Handle for context */ |
1050 | u8 phys_port; /* Physical id of port */ | 1033 | u8 phys_port; /* Physical id of port */ |
1051 | u8 virt_port; /* Virtual/Logical id of port */ | 1034 | u8 virt_port; /* Virtual/Logical id of port */ |
1052 | u8 reserved[128]; /* save space for future expansion */ | 1035 | u8 reserved[128]; /* save space for future expansion */ |
@@ -1072,34 +1055,34 @@ typedef struct { | |||
1072 | */ | 1055 | */ |
1073 | 1056 | ||
1074 | typedef struct { | 1057 | typedef struct { |
1075 | u64 host_phys_addr; /* Ring base addr */ | 1058 | __le64 host_phys_addr; /* Ring base addr */ |
1076 | u32 ring_size; /* Ring entries */ | 1059 | __le32 ring_size; /* Ring entries */ |
1077 | u32 rsvd; /* Padding */ | 1060 | __le32 rsvd; /* Padding */ |
1078 | } nx_hostrq_cds_ring_t; | 1061 | } nx_hostrq_cds_ring_t; |
1079 | 1062 | ||
1080 | typedef struct { | 1063 | typedef struct { |
1081 | u64 host_rsp_dma_addr; /* Response dma'd here */ | 1064 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
1082 | u64 cmd_cons_dma_addr; /* */ | 1065 | __le64 cmd_cons_dma_addr; /* */ |
1083 | u64 dummy_dma_addr; /* */ | 1066 | __le64 dummy_dma_addr; /* */ |
1084 | u32 capabilities[4]; /* Flag bit vector */ | 1067 | __le32 capabilities[4]; /* Flag bit vector */ |
1085 | u32 host_int_crb_mode; /* Interrupt crb usage */ | 1068 | __le32 host_int_crb_mode; /* Interrupt crb usage */ |
1086 | u32 rsvd1; /* Padding */ | 1069 | __le32 rsvd1; /* Padding */ |
1087 | u16 rsvd2; /* Padding */ | 1070 | __le16 rsvd2; /* Padding */ |
1088 | u16 interrupt_ctl; | 1071 | __le16 interrupt_ctl; |
1089 | u16 msi_index; | 1072 | __le16 msi_index; |
1090 | u16 rsvd3; /* Padding */ | 1073 | __le16 rsvd3; /* Padding */ |
1091 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ | 1074 | nx_hostrq_cds_ring_t cds_ring; /* Desc of cds ring */ |
1092 | u8 reserved[128]; /* future expansion */ | 1075 | u8 reserved[128]; /* future expansion */ |
1093 | } nx_hostrq_tx_ctx_t; | 1076 | } nx_hostrq_tx_ctx_t; |
1094 | 1077 | ||
1095 | typedef struct { | 1078 | typedef struct { |
1096 | u32 host_producer_crb; /* Crb to use */ | 1079 | __le32 host_producer_crb; /* Crb to use */ |
1097 | u32 interrupt_crb; /* Crb to use */ | 1080 | __le32 interrupt_crb; /* Crb to use */ |
1098 | } nx_cardrsp_cds_ring_t; | 1081 | } nx_cardrsp_cds_ring_t; |
1099 | 1082 | ||
1100 | typedef struct { | 1083 | typedef struct { |
1101 | u32 host_ctx_state; /* Starting state */ | 1084 | __le32 host_ctx_state; /* Starting state */ |
1102 | u16 context_id; /* Handle for context */ | 1085 | __le16 context_id; /* Handle for context */ |
1103 | u8 phys_port; /* Physical id of port */ | 1086 | u8 phys_port; /* Physical id of port */ |
1104 | u8 virt_port; /* Virtual/Logical id of port */ | 1087 | u8 virt_port; /* Virtual/Logical id of port */ |
1105 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ | 1088 | nx_cardrsp_cds_ring_t cds_ring; /* Card cds settings */ |
@@ -1202,9 +1185,9 @@ enum { | |||
1202 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ | 1185 | #define VPORT_MISS_MODE_ACCEPT_MULTI 2 /* accept unmatched multicast */ |
1203 | 1186 | ||
1204 | typedef struct { | 1187 | typedef struct { |
1205 | u64 qhdr; | 1188 | __le64 qhdr; |
1206 | u64 req_hdr; | 1189 | __le64 req_hdr; |
1207 | u64 words[6]; | 1190 | __le64 words[6]; |
1208 | } nx_nic_req_t; | 1191 | } nx_nic_req_t; |
1209 | 1192 | ||
1210 | typedef struct { | 1193 | typedef struct { |
@@ -1486,8 +1469,6 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter); | |||
1486 | 1469 | ||
1487 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | 1470 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); |
1488 | int netxen_init_firmware(struct netxen_adapter *adapter); | 1471 | int netxen_init_firmware(struct netxen_adapter *adapter); |
1489 | void netxen_tso_check(struct netxen_adapter *adapter, | ||
1490 | struct cmd_desc_type0 *desc, struct sk_buff *skb); | ||
1491 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); | 1472 | void netxen_nic_clear_stats(struct netxen_adapter *adapter); |
1492 | void netxen_watchdog_task(struct work_struct *work); | 1473 | void netxen_watchdog_task(struct work_struct *work); |
1493 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, | 1474 | void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, |
@@ -1496,6 +1477,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter); | |||
1496 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); | 1477 | u32 netxen_process_rcv_ring(struct netxen_adapter *adapter, int ctx, int max); |
1497 | void netxen_p2_nic_set_multi(struct net_device *netdev); | 1478 | void netxen_p2_nic_set_multi(struct net_device *netdev); |
1498 | void netxen_p3_nic_set_multi(struct net_device *netdev); | 1479 | void netxen_p3_nic_set_multi(struct net_device *netdev); |
1480 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter); | ||
1499 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); | 1481 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32); |
1500 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); | 1482 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter); |
1501 | 1483 | ||
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index 64b51643c62..746bdb47041 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -76,7 +76,7 @@ netxen_api_unlock(struct netxen_adapter *adapter) | |||
76 | static u32 | 76 | static u32 |
77 | netxen_poll_rsp(struct netxen_adapter *adapter) | 77 | netxen_poll_rsp(struct netxen_adapter *adapter) |
78 | { | 78 | { |
79 | u32 raw_rsp, rsp = NX_CDRP_RSP_OK; | 79 | u32 rsp = NX_CDRP_RSP_OK; |
80 | int timeout = 0; | 80 | int timeout = 0; |
81 | 81 | ||
82 | do { | 82 | do { |
@@ -86,10 +86,7 @@ netxen_poll_rsp(struct netxen_adapter *adapter) | |||
86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) | 86 | if (++timeout > NX_OS_CRB_RETRY_COUNT) |
87 | return NX_CDRP_RSP_TIMEOUT; | 87 | return NX_CDRP_RSP_TIMEOUT; |
88 | 88 | ||
89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, | 89 | netxen_nic_read_w1(adapter, NX_CDRP_CRB_OFFSET, &rsp); |
90 | &raw_rsp); | ||
91 | |||
92 | rsp = le32_to_cpu(raw_rsp); | ||
93 | } while (!NX_CDRP_IS_RSP(rsp)); | 90 | } while (!NX_CDRP_IS_RSP(rsp)); |
94 | 91 | ||
95 | return rsp; | 92 | return rsp; |
@@ -109,20 +106,16 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
109 | if (netxen_api_lock(adapter)) | 106 | if (netxen_api_lock(adapter)) |
110 | return NX_RCODE_TIMEOUT; | 107 | return NX_RCODE_TIMEOUT; |
111 | 108 | ||
112 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, | 109 | netxen_nic_write_w1(adapter, NX_SIGN_CRB_OFFSET, signature); |
113 | cpu_to_le32(signature)); | ||
114 | 110 | ||
115 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, | 111 | netxen_nic_write_w1(adapter, NX_ARG1_CRB_OFFSET, arg1); |
116 | cpu_to_le32(arg1)); | ||
117 | 112 | ||
118 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, | 113 | netxen_nic_write_w1(adapter, NX_ARG2_CRB_OFFSET, arg2); |
119 | cpu_to_le32(arg2)); | ||
120 | 114 | ||
121 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, | 115 | netxen_nic_write_w1(adapter, NX_ARG3_CRB_OFFSET, arg3); |
122 | cpu_to_le32(arg3)); | ||
123 | 116 | ||
124 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, | 117 | netxen_nic_write_w1(adapter, NX_CDRP_CRB_OFFSET, |
125 | cpu_to_le32(NX_CDRP_FORM_CMD(cmd))); | 118 | NX_CDRP_FORM_CMD(cmd)); |
126 | 119 | ||
127 | rsp = netxen_poll_rsp(adapter); | 120 | rsp = netxen_poll_rsp(adapter); |
128 | 121 | ||
@@ -133,7 +126,6 @@ netxen_issue_cmd(struct netxen_adapter *adapter, | |||
133 | rcode = NX_RCODE_TIMEOUT; | 126 | rcode = NX_RCODE_TIMEOUT; |
134 | } else if (rsp == NX_CDRP_RSP_FAIL) { | 127 | } else if (rsp == NX_CDRP_RSP_FAIL) { |
135 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); | 128 | netxen_nic_read_w1(adapter, NX_ARG1_CRB_OFFSET, &rcode); |
136 | rcode = le32_to_cpu(rcode); | ||
137 | 129 | ||
138 | printk(KERN_ERR "%s: failed card response code:0x%x\n", | 130 | printk(KERN_ERR "%s: failed card response code:0x%x\n", |
139 | netxen_nic_driver_name, rcode); | 131 | netxen_nic_driver_name, rcode); |
@@ -183,7 +175,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
183 | 175 | ||
184 | int i, nrds_rings, nsds_rings; | 176 | int i, nrds_rings, nsds_rings; |
185 | size_t rq_size, rsp_size; | 177 | size_t rq_size, rsp_size; |
186 | u32 cap, reg; | 178 | u32 cap, reg, val; |
187 | 179 | ||
188 | int err; | 180 | int err; |
189 | 181 | ||
@@ -225,11 +217,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
225 | 217 | ||
226 | prq->num_rds_rings = cpu_to_le16(nrds_rings); | 218 | prq->num_rds_rings = cpu_to_le16(nrds_rings); |
227 | prq->num_sds_rings = cpu_to_le16(nsds_rings); | 219 | prq->num_sds_rings = cpu_to_le16(nsds_rings); |
228 | prq->rds_ring_offset = 0; | 220 | prq->rds_ring_offset = cpu_to_le32(0); |
229 | prq->sds_ring_offset = prq->rds_ring_offset + | 221 | |
222 | val = le32_to_cpu(prq->rds_ring_offset) + | ||
230 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); | 223 | (sizeof(nx_hostrq_rds_ring_t) * nrds_rings); |
224 | prq->sds_ring_offset = cpu_to_le32(val); | ||
231 | 225 | ||
232 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + prq->rds_ring_offset); | 226 | prq_rds = (nx_hostrq_rds_ring_t *)(prq->data + |
227 | le32_to_cpu(prq->rds_ring_offset)); | ||
233 | 228 | ||
234 | for (i = 0; i < nrds_rings; i++) { | 229 | for (i = 0; i < nrds_rings; i++) { |
235 | 230 | ||
@@ -241,17 +236,14 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
241 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); | 236 | prq_rds[i].buff_size = cpu_to_le64(rds_ring->dma_size); |
242 | } | 237 | } |
243 | 238 | ||
244 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + prq->sds_ring_offset); | 239 | prq_sds = (nx_hostrq_sds_ring_t *)(prq->data + |
240 | le32_to_cpu(prq->sds_ring_offset)); | ||
245 | 241 | ||
246 | prq_sds[0].host_phys_addr = | 242 | prq_sds[0].host_phys_addr = |
247 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); | 243 | cpu_to_le64(recv_ctx->rcv_status_desc_phys_addr); |
248 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); | 244 | prq_sds[0].ring_size = cpu_to_le32(adapter->max_rx_desc_count); |
249 | /* only one msix vector for now */ | 245 | /* only one msix vector for now */ |
250 | prq_sds[0].msi_index = cpu_to_le32(0); | 246 | prq_sds[0].msi_index = cpu_to_le16(0); |
251 | |||
252 | /* now byteswap offsets */ | ||
253 | prq->rds_ring_offset = cpu_to_le32(prq->rds_ring_offset); | ||
254 | prq->sds_ring_offset = cpu_to_le32(prq->sds_ring_offset); | ||
255 | 247 | ||
256 | phys_addr = hostrq_phys_addr; | 248 | phys_addr = hostrq_phys_addr; |
257 | err = netxen_issue_cmd(adapter, | 249 | err = netxen_issue_cmd(adapter, |
@@ -269,9 +261,9 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
269 | 261 | ||
270 | 262 | ||
271 | prsp_rds = ((nx_cardrsp_rds_ring_t *) | 263 | prsp_rds = ((nx_cardrsp_rds_ring_t *) |
272 | &prsp->data[prsp->rds_ring_offset]); | 264 | &prsp->data[le32_to_cpu(prsp->rds_ring_offset)]); |
273 | 265 | ||
274 | for (i = 0; i < le32_to_cpu(prsp->num_rds_rings); i++) { | 266 | for (i = 0; i < le16_to_cpu(prsp->num_rds_rings); i++) { |
275 | rds_ring = &recv_ctx->rds_rings[i]; | 267 | rds_ring = &recv_ctx->rds_rings[i]; |
276 | 268 | ||
277 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); | 269 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); |
@@ -279,7 +271,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
279 | } | 271 | } |
280 | 272 | ||
281 | prsp_sds = ((nx_cardrsp_sds_ring_t *) | 273 | prsp_sds = ((nx_cardrsp_sds_ring_t *) |
282 | &prsp->data[prsp->sds_ring_offset]); | 274 | &prsp->data[le32_to_cpu(prsp->sds_ring_offset)]); |
283 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); | 275 | reg = le32_to_cpu(prsp_sds[0].host_consumer_crb); |
284 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); | 276 | recv_ctx->crb_sts_consumer = NETXEN_NIC_REG(reg - 0x200); |
285 | 277 | ||
@@ -288,7 +280,7 @@ nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | |||
288 | 280 | ||
289 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); | 281 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); |
290 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); | 282 | recv_ctx->context_id = le16_to_cpu(prsp->context_id); |
291 | recv_ctx->virt_port = le16_to_cpu(prsp->virt_port); | 283 | recv_ctx->virt_port = prsp->virt_port; |
292 | 284 | ||
293 | out_free_rsp: | 285 | out_free_rsp: |
294 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); | 286 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index e45ce295172..c0bd40fcf70 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
136 | 136 | ||
137 | ecmd->port = PORT_TP; | 137 | ecmd->port = PORT_TP; |
138 | 138 | ||
139 | if (netif_running(dev)) { | 139 | ecmd->speed = adapter->link_speed; |
140 | ecmd->speed = adapter->link_speed; | 140 | ecmd->duplex = adapter->link_duplex; |
141 | ecmd->duplex = adapter->link_duplex; | 141 | ecmd->autoneg = adapter->link_autoneg; |
142 | ecmd->autoneg = adapter->link_autoneg; | ||
143 | } | ||
144 | 142 | ||
145 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 143 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
146 | u32 val; | 144 | u32 val; |
@@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
171 | } else | 169 | } else |
172 | return -EIO; | 170 | return -EIO; |
173 | 171 | ||
174 | ecmd->phy_address = adapter->portnum; | 172 | ecmd->phy_address = adapter->physical_port; |
175 | ecmd->transceiver = XCVR_EXTERNAL; | 173 | ecmd->transceiver = XCVR_EXTERNAL; |
176 | 174 | ||
177 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 175 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
@@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
180 | case NETXEN_BRDTYPE_P3_REF_QG: | 178 | case NETXEN_BRDTYPE_P3_REF_QG: |
181 | case NETXEN_BRDTYPE_P3_4_GB: | 179 | case NETXEN_BRDTYPE_P3_4_GB: |
182 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 180 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
183 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
184 | 181 | ||
185 | ecmd->supported |= SUPPORTED_Autoneg; | 182 | ecmd->supported |= SUPPORTED_Autoneg; |
186 | ecmd->advertising |= ADVERTISED_Autoneg; | 183 | ecmd->advertising |= ADVERTISED_Autoneg; |
187 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: | 184 | case NETXEN_BRDTYPE_P2_SB31_10G_CX4: |
188 | case NETXEN_BRDTYPE_P3_10G_CX4: | 185 | case NETXEN_BRDTYPE_P3_10G_CX4: |
189 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: | 186 | case NETXEN_BRDTYPE_P3_10G_CX4_LP: |
187 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | ||
190 | ecmd->supported |= SUPPORTED_TP; | 188 | ecmd->supported |= SUPPORTED_TP; |
191 | ecmd->advertising |= ADVERTISED_TP; | 189 | ecmd->advertising |= ADVERTISED_TP; |
192 | ecmd->port = PORT_TP; | 190 | ecmd->port = PORT_TP; |
@@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
204 | ecmd->port = PORT_FIBRE; | 202 | ecmd->port = PORT_FIBRE; |
205 | ecmd->autoneg = AUTONEG_DISABLE; | 203 | ecmd->autoneg = AUTONEG_DISABLE; |
206 | break; | 204 | break; |
207 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
208 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: | 205 | case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: |
209 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: | 206 | case NETXEN_BRDTYPE_P3_10G_SFP_CT: |
210 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 207 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
208 | ecmd->advertising |= ADVERTISED_TP; | ||
209 | ecmd->supported |= SUPPORTED_TP; | ||
210 | case NETXEN_BRDTYPE_P2_SB31_10G: | ||
211 | case NETXEN_BRDTYPE_P3_10G_XFP: | 211 | case NETXEN_BRDTYPE_P3_10G_XFP: |
212 | ecmd->supported |= SUPPORTED_FIBRE; | 212 | ecmd->supported |= SUPPORTED_FIBRE; |
213 | ecmd->advertising |= ADVERTISED_FIBRE; | 213 | ecmd->advertising |= ADVERTISED_FIBRE; |
214 | ecmd->port = PORT_FIBRE; | 214 | ecmd->port = PORT_FIBRE; |
215 | ecmd->autoneg = AUTONEG_DISABLE; | 215 | ecmd->autoneg = AUTONEG_DISABLE; |
216 | break; | 216 | break; |
217 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
218 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | ||
219 | ecmd->autoneg = AUTONEG_DISABLE; | ||
220 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | ||
221 | ecmd->advertising |= | ||
222 | (ADVERTISED_FIBRE | ADVERTISED_TP); | ||
223 | ecmd->port = PORT_FIBRE; | ||
224 | } else { | ||
225 | ecmd->autoneg = AUTONEG_ENABLE; | ||
226 | ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); | ||
227 | ecmd->advertising |= | ||
228 | (ADVERTISED_TP | ADVERTISED_Autoneg); | ||
229 | ecmd->port = PORT_TP; | ||
230 | } | ||
231 | break; | ||
217 | default: | 232 | default: |
218 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", | 233 | printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", |
219 | (netxen_brdtype_t) boardinfo->board_type); | 234 | (netxen_brdtype_t) boardinfo->board_type); |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index aa6e603bfcb..821cff68b3f 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -503,17 +503,15 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
503 | 503 | ||
504 | i = 0; | 504 | i = 0; |
505 | 505 | ||
506 | netif_tx_lock_bh(adapter->netdev); | ||
507 | |||
506 | producer = adapter->cmd_producer; | 508 | producer = adapter->cmd_producer; |
507 | do { | 509 | do { |
508 | cmd_desc = &cmd_desc_arr[i]; | 510 | cmd_desc = &cmd_desc_arr[i]; |
509 | 511 | ||
510 | pbuf = &adapter->cmd_buf_arr[producer]; | 512 | pbuf = &adapter->cmd_buf_arr[producer]; |
511 | pbuf->mss = 0; | ||
512 | pbuf->total_length = 0; | ||
513 | pbuf->skb = NULL; | 513 | pbuf->skb = NULL; |
514 | pbuf->cmd = 0; | ||
515 | pbuf->frag_count = 0; | 514 | pbuf->frag_count = 0; |
516 | pbuf->port = 0; | ||
517 | 515 | ||
518 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ | 516 | /* adapter->ahw.cmd_desc_head[producer] = *cmd_desc; */ |
519 | memcpy(&adapter->ahw.cmd_desc_head[producer], | 517 | memcpy(&adapter->ahw.cmd_desc_head[producer], |
@@ -531,6 +529,8 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter, | |||
531 | 529 | ||
532 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); | 530 | netxen_nic_update_cmd_producer(adapter, adapter->cmd_producer); |
533 | 531 | ||
532 | netif_tx_unlock_bh(adapter->netdev); | ||
533 | |||
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
536 | 536 | ||
@@ -539,16 +539,19 @@ static int nx_p3_sre_macaddr_change(struct net_device *dev, | |||
539 | { | 539 | { |
540 | struct netxen_adapter *adapter = netdev_priv(dev); | 540 | struct netxen_adapter *adapter = netdev_priv(dev); |
541 | nx_nic_req_t req; | 541 | nx_nic_req_t req; |
542 | nx_mac_req_t mac_req; | 542 | nx_mac_req_t *mac_req; |
543 | u64 word; | ||
543 | int rv; | 544 | int rv; |
544 | 545 | ||
545 | memset(&req, 0, sizeof(nx_nic_req_t)); | 546 | memset(&req, 0, sizeof(nx_nic_req_t)); |
546 | req.qhdr |= (NX_NIC_REQUEST << 23); | 547 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
547 | req.req_hdr |= NX_MAC_EVENT; | 548 | |
548 | req.req_hdr |= ((u64)adapter->portnum << 16); | 549 | word = NX_MAC_EVENT | ((u64)adapter->portnum << 16); |
549 | mac_req.op = op; | 550 | req.req_hdr = cpu_to_le64(word); |
550 | memcpy(&mac_req.mac_addr, addr, 6); | 551 | |
551 | req.words[0] = cpu_to_le64(*(u64 *)&mac_req); | 552 | mac_req = (nx_mac_req_t *)&req.words[0]; |
553 | mac_req->op = op; | ||
554 | memcpy(mac_req->mac_addr, addr, 6); | ||
552 | 555 | ||
553 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); | 556 | rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); |
554 | if (rv != 0) { | 557 | if (rv != 0) { |
@@ -612,18 +615,35 @@ send_fw_cmd: | |||
612 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 615 | int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
613 | { | 616 | { |
614 | nx_nic_req_t req; | 617 | nx_nic_req_t req; |
618 | u64 word; | ||
615 | 619 | ||
616 | memset(&req, 0, sizeof(nx_nic_req_t)); | 620 | memset(&req, 0, sizeof(nx_nic_req_t)); |
617 | 621 | ||
618 | req.qhdr |= (NX_HOST_REQUEST << 23); | 622 | req.qhdr = cpu_to_le64(NX_HOST_REQUEST << 23); |
619 | req.req_hdr |= NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE; | 623 | |
620 | req.req_hdr |= ((u64)adapter->portnum << 16); | 624 | word = NX_NIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE | |
625 | ((u64)adapter->portnum << 16); | ||
626 | req.req_hdr = cpu_to_le64(word); | ||
627 | |||
621 | req.words[0] = cpu_to_le64(mode); | 628 | req.words[0] = cpu_to_le64(mode); |
622 | 629 | ||
623 | return netxen_send_cmd_descs(adapter, | 630 | return netxen_send_cmd_descs(adapter, |
624 | (struct cmd_desc_type0 *)&req, 1); | 631 | (struct cmd_desc_type0 *)&req, 1); |
625 | } | 632 | } |
626 | 633 | ||
634 | void netxen_p3_free_mac_list(struct netxen_adapter *adapter) | ||
635 | { | ||
636 | nx_mac_list_t *cur, *next; | ||
637 | |||
638 | cur = adapter->mac_list; | ||
639 | |||
640 | while (cur) { | ||
641 | next = cur->next; | ||
642 | kfree(cur); | ||
643 | cur = next; | ||
644 | } | ||
645 | } | ||
646 | |||
627 | #define NETXEN_CONFIG_INTR_COALESCE 3 | 647 | #define NETXEN_CONFIG_INTR_COALESCE 3 |
628 | 648 | ||
629 | /* | 649 | /* |
@@ -632,13 +652,15 @@ int netxen_p3_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | |||
632 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) | 652 | int netxen_config_intr_coalesce(struct netxen_adapter *adapter) |
633 | { | 653 | { |
634 | nx_nic_req_t req; | 654 | nx_nic_req_t req; |
655 | u64 word; | ||
635 | int rv; | 656 | int rv; |
636 | 657 | ||
637 | memset(&req, 0, sizeof(nx_nic_req_t)); | 658 | memset(&req, 0, sizeof(nx_nic_req_t)); |
638 | 659 | ||
639 | req.qhdr |= (NX_NIC_REQUEST << 23); | 660 | req.qhdr = cpu_to_le64(NX_NIC_REQUEST << 23); |
640 | req.req_hdr |= NETXEN_CONFIG_INTR_COALESCE; | 661 | |
641 | req.req_hdr |= ((u64)adapter->portnum << 16); | 662 | word = NETXEN_CONFIG_INTR_COALESCE | ((u64)adapter->portnum << 16); |
663 | req.req_hdr = cpu_to_le64(word); | ||
642 | 664 | ||
643 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); | 665 | memcpy(&req.words[0], &adapter->coal, sizeof(adapter->coal)); |
644 | 666 | ||
@@ -772,13 +794,10 @@ int netxen_p3_get_mac_addr(struct netxen_adapter *adapter, __le64 *mac) | |||
772 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); | 794 | adapter->hw_read_wx(adapter, crbaddr, &mac_lo, 4); |
773 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); | 795 | adapter->hw_read_wx(adapter, crbaddr+4, &mac_hi, 4); |
774 | 796 | ||
775 | mac_hi = cpu_to_le32(mac_hi); | ||
776 | mac_lo = cpu_to_le32(mac_lo); | ||
777 | |||
778 | if (pci_func & 1) | 797 | if (pci_func & 1) |
779 | *mac = ((mac_lo >> 16) | ((u64)mac_hi << 16)); | 798 | *mac = le64_to_cpu((mac_lo >> 16) | ((u64)mac_hi << 16)); |
780 | else | 799 | else |
781 | *mac = ((mac_lo) | ((u64)mac_hi << 32)); | 800 | *mac = le64_to_cpu((u64)mac_lo | ((u64)mac_hi << 32)); |
782 | 801 | ||
783 | return 0; | 802 | return 0; |
784 | } | 803 | } |
@@ -937,7 +956,7 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
937 | { | 956 | { |
938 | int i; | 957 | int i; |
939 | u32 data, size = 0; | 958 | u32 data, size = 0; |
940 | u32 flashaddr = NETXEN_BOOTLD_START, memaddr = NETXEN_BOOTLD_START; | 959 | u32 flashaddr = NETXEN_BOOTLD_START; |
941 | 960 | ||
942 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; | 961 | size = (NETXEN_IMAGE_START - NETXEN_BOOTLD_START)/4; |
943 | 962 | ||
@@ -949,10 +968,8 @@ int netxen_load_firmware(struct netxen_adapter *adapter) | |||
949 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) | 968 | if (netxen_rom_fast_read(adapter, flashaddr, (int *)&data) != 0) |
950 | return -EIO; | 969 | return -EIO; |
951 | 970 | ||
952 | adapter->pci_mem_write(adapter, memaddr, &data, 4); | 971 | adapter->pci_mem_write(adapter, flashaddr, &data, 4); |
953 | flashaddr += 4; | 972 | flashaddr += 4; |
954 | memaddr += 4; | ||
955 | cond_resched(); | ||
956 | } | 973 | } |
957 | msleep(1); | 974 | msleep(1); |
958 | 975 | ||
@@ -2034,7 +2051,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2034 | rv = -1; | 2051 | rv = -1; |
2035 | } | 2052 | } |
2036 | 2053 | ||
2037 | DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); | 2054 | if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { |
2055 | u32 gpio = netxen_nic_reg_read(adapter, | ||
2056 | NETXEN_ROMUSB_GLB_PAD_GPIO_I); | ||
2057 | if ((gpio & 0x8000) == 0) | ||
2058 | boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP; | ||
2059 | } | ||
2060 | |||
2038 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 2061 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
2039 | case NETXEN_BRDTYPE_P2_SB35_4G: | 2062 | case NETXEN_BRDTYPE_P2_SB35_4G: |
2040 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2063 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
@@ -2053,7 +2076,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2053 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 2076 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
2054 | case NETXEN_BRDTYPE_P3_10G_XFP: | 2077 | case NETXEN_BRDTYPE_P3_10G_XFP: |
2055 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | 2078 | case NETXEN_BRDTYPE_P3_10000_BASE_T: |
2056 | |||
2057 | adapter->ahw.board_type = NETXEN_NIC_XGBE; | 2079 | adapter->ahw.board_type = NETXEN_NIC_XGBE; |
2058 | break; | 2080 | break; |
2059 | case NETXEN_BRDTYPE_P1_BD: | 2081 | case NETXEN_BRDTYPE_P1_BD: |
@@ -2063,9 +2085,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2063 | case NETXEN_BRDTYPE_P3_REF_QG: | 2085 | case NETXEN_BRDTYPE_P3_REF_QG: |
2064 | case NETXEN_BRDTYPE_P3_4_GB: | 2086 | case NETXEN_BRDTYPE_P3_4_GB: |
2065 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 2087 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
2066 | |||
2067 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2088 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
2068 | break; | 2089 | break; |
2090 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
2091 | adapter->ahw.board_type = (adapter->portnum < 2) ? | ||
2092 | NETXEN_NIC_XGBE : NETXEN_NIC_GBE; | ||
2093 | break; | ||
2069 | default: | 2094 | default: |
2070 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, | 2095 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, |
2071 | boardinfo->board_type); | 2096 | boardinfo->board_type); |
@@ -2110,12 +2135,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2110 | { | 2135 | { |
2111 | __u32 status; | 2136 | __u32 status; |
2112 | __u32 autoneg; | 2137 | __u32 autoneg; |
2113 | __u32 mode; | ||
2114 | __u32 port_mode; | 2138 | __u32 port_mode; |
2115 | 2139 | ||
2116 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | 2140 | if (!netif_carrier_ok(adapter->netdev)) { |
2117 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 2141 | adapter->link_speed = 0; |
2142 | adapter->link_duplex = -1; | ||
2143 | adapter->link_autoneg = AUTONEG_ENABLE; | ||
2144 | return; | ||
2145 | } | ||
2118 | 2146 | ||
2147 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | ||
2119 | adapter->hw_read_wx(adapter, | 2148 | adapter->hw_read_wx(adapter, |
2120 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); | 2149 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); |
2121 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { | 2150 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { |
@@ -2141,7 +2170,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2141 | adapter->link_speed = SPEED_1000; | 2170 | adapter->link_speed = SPEED_1000; |
2142 | break; | 2171 | break; |
2143 | default: | 2172 | default: |
2144 | adapter->link_speed = -1; | 2173 | adapter->link_speed = 0; |
2145 | break; | 2174 | break; |
2146 | } | 2175 | } |
2147 | switch (netxen_get_phy_duplex(status)) { | 2176 | switch (netxen_get_phy_duplex(status)) { |
@@ -2164,7 +2193,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2164 | goto link_down; | 2193 | goto link_down; |
2165 | } else { | 2194 | } else { |
2166 | link_down: | 2195 | link_down: |
2167 | adapter->link_speed = -1; | 2196 | adapter->link_speed = 0; |
2168 | adapter->link_duplex = -1; | 2197 | adapter->link_duplex = -1; |
2169 | } | 2198 | } |
2170 | } | 2199 | } |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index d924468e506..ca7c8d8050c 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -308,7 +308,6 @@ int netxen_alloc_sw_resources(struct netxen_adapter *adapter) | |||
308 | } | 308 | } |
309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); | 309 | memset(rds_ring->rx_buf_arr, 0, RCV_BUFFSIZE); |
310 | INIT_LIST_HEAD(&rds_ring->free_list); | 310 | INIT_LIST_HEAD(&rds_ring->free_list); |
311 | rds_ring->begin_alloc = 0; | ||
312 | /* | 311 | /* |
313 | * Now go through all of them, set reference handles | 312 | * Now go through all of them, set reference handles |
314 | * and put them in the queues. | 313 | * and put them in the queues. |
@@ -439,6 +438,8 @@ static int netxen_wait_rom_done(struct netxen_adapter *adapter) | |||
439 | long timeout = 0; | 438 | long timeout = 0; |
440 | long done = 0; | 439 | long done = 0; |
441 | 440 | ||
441 | cond_resched(); | ||
442 | |||
442 | while (done == 0) { | 443 | while (done == 0) { |
443 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); | 444 | done = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_GLB_STATUS); |
444 | done &= 2; | 445 | done &= 2; |
@@ -533,12 +534,9 @@ static int do_rom_fast_write(struct netxen_adapter *adapter, int addr, | |||
533 | static int do_rom_fast_read(struct netxen_adapter *adapter, | 534 | static int do_rom_fast_read(struct netxen_adapter *adapter, |
534 | int addr, int *valp) | 535 | int addr, int *valp) |
535 | { | 536 | { |
536 | cond_resched(); | ||
537 | |||
538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); | 537 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ADDRESS, addr); |
539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
540 | udelay(100); /* prevent bursting on CRB */ | ||
541 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 538 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
539 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 3); | ||
542 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); | 540 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_INSTR_OPCODE, 0xb); |
543 | if (netxen_wait_rom_done(adapter)) { | 541 | if (netxen_wait_rom_done(adapter)) { |
544 | printk("Error waiting for rom done\n"); | 542 | printk("Error waiting for rom done\n"); |
@@ -546,7 +544,7 @@ static int do_rom_fast_read(struct netxen_adapter *adapter, | |||
546 | } | 544 | } |
547 | /* reset abyte_cnt and dummy_byte_cnt */ | 545 | /* reset abyte_cnt and dummy_byte_cnt */ |
548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); | 546 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_ABYTE_CNT, 0); |
549 | udelay(100); /* prevent bursting on CRB */ | 547 | udelay(10); |
550 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); | 548 | netxen_nic_reg_write(adapter, NETXEN_ROMUSB_ROM_DUMMY_BYTE_CNT, 0); |
551 | 549 | ||
552 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); | 550 | *valp = netxen_nic_reg_read(adapter, NETXEN_ROMUSB_ROM_RDATA); |
@@ -884,14 +882,16 @@ int netxen_flash_unlock(struct netxen_adapter *adapter) | |||
884 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | 882 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) |
885 | { | 883 | { |
886 | int addr, val; | 884 | int addr, val; |
887 | int i, init_delay = 0; | 885 | int i, n, init_delay = 0; |
888 | struct crb_addr_pair *buf; | 886 | struct crb_addr_pair *buf; |
889 | unsigned offset, n; | 887 | unsigned offset; |
890 | u32 off; | 888 | u32 off; |
891 | 889 | ||
892 | /* resetall */ | 890 | /* resetall */ |
891 | rom_lock(adapter); | ||
893 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, | 892 | netxen_crb_writelit_adapter(adapter, NETXEN_ROMUSB_GLB_SW_RESET, |
894 | 0xffffffff); | 893 | 0xffffffff); |
894 | netxen_rom_unlock(adapter); | ||
895 | 895 | ||
896 | if (verbose) { | 896 | if (verbose) { |
897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) | 897 | if (netxen_rom_fast_read(adapter, NETXEN_BOARDTYPE, &val) == 0) |
@@ -910,7 +910,7 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
910 | 910 | ||
911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { | 911 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { |
912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || | 912 | if (netxen_rom_fast_read(adapter, 0, &n) != 0 || |
913 | (n != 0xcafecafeUL) || | 913 | (n != 0xcafecafe) || |
914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { | 914 | netxen_rom_fast_read(adapter, 4, &n) != 0) { |
915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " | 915 | printk(KERN_ERR "%s: ERROR Reading crb_init area: " |
916 | "n: %08x\n", netxen_nic_driver_name, n); | 916 | "n: %08x\n", netxen_nic_driver_name, n); |
@@ -975,6 +975,14 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
975 | /* do not reset PCI */ | 975 | /* do not reset PCI */ |
976 | if (off == (ROMUSB_GLB + 0xbc)) | 976 | if (off == (ROMUSB_GLB + 0xbc)) |
977 | continue; | 977 | continue; |
978 | if (off == (ROMUSB_GLB + 0xa8)) | ||
979 | continue; | ||
980 | if (off == (ROMUSB_GLB + 0xc8)) /* core clock */ | ||
981 | continue; | ||
982 | if (off == (ROMUSB_GLB + 0x24)) /* MN clock */ | ||
983 | continue; | ||
984 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | ||
985 | continue; | ||
978 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 986 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
979 | buf[i].data = 0x1020; | 987 | buf[i].data = 0x1020; |
980 | /* skip the function enable register */ | 988 | /* skip the function enable register */ |
@@ -992,23 +1000,21 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
992 | continue; | 1000 | continue; |
993 | } | 1001 | } |
994 | 1002 | ||
1003 | init_delay = 1; | ||
995 | /* After writing this register, HW needs time for CRB */ | 1004 | /* After writing this register, HW needs time for CRB */ |
996 | /* to quiet down (else crb_window returns 0xffffffff) */ | 1005 | /* to quiet down (else crb_window returns 0xffffffff) */ |
997 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { | 1006 | if (off == NETXEN_ROMUSB_GLB_SW_RESET) { |
998 | init_delay = 1; | 1007 | init_delay = 1000; |
999 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 1008 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { |
1000 | /* hold xdma in reset also */ | 1009 | /* hold xdma in reset also */ |
1001 | buf[i].data = NETXEN_NIC_XDMA_RESET; | 1010 | buf[i].data = NETXEN_NIC_XDMA_RESET; |
1011 | buf[i].data = 0x8000ff; | ||
1002 | } | 1012 | } |
1003 | } | 1013 | } |
1004 | 1014 | ||
1005 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); | 1015 | adapter->hw_write_wx(adapter, off, &buf[i].data, 4); |
1006 | 1016 | ||
1007 | if (init_delay == 1) { | 1017 | msleep(init_delay); |
1008 | msleep(1000); | ||
1009 | init_delay = 0; | ||
1010 | } | ||
1011 | msleep(1); | ||
1012 | } | 1018 | } |
1013 | kfree(buf); | 1019 | kfree(buf); |
1014 | 1020 | ||
@@ -1277,7 +1283,7 @@ static void netxen_process_rcv(struct netxen_adapter *adapter, int ctxid, | |||
1277 | 1283 | ||
1278 | dev_kfree_skb_any(skb); | 1284 | dev_kfree_skb_any(skb); |
1279 | for (i = 0; i < nr_frags; i++) { | 1285 | for (i = 0; i < nr_frags; i++) { |
1280 | index = frag_desc->frag_handles[i]; | 1286 | index = le16_to_cpu(frag_desc->frag_handles[i]); |
1281 | skb = netxen_process_rxbuf(adapter, | 1287 | skb = netxen_process_rxbuf(adapter, |
1282 | rds_ring, index, cksum); | 1288 | rds_ring, index, cksum); |
1283 | if (skb) | 1289 | if (skb) |
@@ -1428,7 +1434,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1428 | struct rcv_desc *pdesc; | 1434 | struct rcv_desc *pdesc; |
1429 | struct netxen_rx_buffer *buffer; | 1435 | struct netxen_rx_buffer *buffer; |
1430 | int count = 0; | 1436 | int count = 0; |
1431 | int index = 0; | ||
1432 | netxen_ctx_msg msg = 0; | 1437 | netxen_ctx_msg msg = 0; |
1433 | dma_addr_t dma; | 1438 | dma_addr_t dma; |
1434 | struct list_head *head; | 1439 | struct list_head *head; |
@@ -1436,7 +1441,6 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1436 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1441 | rds_ring = &recv_ctx->rds_rings[ringid]; |
1437 | 1442 | ||
1438 | producer = rds_ring->producer; | 1443 | producer = rds_ring->producer; |
1439 | index = rds_ring->begin_alloc; | ||
1440 | head = &rds_ring->free_list; | 1444 | head = &rds_ring->free_list; |
1441 | 1445 | ||
1442 | /* We can start writing rx descriptors into the phantom memory. */ | 1446 | /* We can start writing rx descriptors into the phantom memory. */ |
@@ -1444,39 +1448,37 @@ void netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ctx, u32 ringid) | |||
1444 | 1448 | ||
1445 | skb = dev_alloc_skb(rds_ring->skb_size); | 1449 | skb = dev_alloc_skb(rds_ring->skb_size); |
1446 | if (unlikely(!skb)) { | 1450 | if (unlikely(!skb)) { |
1447 | rds_ring->begin_alloc = index; | ||
1448 | break; | 1451 | break; |
1449 | } | 1452 | } |
1450 | 1453 | ||
1454 | if (!adapter->ahw.cut_through) | ||
1455 | skb_reserve(skb, 2); | ||
1456 | |||
1457 | dma = pci_map_single(pdev, skb->data, | ||
1458 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
1459 | if (pci_dma_mapping_error(pdev, dma)) { | ||
1460 | dev_kfree_skb_any(skb); | ||
1461 | break; | ||
1462 | } | ||
1463 | |||
1464 | count++; | ||
1451 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1465 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
1452 | list_del(&buffer->list); | 1466 | list_del(&buffer->list); |
1453 | 1467 | ||
1454 | count++; /* now there should be no failure */ | ||
1455 | pdesc = &rds_ring->desc_head[producer]; | ||
1456 | |||
1457 | if (!adapter->ahw.cut_through) | ||
1458 | skb_reserve(skb, 2); | ||
1459 | /* This will be setup when we receive the | ||
1460 | * buffer after it has been filled FSL TBD TBD | ||
1461 | * skb->dev = netdev; | ||
1462 | */ | ||
1463 | dma = pci_map_single(pdev, skb->data, rds_ring->dma_size, | ||
1464 | PCI_DMA_FROMDEVICE); | ||
1465 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
1466 | buffer->skb = skb; | 1468 | buffer->skb = skb; |
1467 | buffer->state = NETXEN_BUFFER_BUSY; | 1469 | buffer->state = NETXEN_BUFFER_BUSY; |
1468 | buffer->dma = dma; | 1470 | buffer->dma = dma; |
1471 | |||
1469 | /* make a rcv descriptor */ | 1472 | /* make a rcv descriptor */ |
1473 | pdesc = &rds_ring->desc_head[producer]; | ||
1474 | pdesc->addr_buffer = cpu_to_le64(dma); | ||
1470 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1475 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
1471 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1476 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
1472 | DPRINTK(INFO, "done writing descripter\n"); | 1477 | |
1473 | producer = | 1478 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
1474 | get_next_index(producer, rds_ring->max_rx_desc_count); | ||
1475 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
1476 | } | 1479 | } |
1477 | /* if we did allocate buffers, then write the count to Phantom */ | 1480 | /* if we did allocate buffers, then write the count to Phantom */ |
1478 | if (count) { | 1481 | if (count) { |
1479 | rds_ring->begin_alloc = index; | ||
1480 | rds_ring->producer = producer; | 1482 | rds_ring->producer = producer; |
1481 | /* Window = 1 */ | 1483 | /* Window = 1 */ |
1482 | adapter->pci_write_normalize(adapter, | 1484 | adapter->pci_write_normalize(adapter, |
@@ -1515,49 +1517,50 @@ static void netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, | |||
1515 | struct rcv_desc *pdesc; | 1517 | struct rcv_desc *pdesc; |
1516 | struct netxen_rx_buffer *buffer; | 1518 | struct netxen_rx_buffer *buffer; |
1517 | int count = 0; | 1519 | int count = 0; |
1518 | int index = 0; | ||
1519 | struct list_head *head; | 1520 | struct list_head *head; |
1521 | dma_addr_t dma; | ||
1520 | 1522 | ||
1521 | rds_ring = &recv_ctx->rds_rings[ringid]; | 1523 | rds_ring = &recv_ctx->rds_rings[ringid]; |
1522 | 1524 | ||
1523 | producer = rds_ring->producer; | 1525 | producer = rds_ring->producer; |
1524 | index = rds_ring->begin_alloc; | ||
1525 | head = &rds_ring->free_list; | 1526 | head = &rds_ring->free_list; |
1526 | /* We can start writing rx descriptors into the phantom memory. */ | 1527 | /* We can start writing rx descriptors into the phantom memory. */ |
1527 | while (!list_empty(head)) { | 1528 | while (!list_empty(head)) { |
1528 | 1529 | ||
1529 | skb = dev_alloc_skb(rds_ring->skb_size); | 1530 | skb = dev_alloc_skb(rds_ring->skb_size); |
1530 | if (unlikely(!skb)) { | 1531 | if (unlikely(!skb)) { |
1531 | rds_ring->begin_alloc = index; | ||
1532 | break; | 1532 | break; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | if (!adapter->ahw.cut_through) | ||
1536 | skb_reserve(skb, 2); | ||
1537 | |||
1538 | dma = pci_map_single(pdev, skb->data, | ||
1539 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | ||
1540 | if (pci_dma_mapping_error(pdev, dma)) { | ||
1541 | dev_kfree_skb_any(skb); | ||
1542 | break; | ||
1543 | } | ||
1544 | |||
1545 | count++; | ||
1535 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); | 1546 | buffer = list_entry(head->next, struct netxen_rx_buffer, list); |
1536 | list_del(&buffer->list); | 1547 | list_del(&buffer->list); |
1537 | 1548 | ||
1538 | count++; /* now there should be no failure */ | ||
1539 | pdesc = &rds_ring->desc_head[producer]; | ||
1540 | if (!adapter->ahw.cut_through) | ||
1541 | skb_reserve(skb, 2); | ||
1542 | buffer->skb = skb; | 1549 | buffer->skb = skb; |
1543 | buffer->state = NETXEN_BUFFER_BUSY; | 1550 | buffer->state = NETXEN_BUFFER_BUSY; |
1544 | buffer->dma = pci_map_single(pdev, skb->data, | 1551 | buffer->dma = dma; |
1545 | rds_ring->dma_size, | ||
1546 | PCI_DMA_FROMDEVICE); | ||
1547 | 1552 | ||
1548 | /* make a rcv descriptor */ | 1553 | /* make a rcv descriptor */ |
1554 | pdesc = &rds_ring->desc_head[producer]; | ||
1549 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); | 1555 | pdesc->reference_handle = cpu_to_le16(buffer->ref_handle); |
1550 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); | 1556 | pdesc->buffer_length = cpu_to_le32(rds_ring->dma_size); |
1551 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); | 1557 | pdesc->addr_buffer = cpu_to_le64(buffer->dma); |
1552 | producer = | 1558 | |
1553 | get_next_index(producer, rds_ring->max_rx_desc_count); | 1559 | producer = get_next_index(producer, rds_ring->max_rx_desc_count); |
1554 | index = get_next_index(index, rds_ring->max_rx_desc_count); | ||
1555 | buffer = &rds_ring->rx_buf_arr[index]; | ||
1556 | } | 1560 | } |
1557 | 1561 | ||
1558 | /* if we did allocate buffers, then write the count to Phantom */ | 1562 | /* if we did allocate buffers, then write the count to Phantom */ |
1559 | if (count) { | 1563 | if (count) { |
1560 | rds_ring->begin_alloc = index; | ||
1561 | rds_ring->producer = producer; | 1564 | rds_ring->producer = producer; |
1562 | /* Window = 1 */ | 1565 | /* Window = 1 */ |
1563 | adapter->pci_write_normalize(adapter, | 1566 | adapter->pci_write_normalize(adapter, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index ba01524b553..d854f07ef4d 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -39,7 +39,9 @@ | |||
39 | #include "netxen_nic_phan_reg.h" | 39 | #include "netxen_nic_phan_reg.h" |
40 | 40 | ||
41 | #include <linux/dma-mapping.h> | 41 | #include <linux/dma-mapping.h> |
42 | #include <linux/if_vlan.h> | ||
42 | #include <net/ip.h> | 43 | #include <net/ip.h> |
44 | #include <linux/ipv6.h> | ||
43 | 45 | ||
44 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 46 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
45 | MODULE_LICENSE("GPL"); | 47 | MODULE_LICENSE("GPL"); |
@@ -242,7 +244,7 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
242 | case NETXEN_BRDTYPE_P3_4_GB: | 244 | case NETXEN_BRDTYPE_P3_4_GB: |
243 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 245 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
244 | adapter->msix_supported = !!use_msi_x; | 246 | adapter->msix_supported = !!use_msi_x; |
245 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | 247 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
246 | break; | 248 | break; |
247 | 249 | ||
248 | case NETXEN_BRDTYPE_P2_SB35_4G: | 250 | case NETXEN_BRDTYPE_P2_SB35_4G: |
@@ -251,6 +253,14 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
251 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 253 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
252 | break; | 254 | break; |
253 | 255 | ||
256 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
257 | adapter->msix_supported = !!use_msi_x; | ||
258 | if (adapter->ahw.board_type == NETXEN_NIC_XGBE) | ||
259 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; | ||
260 | else | ||
261 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | ||
262 | break; | ||
263 | |||
254 | default: | 264 | default: |
255 | adapter->msix_supported = 0; | 265 | adapter->msix_supported = 0; |
256 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; | 266 | adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; |
@@ -271,10 +281,15 @@ static void netxen_check_options(struct netxen_adapter *adapter) | |||
271 | static int | 281 | static int |
272 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | 282 | netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) |
273 | { | 283 | { |
274 | int ret = 0; | 284 | u32 val, timeout; |
275 | 285 | ||
276 | if (first_boot == 0x55555555) { | 286 | if (first_boot == 0x55555555) { |
277 | /* This is the first boot after power up */ | 287 | /* This is the first boot after power up */ |
288 | adapter->pci_write_normalize(adapter, | ||
289 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | ||
290 | |||
291 | if (!NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
292 | return 0; | ||
278 | 293 | ||
279 | /* PCI bus master workaround */ | 294 | /* PCI bus master workaround */ |
280 | adapter->hw_read_wx(adapter, | 295 | adapter->hw_read_wx(adapter, |
@@ -294,18 +309,26 @@ netxen_check_hw_init(struct netxen_adapter *adapter, int first_boot) | |||
294 | /* clear the register for future unloads/loads */ | 309 | /* clear the register for future unloads/loads */ |
295 | adapter->pci_write_normalize(adapter, | 310 | adapter->pci_write_normalize(adapter, |
296 | NETXEN_CAM_RAM(0x1fc), 0); | 311 | NETXEN_CAM_RAM(0x1fc), 0); |
297 | ret = -1; | 312 | return -EIO; |
298 | } | 313 | } |
299 | 314 | ||
300 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) { | 315 | /* Start P2 boot loader */ |
301 | /* Start P2 boot loader */ | 316 | val = adapter->pci_read_normalize(adapter, |
302 | adapter->pci_write_normalize(adapter, | 317 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE); |
303 | NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 318 | adapter->pci_write_normalize(adapter, |
304 | adapter->pci_write_normalize(adapter, | 319 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, val | 0x1); |
305 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | 320 | timeout = 0; |
306 | } | 321 | do { |
322 | msleep(1); | ||
323 | val = adapter->pci_read_normalize(adapter, | ||
324 | NETXEN_CAM_RAM(0x1fc)); | ||
325 | |||
326 | if (++timeout > 5000) | ||
327 | return -EIO; | ||
328 | |||
329 | } while (val == NETXEN_BDINFO_MAGIC); | ||
307 | } | 330 | } |
308 | return ret; | 331 | return 0; |
309 | } | 332 | } |
310 | 333 | ||
311 | static void netxen_set_port_mode(struct netxen_adapter *adapter) | 334 | static void netxen_set_port_mode(struct netxen_adapter *adapter) |
@@ -784,8 +807,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
784 | CRB_CMDPEG_STATE, 0); | 807 | CRB_CMDPEG_STATE, 0); |
785 | netxen_pinit_from_rom(adapter, 0); | 808 | netxen_pinit_from_rom(adapter, 0); |
786 | msleep(1); | 809 | msleep(1); |
787 | netxen_load_firmware(adapter); | ||
788 | } | 810 | } |
811 | netxen_load_firmware(adapter); | ||
789 | 812 | ||
790 | if (NX_IS_REVISION_P3(revision_id)) | 813 | if (NX_IS_REVISION_P3(revision_id)) |
791 | netxen_pcie_strap_init(adapter); | 814 | netxen_pcie_strap_init(adapter); |
@@ -801,13 +824,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
801 | 824 | ||
802 | } | 825 | } |
803 | 826 | ||
804 | if ((first_boot == 0x55555555) && | ||
805 | (NX_IS_REVISION_P2(revision_id))) { | ||
806 | /* Unlock the HW, prompting the boot sequence */ | ||
807 | adapter->pci_write_normalize(adapter, | ||
808 | NETXEN_ROMUSB_GLB_PEGTUNE_DONE, 1); | ||
809 | } | ||
810 | |||
811 | err = netxen_initialize_adapter_offload(adapter); | 827 | err = netxen_initialize_adapter_offload(adapter); |
812 | if (err) | 828 | if (err) |
813 | goto err_out_iounmap; | 829 | goto err_out_iounmap; |
@@ -821,7 +837,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
821 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); | 837 | adapter->pci_write_normalize(adapter, CRB_DRIVER_VERSION, i); |
822 | 838 | ||
823 | /* Handshake with the card before we register the devices. */ | 839 | /* Handshake with the card before we register the devices. */ |
824 | netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); | 840 | err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); |
841 | if (err) | ||
842 | goto err_out_free_offload; | ||
825 | 843 | ||
826 | } /* first_driver */ | 844 | } /* first_driver */ |
827 | 845 | ||
@@ -925,6 +943,7 @@ err_out_disable_msi: | |||
925 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) | 943 | if (adapter->flags & NETXEN_NIC_MSI_ENABLED) |
926 | pci_disable_msi(pdev); | 944 | pci_disable_msi(pdev); |
927 | 945 | ||
946 | err_out_free_offload: | ||
928 | if (first_driver) | 947 | if (first_driver) |
929 | netxen_free_adapter_offload(adapter); | 948 | netxen_free_adapter_offload(adapter); |
930 | 949 | ||
@@ -968,6 +987,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
968 | netxen_free_hw_resources(adapter); | 987 | netxen_free_hw_resources(adapter); |
969 | netxen_release_rx_buffers(adapter); | 988 | netxen_release_rx_buffers(adapter); |
970 | netxen_free_sw_resources(adapter); | 989 | netxen_free_sw_resources(adapter); |
990 | |||
991 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | ||
992 | netxen_p3_free_mac_list(adapter); | ||
971 | } | 993 | } |
972 | 994 | ||
973 | if (adapter->portnum == 0) | 995 | if (adapter->portnum == 0) |
@@ -983,8 +1005,10 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev) | |||
983 | 1005 | ||
984 | iounmap(adapter->ahw.db_base); | 1006 | iounmap(adapter->ahw.db_base); |
985 | iounmap(adapter->ahw.pci_base0); | 1007 | iounmap(adapter->ahw.pci_base0); |
986 | iounmap(adapter->ahw.pci_base1); | 1008 | if (adapter->ahw.pci_base1 != NULL) |
987 | iounmap(adapter->ahw.pci_base2); | 1009 | iounmap(adapter->ahw.pci_base1); |
1010 | if (adapter->ahw.pci_base2 != NULL) | ||
1011 | iounmap(adapter->ahw.pci_base2); | ||
988 | 1012 | ||
989 | pci_release_regions(pdev); | 1013 | pci_release_regions(pdev); |
990 | pci_disable_device(pdev); | 1014 | pci_disable_device(pdev); |
@@ -1137,29 +1161,64 @@ static int netxen_nic_close(struct net_device *netdev) | |||
1137 | return 0; | 1161 | return 0; |
1138 | } | 1162 | } |
1139 | 1163 | ||
1140 | void netxen_tso_check(struct netxen_adapter *adapter, | 1164 | static bool netxen_tso_check(struct net_device *netdev, |
1141 | struct cmd_desc_type0 *desc, struct sk_buff *skb) | 1165 | struct cmd_desc_type0 *desc, struct sk_buff *skb) |
1142 | { | 1166 | { |
1143 | if (desc->mss) { | 1167 | bool tso = false; |
1144 | desc->total_hdr_length = (sizeof(struct ethhdr) + | 1168 | u8 opcode = TX_ETHER_PKT; |
1145 | ip_hdrlen(skb) + tcp_hdrlen(skb)); | ||
1146 | 1169 | ||
1147 | if ((NX_IS_REVISION_P3(adapter->ahw.revision_id)) && | 1170 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && |
1148 | (skb->protocol == htons(ETH_P_IPV6))) | 1171 | skb_shinfo(skb)->gso_size > 0) { |
1149 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO6); | 1172 | |
1150 | else | 1173 | desc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); |
1151 | netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); | 1174 | desc->total_hdr_length = |
1175 | skb_transport_offset(skb) + tcp_hdrlen(skb); | ||
1176 | |||
1177 | opcode = (skb->protocol == htons(ETH_P_IPV6)) ? | ||
1178 | TX_TCP_LSO6 : TX_TCP_LSO; | ||
1179 | tso = true; | ||
1152 | 1180 | ||
1153 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1181 | } else if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1154 | if (ip_hdr(skb)->protocol == IPPROTO_TCP) | 1182 | u8 l4proto; |
1155 | netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); | 1183 | |
1156 | else if (ip_hdr(skb)->protocol == IPPROTO_UDP) | 1184 | if (skb->protocol == htons(ETH_P_IP)) { |
1157 | netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); | 1185 | l4proto = ip_hdr(skb)->protocol; |
1158 | else | 1186 | |
1159 | return; | 1187 | if (l4proto == IPPROTO_TCP) |
1188 | opcode = TX_TCP_PKT; | ||
1189 | else if(l4proto == IPPROTO_UDP) | ||
1190 | opcode = TX_UDP_PKT; | ||
1191 | } else if (skb->protocol == htons(ETH_P_IPV6)) { | ||
1192 | l4proto = ipv6_hdr(skb)->nexthdr; | ||
1193 | |||
1194 | if (l4proto == IPPROTO_TCP) | ||
1195 | opcode = TX_TCPV6_PKT; | ||
1196 | else if(l4proto == IPPROTO_UDP) | ||
1197 | opcode = TX_UDPV6_PKT; | ||
1198 | } | ||
1160 | } | 1199 | } |
1161 | desc->tcp_hdr_offset = skb_transport_offset(skb); | 1200 | desc->tcp_hdr_offset = skb_transport_offset(skb); |
1162 | desc->ip_hdr_offset = skb_network_offset(skb); | 1201 | desc->ip_hdr_offset = skb_network_offset(skb); |
1202 | netxen_set_tx_flags_opcode(desc, 0, opcode); | ||
1203 | return tso; | ||
1204 | } | ||
1205 | |||
1206 | static void | ||
1207 | netxen_clean_tx_dma_mapping(struct pci_dev *pdev, | ||
1208 | struct netxen_cmd_buffer *pbuf, int last) | ||
1209 | { | ||
1210 | int k; | ||
1211 | struct netxen_skb_frag *buffrag; | ||
1212 | |||
1213 | buffrag = &pbuf->frag_array[0]; | ||
1214 | pci_unmap_single(pdev, buffrag->dma, | ||
1215 | buffrag->length, PCI_DMA_TODEVICE); | ||
1216 | |||
1217 | for (k = 1; k < last; k++) { | ||
1218 | buffrag = &pbuf->frag_array[k]; | ||
1219 | pci_unmap_page(pdev, buffrag->dma, | ||
1220 | buffrag->length, PCI_DMA_TODEVICE); | ||
1221 | } | ||
1163 | } | 1222 | } |
1164 | 1223 | ||
1165 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | 1224 | static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) |
@@ -1167,33 +1226,22 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1167 | struct netxen_adapter *adapter = netdev_priv(netdev); | 1226 | struct netxen_adapter *adapter = netdev_priv(netdev); |
1168 | struct netxen_hardware_context *hw = &adapter->ahw; | 1227 | struct netxen_hardware_context *hw = &adapter->ahw; |
1169 | unsigned int first_seg_len = skb->len - skb->data_len; | 1228 | unsigned int first_seg_len = skb->len - skb->data_len; |
1229 | struct netxen_cmd_buffer *pbuf; | ||
1170 | struct netxen_skb_frag *buffrag; | 1230 | struct netxen_skb_frag *buffrag; |
1171 | unsigned int i; | 1231 | struct cmd_desc_type0 *hwdesc; |
1232 | struct pci_dev *pdev = adapter->pdev; | ||
1233 | dma_addr_t temp_dma; | ||
1234 | int i, k; | ||
1172 | 1235 | ||
1173 | u32 producer, consumer; | 1236 | u32 producer, consumer; |
1174 | u32 saved_producer = 0; | 1237 | int frag_count, no_of_desc; |
1175 | struct cmd_desc_type0 *hwdesc; | ||
1176 | int k; | ||
1177 | struct netxen_cmd_buffer *pbuf = NULL; | ||
1178 | int frag_count; | ||
1179 | int no_of_desc; | ||
1180 | u32 num_txd = adapter->max_tx_desc_count; | 1238 | u32 num_txd = adapter->max_tx_desc_count; |
1239 | bool is_tso = false; | ||
1181 | 1240 | ||
1182 | frag_count = skb_shinfo(skb)->nr_frags + 1; | 1241 | frag_count = skb_shinfo(skb)->nr_frags + 1; |
1183 | 1242 | ||
1184 | /* There 4 fragments per descriptor */ | 1243 | /* There 4 fragments per descriptor */ |
1185 | no_of_desc = (frag_count + 3) >> 2; | 1244 | no_of_desc = (frag_count + 3) >> 2; |
1186 | if (netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) { | ||
1187 | if (skb_shinfo(skb)->gso_size > 0) { | ||
1188 | |||
1189 | no_of_desc++; | ||
1190 | if ((ip_hdrlen(skb) + tcp_hdrlen(skb) + | ||
1191 | sizeof(struct ethhdr)) > | ||
1192 | (sizeof(struct cmd_desc_type0) - 2)) { | ||
1193 | no_of_desc++; | ||
1194 | } | ||
1195 | } | ||
1196 | } | ||
1197 | 1245 | ||
1198 | producer = adapter->cmd_producer; | 1246 | producer = adapter->cmd_producer; |
1199 | smp_mb(); | 1247 | smp_mb(); |
@@ -1205,34 +1253,26 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1205 | } | 1253 | } |
1206 | 1254 | ||
1207 | /* Copy the descriptors into the hardware */ | 1255 | /* Copy the descriptors into the hardware */ |
1208 | saved_producer = producer; | ||
1209 | hwdesc = &hw->cmd_desc_head[producer]; | 1256 | hwdesc = &hw->cmd_desc_head[producer]; |
1210 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); | 1257 | memset(hwdesc, 0, sizeof(struct cmd_desc_type0)); |
1211 | /* Take skb->data itself */ | 1258 | /* Take skb->data itself */ |
1212 | pbuf = &adapter->cmd_buf_arr[producer]; | 1259 | pbuf = &adapter->cmd_buf_arr[producer]; |
1213 | if ((netdev->features & (NETIF_F_TSO | NETIF_F_TSO6)) && | 1260 | |
1214 | skb_shinfo(skb)->gso_size > 0) { | 1261 | is_tso = netxen_tso_check(netdev, hwdesc, skb); |
1215 | pbuf->mss = skb_shinfo(skb)->gso_size; | 1262 | |
1216 | hwdesc->mss = cpu_to_le16(skb_shinfo(skb)->gso_size); | ||
1217 | } else { | ||
1218 | pbuf->mss = 0; | ||
1219 | hwdesc->mss = 0; | ||
1220 | } | ||
1221 | pbuf->total_length = skb->len; | ||
1222 | pbuf->skb = skb; | 1263 | pbuf->skb = skb; |
1223 | pbuf->cmd = TX_ETHER_PKT; | ||
1224 | pbuf->frag_count = frag_count; | 1264 | pbuf->frag_count = frag_count; |
1225 | pbuf->port = adapter->portnum; | ||
1226 | buffrag = &pbuf->frag_array[0]; | 1265 | buffrag = &pbuf->frag_array[0]; |
1227 | buffrag->dma = pci_map_single(adapter->pdev, skb->data, first_seg_len, | 1266 | temp_dma = pci_map_single(pdev, skb->data, first_seg_len, |
1228 | PCI_DMA_TODEVICE); | 1267 | PCI_DMA_TODEVICE); |
1268 | if (pci_dma_mapping_error(pdev, temp_dma)) | ||
1269 | goto drop_packet; | ||
1270 | |||
1271 | buffrag->dma = temp_dma; | ||
1229 | buffrag->length = first_seg_len; | 1272 | buffrag->length = first_seg_len; |
1230 | netxen_set_cmd_desc_totallength(hwdesc, skb->len); | 1273 | netxen_set_tx_frags_len(hwdesc, frag_count, skb->len); |
1231 | netxen_set_cmd_desc_num_of_buff(hwdesc, frag_count); | 1274 | netxen_set_tx_port(hwdesc, adapter->portnum); |
1232 | netxen_set_cmd_desc_opcode(hwdesc, TX_ETHER_PKT); | ||
1233 | 1275 | ||
1234 | netxen_set_cmd_desc_port(hwdesc, adapter->portnum); | ||
1235 | netxen_set_cmd_desc_ctxid(hwdesc, adapter->portnum); | ||
1236 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); | 1276 | hwdesc->buffer1_length = cpu_to_le16(first_seg_len); |
1237 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); | 1277 | hwdesc->addr_buffer1 = cpu_to_le64(buffrag->dma); |
1238 | 1278 | ||
@@ -1240,7 +1280,6 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1240 | struct skb_frag_struct *frag; | 1280 | struct skb_frag_struct *frag; |
1241 | int len, temp_len; | 1281 | int len, temp_len; |
1242 | unsigned long offset; | 1282 | unsigned long offset; |
1243 | dma_addr_t temp_dma; | ||
1244 | 1283 | ||
1245 | /* move to next desc. if there is a need */ | 1284 | /* move to next desc. if there is a need */ |
1246 | if ((i & 0x3) == 0) { | 1285 | if ((i & 0x3) == 0) { |
@@ -1256,8 +1295,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1256 | offset = frag->page_offset; | 1295 | offset = frag->page_offset; |
1257 | 1296 | ||
1258 | temp_len = len; | 1297 | temp_len = len; |
1259 | temp_dma = pci_map_page(adapter->pdev, frag->page, offset, | 1298 | temp_dma = pci_map_page(pdev, frag->page, offset, |
1260 | len, PCI_DMA_TODEVICE); | 1299 | len, PCI_DMA_TODEVICE); |
1300 | if (pci_dma_mapping_error(pdev, temp_dma)) { | ||
1301 | netxen_clean_tx_dma_mapping(pdev, pbuf, i); | ||
1302 | goto drop_packet; | ||
1303 | } | ||
1261 | 1304 | ||
1262 | buffrag++; | 1305 | buffrag++; |
1263 | buffrag->dma = temp_dma; | 1306 | buffrag->dma = temp_dma; |
@@ -1285,16 +1328,12 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1285 | } | 1328 | } |
1286 | producer = get_next_index(producer, num_txd); | 1329 | producer = get_next_index(producer, num_txd); |
1287 | 1330 | ||
1288 | /* might change opcode to TX_TCP_LSO */ | ||
1289 | netxen_tso_check(adapter, &hw->cmd_desc_head[saved_producer], skb); | ||
1290 | |||
1291 | /* For LSO, we need to copy the MAC/IP/TCP headers into | 1331 | /* For LSO, we need to copy the MAC/IP/TCP headers into |
1292 | * the descriptor ring | 1332 | * the descriptor ring |
1293 | */ | 1333 | */ |
1294 | if (netxen_get_cmd_desc_opcode(&hw->cmd_desc_head[saved_producer]) | 1334 | if (is_tso) { |
1295 | == TX_TCP_LSO) { | ||
1296 | int hdr_len, first_hdr_len, more_hdr; | 1335 | int hdr_len, first_hdr_len, more_hdr; |
1297 | hdr_len = hw->cmd_desc_head[saved_producer].total_hdr_length; | 1336 | hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb); |
1298 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { | 1337 | if (hdr_len > (sizeof(struct cmd_desc_type0) - 2)) { |
1299 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; | 1338 | first_hdr_len = sizeof(struct cmd_desc_type0) - 2; |
1300 | more_hdr = 1; | 1339 | more_hdr = 1; |
@@ -1336,6 +1375,11 @@ static int netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev) | |||
1336 | netdev->trans_start = jiffies; | 1375 | netdev->trans_start = jiffies; |
1337 | 1376 | ||
1338 | return NETDEV_TX_OK; | 1377 | return NETDEV_TX_OK; |
1378 | |||
1379 | drop_packet: | ||
1380 | adapter->stats.txdropped++; | ||
1381 | dev_kfree_skb_any(skb); | ||
1382 | return NETDEV_TX_OK; | ||
1339 | } | 1383 | } |
1340 | 1384 | ||
1341 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) | 1385 | static int netxen_nic_check_temp(struct netxen_adapter *adapter) |
@@ -1407,6 +1451,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1407 | netif_carrier_off(netdev); | 1451 | netif_carrier_off(netdev); |
1408 | netif_stop_queue(netdev); | 1452 | netif_stop_queue(netdev); |
1409 | } | 1453 | } |
1454 | |||
1455 | netxen_nic_set_link_parameters(adapter); | ||
1410 | } else if (!adapter->ahw.linkup && linkup) { | 1456 | } else if (!adapter->ahw.linkup && linkup) { |
1411 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 1457 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
1412 | netxen_nic_driver_name, netdev->name); | 1458 | netxen_nic_driver_name, netdev->name); |
@@ -1415,6 +1461,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter) | |||
1415 | netif_carrier_on(netdev); | 1461 | netif_carrier_on(netdev); |
1416 | netif_wake_queue(netdev); | 1462 | netif_wake_queue(netdev); |
1417 | } | 1463 | } |
1464 | |||
1465 | netxen_nic_set_link_parameters(adapter); | ||
1418 | } | 1466 | } |
1419 | } | 1467 | } |
1420 | 1468 | ||