Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 275743
b: refs/heads/master
c: 738a849
h: refs/heads/master
i:
  275741: d3eb12d
  275739: 253d4c3
  275735: 4ee7dde
  275727: 3445801
  275711: f6f7b8a
v: v3
  • Loading branch information
stephen hemminger authored and David S. Miller committed Nov 18, 2011
1 parent 49166c6 commit b51c380
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a8bb7e27fbb68da888b55f26defd2855225b2d5
refs/heads/master: 738a849c8eef4787a526d95763f985b8c1cb68e4
14 changes: 12 additions & 2 deletions trunk/drivers/net/ethernet/marvell/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4088,6 +4088,16 @@ static int sky2_set_coalesce(struct net_device *dev,
return 0;
}

/*
* Hardware is limited to min of 128 and max of 2048 for ring size
* and rounded up to next power of two
* to avoid division in modulus calclation
*/
static unsigned long roundup_ring_size(unsigned long pending)
{
return max(128ul, roundup_pow_of_two(pending+1));
}

static void sky2_get_ringparam(struct net_device *dev,
struct ethtool_ringparam *ering)
{
Expand Down Expand Up @@ -4115,7 +4125,7 @@ static int sky2_set_ringparam(struct net_device *dev,

sky2->rx_pending = ering->rx_pending;
sky2->tx_pending = ering->tx_pending;
sky2->tx_ring_size = roundup_pow_of_two(sky2->tx_pending+1);
sky2->tx_ring_size = roundup_ring_size(sky2->tx_pending);

return sky2_reattach(dev);
}
Expand Down Expand Up @@ -4709,7 +4719,7 @@ static __devinit struct net_device *sky2_init_netdev(struct sky2_hw *hw,
spin_lock_init(&sky2->phy_lock);

sky2->tx_pending = TX_DEF_PENDING;
sky2->tx_ring_size = roundup_pow_of_two(TX_DEF_PENDING+1);
sky2->tx_ring_size = roundup_ring_size(TX_DEF_PENDING);
sky2->rx_pending = RX_DEF_PENDING;

hw->dev[port] = dev;
Expand Down

0 comments on commit b51c380

Please sign in to comment.