mpc85xx: use wpad-mini in WDR4900 profile instead of wpad
[15.05/openwrt.git] / target / linux / mpc85xx / patches-3.10 / 220-fix_gianfar_reported_number_of_sent_bytes_to_BQL.patch
1 --- a/drivers/net/ethernet/freescale/gianfar.c
2 +++ b/drivers/net/ethernet/freescale/gianfar.c
3 @@ -2064,7 +2064,7 @@ static int gfar_start_xmit(struct sk_buf
4         int i, rq = 0, do_tstamp = 0;
5         u32 bufaddr;
6         unsigned long flags;
7 -       unsigned int nr_frags, nr_txbds, length, fcb_length = GMAC_FCB_LEN;
8 +       unsigned int nr_frags, nr_txbds, bytes_sent, fcb_length = GMAC_FCB_LEN;
9  
10         /* TOE=1 frames larger than 2500 bytes may see excess delays
11          * before start of transmission.
12 @@ -2130,7 +2130,10 @@ static int gfar_start_xmit(struct sk_buf
13         }
14  
15         /* Update transmit stats */
16 -       tx_queue->stats.tx_bytes += skb->len;
17 +       bytes_sent = skb->len;
18 +       tx_queue->stats.tx_bytes += bytes_sent;
19 +       /* keep Tx bytes on wire for BQL accounting */
20 +       GFAR_CB(skb)->bytes_sent = bytes_sent;
21         tx_queue->stats.tx_packets++;
22  
23         txbdp = txbdp_start = tx_queue->cur_tx;
24 @@ -2150,12 +2153,13 @@ static int gfar_start_xmit(struct sk_buf
25         } else {
26                 /* Place the fragment addresses and lengths into the TxBDs */
27                 for (i = 0; i < nr_frags; i++) {
28 +                       unsigned int frag_len;
29                         /* Point at the next BD, wrapping as needed */
30                         txbdp = next_txbd(txbdp, base, tx_queue->tx_ring_size);
31  
32 -                       length = skb_shinfo(skb)->frags[i].size;
33 +                       frag_len = skb_shinfo(skb)->frags[i].size;
34  
35 -                       lstatus = txbdp->lstatus | length |
36 +                       lstatus = txbdp->lstatus | frag_len |
37                                   BD_LFLAG(TXBD_READY);
38  
39                         /* Handle the last BD specially */
40 @@ -2165,7 +2169,7 @@ static int gfar_start_xmit(struct sk_buf
41                         bufaddr = skb_frag_dma_map(priv->dev,
42                                                    &skb_shinfo(skb)->frags[i],
43                                                    0,
44 -                                                  length,
45 +                                                  frag_len,
46                                                    DMA_TO_DEVICE);
47  
48                         /* set the TxBD length and buffer pointer */
49 @@ -2231,7 +2235,7 @@ static int gfar_start_xmit(struct sk_buf
50                 lstatus |= BD_LFLAG(TXBD_CRC | TXBD_READY) | skb_headlen(skb);
51         }
52  
53 -       netdev_tx_sent_queue(txq, skb->len);
54 +       netdev_tx_sent_queue(txq, bytes_sent);
55  
56         /* We can work in parallel with gfar_clean_tx_ring(), except
57          * when modifying num_txbdfree. Note that we didn't grab the lock
58 @@ -2551,7 +2555,7 @@ static void gfar_clean_tx_ring(struct gf
59                         bdp = next_txbd(bdp, base, tx_ring_size);
60                 }
61  
62 -               bytes_sent += skb->len;
63 +               bytes_sent += GFAR_CB(skb)->bytes_sent;
64  
65                 dev_kfree_skb_any(skb);
66  
67 --- a/drivers/net/ethernet/freescale/gianfar.h
68 +++ b/drivers/net/ethernet/freescale/gianfar.h
69 @@ -571,7 +571,7 @@ struct rxfcb {
70  };
71  
72  struct gianfar_skb_cb {
73 -       int alignamount;
74 +       unsigned int bytes_sent; /* bytes-on-wire (i.e. no FCB) */
75  };
76  
77  #define GFAR_CB(skb) ((struct gianfar_skb_cb *)((skb)->cb))