[net-next-2.6 27/27] igb: Add new function to read part number from EEPROM in string format

Previous thread: [PATCH] Document the kernel_recvmsg() function by Martin Lucina on Friday, December 10, 2010 - 3:04 am. (4 messages)

Next thread: net-next-2.6 [Patch 1/1] dccp: dead code elimination by Gerrit Renker on Friday, December 10, 2010 - 4:59 am. (4 messages)
From: Jeff Kirsher
Date: Friday, December 10, 2010 - 3:06 am

From: Bruce Allan <bruce.w.allan@intel.com>

Correct error messages when setting up Rx resources and when checking
module parameters.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/e1000e/netdev.c |    2 +-
 drivers/net/e1000e/param.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4bf843a..6e1f3a3 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2130,7 +2130,7 @@ err_pages:
 	}
 err:
 	vfree(rx_ring->buffer_info);
-	e_err("Unable to allocate memory for the transmit descriptor ring\n");
+	e_err("Unable to allocate memory for the receive descriptor ring\n");
 	return err;
 }
 
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index 3d36911..a9612b0 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -421,7 +421,7 @@ void __devinit e1000e_check_options(struct e1000_adapter *adapter)
 		static const struct e1000_option opt = {
 			.type = enable_option,
 			.name = "CRC Stripping",
-			.err  = "defaulting to enabled",
+			.err  = "defaulting to Enabled",
 			.def  = OPTION_ENABLED
 		};
 
-- 
1.7.3.2

--

From: Jeff Kirsher
Date: Friday, December 10, 2010 - 3:06 am

From: Bruce Allan <bruce.w.allan@intel.com>

Adding this default case resolves the issue.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/e1000e/ethtool.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 29b09113..72ce0ec 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1992,6 +1992,10 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
 			p = (char *) adapter +
 					e1000_gstrings_stats[i].stat_offset;
 			break;
+		default:
+			data[i] = 0;
+			continue;
+			break;
 		}
 
 		data[i] = (e1000_gstrings_stats[i].sizeof_stat ==
-- 
1.7.3.2

--

From: Joe Perches
Date: Friday, December 10, 2010 - 5:44 am

Using

	continue;
	break;

is odd and unhelpful.
Just continue; is sufficient and clear.


--

From: Tantilov, Emil S
Date: Friday, December 10, 2010 - 12:35 pm

It's odd and without consequence but not necessarily "unhelpful" as it can protect from bugs in case someone was to add another case statement. While unlikely, bugs in switch statements due to missing breaks are not unheard of.

Looking at the kernel source there is no consistency as far as break in the default: case is concerned.

Dave, unless this is infringing on some coding style rule, I would request that the patch be applied as is.

Thanks,
Emil

From: Joe Perches
Date: Friday, December 10, 2010 - 12:58 pm

continue statements are not fall-through.

Adding another case statement in the switch below


It's not the break, it's the break after continue that's odd.

Glancing through the source code using
	$ grep -rP --include=*.[ch] -B 3 "\bcontinue\s*;\s*break\s*;" *
this is a pretty unusual coding style.

Most all of the matches are like:
	if (condition)
		continue;
	break;

Your choice, your code.  I just think it's ugly
as well as odd and unhelpful.

cheers, Joe

--

From: David Miller
Date: Friday, December 10, 2010 - 1:16 pm

From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>

I think Ben's request is more than reasonable.  Please make his requested
change.  "continue; break;" looks quite silly to me too.
--

From: Jeff Kirsher
Date: Friday, December 10, 2010 - 3:06 am

From: Bruce Allan <bruce.w.allan@intel.com>

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/e1000e/netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 6e1f3a3..5530d0b 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -54,7 +54,7 @@
 
 #define DRV_EXTRAVERSION "-k2"
 
-#define DRV_VERSION "1.2.7" DRV_EXTRAVERSION
+#define DRV_VERSION "1.2.20" DRV_EXTRAVERSION
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
-- 
1.7.3.2

--

From: Jeff Kirsher
Date: Friday, December 10, 2010 - 3:06 am

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

New adapters will have part numbers stored in string format rather than
simple hex format. This function will read part number formats in either
hex or string.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/igb/e1000_defines.h |    7 +++
 drivers/net/igb/e1000_nvm.c     |   93 ++++++++++++++++++++++++++++++++++++---
 drivers/net/igb/e1000_nvm.h     |    2 +
 drivers/net/igb/igb_main.c      |   11 +++--
 4 files changed, 102 insertions(+), 11 deletions(-)

diff --git a/drivers/net/igb/e1000_defines.h b/drivers/net/igb/e1000_defines.h
index 6222279..6319ed9 100644
--- a/drivers/net/igb/e1000_defines.h
+++ b/drivers/net/igb/e1000_defines.h
@@ -419,6 +419,9 @@
 #define E1000_ERR_SWFW_SYNC 13
 #define E1000_NOT_IMPLEMENTED 14
 #define E1000_ERR_MBX      15
+#define E1000_ERR_INVALID_ARGUMENT  16
+#define E1000_ERR_NO_SPACE          17
+#define E1000_ERR_NVM_PBA_SECTION   18
 
 /* Loop limit on how long we wait for auto-negotiation to complete */
 #define COPPER_LINK_UP_LIMIT              10
@@ -580,11 +583,15 @@
 
 /* Mask bits for fields in Word 0x1a of the NVM */
 
+/* length of string needed to store part num */
+#define E1000_PBANUM_LENGTH         11
+
 /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
 #define NVM_SUM                    0xBABA
 
 #define NVM_PBA_OFFSET_0           8
 #define NVM_PBA_OFFSET_1           9
+#define NVM_PBA_PTR_GUARD          0xFAFA
 #define NVM_WORD_SIZE_BASE_SHIFT   6
 
 /* NVM Commands - Microwire */
diff --git a/drivers/net/igb/e1000_nvm.c b/drivers/net/igb/e1000_nvm.c
index d83b77fa..6b5cc2c 100644
--- a/drivers/net/igb/e1000_nvm.c
+++ b/drivers/net/igb/e1000_nvm.c
@@ -445,31 +445,112 @@ out:
 }
 
 /**
- *  igb_read_part_num - Read device part number
+ *  igb_read_part_string - Read device part number
  *  @hw: pointer to the HW structure
  *  @part_num: ...
Previous thread: [PATCH] Document the kernel_recvmsg() function by Martin Lucina on Friday, December 10, 2010 - 3:04 am. (4 messages)

Next thread: net-next-2.6 [Patch 1/1] dccp: dead code elimination by Gerrit Renker on Friday, December 10, 2010 - 4:59 am. (4 messages)