147-net-mvneta-add-BQL-support.patch 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. --- a/drivers/net/ethernet/marvell/mvneta.c
  2. +++ b/drivers/net/ethernet/marvell/mvneta.c
  3. @@ -1696,8 +1696,10 @@ static struct mvneta_tx_queue *mvneta_tx
  4. /* Free tx queue skbuffs */
  5. static void mvneta_txq_bufs_free(struct mvneta_port *pp,
  6. - struct mvneta_tx_queue *txq, int num)
  7. + struct mvneta_tx_queue *txq, int num,
  8. + struct netdev_queue *nq)
  9. {
  10. + unsigned int bytes_compl = 0, pkts_compl = 0;
  11. int i;
  12. for (i = 0; i < num; i++) {
  13. @@ -1705,6 +1707,11 @@ static void mvneta_txq_bufs_free(struct
  14. txq->txq_get_index;
  15. struct sk_buff *skb = txq->tx_skb[txq->txq_get_index];
  16. + if (skb) {
  17. + bytes_compl += skb->len;
  18. + pkts_compl++;
  19. + }
  20. +
  21. mvneta_txq_inc_get(txq);
  22. if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
  23. @@ -1715,6 +1722,8 @@ static void mvneta_txq_bufs_free(struct
  24. continue;
  25. dev_kfree_skb_any(skb);
  26. }
  27. +
  28. + netdev_tx_completed_queue(nq, pkts_compl, bytes_compl);
  29. }
  30. /* Handle end of transmission */
  31. @@ -1728,7 +1737,7 @@ static void mvneta_txq_done(struct mvnet
  32. if (!tx_done)
  33. return;
  34. - mvneta_txq_bufs_free(pp, txq, tx_done);
  35. + mvneta_txq_bufs_free(pp, txq, tx_done, nq);
  36. txq->count -= tx_done;
  37. @@ -2335,6 +2344,8 @@ out:
  38. struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
  39. struct netdev_queue *nq = netdev_get_tx_queue(dev, txq_id);
  40. + netdev_tx_sent_queue(nq, len);
  41. +
  42. txq->count += frags;
  43. mvneta_txq_pend_desc_add(pp, txq, frags);
  44. @@ -2359,9 +2370,10 @@ static void mvneta_txq_done_force(struct
  45. struct mvneta_tx_queue *txq)
  46. {
  47. + struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
  48. int tx_done = txq->count;
  49. - mvneta_txq_bufs_free(pp, txq, tx_done);
  50. + mvneta_txq_bufs_free(pp, txq, tx_done, nq);
  51. /* reset txq */
  52. txq->count = 0;
  53. @@ -2842,6 +2854,8 @@ static int mvneta_txq_init(struct mvneta
  54. static void mvneta_txq_deinit(struct mvneta_port *pp,
  55. struct mvneta_tx_queue *txq)
  56. {
  57. + struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
  58. +
  59. kfree(txq->tx_skb);
  60. if (txq->tso_hdrs)
  61. @@ -2853,6 +2867,8 @@ static void mvneta_txq_deinit(struct mvn
  62. txq->size * MVNETA_DESC_ALIGNED_SIZE,
  63. txq->descs, txq->descs_phys);
  64. + netdev_tx_reset_queue(nq);
  65. +
  66. txq->descs = NULL;
  67. txq->last_desc = 0;
  68. txq->next_desc_to_proc = 0;