[PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i

Previous thread: [PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi by kxie on Thursday, August 12, 2010 - 7:57 pm. (1 message)

Next thread: linux-next: Tree for August 13 by Stephen Rothwell on Thursday, August 12, 2010 - 8:13 pm. (2 messages)
From: kxie
Date: Thursday, August 12, 2010 - 7:57 pm

[PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i

From: Karen Xie <kxie@chelsio.com>

Extracted common functions to libcxgbi.

Signed-off-by: Karen Xie <kxie@chelsio.com>
---

 drivers/scsi/cxgbi/libcxgbi.c | 2658 +++++++++++++++++++++++++++++++++++++++++
 drivers/scsi/cxgbi/libcxgbi.h |  754 ++++++++++++
 2 files changed, 3412 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/libcxgbi.c
 create mode 100644 drivers/scsi/cxgbi/libcxgbi.h


diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
new file mode 100644
index 0000000..0087ff7
--- /dev/null
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -0,0 +1,2658 @@
+/*
+ * libcxgbi.c: Chelsio common library for T3/T4 iSCSI driver.
+ *
+ * Copyright (c) 2010 Chelsio Communications, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation.
+ *
+ * Written by: Karen Xie (kxie@chelsio.com)
+ * Written by: Rakesh Ranjan (rranjan@chelsio.com)
+ */
+
+#include <linux/skbuff.h>
+#include <linux/crypto.h>
+#include <linux/scatterlist.h>
+#include <linux/pci.h>
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_host.h>
+#include <linux/if_vlan.h>
+#include <linux/inet.h>
+#include <net/dst.h>
+#include <net/route.h>
+#include <linux/inetdevice.h>	/* ip_dev_find */
+#include <net/tcp.h>
+
+static unsigned int dbg_level;
+#include "libcxgbi.h"
+
+#define DRV_MODULE_NAME		"libcxgbi"
+#define DRV_MODULE_DESC		"Chelsio iSCSI driver library"
+#define DRV_MODULE_VERSION	"0.9.0"
+#define DRV_MODULE_RELDATE	"Jun. 2010"
+
+MODULE_AUTHOR("Chelsio Communications, Inc.");
+MODULE_DESCRIPTION(DRV_MODULE_DESC);
+MODULE_VERSION(DRV_MODULE_VERSION);
+MODULE_LICENSE("GPL");
+
+module_param(dbg_level, uint, 0644);
+MODULE_PARM_DESC(dbg_level, "libiscsi debug level (default=0)");
+
+#define libcxgbi_log_error	cxgbi_dbg_error
+#define ...
From: Joe Perches
Date: Thursday, August 12, 2010 - 8:21 pm

I think this double indirection isn't useful and it would
be simpler/better to use pr_<level>



--

From: Karen Xie
Date: Thursday, August 12, 2010 - 8:44 pm

Thanks,

Will use pr_xxx instead.

Karen

-----Original Message-----
From: Joe Perches [mailto:joe@perches.com] 
Sent: Thursday, August 12, 2010 8:22 PM
To: Karen Xie
Cc: linux-kernel@vger.kernel.org; linux-scsi@vger.kernel.org; open-iscsi@googlegroups.com; Rakesh Ranjan; James.Bottomley@HansenPartnership.com; michaelc@cs.wisc.edu
Subject: Re: [PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i


I think this double indirection isn't useful and it would
be simpler/better to use pr_<level>



From: Joe Perches
Date: Monday, August 16, 2010 - 9:48 am

I meant more like this:

Use #define pr_fmt(fmt) KBUILD_MODNAME ":s: " fmt, __func__
Use pr_<level>
Correct mismatches of "%lu", sizeof to "%u", sizeof
Standardize message to remove trailing ".", some had, some hadn't.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |  122 +++++++-------
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  153 +++++++++---------
 drivers/scsi/cxgbi/libcxgbi.c      |  312 ++++++++++++++++++------------------
 drivers/scsi/cxgbi/libcxgbi.h      |   31 ++---
 4 files changed, 308 insertions(+), 310 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 6e1dcd8..dc97c83 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -12,6 +12,8 @@
  *		Karen Xie (kxie@chelsio.com)
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -191,7 +193,7 @@ static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
 			V_RCV_BUFSIZ(cxgb3i_rcv_win>>10));
 
 	log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
-		"csk 0x%p,%u,0x%lx,%u, %pI4:%u-%pI4:%u, %u,%u,%u.\n",
+		"csk 0x%p,%u,0x%lx,%u, %pI4:%u-%pI4:%u, %u,%u,%u\n",
 		csk, csk->state, csk->flags, csk->atid,
 		&req->local_ip, ntohs(req->local_port),
 		&req->peer_ip, ntohs(req->peer_port),
@@ -218,7 +220,7 @@ static void send_close_req(struct cxgbi_sock *csk)
 	unsigned int tid = csk->tid;
 
 	log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
-		"csk 0x%p,%u,0x%lx,%u.\n",
+		"csk 0x%p,%u,0x%lx,%u\n",
 		csk, csk->state, csk->flags, csk->tid);
 
 	csk->cpl_close = NULL;
@@ -244,7 +246,7 @@ static void abort_arp_failure(struct t3cdev *tdev, struct sk_buff *skb)
 	struct cpl_abort_req *req = cplhdr(skb);
 
 	log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
-		"t3dev 0x%p, tid %u, skb 0x%p.\n",
+		"t3dev 0x%p, tid %u, skb 0x%p\n",
 		tdev, GET_TID(req), skb);
 ...
From: Karen Xie
Date: Monday, August 16, 2010 - 5:02 pm

Thanks, Joe.

I will update the patch with your suggestion. BTW, I probably won't use
pr_<level> just to avoid any confusion since they are already defined in
kernel.h. I know I can undef them, but rather not to.

Thanks for reviewing,
Karen

-----Original Message-----
From: open-iscsi@googlegroups.com [mailto:open-iscsi@googlegroups.com]
On Behalf Of Joe Perches
Sent: Monday, August 16, 2010 9:48 AM
To: Karen Xie
Cc: linux-kernel@vger.kernel.org; linux-scsi@vger.kernel.org;
open-iscsi@googlegroups.com; Rakesh Ranjan;
James.Bottomley@HansenPartnership.com; michaelc@cs.wisc.edu
Subject: RE: [PATCH v2 1/3] libcxgbi: common library for cxgb3i and
cxgb4i


I meant more like this:

Use #define pr_fmt(fmt) KBUILD_MODNAME ":s: " fmt, __func__
Use pr_<level>
Correct mismatches of "%lu", sizeof to "%u", sizeof
Standardize message to remove trailing ".", some had, some hadn't.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |  122 +++++++-------
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  153 +++++++++---------
 drivers/scsi/cxgbi/libcxgbi.c      |  312
++++++++++++++++++------------------
 drivers/scsi/cxgbi/libcxgbi.h      |   31 ++---
 4 files changed, 308 insertions(+), 310 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index 6e1dcd8..dc97c83 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -12,6 +12,8 @@
  *		Karen Xie (kxie@chelsio.com)
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
+
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
@@ -191,7 +193,7 @@ static void send_act_open_req(struct cxgbi_sock
*csk, struct sk_buff *skb,
 			V_RCV_BUFSIZ(cxgb3i_rcv_win>>10));
 
 	log_debug(1 << CXGBI_DBG_TOE | 1 << CXGBI_DBG_SOCK,
-		"csk 0x%p,%u,0x%lx,%u, %pI4:%u-%pI4:%u, %u,%u,%u.\n",
+		"csk 0x%p,%u,0x%lx,%u, %pI4:%u-%pI4:%u, %u,%u,%u\n",
 		csk, csk->state, csk->flags, csk->atid,
 ...
From: Joe Perches
Date: Monday, August 16, 2010 - 5:22 pm

Hi Karen.

The point is to use pr_<level> precisely because it is
defined in kernel.h and they are standard kernel functions
commonly used in the rest of the kernel source.

There's no need to undef it any more than there is to
#undef printk or use a #define printf printk

cheers, Joe

--

Previous thread: [PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi by kxie on Thursday, August 12, 2010 - 7:57 pm. (1 message)

Next thread: linux-next: Tree for August 13 by Stephen Rothwell on Thursday, August 12, 2010 - 8:13 pm. (2 messages)