2
0

107-korina-refactor-rx-descriptor-flags-processing.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. --- a/drivers/net/ethernet/korina.c
  2. +++ b/drivers/net/ethernet/korina.c
  3. @@ -363,59 +363,60 @@ static int korina_rx(struct net_device *
  4. if ((KORINA_RBSIZE - (u32)DMA_COUNT(rd->control)) == 0)
  5. break;
  6. - /* Update statistics counters */
  7. - if (devcs & ETH_RX_CRC)
  8. - dev->stats.rx_crc_errors++;
  9. - if (devcs & ETH_RX_LOR)
  10. - dev->stats.rx_length_errors++;
  11. - if (devcs & ETH_RX_LE)
  12. - dev->stats.rx_length_errors++;
  13. - if (devcs & ETH_RX_OVR)
  14. - dev->stats.rx_fifo_errors++;
  15. - if (devcs & ETH_RX_CV)
  16. - dev->stats.rx_frame_errors++;
  17. - if (devcs & ETH_RX_CES)
  18. - dev->stats.rx_length_errors++;
  19. - if (devcs & ETH_RX_MP)
  20. - dev->stats.multicast++;
  21. + /* check that this is a whole packet
  22. + * WARNING: DMA_FD bit incorrectly set
  23. + * in Rc32434 (errata ref #077) */
  24. + if (!(devcs & ETH_RX_LD))
  25. + goto next;
  26. - if ((devcs & ETH_RX_LD) != ETH_RX_LD) {
  27. - /* check that this is a whole packet
  28. - * WARNING: DMA_FD bit incorrectly set
  29. - * in Rc32434 (errata ref #077) */
  30. + if (!(devcs & ETH_RX_ROK)) {
  31. + /* Update statistics counters */
  32. dev->stats.rx_errors++;
  33. dev->stats.rx_dropped++;
  34. - } else if ((devcs & ETH_RX_ROK)) {
  35. - pkt_len = RCVPKT_LENGTH(devcs);
  36. + if (devcs & ETH_RX_CRC)
  37. + dev->stats.rx_crc_errors++;
  38. + if (devcs & ETH_RX_LE)
  39. + dev->stats.rx_length_errors++;
  40. + if (devcs & ETH_RX_OVR)
  41. + dev->stats.rx_fifo_errors++;
  42. + if (devcs & ETH_RX_CV)
  43. + dev->stats.rx_frame_errors++;
  44. + if (devcs & ETH_RX_CES)
  45. + dev->stats.rx_frame_errors++;
  46. - /* must be the (first and) last
  47. - * descriptor then */
  48. - pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
  49. -
  50. - /* invalidate the cache */
  51. - dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
  52. -
  53. - /* Malloc up new buffer. */
  54. - skb_new = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE);
  55. -
  56. - if (!skb_new)
  57. - break;
  58. - /* Do not count the CRC */
  59. - skb_put(skb, pkt_len - 4);
  60. - skb->protocol = eth_type_trans(skb, dev);
  61. -
  62. - /* Pass the packet to upper layers */
  63. - netif_receive_skb(skb);
  64. - dev->stats.rx_packets++;
  65. - dev->stats.rx_bytes += pkt_len;
  66. -
  67. - /* Update the mcast stats */
  68. - if (devcs & ETH_RX_MP)
  69. - dev->stats.multicast++;
  70. -
  71. - lp->rx_skb[lp->rx_next_done] = skb_new;
  72. + goto next;
  73. }
  74. + pkt_len = RCVPKT_LENGTH(devcs);
  75. +
  76. + /* must be the (first and) last
  77. + * descriptor then */
  78. + pkt_buf = (u8 *)lp->rx_skb[lp->rx_next_done]->data;
  79. +
  80. + /* invalidate the cache */
  81. + dma_cache_inv((unsigned long)pkt_buf, pkt_len - 4);
  82. +
  83. + /* Malloc up new buffer. */
  84. + skb_new = netdev_alloc_skb_ip_align(dev, KORINA_RBSIZE);
  85. +
  86. + if (!skb_new)
  87. + break;
  88. + /* Do not count the CRC */
  89. + skb_put(skb, pkt_len - 4);
  90. + skb->protocol = eth_type_trans(skb, dev);
  91. +
  92. + /* Pass the packet to upper layers */
  93. + netif_receive_skb(skb);
  94. + dev->stats.rx_packets++;
  95. + dev->stats.rx_bytes += pkt_len;
  96. +
  97. + /* Update the mcast stats */
  98. + if (devcs & ETH_RX_MP)
  99. + dev->stats.multicast++;
  100. +
  101. + lp->rx_skb[lp->rx_next_done] = skb_new;
  102. +
  103. +next:
  104. rd->devcs = 0;
  105. /* Restore descriptor's curr_addr */