Skip to contentSkip to conversation

chelsio: introduction

PATCH In review Francois Romieu 2 participants 9 messages Dec 11, 2006 – Dec 26, 2006

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

cover chelsio: introduction

The serie applies against netdev-2.6#upstream-linus or linux-2.6#master

Patches have been compiled. No further test.

It is available as:

git://electric-eye.fr.zoreil.com/home/romieu/linux-2.6.git#chelsio

Former 'chelsio' branch is archived as 'chelsio-20061211'.

Distance from Linus's trunk (8af905b4a403ce74b8d907b50bccc453a58834bc)
----------------------------------------------------------------------

6822b9d59faceb62a7044849cff012d6cf20ad7a
1f3d073359a4f78731fabc1ef2d9b8cc8dcff16b
e4b382e3b6df583f53bd56285ab32d25924fe653
1699093b113c327f0b8e79aeae73eba5c6b30910
e284e11a7ede38ed441c52aa51c7bf48a6623e0d
18f6e5536f6c00fe27b19745eb8577432bb6bc95
36959faf64235eb0509420b91d950279f797f58e

Diffstat
--------

 drivers/net/chelsio/common.h      |    2 
 drivers/net/chelsio/cpl5_cmd.h    |   18 ++--
 drivers/net/chelsio/cxgb2.c       |  149 ++++++++++++-------------------
 drivers/net/chelsio/elmer0.h      |   40 ++++----
 drivers/net/chelsio/espi.c        |   44 +++++----
 drivers/net/chelsio/fpga_defs.h   |    6 +
 drivers/net/chelsio/gmac.h        |   11 ++
 drivers/net/chelsio/ixf1010.c     |  100 ++++++++++++---------
 drivers/net/chelsio/mv88e1xxx.c   |   27 +++---
 drivers/net/chelsio/my3126.c      |   16 ++-
 drivers/net/chelsio/pm3393.c      |   91 +++++++++++--------
 drivers/net/chelsio/sge.c         |  178 +++++++++++++++++--------------------
 drivers/net/chelsio/subr.c        |   89 +++++++++----------
 drivers/net/chelsio/tp.c          |   62 ++++++-------
 drivers/net/chelsio/vsc7326.c     |  139 +++++++++++++++--------------
 drivers/net/chelsio/vsc7326_reg.h |  139 ++++++++++++++++-------------
 drivers/net/chelsio/vsc8244.c     |   41 ++++-----
 17 files changed, 580 insertions(+), 572 deletions(-)

Shortlog
--------

Francois Romieu:
chelsio: move return, break and continue statements on their own line
chelsio: the return statement is not a function
chelsio: spaces, tabs and friends
chelsio: useless curly braces
chelsio: useless test in cxgb2::remove_one
chelsio: misc cleanups in sge
chelsio: tabulate the update of the statistic counters

Patch
-----

See following messages.

Signature · 1 line
Ueimor
#1 lore raw

PATCH 1/7 chelsio: move return, break and continue statements on their own line

---
 drivers/net/chelsio/espi.c      |    3 ++-
 drivers/net/chelsio/ixf1010.c   |    9 ++++++---
 drivers/net/chelsio/mv88e1xxx.c |    6 ++++--
 drivers/net/chelsio/subr.c      |    6 ++++--
 drivers/net/chelsio/vsc7326.c   |    3 ++-
 drivers/net/chelsio/vsc8244.c   |    3 ++-
 6 files changed, 20 insertions(+), 10 deletions(-)
drivers/net/chelsio/espi.c +2 -1
index 4192f0f..44d2603 100644
@@ -301,7 +301,8 @@ void t1_espi_set_misc_ctrl(adapter_t *ad
 {
 	struct peespi *espi = adapter->espi;
 
-	if (!is_T2(adapter)) return;
+	if (!is_T2(adapter))
+		return;
 	spin_lock(&espi->lock);
 	espi->misc_ctrl = (val & ~MON_MASK) |
 			  (espi->misc_ctrl & MON_MASK);
drivers/net/chelsio/ixf1010.c +6 -3
index 5b8f144..91a5bf7 100644
@@ -273,7 +273,8 @@ static int mac_set_rx_mode(struct cmac *
 static int mac_set_mtu(struct cmac *mac, int mtu)
 {
 	/* MAX_FRAME_SIZE inludes header + FCS, mtu doesn't */
-	if (mtu > (MAX_FRAME_SIZE - 14 - 4)) return -EINVAL;
+	if (mtu > (MAX_FRAME_SIZE - 14 - 4))
+		return -EINVAL;
 	t1_tpi_write(mac->adapter, MACREG(mac, REG_MAX_FRAME_SIZE),
 		     mtu + 14 + 4);
 	return 0;
@@ -460,10 +461,12 @@ static struct cmac *ixf1010_mac_create(a
 	struct cmac *mac;
 	u32 val;
 
-	if (index > 9) return NULL;
+	if (index > 9)
+		return NULL;
 
 	mac = kzalloc(sizeof(*mac) + sizeof(cmac_instance), GFP_KERNEL);
-	if (!mac) return NULL;
+	if (!mac)
+		return NULL;
 
 	mac->ops = &ixf1010_ops;
 	mac->instance = (cmac_instance *)(mac + 1);
drivers/net/chelsio/mv88e1xxx.c +4 -2
index 28ac93f..75fac85 100644
@@ -308,7 +308,8 @@ static int mv88e1xxx_interrupt_handler(s
 				MV88E1XXX_INTERRUPT_STATUS_REGISTER,
 				&cause);
 		cause &= INTR_ENABLE_MASK;
-		if (!cause) break;
+		if (!cause)
+			break;
 
 		if (cause & MV88E1XXX_INTR_LINK_CHNG) {
 			(void) simple_mdio_read(cphy,
@@ -360,7 +361,8 @@ static struct cphy *mv88e1xxx_phy_create
 {
 	struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
 
-	if (!cphy) return NULL;
+	if (!cphy)
+		return NULL;
 
 	cphy_init(cphy, adapter, phy_addr, &mv88e1xxx_ops, mdio_ops);
 
drivers/net/chelsio/subr.c +4 -2
index 22ed9a3..38dbaf2 100644
@@ -612,7 +612,8 @@ #ifdef CONFIG_CHELSIO_T1_1G
                 int i, port_bit;
 		for_each_port(adapter, i) {
 			port_bit = i + 1;
-			if (!(cause & (1 << port_bit))) continue;
+			if (!(cause & (1 << port_bit)))
+				continue;
 
 	                phy = adapter->port[i].phy;
 			phy_cause = phy->ops->interrupt_handler(phy);
@@ -688,7 +689,8 @@ #ifdef CONFIG_CHELSIO_T1_COUGAR
 
 			for_each_port(adapter, i) {
 				port_bit = i ? i + 1 : 0;
-				if (!(cause & (1 << port_bit))) continue;
+				if (!(cause & (1 << port_bit)))
+					continue;
 
 				phy = adapter->port[i].phy;
 				phy_cause = phy->ops->interrupt_handler(phy);
drivers/net/chelsio/vsc7326.c +2 -1
index 85dc3b1..3355441 100644
@@ -686,7 +686,8 @@ static struct cmac *vsc7326_mac_create(a
 	int i;
 
 	mac = kzalloc(sizeof(*mac) + sizeof(cmac_instance), GFP_KERNEL);
-	if (!mac) return NULL;
+	if (!mac)
+		return NULL;
 
 	mac->ops = &vsc7326_ops;
 	mac->instance = (cmac_instance *)(mac + 1);
drivers/net/chelsio/vsc8244.c +2 -1
index c493e78..f947cf6 100644
@@ -347,7 +347,8 @@ static struct cphy* vsc8244_phy_create(a
 {
 	struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
 
-	if (!cphy) return NULL;
+	if (!cphy)
+		return NULL;
 
 	cphy_init(cphy, adapter, phy_addr, &vsc8244_ops, mdio_ops);
 
Signature · 1 line
1.4.2.3
#2 lore raw

PATCH 2/7 chelsio: the return statement is not a function

In reply to Francois Romieu
---
 drivers/net/chelsio/my3126.c  |   16 ++++++++--------
 drivers/net/chelsio/vsc7326.c |   12 ++++++------
 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/chelsio/my3126.c +8 -8
index c7731b6..3e4e57f 100644
@@ -10,25 +10,25 @@ static int my3126_reset(struct cphy *cph
 	 * This can be done through registers.  It is not required since
 	 * a full chip reset is used.
 	 */
-	return (0);
+	return 0;
 }
 
 static int my3126_interrupt_enable(struct cphy *cphy)
 {
 	schedule_delayed_work(&cphy->phy_update, HZ/30);
 	t1_tpi_read(cphy->adapter, A_ELMER0_GPO, &cphy->elmer_gpo);
-	return (0);
+	return 0;
 }
 
 static int my3126_interrupt_disable(struct cphy *cphy)
 {
 	cancel_rearming_delayed_work(&cphy->phy_update);
-	return (0);
+	return 0;
 }
 
 static int my3126_interrupt_clear(struct cphy *cphy)
 {
-	return (0);
+	return 0;
 }
 
 #define OFFSET(REG_ADDR)    (REG_ADDR << 2)
@@ -102,7 +102,7 @@ static void my3216_poll(struct work_stru
 
 static int my3126_set_loopback(struct cphy *cphy, int on)
 {
-	return (0);
+	return 0;
 }
 
 /* To check the activity LED */
@@ -146,7 +146,7 @@ static int my3126_get_link_status(struct
 	if (fc)
 		*fc = PAUSE_RX | PAUSE_TX;
 
-	return (0);
+	return 0;
 }
 
 static void my3126_destroy(struct cphy *cphy)
@@ -176,7 +176,7 @@ static struct cphy *my3126_phy_create(ad
 	INIT_DELAYED_WORK(&cphy->phy_update, my3216_poll);
 	cphy->bmsr = 0;
 
-	return (cphy);
+	return cphy;
 }
 
 /* Chip Reset */
@@ -197,7 +197,7 @@ static int my3126_phy_reset(adapter_t * 
 	val |= 0x8000;
 	t1_tpi_write(adapter, A_ELMER0_GPO, val);
 	udelay(100);
-	return (0);
+	return 0;
 }
 
 struct gphy t1_my3126_ops = {
drivers/net/chelsio/vsc7326.c +6 -6
index 3355441..8c4a31e 100644
@@ -256,7 +256,7 @@ static int bist_rd(adapter_t *adapter, i
 	else if((result & (1<<8)) != 0x0)
 		CH_ERR("bist read error: 0x%x\n", result);
 
-	return(result & 0xff);
+	return (result & 0xff);
 }
 
 static int bist_wr(adapter_t *adapter, int moduleid, int address, int value)
@@ -286,7 +286,7 @@ static int bist_wr(adapter_t *adapter, i
 	else if((result & (1<<26)) != 0x0)
 		CH_ERR("bist write error: 0x%x\n", result);
 
-	return(0);
+	return 0;
 }
 
 static int run_bist(adapter_t *adapter, int moduleid)
@@ -295,7 +295,7 @@ static int run_bist(adapter_t *adapter, 
 	(void) bist_wr(adapter,moduleid, 0x00, 0x02);
 	(void) bist_wr(adapter,moduleid, 0x01, 0x01);
 
-	return(0);
+	return 0;
 }
 
 static int check_bist(adapter_t *adapter, int moduleid)
@@ -309,14 +309,14 @@ static int check_bist(adapter_t *adapter
 	if ((result & 3) != 0x3)
 		CH_ERR("Result: 0x%x  BIST error in ram %d, column: 0x%04x\n",
 			result, moduleid, column);
-	return(0);
+	return 0;
 }
 
 static int enable_mem(adapter_t *adapter, int moduleid)
 {
 	/*enable mem*/
 	(void) bist_wr(adapter,moduleid, 0x00, 0x00);
-	return(0);
+	return 0;
 }
 
 static int run_bist_all(adapter_t *adapter)
@@ -358,7 +358,7 @@ static int run_bist_all(adapter_t *adapt
 	udelay(300);
 	vsc_write(adapter, REG_MEM_BIST, 0x0);
 	mdelay(10);
-	return(0);
+	return 0;
 }
 
 static int mac_intr_handler(struct cmac *mac)
Signature · 1 line
1.4.2.3
#3 lore raw

PATCH 3/7 chelsio: spaces, tabs and friends

In reply to Francois Romieu
---
 drivers/net/chelsio/common.h    |    2 -
 drivers/net/chelsio/cpl5_cmd.h  |   18 +++---
 drivers/net/chelsio/cxgb2.c     |   64 ++++++++++----------
 drivers/net/chelsio/elmer0.h    |   40 ++++++------
 drivers/net/chelsio/espi.c      |   41 ++++++-------
 drivers/net/chelsio/fpga_defs.h |    6 +-
 drivers/net/chelsio/gmac.h      |   11 +++
 drivers/net/chelsio/ixf1010.c   |    4 +
 drivers/net/chelsio/mv88e1xxx.c |   17 ++---
 drivers/net/chelsio/pm3393.c    |    8 +-
 drivers/net/chelsio/sge.c       |  125 ++++++++++++++++++++-------------------
 drivers/net/chelsio/subr.c      |   83 +++++++++++++-------------
 drivers/net/chelsio/tp.c        |   62 +++++++++----------
 drivers/net/chelsio/vsc7326.c   |   57 +++++++++---------
 drivers/net/chelsio/vsc8244.c   |   38 ++++++------
 15 files changed, 288 insertions(+), 288 deletions(-)
drivers/net/chelsio/common.h +1 -1
index 74758d2..787f2f2 100644
@@ -324,7 +324,7 @@ struct board_info {
 	unsigned char           mdio_phybaseaddr;
 	struct gmac            *gmac;
 	struct gphy            *gphy;
-	struct mdio_ops	       *mdio_ops;
+	struct mdio_ops        *mdio_ops;
 	const char             *desc;
 };
 
drivers/net/chelsio/cpl5_cmd.h +9 -9
index 35f565b..e36d45b 100644
@@ -103,7 +103,7 @@ enum CPL_opcode {
 	CPL_MIGRATE_C2T_RPL   = 0xDD,
 	CPL_ERROR             = 0xD7,
 
-    /* internal: driver -> TOM */
+	/* internal: driver -> TOM */
 	CPL_MSS_CHANGE        = 0xE1
 };
 
@@ -159,8 +159,8 @@ enum {                // TX_PKT_LSO ethe
 };
 
 union opcode_tid {
-    u32 opcode_tid;
-    u8 opcode;
+	u32 opcode_tid;
+	u8 opcode;
 };
 
 #define S_OPCODE 24
@@ -234,7 +234,7 @@ struct cpl_pass_accept_req {
 	u32 local_ip;
 	u32 peer_ip;
 	u32 tos_tid;
-    struct tcp_options tcp_options;
+	struct tcp_options tcp_options;
 	u8  dst_mac[6];
 	u16 vlan_tag;
 	u8  src_mac[6];
@@ -250,12 +250,12 @@ struct cpl_pass_accept_rpl {
 	u32 peer_ip;
 	u32 opt0h;
 	union {
-	u32 opt0l;
-	struct {
-	    u8 rsvd[3];
-	    u8 status;
+		u32 opt0l;
+		struct {
+		    u8 rsvd[3];
+		    u8 status;
+		};
 	};
-    };
 };
 
 struct cpl_act_open_req {
drivers/net/chelsio/cxgb2.c +32 -32

142 lines not on this page · raw message

drivers/net/chelsio/elmer0.h +20 -20
index 9ebecaa..eef655c 100644
@@ -46,14 +46,14 @@ enum {
 };
 
 /* ELMER0 registers */
-#define A_ELMER0_VERSION 0x100000
-#define A_ELMER0_PHY_CFG 0x100004
-#define A_ELMER0_INT_ENABLE 0x100008
-#define A_ELMER0_INT_CAUSE 0x10000c
-#define A_ELMER0_GPI_CFG 0x100010
-#define A_ELMER0_GPI_STAT 0x100014
-#define A_ELMER0_GPO 0x100018
-#define A_ELMER0_PORT0_MI1_CFG 0x400000
+#define A_ELMER0_VERSION	0x100000
+#define A_ELMER0_PHY_CFG	0x100004
+#define A_ELMER0_INT_ENABLE	0x100008
+#define A_ELMER0_INT_CAUSE	0x10000c
+#define A_ELMER0_GPI_CFG	0x100010
+#define A_ELMER0_GPI_STAT	0x100014
+#define A_ELMER0_GPO		0x100018
+#define A_ELMER0_PORT0_MI1_CFG	0x400000
 
 #define S_MI1_MDI_ENABLE    0
 #define V_MI1_MDI_ENABLE(x) ((x) << S_MI1_MDI_ENABLE)
@@ -111,18 +111,18 @@ #define S_MI1_OP_BUSY    31
 #define V_MI1_OP_BUSY(x) ((x) << S_MI1_OP_BUSY)
 #define F_MI1_OP_BUSY    V_MI1_OP_BUSY(1U)
 
-#define A_ELMER0_PORT1_MI1_CFG 0x500000
-#define A_ELMER0_PORT1_MI1_ADDR 0x500004
-#define A_ELMER0_PORT1_MI1_DATA 0x500008
-#define A_ELMER0_PORT1_MI1_OP 0x50000c
-#define A_ELMER0_PORT2_MI1_CFG 0x600000
-#define A_ELMER0_PORT2_MI1_ADDR 0x600004
-#define A_ELMER0_PORT2_MI1_DATA 0x600008
-#define A_ELMER0_PORT2_MI1_OP 0x60000c
-#define A_ELMER0_PORT3_MI1_CFG 0x700000
-#define A_ELMER0_PORT3_MI1_ADDR 0x700004
-#define A_ELMER0_PORT3_MI1_DATA 0x700008
-#define A_ELMER0_PORT3_MI1_OP 0x70000c
+#define A_ELMER0_PORT1_MI1_CFG	0x500000
+#define A_ELMER0_PORT1_MI1_ADDR	0x500004
+#define A_ELMER0_PORT1_MI1_DATA	0x500008
+#define A_ELMER0_PORT1_MI1_OP	0x50000c
+#define A_ELMER0_PORT2_MI1_CFG	0x600000
+#define A_ELMER0_PORT2_MI1_ADDR	0x600004
+#define A_ELMER0_PORT2_MI1_DATA	0x600008
+#define A_ELMER0_PORT2_MI1_OP	0x60000c
+#define A_ELMER0_PORT3_MI1_CFG	0x700000
+#define A_ELMER0_PORT3_MI1_ADDR	0x700004
+#define A_ELMER0_PORT3_MI1_DATA	0x700008
+#define A_ELMER0_PORT3_MI1_OP	0x70000c
 
 /* Simple bit definition for GPI and GP0 registers. */
 #define     ELMER0_GP_BIT0              0x0001
drivers/net/chelsio/espi.c +20 -21

71 lines not on this page · raw message

drivers/net/chelsio/fpga_defs.h +3 -3
index 17a3c2b..ccdb2bc 100644
@@ -98,9 +98,9 @@ #define A_MI0_DATA_EXT 0xb0c
 #define A_MI0_DATA_INT 0xb10
 
 /* GMAC registers */
-#define A_GMAC_MACID_LO 0x28
-#define A_GMAC_MACID_HI 0x2c
-#define A_GMAC_CSR 0x30
+#define A_GMAC_MACID_LO	0x28
+#define A_GMAC_MACID_HI	0x2c
+#define A_GMAC_CSR	0x30
 
 #define S_INTERFACE    0
 #define M_INTERFACE    0x3
drivers/net/chelsio/gmac.h +9 -2
index a2b8ad9..006a2eb 100644
@@ -42,8 +42,15 @@ #define _CXGB_GMAC_H_
 
 #include "common.h"
 
-enum { MAC_STATS_UPDATE_FAST, MAC_STATS_UPDATE_FULL };
-enum { MAC_DIRECTION_RX = 1, MAC_DIRECTION_TX = 2 };
+enum {
+	MAC_STATS_UPDATE_FAST,
+	MAC_STATS_UPDATE_FULL
+};
+
+enum {
+	MAC_DIRECTION_RX = 1,
+	MAC_DIRECTION_TX = 2
+};
 
 struct cmac_statistics {
 	/* Transmit */
drivers/net/chelsio/ixf1010.c +2 -2
index 91a5bf7..c40a88d 100644
@@ -358,8 +358,8 @@ static void enable_port(struct cmac *mac
 	val |= (1 << index);
 	t1_tpi_write(adapter, REG_PORT_ENABLE, val);
 
-       	index <<= 2;
-        if (is_T2(adapter)) {
+	index <<= 2;
+	if (is_T2(adapter)) {
 		/* T204: set the Fifo water level & threshold */
 		t1_tpi_write(adapter, RX_FIFO_HIGH_WATERMARK_BASE + index, 0x740);
 		t1_tpi_write(adapter, RX_FIFO_LOW_WATERMARK_BASE + index, 0x730);
drivers/net/chelsio/mv88e1xxx.c +7 -10
index 75fac85..c7c5854 100644
@@ -73,9 +73,8 @@ static int mv88e1xxx_interrupt_enable(st
 
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
 		elmer |= ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
-		    elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4;
-                }
+		if (is_T2(cphy->adapter))
+		    elmer |= ELMER0_GP_BIT2 | ELMER0_GP_BIT3 | ELMER0_GP_BIT4;
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
 	}
 	return 0;
@@ -92,9 +91,8 @@ static int mv88e1xxx_interrupt_disable(s
 
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
 		elmer &= ~ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
+		if (is_T2(cphy->adapter))
 		    elmer &= ~(ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4);
-                }
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
 	}
 	return 0;
@@ -112,9 +110,8 @@ static int mv88e1xxx_interrupt_clear(str
 	if (t1_is_asic(cphy->adapter)) {
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer);
 		elmer |= ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
+		if (is_T2(cphy->adapter))
 		    elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4;
-                }
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer);
 	}
 	return 0;
@@ -300,7 +297,7 @@ static int mv88e1xxx_interrupt_handler(s
 
 	/*
 	 * Loop until cause reads zero. Need to handle bouncing interrupts.
-         */
+	 */
 	while (1) {
 		u32 cause;
 
@@ -379,11 +376,11 @@ static struct cphy *mv88e1xxx_phy_create
 	}
 	(void) mv88e1xxx_downshift_set(cphy, 1);   /* Enable downshift */
 
-        /* LED */
+	/* LED */
 	if (is_T2(adapter)) {
 		(void) simple_mdio_write(cphy,
 				MV88E1XXX_LED_CONTROL_REGISTER, 0x1);
-        }
+	}
 
 	return cphy;
 }
drivers/net/chelsio/pm3393.c +4 -4
index 63cabeb..76a7ca9 100644
@@ -455,8 +455,8 @@ #define RMON_UPDATE(mac, name, stat_name
 static const struct cmac_statistics *pm3393_update_statistics(struct cmac *mac,
 							      int flag)
 {
-	u64	ro;
-	u32	val0, val1, val2, val3;
+	u64 ro;
+	u32 val0, val1, val2, val3;
 
 	/* Snap the counters */
 	pmwrite(mac, SUNI1x10GEXP_REG_MSTAT_CONTROL,
@@ -534,9 +534,9 @@ static int pm3393_macaddress_set(struct 
 	/* Store local copy */
 	memcpy(cmac->instance->mac_addr, ma, 6);
 
-	lo = ((u32) ma[1] << 8) | (u32) ma[0];
+	lo  = ((u32) ma[1] << 8) | (u32) ma[0];
 	mid = ((u32) ma[3] << 8) | (u32) ma[2];
-	hi = ((u32) ma[5] << 8) | (u32) ma[4];
+	hi  = ((u32) ma[5] << 8) | (u32) ma[4];
 
 	/* Disable Rx/Tx MAC before configuring it. */
 	if (enabled)
drivers/net/chelsio/sge.c +64 -61

305 lines not on this page · raw message

drivers/net/chelsio/subr.c +41 -42

184 lines not on this page · raw message

drivers/net/chelsio/tp.c +30 -32

75 lines not on this page · raw message

drivers/net/chelsio/vsc7326.c +28 -29

115 lines not on this page · raw message

drivers/net/chelsio/vsc8244.c +18 -20
index f947cf6..251d485 100644
@@ -54,7 +54,7 @@ enum {
 };
 
 #define CFG_CHG_INTR_MASK (VSC_INTR_LINK_CHG | VSC_INTR_NEG_ERR | \
-	 		   VSC_INTR_NEG_DONE)
+			   VSC_INTR_NEG_DONE)
 #define INTR_MASK (CFG_CHG_INTR_MASK | VSC_INTR_TX_FIFO | VSC_INTR_RX_FIFO | \
 		   VSC_INTR_ENABLE)
 
@@ -94,19 +94,18 @@ static int vsc8244_intr_enable(struct cp
 {
 	simple_mdio_write(cphy, VSC8244_INTR_ENABLE, INTR_MASK);
 
-    /* Enable interrupts through Elmer */
+	/* Enable interrupts through Elmer */
 	if (t1_is_asic(cphy->adapter)) {
 		u32 elmer;
 
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
 		elmer |= ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
+		if (is_T2(cphy->adapter))
 		    elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4;
-                }
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
 	}
 
-    return 0;
+	return 0;
 }
 
 static int vsc8244_intr_disable(struct cphy *cphy)
@@ -118,19 +117,18 @@ static int vsc8244_intr_disable(struct c
 
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_ENABLE, &elmer);
 		elmer &= ~ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
+		if (is_T2(cphy->adapter))
 		    elmer &= ~(ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4);
-                }
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_ENABLE, elmer);
 	}
 
-    return 0;
+	return 0;
 }
 
 static int vsc8244_intr_clear(struct cphy *cphy)
 {
 	u32 val;
-    u32 elmer;
+	u32 elmer;
 
 	/* Clear PHY interrupts by reading the register. */
 	simple_mdio_read(cphy, VSC8244_INTR_ENABLE, &val);
@@ -138,13 +136,12 @@ static int vsc8244_intr_clear(struct cph
 	if (t1_is_asic(cphy->adapter)) {
 		t1_tpi_read(cphy->adapter, A_ELMER0_INT_CAUSE, &elmer);
 		elmer |= ELMER0_GP_BIT1;
-		if (is_T2(cphy->adapter)) {
+		if (is_T2(cphy->adapter))
 		    elmer |= ELMER0_GP_BIT2|ELMER0_GP_BIT3|ELMER0_GP_BIT4;
-                }
 		t1_tpi_write(cphy->adapter, A_ELMER0_INT_CAUSE, elmer);
 	}
 
-    return 0;
+	return 0;
 }
 
 /*
@@ -179,13 +176,13 @@ static int vsc8244_set_speed_duplex(stru
 
 int t1_mdio_set_bits(struct cphy *phy, int mmd, int reg, unsigned int bits)
 {
-    int ret;
-    unsigned int val;
+	int ret;
+	unsigned int val;
 
-    ret = mdio_read(phy, mmd, reg, &val);
-    if (!ret)
-        ret = mdio_write(phy, mmd, reg, val | bits);
-    return ret;
+	ret = mdio_read(phy, mmd, reg, &val);
+	if (!ret)
+		ret = mdio_write(phy, mmd, reg, val | bits);
+	return ret;
 }
 
 static int vsc8244_autoneg_enable(struct cphy *cphy)
@@ -235,7 +232,7 @@ static int vsc8244_advertise(struct cphy
 }
 
 static int vsc8244_get_link_status(struct cphy *cphy, int *link_ok,
-				     int *speed, int *duplex, int *fc)
+				   int *speed, int *duplex, int *fc)
 {
 	unsigned int bmcr, status, lpa, adv;
 	int err, sp = -1, dplx = -1, pause = 0;
@@ -343,7 +340,8 @@ static struct cphy_ops vsc8244_ops = {
 	.get_link_status      = vsc8244_get_link_status
 };
 
-static struct cphy* vsc8244_phy_create(adapter_t *adapter, int phy_addr, struct mdio_ops *mdio_ops)
+static struct cphy* vsc8244_phy_create(adapter_t *adapter, int phy_addr,
+				       struct mdio_ops *mdio_ops)
 {
 	struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
 
Signature · 1 line
1.4.2.3
#4 lore raw

PATCH 4/7 chelsio: useless curly braces

In reply to Francois Romieu
---
 drivers/net/chelsio/cxgb2.c     |    3 +--
 drivers/net/chelsio/mv88e1xxx.c |    4 ++--
 drivers/net/chelsio/sge.c       |    3 +--
 drivers/net/chelsio/vsc7326.c   |    3 +--
 4 files changed, 5 insertions(+), 8 deletions(-)
drivers/net/chelsio/cxgb2.c +1 -2
index bb11b11..689b91c 100644
@@ -1292,9 +1292,8 @@ static int t1_clock(struct adapter *adap
 	if (!t1_is_T1B(adapter))
 		return -ENODEV;	/* Can't re-clock this chip. */
 
-	if (mode & 2) {
+	if (mode & 2)
 		return 0;	/* show current mode. */
-	}
 
 	if ((adapter->t1powersave & 1) == (mode & 1))
 		return -EALREADY;	/* ASIC already running in mode. */
drivers/net/chelsio/mv88e1xxx.c +2 -2
index c7c5854..5867e3b 100644
@@ -312,9 +312,9 @@ static int mv88e1xxx_interrupt_handler(s
 			(void) simple_mdio_read(cphy,
 				MV88E1XXX_SPECIFIC_STATUS_REGISTER, &status);
 
-			if (status & MV88E1XXX_INTR_LINK_CHNG) {
+			if (status & MV88E1XXX_INTR_LINK_CHNG)
 				cphy->state |= PHY_LINK_UP;
-			} else {
+			else {
 				cphy->state &= ~PHY_LINK_UP;
 				if (cphy->state & PHY_AUTONEG_EN)
 					cphy->state &= ~PHY_AUTONEG_RDY;
drivers/net/chelsio/sge.c +1 -2
index 6b1e857..ac7c46b 100644
@@ -2195,9 +2195,8 @@ struct sge * __devinit t1_sge_create(str
 		if (adapter->params.nports > 1) {
 			tx_sched_init(sge);
 			sge->espibug_timer.function = espibug_workaround_t204;
-		} else {
+		} else
 			sge->espibug_timer.function = espibug_workaround;
-		}
 		sge->espibug_timer.data = (unsigned long)sge->adapter;
 
 		sge->espibug_timeout = 1;
drivers/net/chelsio/vsc7326.c +1 -2
index bdd25c0..31a67f5 100644
@@ -226,9 +226,8 @@ static void run_table(adapter_t *adapter
 		if (ib[i].addr == INITBLOCK_SLEEP) {
 			udelay( ib[i].data );
 			CH_ERR("sleep %d us\n",ib[i].data);
-		} else {
+		} else
 			vsc_write( adapter, ib[i].addr, ib[i].data );
-		}
 	}
 }
 
Signature · 1 line
1.4.2.3
#5 lore raw

PATCH 5/7 chelsio: useless test in cxgb2::remove_one

In reply to Francois Romieu

pci_get_drvadata() is necessarily distinct from NULL if cxgb2::init_one succeeded. cxgb2::remove_one is solely issued through the PCI device callback.

---
 drivers/net/chelsio/cxgb2.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
drivers/net/chelsio/cxgb2.c +16 -16
index 689b91c..c3b1648 100644
@@ -1385,26 +1385,26 @@ static inline void t1_sw_reset(struct pc
 static void __devexit remove_one(struct pci_dev *pdev)
 {
 	struct net_device *dev = pci_get_drvdata(pdev);
+	struct adapter *adapter = dev->priv;
+	int i;
 
-	if (dev) {
-		int i;
-		struct adapter *adapter = dev->priv;
-
-		for_each_port(adapter, i)
-			if (test_bit(i, &adapter->registered_device_map))
-				unregister_netdev(adapter->port[i].dev);
+	for_each_port(adapter, i) {
+		if (test_bit(i, &adapter->registered_device_map))
+			unregister_netdev(adapter->port[i].dev);
+	}
 
-		t1_free_sw_modules(adapter);
-		iounmap(adapter->regs);
-		while (--i >= 0)
-			if (adapter->port[i].dev)
-				free_netdev(adapter->port[i].dev);
+	t1_free_sw_modules(adapter);
+	iounmap(adapter->regs);
 
-		pci_release_regions(pdev);
-		pci_disable_device(pdev);
-		pci_set_drvdata(pdev, NULL);
-		t1_sw_reset(pdev);
+	while (--i >= 0) {
+		if (adapter->port[i].dev)
+			free_netdev(adapter->port[i].dev);
 	}
+
+	pci_release_regions(pdev);
+	pci_disable_device(pdev);
+	pci_set_drvdata(pdev, NULL);
+	t1_sw_reset(pdev);
 }
 
 static struct pci_driver driver = {
Signature · 1 line
1.4.2.3
#6 lore raw

PATCH 6/7 chelsio: misc cleanups in sge

In reply to Francois Romieu

- duplicated code in sge::free_cmdQ_buffers ;
- NET_IP_ALIGN is already defined in (included) <linux/skbuff.h> ;
- pci_alloc_consistent() returns void * ;
- pci_alloc_consistent() returns a zeroed chunk of memory ;
- early return in restart_tx_queues.

---
 drivers/net/chelsio/sge.c |   54 ++++++++++++++++-----------------------------
 1 files changed, 19 insertions(+), 35 deletions(-)
drivers/net/chelsio/sge.c +19 -35
index ac7c46b..f94d639 100644
@@ -85,10 +85,6 @@ #define SGE_RESPQ_REPLENISH_THRES (SGE_R
  */
 #define TX_RECLAIM_PERIOD (HZ / 4)
 
-#ifndef NET_IP_ALIGN
-# define NET_IP_ALIGN 2
-#endif
-
 #define M_CMD_LEN       0x7fffffff
 #define V_CMD_LEN(v)    (v)
 #define G_CMD_LEN(v)    ((v) & M_CMD_LEN)
@@ -575,11 +571,10 @@ static int alloc_rx_resources(struct sge
 		q->size = p->freelQ_size[i];
 		q->dma_offset = sge->rx_pkt_pad ? 0 : NET_IP_ALIGN;
 		size = sizeof(struct freelQ_e) * q->size;
-		q->entries = (struct freelQ_e *)
-			      pci_alloc_consistent(pdev, size, &q->dma_addr);
+		q->entries = pci_alloc_consistent(pdev, size, &q->dma_addr);
 		if (!q->entries)
 			goto err_no_mem;
-		memset(q->entries, 0, size);
+
 		size = sizeof(struct freelQ_ce) * q->size;
 		q->centries = kzalloc(size, GFP_KERNEL);
 		if (!q->centries)
@@ -613,11 +608,10 @@ static int alloc_rx_resources(struct sge
 	sge->respQ.size = SGE_RESPQ_E_N;
 	sge->respQ.credits = 0;
 	size = sizeof(struct respQ_e) * sge->respQ.size;
-	sge->respQ.entries = (struct respQ_e *)
+	sge->respQ.entries =
 		pci_alloc_consistent(pdev, size, &sge->respQ.dma_addr);
 	if (!sge->respQ.entries)
 		goto err_no_mem;
-	memset(sge->respQ.entries, 0, size);
 	return 0;
 
 err_no_mem:
@@ -637,20 +631,12 @@ static void free_cmdQ_buffers(struct sge
 	q->in_use -= n;
 	ce = &q->centries[cidx];
 	while (n--) {
-		if (q->sop) {
-			if (likely(pci_unmap_len(ce, dma_len))) {
-				pci_unmap_single(pdev,
-						 pci_unmap_addr(ce, dma_addr),
-						 pci_unmap_len(ce, dma_len),
-						 PCI_DMA_TODEVICE);
+		if (likely(pci_unmap_len(ce, dma_len))) {
+			pci_unmap_single(pdev, pci_unmap_addr(ce, dma_addr),
+					 pci_unmap_len(ce, dma_len),
+					 PCI_DMA_TODEVICE);
+			if (q->sop)
 				q->sop = 0;
-			}
-		} else {
-			if (likely(pci_unmap_len(ce, dma_len))) {
-				pci_unmap_page(pdev, pci_unmap_addr(ce, dma_addr),
-					       pci_unmap_len(ce, dma_len),
-					       PCI_DMA_TODEVICE);
-			}
 		}
 		if (ce->skb) {
 			dev_kfree_skb_any(ce->skb);
@@ -711,11 +697,10 @@ static int alloc_tx_resources(struct sge
 		q->stop_thres = 0;
 		spin_lock_init(&q->lock);
 		size = sizeof(struct cmdQ_e) * q->size;
-		q->entries = (struct cmdQ_e *)
-			      pci_alloc_consistent(pdev, size, &q->dma_addr);
+		q->entries = pci_alloc_consistent(pdev, size, &q->dma_addr);
 		if (!q->entries)
 			goto err_no_mem;
-		memset(q->entries, 0, size);
+
 		size = sizeof(struct cmdQ_ce) * q->size;
 		q->centries = kzalloc(size, GFP_KERNEL);
 		if (!q->centries)
@@ -1447,19 +1432,18 @@ static inline int enough_free_Tx_descs(c
 static void restart_tx_queues(struct sge *sge)
 {
 	struct adapter *adap = sge->adapter;
+	int i;
 
-	if (enough_free_Tx_descs(&sge->cmdQ[0])) {
-		int i;
+	if (!enough_free_Tx_descs(&sge->cmdQ[0]))
+		return;
 
-		for_each_port(adap, i) {
-			struct net_device *nd = adap->port[i].dev;
+	for_each_port(adap, i) {
+		struct net_device *nd = adap->port[i].dev;
 
-			if (test_and_clear_bit(nd->if_port,
-					       &sge->stopped_tx_queues) &&
-			    netif_running(nd)) {
-				sge->stats.cmdQ_restarted[2]++;
-				netif_wake_queue(nd);
-			}
+		if (test_and_clear_bit(nd->if_port, &sge->stopped_tx_queues) &&
+		    netif_running(nd)) {
+			sge->stats.cmdQ_restarted[2]++;
+			netif_wake_queue(nd);
 		}
 	}
 }
Signature · 1 line
1.4.2.3
#7 lore raw

PATCH 7/7 chelsio: tabulate the update of the statistic counters

In reply to Francois Romieu

Let's try to avoid some code duplication.

- cxgb2
The data are contiguous. Use plain memcpy.

- ixf1010/pm3393/vsc7326
The cast of &mac->stats to (u64 *) is not wonderful but it is not clear if it is worth to add an ad-hoc union under the struct cmac_statistics.

vsc7326_reg.h suggests that more statistics could be available.

---
 drivers/net/chelsio/cxgb2.c       |   50 +++----------
 drivers/net/chelsio/ixf1010.c     |   87 ++++++++++++++---------
 drivers/net/chelsio/pm3393.c      |   83 +++++++++++++---------
 drivers/net/chelsio/vsc7326.c     |   68 ++++++++++--------
 drivers/net/chelsio/vsc7326_reg.h |  139 ++++++++++++++++++++-----------------
 5 files changed, 222 insertions(+), 205 deletions(-)
drivers/net/chelsio/cxgb2.c +10 -40
index c3b1648..7d0f24f 100644
@@ -454,51 +454,21 @@ static void get_stats(struct net_device 
 	const struct cmac_statistics *s;
 	const struct sge_intr_counts *t;
 	struct sge_port_stats ss;
+	unsigned int len;
 
 	s = mac->ops->statistics_update(mac, MAC_STATS_UPDATE_FULL);
 
-	*data++ = s->TxOctetsOK;
-	*data++ = s->TxOctetsBad;
-	*data++ = s->TxUnicastFramesOK;
-	*data++ = s->TxMulticastFramesOK;
-	*data++ = s->TxBroadcastFramesOK;
-	*data++ = s->TxPauseFrames;
-	*data++ = s->TxFramesWithDeferredXmissions;
-	*data++ = s->TxLateCollisions;
-	*data++ = s->TxTotalCollisions;
-	*data++ = s->TxFramesAbortedDueToXSCollisions;
-	*data++ = s->TxUnderrun;
-	*data++ = s->TxLengthErrors;
-	*data++ = s->TxInternalMACXmitError;
-	*data++ = s->TxFramesWithExcessiveDeferral;
-	*data++ = s->TxFCSErrors;
-
-	*data++ = s->RxOctetsOK;
-	*data++ = s->RxOctetsBad;
-	*data++ = s->RxUnicastFramesOK;
-	*data++ = s->RxMulticastFramesOK;
-	*data++ = s->RxBroadcastFramesOK;
-	*data++ = s->RxPauseFrames;
-	*data++ = s->RxFCSErrors;
-	*data++ = s->RxAlignErrors;
-	*data++ = s->RxSymbolErrors;
-	*data++ = s->RxDataErrors;
-	*data++ = s->RxSequenceErrors;
-	*data++ = s->RxRuntErrors;
-	*data++ = s->RxJabberErrors;
-	*data++ = s->RxInternalMACRcvError;
-	*data++ = s->RxInRangeLengthErrors;
-	*data++ = s->RxOutOfRangeLengthField;
-	*data++ = s->RxFrameTooLongErrors;
+	len = sizeof(u64)*(&s->TxFCSErrors + 1 - &s->TxOctetsOK);
+	memcpy(data, &s->TxOctetsOK, len);
+	data += len;
+
+	len = sizeof(u64)*(&s->RxFrameTooLongErrors + 1 - &s->RxOctetsOK);
+	memcpy(data, &s->RxOctetsOK, len);
+	data += len;
 
 	t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss);
-	*data++ = ss.rx_packets;
-	*data++ = ss.rx_cso_good;
-	*data++ = ss.tx_packets;
-	*data++ = ss.tx_cso;
-	*data++ = ss.tx_tso;
-	*data++ = ss.vlan_xtract;
-	*data++ = ss.vlan_insert;
+	memcpy(data, &ss, sizeof(ss));
+	data += sizeof(ss);
 
 	t = t1_sge_get_intr_counts(adapter->sge);
 	*data++ = t->rx_drops;
drivers/net/chelsio/ixf1010.c +52 -35

106 lines not on this page · raw message

drivers/net/chelsio/pm3393.c +48 -35

100 lines not on this page · raw message

drivers/net/chelsio/vsc7326.c +37 -31

77 lines not on this page · raw message

drivers/net/chelsio/vsc7326_reg.h +75 -64

148 lines not on this page · raw message

Signature · 1 line
1.4.2.3
#8 lore raw
In reply to Francois Romieu
Quoted 7 lines · Francois Romieu

The serie applies against netdev-2.6#upstream-linus or linux-2.6#master

Patches have been compiled. No further test.

It is available as:

git://electric-eye.fr.zoreil.com/home/romieu/linux-2.6.git#chelsio

Perfect pull. Pulled, thanks.

Jeff