Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec2a5466 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller
Browse files

sky2: add bql support



This adds support for byte queue limits and aggregates statistics
update (suggestion from Eric).

Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@drr.davemloft.net>
parent 614c76df
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -1110,6 +1110,7 @@ static void tx_init(struct sky2_port *sky2)
	sky2->tx_prod = sky2->tx_cons = 0;
	sky2->tx_prod = sky2->tx_cons = 0;
	sky2->tx_tcpsum = 0;
	sky2->tx_tcpsum = 0;
	sky2->tx_last_mss = 0;
	sky2->tx_last_mss = 0;
	netdev_reset_queue(sky2->netdev);


	le = get_tx_le(sky2, &sky2->tx_prod);
	le = get_tx_le(sky2, &sky2->tx_prod);
	le->addr = 0;
	le->addr = 0;
@@ -1971,6 +1972,7 @@ static netdev_tx_t sky2_xmit_frame(struct sk_buff *skb,
	if (tx_avail(sky2) <= MAX_SKB_TX_LE)
	if (tx_avail(sky2) <= MAX_SKB_TX_LE)
		netif_stop_queue(dev);
		netif_stop_queue(dev);


	netdev_sent_queue(dev, skb->len);
	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);
	sky2_put_idx(hw, txqaddr[sky2->port], sky2->tx_prod);


	return NETDEV_TX_OK;
	return NETDEV_TX_OK;
@@ -2002,7 +2004,8 @@ mapping_error:
static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
{
{
	struct net_device *dev = sky2->netdev;
	struct net_device *dev = sky2->netdev;
	unsigned idx;
	u16 idx;
	unsigned int bytes_compl = 0, pkts_compl = 0;


	BUG_ON(done >= sky2->tx_ring_size);
	BUG_ON(done >= sky2->tx_ring_size);


@@ -2017,10 +2020,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
			netif_printk(sky2, tx_done, KERN_DEBUG, dev,
			netif_printk(sky2, tx_done, KERN_DEBUG, dev,
				     "tx done %u\n", idx);
				     "tx done %u\n", idx);


			u64_stats_update_begin(&sky2->tx_stats.syncp);
			pkts_compl++;
			++sky2->tx_stats.packets;
			bytes_compl += skb->len;
			sky2->tx_stats.bytes += skb->len;
			u64_stats_update_end(&sky2->tx_stats.syncp);


			re->skb = NULL;
			re->skb = NULL;
			dev_kfree_skb_any(skb);
			dev_kfree_skb_any(skb);
@@ -2031,6 +2032,13 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)


	sky2->tx_cons = idx;
	sky2->tx_cons = idx;
	smp_mb();
	smp_mb();

	netdev_completed_queue(dev, pkts_compl, bytes_compl);

	u64_stats_update_begin(&sky2->tx_stats.syncp);
	sky2->tx_stats.packets += pkts_compl;
	sky2->tx_stats.bytes += bytes_compl;
	u64_stats_update_end(&sky2->tx_stats.syncp);
}
}


static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)
static void sky2_tx_reset(struct sky2_hw *hw, unsigned port)