Commit aa25cf469485e41305425674e8e65f3c60874ef7

Authored by edgar_igl
1 parent 875cdcf6

ETRAX-FS: Drop DMA polling for ethernet.

* Drop DMA poll mode. Instead immediately push rx frames straight into the DMA
  without waiting for DMA_run to poll them of the fifo.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5520 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 46 deletions
hw/etraxfs_eth.c
... ... @@ -322,10 +322,6 @@ struct fs_eth
322 322 uint8_t macaddr[2][6];
323 323 uint32_t regs[FS_ETH_MAX_REGS];
324 324  
325   - unsigned char rx_fifo[1536];
326   - int rx_fifo_len;
327   - int rx_fifo_pos;
328   -
329 325 struct etraxfs_dma_client *dma_out;
330 326 struct etraxfs_dma_client *dma_in;
331 327  
... ... @@ -523,15 +519,7 @@ static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa)
523 519  
524 520 static int eth_can_receive(void *opaque)
525 521 {
526   - struct fs_eth *eth = opaque;
527   - int r;
528   -
529   - r = eth->rx_fifo_len == 0;
530   - if (!r) {
531   - /* TODO: signal fifo overrun. */
532   - printf("PACKET LOSS!\n");
533   - }
534   - return r;
  522 + return 1;
535 523 }
536 524  
537 525 static void eth_receive(void *opaque, const uint8_t *buf, int size)
... ... @@ -556,38 +544,8 @@ static void eth_receive(void *opaque, const uint8_t *buf, int size)
556 544 && !eth_match_groupaddr(eth, buf))
557 545 return;
558 546  
559   - if (size > sizeof(eth->rx_fifo)) {
560   - /* TODO: signal error. */
561   - } else if (eth->rx_fifo_len) {
562   - /* FIFO overrun. */
563   - } else {
564   - memcpy(eth->rx_fifo, buf, size);
565   - /* +4, HW passes the CRC to sw. */
566   - eth->rx_fifo_len = size + 4;
567   - eth->rx_fifo_pos = 0;
568   - }
569   -}
570   -
571   -static void eth_rx_pull(void *opaque)
572   -{
573   - struct fs_eth *eth = opaque;
574   - int len;
575   - if (eth->rx_fifo_len) {
576   - D(printf("%s %d\n", __func__, eth->rx_fifo_len));
577   -#if 0
578   - {
579   - int i;
580   - for (i = 0; i < 32; i++)
581   - printf("%2.2x", eth->rx_fifo[i]);
582   - printf("\n");
583   - }
584   -#endif
585   - len = etraxfs_dmac_input(eth->dma_in,
586   - eth->rx_fifo + eth->rx_fifo_pos,
587   - eth->rx_fifo_len, 1);
588   - eth->rx_fifo_len -= len;
589   - eth->rx_fifo_pos += len;
590   - }
  547 + /* FIXME: Find another way to pass on the fake csum. */
  548 + etraxfs_dmac_input(eth->dma_in, (void *)buf, size + 4, 1);
591 549 }
592 550  
593 551 static int eth_tx_push(void *opaque, unsigned char *buf, int len)
... ... @@ -628,7 +586,7 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env,
628 586 dma[0].client.push = eth_tx_push;
629 587 dma[0].client.opaque = eth;
630 588 dma[1].client.opaque = eth;
631   - dma[1].client.pull = eth_rx_pull;
  589 + dma[1].client.pull = NULL;
632 590  
633 591 eth->env = env;
634 592 eth->base = base;
... ...