|
@@ -456,19 +456,20 @@ void intel_refill_rx ( struct intel_nic *intel ) {
|
456
|
456
|
unsigned int rx_idx;
|
457
|
457
|
unsigned int rx_tail;
|
458
|
458
|
physaddr_t address;
|
|
459
|
+ unsigned int refilled = 0;
|
459
|
460
|
|
|
461
|
+ /* Refill ring */
|
460
|
462
|
while ( ( intel->rx.prod - intel->rx.cons ) < INTEL_RX_FILL ) {
|
461
|
463
|
|
462
|
464
|
/* Allocate I/O buffer */
|
463
|
465
|
iobuf = alloc_iob ( INTEL_RX_MAX_LEN );
|
464
|
466
|
if ( ! iobuf ) {
|
465
|
467
|
/* Wait for next refill */
|
466
|
|
- return;
|
|
468
|
+ break;
|
467
|
469
|
}
|
468
|
470
|
|
469
|
471
|
/* Get next receive descriptor */
|
470
|
472
|
rx_idx = ( intel->rx.prod++ % INTEL_NUM_RX_DESC );
|
471
|
|
- rx_tail = ( intel->rx.prod % INTEL_NUM_RX_DESC );
|
472
|
473
|
rx = &intel->rx.desc[rx_idx];
|
473
|
474
|
|
474
|
475
|
/* Populate receive descriptor */
|
|
@@ -477,20 +478,24 @@ void intel_refill_rx ( struct intel_nic *intel ) {
|
477
|
478
|
rx->length = 0;
|
478
|
479
|
rx->status = 0;
|
479
|
480
|
rx->errors = 0;
|
480
|
|
- wmb();
|
481
|
481
|
|
482
|
482
|
/* Record I/O buffer */
|
483
|
483
|
assert ( intel->rx_iobuf[rx_idx] == NULL );
|
484
|
484
|
intel->rx_iobuf[rx_idx] = iobuf;
|
485
|
485
|
|
486
|
|
- /* Push descriptor to card */
|
487
|
|
- profile_start ( &intel_vm_refill_profiler );
|
488
|
|
- writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT );
|
489
|
|
- profile_stop ( &intel_vm_refill_profiler );
|
490
|
|
-
|
491
|
486
|
DBGC2 ( intel, "INTEL %p RX %d is [%llx,%llx)\n", intel, rx_idx,
|
492
|
487
|
( ( unsigned long long ) address ),
|
493
|
488
|
( ( unsigned long long ) address + INTEL_RX_MAX_LEN ) );
|
|
489
|
+ refilled++;
|
|
490
|
+ }
|
|
491
|
+
|
|
492
|
+ /* Push descriptors to card, if applicable */
|
|
493
|
+ if ( refilled ) {
|
|
494
|
+ wmb();
|
|
495
|
+ rx_tail = ( intel->rx.prod % INTEL_NUM_RX_DESC );
|
|
496
|
+ profile_start ( &intel_vm_refill_profiler );
|
|
497
|
+ writel ( rx_tail, intel->regs + intel->rx.reg + INTEL_xDT );
|
|
498
|
+ profile_stop ( &intel_vm_refill_profiler );
|
494
|
499
|
}
|
495
|
500
|
}
|
496
|
501
|
|