Skip to contentSkip to conversation

atl1: incorporate reviewer comments

PATCH Applied Jay Cliburn 1 participant 1 message Jan 28, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 atl1: incorporate reviewer comments

From: Jay Cliburn <[email protected]>

Incorporate reviewer comments from:
Randy Dunlap, http://lkml.org/lkml/2007/1/21/157
Arjan van de Ven, http://lkml.org/lkml/2007/1/22/21
Francois Romieu, http://lkml.org/lkml/2007/1/22/49

Fixup to follow coding standards, remove MII defines already found in mii.h, remove unneeded code, make atl1_clear_phy_int() irq safe.

---

drivers/net/atl1/atl1.h +33 -38
index 0b30e1c..cc18016 100644
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
  * Copyright(c) 2006 Chris Snook <[email protected]>
  * Copyright(c) 2006 Jay Cliburn <[email protected]>
@@ -19,14 +19,13 @@
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 59
  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- **/
+ */
 
 #ifndef _ATL1_H_
 #define _ATL1_H_
 
 #include <linux/types.h>
 #include <linux/if_vlan.h>
-#include <linux/mii.h>
 
 #include "atl1_hw.h"
 
@@ -37,6 +36,9 @@ int atl1_reset(struct atl1_adapter *adapter);
 s32 atl1_setup_ring_resources(struct atl1_adapter *adapter);
 void atl1_free_ring_resources(struct atl1_adapter *adapter);
 
+extern char atl1_driver_name[];
+extern char atl1_driver_version[];
+
 struct atl1_adapter;
 
 #define ATL1_MAX_INTR		3
@@ -53,17 +55,17 @@ struct atl1_adapter;
 #define ATL1_TPD_DESC(R, i)	ATL1_GET_DESC(R, i, struct tx_packet_desc)
 #define ATL1_RRD_DESC(R, i)	ATL1_GET_DESC(R, i, struct rx_return_desc)
 
-/**
+/*
  * Some workarounds require millisecond delays and are run during interrupt
  * context.  Most notably, when establishing link, the phy may need tweaking
  * but cannot process phy register reads/writes faster than millisecond
  * intervals...and we establish link due to a "link status change" interrupt.
- **/
+ */
 
-/**
+/*
  * wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer
- **/
+ */
 struct atl1_buffer {
 	struct sk_buff *skb;
 	u16 length;
@@ -78,7 +80,6 @@ struct atl1_tpd_ring {
 	dma_addr_t dma;		/* physical adress of the descriptor ring */
 	u16 size;		/* length of descriptor ring in bytes */
 	u16 count;		/* number of descriptors in the ring */
-
 	u16 hw_idx;		/* hardware index */
 	atomic_t next_to_clean;
 	atomic_t next_to_use;
@@ -105,12 +106,9 @@ struct atl1_rrd_ring {
 };
 
 struct atl1_ring_header {
-	/* pointer to the descriptor ring memory */
-	void *desc;
-	/* physical adress of the descriptor ring */
-	dma_addr_t dma;
-	/* length of descriptor ring in bytes */
-	unsigned int size;
+	void *desc;		/* pointer to the descriptor ring memory */
+	dma_addr_t dma;		/* physical adress of the descriptor ring */
+	unsigned int size;	/* length of descriptor ring in bytes */
 };
 
 struct atl1_cmb {
@@ -143,16 +141,15 @@ struct atl1_sft_stats {
 	u64 tx_window_errors;
 	u64 tx_carrier_errors;
 
-	u64 tx_pause;		/* The number of Pause packet transmitted. */
-	u64 excecol;		/* The number of transmit packets aborted due to excessive collisions. */
-	u64 deffer;		/* The number of packets transmitted that is deferred. */
-	u64 scc;		/* The number of packets subsequently transmitted successfully with a single prior collision. */
-	u64 mcc;		/* The number of packets subsequently transmitted successfully with multiple prior collisions. */
-	u64 latecol;		/* The number of packets transmitted with late collisions. */
-	u64 tx_underun;		/* The number of transmit packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */
-	u64 tx_trunc;		/* The number of transmit packets truncated due to size exceeding MTU, regardless if it is truncated by Selene or not.
-				 * (The name is not really reflects the meaning in this case here.) */
-	u64 rx_pause;		/* The number of Pause packet received. */
+	u64 tx_pause;		/* num Pause packet transmitted. */
+	u64 excecol;		/* num tx packets aborted due to excessive collisions. */
+	u64 deffer;		/* num deferred tx packets */
+	u64 scc;		/* num packets subsequently transmitted successfully w/ single prior collision. */
+	u64 mcc;		/* num packets subsequently transmitted successfully w/ multiple prior collisions. */
+	u64 latecol;		/* num tx packets  w/ late collisions. */
+	u64 tx_underun;		/* num tx packets aborted due to transmit FIFO underrun, or TRD FIFO underrun */
+	u64 tx_trunc;		/* num tx packets truncated due to size exceeding MTU, regardless whether truncated by Selene or not. (The name doesn't really reflect the meaning in this case.) */
+	u64 rx_pause;		/* num Pause packets received. */
 	u64 rx_rrd_ov;
 	u64 rx_trunc;
 };
@@ -164,29 +161,27 @@ struct atl1_sft_stats {
 struct atl1_hw {
 	u8 __iomem *hw_addr;
 	struct atl1_adapter *back;
-
 	enum atl1_dma_order dma_ord;
 	enum atl1_dma_rcb rcb_value;
 	enum atl1_dma_req_block dmar_block;
 	enum atl1_dma_req_block dmaw_block;
-
 	u8 preamble_len;
-	u8 max_retry;		/* Retransmission maximum , afterwards the packet will be discarded. */
-	u8 jam_ipg;		/* IPG to start JAM for collision based flow control in half-duplex mode. In unit of 8-bit time. */
-	u8 ipgt;		/* Desired back to back inter-packet gap. The default is 96-bit time. */
-	u8 min_ifg;		/* Minimum number of IFG to enforce in between RX frames. Frame gap below such IFP is dropped. */
+	u8 max_retry;		/* Retransmission maximum, after which the packet will be discarded */
+	u8 jam_ipg;		/* IPG to start JAM for collision based flow control in half-duplex mode. In units of 8-bit time */
+	u8 ipgt;		/* Desired back to back inter-packet gap. The default is 96-bit time */
+	u8 min_ifg;		/* Minimum number of IFG to enforce in between RX frames. Frame gap below such IFP is dropped */
 	u8 ipgr1;		/* 64bit Carrier-Sense window */
 	u8 ipgr2;		/* 96-bit IPG window */
-
-	u8 tpd_burst;		/* Number of TPD to prefetch in a cache-aligned burst. Each TPD is 16-byte in length. */
-	u8 rfd_burst;		/* Number of RFD to prefetch in a cache-aligned burst. Each RFD is 12-byte in length. */
+	u8 tpd_burst;		/* Number of TPD to prefetch in cache-aligned burst. Each TPD is 16 bytes long */
+	u8 rfd_burst;		/* Number of RFD to prefetch in cache-aligned burst. Each RFD is 12 bytes long */
 	u8 rfd_fetch_gap;
-	u8 rrd_burst;		/* Threshold of number of RRDs can be retired in a burst. Each RRD is 16-byte in length. */
+	u8 rrd_burst;		/* Threshold number of RRDs that can be retired in a burst. Each RRD is 16 bytes long */
 	u8 tpd_fetch_th;
 	u8 tpd_fetch_gap;
 	u16 tx_jumbo_task_th;
-	u16 txf_burst;		/* Number of data byte to read in a cache-aligned burst. Each SRAM entry is 8-byte in length. */
-	u16 rx_jumbo_th;	/* Jumbo packet size for non-VLAN packet. VLAN packet should add 4-byte */
+	u16 txf_burst;		/* Number of data bytes to read in a cache-aligned burst. Each SRAM entry is
+				   8 bytes long */
+	u16 rx_jumbo_th;	/* Jumbo packet size for non-VLAN packet. VLAN packets should add 4 bytes */
 	u16 rx_jumbo_lkah;
 	u16 rrd_ret_timer;	/* RRD retirement timer. Decrement by 1 after every 512ns passes. */
 	u16 lcol;		/* Collision Window */
@@ -220,8 +215,8 @@ struct atl1_hw {
 	u8 flash_vendor;
 
 	u8 dma_fairness;
-	u8 mac_addr[NODE_ADDRESS_SIZE];
-	u8 perm_mac_addr[NODE_ADDRESS_SIZE];
+	u8 mac_addr[ETH_ALEN];
+	u8 perm_mac_addr[ETH_ALEN];
 
 	/* bool phy_preamble_sup; */
 	bool phy_configured;
drivers/net/atl1/atl1_ethtool.c +31 -33

155 lines not on this page · raw message

drivers/net/atl1/atl1_hw.c +78 -88

464 lines not on this page · raw message

drivers/net/atl1/atl1_hw.h +11 -25
index 0450b77..41f3ca7 100644
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
  * Copyright(c) 2006 Chris Snook <[email protected]>
  * Copyright(c) 2006 Jay Cliburn <[email protected]>
@@ -23,25 +23,28 @@
  * There are a lot of defines in here that are unused and/or have cryptic 
  * names.  Please leave them alone, as they're the closest thing we have 
  * to a spec from Attansic at present. *ahem* -- CHS
- **/
+ */
 
 #ifndef _ATL1_HW_H_
 #define _ATL1_HW_H_
 
+#include <linux/types.h>
+#include <linux/mii.h>
+
 struct atl1_adapter;
 struct atl1_hw;
 
 /* function prototypes needed by multiple files */
 s32 atl1_phy_setup_autoneg_adv(struct atl1_hw *hw);
 s32 atl1_write_phy_reg(struct atl1_hw *hw, u32 reg_addr, u16 phy_data);
-s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 * speed, u16 * duplex);
+s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex);
 s32 atl1_read_mac_addr(struct atl1_hw *hw);
 s32 atl1_init_hw(struct atl1_hw *hw);
-s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 * speed, u16 * duplex);
+s32 atl1_get_speed_and_duplex(struct atl1_hw *hw, u16 *speed, u16 *duplex);
 s32 atl1_set_speed_and_duplex(struct atl1_hw *hw, u16 speed, u16 duplex);
-u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 * mc_addr);
+u32 atl1_hash_mc_addr(struct atl1_hw *hw, u8 *mc_addr);
 void atl1_hash_set(struct atl1_hw *hw, u32 hash_value);
-s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 * phy_data);
+s32 atl1_read_phy_reg(struct atl1_hw *hw, u16 reg_addr, u16 *phy_data);
 void atl1_set_mac_addr(struct atl1_hw *hw);
 s32 atl1_phy_enter_power_saving(struct atl1_hw *hw);
 s32 atl1_reset_hw(struct atl1_hw *hw);
@@ -506,29 +509,11 @@ void atl1_check_options(struct atl1_adapter *adapter);
 
 /*  MII definition */
 /* PHY Common Register */
-#define MII_BMCR					0x00
-#define MII_BMSR					0x01
-#define MII_PHYSID1					0x02
-#define MII_PHYSID2					0x03
-#define MII_ADVERTISE					0x04
-#define MII_LPA						0x05
-#define MII_EXPANSION					0x06
 #define MII_AT001_CR					0x09
 #define MII_AT001_SR					0x0A
 #define MII_AT001_ESR					0x0F
 #define MII_AT001_PSCR					0x10
 #define MII_AT001_PSSR					0x11
-#define MII_DCOUNTER					0x12
-#define MII_FCSCOUNTER					0x13
-#define MII_NWAYTEST					0x14
-#define MII_RERRCOUNTER					0x15
-#define MII_SREVISION					0x16
-#define MII_RESV1					0x17
-#define MII_LBRERROR					0x18
-#define MII_PHYADDR					0x19
-#define MII_RESV2					0x1a
-#define MII_TPISTATUS					0x1b
-#define MII_NCONFIG					0x1c
 
 /* PHY Control Register */
 #define MII_CR_SPEED_SELECT_MSB				0x0040	/* bits 6,13: 10=1000, 01=100, 00=10 */
@@ -707,7 +692,8 @@ void atl1_check_options(struct atl1_adapter *adapter);
 
 /* For checksumming , the sum of all words in the EEPROM should equal 0xBABA */
 #define EEPROM_SUM		0xBABA
-#define NODE_ADDRESS_SIZE	6
+
+#define ATL1_EEDUMP_LEN		48
 
 /* Statistics counters collected by the MAC */
 struct stats_msg_block {
drivers/net/atl1/atl1_main.c +108 -121

715 lines not on this page · raw message

drivers/net/atl1/atl1_param.c +12 -16
index caa2d83..d9aabfa 100644
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright(c) 2005 - 2006 Attansic Corporation. All rights reserved.
  * Copyright(c) 2006 Chris Snook <[email protected]>
  * Copyright(c) 2006 Jay Cliburn <[email protected]>
@@ -19,19 +19,17 @@
  * You should have received a copy of the GNU General Public License along with
  * this program; if not, write to the Free Software Foundation, Inc., 59
  * Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- **/
+ */
 
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/moduleparam.h>
 #include "atl1.h"
 
-extern char atl1_driver_name[];
-
-/**
+/*
  * This is the only thing that needs to be changed to adjust the
  * maximum number of ports that the driver can manage.
- **/
+ */
 #define ATL1_MAX_NIC 4
 
 #define OPTION_UNSET    -1
@@ -40,19 +38,19 @@ extern char atl1_driver_name[];
 
 #define ATL1_PARAM_INIT { [0 ... ATL1_MAX_NIC] = OPTION_UNSET }
 
-/**
+/*
  * Interrupt Moderate Timer in units of 2 us
  *
  * Valid Range: 10-65535
  *
  * Default Value: 100 (200us)
- **/
+ */
 static int __devinitdata int_mod_timer[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT;
 static int num_int_mod_timer = 0;
 module_param_array_named(int_mod_timer, int_mod_timer, int, &num_int_mod_timer, 0);
 MODULE_PARM_DESC(int_mod_timer, "Interrupt moderator timer");
 
-/**
+/*
  * flash_vendor
  *
  * Valid Range: 0-2
@@ -62,7 +60,7 @@ MODULE_PARM_DESC(int_mod_timer, "Interrupt moderator timer");
  * 2 - ST
  *
  * Default Value: 0
- **/
+ */
 static int __devinitdata flash_vendor[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT;
 static int num_flash_vendor = 0;
 module_param_array_named(flash_vendor, flash_vendor, int, &num_flash_vendor, 0);
@@ -149,7 +147,7 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt)
 	return -1;
 }
 
-/**
+/*
  * atl1_check_options - Range Checking for Command Line Parameters
  * @adapter: board private structure
  *
@@ -157,7 +155,7 @@ static int __devinit atl1_validate_option(int *value, struct atl1_option *opt)
  * input.  If an invalid value is given, or if no user specified
  * value exists, a default value is used.  The final value is stored
  * in a variable in the adapter structure.
- **/
+ */
 void __devinit atl1_check_options(struct atl1_adapter *adapter)
 {
 	int bd = adapter->bd_number;
@@ -182,9 +180,8 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter)
 			val = int_mod_timer[bd];
 			atl1_validate_option(&val, &opt);
 			adapter->imt = (u16) val;
-		} else {
+		} else
 			adapter->imt = (u16) (opt.def);
-		}
 	}
 
 	{			/* Flash Vendor */
@@ -203,8 +200,7 @@ void __devinit atl1_check_options(struct atl1_adapter *adapter)
 			val = flash_vendor[bd];
 			atl1_validate_option(&val, &opt);
 			adapter->hw.flash_vendor = (u8) val;
-		} else {
+		} else
 			adapter->hw.flash_vendor = (u8) (opt.def);
-		}
 	}
 }