Patchwork [net-next-2.6,01/23] igb: add support for seperate tx-usecs setting in ethtool

login
register
mail settings
Submitter David Miller
Date Oct. 28, 2009, 10:39 a.m.
Message ID <20091028.033922.99548522.davem@davemloft.net>
Download mbox | patch
Permalink /patch/37087/
State Accepted
Delegated to: David Miller
Headers show

Comments

David Miller - Oct. 28, 2009, 10:39 a.m.
All applied to net-next-2.6, but then I had to add the following
patch to kill a warning:

igb: Fix warnings in igb_set_ringparam()

drivers/net/igb/igb_ethtool.c: In function ‘igb_set_ringparam’:
drivers/net/igb/igb_ethtool.c:744: warning: comparison of distinct pointer types lacks a cast
drivers/net/igb/igb_ethtool.c:748: warning: comparison of distinct pointer types lacks a cast

Casts were to u16 on the constant, but the type of new_{r,t}x_count is
u32.  Cast to u32 instead.

Signed-off-by: David S. Miller <davem@davemloft.net>

---
 drivers/net/igb/igb_ethtool.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.6.5.1
stephen hemminger - Oct. 28, 2009, 3:42 p.m.
On Wed, 28 Oct 2009 03:39:22 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> +	new_rx_count = max(new_rx_count, (u32)IGB_MIN_RXD);

new_rx_count = max_t(u32, new_rx_count, IGB_MIN_RXD)
  is slightly cleaner (hides cast)

Patch

diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c

index d24b902..90b89a8 100644

--- a/drivers/net/igb/igb_ethtool.c

+++ b/drivers/net/igb/igb_ethtool.c

@@ -741,11 +741,11 @@  static int igb_set_ringparam(struct net_device *netdev,

 		return -EINVAL;
 
 	new_rx_count = min(ring->rx_pending, (u32)IGB_MAX_RXD);
-	new_rx_count = max(new_rx_count, (u16)IGB_MIN_RXD);

+	new_rx_count = max(new_rx_count, (u32)IGB_MIN_RXD);

 	new_rx_count = ALIGN(new_rx_count, REQ_RX_DESCRIPTOR_MULTIPLE);
 
 	new_tx_count = min(ring->tx_pending, (u32)IGB_MAX_TXD);
-	new_tx_count = max(new_tx_count, (u16)IGB_MIN_TXD);

+	new_tx_count = max(new_tx_count, (u32)IGB_MIN_TXD);

 	new_tx_count = ALIGN(new_tx_count, REQ_TX_DESCRIPTOR_MULTIPLE);
 
 	if ((new_tx_count == adapter->tx_ring_count) &&