aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/e1000e/netdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/e1000e/netdev.c')
-rw-r--r--drivers/net/e1000e/netdev.c223
1 files changed, 113 insertions, 110 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index fa5b60452547..1c18f26b0812 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 Intel PRO/1000 Linux driver 3 Intel PRO/1000 Linux driver
4 Copyright(c) 1999 - 2010 Intel Corporation. 4 Copyright(c) 1999 - 2011 Intel Corporation.
5 5
6 This program is free software; you can redistribute it and/or modify it 6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License, 7 under the terms and conditions of the GNU General Public License,
@@ -77,17 +77,17 @@ struct e1000_reg_info {
77 char *name; 77 char *name;
78}; 78};
79 79
80#define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */ 80#define E1000_RDFH 0x02410 /* Rx Data FIFO Head - RW */
81#define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */ 81#define E1000_RDFT 0x02418 /* Rx Data FIFO Tail - RW */
82#define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */ 82#define E1000_RDFHS 0x02420 /* Rx Data FIFO Head Saved - RW */
83#define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */ 83#define E1000_RDFTS 0x02428 /* Rx Data FIFO Tail Saved - RW */
84#define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */ 84#define E1000_RDFPC 0x02430 /* Rx Data FIFO Packet Count - RW */
85 85
86#define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */ 86#define E1000_TDFH 0x03410 /* Tx Data FIFO Head - RW */
87#define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */ 87#define E1000_TDFT 0x03418 /* Tx Data FIFO Tail - RW */
88#define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */ 88#define E1000_TDFHS 0x03420 /* Tx Data FIFO Head Saved - RW */
89#define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */ 89#define E1000_TDFTS 0x03428 /* Tx Data FIFO Tail Saved - RW */
90#define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */ 90#define E1000_TDFPC 0x03430 /* Tx Data FIFO Packet Count - RW */
91 91
92static const struct e1000_reg_info e1000_reg_info_tbl[] = { 92static const struct e1000_reg_info e1000_reg_info_tbl[] = {
93 93
@@ -99,7 +99,7 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
99 /* Interrupt Registers */ 99 /* Interrupt Registers */
100 {E1000_ICR, "ICR"}, 100 {E1000_ICR, "ICR"},
101 101
102 /* RX Registers */ 102 /* Rx Registers */
103 {E1000_RCTL, "RCTL"}, 103 {E1000_RCTL, "RCTL"},
104 {E1000_RDLEN, "RDLEN"}, 104 {E1000_RDLEN, "RDLEN"},
105 {E1000_RDH, "RDH"}, 105 {E1000_RDH, "RDH"},
@@ -115,7 +115,7 @@ static const struct e1000_reg_info e1000_reg_info_tbl[] = {
115 {E1000_RDFTS, "RDFTS"}, 115 {E1000_RDFTS, "RDFTS"},
116 {E1000_RDFPC, "RDFPC"}, 116 {E1000_RDFPC, "RDFPC"},
117 117
118 /* TX Registers */ 118 /* Tx Registers */
119 {E1000_TCTL, "TCTL"}, 119 {E1000_TCTL, "TCTL"},
120 {E1000_TDBAL, "TDBAL"}, 120 {E1000_TDBAL, "TDBAL"},
121 {E1000_TDBAH, "TDBAH"}, 121 {E1000_TDBAH, "TDBAH"},
@@ -160,7 +160,7 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
160 break; 160 break;
161 default: 161 default:
162 printk(KERN_INFO "%-15s %08x\n", 162 printk(KERN_INFO "%-15s %08x\n",
163 reginfo->name, __er32(hw, reginfo->ofs)); 163 reginfo->name, __er32(hw, reginfo->ofs));
164 return; 164 return;
165 } 165 }
166 166
@@ -171,9 +171,8 @@ static void e1000_regdump(struct e1000_hw *hw, struct e1000_reg_info *reginfo)
171 printk(KERN_CONT "\n"); 171 printk(KERN_CONT "\n");
172} 172}
173 173
174
175/* 174/*
176 * e1000e_dump - Print registers, tx-ring and rx-ring 175 * e1000e_dump - Print registers, Tx-ring and Rx-ring
177 */ 176 */
178static void e1000e_dump(struct e1000_adapter *adapter) 177static void e1000e_dump(struct e1000_adapter *adapter)
179{ 178{
@@ -182,12 +181,20 @@ static void e1000e_dump(struct e1000_adapter *adapter)
182 struct e1000_reg_info *reginfo; 181 struct e1000_reg_info *reginfo;
183 struct e1000_ring *tx_ring = adapter->tx_ring; 182 struct e1000_ring *tx_ring = adapter->tx_ring;
184 struct e1000_tx_desc *tx_desc; 183 struct e1000_tx_desc *tx_desc;
185 struct my_u0 { u64 a; u64 b; } *u0; 184 struct my_u0 {
185 u64 a;
186 u64 b;
187 } *u0;
186 struct e1000_buffer *buffer_info; 188 struct e1000_buffer *buffer_info;
187 struct e1000_ring *rx_ring = adapter->rx_ring; 189 struct e1000_ring *rx_ring = adapter->rx_ring;
188 union e1000_rx_desc_packet_split *rx_desc_ps; 190 union e1000_rx_desc_packet_split *rx_desc_ps;
189 struct e1000_rx_desc *rx_desc; 191 struct e1000_rx_desc *rx_desc;
190 struct my_u1 { u64 a; u64 b; u64 c; u64 d; } *u1; 192 struct my_u1 {
193 u64 a;
194 u64 b;
195 u64 c;
196 u64 d;
197 } *u1;
191 u32 staterr; 198 u32 staterr;
192 int i = 0; 199 int i = 0;
193 200
@@ -198,12 +205,10 @@ static void e1000e_dump(struct e1000_adapter *adapter)
198 if (netdev) { 205 if (netdev) {
199 dev_info(&adapter->pdev->dev, "Net device Info\n"); 206 dev_info(&adapter->pdev->dev, "Net device Info\n");
200 printk(KERN_INFO "Device Name state " 207 printk(KERN_INFO "Device Name state "
201 "trans_start last_rx\n"); 208 "trans_start last_rx\n");
202 printk(KERN_INFO "%-15s %016lX %016lX %016lX\n", 209 printk(KERN_INFO "%-15s %016lX %016lX %016lX\n",
203 netdev->name, 210 netdev->name, netdev->state, netdev->trans_start,
204 netdev->state, 211 netdev->last_rx);
205 netdev->trans_start,
206 netdev->last_rx);
207 } 212 }
208 213
209 /* Print Registers */ 214 /* Print Registers */
@@ -214,26 +219,26 @@ static void e1000e_dump(struct e1000_adapter *adapter)
214 e1000_regdump(hw, reginfo); 219 e1000_regdump(hw, reginfo);
215 } 220 }
216 221
217 /* Print TX Ring Summary */ 222 /* Print Tx Ring Summary */
218 if (!netdev || !netif_running(netdev)) 223 if (!netdev || !netif_running(netdev))
219 goto exit; 224 goto exit;
220 225
221 dev_info(&adapter->pdev->dev, "TX Rings Summary\n"); 226 dev_info(&adapter->pdev->dev, "Tx Ring Summary\n");
222 printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]" 227 printk(KERN_INFO "Queue [NTU] [NTC] [bi(ntc)->dma ]"
223 " leng ntw timestamp\n"); 228 " leng ntw timestamp\n");
224 buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean]; 229 buffer_info = &tx_ring->buffer_info[tx_ring->next_to_clean];
225 printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n", 230 printk(KERN_INFO " %5d %5X %5X %016llX %04X %3X %016llX\n",
226 0, tx_ring->next_to_use, tx_ring->next_to_clean, 231 0, tx_ring->next_to_use, tx_ring->next_to_clean,
227 (unsigned long long)buffer_info->dma, 232 (unsigned long long)buffer_info->dma,
228 buffer_info->length, 233 buffer_info->length,
229 buffer_info->next_to_watch, 234 buffer_info->next_to_watch,
230 (unsigned long long)buffer_info->time_stamp); 235 (unsigned long long)buffer_info->time_stamp);
231 236
232 /* Print TX Rings */ 237 /* Print Tx Ring */
233 if (!netif_msg_tx_done(adapter)) 238 if (!netif_msg_tx_done(adapter))
234 goto rx_ring_summary; 239 goto rx_ring_summary;
235 240
236 dev_info(&adapter->pdev->dev, "TX Rings Dump\n"); 241 dev_info(&adapter->pdev->dev, "Tx Ring Dump\n");
237 242
238 /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended) 243 /* Transmit Descriptor Formats - DEXT[29] is 0 (Legacy) or 1 (Extended)
239 * 244 *
@@ -263,22 +268,22 @@ static void e1000e_dump(struct e1000_adapter *adapter)
263 * 63 48 47 40 39 36 35 32 31 24 23 20 19 0 268 * 63 48 47 40 39 36 35 32 31 24 23 20 19 0
264 */ 269 */
265 printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]" 270 printk(KERN_INFO "Tl[desc] [address 63:0 ] [SpeCssSCmCsLen]"
266 " [bi->dma ] leng ntw timestamp bi->skb " 271 " [bi->dma ] leng ntw timestamp bi->skb "
267 "<-- Legacy format\n"); 272 "<-- Legacy format\n");
268 printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]" 273 printk(KERN_INFO "Tc[desc] [Ce CoCsIpceCoS] [MssHlRSCm0Plen]"
269 " [bi->dma ] leng ntw timestamp bi->skb " 274 " [bi->dma ] leng ntw timestamp bi->skb "
270 "<-- Ext Context format\n"); 275 "<-- Ext Context format\n");
271 printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]" 276 printk(KERN_INFO "Td[desc] [address 63:0 ] [VlaPoRSCm1Dlen]"
272 " [bi->dma ] leng ntw timestamp bi->skb " 277 " [bi->dma ] leng ntw timestamp bi->skb "
273 "<-- Ext Data format\n"); 278 "<-- Ext Data format\n");
274 for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) { 279 for (i = 0; tx_ring->desc && (i < tx_ring->count); i++) {
275 tx_desc = E1000_TX_DESC(*tx_ring, i); 280 tx_desc = E1000_TX_DESC(*tx_ring, i);
276 buffer_info = &tx_ring->buffer_info[i]; 281 buffer_info = &tx_ring->buffer_info[i];
277 u0 = (struct my_u0 *)tx_desc; 282 u0 = (struct my_u0 *)tx_desc;
278 printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX " 283 printk(KERN_INFO "T%c[0x%03X] %016llX %016llX %016llX "
279 "%04X %3X %016llX %p", 284 "%04X %3X %016llX %p",
280 (!(le64_to_cpu(u0->b) & (1<<29)) ? 'l' : 285 (!(le64_to_cpu(u0->b) & (1 << 29)) ? 'l' :
281 ((le64_to_cpu(u0->b) & (1<<20)) ? 'd' : 'c')), i, 286 ((le64_to_cpu(u0->b) & (1 << 20)) ? 'd' : 'c')), i,
282 (unsigned long long)le64_to_cpu(u0->a), 287 (unsigned long long)le64_to_cpu(u0->a),
283 (unsigned long long)le64_to_cpu(u0->b), 288 (unsigned long long)le64_to_cpu(u0->b),
284 (unsigned long long)buffer_info->dma, 289 (unsigned long long)buffer_info->dma,
@@ -296,22 +301,22 @@ static void e1000e_dump(struct e1000_adapter *adapter)
296 301
297 if (netif_msg_pktdata(adapter) && buffer_info->dma != 0) 302 if (netif_msg_pktdata(adapter) && buffer_info->dma != 0)
298 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 303 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS,
299 16, 1, phys_to_virt(buffer_info->dma), 304 16, 1, phys_to_virt(buffer_info->dma),
300 buffer_info->length, true); 305 buffer_info->length, true);
301 } 306 }
302 307
303 /* Print RX Rings Summary */ 308 /* Print Rx Ring Summary */
304rx_ring_summary: 309rx_ring_summary:
305 dev_info(&adapter->pdev->dev, "RX Rings Summary\n"); 310 dev_info(&adapter->pdev->dev, "Rx Ring Summary\n");
306 printk(KERN_INFO "Queue [NTU] [NTC]\n"); 311 printk(KERN_INFO "Queue [NTU] [NTC]\n");
307 printk(KERN_INFO " %5d %5X %5X\n", 0, 312 printk(KERN_INFO " %5d %5X %5X\n", 0,
308 rx_ring->next_to_use, rx_ring->next_to_clean); 313 rx_ring->next_to_use, rx_ring->next_to_clean);
309 314
310 /* Print RX Rings */ 315 /* Print Rx Ring */
311 if (!netif_msg_rx_status(adapter)) 316 if (!netif_msg_rx_status(adapter))
312 goto exit; 317 goto exit;
313 318
314 dev_info(&adapter->pdev->dev, "RX Rings Dump\n"); 319 dev_info(&adapter->pdev->dev, "Rx Ring Dump\n");
315 switch (adapter->rx_ps_pages) { 320 switch (adapter->rx_ps_pages) {
316 case 1: 321 case 1:
317 case 2: 322 case 2:
@@ -329,7 +334,7 @@ rx_ring_summary:
329 * +-----------------------------------------------------+ 334 * +-----------------------------------------------------+
330 */ 335 */
331 printk(KERN_INFO "R [desc] [buffer 0 63:0 ] " 336 printk(KERN_INFO "R [desc] [buffer 0 63:0 ] "
332 "[buffer 1 63:0 ] " 337 "[buffer 1 63:0 ] "
333 "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] " 338 "[buffer 2 63:0 ] [buffer 3 63:0 ] [bi->dma ] "
334 "[bi->skb] <-- Ext Pkt Split format\n"); 339 "[bi->skb] <-- Ext Pkt Split format\n");
335 /* [Extended] Receive Descriptor (Write-Back) Format 340 /* [Extended] Receive Descriptor (Write-Back) Format
@@ -344,7 +349,7 @@ rx_ring_summary:
344 * 63 48 47 32 31 20 19 0 349 * 63 48 47 32 31 20 19 0
345 */ 350 */
346 printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] " 351 printk(KERN_INFO "RWB[desc] [ck ipid mrqhsh] "
347 "[vl l0 ee es] " 352 "[vl l0 ee es] "
348 "[ l3 l2 l1 hs] [reserved ] ---------------- " 353 "[ l3 l2 l1 hs] [reserved ] ---------------- "
349 "[bi->skb] <-- Ext Rx Write-Back format\n"); 354 "[bi->skb] <-- Ext Rx Write-Back format\n");
350 for (i = 0; i < rx_ring->count; i++) { 355 for (i = 0; i < rx_ring->count; i++) {
@@ -352,26 +357,26 @@ rx_ring_summary:
352 rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i); 357 rx_desc_ps = E1000_RX_DESC_PS(*rx_ring, i);
353 u1 = (struct my_u1 *)rx_desc_ps; 358 u1 = (struct my_u1 *)rx_desc_ps;
354 staterr = 359 staterr =
355 le32_to_cpu(rx_desc_ps->wb.middle.status_error); 360 le32_to_cpu(rx_desc_ps->wb.middle.status_error);
356 if (staterr & E1000_RXD_STAT_DD) { 361 if (staterr & E1000_RXD_STAT_DD) {
357 /* Descriptor Done */ 362 /* Descriptor Done */
358 printk(KERN_INFO "RWB[0x%03X] %016llX " 363 printk(KERN_INFO "RWB[0x%03X] %016llX "
359 "%016llX %016llX %016llX " 364 "%016llX %016llX %016llX "
360 "---------------- %p", i, 365 "---------------- %p", i,
361 (unsigned long long)le64_to_cpu(u1->a), 366 (unsigned long long)le64_to_cpu(u1->a),
362 (unsigned long long)le64_to_cpu(u1->b), 367 (unsigned long long)le64_to_cpu(u1->b),
363 (unsigned long long)le64_to_cpu(u1->c), 368 (unsigned long long)le64_to_cpu(u1->c),
364 (unsigned long long)le64_to_cpu(u1->d), 369 (unsigned long long)le64_to_cpu(u1->d),
365 buffer_info->skb); 370 buffer_info->skb);
366 } else { 371 } else {
367 printk(KERN_INFO "R [0x%03X] %016llX " 372 printk(KERN_INFO "R [0x%03X] %016llX "
368 "%016llX %016llX %016llX %016llX %p", i, 373 "%016llX %016llX %016llX %016llX %p", i,
369 (unsigned long long)le64_to_cpu(u1->a), 374 (unsigned long long)le64_to_cpu(u1->a),
370 (unsigned long long)le64_to_cpu(u1->b), 375 (unsigned long long)le64_to_cpu(u1->b),
371 (unsigned long long)le64_to_cpu(u1->c), 376 (unsigned long long)le64_to_cpu(u1->c),
372 (unsigned long long)le64_to_cpu(u1->d), 377 (unsigned long long)le64_to_cpu(u1->d),
373 (unsigned long long)buffer_info->dma, 378 (unsigned long long)buffer_info->dma,
374 buffer_info->skb); 379 buffer_info->skb);
375 380
376 if (netif_msg_pktdata(adapter)) 381 if (netif_msg_pktdata(adapter))
377 print_hex_dump(KERN_INFO, "", 382 print_hex_dump(KERN_INFO, "",
@@ -400,18 +405,18 @@ rx_ring_summary:
400 * 63 48 47 40 39 32 31 16 15 0 405 * 63 48 47 40 39 32 31 16 15 0
401 */ 406 */
402 printk(KERN_INFO "Rl[desc] [address 63:0 ] " 407 printk(KERN_INFO "Rl[desc] [address 63:0 ] "
403 "[vl er S cks ln] [bi->dma ] [bi->skb] " 408 "[vl er S cks ln] [bi->dma ] [bi->skb] "
404 "<-- Legacy format\n"); 409 "<-- Legacy format\n");
405 for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) { 410 for (i = 0; rx_ring->desc && (i < rx_ring->count); i++) {
406 rx_desc = E1000_RX_DESC(*rx_ring, i); 411 rx_desc = E1000_RX_DESC(*rx_ring, i);
407 buffer_info = &rx_ring->buffer_info[i]; 412 buffer_info = &rx_ring->buffer_info[i];
408 u0 = (struct my_u0 *)rx_desc; 413 u0 = (struct my_u0 *)rx_desc;
409 printk(KERN_INFO "Rl[0x%03X] %016llX %016llX " 414 printk(KERN_INFO "Rl[0x%03X] %016llX %016llX "
410 "%016llX %p", i, 415 "%016llX %p", i,
411 (unsigned long long)le64_to_cpu(u0->a), 416 (unsigned long long)le64_to_cpu(u0->a),
412 (unsigned long long)le64_to_cpu(u0->b), 417 (unsigned long long)le64_to_cpu(u0->b),
413 (unsigned long long)buffer_info->dma, 418 (unsigned long long)buffer_info->dma,
414 buffer_info->skb); 419 buffer_info->skb);
415 if (i == rx_ring->next_to_use) 420 if (i == rx_ring->next_to_use)
416 printk(KERN_CONT " NTU\n"); 421 printk(KERN_CONT " NTU\n");
417 else if (i == rx_ring->next_to_clean) 422 else if (i == rx_ring->next_to_clean)
@@ -421,9 +426,10 @@ rx_ring_summary:
421 426
422 if (netif_msg_pktdata(adapter)) 427 if (netif_msg_pktdata(adapter))
423 print_hex_dump(KERN_INFO, "", 428 print_hex_dump(KERN_INFO, "",
424 DUMP_PREFIX_ADDRESS, 429 DUMP_PREFIX_ADDRESS,
425 16, 1, phys_to_virt(buffer_info->dma), 430 16, 1,
426 adapter->rx_buffer_len, true); 431 phys_to_virt(buffer_info->dma),
432 adapter->rx_buffer_len, true);
427 } 433 }
428 } 434 }
429 435
@@ -450,8 +456,7 @@ static int e1000_desc_unused(struct e1000_ring *ring)
450 * @skb: pointer to sk_buff to be indicated to stack 456 * @skb: pointer to sk_buff to be indicated to stack
451 **/ 457 **/
452static void e1000_receive_skb(struct e1000_adapter *adapter, 458static void e1000_receive_skb(struct e1000_adapter *adapter,
453 struct net_device *netdev, 459 struct net_device *netdev, struct sk_buff *skb,
454 struct sk_buff *skb,
455 u8 status, __le16 vlan) 460 u8 status, __le16 vlan)
456{ 461{
457 skb->protocol = eth_type_trans(skb, netdev); 462 skb->protocol = eth_type_trans(skb, netdev);
@@ -464,7 +469,7 @@ static void e1000_receive_skb(struct e1000_adapter *adapter,
464} 469}
465 470
466/** 471/**
467 * e1000_rx_checksum - Receive Checksum Offload for 82543 472 * e1000_rx_checksum - Receive Checksum Offload
468 * @adapter: board private structure 473 * @adapter: board private structure
469 * @status_err: receive descriptor status and error fields 474 * @status_err: receive descriptor status and error fields
470 * @csum: receive descriptor csum field 475 * @csum: receive descriptor csum field
@@ -548,7 +553,7 @@ map_skb:
548 adapter->rx_buffer_len, 553 adapter->rx_buffer_len,
549 DMA_FROM_DEVICE); 554 DMA_FROM_DEVICE);
550 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { 555 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
551 dev_err(&pdev->dev, "RX DMA map failed\n"); 556 dev_err(&pdev->dev, "Rx DMA map failed\n");
552 adapter->rx_dma_failed++; 557 adapter->rx_dma_failed++;
553 break; 558 break;
554 } 559 }
@@ -601,7 +606,8 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
601 ps_page = &buffer_info->ps_pages[j]; 606 ps_page = &buffer_info->ps_pages[j];
602 if (j >= adapter->rx_ps_pages) { 607 if (j >= adapter->rx_ps_pages) {
603 /* all unused desc entries get hw null ptr */ 608 /* all unused desc entries get hw null ptr */
604 rx_desc->read.buffer_addr[j+1] = ~cpu_to_le64(0); 609 rx_desc->read.buffer_addr[j + 1] =
610 ~cpu_to_le64(0);
605 continue; 611 continue;
606 } 612 }
607 if (!ps_page->page) { 613 if (!ps_page->page) {
@@ -617,7 +623,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
617 if (dma_mapping_error(&pdev->dev, 623 if (dma_mapping_error(&pdev->dev,
618 ps_page->dma)) { 624 ps_page->dma)) {
619 dev_err(&adapter->pdev->dev, 625 dev_err(&adapter->pdev->dev,
620 "RX DMA page map failed\n"); 626 "Rx DMA page map failed\n");
621 adapter->rx_dma_failed++; 627 adapter->rx_dma_failed++;
622 goto no_buffers; 628 goto no_buffers;
623 } 629 }
@@ -627,8 +633,8 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
627 * didn't change because each write-back 633 * didn't change because each write-back
628 * erases this info. 634 * erases this info.
629 */ 635 */
630 rx_desc->read.buffer_addr[j+1] = 636 rx_desc->read.buffer_addr[j + 1] =
631 cpu_to_le64(ps_page->dma); 637 cpu_to_le64(ps_page->dma);
632 } 638 }
633 639
634 skb = netdev_alloc_skb_ip_align(netdev, 640 skb = netdev_alloc_skb_ip_align(netdev,
@@ -644,7 +650,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
644 adapter->rx_ps_bsize0, 650 adapter->rx_ps_bsize0,
645 DMA_FROM_DEVICE); 651 DMA_FROM_DEVICE);
646 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) { 652 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) {
647 dev_err(&pdev->dev, "RX DMA map failed\n"); 653 dev_err(&pdev->dev, "Rx DMA map failed\n");
648 adapter->rx_dma_failed++; 654 adapter->rx_dma_failed++;
649 /* cleanup skb */ 655 /* cleanup skb */
650 dev_kfree_skb_any(skb); 656 dev_kfree_skb_any(skb);
@@ -662,7 +668,7 @@ static void e1000_alloc_rx_buffers_ps(struct e1000_adapter *adapter,
662 * such as IA-64). 668 * such as IA-64).
663 */ 669 */
664 wmb(); 670 wmb();
665 writel(i<<1, adapter->hw.hw_addr + rx_ring->tail); 671 writel(i << 1, adapter->hw.hw_addr + rx_ring->tail);
666 } 672 }
667 673
668 i++; 674 i++;
@@ -1106,11 +1112,10 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
1106 cleaned = 1; 1112 cleaned = 1;
1107 cleaned_count++; 1113 cleaned_count++;
1108 dma_unmap_single(&pdev->dev, buffer_info->dma, 1114 dma_unmap_single(&pdev->dev, buffer_info->dma,
1109 adapter->rx_ps_bsize0, 1115 adapter->rx_ps_bsize0, DMA_FROM_DEVICE);
1110 DMA_FROM_DEVICE);
1111 buffer_info->dma = 0; 1116 buffer_info->dma = 0;
1112 1117
1113 /* see !EOP comment in other rx routine */ 1118 /* see !EOP comment in other Rx routine */
1114 if (!(staterr & E1000_RXD_STAT_EOP)) 1119 if (!(staterr & E1000_RXD_STAT_EOP))
1115 adapter->flags2 |= FLAG2_IS_DISCARDING; 1120 adapter->flags2 |= FLAG2_IS_DISCARDING;
1116 1121
@@ -2610,7 +2615,7 @@ static void e1000_init_manageability_pt(struct e1000_adapter *adapter)
2610} 2615}
2611 2616
2612/** 2617/**
2613 * e1000_configure_tx - Configure 8254x Transmit Unit after Reset 2618 * e1000_configure_tx - Configure Transmit Unit after Reset
2614 * @adapter: board private structure 2619 * @adapter: board private structure
2615 * 2620 *
2616 * Configure the Tx unit of the MAC after a reset. 2621 * Configure the Tx unit of the MAC after a reset.
@@ -2663,7 +2668,7 @@ static void e1000_configure_tx(struct e1000_adapter *adapter)
2663 * hthresh = 1 ==> prefetch when one or more available 2668 * hthresh = 1 ==> prefetch when one or more available
2664 * pthresh = 0x1f ==> prefetch if internal cache 31 or less 2669 * pthresh = 0x1f ==> prefetch if internal cache 31 or less
2665 * BEWARE: this seems to work but should be considered first if 2670 * BEWARE: this seems to work but should be considered first if
2666 * there are tx hangs or other tx related bugs 2671 * there are Tx hangs or other Tx related bugs
2667 */ 2672 */
2668 txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE; 2673 txdctl |= E1000_TXDCTL_DMA_BURST_ENABLE;
2669 ew32(TXDCTL(0), txdctl); 2674 ew32(TXDCTL(0), txdctl);
@@ -2877,7 +2882,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2877 if (adapter->rx_ps_pages) { 2882 if (adapter->rx_ps_pages) {
2878 /* this is a 32 byte descriptor */ 2883 /* this is a 32 byte descriptor */
2879 rdlen = rx_ring->count * 2884 rdlen = rx_ring->count *
2880 sizeof(union e1000_rx_desc_packet_split); 2885 sizeof(union e1000_rx_desc_packet_split);
2881 adapter->clean_rx = e1000_clean_rx_irq_ps; 2886 adapter->clean_rx = e1000_clean_rx_irq_ps;
2882 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps; 2887 adapter->alloc_rx_buf = e1000_alloc_rx_buffers_ps;
2883 } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) { 2888 } else if (adapter->netdev->mtu > ETH_FRAME_LEN + ETH_FCS_LEN) {
@@ -2900,7 +2905,7 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2900 /* 2905 /*
2901 * set the writeback threshold (only takes effect if the RDTR 2906 * set the writeback threshold (only takes effect if the RDTR
2902 * is set). set GRAN=1 and write back up to 0x4 worth, and 2907 * is set). set GRAN=1 and write back up to 0x4 worth, and
2903 * enable prefetching of 0x20 rx descriptors 2908 * enable prefetching of 0x20 Rx descriptors
2904 * granularity = 01 2909 * granularity = 01
2905 * wthresh = 04, 2910 * wthresh = 04,
2906 * hthresh = 04, 2911 * hthresh = 04,
@@ -2981,12 +2986,10 @@ static void e1000_configure_rx(struct e1000_adapter *adapter)
2981 * excessive C-state transition latencies result in 2986 * excessive C-state transition latencies result in
2982 * dropped transactions. 2987 * dropped transactions.
2983 */ 2988 */
2984 pm_qos_update_request( 2989 pm_qos_update_request(&adapter->netdev->pm_qos_req, 55);
2985 &adapter->netdev->pm_qos_req, 55);
2986 } else { 2990 } else {
2987 pm_qos_update_request( 2991 pm_qos_update_request(&adapter->netdev->pm_qos_req,
2988 &adapter->netdev->pm_qos_req, 2992 PM_QOS_DEFAULT_VALUE);
2989 PM_QOS_DEFAULT_VALUE);
2990 } 2993 }
2991 } 2994 }
2992 2995
@@ -3152,7 +3155,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
3152 /* lower 16 bits has Rx packet buffer allocation size in KB */ 3155 /* lower 16 bits has Rx packet buffer allocation size in KB */
3153 pba &= 0xffff; 3156 pba &= 0xffff;
3154 /* 3157 /*
3155 * the Tx fifo also stores 16 bytes of information about the tx 3158 * the Tx fifo also stores 16 bytes of information about the Tx
3156 * but don't include ethernet FCS because hardware appends it 3159 * but don't include ethernet FCS because hardware appends it
3157 */ 3160 */
3158 min_tx_space = (adapter->max_frame_size + 3161 min_tx_space = (adapter->max_frame_size +
@@ -3175,7 +3178,7 @@ void e1000e_reset(struct e1000_adapter *adapter)
3175 pba -= min_tx_space - tx_space; 3178 pba -= min_tx_space - tx_space;
3176 3179
3177 /* 3180 /*
3178 * if short on Rx space, Rx wins and must trump tx 3181 * if short on Rx space, Rx wins and must trump Tx
3179 * adjustment or use Early Receive if available 3182 * adjustment or use Early Receive if available
3180 */ 3183 */
3181 if ((pba < min_rx_space) && 3184 if ((pba < min_rx_space) &&
@@ -4039,11 +4042,11 @@ static void e1000_print_link_info(struct e1000_adapter *adapter)
4039 adapter->netdev->name, 4042 adapter->netdev->name,
4040 adapter->link_speed, 4043 adapter->link_speed,
4041 (adapter->link_duplex == FULL_DUPLEX) ? 4044 (adapter->link_duplex == FULL_DUPLEX) ?
4042 "Full Duplex" : "Half Duplex", 4045 "Full Duplex" : "Half Duplex",
4043 ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ? 4046 ((ctrl & E1000_CTRL_TFCE) && (ctrl & E1000_CTRL_RFCE)) ?
4044 "RX/TX" : 4047 "Rx/Tx" :
4045 ((ctrl & E1000_CTRL_RFCE) ? "RX" : 4048 ((ctrl & E1000_CTRL_RFCE) ? "Rx" :
4046 ((ctrl & E1000_CTRL_TFCE) ? "TX" : "None" ))); 4049 ((ctrl & E1000_CTRL_TFCE) ? "Tx" : "None")));
4047} 4050}
4048 4051
4049static bool e1000e_has_link(struct e1000_adapter *adapter) 4052static bool e1000e_has_link(struct e1000_adapter *adapter)
@@ -4338,7 +4341,7 @@ link_up:
4338 /* Force detection of hung controller every watchdog period */ 4341 /* Force detection of hung controller every watchdog period */
4339 adapter->detect_tx_hung = 1; 4342 adapter->detect_tx_hung = 1;
4340 4343
4341 /* flush partial descriptors to memory before detecting tx hang */ 4344 /* flush partial descriptors to memory before detecting Tx hang */
4342 if (adapter->flags2 & FLAG2_DMA_BURST) { 4345 if (adapter->flags2 & FLAG2_DMA_BURST) {
4343 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); 4346 ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD);
4344 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD); 4347 ew32(RDTR, adapter->rx_int_delay | E1000_RDTR_FPD);
@@ -4529,7 +4532,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
4529 buffer_info->next_to_watch = i; 4532 buffer_info->next_to_watch = i;
4530 buffer_info->dma = dma_map_single(&pdev->dev, 4533 buffer_info->dma = dma_map_single(&pdev->dev,
4531 skb->data + offset, 4534 skb->data + offset,
4532 size, DMA_TO_DEVICE); 4535 size, DMA_TO_DEVICE);
4533 buffer_info->mapped_as_page = false; 4536 buffer_info->mapped_as_page = false;
4534 if (dma_mapping_error(&pdev->dev, buffer_info->dma)) 4537 if (dma_mapping_error(&pdev->dev, buffer_info->dma))
4535 goto dma_error; 4538 goto dma_error;
@@ -4576,7 +4579,7 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
4576 } 4579 }
4577 } 4580 }
4578 4581
4579 segs = skb_shinfo(skb)->gso_segs ?: 1; 4582 segs = skb_shinfo(skb)->gso_segs ? : 1;
4580 /* multiply data chunks by size of headers */ 4583 /* multiply data chunks by size of headers */
4581 bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len; 4584 bytecount = ((segs - 1) * skb_headlen(skb)) + skb->len;
4582 4585
@@ -4588,13 +4591,13 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
4588 return count; 4591 return count;
4589 4592
4590dma_error: 4593dma_error:
4591 dev_err(&pdev->dev, "TX DMA map failed\n"); 4594 dev_err(&pdev->dev, "Tx DMA map failed\n");
4592 buffer_info->dma = 0; 4595 buffer_info->dma = 0;
4593 if (count) 4596 if (count)
4594 count--; 4597 count--;
4595 4598
4596 while (count--) { 4599 while (count--) {
4597 if (i==0) 4600 if (i == 0)
4598 i += tx_ring->count; 4601 i += tx_ring->count;
4599 i--; 4602 i--;
4600 buffer_info = &tx_ring->buffer_info[i]; 4603 buffer_info = &tx_ring->buffer_info[i];
@@ -6193,7 +6196,7 @@ static int __init e1000_init_module(void)
6193 int ret; 6196 int ret;
6194 pr_info("Intel(R) PRO/1000 Network Driver - %s\n", 6197 pr_info("Intel(R) PRO/1000 Network Driver - %s\n",
6195 e1000e_driver_version); 6198 e1000e_driver_version);
6196 pr_info("Copyright (c) 1999 - 2010 Intel Corporation.\n"); 6199 pr_info("Copyright(c) 1999 - 2011 Intel Corporation.\n");
6197 ret = pci_register_driver(&e1000_driver); 6200 ret = pci_register_driver(&e1000_driver);
6198 6201
6199 return ret; 6202 return ret;