aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/marvell/sky2.c
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-11-29 10:15:33 -0500
committerDavid S. Miller <davem@drr.davemloft.net>2011-11-29 20:49:21 -0500
commitec2a5466b3ce680c92e8e05617b020fd825854b9 (patch)
tree9b2169e588ea8260b649a85dca639e882df9173f /drivers/net/ethernet/marvell/sky2.c
parent614c76df1d1224dc2eee8678fab6e0b95b49b7da (diff)
sky2: add bql support
This adds support for byte queue limits and aggregates statistics update (suggestion from Eric). Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@drr.davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/marvell/sky2.c')
-rw-r--r--drivers/net/ethernet/marvell/sky2.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 29adc7850ee4..760c2b17dfd3 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -1110,6 +1110,7 @@ static void tx_init(struct sky2_port *sky2)
1110 sky2->tx_prod = sky2->tx_cons = 0; 1110 sky2->tx_prod = sky2->tx_cons = 0;
1111 sky2->tx_tcpsum = 0; 1111 sky2->tx_tcpsum = 0;
1112 sky2->tx_last_mss = 0; 1112 sky2->tx_last_mss = 0;
1113 netdev_reset_queue(sky2->netdev);
1113 1114
1114 le = get_tx_le(sky2, &sky2->tx_prod); 1115 le = get_tx_le(sky2, &sky2->tx_prod);
1115 le->addr = 0; 1116 le->addr = 0;
@@ -1971,6 +1972,7 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
1971 if (tx_avail(sky2) <= MAX_SKB_TX_LE) 1972 if (tx_avail(sky2) <= MAX_SKB_TX_LE)
1972 netif_stop_queue(dev); 1973 netif_stop_queue(dev);
1973 1974
1975 netdev_sent_queue(dev, skb->len);
1974 sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod); 1976 sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
1975 1977
1976 return NETDEV_TX_OK; 1978 return NETDEV_TX_OK;
@@ -2002,7 +2004,8 @@ mapping_error:
2002static void sky2_tx_complete(struct sky2_port *sky2, u16 done) 2004static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
2003{ 2005{
2004 struct net_device *dev = sky2->netdev; 2006 struct net_device *dev = sky2->netdev;
2005 unsigned idx; 2007 u16 idx;
2008 unsigned int bytes_compl = 0, pkts_compl = 0;
2006 2009
2007 BUG_ON(done >= sky2->tx_ring_size); 2010 BUG_ON(done >= sky2->tx_ring_size);
2008 2011
@@ -2017,10 +2020,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
2017 netif_printk(sky2, tx_done, KERN_DEBUG, dev, 2020 netif_printk(sky2, tx_done, KERN_DEBUG, dev,
2018 "tx done %u\n", idx); 2021 "tx done %u\n", idx);
2019 2022
2020 u64_stats_update_begin(&sky2->tx_stats.syncp); 2023 pkts_compl++;
2021 ++sky2->tx_stats.packets; 2024 bytes_compl += skb->len;
2022 sky2->tx_stats.bytes += skb->len;
2023 u64_stats_update_end(&sky2->tx_stats.syncp);
2024 2025
2025 re->skb = NULL; 2026 re->skb = NULL;
2026 dev_kfree_skb_any(skb); 2027 dev_kfree_skb_any(skb);
@@ -2031,6 +2032,13 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
2031 2032
2032 sky2->tx_cons = idx; 2033 sky2->tx_cons = idx;
2033 smp_mb(); 2034 smp_mb();
2035
2036 netdev_completed_queue(dev, pkts_compl, bytes_compl);
2037
2038 u64_stats_update_begin(&sky2->tx_stats.syncp);
2039 sky2->tx_stats.packets += pkts_compl;
2040 sky2->tx_stats.bytes += bytes_compl;
2041 u64_stats_update_end(&sky2->tx_stats.syncp);
2034} 2042}
2035 2043
2036static void sky2_tx_reset(struct sky2_hw *hw, unsigned port) 2044static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)