Guest User

Untitled

a guest
Jun 2nd, 2021
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
  2. index 1477ce2c3387..6120e2a73fd2 100644
  3. --- a/drivers/net/ethernet/realtek/8139too.c
  4. +++ b/drivers/net/ethernet/realtek/8139too.c
  5. @@ -2127,21 +2127,43 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
  6. struct rtl8139_private *tp = container_of(napi, struct rtl8139_private, napi);
  7. struct net_device *dev = tp->dev;
  8. void __iomem *ioaddr = tp->mmio_addr;
  9. + int link_changed = 0; /* avoid bogus "uninit" warning */
  10. + unsigned long flags;
  11. + u32 status;
  12. int work_done;
  13.  
  14. spin_lock(&tp->rx_lock);
  15. + spin_lock_irqsave(&tp->lock, flags);
  16. work_done = 0;
  17. - if (likely(RTL_R16(IntrStatus) & RxAckBits))
  18. + status = RTL_R16(IntrStatus);
  19. +
  20. + /* Acknowledge all of the current interrupt sources ASAP, but
  21. + an first get an additional status bit from CSCR. */
  22. + if (unlikely(status & RxUnderrun)) {
  23. + link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;
  24. +
  25. + /* Check uncommon events with one test. */
  26. + if (unlikely(status & (PCIErr | PCSTimeout | RxUnderrun | RxErr))) {
  27. + RTL_W16_F(IntrMask,
  28. + status & (PCIErr | PCSTimeout | RxUnderrun | RxErr));
  29. + rtl8139_weird_interrupt (dev, tp, ioaddr,
  30. + status, link_changed);
  31. + }
  32. +
  33. + if (status & (TxOK | TxErr)) {
  34. + RTL_W16 (IntrStatus, status & (TxOK | TxErr));
  35. + rtl8139_tx_interrupt (dev, tp, ioaddr);
  36. + }
  37. +
  38. + if (likely(status & RxAckBits))
  39. work_done += rtl8139_rx(dev, tp, budget);
  40.  
  41. + /* All handled events are acked now, unmask them */
  42. if (work_done < budget) {
  43. - unsigned long flags;
  44. -
  45. - spin_lock_irqsave(&tp->lock, flags);
  46. if (napi_complete_done(napi, work_done))
  47. RTL_W16_F(IntrMask, rtl8139_intr_mask);
  48. - spin_unlock_irqrestore(&tp->lock, flags);
  49. }
  50. + spin_unlock_irqrestore(&tp->lock, flags);
  51. spin_unlock(&tp->rx_lock);
  52.  
  53. return work_done;
  54. @@ -2154,7 +2176,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
  55. struct net_device *dev = (struct net_device *) dev_instance;
  56. struct rtl8139_private *tp = netdev_priv(dev);
  57. void __iomem *ioaddr = tp->mmio_addr;
  58. - u16 status, ackstat;
  59. + u16 status;
  60. int link_changed = 0; /* avoid bogus "uninit" warning */
  61. int handled = 0;
  62.  
  63. @@ -2177,34 +2199,15 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
  64. goto out;
  65. }
  66.  
  67. - /* Acknowledge all of the current interrupt sources ASAP, but
  68. - an first get an additional status bit from CSCR. */
  69. - if (unlikely(status & RxUnderrun))
  70. - link_changed = RTL_R16 (CSCR) & CSCR_LinkChangeBit;
  71. -
  72. - ackstat = status & ~(RxAckBits | TxErr);
  73. - if (ackstat)
  74. - RTL_W16 (IntrStatus, ackstat);
  75. -
  76. - /* Receive packets are processed by poll routine.
  77. + /* Process interrupts in poll routine.
  78. If not running start it now. */
  79. - if (status & RxAckBits){
  80. + if (status) {
  81. if (napi_schedule_prep(&tp->napi)) {
  82. - RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
  83. + RTL_W16_F (IntrMask, 0);
  84. __napi_schedule(&tp->napi);
  85. }
  86. }
  87.  
  88. - /* Check uncommon events with one test. */
  89. - if (unlikely(status & (PCIErr | PCSTimeout | RxUnderrun | RxErr)))
  90. - rtl8139_weird_interrupt (dev, tp, ioaddr,
  91. - status, link_changed);
  92. -
  93. - if (status & (TxOK | TxErr)) {
  94. - rtl8139_tx_interrupt (dev, tp, ioaddr);
  95. - if (status & TxErr)
  96. - RTL_W16 (IntrStatus, TxErr);
  97. - }
  98. out:
  99. spin_unlock (&tp->lock);
  100.  
  101.  
Advertisement
Add Comment
Please, Sign In to add comment