Skip to contentSkip to conversation

cxgb3: Chelsio T3 1G/10G ethernet device driver

PATCH In review Divy Le Ray 4 participants 8 messages Dec 14, 2006 – Dec 16, 2006 1 message not in the archive

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

cover cxgb3: Chelsio T3 1G/10G ethernet device driver

Jeff,

I resubmit the patch supporting the latest Chelsio T3 adapter. It incorporates the last feedbacks for code cleanup. It is built gainst Linus'tree.

We think the driver is now ready to be merged.
Can you please advise on the next steps for inclusion in 2.6.20 ?

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

This driver is required by the Chelsio T3 RDMA driver which was updated on 12/10/2006.

Cheers,
Divy

#1 lore raw

Hey Jeff,

Is this driver in your queue for merging? The Chelsio T3 RDMA driver that depends on the T3 Ethernet driver is also ready to be merged.

I was just wondering if its in queue, or if there is something else we need to do.

Thanks,

Steve.

Quoted 22 lines · Divy Le Ray

Jeff,

I resubmit the patch supporting the latest Chelsio T3 adapter. It incorporates the last feedbacks for code cleanup. It is built gainst Linus'tree.

We think the driver is now ready to be merged.
Can you please advise on the next steps for inclusion in 2.6.20 ?

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

This driver is required by the Chelsio T3 RDMA driver which was updated on 12/10/2006.

Cheers,
Divy

-
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 7 lines · Steve Wise

Hey Jeff,

Is this driver in your queue for merging? The Chelsio T3 RDMA driver that depends on the T3 Ethernet driver is also ready to be merged.

I was just wondering if its in queue, or if there is something else we need to do.

I have mainly been waiting for feedback from other developers on it, and letting the driver settle down. When its being revised on a daily basis, I usually just delete the driver and wait for the next revision :)

Jeff

#3 lore raw
Quoted 6 lines · Jeff Garzik
Quoted 5 lines · Steve Wise

Hey Jeff,

Is this driver in your queue for merging? The Chelsio T3 RDMA driver that depends on the T3 Ethernet driver is also ready to be merged.

Quoted 8 lines
Quoted 2 lines

I was just wondering if its in queue, or if there is something else we need to do.

I have mainly been waiting for feedback from other developers on it, and letting the driver settle down. When its being revised on a daily basis, I usually just delete the driver and wait for the next revision :)

Jeff

Ok, fair enough.

I do believe all issues/comments have been addressed for both drivers, and the last review round only had minimal feedback. Perhaps they're ready now?

Steve.

#4 lore raw

Re: cxgb3 and 2.6.20-rc1

In reply to Divy Le Ray

Hi,

Quoted 3 lines · Divy Le Ray

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

I was unable to compile this on 2.6.20-rc1, because:

CC [M] drivers/net/cxgb3/cxgb3_offload.o
drivers/net/cxgb3/cxgb3_offload.c: In function ‘cxgb_free_mem’:
drivers/net/cxgb3/cxgb3_offload.c:1004: error: ‘PKMAP_BASE’ undeclared (first use in this function)

However, line 1004 is:

	if (p >= VMALLOC_START && p < VMALLOC_END)

and include/asm/pgtable.h:

	#ifdef CONFIG_HIGHMEM
	# define VMALLOC_END    (PKMAP_BASE-2*PAGE_SIZE)
	#else
	# define VMALLOC_END    (FIXADDR_START-2*PAGE_SIZE)
	#endif

So include/asm/pgtable.h lacks inclusion of include/asm/highmem.h, where PKMAP_BASE is defined. Adding it gives me more compile errors. Not good. Does anyone have a patch to fix that?

	-`J'
#7 lore raw

Re: [PATCH 0/10] cxgb3, p1

In reply to Divy Le Ray
Quoted 5 lines

I resubmit the patch supporting the latest Chelsio T3 adapter. It incorporates the last feedbacks for code cleanup. It is built gainst Linus'tree.

Quoted 8 lines

We think the driver is now ready to be merged.
Can you please advise on the next steps for inclusion in 2.6.20 ?

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

This driver is required by the Chelsio T3 RDMA driver which was updated on 12/10/2006.

Here are some extras that you could source (but don't require a resubmit)

---

Cleanup.
Not all unnecessary casts are gone

- (void)cmpxchg stayed to silence a warning

- some (u32) in t3_hw.c remain because it's not just an ugly cast, but also a truncation. Taking away (u32) without verifying that it is invariant with an implicit truncation is not good (and I was lazy at verifying it)

drivers/net/cxgb3/xgmac.c +4 -4
Index: linux-2.6.20-rc1/drivers/net/cxgb3/xgmac.c
===================================================================
@@ -25,7 +25,7 @@ static inline int macidx(const struct cm
 
 static void xaui_serdes_reset(struct cmac *mac)
 {
-	static unsigned int clear[] = {
+	static const unsigned int clear[] = {
 		F_PWRDN0 | F_PWRDN1, F_RESETPLL01, F_RESET0 | F_RESET1,
 		F_PWRDN2 | F_PWRDN3, F_RESETPLL23, F_RESET2 | F_RESET3
 	};
@@ -38,7 +38,7 @@ static void xaui_serdes_reset(struct cma
 		     F_RESET3 | F_RESET2 | F_RESET1 | F_RESET0 |
 		     F_PWRDN3 | F_PWRDN2 | F_PWRDN1 | F_PWRDN0 |
 		     F_RESETPLL23 | F_RESETPLL01);
-	(void)t3_read_reg(adap, ctrl);
+	t3_read_reg(adap, ctrl);
 	udelay(15);
 
 	for (i = 0; i < ARRAY_SIZE(clear); i++) {
@@ -80,7 +80,7 @@ int t3_mac_reset(struct cmac *mac)
 	unsigned int oft = mac->offset;
 
 	t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_);
-	(void)t3_read_reg(adap, A_XGM_RESET_CTRL + oft);	/* flush */
+	t3_read_reg(adap, A_XGM_RESET_CTRL + oft);	/* flush */
 
 	t3_write_regs(adap, mac_reset_avp, ARRAY_SIZE(mac_reset_avp), oft);
 	t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft,
@@ -115,7 +115,7 @@ int t3_mac_reset(struct cmac *mac)
 	else
 		val |= F_RGMII_RESET_ | F_XG2G_RESET_;
 	t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val);
-	(void)t3_read_reg(adap, A_XGM_RESET_CTRL + oft);	/* flush */
+	t3_read_reg(adap, A_XGM_RESET_CTRL + oft);	/* flush */
 	if ((val & F_PCS_RESET_) && adap->params.rev) {
 		msleep(1);
 		t3b_pcs_reset(mac);
drivers/net/cxgb3/sge.c +1 -1
Index: linux-2.6.20-rc1/drivers/net/cxgb3/sge.c
===================================================================
@@ -2160,7 +2160,7 @@ static irqreturn_t t3_intr(int irq, void
 
 	if (likely(w0 | w1)) {
 		t3_write_reg(adap, A_PL_CLI, 0);
-		(void)t3_read_reg(adap, A_PL_CLI);	/* flush */
+		t3_read_reg(adap, A_PL_CLI);	/* flush */
 
 		if (likely(w0))
 			process_responses_gts(adap, q0);
drivers/net/cxgb3/t3_hw.c +43 -42

301 lines not on this page · raw message

#<EOF>

	-`J'
#8 lore raw

Re: [PATCH 0/10] cxgb3, p2

In reply to Divy Le Ray
Quoted 3 lines

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

Stylistic stuff that was mentioned. (TYPE * a -> TYPE *a)

drivers/net/cxgb3/common.h +26 -26
Index: linux-2.6.20-rc1/drivers/net/cxgb3/common.h
===================================================================
@@ -139,10 +139,10 @@ struct cphy;
 struct adapter;
 
 struct mdio_ops {
-	int (*read) (struct adapter * adapter, int phy_addr, int mmd_addr,
-		     int reg_addr, unsigned int *val);
-	int (*write) (struct adapter * adapter, int phy_addr, int mmd_addr,
-		      int reg_addr, unsigned int val);
+	int (*read)(struct adapter *adapter, int phy_addr, int mmd_addr,
+		    int reg_addr, unsigned int *val);
+	int (*write)(struct adapter *adapter, int phy_addr, int mmd_addr,
+		     int reg_addr, unsigned int val);
 };
 
 struct adapter_info {
@@ -158,8 +158,8 @@ struct adapter_info {
 };
 
 struct port_type_info {
-	void (*phy_prep) (struct cphy * phy, struct adapter * adapter,
-			  int phy_addr, const struct mdio_ops * ops);
+	void (*phy_prep)(struct cphy *phy, struct adapter *adapter,
+			 int phy_addr, const struct mdio_ops *ops);
 	unsigned int caps;
 	const char *desc;
 };
@@ -476,23 +476,23 @@ enum {
 
 /* PHY operations */
 struct cphy_ops {
-	void (*destroy) (struct cphy * phy);
-	int (*reset) (struct cphy * phy, int wait);
+	void (*destroy)(struct cphy *phy);
+	int (*reset)(struct cphy *phy, int wait);
 
-	int (*intr_enable) (struct cphy * phy);
-	int (*intr_disable) (struct cphy * phy);
-	int (*intr_clear) (struct cphy * phy);
-	int (*intr_handler) (struct cphy * phy);
-
-	int (*autoneg_enable) (struct cphy * phy);
-	int (*autoneg_restart) (struct cphy * phy);
-
-	int (*advertise) (struct cphy * phy, unsigned int advertise_map);
-	int (*set_loopback) (struct cphy * phy, int mmd, int dir, int enable);
-	int (*set_speed_duplex) (struct cphy * phy, int speed, int duplex);
-	int (*get_link_status) (struct cphy * phy, int *link_ok, int *speed,
-				int *duplex, int *fc);
-	int (*power_down) (struct cphy * phy, int enable);
+	int (*intr_enable)(struct cphy *phy);
+	int (*intr_disable)(struct cphy *phy);
+	int (*intr_clear)(struct cphy *phy);
+	int (*intr_handler)(struct cphy *phy);
+
+	int (*autoneg_enable)(struct cphy *phy);
+	int (*autoneg_restart)(struct cphy *phy);
+
+	int (*advertise)(struct cphy *phy, unsigned int advertise_map);
+	int (*set_loopback)(struct cphy *phy, int mmd, int dir, int enable);
+	int (*set_speed_duplex)(struct cphy *phy, int speed, int duplex);
+	int (*get_link_status)(struct cphy *phy, int *link_ok, int *speed,
+			       int *duplex, int *fc);
+	int (*power_down)(struct cphy *phy, int enable);
 };
 
 /* A PHY instance */
@@ -501,10 +501,10 @@ struct cphy {
 	struct adapter *adapter;	/* associated adapter */
 	unsigned long fifo_errors;	/* FIFO over/under-flows */
 	const struct cphy_ops *ops;	/* PHY operations */
-	int (*mdio_read) (struct adapter * adapter, int phy_addr, int mmd_addr,
-			  int reg_addr, unsigned int *val);
-	int (*mdio_write) (struct adapter * adapter, int phy_addr, int mmd_addr,
-			   int reg_addr, unsigned int val);
+	int (*mdio_read)(struct adapter *adapter, int phy_addr, int mmd_addr,
+			 int reg_addr, unsigned int *val);
+	int (*mdio_write)(struct adapter *adapter, int phy_addr, int mmd_addr,
+			  int reg_addr, unsigned int val);
 };
 
 /* Convenience MDIO read/write wrappers */
drivers/net/cxgb3/cxgb3_main.c +1 -1
Index: linux-2.6.20-rc1/drivers/net/cxgb3/cxgb3_main.c
===================================================================
@@ -1479,7 +1479,7 @@ static int in_range(int val, int lo, int
 	return val < 0 || (val <= hi && val >= lo);
 }
 
-static int cxgb_extension_ioctl(struct net_device *dev, void __user * useraddr)
+static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr)
 {
 	int ret;
 	u32 cmd;
drivers/net/cxgb3/cxgb3_offload.h +5 -5
Index: linux-2.6.20-rc1/drivers/net/cxgb3/cxgb3_offload.h
===================================================================
@@ -64,16 +64,16 @@ void cxgb3_unregister_client(struct cxgb
 void cxgb3_add_clients(struct t3cdev *tdev);
 void cxgb3_remove_clients(struct t3cdev *tdev);
 
-typedef int (*cxgb3_cpl_handler_func) (struct t3cdev * dev,
-				       struct sk_buff * skb, void *ctx);
+typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
+				      struct sk_buff *skb, void *ctx);
 
 struct cxgb3_client {
 	char *name;
 	void (*add) (struct t3cdev *);
 	void (*remove) (struct t3cdev *);
 	cxgb3_cpl_handler_func *handlers;
-	int (*redirect) (void *ctx, struct dst_entry * old,
-			 struct dst_entry * new, struct l2t_entry * l2t);
+	int (*redirect)(void *ctx, struct dst_entry *old,
+			struct dst_entry *new, struct l2t_entry *l2t);
 	struct list_head client_list;
 };
 
@@ -113,7 +113,7 @@ enum {
 	CPL_RET_UNKNOWN_TID = 4	/* unexpected unknown TID */
 };
 
-typedef int (*cpl_handler_func) (struct t3cdev * dev, struct sk_buff * skb);
+typedef int (*cpl_handler_func)(struct t3cdev *dev, struct sk_buff *skb);
 
 /*
  * Returns a pointer to the first byte of the CPL header in an sk_buff that
drivers/net/cxgb3/l2t.h +2 -2
Index: linux-2.6.20-rc1/drivers/net/cxgb3/l2t.h
===================================================================
@@ -80,8 +80,8 @@ struct l2t_data {
 	struct l2t_entry l2tab[0];
 };
 
-typedef void (*arp_failure_handler_func) (struct t3cdev * dev,
-					  struct sk_buff * skb);
+typedef void (*arp_failure_handler_func)(struct t3cdev *dev,
+					 struct sk_buff *skb);
 
 /*
  * Callback stored in an skb to handle address resolution failure.
drivers/net/cxgb3/sge.c +2 -2
Index: linux-2.6.20-rc1/drivers/net/cxgb3/sge.c
===================================================================
@@ -426,7 +426,7 @@ static void recycle_rx_buf(struct adapte
  *	of the SW ring.
  */
 static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size,
-			size_t sw_size, dma_addr_t * phys, void *metadata)
+			size_t sw_size, dma_addr_t *phys, void *metadata)
 {
 	size_t len = nelem * elem_size;
 	void *s = NULL;
@@ -2263,7 +2263,7 @@ static irqreturn_t t3b_intr_napi(int irq
  *	(MSI-X, MSI, or legacy) and whether NAPI will be used to service the
  *	response queues.
  */
-intr_handler_t t3_intr_handler(struct adapter * adap, int polling)
+intr_handler_t t3_intr_handler(struct adapter *adap, int polling)
 {
 	if (adap->flags & USING_MSIX)
 		return polling ? t3_sge_intr_msix_napi : t3_sge_intr_msix;
drivers/net/cxgb3/t3_hw.c +19 -19
Index: linux-2.6.20-rc1/drivers/net/cxgb3/t3_hw.c
===================================================================
@@ -483,22 +483,22 @@ struct t3_vpd {
 	u8 id_data[16];
 	u8 vpdr_tag;
 	u8 vpdr_len[2];
-	 VPD_ENTRY(pn, 16);	/* part number */
-	 VPD_ENTRY(ec, 16);	/* EC level */
-	 VPD_ENTRY(sn, 16);	/* serial number */
-	 VPD_ENTRY(na, 12);	/* MAC address base */
-	 VPD_ENTRY(cclk, 6);	/* core clock */
-	 VPD_ENTRY(mclk, 6);	/* mem clock */
-	 VPD_ENTRY(uclk, 6);	/* uP clk */
-	 VPD_ENTRY(mdc, 6);	/* MDIO clk */
-	 VPD_ENTRY(mt, 2);	/* mem timing */
-	 VPD_ENTRY(xaui0cfg, 6);	/* XAUI0 config */
-	 VPD_ENTRY(xaui1cfg, 6);	/* XAUI1 config */
-	 VPD_ENTRY(port0, 2);	/* PHY0 complex */
-	 VPD_ENTRY(port1, 2);	/* PHY1 complex */
-	 VPD_ENTRY(port2, 2);	/* PHY2 complex */
-	 VPD_ENTRY(port3, 2);	/* PHY3 complex */
-	 VPD_ENTRY(rv, 1);	/* csum */
+	VPD_ENTRY(pn, 16);	/* part number */
+	VPD_ENTRY(ec, 16);	/* EC level */
+	VPD_ENTRY(sn, 16);	/* serial number */
+	VPD_ENTRY(na, 12);	/* MAC address base */
+	VPD_ENTRY(cclk, 6);	/* core clock */
+	VPD_ENTRY(mclk, 6);	/* mem clock */
+	VPD_ENTRY(uclk, 6);	/* uP clk */
+	VPD_ENTRY(mdc, 6);	/* MDIO clk */
+	VPD_ENTRY(mt, 2);	/* mem timing */
+	VPD_ENTRY(xaui0cfg, 6);	/* XAUI0 config */
+	VPD_ENTRY(xaui1cfg, 6);	/* XAUI1 config */
+	VPD_ENTRY(port0, 2);	/* PHY0 complex */
+	VPD_ENTRY(port1, 2);	/* PHY1 complex */
+	VPD_ENTRY(port2, 2);	/* PHY2 complex */
+	VPD_ENTRY(port3, 2);	/* PHY3 complex */
+	VPD_ENTRY(rv, 1);	/* csum */
 	u32 pad;		/* for multiple-of-4 sizing and alignment */
 };
 
@@ -611,7 +611,7 @@ static int get_vpd_params(struct adapter
 	 * Card information is normally at VPD_BASE but some early cards had
 	 * it at 0.
 	 */
-	ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *) & vpd);
+	ret = t3_seeprom_read(adapter, VPD_BASE, (u32 *)&vpd);
 	if (ret)
 		return ret;
 	addr = vpd.id_tag == 0x82 ? VPD_BASE : 0;
@@ -789,7 +789,7 @@ int t3_read_flash(struct adapter *adapte
  *	at the given address.
  */
 static int t3_write_flash(struct adapter *adapter, unsigned int addr,
-			  unsigned int n, const u8 * data)
+			  unsigned int n, const u8 *data)
 {
 	int ret;
 	u32 buf[64];
@@ -899,7 +899,7 @@ static int t3_flash_erase_sectors(struct
  *	data, followed by 4 bytes of FW version, followed by the 32-bit
  *	1's complement checksum of the whole image.
  */
-int t3_load_fw(struct adapter *adapter, const u8 * fw_data, unsigned int size)
+int t3_load_fw(struct adapter *adapter, const u8 *fw_data, unsigned int size)
 {
 	u32 csum;
 	unsigned int i;
drivers/net/cxgb3/t3cdev.h +4 -4
Index: linux-2.6.20-rc1/drivers/net/cxgb3/t3cdev.h
===================================================================
@@ -58,10 +58,10 @@ struct t3cdev {
 	struct list_head ofld_dev_list;	/* for list linking */
 	struct net_device *lldev;	/* LL dev associated with T3C messages */
 	struct proc_dir_entry *proc_dir;	/* root of proc dir for this T3C */
-	int (*send) (struct t3cdev * dev, struct sk_buff * skb);
-	int (*recv) (struct t3cdev * dev, struct sk_buff ** skb, int n);
-	int (*ctl) (struct t3cdev * dev, unsigned int req, void *data);
-	void (*neigh_update) (struct t3cdev * dev, struct neighbour * neigh);
+	int (*send)(struct t3cdev *dev, struct sk_buff *skb);
+	int (*recv)(struct t3cdev *dev, struct sk_buff **skb, int n);
+	int (*ctl)(struct t3cdev *dev, unsigned int req, void *data);
+	void (*neigh_update)(struct t3cdev *dev, struct neighbour *neigh);
 	void *priv;		/* driver private data */
 	void *l2opt;		/* optional layer 2 data */
 	void *l3opt;		/* optional layer 3 data */

#<EOF>

	-`J'
#6 lore raw

Re: cxgb3 and 2.6.20-rc1

In reply to a message not in the archive
Quoted 23 lines · Divy Le Ray
Quoted 23 lines
Quoted 3 lines

A corresponding monolithic patch is posted at the following URL:
http://service.chelsio.com/kernel.org/cxgb3.patch.bz2

I was unable to compile this on 2.6.20-rc1, because:

CC [M] drivers/net/cxgb3/cxgb3_offload.o
drivers/net/cxgb3/cxgb3_offload.c: In function ‘cxgb_free_mem’:
drivers/net/cxgb3/cxgb3_offload.c:1004: error: ‘PKMAP_BASE’ undeclared (first use in this function)

However, line 1004 is:

if (p >= VMALLOC_START && p < VMALLOC_END)

and include/asm/pgtable.h:

# ifdef CONFIG_HIGHMEM
# define VMALLOC_END    (PKMAP_BASE-2*PAGE_SIZE)
# else
# define VMALLOC_END    (FIXADDR_START-2*PAGE_SIZE)
# endif
Quoted 6 lines
Quoted 4 lines

So include/asm/pgtable.h lacks inclusion of include/asm/highmem.h, where PKMAP_BASE is defined. Adding it gives me more compile errors. Not good. Does anyone have a patch to fix that?

I've never tripped on this. I cannot reproduce it.

Enable CONFIG_HIGHMEM4G or CONFIG_HIGHMEM64G.

Quoted 3 lines

Would you mind trying this:
add #include <linux/highmem.h> in drivers/net/cxgb3/cxgb3_offload.c and see if it fixes the compilation ?

Yes 'fixes' it.
But such a change seems bogus to me. You are
using VMALLOC_END, hence you should include the .h file which contains VMALLOC_END, and nothing more. Of course there are exceptions to this (like getting at elevator.h's stuff by means of inclusion of blkdev.h)

	-`J'