netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Alexander Duyck <alexander.h.duyck@intel.com>,
	netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 03/11] igb: avoid unnecessary conversions from u16 to int
Date: Fri,  7 Oct 2011 23:47:33 -0700	[thread overview]
Message-ID: <1318056461-19562-4-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1318056461-19562-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Alexander Duyck <alexander.h.duyck@intel.com>

There are a number of places where we have values that are stored as u16
but are being converted to int unnecessarily.  In order to avoid that we
should convert all variables that deal with the next_to_clean, next_to_use,
and count to u16 values.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by:  Aaron Brown  <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c |    5 +++--
 drivers/net/ethernet/intel/igb/igb_main.c    |    9 ++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index f227fc5..a893da1 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -1581,8 +1581,8 @@ static int igb_clean_test_rings(struct igb_ring *rx_ring,
 	union e1000_adv_rx_desc *rx_desc;
 	struct igb_rx_buffer *rx_buffer_info;
 	struct igb_tx_buffer *tx_buffer_info;
-	int rx_ntc, tx_ntc, count = 0;
 	u32 staterr;
+	u16 rx_ntc, tx_ntc, count = 0;
 
 	/* initialize next to clean and descriptor values */
 	rx_ntc = rx_ring->next_to_clean;
@@ -1634,7 +1634,8 @@ static int igb_run_loopback_test(struct igb_adapter *adapter)
 {
 	struct igb_ring *tx_ring = &adapter->test_tx_ring;
 	struct igb_ring *rx_ring = &adapter->test_rx_ring;
-	int i, j, lc, good_cnt, ret_val = 0;
+	u16 i, j, lc, good_cnt;
+	int ret_val = 0;
 	unsigned int size = IGB_RX_HDR_LEN;
 	netdev_tx_t tx_ret_val;
 	struct sk_buff *skb;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 287be85..3a5c75d 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -338,14 +338,13 @@ static void igb_dump(struct igb_adapter *adapter)
 	struct net_device *netdev = adapter->netdev;
 	struct e1000_hw *hw = &adapter->hw;
 	struct igb_reg_info *reginfo;
-	int n = 0;
 	struct igb_ring *tx_ring;
 	union e1000_adv_tx_desc *tx_desc;
 	struct my_u0 { u64 a; u64 b; } *u0;
 	struct igb_ring *rx_ring;
 	union e1000_adv_rx_desc *rx_desc;
 	u32 staterr;
-	int i = 0;
+	u16 i, n;
 
 	if (!netif_msg_hw(adapter))
 		return;
@@ -3239,7 +3238,7 @@ static void igb_clean_tx_ring(struct igb_ring *tx_ring)
 {
 	struct igb_tx_buffer *buffer_info;
 	unsigned long size;
-	unsigned int i;
+	u16 i;
 
 	if (!tx_ring->tx_buffer_info)
 		return;
@@ -4355,7 +4354,7 @@ dma_error:
 	tx_ring->next_to_use = i;
 }
 
-static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, int size)
+static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
 {
 	struct net_device *netdev = tx_ring->netdev;
 
@@ -4381,7 +4380,7 @@ static int __igb_maybe_stop_tx(struct igb_ring *tx_ring, int size)
 	return 0;
 }
 
-static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, int size)
+static inline int igb_maybe_stop_tx(struct igb_ring *tx_ring, const u16 size)
 {
 	if (igb_desc_unused(tx_ring) >= size)
 		return 0;
-- 
1.7.6.4

  parent reply	other threads:[~2011-10-08  6:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08  6:47 [net-next 00/11][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2011-10-08  6:47 ` [net-next 01/11] igb: push data into first igb_tx_buffer sooner to reduce stack usage Jeff Kirsher
2011-10-08  6:47 ` [net-next 02/11] igb: Use node specific allocations for the q_vectors and rings Jeff Kirsher
2011-10-08 19:51   ` David Miller
2011-10-10 16:15     ` Alexander Duyck
2011-10-10 17:50       ` David Miller
2011-10-09 18:08   ` Andi Kleen
2011-10-10 16:25     ` Alexander Duyck
2011-10-10 16:32       ` Andi Kleen
2011-10-10 17:02         ` Alexander Duyck
2011-10-08  6:47 ` Jeff Kirsher [this message]
2011-10-08  6:47 ` [net-next 04/11] igb: Consolidate all of the ring feature flags into a single value Jeff Kirsher
2011-10-08  6:47 ` [net-next 05/11] igb: Move ITR related data into work container within the q_vector Jeff Kirsher
2011-10-08  6:47 ` [net-next 06/11] igb: cleanup IVAR configuration Jeff Kirsher
2011-10-08  6:47 ` [net-next 07/11] igb: retire the RX_CSUM flag and use the netdev flag instead Jeff Kirsher
2011-10-08  6:47 ` [net-next 08/11] igb: leave staterr in place and instead us a helper function to check bits Jeff Kirsher
2011-10-08  6:47 ` [net-next 09/11] igb: fix recent VLAN changes that would leave VLANs disabled after reset Jeff Kirsher
2011-10-08  6:47 ` [net-next 10/11] igb: move TX hang check flag into ring->flags Jeff Kirsher
2011-10-08  6:47 ` [net-next 11/11] igb: add support for NETIF_F_RXHASH Jeff Kirsher
2011-10-08  6:52 ` [net-next 00/11][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
  -- strict thread matches above, loose matches on Subject: below --
2011-10-11 15:45 [net-next 00/11 v2][pull " Jeff Kirsher
2011-10-11 15:45 ` [net-next 03/11] igb: avoid unnecessary conversions from u16 to int Jeff Kirsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1318056461-19562-4-git-send-email-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=gospo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).