[PATCH] cxgb4i: add support for t5 adapter

2013-05-29 Thread kxie
[PATCH] cxgb4i: add support for T5 adapter

From: Karen Xie k...@chelsio.com

Adds support for Chelsio T5 adapter.

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  159 +---
 1 files changed, 128 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 3fecf35..e659feb 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -20,6 +20,7 @@
 #include net/dst.h
 #include linux/netdevice.h
 
+#include t4_regs.h
 #include t4_msg.h
 #include cxgb4.h
 #include cxgb4_uld.h
@@ -32,13 +33,12 @@ static unsigned int dbg_level;
 #include ../libcxgbi.h
 
 #defineDRV_MODULE_NAME cxgb4i
-#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
-#defineDRV_MODULE_VERSION  0.9.1
-#defineDRV_MODULE_RELDATE  Aug. 2010
+#define DRV_MODULE_DESCChelsio T4/T5 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.4
 
 static char version[] =
DRV_MODULE_DESC   DRV_MODULE_NAME
-v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+v DRV_MODULE_VERSION \n;
 
 MODULE_AUTHOR(Chelsio Communications, Inc.);
 MODULE_DESCRIPTION(DRV_MODULE_DESC);
@@ -175,10 +175,56 @@ static inline int is_ofld_imm(const struct sk_buff *skb)
sizeof(struct fw_ofld_tx_data_wr));
 }
 
+
+#define VLAN_NONE 0xfff
+#define FILTER_SEL_VLAN_NONE 0x
+#define FILTER_SEL_WIDTH_P_FC (3+1) /* port uses 3 bits, FCoE one bit */
+#define FILTER_SEL_WIDTH_VIN_P_FC \
+   (6 + 7 + FILTER_SEL_WIDTH_P_FC) /* 6 bits are unused, VF uses 7 bits*/
+#define FILTER_SEL_WIDTH_TAG_P_FC \
+   (3 + FILTER_SEL_WIDTH_VIN_P_FC) /* PF uses 3 bits */
+#define FILTER_SEL_WIDTH_VLD_TAG_P_FC (1 + FILTER_SEL_WIDTH_TAG_P_FC)
+
+static unsigned int select_ntuple(struct cxgbi_device *cdev,
+   struct l2t_entry *l2t)
+{
+   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
+   unsigned int ntuple = 0;
+   u32 viid;
+
+   switch (lldi-filt_mode) {
+
+   /* default filter mode */
+   case HW_TPL_FR_MT_PR_IV_P_FC:
+   if (l2t-vlan == VLAN_NONE)
+   ntuple |= FILTER_SEL_VLAN_NONE  FILTER_SEL_WIDTH_P_FC;
+   else {
+   ntuple |= l2t-vlan  FILTER_SEL_WIDTH_P_FC;
+   ntuple |= 1  FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   }
+   ntuple |= l2t-lport  S_PORT | IPPROTO_TCP 
+ FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   break;
+   case HW_TPL_FR_MT_PR_OV_P_FC: {
+   viid = cxgb4_port_viid(l2t-neigh-dev);
+
+   ntuple |= FW_VIID_VIN_GET(viid)  FILTER_SEL_WIDTH_P_FC;
+   ntuple |= FW_VIID_PFN_GET(viid)  FILTER_SEL_WIDTH_VIN_P_FC;
+   ntuple |= FW_VIID_VIVLD_GET(viid)  FILTER_SEL_WIDTH_TAG_P_FC;
+   ntuple |= l2t-lport  S_PORT | IPPROTO_TCP 
+ FILTER_SEL_WIDTH_VLD_TAG_P_FC;
+   break;
+   }
+   default:
+   break;
+   }
+   return ntuple;
+}
+
 static void send_act_open_req(struct cxgbi_sock *csk, struct sk_buff *skb,
struct l2t_entry *e)
 {
-   struct cpl_act_open_req *req;
+   struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(csk-cdev);
int wscale = cxgbi_sock_compute_wscale(csk-mss_idx);
unsigned long long opt0;
unsigned int opt2;
@@ -195,29 +241,58 @@ static void send_act_open_req(struct cxgbi_sock *csk, 
struct sk_buff *skb,
RCV_BUFSIZ(cxgb4i_rcv_win  10);
opt2 = RX_CHANNEL(0) |
RSS_QUEUE_VALID |
-   (1  20) | (1  22) |
+   (1  20) |
RSS_QUEUE(csk-rss_qid);
 
-   set_wr_txq(skb, CPL_PRIORITY_SETUP, csk-port_id);
-   req = (struct cpl_act_open_req *)skb-head;
+   if (is_t4(lldi-adapter_type)) {
+   struct cpl_act_open_req *req =
+   (struct cpl_act_open_req *)skb-head;
 
-   INIT_TP_WR(req, 0);
-   OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
+   req = (struct cpl_act_open_req *)skb-head;
+
+   INIT_TP_WR(req, 0);
+   OPCODE_TID(req) = cpu_to_be32(MK_OPCODE_TID(CPL_ACT_OPEN_REQ,
qid_atid));
-   req-local_port = csk-saddr.sin_port;
-   req-peer_port = csk-daddr.sin_port;
-   req-local_ip = csk-saddr.sin_addr.s_addr;
-   req-peer_ip = csk-daddr.sin_addr.s_addr;
-   req-opt0 = cpu_to_be64(opt0);
-   req-params = 0;
-   req-opt2 = cpu_to_be32(opt2);
+   req-local_port = csk-saddr.sin_port;
+   req-peer_port = csk-daddr.sin_port;
+   req-local_ip = csk-saddr.sin_addr.s_addr;
+   req-peer_ip = csk-daddr.sin_addr.s_addr;
+   req-opt0 = cpu_to_be64(opt0);

[PATCH] cxgb4i: tcp push bit fix

2012-06-28 Thread kxie
[PATCH] cxgb4i: tcp push bit fix

From: Karen Xie k...@chelsio.com

Fixed the parentheses so the tcp push bit would be sent properly.

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 5a4a3bf..9bfc348 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -438,8 +438,8 @@ static inline void make_tx_data_wr(struct cxgbi_sock *csk, 
struct sk_buff *skb,
if (submode)
wr_ulp_mode = FW_OFLD_TX_DATA_WR_ULPMODE(ULP2_MODE_ISCSI) |
FW_OFLD_TX_DATA_WR_ULPSUBMODE(submode);
-   req-tunnel_to_proxy = htonl(wr_ulp_mode) |
-FW_OFLD_TX_DATA_WR_SHOVE(skb_peek(csk-write_queue) ? 0 : 1);
+   req-tunnel_to_proxy = htonl(wr_ulp_mode |
+FW_OFLD_TX_DATA_WR_SHOVE(skb_peek(csk-write_queue) ? 0 : 1));
req-plen = htonl(len);
if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT))
cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT);

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH] cxgb3i: fixed programing of the dma page sizes

2011-06-17 Thread kxie
[PATCH] cxgb3i: fixed programing of the dma page sizes

From: Karen Xie k...@chelsio.com

Fixed missing programming of the pages sizes for DMA. 

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index fc2cdb6..ffb9eea 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -1245,7 +1245,7 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev)
struct cxgbi_ddp_info *ddp = tdev-ulp_iscsi;
struct ulp_iscsi_info uinfo;
unsigned int pgsz_factor[4];
-   int err;
+   int i, err;
 
if (ddp) {
kref_get(ddp-refcnt);
@@ -1271,6 +1271,8 @@ static int cxgb3i_ddp_init(struct cxgbi_device *cdev)
 
uinfo.tagmask = ddp-idx_mask  PPOD_IDX_SHIFT;
cxgbi_ddp_page_size_factor(pgsz_factor);
+   for (i = 0; i  4; i++)
+   uinfo.pgsz_factor[i] = pgsz_factor[i];
uinfo.ulimit = uinfo.llimit + (ddp-nppods  PPOD_SIZE_SHIFT);
 
err = tdev-ctl(tdev, ULP_ISCSI_SET_PARAMS, uinfo);

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH] cxgb3i: fixed connection problem with iscsi private ip

2011-01-10 Thread kxie
[PATCH] cxgb3i: fixed connection problem with iscsi private ip

From: Karen Xie k...@chelsio.com

fixed the connection problem when the private iscsi ipv4 address is provisioned 
on the interface.

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h |   18 ++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
index 5f5e339..bed14db 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
@@ -24,10 +24,20 @@
 
 extern cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
 
-#define cxgb3i_get_private_ipv4addr(ndev) \
-   (((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr)
-#define cxgb3i_set_private_ipv4addr(ndev, addr) \
-   (((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr) = addr
+static inline unsigned int cxgb3i_get_private_ipv4addr(struct net_device *ndev)
+{
+   return ((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr;
+}
+
+static inline void cxgb3i_set_private_ipv4addr(struct net_device *ndev,
+   unsigned int addr)
+{
+   struct port_info *pi =  (struct port_info *)netdev_priv(ndev);
+
+   pi-iscsic.flags = addr ? 1 : 0;
+   pi-iscsi_ipv4addr = addr;
+   if (addr)
+   memcpy(pi-iscsic.mac_addr, ndev-dev_addr, ETH_ALEN);
+}
 
 struct cpl_iscsi_hdr_norss {
union opcode_tid ot;

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH v2] cxgb3i: fixed connection problem with iscsi private ip

2011-01-10 Thread kxie
[PATCH v2] cxgb3i: fixed connection problem with iscsi private ip

From: Karen Xie k...@chelsio.com

The last one seems to have some formatting problem. Regenerated the patch.

fixed the connection problem when the private iscsi ipv4 address is provisioned 
on the interface.

Signed-off-by: Karen Xie k...@chelsio.com
---
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
index 5f5e339..20593fd 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.h
@@ -24,10 +24,21 @@
 
 extern cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
 
-#define cxgb3i_get_private_ipv4addr(ndev) \
-   (((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr)
-#define cxgb3i_set_private_ipv4addr(ndev, addr) \
-   (((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr) = addr
+static inline unsigned int cxgb3i_get_private_ipv4addr(struct net_device *ndev)
+{
+   return ((struct port_info *)(netdev_priv(ndev)))-iscsi_ipv4addr;
+}
+
+static inline void cxgb3i_set_private_ipv4addr(struct net_device *ndev,
+   unsigned int addr)
+{
+   struct port_info *pi =  (struct port_info *)netdev_priv(ndev);
+
+   pi-iscsic.flags = addr ? 1 : 0;
+   pi-iscsi_ipv4addr = addr;
+   if (addr)
+   memcpy(pi-iscsic.mac_addr, ndev-dev_addr, ETH_ALEN);
+}
 
 struct cpl_iscsi_hdr_norss {
union opcode_tid ot;

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH] cxgb4i: ignore informational act-open-rpl message

2010-10-16 Thread kxie
[PATCH] cxgb4i: ignore informational act-open-rpl message 

From: Karen Xie k...@chelsio.com

Ignore active open reply with status negative advice. This is an informational 
message. 

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)


diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 99f2b8c..8c04fad 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -692,6 +692,9 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, 
struct sk_buff *skb)
csk-daddr.sin_addr.s_addr, ntohs(csk-daddr.sin_port),
atid, tid, status, csk, csk-state, csk-flags);
 
+   if (status == CPL_ERR_RTX_NEG_ADVICE)
+   goto rel_skb;
+
if (status  status != CPL_ERR_TCAM_FULL 
status != CPL_ERR_CONN_EXIST 
status != CPL_ERR_ARP_MISS)

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 1/4] cxgbi: renamed alloc_cpl to alloc_wr

2010-09-23 Thread kxie
[PATCH 1/4] cxgbi: renamed alloc_cpl to alloc_wr
  
From: Karen Xie k...@chelsio.com
  
This patch renamed alloc_cpl() to alloc_wr().

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |   18 +-
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |   28 ++--
 drivers/scsi/cxgbi/libcxgbi.h  |5 ++---
 3 files changed, 25 insertions(+), 26 deletions(-)


diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index a01c1e2..a2c207f 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -320,7 +320,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 
credits)
csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n,
csk, csk-state, csk-flags, csk-tid, credits, dack);
 
-   skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC);
+   skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
if (!skb) {
pr_info(csk 0x%p, credit %u, OOM.\n, csk, credits);
return 0;
@@ -572,7 +572,7 @@ static void act_open_retry_timer(unsigned long data)
 
cxgbi_sock_get(csk);
spin_lock_bh(csk-lock);
-   skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
+   skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
if (!skb)
cxgbi_sock_fail_act_open(csk, -ENOMEM);
else {
@@ -881,16 +881,16 @@ static int do_wr_ack(struct t3cdev *cdev, struct sk_buff 
*skb, void *ctx)
  */
 static int alloc_cpls(struct cxgbi_sock *csk)
 {
-   csk-cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req), 0,
+   csk-cpl_close = alloc_wr(sizeof(struct cpl_close_con_req), 0,
GFP_KERNEL);
if (!csk-cpl_close)
return -ENOMEM;
-   csk-cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req), 0,
+   csk-cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req), 0,
GFP_KERNEL);
if (!csk-cpl_abort_req)
goto free_cpl_skbs;
 
-   csk-cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl), 0,
+   csk-cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl), 0,
GFP_KERNEL);
if (!csk-cpl_abort_rpl)
goto free_cpl_skbs;
@@ -972,7 +972,7 @@ static int init_act_open(struct cxgbi_sock *csk)
cxgbi_sock_set_flag(csk, CTPF_HAS_ATID);
cxgbi_sock_get(csk);
 
-   skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
+   skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_KERNEL);
if (!skb)
goto rel_resource;
skb-sk = (struct sock *)csk;
@@ -1141,7 +1141,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, 
int idx,
ddp 0x%p, idx %d, cnt %d.\n, ddp, idx, cnt);
 
for (i = 0; i  cnt; i++) {
-   struct sk_buff *skb = alloc_cpl(sizeof(struct ulp_mem_io) +
+   struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
PPOD_SIZE, 0, gfp);
if (skb) {
ddp-gl_skb[idx + i] = skb;
@@ -1156,7 +1156,7 @@ static int ddp_alloc_gl_skb(struct cxgbi_ddp_info *ddp, 
int idx,
 static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
   unsigned int tid, int pg_idx, bool reply)
 {
-   struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0,
+   struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
GFP_KERNEL);
struct cpl_set_tcb_field *req;
u64 val = pg_idx  DDP_PGIDX_MAX ? pg_idx : 0;
@@ -1193,7 +1193,7 @@ static int ddp_setup_conn_pgidx(struct cxgbi_sock *csk,
 static int ddp_setup_conn_digest(struct cxgbi_sock *csk, unsigned int tid,
 int hcrc, int dcrc, int reply)
 {
-   struct sk_buff *skb = alloc_cpl(sizeof(struct cpl_set_tcb_field), 0,
+   struct sk_buff *skb = alloc_wr(sizeof(struct cpl_set_tcb_field), 0,
GFP_KERNEL);
struct cpl_set_tcb_field *req;
u64 val = (hcrc ? 1 : 0) | (dcrc ? 2 : 0);
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index b375a68..1056d97 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -332,7 +332,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 
credits)
csk 0x%p,%u,0x%lx,%u, credit %u.\n,
csk, csk-state, csk-flags, csk-tid, credits);
 
-   skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC);
+   skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
if (!skb) {
pr_info(csk 0x%p, credit %u, OOM.\n, csk, credits);
return 0;
@@ -388,7 +388,7 @@ static inline void send_tx_flowc_wr(struct cxgbi_sock *csk)
int 

[PATCH 2/4] libcxgbi: pdu read fixes

2010-09-23 Thread kxie
[PATCH 2/4] libcxgbi: pdu read fixes
  
From: Karen Xie k...@chelsio.com
  
This patch
- fixed the locking and releasing skb in the case of error in the pdu read 
path, and
- added define iscsi_task_cxgbi_data to access the private data inside the 
iscsi_task.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/libcxgbi.c |   79 ++---
 drivers/scsi/cxgbi/libcxgbi.h |2 +
 2 files changed, 53 insertions(+), 28 deletions(-)


diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index db9d08a..7136fb2 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -593,11 +593,11 @@ static void cxgbi_inform_iscsi_conn_closing(struct 
cxgbi_sock *csk)
csk, csk-state, csk-flags, csk-user_data);
 
if (csk-state != CTP_ESTABLISHED) {
-   read_lock(csk-callback_lock);
+   read_lock_bh(csk-callback_lock);
if (csk-user_data)
iscsi_conn_failure(csk-user_data,
ISCSI_ERR_CONN_FAILED);
-   read_unlock(csk-callback_lock);
+   read_unlock_bh(csk-callback_lock);
}
 }
 
@@ -1712,12 +1712,10 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n,
csk, conn, conn ? conn-id : 0xFF,
conn ? conn-suspend_rx : 0xFF);
-   read_unlock(csk-callback_lock);
return;
}
 
while (!err) {
-   read_lock(csk-callback_lock);
skb = skb_peek(csk-receive_queue);
if (!skb ||
!(cxgbi_skcb_test_flag(skb, SKCBF_RX_STATUS))) {
@@ -1725,11 +1723,9 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
log_debug(1  CXGBI_DBG_PDU_RX,
skb 0x%p, NOT ready 0x%lx.\n,
skb, cxgbi_skcb_flags(skb));
-   read_unlock(csk-callback_lock);
break;
}
__skb_unlink(skb, csk-receive_queue);
-   read_unlock(csk-callback_lock);
 
read += cxgbi_skcb_rx_pdulen(skb);
log_debug(1  CXGBI_DBG_PDU_RX,
@@ -1739,37 +1735,66 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
 
if (cxgbi_skcb_test_flag(skb, SKCBF_RX_COALESCED)) {
err = skb_read_pdu_bhs(conn, skb);
-   if (err  0)
-   break;
+   if (err  0) {
+   pr_err(coalesced bhs, csk 0x%p, skb 0x%p,%u, 
+   f 0x%lx, plen %u.\n,
+   csk, skb, skb-len,
+   cxgbi_skcb_flags(skb),
+   cxgbi_skcb_rx_pdulen(skb));
+   goto skb_done;
+   }
err = skb_read_pdu_data(conn, skb, skb,
err + cdev-skb_rx_extra);
+   if (err  0)
+   pr_err(coalesced data, csk 0x%p, skb 0x%p,%u, 
+   f 0x%lx, plen %u.\n,
+   csk, skb, skb-len,
+   cxgbi_skcb_flags(skb),
+   cxgbi_skcb_rx_pdulen(skb));
} else {
err = skb_read_pdu_bhs(conn, skb);
-   if (err  0)
-   break;
+   if (err  0) {
+   pr_err(bhs, csk 0x%p, skb 0x%p,%u, 
+   f 0x%lx, plen %u.\n,
+   csk, skb, skb-len,
+   cxgbi_skcb_flags(skb),
+   cxgbi_skcb_rx_pdulen(skb));
+   goto skb_done;
+   }
+
if (cxgbi_skcb_test_flag(skb, SKCBF_RX_DATA)) {
struct sk_buff *dskb;
 
-   read_lock(csk-callback_lock);
dskb = skb_peek(csk-receive_queue);
if (!dskb) {
-   read_unlock(csk-callback_lock);
-   pr_err(csk 0x%p, NO data.\n, csk);
-   err = -EAGAIN;
-   break;
+   pr_err(csk 0x%p, skb 0x%p,%u, f 0x%lx,
+plen %u, NO data.\n,
+   csk, skb, skb-len,
+

[PATCH 0/4] cxgbi: bug fixes and driver update

2010-09-23 Thread kxie
[PATCH 0/4] cxgbi: bug fixes and driver update

From: Karen Xie k...@chelsio.com

This patchset includes:
- renamed alloc_cpl() to alloc_wr(),
- fixed locking in pdu read,
- fixed cxgb3i connecting over VLAN, and
- updated cxgb4i connection setting and ddp programming.

Thanks.
Karen

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 4/4] cxgb4i: connection and ddp setting update

2010-09-23 Thread kxie
[PATCH 4/4] cxgb4i: connection and ddp setting update
  
From: Karen Xie k...@chelsio.com
  
This patch updated cxgb4i connection setting and pagepod programming.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  128 +++-
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |5 +
 drivers/scsi/cxgbi/libcxgbi.h  |   10 ---
 3 files changed, 71 insertions(+), 72 deletions(-)


diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 1056d97..99f2b8c 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -34,8 +34,8 @@ static unsigned int dbg_level;
 
 #defineDRV_MODULE_NAME cxgb4i
 #define DRV_MODULE_DESCChelsio T4 iSCSI Driver
-#defineDRV_MODULE_VERSION  0.9.0
-#defineDRV_MODULE_RELDATE  May 2010
+#defineDRV_MODULE_VERSION  0.9.1
+#defineDRV_MODULE_RELDATE  Aug. 2010
 
 static char version[] =
DRV_MODULE_DESC   DRV_MODULE_NAME
@@ -396,7 +396,7 @@ static inline void send_tx_flowc_wr(struct cxgbi_sock *csk)
htonl(FW_WR_LEN16(DIV_ROUND_UP(72, 16)) |
FW_WR_FLOWID(csk-tid));
flowc-mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
-   flowc-mnemval[0].val = htonl(0);
+   flowc-mnemval[0].val = htonl(csk-cdev-pfvf);
flowc-mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
flowc-mnemval[1].val = htonl(csk-tx_chan);
flowc-mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
@@ -568,6 +568,12 @@ static void do_act_establish(struct cxgbi_device *cdev, 
struct sk_buff *skb)
goto rel_skb;
}
 
+   if (csk-atid != atid) {
+   pr_err(bad conn atid %u, csk 0x%p,%u,0x%lx,tid %u, atid %u.\n,
+   atid, csk, csk-state, csk-flags, csk-tid, csk-atid);
+   goto rel_skb;
+   }
+
log_debug(1  CXGBI_DBG_TOE | 1  CXGBI_DBG_SOCK,
csk 0x%p,%u,0x%lx, tid %u, atid %u, rseq %u.\n,
csk, csk-state, csk-flags, tid, atid, rcv_isn);
@@ -681,9 +687,10 @@ static void do_act_open_rpl(struct cxgbi_device *cdev, 
struct sk_buff *skb)
goto rel_skb;
}
 
-   log_debug(1  CXGBI_DBG_TOE | 1  CXGBI_DBG_SOCK,
-   csk 0x%p,%u,0x%lx, status %u, atid %u, tid %u.\n,
-   csk, csk-state, csk-flags, status, atid, tid);
+   pr_info(%pI4:%u-%pI4:%u, atid %u,%u, status %u, csk 0x%p,%u,0x%lx.\n,
+   csk-saddr.sin_addr.s_addr, ntohs(csk-saddr.sin_port),
+   csk-daddr.sin_addr.s_addr, ntohs(csk-daddr.sin_port),
+   atid, tid, status, csk, csk-state, csk-flags);
 
if (status  status != CPL_ERR_TCAM_FULL 
status != CPL_ERR_CONN_EXIST 
@@ -846,7 +853,6 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, 
struct sk_buff *skb)
unsigned int tid = GET_TID(cpl);
struct cxgb4_lld_info *lldi = cxgbi_cdev_priv(cdev);
struct tid_info *t = lldi-tids;
-   struct sk_buff *lskb;
 
csk = lookup_tid(t, tid);
if (unlikely(!csk)) {
@@ -872,6 +878,8 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, 
struct sk_buff *skb)
}
 
cxgbi_skcb_tcp_seq(skb) = ntohl(cpl-seq);
+   cxgbi_skcb_flags(skb) = 0;
+
skb_reset_transport_header(skb);
__skb_pull(skb, sizeof(*cpl));
__pskb_trim(skb, ntohs(cpl-len));
@@ -884,17 +892,16 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, 
struct sk_buff *skb)
csk 0x%p,%u,0x%lx, tid %u, skb 0x%p header.\n,
csk, csk-state, csk-flags, csk-tid, skb);
csk-skb_ulp_lhdr = skb;
-   lskb = csk-skb_ulp_lhdr;
-   cxgbi_skcb_set_flag(lskb, SKCBF_RX_HDR);
+   cxgbi_skcb_set_flag(skb, SKCBF_RX_HDR);
 
-   if (cxgbi_skcb_tcp_seq(lskb) != csk-rcv_nxt) {
+   if (cxgbi_skcb_tcp_seq(skb) != csk-rcv_nxt) {
pr_info(tid %u, CPL_ISCSI_HDR, bad seq, 0x%x/0x%x.\n,
-   csk-tid, cxgbi_skcb_tcp_seq(lskb),
+   csk-tid, cxgbi_skcb_tcp_seq(skb),
csk-rcv_nxt);
goto abort_conn;
}
 
-   bhs = lskb-data;
+   bhs = skb-data;
hlen = ntohs(cpl-len);
dlen = ntohl(*(unsigned int *)(bhs + 4))  0xFF;
 
@@ -918,9 +925,9 @@ static void do_rx_iscsi_hdr(struct cxgbi_device *cdev, 
struct sk_buff *skb)
ntohl(*((unsigned int *)(bhs + 24;
 
} else {
-   lskb = csk-skb_ulp_lhdr;
-   cxgbi_skcb_set_flag(lskb, SKCBF_RX_DATA);
+   struct sk_buff *lskb = csk-skb_ulp_lhdr;
 
+   cxgbi_skcb_set_flag(lskb, SKCBF_RX_DATA);
log_debug(1  CXGBI_DBG_TOE | 1  

[PATCH] cxgbi: bug fixes and code cleanup

2010-09-21 Thread kxie
[PATCH] cxgbi: bug fixes and code cleanup

From: Karen Xie k...@chelsio.com

The patch includes the following changes.
- removed un-used code
- renamed alloc_cpl() to alloc_wr().
- fixed connecting over VLAN.
- updated cxgb4i connection setting and pagepod programming.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c |   65 ++-
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c |  126 +++-
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |5 +
 drivers/scsi/cxgbi/libcxgbi.c  |   94 +--
 drivers/scsi/cxgbi/libcxgbi.h  |   18 +
 5 files changed, 172 insertions(+), 136 deletions(-)


diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
index a01c1e2..a129a17 100644
--- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -320,7 +320,7 @@ static u32 send_rx_credits(struct cxgbi_sock *csk, u32 
credits)
csk 0x%p,%u,0x%lx,%u, credit %u, dack %u.\n,
csk, csk-state, csk-flags, csk-tid, credits, dack);
 
-   skb = alloc_cpl(sizeof(*req), 0, GFP_ATOMIC);
+   skb = alloc_wr(sizeof(*req), 0, GFP_ATOMIC);
if (!skb) {
pr_info(csk 0x%p, credit %u, OOM.\n, csk, credits);
return 0;
@@ -572,7 +572,7 @@ static void act_open_retry_timer(unsigned long data)
 
cxgbi_sock_get(csk);
spin_lock_bh(csk-lock);
-   skb = alloc_cpl(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
+   skb = alloc_wr(sizeof(struct cpl_act_open_req), 0, GFP_ATOMIC);
if (!skb)
cxgbi_sock_fail_act_open(csk, -ENOMEM);
else {
@@ -589,9 +589,10 @@ static int do_act_open_rpl(struct t3cdev *tdev, struct 
sk_buff *skb, void *ctx)
struct cxgbi_sock *csk = ctx;
struct cpl_act_open_rpl *rpl = cplhdr(skb);
 
-   log_debug(1  CXGBI_DBG_TOE | 1  CXGBI_DBG_SOCK,
-   csk 0x%p,%u,0x%lx,%u, status %u.\n,
-   csk, csk-state, csk-flags, csk-atid, rpl-status);
+   pr_info(csk 0x%p,%u,0x%lx,%u, status %u, %pI4:%u-%pI4:%u.\n,
+   csk, csk-state, csk-flags, csk-atid, rpl-status,
+   csk-saddr.sin_addr.s_addr, ntohs(csk-saddr.sin_port),
+   csk-daddr.sin_addr.s_addr, ntohs(csk-daddr.sin_port));
 
if (rpl-status != CPL_ERR_TCAM_FULL 
rpl-status != CPL_ERR_CONN_EXIST 
@@ -662,8 +663,7 @@ static int abort_status_to_errno(struct cxgbi_sock *csk, 
int abort_reason,
switch (abort_reason) {
case CPL_ERR_BAD_SYN: /* fall through */
case CPL_ERR_CONN_RESET:
-   return csk-state  CTP_ESTABLISHED ?
-   -EPIPE : -ECONNRESET;
+   return csk-state  CTP_ESTABLISHED ? -EPIPE : -ECONNRESET;
case CPL_ERR_XMIT_TIMEDOUT:
case CPL_ERR_PERSIST_TIMEDOUT:
case CPL_ERR_FINWAIT2_TIMEDOUT:
@@ -881,16 +881,16 @@ static int do_wr_ack(struct t3cdev *cdev, struct sk_buff 
*skb, void *ctx)
  */
 static int alloc_cpls(struct cxgbi_sock *csk)
 {
-   csk-cpl_close = alloc_cpl(sizeof(struct cpl_close_con_req), 0,
+   csk-cpl_close = alloc_wr(sizeof(struct cpl_close_con_req), 0,
GFP_KERNEL);
if (!csk-cpl_close)
return -ENOMEM;
-   csk-cpl_abort_req = alloc_cpl(sizeof(struct cpl_abort_req), 0,
+   csk-cpl_abort_req = alloc_wr(sizeof(struct cpl_abort_req), 0,
GFP_KERNEL);
if (!csk-cpl_abort_req)
goto free_cpl_skbs;
 
-   csk-cpl_abort_rpl = alloc_cpl(sizeof(struct cpl_abort_rpl), 0,
+   csk-cpl_abort_rpl = alloc_wr(sizeof(struct cpl_abort_rpl), 0,
GFP_KERNEL);
if (!csk-cpl_abort_rpl)
goto free_cpl_skbs;
@@ -945,17 +945,44 @@ static void release_offload_resources(struct cxgbi_sock 
*csk)
csk-cdev = NULL;
 }
 
+static void update_address(struct cxgbi_hba *chba)
+{
+   if (chba-ipv4addr) {
+   if (chba-vdev 
+   chba-ipv4addr != cxgb3i_get_private_ipv4addr(chba-vdev)) {
+   cxgb3i_set_private_ipv4addr(chba-vdev, chba-ipv4addr);
+   cxgb3i_set_private_ipv4addr(chba-ndev, 0);
+   pr_info(%s set %pI4.\n,
+   chba-vdev-name, chba-ipv4addr);
+   } else if (chba-ipv4addr !=
+   cxgb3i_get_private_ipv4addr(chba-ndev)) {
+   cxgb3i_set_private_ipv4addr(chba-ndev, chba-ipv4addr);
+   pr_info(%s set %pI4.\n,
+   chba-ndev-name, chba-ipv4addr);
+   }
+   } else if (cxgb3i_get_private_ipv4addr(chba-ndev)) {
+   if (chba-vdev)
+   cxgb3i_set_private_ipv4addr(chba-vdev, 0);
+   cxgb3i_set_private_ipv4addr(chba-ndev, 0);
+   }
+}
+
 static int 

[PATCH v5 2/3] cxgb4i v5: iscsi driver

2010-08-16 Thread kxie
[PATCH v5 2/3] cxgb4i v5: iscsi driver

From: Karen Xie k...@chelsio.com

Added cxgb4i iSCSI driver.

This patch implements the cxgb4i iscsi connection acceleration for the
open-iscsi initiator.

The cxgb4i driver offers the iscsi PDU based offload:
- digest insertion and verification   
- payload direct-placement into host memory buffer.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb4i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1600 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   38 +
 6 files changed, 1650 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a479b3b..efe66bb 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -379,6 +379,7 @@ config ISCSI_BOOT_SYSFS
  say Y. Otherwise, say N.
 
 source drivers/scsi/cxgb3i/Kconfig
+source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
 
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2703c6e..cb31f8c 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_SCSI_STEX) += stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
new file mode 100644
index 000..a470e38
--- /dev/null
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -0,0 +1 @@
+source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
new file mode 100644
index 000..9e8f604
--- /dev/null
+++ b/drivers/scsi/cxgbi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
new file mode 100644
index 000..b9f4af7
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig 
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
new file mode 100644
index 000..bb94b39
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+   tristate Chelsio T4 iSCSI support
+   depends on CHELSIO_T4_DEPENDS
+   select CHELSIO_T4
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
new file mode 100644
index 000..b375a68
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -0,0 +1,1600 @@
+/*
+ * cxgb4i.c: Chelsio 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 (k...@chelsio.com)
+ * Rakesh Ranjan (rran...@chelsio.com)
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME :%s:  fmt, __func__
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+#include net/tcp.h
+#include net/dst.h
+#include linux/netdevice.h
+
+#include t4_msg.h
+#include cxgb4.h
+#include cxgb4_uld.h
+#include t4fw_api.h
+#include l2t.h
+#include cxgb4i.h
+
+static unsigned int dbg_level;
+
+#include ../libcxgbi.h
+
+#defineDRV_MODULE_NAME cxgb4i
+#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.0
+#defineDRV_MODULE_RELDATE  May 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, Debug flag (default=0));
+
+static int cxgb4i_rcv_win = 256 * 1024;
+module_param(cxgb4i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_rcv_win, TCP reveive window in bytes);
+
+static int cxgb4i_snd_win = 128 * 1024;

[PATCH v2 0/3] cxgbi iscsi driver

2010-08-13 Thread kxie
[PATCH v2 0/3] cxgbi iscsi driver

From: Karen Xie k...@chelsio.com

Re-submission, missed netdev list last time.

This patchset includes:

1. added libcxgbi as the common library for both cxgb4i and cxgb3i driver
2. added cxgb4i iscsi initiator v5.
3. changed cxgb3i to use libcxgbi.

The version 2 includes the following changes:
- Made dbg_level static to avoid compiling errors when both cxgb3i and cxgb4i
  are built into the kernel.
- Deleted cxgbi_fill_iscsi_transport() and cxgbi_fill_scsi_host_template().
  The iscsi_transport and scsi_host_template are initialized in the drivers
  instead of being filled in by the library at runtime..
- Only register with iscsi class transport once per driver type. 

Thanks.
Karen

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi

2010-08-13 Thread kxie
[PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi

From: Karen Xie k...@chelsio.com

Changed cxgb3i to make use of libcxgbi.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |2 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb3i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb3i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1454 
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h |   51 +
 8 files changed, 1518 insertions(+), 2 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index efe66bb..0c85653 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -378,7 +378,6 @@ config ISCSI_BOOT_SYSFS
  via sysfs to userspace. If you wish to export this information,
  say Y. Otherwise, say N.
 
-source drivers/scsi/cxgb3i/Kconfig
 source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index cb31f8c..2e9a87e 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -133,7 +133,7 @@ obj-$(CONFIG_SCSI_HPTIOP)   += hptiop.o
 obj-$(CONFIG_SCSI_STEX)+= stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
-obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
index a470e38..17eb5d5 100644
--- a/drivers/scsi/cxgbi/Kconfig
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -1 +1,2 @@
+source drivers/scsi/cxgbi/cxgb3i/Kconfig
 source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
index 9e8f604..86007e3 100644
--- a/drivers/scsi/cxgbi/Makefile
+++ b/drivers/scsi/cxgbi/Makefile
@@ -1 +1,2 @@
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libcxgbi.o cxgb3i/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kbuild b/drivers/scsi/cxgbi/cxgb3i/Kbuild
new file mode 100644
index 000..09dbf9e
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb3
+
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kconfig 
b/drivers/scsi/cxgbi/cxgb3i/Kconfig
new file mode 100644
index 000..5cf4e98
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB3_ISCSI
+   tristate Chelsio T3 iSCSI support
+   depends on CHELSIO_T3_DEPENDS
+   select CHELSIO_T3
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T3 devices.
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
new file mode 100644
index 000..6cd9bd6
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -0,0 +1,1454 @@
+/*
+ * cxgb3i.c: Chelsio S3xx iscsi offload driver
+ *
+ * Copyright (C) 2003-2008 Chelsio Communications.  All rights reserved.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
+ * release for licensing terms and conditions.
+ *
+ * Written by: Dimitris Michailidis (d...@chelsio.com)
+ * Karen Xie (k...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+
+#include common.h
+#include t3_cpl.h
+#include t3cdev.h
+#include cxgb3_defs.h
+#include cxgb3_ctl_defs.h
+#include cxgb3_offload.h
+#include firmware_exports.h
+#include cxgb3i.h
+
+static unsigned int dbg_level;
+#include ../libcxgbi.h
+
+#define DRV_MODULE_NAME cxgb3i
+#define DRV_MODULE_DESC Chelsio T3 iSCSI Driver
+#define DRV_MODULE_VERSION 2.0.0
+#define DRV_MODULE_RELDATE Jun. 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, debug flag (default=0));
+
+static int cxgb3i_rcv_win = 256 * 1024;
+module_param(cxgb3i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb3i_rcv_win, TCP receive window in bytes 

[PATCH v2 2/3] cxgb4i v5: iscsi driver

2010-08-13 Thread kxie
[PATCH v2 2/3] cxgb4i v5: iscsi driver

From: Karen Xie k...@chelsio.com

Added cxgb4i iSCSI driver.  

This patch implements the cxgb4i iscsi connection acceleration for the
open-iscsi initiator.

The cxgb4i driver offers the iscsi PDU based offload:
- digest insertion and verification   
- payload direct-placement into host memory buffer.
 
Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |1 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb4i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1622 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   38 +
 8 files changed, 1674 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a479b3b..efe66bb 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -379,6 +379,7 @@ config ISCSI_BOOT_SYSFS
  say Y. Otherwise, say N.
 
 source drivers/scsi/cxgb3i/Kconfig
+source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
 
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2703c6e..cb31f8c 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_SCSI_STEX) += stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
new file mode 100644
index 000..a470e38
--- /dev/null
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -0,0 +1 @@
+source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
new file mode 100644
index 000..9e8f604
--- /dev/null
+++ b/drivers/scsi/cxgbi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
new file mode 100644
index 000..b9f4af7
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig 
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
new file mode 100644
index 000..bb94b39
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+   tristate Chelsio T4 iSCSI support
+   depends on CHELSIO_T4_DEPENDS
+   select CHELSIO_T4
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
new file mode 100644
index 000..b97ff13
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -0,0 +1,1622 @@
+/*
+ * cxgb4i.c: Chelsio 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 (k...@chelsio.com)
+ * Rakesh Ranjan (rran...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+#include net/tcp.h
+#include net/dst.h
+#include linux/netdevice.h
+
+#include t4_msg.h
+#include cxgb4.h
+#include cxgb4_uld.h
+#include t4fw_api.h
+#include l2t.h
+#include cxgb4i.h
+
+static unsigned int dbg_level;
+#include ../libcxgbi.h
+
+#defineDRV_MODULE_NAME cxgb4i
+#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.0
+#defineDRV_MODULE_RELDATE  May 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, Debug flag (default=0));
+
+static int cxgb4i_rcv_win = 256 * 1024;
+module_param(cxgb4i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_rcv_win, TCP reveive window in bytes);
+
+static int cxgb4i_snd_win = 128 * 

[PATCH v3 2/3] cxgb4i v5: iscsi driver

2010-08-13 Thread kxie
[PATCH v3 3/3] cxgb3i: change cxgb3i to use libcxgbi

From: Karen Xie k...@chelsio.com

Changed cxgb3i to make use of libcxgbi.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |1 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb4i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1599 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   38 +
 6 files changed, 1649 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a479b3b..efe66bb 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -379,6 +379,7 @@ config ISCSI_BOOT_SYSFS
  say Y. Otherwise, say N.
 
 source drivers/scsi/cxgb3i/Kconfig
+source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
 
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2703c6e..cb31f8c 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_SCSI_STEX) += stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
new file mode 100644
index 000..a470e38
--- /dev/null
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -0,0 +1 @@
+source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
new file mode 100644
index 000..9e8f604
--- /dev/null
+++ b/drivers/scsi/cxgbi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
new file mode 100644
index 000..b9f4af7
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig 
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
new file mode 100644
index 000..bb94b39
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+   tristate Chelsio T4 iSCSI support
+   depends on CHELSIO_T4_DEPENDS
+   select CHELSIO_T4
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
new file mode 100644
index 000..9b119e4
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -0,0 +1,1599 @@
+/*
+ * cxgb4i.c: Chelsio 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 (k...@chelsio.com)
+ * Rakesh Ranjan (rran...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+#include net/tcp.h
+#include net/dst.h
+#include linux/netdevice.h
+
+#include t4_msg.h
+#include cxgb4.h
+#include cxgb4_uld.h
+#include t4fw_api.h
+#include l2t.h
+#include cxgb4i.h
+
+#define pr_prefix cxgb4i: 
+static unsigned int dbg_level;
+
+#include ../libcxgbi.h
+
+#defineDRV_MODULE_NAME cxgb4i
+#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.0
+#defineDRV_MODULE_RELDATE  May 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, Debug flag (default=0));
+
+static int cxgb4i_rcv_win = 256 * 1024;
+module_param(cxgb4i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_rcv_win, TCP reveive window in bytes);
+
+static int cxgb4i_snd_win = 128 * 1024;
+module_param(cxgb4i_snd_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_snd_win, TCP send window in bytes);
+
+static int cxgb4i_rx_credit_thres = 10 * 1024;

[PATCH v4 0/3] cxgbi iscsi driver

2010-08-13 Thread kxie
[PATCH v4 0/3] cxgbi iscsi driver

From: Karen Xie k...@chelsio.com

This patchset includes:

1. added libcxgbi as the common library for both cxgb4i and cxgb3i driver
2. added cxgb4i iscsi initiator v5.
3. changed cxgb3i to use libcxgbi.

Version 4 changes:
- removed directory drivers/scsi/cxgb3i. The updated cxgb3i driver is under
  drivers/scsi/cxgbi/cxgb3i.

Version 3 changes:
- re-worked defines of xxx_log_error/warn/info/debug to get rid of double
  indirection. 

Version 2 changes:
- Made dbg_level static to avoid compiling errors when both cxgb3i and cxgb4i
  are built into the kernel.
- Deleted cxgbi_fill_iscsi_transport() and cxgbi_fill_scsi_host_template().
  The iscsi_transport and scsi_host_template are initialized in the drivers
  instead of being filled in by the library at runtime..
- Only register with iscsi class transport once per driver type. 

Thanks.
Karen

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH v4 2/3] cxgb4i v5: iscsi driver

2010-08-13 Thread kxie
[PATCH v4 2/3] cxgb4i v5: iscsi driver

From: Karen Xie k...@chelsio.com

Added cxgb4i iSCSI driver.

This patch implements the cxgb4i iscsi connection acceleration for the
open-iscsi initiator.

The cxgb4i driver offers the iscsi PDU based offload:
- digest insertion and verification   
- payload direct-placement into host memory buffer.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |1 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb4i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1599 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   38 +
 6 files changed, 1649 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a479b3b..efe66bb 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -379,6 +379,7 @@ config ISCSI_BOOT_SYSFS
  say Y. Otherwise, say N.
 
 source drivers/scsi/cxgb3i/Kconfig
+source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
 
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2703c6e..cb31f8c 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_SCSI_STEX) += stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
new file mode 100644
index 000..a470e38
--- /dev/null
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -0,0 +1 @@
+source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
new file mode 100644
index 000..9e8f604
--- /dev/null
+++ b/drivers/scsi/cxgbi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
new file mode 100644
index 000..b9f4af7
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig 
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
new file mode 100644
index 000..bb94b39
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+   tristate Chelsio T4 iSCSI support
+   depends on CHELSIO_T4_DEPENDS
+   select CHELSIO_T4
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
new file mode 100644
index 000..9b119e4
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -0,0 +1,1599 @@
+/*
+ * cxgb4i.c: Chelsio 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 (k...@chelsio.com)
+ * Rakesh Ranjan (rran...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+#include net/tcp.h
+#include net/dst.h
+#include linux/netdevice.h
+
+#include t4_msg.h
+#include cxgb4.h
+#include cxgb4_uld.h
+#include t4fw_api.h
+#include l2t.h
+#include cxgb4i.h
+
+#define pr_prefix cxgb4i: 
+static unsigned int dbg_level;
+
+#include ../libcxgbi.h
+
+#defineDRV_MODULE_NAME cxgb4i
+#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.0
+#defineDRV_MODULE_RELDATE  May 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, Debug flag (default=0));
+
+static int cxgb4i_rcv_win = 256 * 1024;
+module_param(cxgb4i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_rcv_win, TCP reveive window in bytes);
+
+static 

[PATCH v2 0/3] cxgbi iscsi driver

2010-08-12 Thread kxie
[PATCH v2 0/3] cxgbi iscsi driver

From: Karen Xie k...@chelsio.com

This patchset includes:

1. added libcxgbi as the common library for both cxgb4i and cxgb3i driver
2. added cxgb4i iscsi initiator v5.
3. changed cxgb3i to use libcxgbi.

The version 2 includes the following changes:
- Made dbg_level static to avoid compiling errors when both cxgb3i and cxgb4i
  are built into the kernel.
- Deleted cxgbi_fill_iscsi_transport() and cxgbi_fill_scsi_host_template().
  The iscsi_transport and scsi_host_template are initialized in the drivers
  instead of being filled in by the library at runtime..
- Only register with iscsi class transport once per driver type. 

Thanks.
Karen

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH v2 2/3] cxgb4i v5: iscsi driver

2010-08-12 Thread kxie
[PATCH v2 2/3] cxgb4i v5: iscsi driver

From: Karen Xie k...@chelsio.com

Added cxgb4i iSCSI driver.  

This patch implements the cxgb4i iscsi connection acceleration for the
open-iscsi initiator.

The cxgb4i driver offers the iscsi PDU based offload:
- digest insertion and verification   
- payload direct-placement into host memory buffer.
 
Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |1 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb4i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb4i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1622 
 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h |   38 +
 8 files changed, 1674 insertions(+), 0 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/Kconfig
 create mode 100644 drivers/scsi/cxgbi/Makefile
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb4i/cxgb4i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a479b3b..efe66bb 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -379,6 +379,7 @@ config ISCSI_BOOT_SYSFS
  say Y. Otherwise, say N.
 
 source drivers/scsi/cxgb3i/Kconfig
+source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
 
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 2703c6e..cb31f8c 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -134,6 +134,7 @@ obj-$(CONFIG_SCSI_STEX) += stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
 obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
 obj-$(CONFIG_SCSI_PMCRAID) += pmcraid.o
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
new file mode 100644
index 000..a470e38
--- /dev/null
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -0,0 +1 @@
+source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
new file mode 100644
index 000..9e8f604
--- /dev/null
+++ b/drivers/scsi/cxgbi/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kbuild b/drivers/scsi/cxgbi/cxgb4i/Kbuild
new file mode 100644
index 000..b9f4af7
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb4
+
+obj-$(CONFIG_SCSI_CXGB4_ISCSI) += cxgb4i.o
diff --git a/drivers/scsi/cxgbi/cxgb4i/Kconfig 
b/drivers/scsi/cxgbi/cxgb4i/Kconfig
new file mode 100644
index 000..bb94b39
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB4_ISCSI
+   tristate Chelsio T4 iSCSI support
+   depends on CHELSIO_T4_DEPENDS
+   select CHELSIO_T4
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T4 devices.
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c 
b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
new file mode 100644
index 000..b97ff13
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -0,0 +1,1622 @@
+/*
+ * cxgb4i.c: Chelsio 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 (k...@chelsio.com)
+ * Rakesh Ranjan (rran...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+#include net/tcp.h
+#include net/dst.h
+#include linux/netdevice.h
+
+#include t4_msg.h
+#include cxgb4.h
+#include cxgb4_uld.h
+#include t4fw_api.h
+#include l2t.h
+#include cxgb4i.h
+
+static unsigned int dbg_level;
+#include ../libcxgbi.h
+
+#defineDRV_MODULE_NAME cxgb4i
+#define DRV_MODULE_DESCChelsio T4 iSCSI Driver
+#defineDRV_MODULE_VERSION  0.9.0
+#defineDRV_MODULE_RELDATE  May 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, Debug flag (default=0));
+
+static int cxgb4i_rcv_win = 256 * 1024;
+module_param(cxgb4i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb4i_rcv_win, TCP reveive window in bytes);
+
+static int cxgb4i_snd_win = 128 * 

[PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi

2010-08-12 Thread kxie
[PATCH v2 3/3] cxgb3i: change cxgb3i to use libcxgbi

From: Karen Xie k...@chelsio.com

Changed cxgb3i to make use of libcxgbi.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/Kconfig   |1 
 drivers/scsi/Makefile  |2 
 drivers/scsi/cxgbi/Kconfig |1 
 drivers/scsi/cxgbi/Makefile|1 
 drivers/scsi/cxgbi/cxgb3i/Kbuild   |3 
 drivers/scsi/cxgbi/cxgb3i/Kconfig  |7 
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 1454 
 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h |   51 +
 8 files changed, 1518 insertions(+), 2 deletions(-)
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/Kbuild
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/Kconfig
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
 create mode 100644 drivers/scsi/cxgbi/cxgb3i/cxgb3i.h


diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index efe66bb..0c85653 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -378,7 +378,6 @@ config ISCSI_BOOT_SYSFS
  via sysfs to userspace. If you wish to export this information,
  say Y. Otherwise, say N.
 
-source drivers/scsi/cxgb3i/Kconfig
 source drivers/scsi/cxgbi/Kconfig
 source drivers/scsi/bnx2i/Kconfig
 source drivers/scsi/be2iscsi/Kconfig
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index cb31f8c..2e9a87e 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -133,7 +133,7 @@ obj-$(CONFIG_SCSI_HPTIOP)   += hptiop.o
 obj-$(CONFIG_SCSI_STEX)+= stex.o
 obj-$(CONFIG_SCSI_MVSAS)   += mvsas/
 obj-$(CONFIG_PS3_ROM)  += ps3rom.o
-obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgb3i/
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libiscsi.o libiscsi_tcp.o cxgbi/
 obj-$(CONFIG_SCSI_BNX2_ISCSI)  += libiscsi.o bnx2i/
 obj-$(CONFIG_BE2ISCSI) += libiscsi.o be2iscsi/
diff --git a/drivers/scsi/cxgbi/Kconfig b/drivers/scsi/cxgbi/Kconfig
index a470e38..17eb5d5 100644
--- a/drivers/scsi/cxgbi/Kconfig
+++ b/drivers/scsi/cxgbi/Kconfig
@@ -1 +1,2 @@
+source drivers/scsi/cxgbi/cxgb3i/Kconfig
 source drivers/scsi/cxgbi/cxgb4i/Kconfig
diff --git a/drivers/scsi/cxgbi/Makefile b/drivers/scsi/cxgbi/Makefile
index 9e8f604..86007e3 100644
--- a/drivers/scsi/cxgbi/Makefile
+++ b/drivers/scsi/cxgbi/Makefile
@@ -1 +1,2 @@
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += libcxgbi.o cxgb3i/
 obj-$(CONFIG_SCSI_CXGB4_ISCSI) += libcxgbi.o cxgb4i/
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kbuild b/drivers/scsi/cxgbi/cxgb3i/Kbuild
new file mode 100644
index 000..09dbf9e
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/Kbuild
@@ -0,0 +1,3 @@
+EXTRA_CFLAGS += -I$(srctree)/drivers/net/cxgb3
+
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
diff --git a/drivers/scsi/cxgbi/cxgb3i/Kconfig 
b/drivers/scsi/cxgbi/cxgb3i/Kconfig
new file mode 100644
index 000..5cf4e98
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/Kconfig
@@ -0,0 +1,7 @@
+config SCSI_CXGB3_ISCSI
+   tristate Chelsio T3 iSCSI support
+   depends on CHELSIO_T3_DEPENDS
+   select CHELSIO_T3
+   select SCSI_ISCSI_ATTRS
+   ---help---
+ This driver supports iSCSI offload for the Chelsio T3 devices.
diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c 
b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
new file mode 100644
index 000..6cd9bd6
--- /dev/null
+++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
@@ -0,0 +1,1454 @@
+/*
+ * cxgb3i.c: Chelsio S3xx iscsi offload driver
+ *
+ * Copyright (C) 2003-2008 Chelsio Communications.  All rights reserved.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the LICENSE file included in this
+ * release for licensing terms and conditions.
+ *
+ * Written by: Dimitris Michailidis (d...@chelsio.com)
+ * Karen Xie (k...@chelsio.com)
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/moduleparam.h
+#include scsi/scsi_host.h
+
+#include common.h
+#include t3_cpl.h
+#include t3cdev.h
+#include cxgb3_defs.h
+#include cxgb3_ctl_defs.h
+#include cxgb3_offload.h
+#include firmware_exports.h
+#include cxgb3i.h
+
+static unsigned int dbg_level;
+#include ../libcxgbi.h
+
+#define DRV_MODULE_NAME cxgb3i
+#define DRV_MODULE_DESC Chelsio T3 iSCSI Driver
+#define DRV_MODULE_VERSION 2.0.0
+#define DRV_MODULE_RELDATE Jun. 2010
+
+static char version[] =
+   DRV_MODULE_DESC   DRV_MODULE_NAME
+v DRV_MODULE_VERSION  ( DRV_MODULE_RELDATE )\n;
+
+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, debug flag (default=0));
+
+static int cxgb3i_rcv_win = 256 * 1024;
+module_param(cxgb3i_rcv_win, int, 0644);
+MODULE_PARM_DESC(cxgb3i_rcv_win, TCP receive window in bytes 

[PATCH 0/3] cxgbi iscsi driver

2010-08-09 Thread kxie
[PATCH 0/3] cxgbi iscsi driver

From: Karen Xie k...@chelsio.com

This patchset includes:

1. added libcxgbi as the common library for both cxgb4i and cxgb3i driver

2. added cxgb4i iscsi initiator v5.

   This updated cxgb4i version incorporates the comments from Mike to
   identify more common functions to be moved to the libcxgbi.

   The cxgb4i driver provides iscsi acceleration (PDU offload and payload data
   direct placement) to the open-iscsi initiator. It accesses the hardware
   through the cxgb4 module.

3. changed cxgb3i to use libcxgbi.

Thanks.
Karen

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH] cxgb3i: zero out reserved or un-used cpl message fields

2010-06-16 Thread kxie
[PATCH] cxgb3i: zero out reserved or un-used fields.

From: Karen Xie k...@chelsio.com

Zero out the reserved or un-used CPL message fields to prevent any garbage
value.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |2 ++
 drivers/scsi/cxgb3i/cxgb3i_offload.c |5 +
 2 files changed, 7 insertions(+), 0 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index b58d913..be0e230 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -499,6 +499,7 @@ static int setup_conn_pgidx(struct t3cdev *tdev, unsigned 
int tid, int pg_idx,
/* set up ulp submode and page size */
req = (struct cpl_set_tcb_field *)skb_put(skb, sizeof(*req));
req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   req-wr.wr_lo = 0;
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
req-reply = V_NO_REPLY(reply ? 0 : 1);
req-cpu_idx = 0;
@@ -564,6 +565,7 @@ int cxgb3i_setup_conn_digest(struct t3cdev *tdev, unsigned 
int tid,
/* set up ulp submode and page size */
req = (struct cpl_set_tcb_field *)skb_put(skb, sizeof(*req));
req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   req-wr.wr_lo = 0;
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, tid));
req-reply = V_NO_REPLY(reply ? 0 : 1);
req-cpu_idx = 0;
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index a175be9..246a6c2 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -264,6 +264,7 @@ static void make_act_open_req(struct s3_conn *c3cn, struct 
sk_buff *skb,
skb-priority = CPL_PRIORITY_SETUP;
req = (struct cpl_act_open_req *)__skb_put(skb, sizeof(*req));
req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   req-wr.wr_lo = 0;
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, atid));
req-local_port = c3cn-saddr.sin_port;
req-peer_port = c3cn-daddr.sin_port;
@@ -273,6 +274,7 @@ static void make_act_open_req(struct s3_conn *c3cn, struct 
sk_buff *skb,
   V_TX_CHANNEL(e-smt_idx));
req-opt0l = htonl(calc_opt0l(c3cn));
req-params = 0;
+   req-opt2 = 0;
 }
 
 static void fail_act_open(struct s3_conn *c3cn, int errno)
@@ -379,6 +381,7 @@ static void send_abort_req(struct s3_conn *c3cn)
 
c3cn-cpl_abort_req = NULL;
req = (struct cpl_abort_req *)skb-head;
+   memset(req, 0, sizeof(*req));
 
skb-priority = CPL_PRIORITY_DATA;
set_arp_failure_handler(skb, abort_arp_failure);
@@ -406,6 +409,7 @@ static void send_abort_rpl(struct s3_conn *c3cn, int 
rst_status)
c3cn-cpl_abort_rpl = NULL;
 
skb-priority = CPL_PRIORITY_DATA;
+   memset(rpl, 0, sizeof(*rpl));
rpl-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL));
rpl-wr.wr_lo = htonl(V_WR_TID(c3cn-tid));
OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, c3cn-tid));
@@ -430,6 +434,7 @@ static u32 send_rx_credits(struct s3_conn *c3cn, u32 
credits, u32 dack)
 
req = (struct cpl_rx_data_ack *)__skb_put(skb, sizeof(*req));
req-wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
+   req-wr.wr_lo = 0;
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, c3cn-tid));
req-credit_dack = htonl(dack | V_RX_CREDITS(credits));
skb-priority = CPL_PRIORITY_ACK;

-- 
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.



[PATCH 1/1 v2] cxgb3i: Fix a login over vlan issue

2009-12-10 Thread kxie
[PATCH 1/1 v2] cxgb3i: Fix a login over vlan issue

From: Rakesh Ranjan rak...@chelsio.com

Fix a target login issue, when parent interface is vlan and we are using
cxgb3i sepecific private ip address in '/etc/iscsi/ifaces/' iface file.

Acked-by: Karen Xie k...@chelsio.com
Signed-off-by: Rakesh Ranjan rak...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_offload.c |   34 +-
 1 files changed, 33 insertions(+), 1 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index 26ffdcd..15a00e8 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -1440,6 +1440,10 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn)
 static int is_cxgb3_dev(struct net_device *dev)
 {
struct cxgb3i_sdev_data *cdata;
+   struct net_device *ndev = dev;
+
+   if (dev-priv_flags  IFF_802_1Q_VLAN)
+   ndev = vlan_dev_real_dev(dev);
 
write_lock(cdata_rwlock);
list_for_each_entry(cdata, cdata_list, list) {
@@ -1447,7 +1451,7 @@ static int is_cxgb3_dev(struct net_device *dev)
int i;
 
for (i = 0; i  ports-nports; i++)
-   if (dev == ports-lldevs[i]) {
+   if (ndev == ports-lldevs[i]) {
write_unlock(cdata_rwlock);
return 1;
}
@@ -1566,6 +1570,26 @@ out_err:
return -EINVAL;
 }
 
+/**
+ * cxgb3i_find_dev - find the interface associated with the given address
+ * @ipaddr: ip address
+ */
+static struct net_device *
+cxgb3i_find_dev(struct net_device *dev, __be32 ipaddr)
+{
+   struct flowi fl;
+   int err;
+   struct rtable *rt;
+
+   memset(fl, 0, sizeof(fl));
+   fl.nl_u.ip4_u.daddr = ipaddr;
+
+   err = ip_route_output_key(dev ? dev_net(dev) : init_net, rt, fl);
+   if (!err)
+   return (rt-u.dst)-dev;
+
+   return NULL;
+}
 
 /**
  * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address
@@ -1581,6 +1605,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct 
s3_conn *c3cn,
struct cxgb3i_sdev_data *cdata;
struct t3cdev *cdev;
__be32 sipv4;
+   struct net_device *dstdev;
int err;
 
c3cn_conn_debug(c3cn 0x%p, dev 0x%p.\n, c3cn, dev);
@@ -1591,6 +1616,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct 
s3_conn *c3cn,
c3cn-daddr.sin_port = usin-sin_port;
c3cn-daddr.sin_addr.s_addr = usin-sin_addr.s_addr;
 
+   dstdev = cxgb3i_find_dev(dev, usin-sin_addr.s_addr);
+   if (!dstdev || !is_cxgb3_dev(dstdev))
+   return -ENETUNREACH;
+
+   if (dstdev-priv_flags  IFF_802_1Q_VLAN)
+   dev = dstdev;
+
rt = find_route(dev, c3cn-saddr.sin_addr.s_addr,
c3cn-daddr.sin_addr.s_addr,
c3cn-saddr.sin_port,

--

You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.




[PATCH 1/1] cxgb3i: Fix a login over vlan issue

2009-12-09 Thread kxie
[PATCH 1/1] cxgb3i: Fix a login over vlan issue

From: Karen Xie k...@chelsio.com

Fix a login over vlan issue, when parent interface is vlan and we are using

cxgb3i sepecific private ip address in '/etc/iscsi/ifaces/' iface file.

Acked-by: Karen Xie k...@chelsio.com
Signed-off-by: Rakesh Ranjan rak...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_offload.c |   33 -
 1 files changed, 32 insertions(+), 1 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index 26ffdcd..1aef364 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -1440,6 +1440,10 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn)
 static int is_cxgb3_dev(struct net_device *dev)
 {
struct cxgb3i_sdev_data *cdata;
+   struct net_device *ndev = dev;
+
+   if (dev-priv_flags  IFF_802_1Q_VLAN)
+   ndev = vlan_dev_real_dev(dev);
 
write_lock(cdata_rwlock);
list_for_each_entry(cdata, cdata_list, list) {
@@ -1447,7 +1451,7 @@ static int is_cxgb3_dev(struct net_device *dev)
int i;
 
for (i = 0; i  ports-nports; i++)
-   if (dev == ports-lldevs[i]) {
+   if (ndev == ports-lldevs[i]) {
write_unlock(cdata_rwlock);
return 1;
}
@@ -1566,6 +1570,25 @@ out_err:
return -EINVAL;
 }
 
+/**
+ * cxgb3i_find_dev - find the interface associated with the given address
+ * @ipaddr: ip address
+ */
+static struct net_device *cxgb3i_find_dev(__be32 ipaddr)
+{
+   struct flowi fl;
+   int err;
+   struct rtable *rt;
+
+   memset(fl, 0, sizeof(fl));
+   fl.nl_u.ip4_u.daddr = ipaddr;
+
+   err = ip_route_output_key(init_net, rt, fl);
+   if (!err)
+   return (rt-u.dst)-dev;
+
+   return NULL;
+}
 
 /**
  * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address
@@ -1581,6 +1604,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct 
s3_conn *c3cn,
struct cxgb3i_sdev_data *cdata;
struct t3cdev *cdev;
__be32 sipv4;
+   struct net_device *dstdev;
int err;
 
c3cn_conn_debug(c3cn 0x%p, dev 0x%p.\n, c3cn, dev);
@@ -1591,6 +1615,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct 
s3_conn *c3cn,
c3cn-daddr.sin_port = usin-sin_port;
c3cn-daddr.sin_addr.s_addr = usin-sin_addr.s_addr;
 
+   dstdev = cxgb3i_find_dev(usin-sin_addr.s_addr);
+   if (!dstdev || !is_cxgb3_dev(dstdev))
+   return -ENETUNREACH;
+
+   if (dstdev-priv_flags  IFF_802_1Q_VLAN)
+   dev = dstdev;
+
rt = find_route(dev, c3cn-saddr.sin_addr.s_addr,
c3cn-daddr.sin_addr.s_addr,
c3cn-saddr.sin_port,

--

You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.




[PATCH v2 1/2 net-next-2.6] cxgb3: added private MAC address and provisioning packet handler for iSCSI

2009-09-25 Thread kxie

[PATCH v2 1/2 net-next-2.6] cxgb3: Added private MAC address and provisioning 
packet handler for iSCSI

This patch added support of private MAC address per port and provisioning
packet handler for iSCSI traffic only.

This patch is generated against net-next-2.6.

Acked-by: Karen Xie k...@chelsio.com
Acked-by: Divy Le Ray d...@chelsio.com
Signed-off-by: Rakesh Ranjan rran...@chelsio.com
---
 drivers/net/cxgb3/adapter.h   |   18 +-
 drivers/net/cxgb3/cxgb3_main.c|   22 ++
 drivers/net/cxgb3/cxgb3_offload.c |2 +-
 drivers/net/cxgb3/sge.c   |   30 --
 4 files changed, 56 insertions(+), 16 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 2b1aea6..3f3083a 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -48,12 +48,28 @@
 struct vlan_group;
 struct adapter;
 struct sge_qset;
+struct port_info;
 
 enum { /* rx_offload flags */
T3_RX_CSUM  = 1  0,
T3_LRO  = 1  1,
 };
 
+enum {
+   LAN_MAC_IDX = 0,
+   SAN_MAC_IDX,
+
+   MAX_MAC_IDX
+};
+
+struct iscsi_config {
+   __be32  ipv4_addr;
+   __u8mac_addr[ETH_ALEN];
+   __u32   flags;
+   int (*send)(struct port_info *pi, struct sk_buff **skb);
+   int (*recv)(struct port_info *pi, struct sk_buff *skb);
+};
+
 struct port_info {
struct adapter *adapter;
struct vlan_group *vlan_grp;
@@ -67,7 +83,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
-   __be32 iscsi_ipv4addr;
+   struct iscsi_config iscsic;
 
int link_fault; /* link fault was detected */
 };
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 34e776c..c9113d3 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -344,8 +344,10 @@ static void link_start(struct net_device *dev)
 
init_rx_mode(rm, dev, dev-mc_list);
t3_mac_reset(mac);
+   t3_mac_set_num_ucast(mac, MAX_MAC_IDX);
t3_mac_set_mtu(mac, dev-mtu);
-   t3_mac_set_address(mac, 0, dev-dev_addr);
+   t3_mac_set_address(mac, LAN_MAC_IDX, dev-dev_addr);
+   t3_mac_set_address(mac, SAN_MAC_IDX, pi-iscsic.mac_addr);
t3_mac_set_rx_mode(mac, rm);
t3_link_start(pi-phy, mac, pi-link_config);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
@@ -903,6 +905,7 @@ static inline int offload_tx(struct t3cdev *tdev, struct 
sk_buff *skb)
 static int write_smt_entry(struct adapter *adapter, int idx)
 {
struct cpl_smt_write_req *req;
+   struct port_info *pi = netdev_priv(adapter-port[idx]);
struct sk_buff *skb = alloc_skb(sizeof(*req), GFP_KERNEL);
 
if (!skb)
@@ -913,8 +916,8 @@ static int write_smt_entry(struct adapter *adapter, int idx)
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SMT_WRITE_REQ, idx));
req-mtu_idx = NMTUS - 1;   /* should be 0 but there's a T3 bug */
req-iff = idx;
-   memset(req-src_mac1, 0, sizeof(req-src_mac1));
memcpy(req-src_mac0, adapter-port[idx]-dev_addr, ETH_ALEN);
+   memcpy(req-src_mac1, pi-iscsic.mac_addr, ETH_ALEN);
skb-priority = 1;
offload_tx(adapter-tdev, skb);
return 0;
@@ -2516,7 +2519,7 @@ static int cxgb_set_mac_addr(struct net_device *dev, void 
*p)
return -EINVAL;
 
memcpy(dev-dev_addr, addr-sa_data, dev-addr_len);
-   t3_mac_set_address(pi-mac, 0, dev-dev_addr);
+   t3_mac_set_address(pi-mac, LAN_MAC_IDX, dev-dev_addr);
if (offload_running(adapter))
write_smt_entry(adapter, pi-port_id);
return 0;
@@ -2654,7 +2657,7 @@ static void check_t3b2_mac(struct adapter *adapter)
struct cmac *mac = p-mac;
 
t3_mac_set_mtu(mac, dev-mtu);
-   t3_mac_set_address(mac, 0, dev-dev_addr);
+   t3_mac_set_address(mac, LAN_MAC_IDX, dev-dev_addr);
cxgb_set_rxmode(dev);
t3_link_start(p-phy, mac, p-link_config);
t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX);
@@ -3112,6 +3115,14 @@ static const struct net_device_ops cxgb_netdev_ops = {
 #endif
 };
 
+static void __devinit cxgb3_init_iscsi_mac(struct net_device *dev)
+{
+   struct port_info *pi = netdev_priv(dev);
+
+   memcpy(pi-iscsic.mac_addr, dev-dev_addr, ETH_ALEN);
+   pi-iscsic.mac_addr[3] |= 0x80;
+}
+
 static int __devinit init_one(struct pci_dev *pdev,
  const struct pci_device_id *ent)
 {
@@ -3270,6 +3281,9 @@ static int __devinit init_one(struct pci_dev *pdev,
goto out_free_dev;
}
 
+   for_each_port(adapter, i)
+   cxgb3_init_iscsi_mac(adapter-port[i]);
+
/* Driver's ready. Reflect it on LEDs */

[PATCH 2.6.30-rc] cxgb3i -- fixed connection error when vlan is enabled

2009-06-26 Thread kxie

[PATCH 2.6.30-rc] cxgb3i -- fixed connection error when vlan is enabled

From: Karen Xie k...@chelsio.com

There is a bug when VLAN is configured on the cxgb3 interface, the iscsi
conn. would be denied with message cxgb3i: NOT going through cxgbi device.

This patch added code to get the real egress net_device when vlan is configured.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_iscsi.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 04a4374..60013a4 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -13,6 +13,7 @@
 
 #include linux/inet.h
 #include linux/crypto.h
+#include linux/if_vlan.h
 #include net/tcp.h
 #include scsi/scsi_cmnd.h
 #include scsi/scsi_device.h
@@ -183,6 +184,9 @@ static struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct 
net_device *ndev)
struct cxgb3i_adapter *snic;
int i;
 
+   if (ndev-priv_flags  IFF_802_1Q_VLAN)
+   ndev = vlan_dev_real_dev(ndev);
+
read_lock(cxgb3i_snic_rwlock);
list_for_each_entry(snic, cxgb3i_snic_list, list_head) {
for (i = 0; i  snic-hba_cnt; i++) {

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 2/2 2.6.30-rc v2] cxgb3i -- suppot of different kernel page sizes

2009-06-15 Thread kxie

[PATCH 2/2 2.6.30-rc v2] cxgb3i -- suppot of different kernel page sizes

From: Karen Xie k...@chelsio.com

The default kernel pages supported are 4K, 8K, 16K, and 64K. Re-calculate
entries if PAGE_SIZE is not one of the defaults.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 8eb2848..344fd53 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -206,6 +206,31 @@ int cxgb3i_ddp_find_page_index(unsigned long pgsz)
return DDP_PGIDX_MAX;
 }
 
+/**
+ * cxgb3i_ddp_adjust_page_table - adjust page table with PAGE_SIZE
+ * return the ddp page index, if no match is found return DDP_PGIDX_MAX.
+ */
+int cxgb3i_ddp_adjust_page_table(void)
+{
+   int i;
+   unsigned int base_order, order;
+
+   if (PAGE_SIZE  (1UL  ddp_page_shift[0])) {
+   ddp_log_info(PAGE_SIZE 0x%lx too small, min. 0x%lx.\n,
+   PAGE_SIZE, 1UL  ddp_page_shift[0]);
+   return -EINVAL;
+   }
+
+   base_order = get_order(1UL  ddp_page_shift[0]);
+   order = get_order(1  PAGE_SHIFT);
+   for (i = 0; i  DDP_PGIDX_MAX; i++) {
+   /* first is the kernel page size, then just doubling the size */
+   ddp_page_order[i] = order - base_order + i;
+   ddp_page_shift[i] = PAGE_SHIFT + i;
+   }
+   return 0;
+}
+
 static inline void ddp_gl_unmap(struct pci_dev *pdev,
struct cxgb3i_gather_list *gl)
 {
@@ -727,6 +752,17 @@ void cxgb3i_ddp_init(struct t3cdev *tdev)
 {
if (page_idx == DDP_PGIDX_MAX) {
page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
+
+   if (page_idx == DDP_PGIDX_MAX) {
+   ddp_log_info(system PAGE_SIZE %lu, update hw.\n,
+   PAGE_SIZE);
+   if (cxgb3i_ddp_adjust_page_table()  0) {
+   ddp_log_info(PAGE_SIZE %lu, ddp disabled.\n,
+   PAGE_SIZE);
+   return;
+   }
+   page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
+   }
ddp_log_info(system PAGE_SIZE %lu, ddp idx %u.\n,
PAGE_SIZE, page_idx);
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 1/2 2.6.30-rc v2] cxgb3i -- use kref to track ddp usage

2009-06-15 Thread kxie

[PATCH 1/2 2.6.30-rc v2] cxgb3i -- use kref to track ddp usage

From: Karen Xie k...@chelsio.com

The iscsi ddp functionality could be used by multiple iscsi entities,
add a refcnt to keep track of it, so we would not release it pre-maturely.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   54 +++---
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |2 +
 2 files changed, 35 insertions(+), 21 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 99c9125..8eb2848 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -598,30 +598,40 @@ int cxgb3i_adapter_ddp_info(struct t3cdev *tdev,
  * release all the resource held by the ddp pagepod manager for a given
  * adapter if needed
  */
-void cxgb3i_ddp_cleanup(struct t3cdev *tdev)
+
+static void ddp_cleanup(struct kref *kref)
 {
+   struct cxgb3i_ddp_info *ddp = container_of(kref,
+   struct cxgb3i_ddp_info,
+   refcnt);
int i = 0;
+
+   ddp_log_info(kref release ddp 0x%p, t3dev 0x%p.\n, ddp, ddp-tdev);
+
+   ddp-tdev-ulp_iscsi = NULL;
+   while (i  ddp-nppods) {
+   struct cxgb3i_gather_list *gl = ddp-gl_map[i];
+   if (gl) {
+   int npods = (gl-nelem + PPOD_PAGES_MAX - 1)
+PPOD_PAGES_SHIFT;
+   ddp_log_info(t3dev 0x%p, ddp %d + %d.\n,
+   ddp-tdev, i, npods);
+   kfree(gl);
+   ddp_free_gl_skb(ddp, i, npods);
+   i += npods;
+   } else
+   i++;
+   }
+   cxgb3i_free_big_mem(ddp);
+}
+
+void cxgb3i_ddp_cleanup(struct t3cdev *tdev)
+{
struct cxgb3i_ddp_info *ddp = (struct cxgb3i_ddp_info *)tdev-ulp_iscsi;
 
ddp_log_info(t3dev 0x%p, release ddp 0x%p.\n, tdev, ddp);
-
-   if (ddp) {
-   tdev-ulp_iscsi = NULL;
-   while (i  ddp-nppods) {
-   struct cxgb3i_gather_list *gl = ddp-gl_map[i];
-   if (gl) {
-   int npods = (gl-nelem + PPOD_PAGES_MAX - 1)
-PPOD_PAGES_SHIFT;
-   ddp_log_info(t3dev 0x%p, ddp %d + %d.\n,
-   tdev, i, npods);
-   kfree(gl);
-   ddp_free_gl_skb(ddp, i, npods);
-   i += npods;
-   } else
-   i++;
-   }
-   cxgb3i_free_big_mem(ddp);
-   }
+   if (ddp)
+   kref_put(ddp-refcnt, ddp_cleanup);
 }
 
 /**
@@ -631,12 +641,13 @@ void cxgb3i_ddp_cleanup(struct t3cdev *tdev)
  */
 static void ddp_init(struct t3cdev *tdev)
 {
-   struct cxgb3i_ddp_info *ddp;
+   struct cxgb3i_ddp_info *ddp = tdev-ulp_iscsi;
struct ulp_iscsi_info uinfo;
unsigned int ppmax, bits;
int i, err;
 
-   if (tdev-ulp_iscsi) {
+   if (ddp) {
+   kref_get(ddp-refcnt);
ddp_log_warn(t3dev 0x%p, ddp 0x%p already set up.\n,
tdev, tdev-ulp_iscsi);
return;
@@ -670,6 +681,7 @@ static void ddp_init(struct t3cdev *tdev)
  ppmax *
  sizeof(struct cxgb3i_gather_list *));
spin_lock_init(ddp-map_lock);
+   kref_init(ddp-refcnt);
 
ddp-tdev = tdev;
ddp-pdev = uinfo.pdev;
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 0d296de..87dd56b 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -54,6 +54,7 @@ struct cxgb3i_gather_list {
  * struct cxgb3i_ddp_info - cxgb3i direct data placement for pdu payload
  *
  * @list:  list head to link elements
+ * @refcnt:ref. count
  * @tdev:  pointer to t3cdev used by cxgb3 driver
  * @max_txsz:  max tx packet size for ddp
  * @max_rxsz:  max rx packet size for ddp
@@ -70,6 +71,7 @@ struct cxgb3i_gather_list {
  */
 struct cxgb3i_ddp_info {
struct list_head list;
+   struct kref refcnt;
struct t3cdev *tdev;
struct pci_dev *pdev;
unsigned int max_txsz;

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 2/2 2.6.30-rc] cxgb3i -- suppot of different kernel page sizes

2009-06-13 Thread kxie

[PATCH 2/2 2.6.30-rc] cxgb3i -- suppot of different kernel page sizes

From: Karen Xie k...@chelsio.com

The default kernel pages supported are 4K, 8K, 16K, and 64K. Re-calculate
entries if PAGE_SIZE is not one of the defaults.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index b6fdb5e..cdecd73 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -206,6 +206,31 @@ int cxgb3i_ddp_find_page_index(unsigned long pgsz)
return DDP_PGIDX_MAX;
 }
 
+/**
+ * cxgb3i_ddp_adjust_page_table - adjust page table with PAGE_SIZE
+ * return the ddp page index, if no match is found return DDP_PGIDX_MAX.
+ */
+int cxgb3i_ddp_adjust_page_table(void)
+{
+   int i;
+   unsigned int base_order, order;
+
+   if (PAGE_SIZE  (1UL  ddp_page_shift[0])) {
+   ddp_log_info(PAGE_SIZE 0x%lx too small, min. 0x%lx.\n,
+   PAGE_SIZE, 1UL  ddp_page_shift[0]);
+   return -EINVAL;
+   }
+
+   base_order = get_order(1UL  ddp_page_shift[0]);
+   order = get_order(1  PAGE_SHIFT);
+   for (i = 0; i  DDP_PGIDX_MAX; i++) {
+   /* first is the kernel page size, then just doubling the size */
+   ddp_page_order[i] = order - base_order + i;
+   ddp_page_shift[i] = PAGE_SHIFT + i;
+   }
+   return 0;
+}
+
 static inline void ddp_gl_unmap(struct pci_dev *pdev,
struct cxgb3i_gather_list *gl)
 {
@@ -718,6 +743,17 @@ void cxgb3i_ddp_init(struct t3cdev *tdev)
 {
if (page_idx == DDP_PGIDX_MAX) {
page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
+
+   if (page_idx == DDP_PGIDX_MAX) {
+   ddp_log_info(system PAGE_SIZE %lu, update hw.\n,
+   PAGE_SIZE);
+   if (cxgb3i_ddp_adjust_page_table()  0) {
+   ddp_log_info(PAGE_SIZE %lu, ddp disabled.\n,
+   PAGE_SIZE);
+   return;
+   }
+   page_idx = cxgb3i_ddp_find_page_index(PAGE_SIZE);
+   }
ddp_log_info(system PAGE_SIZE %lu, ddp idx %u.\n,
PAGE_SIZE, page_idx);
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 1/2 2.6.30-rc] cxgb3i -- add a refcnt to track ddp usage

2009-06-13 Thread kxie

[PATCH 1/2 2.6.30-rc] cxgb3i -- add a refcnt to track ddp usage

From: Karen Xie k...@chelsio.com

The iscsi ddp functionality could be used by multiple iscsi entities,
add a refcnt to keep track of it, so we would not release it pre-maturely.

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   11 +++
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |2 ++
 2 files changed, 9 insertions(+), 4 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 99c9125..b6fdb5e 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -603,9 +603,10 @@ void cxgb3i_ddp_cleanup(struct t3cdev *tdev)
int i = 0;
struct cxgb3i_ddp_info *ddp = (struct cxgb3i_ddp_info *)tdev-ulp_iscsi;
 
-   ddp_log_info(t3dev 0x%p, release ddp 0x%p.\n, tdev, ddp);
+   ddp_log_info(t3dev 0x%p, release ddp 0x%p, ref %d.\n,
+   tdev, ddp, atomic_read(ddp-refcnt));
 
-   if (ddp) {
+   if (ddp  atomic_dec_and_test(ddp-refcnt)) {
tdev-ulp_iscsi = NULL;
while (i  ddp-nppods) {
struct cxgb3i_gather_list *gl = ddp-gl_map[i];
@@ -631,12 +632,13 @@ void cxgb3i_ddp_cleanup(struct t3cdev *tdev)
  */
 static void ddp_init(struct t3cdev *tdev)
 {
-   struct cxgb3i_ddp_info *ddp;
+   struct cxgb3i_ddp_info *ddp = tdev-ulp_iscsi;
struct ulp_iscsi_info uinfo;
unsigned int ppmax, bits;
int i, err;
 
-   if (tdev-ulp_iscsi) {
+   if (ddp) {
+   atomic_inc(ddp-refcnt);
ddp_log_warn(t3dev 0x%p, ddp 0x%p already set up.\n,
tdev, tdev-ulp_iscsi);
return;
@@ -670,6 +672,7 @@ static void ddp_init(struct t3cdev *tdev)
  ppmax *
  sizeof(struct cxgb3i_gather_list *));
spin_lock_init(ddp-map_lock);
+   atomic_set(ddp-refcnt, 1);
 
ddp-tdev = tdev;
ddp-pdev = uinfo.pdev;
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 0d296de..0e699e8 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -54,6 +54,7 @@ struct cxgb3i_gather_list {
  * struct cxgb3i_ddp_info - cxgb3i direct data placement for pdu payload
  *
  * @list:  list head to link elements
+ * @refcnt:count of iscsi entities using it
  * @tdev:  pointer to t3cdev used by cxgb3 driver
  * @max_txsz:  max tx packet size for ddp
  * @max_rxsz:  max rx packet size for ddp
@@ -70,6 +71,7 @@ struct cxgb3i_gather_list {
  */
 struct cxgb3i_ddp_info {
struct list_head list;
+   atomic_t refcnt;
struct t3cdev *tdev;
struct pci_dev *pdev;
unsigned int max_txsz;

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH] cxgb3i: fix ddp map overrun

2009-04-17 Thread kxie

[PATCH] cxgb3i: fix ddp map overrun

From: Karen Xie k...@chelsio.com

Fixed a bug in calculating ddp map range when search for free entries: 
it was going beyond the end by one, thus corrupting gl_skb[0].

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index d06a661..43f6ece 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -367,7 +367,7 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned 
int tid,
}
 
npods = (gl-nelem + PPOD_PAGES_MAX - 1)  PPOD_PAGES_SHIFT;
-   idx_max = ddp-nppods - npods + 1;
+   idx_max = ddp-nppods - npods;
 
if (ddp-idx_last == ddp-nppods)
idx = ddp_find_unused_entries(ddp, 0, idx_max, npods, gl);
@@ -376,7 +376,7 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned 
int tid,
  idx_max, npods, gl);
if (idx  0  ddp-idx_last = npods)
idx = ddp_find_unused_entries(ddp, 0,
- ddp-idx_last - npods + 1,
+ ddp-idx_last + npods - 1,
  npods, gl);
}
if (idx  0) {

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH v2] cxgb3i: fix ddp map overrun (v2)

2009-04-17 Thread kxie

[PATCH v2] cxgb3i: fix ddp map overrun (version 2)

From: Karen Xie k...@chelsio.com

Fixed a bug in calculating ddp map range when search for free entries:
it was going beyond the end by one, thus corrupting gl_skb[0].

Signed-off-by: Karen Xie k...@chelsio.com
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   32 +++-
 1 files changed, 19 insertions(+), 13 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index d06a661..99c9125 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -120,20 +120,26 @@ static void clear_ddp_map(struct cxgb3i_ddp_info *ddp, 
unsigned int tag,
 }
 
 static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp,
- int start, int max, int count,
+ unsigned int start, unsigned int max,
+ unsigned int count,
  struct cxgb3i_gather_list *gl)
 {
-   unsigned int i, j;
+   unsigned int i, j, k;
 
+   /* not enough entries */
+   if ((max - start)  count)
+   return -EBUSY;
+
+   max -= count;
spin_lock(ddp-map_lock);
-   for (i = start; i = max;) {
-   for (j = 0; j  count; j++) {
-   if (ddp-gl_map[i + j])
+   for (i = start; i  max;) {
+   for (j = 0, k = i; j  count; j++, k++) {
+   if (ddp-gl_map[k])
break;
}
if (j == count) {
-   for (j = 0; j  count; j++)
-   ddp-gl_map[i + j] = gl;
+   for (j = 0, k = i; j  count; j++, k++)
+   ddp-gl_map[k] = gl;
spin_unlock(ddp-map_lock);
return i;
}
@@ -354,7 +360,7 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned 
int tid,
struct cxgb3i_ddp_info *ddp = tdev-ulp_iscsi;
struct pagepod_hdr hdr;
unsigned int npods;
-   int idx = -1, idx_max;
+   int idx = -1;
int err = -ENOMEM;
u32 sw_tag = *tagp;
u32 tag;
@@ -367,17 +373,17 @@ int cxgb3i_ddp_tag_reserve(struct t3cdev *tdev, unsigned 
int tid,
}
 
npods = (gl-nelem + PPOD_PAGES_MAX - 1)  PPOD_PAGES_SHIFT;
-   idx_max = ddp-nppods - npods + 1;
 
if (ddp-idx_last == ddp-nppods)
-   idx = ddp_find_unused_entries(ddp, 0, idx_max, npods, gl);
+   idx = ddp_find_unused_entries(ddp, 0, ddp-nppods, npods, gl);
else {
idx = ddp_find_unused_entries(ddp, ddp-idx_last + 1,
- idx_max, npods, gl);
-   if (idx  0  ddp-idx_last = npods)
+ ddp-nppods, npods, gl);
+   if (idx  0  ddp-idx_last = npods) {
idx = ddp_find_unused_entries(ddp, 0,
- ddp-idx_last - npods + 1,
+   min(ddp-idx_last + npods, ddp-nppods),
  npods, gl);
+   }
}
if (idx  0) {
ddp_log_debug(xferlen %u, gl %u, npods %u NO DDP.\n,

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth

2009-04-06 Thread kxie

[PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth

From: Karen Xie k...@chelsio.com

From: Karen Xie k...@chelsio.com

Bump the command queue depth.

Signed-off-by: Karen Xie k...@chelsio.com
---
---

 drivers/scsi/cxgb3i/cxgb3i.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index d362860..68ed5db 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -34,7 +34,7 @@
 #include cxgb3i_offload.h
 #include cxgb3i_ddp.h
 
-#define CXGB3I_SCSI_QDEPTH_DFLT128
+#define CXGB3I_SCSI_QDEPTH_DFLT1024
 #define CXGB3I_MAX_TARGET  CXGB3I_MAX_CONN
 #define CXGB3I_MAX_LUN 512
 #define ISCSI_PDU_NONPAYLOAD_MAX \

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
open-iscsi group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---