imx6: fix USB for 4.9 kernel
[oweals/openwrt.git] / target / linux / mvebu / patches-4.4 / 147-net-mvneta-add-BQL-support.patch
1 --- a/drivers/net/ethernet/marvell/mvneta.c
2 +++ b/drivers/net/ethernet/marvell/mvneta.c
3 @@ -1695,8 +1695,10 @@ static struct mvneta_tx_queue *mvneta_tx
4  
5  /* Free tx queue skbuffs */
6  static void mvneta_txq_bufs_free(struct mvneta_port *pp,
7 -                                struct mvneta_tx_queue *txq, int num)
8 +                                struct mvneta_tx_queue *txq, int num,
9 +                                struct netdev_queue *nq)
10  {
11 +       unsigned int bytes_compl = 0, pkts_compl = 0;
12         int i;
13  
14         for (i = 0; i < num; i++) {
15 @@ -1704,6 +1706,11 @@ static void mvneta_txq_bufs_free(struct
16                         txq->txq_get_index;
17                 struct sk_buff *skb = txq->tx_skb[txq->txq_get_index];
18  
19 +               if (skb) {
20 +                       bytes_compl += skb->len;
21 +                       pkts_compl++;
22 +               }
23 +
24                 mvneta_txq_inc_get(txq);
25  
26                 if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr))
27 @@ -1714,6 +1721,8 @@ static void mvneta_txq_bufs_free(struct
28                         continue;
29                 dev_kfree_skb_any(skb);
30         }
31 +
32 +       netdev_tx_completed_queue(nq, pkts_compl, bytes_compl);
33  }
34  
35  /* Handle end of transmission */
36 @@ -1727,7 +1736,7 @@ static void mvneta_txq_done(struct mvnet
37         if (!tx_done)
38                 return;
39  
40 -       mvneta_txq_bufs_free(pp, txq, tx_done);
41 +       mvneta_txq_bufs_free(pp, txq, tx_done, nq);
42  
43         txq->count -= tx_done;
44  
45 @@ -2334,6 +2343,8 @@ out:
46                 struct mvneta_pcpu_stats *stats = this_cpu_ptr(pp->stats);
47                 struct netdev_queue *nq = netdev_get_tx_queue(dev, txq_id);
48  
49 +               netdev_tx_sent_queue(nq, len);
50 +
51                 txq->count += frags;
52                 mvneta_txq_pend_desc_add(pp, txq, frags);
53  
54 @@ -2358,9 +2369,10 @@ static void mvneta_txq_done_force(struct
55                                   struct mvneta_tx_queue *txq)
56  
57  {
58 +       struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
59         int tx_done = txq->count;
60  
61 -       mvneta_txq_bufs_free(pp, txq, tx_done);
62 +       mvneta_txq_bufs_free(pp, txq, tx_done, nq);
63  
64         /* reset txq */
65         txq->count = 0;
66 @@ -2841,6 +2853,8 @@ static int mvneta_txq_init(struct mvneta
67  static void mvneta_txq_deinit(struct mvneta_port *pp,
68                               struct mvneta_tx_queue *txq)
69  {
70 +       struct netdev_queue *nq = netdev_get_tx_queue(pp->dev, txq->id);
71 +
72         kfree(txq->tx_skb);
73  
74         if (txq->tso_hdrs)
75 @@ -2852,6 +2866,8 @@ static void mvneta_txq_deinit(struct mvn
76                                   txq->size * MVNETA_DESC_ALIGNED_SIZE,
77                                   txq->descs, txq->descs_phys);
78  
79 +       netdev_tx_reset_queue(nq);
80 +
81         txq->descs             = NULL;
82         txq->last_desc         = 0;
83         txq->next_desc_to_proc = 0;