aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/arm
diff options
context:
space:
mode:
authorYegor Yefremov <yegorslists@googlemail.com>2010-03-20 01:43:29 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-20 01:43:29 -0400
commitea93fd9456ad32cd85b2d7914b58c6313cc40c9e (patch)
tree5e9c1fc69059bfadc14f0f5166a19ecc577677bb /drivers/net/arm
parentb894fa2627e28c078740dc7041cd08c7e2c353ab (diff)
KS8695: update ksp->next_rx_desc_read at the end of rx loop
There is no need to adjust the next rx descriptor after each packet, so do it only once at the end of the routine. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Diffstat (limited to 'drivers/net/arm')
-rw-r--r--drivers/net/arm/ks8695net.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/net/arm/ks8695net.c b/drivers/net/arm/ks8695net.c
index a1d4188c430b..e7810b74f396 100644
--- a/drivers/net/arm/ks8695net.c
+++ b/drivers/net/arm/ks8695net.c
@@ -449,11 +449,10 @@ ks8695_rx_irq(int irq, void *dev_id)
449} 449}
450 450
451/** 451/**
452 * ks8695_rx - Receive packets called by NAPI poll method 452 * ks8695_rx - Receive packets called by NAPI poll method
453 * @ksp: Private data for the KS8695 Ethernet 453 * @ksp: Private data for the KS8695 Ethernet
454 * @budget: The max packets would be receive 454 * @budget: Number of packets allowed to process
455 */ 455 */
456
457static int ks8695_rx(struct ks8695_priv *ksp, int budget) 456static int ks8695_rx(struct ks8695_priv *ksp, int budget)
458{ 457{
459 struct net_device *ndev = ksp->ndev; 458 struct net_device *ndev = ksp->ndev;
@@ -461,7 +460,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
461 int buff_n; 460 int buff_n;
462 u32 flags; 461 u32 flags;
463 int pktlen; 462 int pktlen;
464 int last_rx_processed = -1;
465 int received = 0; 463 int received = 0;
466 464
467 buff_n = ksp->next_rx_desc_read; 465 buff_n = ksp->next_rx_desc_read;
@@ -471,6 +469,7 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
471 cpu_to_le32(RDES_OWN)))) { 469 cpu_to_le32(RDES_OWN)))) {
472 rmb(); 470 rmb();
473 flags = le32_to_cpu(ksp->rx_ring[buff_n].status); 471 flags = le32_to_cpu(ksp->rx_ring[buff_n].status);
472
474 /* Found an SKB which we own, this means we 473 /* Found an SKB which we own, this means we
475 * received a packet 474 * received a packet
476 */ 475 */
@@ -533,23 +532,18 @@ rx_failure:
533 ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN); 532 ksp->rx_ring[buff_n].status = cpu_to_le32(RDES_OWN);
534rx_finished: 533rx_finished:
535 received++; 534 received++;
536 /* And note this as processed so we can start
537 * from here next time
538 */
539 last_rx_processed = buff_n;
540 buff_n = (buff_n + 1) & MAX_RX_DESC_MASK; 535 buff_n = (buff_n + 1) & MAX_RX_DESC_MASK;
541 /*And note which RX descriptor we last did */
542 if (likely(last_rx_processed != -1))
543 ksp->next_rx_desc_read =
544 (last_rx_processed + 1) &
545 MAX_RX_DESC_MASK;
546 } 536 }
537
538 /* And note which RX descriptor we last did */
539 ksp->next_rx_desc_read = buff_n;
540
547 /* And refill the buffers */ 541 /* And refill the buffers */
548 ks8695_refill_rxbuffers(ksp); 542 ks8695_refill_rxbuffers(ksp);
549 543
550 /* Kick the RX DMA engine, in case it became 544 /* Kick the RX DMA engine, in case it became suspended */
551 * suspended */
552 ks8695_writereg(ksp, KS8695_DRSC, 0); 545 ks8695_writereg(ksp, KS8695_DRSC, 0);
546
553 return received; 547 return received;
554} 548}
555 549