RE: [PATCH] iscsiadm : make iface.ipaddress optional in iface configs for transports that don't have a hard requirement on it.

2014-07-25 Thread Karen Xie
Hi, Mike,

cxgb3i supports setting the iscsi ip address specified in the iface config. 
cxgb4i does not support it, for setting it prints out a message but does not 
return an error. Yes, we will fix it.

Thanks,
Karen

From: Mike Christie [micha...@cs.wisc.edu]
Sent: Friday, July 25, 2014 11:14 AM
To: Anish Bhatt
Cc: open-iscsi@googlegroups.com; Karen Xie
Subject: Re: [PATCH] iscsiadm : make iface.ipaddress optional in iface configs 
for transports that don't have a hard requirement on it.

On 07/24/2014 09:47 PM, Anish Bhatt wrote:
> If an ipaddress is setup for a chelsio interface, then  
> /sys/class/iscsi_host/ip_address returns the ip address from the netdev 
> correctly, otherwise it is all zeros. It will always return the value from 
> netdev, since we don't actually support setting iface.ipaddress in the 
> transport

I am confused about the last statement. If you do not support
iface.ipaddress why is it optional in your patch? Also, is that
statement that for both drivers or only cxgb3i. It looks like cxgb4i only.

For cxgb3i, it looks like cxgbi_set_host_param will set the
chba->ipv4addr to what is passed in, and it looks like
cxgbi_get_host_param will return that value. It then looks like
update_address will look at ipv4addr and use it if set. So it looks like
it could use the iface.ipaddress and so SET_HOST_IP_OPT is ok to use.
However, should cxgbi_get_host_param be returning the netdev ip address
if cxgbi_set_host_param/ISCSI_HOST_PARAM_IPADDRESS has not yet been called?

For cxgb4i, it looks like cxgbi_set_host_param will set the
chba->ipv4addr to what is passed in, and it looks like
cxgbi_get_host_param will return that value. However, I am not seeing
that driver ever touch ipv4addr. Is that right? So will it always use
the netdev ipaddress, but actually return in
/sys/class/iscsi_host/ip_address whatever was set by the iscsi tools in
iface.ipaddress? If so, should cxgb4i not be SET_HOST_IP_NOT_REQ and
should the cxgb4i ISCSI_HOST_PARAM_IPADDRESS code be fixed so it returns
the value we are actually using?


> -Anish
> 
> From: Mike Christie [micha...@cs.wisc.edu]
> Sent: Thursday, July 24, 2014 9:21 AM
> To: open-iscsi@googlegroups.com
> Cc: Anish Bhatt; Karen Xie; Anish Bhatt
> Subject: Re: [PATCH] iscsiadm : make iface.ipaddress optional in iface 
> configs for transports that don't have a hard requirement on it.
>
> On 07/24/2014 01:14 AM, Anish Bhatt wrote:
>> From: Anish Bhatt 
>>
>> Signed-off-by: Anish Bhatt 
>> ---
>>  usr/initiator_common.c | 15 ---
>>  usr/transport.c|  8 
>>  usr/transport.h|  6 ++
>>  3 files changed, 22 insertions(+), 7 deletions(-)
>>
>> diff --git a/usr/initiator_common.c b/usr/initiator_common.c
>> index 50f8d41..8ff993d 100644
>> --- a/usr/initiator_common.c
>> +++ b/usr/initiator_common.c
>> @@ -685,9 +685,18 @@ int iscsi_host_set_net_params(struct iface_rec *iface,
>>
>>   /* if we need to set the ip addr then set all the iface net settings */
>>   if (!iface_is_bound_by_ipaddr(iface)) {
>> - log_warning("Please set the iface.ipaddress for iface %s, "
>> - "then retry the login command.\n", iface->name);
>> - return EINVAL;
>> + if (t->template->set_host_ip == SET_HOST_IP_REQ) {
>> + log_warning("Please set the iface.ipaddress for iface "
>> + "%s, then retry the login command.\n",
>> + iface->name);
>> + return EINVAL;
>> + } else if (t->template->set_host_ip == SET_HOST_IP_OPT) {
>> + log_info("Optional iface.ipaddress for iface %s "
>> +  "not set.\n", iface->name);
>> + return 0;
>> + } else {
>
> Is there a way to tell if it was not set in the iface config file but is
> actually already set in the driver/kernel already?
>
> If I read the /sys/class/iscsi_host/ip_address file will that return the
> value from the netdev that will be used or the already setup value?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.


RE: [PATCH] make if.ipaddress optional in iface configuration files for offload iscsi

2011-10-25 Thread Karen Xie
Hi, Mike,

The patch is taking care of the cases where the ip address is already
set by other tools.
And if the ip address is not present in the iface file, the ip of the
netdev/ethX is used.

Thanks,
Karen
-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-iscsi@googlegroups.com]
On Behalf Of Mike Christie
Sent: Tuesday, October 25, 2011 3:45 PM
To: open-iscsi@googlegroups.com
Cc: Anish Bhatt
Subject: Re: [PATCH] make if.ipaddress optional in iface configuration
files for offload iscsi

On 10/25/2011 01:58 PM, Anish Bhatt wrote:
> Currently, the iface.ipaddress field is required in iface files for
> offload iscsi. This is not generated by `iscsiadm -m iface` ,
requiring
> manual editing of the files. However, some transports (like Chelsio)
can
> work without needing the ipaddress to be explicitly defined in the
iface
> files.  This patch lets the transport template specify that this field
> is optional. After patch, transport can pull ip address from the
system,
> but this can still be overridden by specifying iface.ipaddress , thus
> dropping the hard requirement.

Ah, I thought we always had to set it for chelsio cards. For chelsio
cards does this work if the iscsi function does not have any address set
at all or is it already setup by some other tools or previous iscsiadm
run?

If nothing is set by the iscsi tools is the ip of the netdev/ethX that
the iscsi interface is bound supposed to be used then?



+   return EINVAL;
+   } else if(t->template->set_host_ip == SET_HOST_IP_OPT) {
+   log_info("Optional iface.ipaddress for iface %s,
"
+"not set.\n", iface->name);
+   return 0;



diff --git a/usr/transport.c b/usr/transport.c
index 5d6bea4..fc85ce7 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -45,7 +45,7 @@ struct iscsi_transport_template iscsi_iser = {

 struct iscsi_transport_template cxgb3i = {
.name   = "cxgb3i",
-   .set_host_ip= 1,
+   .set_host_ip= 2,
.ep_connect = ktransport_ep_connect,
.ep_poll= ktransport_ep_poll,
.ep_disconnect  = ktransport_ep_disconnect,
@@ -54,7 +54,7 @@ struct iscsi_transport_template cxgb3i = {

 struct iscsi_transport_template cxgb4i = {
.name   = "cxgb4i",
-   .set_host_ip= 1,
+   .set_host_ip= 2,
.ep_connect = ktransport_ep_connect,
.ep_poll= ktransport_ep_poll,
.ep_disconnect  = ktransport_ep_disconnect,
diff --git a/usr/transport.h b/usr/transport.h

Since you made it into a enum use the enum names instead of the
numerical values. It will be easier to read.

-- 
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.

-- 
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.



RE: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

2011-01-10 Thread Karen Xie
Yes, that's bug this patch is fixing too. The current implementation
does not replenish the gl_skb after the initial allocation.

I am working on an update which utilizing a pool of skbs, and those skbs
would be used not only for the ddp setups (like the current gl_skb) but
also for the connection management like the rx credit returns. So this
skb pool will not reside in cxgbi_ddp_info, so still need to get rid of
gl_skb. I guess this patch can be viewed as an interim fix.

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Monday, January 10, 2011 11:57 AM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

On 01/10/2011 11:52 AM, Karen Xie wrote:
> Hi, Mike,
>
> What I mean is even if cxgb3i maintains a pool of skbs (equivalent of
> gl_skbs). Once they are handed down to the network layer cxgb3 they
will
> still be freed by the network driver (on the tx path).
>

So hows does it work now? It seems ddp_alloc_gl_skb is called at device 
setup time, then when IO is queued/xmited we run ddp_set_map which 
allocates from gl_skbs. If when you transmit the IO, the driver frees 
the skb, how does gl_skb get replenished?

-- 
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.



RE: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

2011-01-10 Thread Karen Xie
Hi, Mike,

What I mean is even if cxgb3i maintains a pool of skbs (equivalent of
gl_skbs). Once they are handed down to the network layer cxgb3 they will
still be freed by the network driver (on the tx path).

Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Friday, January 07, 2011 8:23 PM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

On 01/07/2011 06:09 PM, Karen Xie wrote:
> Hi, Mike,
>
> Yes, the message size is different between cxgb3i and cxgb4i. I am not

I am not sure if we are talking about the same thing. Mostly I am 
confused a little :)

For pool I just mean gl_skb. So I mean cxgb3i could make its own pool 
like it is now. Basically just move gl_skb to some cxgb3i struct and mv 
ddp_alloc_gl_skb related code to cxgb3i.

Then cxgb4i could do something similar if possible. Below when I was 
asking about variable sizes I meant that for cxgb4i it seemed harder 
because ddp_set_map->ddp_ppod_write_idata->alloc_wr allocates the skb 
based on wr_len.

> using the pool mainly because this is on the tx side and tx skb
> recycling does not seem to be utilized much.
>

What pool are you talking about? Some sort of skb pool from the network 
layer?

> Karen
>
> -Original Message-
> From: Mike Christie [mailto:micha...@cs.wisc.edu]
> Sent: Friday, January 07, 2011 3:48 PM
> To: open-iscsi@googlegroups.com
> Cc: Karen Xie; linux-s...@vger.kernel.org;
> james.bottom...@hansenpartnership.com
> Subject: Re: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info
>
> On 01/07/2011 05:42 PM, Mike Christie wrote:
>> On 01/07/2011 04:45 PM, k...@chelsio.com wrote:
>>> [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info.
>>>
>>> From: Karen Xie
>>>
>>> Remove gl_skb from cxgbi_ddp_info as it is only used by cxgb3i.
>>>
>>> Signed-off-by: Karen Xie
>>> ---
>>> drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 51
>>> +---
>>> drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 -
>>> drivers/scsi/cxgbi/libcxgbi.c | 15 +--
>>> drivers/scsi/cxgbi/libcxgbi.h | 3 --
>>> 4 files changed, 8 insertions(+), 63 deletions(-)
>>>
>>> diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>>> b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>>> index a129a17..e2362b9 100644
>>> --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>>> +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>>> @@ -1108,10 +1108,11 @@ static int ddp_set_map(struct cxgbi_sock
> *csk,
>>> struct cxgbi_pagepod_hdr *hdr,
>>> csk, idx, npods, gl);
>>>
>>> for (i = 0; i<  npods; i++, idx++, pm_addr += PPOD_SIZE) {
>>> - struct sk_buff *skb = ddp->gl_skb[idx];
>>> + struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
>>> + PPOD_SIZE, 0, GFP_ATOMIC);
>>
>>
>> I think you want to try to avoid lots of little GFP_ATOMIC
allocations
>> in the main IO path, because it probably is bad for performance and
>> because they can fail and you can be stuck with no mem but other
>> allocations needing to write data out.
>>
>> Did you want to just make each driver allocate a pool/map, then
> allocate
>> from that pool/map in these places (cxgb4i does a similar skb
> allocation
>> at these points right?)?
>>
>
> Oh yeah, is the complication that the cxgb3i driver uses 1 size for
the
> objects but cxgb4i is variable?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi"
in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
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.



RE: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

2011-01-07 Thread Karen Xie
Hi, Mike,

Yes, the message size is different between cxgb3i and cxgb4i. I am not
using the pool mainly because this is on the tx side and tx skb
recycling does not seem to be utilized much.

Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Friday, January 07, 2011 3:48 PM
To: open-iscsi@googlegroups.com
Cc: Karen Xie; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info

On 01/07/2011 05:42 PM, Mike Christie wrote:
> On 01/07/2011 04:45 PM, k...@chelsio.com wrote:
>> [PATCH 2/2] cxgbi: get rid of gl_skb in cxgbi_ddp_info.
>>
>> From: Karen Xie
>>
>> Remove gl_skb from cxgbi_ddp_info as it is only used by cxgb3i.
>>
>> Signed-off-by: Karen Xie
>> ---
>> drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 51
>> +---
>> drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 -
>> drivers/scsi/cxgbi/libcxgbi.c | 15 +--
>> drivers/scsi/cxgbi/libcxgbi.h | 3 --
>> 4 files changed, 8 insertions(+), 63 deletions(-)
>>
>> diff --git a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>> b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>> index a129a17..e2362b9 100644
>> --- a/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>> +++ b/drivers/scsi/cxgbi/cxgb3i/cxgb3i.c
>> @@ -1108,10 +1108,11 @@ static int ddp_set_map(struct cxgbi_sock
*csk,
>> struct cxgbi_pagepod_hdr *hdr,
>> csk, idx, npods, gl);
>>
>> for (i = 0; i< npods; i++, idx++, pm_addr += PPOD_SIZE) {
>> - struct sk_buff *skb = ddp->gl_skb[idx];
>> + struct sk_buff *skb = alloc_wr(sizeof(struct ulp_mem_io) +
>> + PPOD_SIZE, 0, GFP_ATOMIC);
>
>
> I think you want to try to avoid lots of little GFP_ATOMIC allocations
> in the main IO path, because it probably is bad for performance and
> because they can fail and you can be stuck with no mem but other
> allocations needing to write data out.
>
> Did you want to just make each driver allocate a pool/map, then
allocate
> from that pool/map in these places (cxgb4i does a similar skb
allocation
> at these points right?)?
>

Oh yeah, is the complication that the cxgb3i driver uses 1 size for the 
objects but cxgb4i is variable?

-- 
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.



RE: [PATCH 1/2] cxgbi: set ulpmode only if digest is on

2011-01-07 Thread Karen Xie
Oops, I mean "There is NO need to set ulpmode on the tx skbs if no
digest is enabled."

-Original Message-
From: k...@chelsio.com [mailto:k...@chelsio.com] 
Sent: Friday, January 07, 2011 2:46 PM
To: linux-s...@vger.kernel.org; open-iscsi@googlegroups.com
Cc: Karen Xie; james.bottom...@hansenpartnership.com;
micha...@cs.wisc.edu
Subject: [PATCH 1/2] cxgbi: set ulpmode only if digest is on

[PATCH 1/2] cxgbi: set ulpmode only if digest is on

From: Karen Xie 

There is need to set ulpmode on the tx skbs if no digest is enabled.

Signed-off-by: Karen Xie 
---
 drivers/scsi/cxgbi/libcxgbi.c |   17 ++---
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/cxgbi/libcxgbi.c
b/drivers/scsi/cxgbi/libcxgbi.c
index be56617..17dcada 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1908,13 +1908,16 @@ EXPORT_SYMBOL_GPL(cxgbi_conn_alloc_pdu);
 
 static inline void tx_skb_setmode(struct sk_buff *skb, int hcrc, int
dcrc)
 {
-   u8 submode = 0;
-
-   if (hcrc)
-   submode |= 1;
-   if (dcrc)
-   submode |= 2;
-   cxgbi_skcb_ulp_mode(skb) = (ULP2_MODE_ISCSI << 4) | submode;
+   if (hcrc || dcrc) {
+   u8 submode = 0;
+
+   if (hcrc)
+   submode |= 1;
+   if (dcrc)
+   submode |= 2;
+   cxgbi_skcb_ulp_mode(skb) = (ULP2_MODE_ISCSI << 4) |
submode;
+   } else
+   cxgbi_skcb_ulp_mode(skb) = 0;
 }
 
 int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,

-- 
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.



RE: [PATCH] cxgbi: bug fixes and code cleanup

2010-09-22 Thread Karen Xie
Thanks, Mike.
I will fix the patch and break it into per change.
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Wednesday, September 22, 2010 1:10 PM
To: Karen Xie
Cc: net...@vger.kernel.org; linux-s...@vger.kernel.org;
open-iscsi@googlegroups.com; Rakesh Ranjan;
james.bottom...@hansenpartnership.com; da...@davemloft.net
Subject: Re: [PATCH] cxgbi: bug fixes and code cleanup

On 09/21/2010 11:09 AM, k...@chelsio.com wrote:
> [PATCH] cxgbi: bug fixes and code cleanup
>
> From: Karen Xie
>
> 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.

Could you break up the patch into a patch per change next time?


> - read_lock(&csk->callback_lock);
>   dskb = skb_peek(&csk->receive_queue);
>   if (!dskb) {
>
read_unlock(&csk->callback_lock);

I think you also have to remove this read_unlock call.

-- 
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.



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

2010-08-12 Thread Karen Xie
Thanks,

Will use pr_xxx instead.

Karen

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

On Thu, 2010-08-12 at 19:57 -0700, k...@chelsio.com wrote:
> [PATCH v2 1/3] libcxgbi: common library for cxgb3i and cxgb4i
[]
> +#define libcxgbi_log_error   cxgbi_dbg_error
> +#define libcxgbi_log_warncxgbi_dbg_warn
> +#define libcxgbi_log_infocxgbi_dbg_info
> +#define libcxgbi_log_debug(flag, fmt, args...) \
> + cxgbi_dbg_print(flag, fmt, ## args)

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

[]

> +#define cxgbi_dbg_print(level, fmt, args...) \
> + do {\
> + if (dbg_level & (level)) \
> + printk(KERN_INFO "cxgbi: %s - " fmt, \
> + __func__ , ## args); \
> + } while (0)
> +#define  cxgbi_dbg_error(fmt, args...) \
> + printk(KERN_ERR "cxgbi: ERR! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_warn(fmt, args...) \
> + printk(KERN_WARNING "cxgbi: WARN! %s, " fmt, __func__ , ## args)
> +#define cxgbi_dbg_info(fmt, args...) \
> + printk(KERN_INFO "cxgbi: %s, " fmt, __func__ , ## args)


-- 
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.



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

2010-08-11 Thread Karen Xie
Sure, I will move the callouts for both iscsi_transport and
scsi_host_template to LLD.

Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Wednesday, August 11, 2010 11:28 AM
To: open-iscsi@googlegroups.com
Cc: Karen Xie; linux-ker...@vger.kernel.org; linux-s...@vger.kernel.org;
Rakesh Ranjan; james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 1/3] libcxgbi: common library for cxgb3i and cxgb4i

On 08/09/2010 12:53 PM, k...@chelsio.com wrote:
> +void cxgbi_fill_iscsi_transport(struct iscsi_transport *itp)
> +{
> + /* owner and name should be set already */
> + itp->caps   = CAP_RECOVERY_L0 | CAP_MULTI_R2T |
CAP_HDRDGST
> + | CAP_DATADGST | CAP_DIGEST_OFFLOAD |
> + CAP_PADDING_OFFLOAD;
> + itp->param_mask = ISCSI_MAX_RECV_DLENGTH |
> + ISCSI_MAX_XMIT_DLENGTH |
> + ISCSI_HDRDGST_EN |
> + ISCSI_DATADGST_EN |
> + ISCSI_INITIAL_R2T_EN |
> + ISCSI_MAX_R2T |
> + ISCSI_IMM_DATA_EN |
> + ISCSI_FIRST_BURST |
> + ISCSI_MAX_BURST |
> + ISCSI_PDU_INORDER_EN |
> + ISCSI_DATASEQ_INORDER_EN |
> + ISCSI_ERL |
> + ISCSI_CONN_PORT |
> + ISCSI_CONN_ADDRESS |
> + ISCSI_EXP_STATSN |
> + ISCSI_PERSISTENT_PORT |
> + ISCSI_PERSISTENT_ADDRESS |
> + ISCSI_TARGET_NAME | ISCSI_TPGT |
> + ISCSI_USERNAME | ISCSI_PASSWORD |
> + ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN |
> + ISCSI_FAST_ABORT | ISCSI_ABORT_TMO |
> + ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO
|
> + ISCSI_PING_TMO | ISCSI_RECV_TMO |
> + ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME;
> + itp->host_param_mask= ISCSI_HOST_HWADDRESS |
ISCSI_HOST_IPADDRESS |
> + ISCSI_HOST_INITIATOR_NAME |
> + ISCSI_HOST_NETDEV_NAME;
> + itp->get_host_param = cxgbi_get_host_param;
> + itp->set_host_param = cxgbi_set_host_param;
> + /* session management */
> + itp->create_session = cxgbi_create_session;
> + itp->destroy_session= cxgbi_destroy_session;
> + itp->get_session_param  = iscsi_session_get_param;
> + /* connection management */
> + itp->create_conn= cxgbi_create_conn;
> + itp->bind_conn  = cxgbi_bind_conn;
> + itp->destroy_conn   = iscsi_tcp_conn_teardown;
> + itp->start_conn = iscsi_conn_start;
> + itp->stop_conn  = iscsi_conn_stop;
> + itp->get_conn_param = cxgbi_get_conn_param;
> + itp->set_param  = cxgbi_set_conn_param;
> + itp->get_stats  = cxgbi_get_conn_stats;
> + /* pdu xmit reqitp->  from user space */
> + itp->send_pdu   = iscsi_conn_send_pdu;
> + /* task */
> + itp->init_task  = iscsi_tcp_task_init;
> + itp->xmit_task  = iscsi_tcp_task_xmit;
> + itp->cleanup_task   = cxgbi_cleanup_task;
> +
> + /* pdu */
> + itp->alloc_pdu  = cxgbi_conn_alloc_pdu;
> + itp->init_pdu   = cxgbi_conn_init_pdu;
> + itp->xmit_pdu   = cxgbi_conn_xmit_pdu;
> + itp->parse_pdu_itt  = cxgbi_parse_pdu_itt;
> +
> + /* TCP connect/disconnect */
> + itp->ep_connect = cxgbi_ep_connect;
> + itp->ep_poll= cxgbi_ep_poll;
> + itp->ep_disconnect  = cxgbi_ep_disconnect;
> + /* Error recovery timeout call */
> + itp->session_recovery_timedout =
iscsi_session_recovery_timedout;
> +}
> +EXPORT_SYMBOL_GPL(cxgbi_fill_iscsi_transport);
> +
> +void cxgbi_fill_scsi_host_template(struct scsi_host_template *sht)
> +{
> + /*
> +  * the following fields should be set already:
> +  * module; name, proc_name, can_queue
> +  */
> + sht->queuecommand   = iscsi_queuecommand;
> + sht->change_queue_depth = iscsi_change_queue_depth;
> + sht->sg_tablesize   = SG_ALL;
> + sht->max_sectors= 0x;
> + sht->cmd_per_lun= ISCSI_DEF_CMD_PER_LUN;
> + sht->eh_abort_handler   = iscsi_eh_abort;
> + sht->eh_device_reset_handl

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

2010-08-11 Thread Karen Xie
Yes, you are right. I will fix it to make sure iscsi transport
registration happens only once.
Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Wednesday, August 11, 2010 11:38 AM
To: open-iscsi@googlegroups.com
Cc: Karen Xie; linux-ker...@vger.kernel.org; linux-s...@vger.kernel.org;
Rakesh Ranjan; james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/3] cxgb4i v5: iscsi driver

On 08/09/2010 12:53 PM, k...@chelsio.com wrote:
> +
> +static void *t4_uld_add(const struct cxgb4_lld_info *lldi)
> +{
> + struct cxgbi_device *cdev;
> + struct port_info *pi;
> + int i, rc;
> +
> + cxgb4i_log_info("%s", version);
> +
> + cdev = cxgbi_device_register(sizeof(*lldi), lldi->nports);
> + if (!cdev) {
> + cxgb4i_log_info("t4 device 0x%p, register failed.\n",
lldi);
> + return NULL;
> + }
> + cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
> + "t4 0x%p,0x%x, ports %u,%s, chan %u, q %u,%u, wr
%u.\n",
> + cdev, lldi->adapter_type, lldi->nports,
> + lldi->ports[0]->name, lldi->nchan, lldi->ntxq,
> + lldi->nrxq, lldi->wr_cred);
> + for (i = 0; i<  lldi->nrxq; i++)
> + cxgb4i_log_debug(1<<  CXGBI_DBG_DEV,
> + "t4 0x%p, rxq id #%d: %u.\n",
> + cdev, i, lldi->rxq_ids[i]);
> +
> + memcpy(cxgbi_cdev_priv(cdev), lldi, sizeof(*lldi));
> + cdev->flags = CXGBI_FLAG_DEV_T4;
> + cdev->pdev = lldi->pdev;
> + cdev->ports = lldi->ports;
> + cdev->nports = lldi->nports;
> + cdev->mtus = lldi->mtus;
> + cdev->nmtus = NMTUS;
> + cdev->snd_win = cxgb4i_snd_win;
> + cdev->rcv_win = cxgb4i_rcv_win;
> + cdev->rx_credit_thres = cxgb4i_rx_credit_thres;
> + cdev->skb_tx_rsvd = CXGB4I_TX_HEADER_LEN;
> + cdev->skb_rx_extra = sizeof(struct cpl_iscsi_hdr);
> + cdev->itp =&cxgb4i_iscsi_transport;
> +
> + rc = cxgbi_iscsi_init(cdev);
> + if (rc) {
> + cxgb4i_log_info("t4 0x%p iscsi init failed\n", cdev);
> + goto err_out;
> + }

For each LLD (cxgb3i and cxgb4i) could it get called more than once? I 
mean if you had multiple cxgb3i HBAs could it get called once for each 
or is it called just once time for all cxgb3i hbas? If more than once 
the cxgbi_iscsi_init call to iscsi_register_transport would fail on the 
second call, because the iscsi class would not allow you to register the

same transport twice.

-- 
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.



RE: [PATCH 2/3] cxgb4i: main driver files

2010-04-13 Thread Karen Xie
Hi, Mike,

Yes, will do that for the next submission.

Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Tuesday, April 13, 2010 1:42 PM
To: open-iscsi@googlegroups.com
Cc: Rakesh Ranjan; net...@vger.kernel.org; linux-s...@vger.kernel.org;
linux-ker...@vger.kernel.org; Karen Xie; da...@davemloft.net;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/3] cxgb4i: main driver files

On 04/08/2010 07:14 AM, Rakesh Ranjan wrote:
> +static inline int cxgb4i_ddp_gl_map(struct pci_dev *pdev,
> + struct cxgb4i_gather_list *gl)
> +{
> + int i;
> +
> + for (i = 0; i<  gl->nelem; i++) {
> + gl->phys_addr[i] = pci_map_page(pdev, gl->pages[i], 0,
> + PAGE_SIZE,

Hey Rakesh,

I guess we are trying to move away from the pci mapping functions move 
to the dma ones. On your next submission, could you fix those up too?

-- 
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.



RE: [PATCH 02/11] qla4xxx: added IPv6 support.

2010-04-06 Thread Karen Xie
Hi, Mike,

Yeah, the cxgb3i does have the limitation of offloading ipv4 only. Would
it be possible to have separate param for ipv4 and ipv6?

Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Tuesday, April 06, 2010 8:44 PM
To: ravi.anand
Cc: James Bottomley; Linux-SCSI Mailing List; Vikas Chaudhary;
open-iscsi; Karen Xie; Jayamohan Kalickal
Subject: Re: [PATCH 02/11] qla4xxx: added IPv6 support.

On 04/06/2010 05:21 AM, ravi.anand wrote:
>
> On Feb 1, 2010, at 10:15 AM, Mike Christie wrote:
>
>> On 01/30/2010 12:28 AM, Ravi Anand wrote:
>>>
>>
>>> + DEBUG2(dev_info(&ha->pdev->dev, "%s: DDB[%d] osIdx = %d "
>>> + "State %04x ConnErr %08x "
>>> + NIPQUAD_FMT ":%04d \"%s\"\n",
>>
>>
>> Do you go down this path for ipv6 (looked like it did and did in
other
>> places)? NIPQUAD_FMT will not work, and we are trying to not use it
>> NIPQUAD_FMT/NIPQUAD. See %pI4 use in qla4xxx_conn_get_param. There is
>> also a %pI6 for ipv6.
>>
>> Also you need to update qla4xxx_conn_get_param and
>> qla4xxx_host_get_param ip handling.
>>>
>>
>
> While trying to address the IPV6 part for conn_get_param() and
> host_get_param(), we ran into
> the dilemma how to populate IPV4 and IPV6 address at the same time.
> Currently on our adapter IPV4 and IPV6 can be enabled at the same time
> and can be active.
>
> So we wanted to find out if for following param mask :
>
> ISCSI_HOST_PARAM_IPADDRESS
>
> should we just fill the buffer for IPV4 and IPV6 address or should
> we need define new param mask sepeartely for IPV6 ?
>
> Basically we will like to follow up with another patch to address this
part
> on to of the patches which we have just pushed.
>

Right now iscsi_tcp supports ipv4 and ipv6 for that param. I think 
people have been saying it might be easier to break it up into a ipv4 
and ipv6 param.

Karen, it seems like you are only supporting ipv4 right now. Any
thoughts?

Jay, it seems be2iscsi handling is incorrect. Is your driver supporting 
ipv6 right now?

-- 
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.



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

2009-12-09 Thread Karen Xie

Hi, thanks, Mike.

It looks like the original patch somehow did not make into the linux-scsi list 
at all for some reason: tried to search for it but could not find it.

We are re-submitting it just to make sure.

Best regards,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu]
Sent: Mon 12/7/2009 8:34 AM
To: open-iscsi@googlegroups.com
Cc: james.bottom...@hansenpartnership.com; da...@davemloft.net; Steve Wise; 
Karen Xie; linux-s...@vger.kernel.org; linux-ker...@vger.kernel.org; 
net...@vger.kernel.org; Rakesh Ranjan
Subject: Re: [PATCH 1/1] cxgb3i: Fix a login over vlan issue
 
Rakesh Ranjan wrote:
> 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 
> Signed-off-by: Rakesh Ranjan 
> ---
>  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 c1d5be4..66d52e4 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 -1;
>  }
>  
> +/**
> + * 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 +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(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,


Looks sane. I am not a expert on the networks apis being used though.


--

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.




RE: [PATCH v2 0/2] cxgb3/cxgb3i: added support of private MAC address and provisioning packet handler for iSCSI

2009-09-26 Thread Karen Xie

Thanks, understood.

We are submitting a new version that would be isolated to changes to the
net driver only and would not affect scsi driver.

Thanks a lot.
Karen

-Original Message-
From: David Miller [mailto:da...@davemloft.net] 
Sent: Saturday, September 26, 2009 12:17 AM
To: Karen Xie
Cc: micha...@cs.wisc.edu; james.bottom...@hansenpartnership.com; Steve
Wise; Divy Le Ray; Rakesh Ranjan; linux-s...@vger.kernel.org;
open-iscsi@googlegroups.com; linux-ker...@vger.kernel.org;
net...@vger.kernel.org
Subject: Re: [PATCH v2 0/2] cxgb3/cxgb3i: added support of private MAC
address and provisioning packet handler for iSCSI

From: "Karen Xie" 
Date: Fri, 25 Sep 2009 15:34:22 -0700

> Hmm, I am wondering how could this merge activity to be coordinated?
If
> only the driver/scsi change is merged, then it won't compile either,
> since it requires the driver/net change.

That's rediculious, frankly.

Since they are two seperate changes you are knowingly creating
a bisection point that will not work.  That's wrong.

You need to split up the changes so that each and every one of them
are independant and the tree can be checked out at either of them and
everything can be expected to work.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [PATCH v2 0/2] cxgb3/cxgb3i: added support of private MAC address and provisioning packet handler for iSCSI

2009-09-25 Thread Karen Xie

Hmm, I am wondering how could this merge activity to be coordinated? If
only the driver/scsi change is merged, then it won't compile either,
since it requires the driver/net change.

Is it possible to merge both patches to the scsi or net tree?

Thanks,
Karen

-Original Message-
From: David Miller [mailto:da...@davemloft.net] 
Sent: Friday, September 25, 2009 3:25 PM
To: Karen Xie
Cc: micha...@cs.wisc.edu; james.bottom...@hansenpartnership.com; Steve
Wise; Divy Le Ray; Rakesh Ranjan; linux-s...@vger.kernel.org;
open-iscsi@googlegroups.com; linux-ker...@vger.kernel.org;
net...@vger.kernel.org
Subject: Re: [PATCH v2 0/2] cxgb3/cxgb3i: added support of private MAC
address and provisioning packet handler for iSCSI

From: k...@chelsio.com
Date: Fri, 25 Sep 2009 15:25:36 -0700

> From: Karen Xie 
> 
> The two patches added support of private MAC address, which is derived
from
> the network (i.e., public) MAC address, and provisioning packet
handler for
> iSCSI traffic only.

I think I'm going to ask you to resubmit the drivers/net patch
after the necessary drivers/scsi changes get merged by the scsi
folks.

Thank you.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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

2009-06-27 Thread Karen Xie

James & Mike,

Yes, I will cc netdev list next time if there is anything related to the 
networking.

James, thanks for fixing up the patch. I was using a older tree sorry about it.

Thanks,
Karen


-Original Message-
From: James Bottomley [mailto:james.bottom...@hansenpartnership.com]
Sent: Sat 6/27/2009 10:55 AM
To: Mike Christie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org; Karen Xie
Subject: Re: [PATCH 2.6.30-rc] cxgb3i -- fixed connection error when vlan is 
enabled
 
On Sat, 2009-06-27 at 12:52 -0500, Mike Christie wrote:
> On 06/26/2009 05:17 PM, k...@chelsio.com wrote:
> > [PATCH 2.6.30-rc] cxgb3i -- fixed connection error when vlan is enabled
> >
> > From: Karen Xie
> >
> > 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
> > ---
> >
> >   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
> >   #include
> > +#include
> >   #include
> >   #include
> >   #include
> > @@ -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++) {
> >
> 
> It looks ok, but when touching network stuff you might want to cc the 
> netdev list in the future. Well, maybe for non-trivial stuff at least. 
> This might be fine.
> 
> Reviewed-by: Mike Christie 

Thanks, but actually this patch gives a rejection here because of a
commit made by Herbert Xu which is already in mainline:

commit f00a3328bf9ecff46abd68a421693ba71cd16fc8
Author: Herbert Xu 
Date:   Sat May 30 13:40:04 2009 +1000

[SCSI] cxgb3i: Include net/dst.h for struct dst_cache

It's simple enough to fix up, so I did it, but next time could you
(Karen) check your patches against the relevant trees to make sure
they're up to date.

James




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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

2009-06-15 Thread Karen Xie

Hi, James,

Thanks, I've re-submitted the patches to use kref instead.

Best regards,
Karen

-Original Message-
From: James Bottomley [mailto:james.bottom...@hansenpartnership.com] 
Sent: Saturday, June 13, 2009 4:53 PM
To: Karen Xie
Cc: linux-s...@vger.kernel.org; open-iscsi@googlegroups.com;
micha...@cs.wisc.edu
Subject: Re: [PATCH 1/2 2.6.30-rc] cxgb3i -- add a refcnt to track ddp
usage

On Sat, 2009-06-13 at 14:29 -0700, k...@chelsio.com wrote:
> [PATCH 1/2 2.6.30-rc] cxgb3i -- add a refcnt to track ddp usage
> 
> From: Karen Xie 
> 
> 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.

The code is fine as it stands but, I wonder, would you consider using a
kref for this?  The reasons are twofold:

 1. It's a well understood kernel paradigm that works ... this would
be helpful for the far distant time when chelsio no longer wants
to maintain this driver.
 2. It includes useful and appropriate warnings for common bugs in
refcounted code, such as use of a freed reference.

James



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver.

2009-05-06 Thread Karen Xie


-Original Message-
From: netdev-ow...@vger.kernel.org [mailto:netdev-ow...@vger.kernel.org]
On Behalf Of Mike Christie
Sent: Wednesday, May 06, 2009 9:49 AM
To: open-iscsi@googlegroups.com
Cc: da...@davemloft.net; james.bottom...@hansenpartnership.com;
net...@vger.kernel.org; linux-s...@vger.kernel.org; Karen Xie; Jayamohan
Kalickal
Subject: Re: [PATCH 4/4] bnx2i: Add bnx2i iSCSI driver.


> +
> +/**
> + * bnx2i_nl_mesg_recv -
> + * @buf: pointer to buffer containing vendor specific message
> + * @buf: buffer length
> + *
> + */
> +static int bnx2i_nl_mesg_recv(struct Scsi_Host *shost, uint16_t
priv_op,
> +   int status, char *buf, int buflen)
> +{
> + struct bnx2i_hba *hba = iscsi_host_priv(shost);
> +
> + switch (priv_op) {
> + case NX2_UIO_UEVENT_NEIGH_LOOKUP:
> + default:
> + /* handle by cnic driver */
> + hba->cnic->nl_priv_msg_recv(hba->cnic, priv_op, buf,
buflen);
> + break;
> + }
> +
> + return buflen;
> +}

I think I was wrong with one of the comments I gave you.

It seems like we have two iscsi net config models.

1. qla4xxx and Server Engines type of setup where the driver just tells 
the card to use some ip or do dhcp and some other net settings and it 
does all the net magic. The iscsi driver does not have to worry about 
anything like the dhcp process or arp. It only passes down the setup
values.

2. cxgb3i and bnx2i type of model where kernel or userspace code is 
needed to execute many net operations.
- Right now, cxgb3i sort of cheated :) and only supports static IPs. It 
currently uses the iscsi set param interface to do this.

- bnx2i wants to add more complicated features and is going to do them 
in userspace. It us using the private messages that were added in the 
previous patch.


I think cxgb3i is one day going to want to support the same features 
bnx2i does. If that is right, then should we just make the NX2_UIO 
events common iscsi events, and hook cxb3i in? It would not use the 
iscsi set param interface at all and would work just like bnx2i. Is that

possible? What about future drivers? Are done making iscsi cards and 
drivers. If so, thank goodness :)  If not then maybe we want to consider

some future driver using the #2 module and possibly using this.

[Karen] for cxgb3i, we are looking into support dynamic IP, so making
the events common to iscsi would be helpful.

If cxgb3i is really only going to support static ip setup and we think 
that bnx2i is going to be unique on how it sets up the network then I 
NX2_UIO private events are fine. Or is this a case of we are thinking 
that iscsi hardware people are creating crazy interfaces so there is no 
why to predict what they are going to do so there is no point in trying 
to design for them.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Data Digest always None during iBFT based boot

2009-04-09 Thread Karen Xie
Hi,
 
Data digest is always offered as None, even for iBFT based boot
sessions started by iscsistart. I was trying to boot RHEL5 U3, and it
installs and boots fine to the iSCSI LUN, with Header digest on, and
Data digest off.
 
But if the Target always requires Data digests on, the login will fail
with a non-retryable login failure error.
 
My suggestion would be to always offer Header and Data digests, with a
preference for them off, atleast in the boot scenario, since we don't
know what the target will require, and the user does not have any
means of configuring it with configuration files, for the boot case.
 
I edited the iscsistart.c in the 2.0-870.3, and added the default
behavior to offer Header and Data digests as None,CRC32C, and it boots
fine after that.
 
Also noticed another issue on RHEL 5 U3, where iscsistart looks for /
dev/mem, and the mkinitrd on that does not create it dynamically after
mounting /dev on tmpfs. Edited the init script in the initrd and
rebuilt it for that.
 
There's probably a better place to put these additions, but to affect
the default behavior only in the boot case, I put it here.
 
Here's the diff for iscsistart.c on the git code as of today
 
$ diff -p  open-iscsi/usr/iscsistart.c iscsistart.c
*** open-iscsi/usr/iscsistart.c 2009-04-09 13:29:10.0 +0530 
--- iscsistart.c2009-04-09 13:20:10.0 +0530
*** static int setup_session(void)
*** 182,187 
--- 182,190 
strlcpy((char *)auth->password_in, context-
>chap_password_in,
sizeof(context->chap_password_in));
auth->password_in_length = strlen((char *)auth-
>password_in);
+   // always offer both for boot targets..
+   config_rec.conn[0].iscsi.HeaderDigest =
CONFIG_DIGEST_PREFER_OFF;
+   config_rec.conn[0].iscsi.DataDigest =
CONFIG_DIGEST_PREFER_OFF;
 
rc2 = login_session();
if (rc2)

 


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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

2009-04-07 Thread Karen Xie

Yes, the ddp map is per-adapter.

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Mike Christie
Sent: Tuesday, April 07, 2009 1:11 PM
To: open-iscsi@googlegroups.com
Subject: Re: [PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth


Karen Xie wrote:
> 
> 
> -Original Message-
> From: Mike Christie [mailto:micha...@cs.wisc.edu] 
> Sent: Tuesday, April 07, 2009 9:00 AM
> To: open-iscsi@googlegroups.com
> Cc: Karen Xie
> Subject: Re: [PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth
> 
> Mike Christie wrote:
>> k...@chelsio.com wrote:
>>> [PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth
>>>
>>> From: Karen Xie 
>>>
>>> From: Karen Xie 
>>>
>>> Bump the command queue depth.
>>>
>>> Signed-off-by: Karen Xie 
>>> ---
>>> ---
>>>
>>>  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 \
>>>
>> Is there a max number of iscsi pdus or scsi commands or skbs or max 
>> number of bytes that we can send to the card?
> 
> [Karen] There are per-connection limits but they are more related to
the
> tcp layer (say send and receive windows).
> 
> Also is there a limit for each port/scsi_host?
> 
> [Karen] The hardware actually does not maintain any iscsi/scsi related
> state. For IOs, there is data memory map for directly DMAing data to
the
> scsi data buffer (for read). But the memory map is not organized
> according to # of IOs but rather it is related to the total numbers of
> data buffers.
> 

This is the ddp map, right? And that is snic wide (it is not port wide)?



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



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

2009-04-07 Thread Karen Xie



-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Tuesday, April 07, 2009 9:00 AM
To: open-iscsi@googlegroups.com
Cc: Karen Xie
Subject: Re: [PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth

Mike Christie wrote:
> k...@chelsio.com wrote:
>> [PATCH 1/1 2.6.30] cxgb3i -- increase command queue depth
>>
>> From: Karen Xie 
>>
>> From: Karen Xie 
>>
>> Bump the command queue depth.
>>
>> Signed-off-by: Karen Xie 
>> ---
>> ---
>>
>>  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_DFLT 128
>> +#define CXGB3I_SCSI_QDEPTH_DFLT 1024
>>  #define CXGB3I_MAX_TARGET   CXGB3I_MAX_CONN
>>  #define CXGB3I_MAX_LUN  512
>>  #define ISCSI_PDU_NONPAYLOAD_MAX \
>>
> 
> Is there a max number of iscsi pdus or scsi commands or skbs or max 
> number of bytes that we can send to the card?

[Karen] There are per-connection limits but they are more related to the
tcp layer (say send and receive windows).

Also is there a limit for each port/scsi_host?

[Karen] The hardware actually does not maintain any iscsi/scsi related
state. For IOs, there is data memory map for directly DMAing data to the
scsi data buffer (for read). But the memory map is not organized
according to # of IOs but rather it is related to the total numbers of
data buffers.

--~--~-~--~~~---~--~~
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.6.30] cxgb3i -- merge cxgb3i_ddp into cxgb3i module

2009-03-07 Thread Karen Xie

[PATCH 2.6.30] cxgb3i -- merge cxgb3i_ddp into cxgb3i module

From: Karen Xie 

- Merge cxgb3i_ddp.ko to cxgb3i.ko as there is no other users.
- Bump the driver version up to 1.0.2.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/Kbuild   |4 +-
 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   63 ++
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |3 ++
 drivers/scsi/cxgb3i/cxgb3i_init.c|6 ++-
 drivers/scsi/cxgb3i/cxgb3i_offload.h |2 +
 5 files changed, 21 insertions(+), 57 deletions(-)


diff --git a/drivers/scsi/cxgb3i/Kbuild b/drivers/scsi/cxgb3i/Kbuild
index ee7d6d2..25a2032 100644
--- a/drivers/scsi/cxgb3i/Kbuild
+++ b/drivers/scsi/cxgb3i/Kbuild
@@ -1,4 +1,4 @@
 EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3
 
-cxgb3i-y := cxgb3i_init.o cxgb3i_iscsi.o cxgb3i_pdu.o cxgb3i_offload.o
-obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i_ddp.o cxgb3i.o
+cxgb3i-y := cxgb3i_init.o cxgb3i_iscsi.o cxgb3i_pdu.o cxgb3i_offload.o 
cxgb3i_ddp.o
+obj-$(CONFIG_SCSI_CXGB3_ISCSI) += cxgb3i.o
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index bb1eebf..275d2da 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -23,19 +23,6 @@
 
 #include "cxgb3i_ddp.h"
 
-#define DRV_MODULE_NAME "cxgb3i_ddp"
-#define DRV_MODULE_VERSION  "1.0.0"
-#define DRV_MODULE_RELDATE  "Dec. 1, 2008"
-
-static char version[] =
-   "Chelsio S3xx iSCSI DDP " DRV_MODULE_NAME
-   " v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
-
-MODULE_AUTHOR("Karen Xie ");
-MODULE_DESCRIPTION("cxgb3i ddp pagepod manager");
-MODULE_LICENSE("GPL");
-MODULE_VERSION(DRV_MODULE_VERSION);
-
 #define ddp_log_error(fmt...) printk(KERN_ERR "cxgb3i_ddp: ERR! " fmt)
 #define ddp_log_warn(fmt...)  printk(KERN_WARNING "cxgb3i_ddp: WARN! " fmt)
 #define ddp_log_info(fmt...)  printk(KERN_INFO "cxgb3i_ddp: " fmt)
@@ -212,7 +199,6 @@ int cxgb3i_ddp_find_page_index(unsigned long pgsz)
ddp_log_debug("ddp page size 0x%lx not supported.\n", pgsz);
return DDP_PGIDX_MAX;
 }
-EXPORT_SYMBOL_GPL(cxgb3i_ddp_find_page_index);
 
 static inline void ddp_gl_unmap(struct pci_dev *pdev,
struct cxgb3i_gather_list *gl)
@@ -335,7 +321,6 @@ error_out:
kfree(gl);
return NULL;
 }
-EXPORT_SYMBOL_GPL(cxgb3i_ddp_make_gl);
 
 /**
  * cxgb3i_ddp_release_gl - release a page buffer list
@@ -349,7 +334,6 @@ void cxgb3i_ddp_release_gl(struct cxgb3i_gather_list *gl,
ddp_gl_unmap(pdev, gl);
kfree(gl);
 }
-EXPORT_SYMBOL_GPL(cxgb3i_ddp_release_gl);
 
 /**
  * cxgb3i_ddp_tag_reserve - set up ddp for a data transfer
@@ -431,7 +415,6 @@ unmark_entries:
ddp_unmark_entries(ddp, idx, npods);
return err;
 }
-EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_reserve);
 
 /**
  * cxgb3i_ddp_tag_release - release a ddp tag
@@ -469,7 +452,6 @@ void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
ddp_log_error("ddp tag 0x%x, idx 0x%x > max 0x%x.\n",
  tag, idx, ddp->nppods);
 }
-EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_release);
 
 static int setup_conn_pgidx(struct t3cdev *tdev, unsigned int tid, int pg_idx,
int reply)
@@ -510,7 +492,6 @@ int cxgb3i_setup_conn_host_pagesize(struct t3cdev *tdev, 
unsigned int tid,
 {
return setup_conn_pgidx(tdev, tid, page_idx, reply);
 }
-EXPORT_SYMBOL_GPL(cxgb3i_setup_conn_host_pagesize);
 
 /**
  * cxgb3i_setup_conn_pagesize - setup the conn.'s ddp page size
@@ -527,7 +508,6 @@ int cxgb3i_setup_conn_pagesize(struct t3cdev *tdev, 
unsigned int tid,
 
return setup_conn_pgidx(tdev, tid, pgidx, reply);
 }
-EXPORT_SYMBOL_GPL(cxgb3i_setup_conn_pagesize);
 
 /**
  * cxgb3i_setup_conn_digest - setup conn. digest setting
@@ -563,7 +543,6 @@ int cxgb3i_setup_conn_digest(struct t3cdev *tdev, unsigned 
int tid,
cxgb3_ofld_send(tdev, skb);
return 0;
 }
-EXPORT_SYMBOL_GPL(cxgb3i_setup_conn_digest);
 
 
 /**
@@ -606,7 +585,6 @@ int cxgb3i_adapter_ddp_info(struct t3cdev *tdev,
 *txsz, ddp->max_txsz, *rxsz, ddp->max_rxsz);
return 0;
 }
-EXPORT_SYMBOL_GPL(cxgb3i_adapter_ddp_info);
 
 /**
  * ddp_release - release the cxgb3 adapter's ddp resource
@@ -651,7 +629,6 @@ static void ddp_init(struct t3cdev *tdev)
struct ulp_iscsi_info uinfo;
unsigned int ppmax, bits;
int i, err;
-   static int vers_printed;
 
if (tdev->ulp_iscsi) {
ddp_log_warn("t3dev 0x%p, ddp 0x%p already set up.\n",
@@ -659,11 +636,6 @@ static void ddp_init(struct t3cdev *tdev)
return;
}
 
-   if (!vers_printed) {
-   printk(KERN_INFO "%s", version);
-   vers_printed = 1;
-   }
-
err = tdev-

[PATCH 5/5 2.6.30] cxgb3i - close all tcp connections upon chip reset

2009-02-26 Thread Karen Xie

[PATCH 5/5 2.6.30] cxgb3i - close all tcp connections upon chip reset

From: Karen Xie 

Keep track of offloaded tcp connections per adapter. Close all of the
connections upon reset.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_offload.c |  101 ++
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   11 ++--
 2 files changed, 71 insertions(+), 41 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index c2e434e..4d8654c 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -94,29 +94,30 @@ static int c3cn_get_port(struct s3_conn *c3cn, struct 
cxgb3i_sdev_data *cdata)
if (!cdata)
goto error_out;
 
-   if (c3cn->saddr.sin_port != 0) {
-   idx = ntohs(c3cn->saddr.sin_port) - cxgb3_sport_base;
-   if (idx < 0 || idx >= cxgb3_max_connect)
-   return 0;
-   if (!test_and_set_bit(idx, cdata->sport_map))
-   return -EADDRINUSE;
+   if (c3cn->saddr.sin_port) {
+   cxgb3i_log_error("connect, sin_port NON-ZERO %u.\n",
+c3cn->saddr.sin_port);
+   return -EADDRINUSE;
}
 
-   /* the sport_map_next may not be accurate but that is okay, sport_map
-  should be */
-   start = idx = cdata->sport_map_next;
+   spin_lock_bh(&cdata->lock);
+   start = idx = cdata->sport_next;
do {
if (++idx >= cxgb3_max_connect)
idx = 0;
-   if (!(test_and_set_bit(idx, cdata->sport_map))) {
+   if (!cdata->sport_conn[idx]) {
c3cn->saddr.sin_port = htons(cxgb3_sport_base + idx);
-   cdata->sport_map_next = idx;
+   cdata->sport_next = idx;
+   cdata->sport_conn[idx] = c3cn;
+   spin_unlock_bh(&cdata->lock);
+
c3cn_conn_debug("%s reserve port %u.\n",
cdata->cdev->name,
cxgb3_sport_base + idx);
return 0;
}
} while (idx != start);
+   spin_unlock_bh(&cdata->lock);
 
 error_out:
return -EADDRNOTAVAIL;
@@ -124,15 +125,19 @@ error_out:
 
 static void c3cn_put_port(struct s3_conn *c3cn)
 {
-   struct cxgb3i_sdev_data *cdata = CXGB3_SDEV_DATA(c3cn->cdev);
+   if (!c3cn->cdev)
+   return;
 
if (c3cn->saddr.sin_port) {
+   struct cxgb3i_sdev_data *cdata = CXGB3_SDEV_DATA(c3cn->cdev);
int idx = ntohs(c3cn->saddr.sin_port) - cxgb3_sport_base;
 
c3cn->saddr.sin_port = 0;
if (idx < 0 || idx >= cxgb3_max_connect)
return;
-   clear_bit(idx, cdata->sport_map);
+   spin_lock_bh(&cdata->lock);
+   cdata->sport_conn[idx] = NULL;
+   spin_unlock_bh(&cdata->lock);
c3cn_conn_debug("%s, release port %u.\n",
cdata->cdev->name, cxgb3_sport_base + idx);
}
@@ -1305,11 +1310,7 @@ static void c3cn_release_offload_resources(struct 
s3_conn *c3cn)
struct t3cdev *cdev = c3cn->cdev;
unsigned int tid = c3cn->tid;
 
-   if (!cdev)
-   return;
-
c3cn->qset = 0;
-
c3cn_free_cpl_skbs(c3cn);
 
if (c3cn->wr_avail != c3cn->wr_max) {
@@ -1317,18 +1318,22 @@ static void c3cn_release_offload_resources(struct 
s3_conn *c3cn)
reset_wr_list(c3cn);
}
 
-   if (c3cn->l2t) {
-   l2t_release(L2DATA(cdev), c3cn->l2t);
-   c3cn->l2t = NULL;
-   }
-
-   if (c3cn->state == C3CN_STATE_CONNECTING) /* we have ATID */
-   s3_free_atid(cdev, tid);
-   else {  /* we have TID */
-   cxgb3_remove_tid(cdev, (void *)c3cn, tid);
-   c3cn_put(c3cn);
+   if (cdev) {
+   if (c3cn->l2t) {
+   l2t_release(L2DATA(cdev), c3cn->l2t);
+   c3cn->l2t = NULL;
+   }
+   if (c3cn->state == C3CN_STATE_CONNECTING)
+   /* we have ATID */
+   s3_free_atid(cdev, tid);
+   else {
+   /* we have TID */
+   cxgb3_remove_tid(cdev, (void *)c3cn, tid);
+   c3cn_put(c3cn);
+   }
}
 
+   c3cn->dst_cache = NULL;
c3cn->cdev = NULL;
 }
 
@@ -1417,17 +1422,18 @@ static void c3cn_active_close(struct s3_conn *c3cn)
 }
 
 /**
- * cxgb3i_c3cn_release - close and release an iscsi 

[PATCH 4/5 2.6.30] cxgb3i - re-read ddp settings after chip reset

2009-02-26 Thread Karen Xie

[PATCH 4/5 2.6.30] cxgb3i - re-read ddp settings information after chip reset

From: Karen Xie 

Re-read the ddp tag information after reset.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i.h   |2 -
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c |  114 ++--
 2 files changed, 70 insertions(+), 46 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index 1120c70..e13c98a 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -141,7 +141,7 @@ int cxgb3i_iscsi_init(void);
 void cxgb3i_iscsi_cleanup(void);
 
 struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *);
-struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev *);
+void cxgb3i_adapter_open(struct t3cdev *);
 void cxgb3i_adapter_close(struct t3cdev *);
 
 struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *);
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index 7e879c0..26e4dec 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -71,37 +71,34 @@ struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct 
t3cdev *tdev)
return NULL;
 }
 
-/**
- * cxgb3i_adapter_open - init a s3 adapter structure and any h/w settings
- * @t3dev: t3cdev adapter
- * return the resulting cxgb3i_adapter struct
- */
-struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev *t3dev)
+static inline int adapter_update(struct cxgb3i_adapter *snic)
 {
-   struct cxgb3i_adapter *snic;
-   struct adapter *adapter = tdev2adap(t3dev);
-   int i;
+   cxgb3i_log_info("snic 0x%p, t3dev 0x%p, updating.\n",
+   snic, snic->tdev);
+   return cxgb3i_adapter_ddp_info(snic->tdev, &snic->tag_format,
+   &snic->tx_max_size,
+   &snic->rx_max_size);
+}
 
-   snic = kzalloc(sizeof(*snic), GFP_KERNEL);
-   if (!snic) {
-   cxgb3i_api_debug("cxgb3 %s, OOM.\n", t3dev->name);
-   return NULL;
-   }
-   spin_lock_init(&snic->lock);
+static int adapter_add(struct cxgb3i_adapter *snic)
+{
+   struct t3cdev *t3dev = snic->tdev;
+   struct adapter *adapter = tdev2adap(t3dev);
+   int i, err;
 
-   snic->tdev = t3dev;
snic->pdev = adapter->pdev;
snic->tag_format.sw_bits = sw_tag_idx_bits + sw_tag_age_bits;
 
-   if (cxgb3i_adapter_ddp_init(t3dev, &snic->tag_format,
+   err = cxgb3i_adapter_ddp_info(t3dev, &snic->tag_format,
&snic->tx_max_size,
-   &snic->rx_max_size) < 0)
-   goto free_snic;
+   &snic->rx_max_size);
+   if (err < 0)
+   return err;
 
for_each_port(adapter, i) {
snic->hba[i] = cxgb3i_hba_host_add(snic, adapter->port[i]);
if (!snic->hba[i])
-   goto ulp_cleanup;
+   return -EINVAL;
}
snic->hba_cnt = adapter->params.nports;
 
@@ -110,13 +107,40 @@ struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev 
*t3dev)
list_add_tail(&snic->list_head, &cxgb3i_snic_list);
write_unlock(&cxgb3i_snic_rwlock);
 
-   return snic;
+   cxgb3i_log_info("t3dev 0x%p open, snic 0x%p, %u scsi hosts added.\n",
+   t3dev, snic, snic->hba_cnt);
+   return 0;
+}
 
-ulp_cleanup:
-   cxgb3i_adapter_ddp_cleanup(t3dev);
-free_snic:
-   kfree(snic);
-   return NULL;
+/**
+ * cxgb3i_adapter_open - init a s3 adapter structure and any h/w settings
+ * @t3dev: t3cdev adapter
+ */
+void cxgb3i_adapter_open(struct t3cdev *t3dev)
+{
+   struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(t3dev);
+   int err;
+
+   if (snic)
+   err = adapter_update(snic);
+   else {
+   snic = kzalloc(sizeof(*snic), GFP_KERNEL);
+   if (snic) {
+   spin_lock_init(&snic->lock);
+   snic->tdev = t3dev;
+   err = adapter_add(snic);
+   } else
+   err = -ENOMEM;
+   }
+
+   if (err < 0) {
+   cxgb3i_log_info("snic 0x%p, f 0x%x, t3dev 0x%p open, err %d.\n",
+   snic, snic ? snic->flags : 0, t3dev, err);
+   if (snic) {
+   snic->flags &= ~CXGB3I_ADAPTER_FLAG_RESET;
+   cxgb3i_adapter_close(t3dev);
+   }
+   }
 }
 
 /**
@@ -125,31 +149,29 @@ free_snic:
  */
 void cxgb3i_adapter_close(struct t3cdev *t3dev)
 {
+   struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(t3dev);
int i;
-   struct cxgb3i_adapter *

[PATCH 3/5 2.6.30] cxgb3i - re-initialize ddp settings after chip reset

2009-02-26 Thread Karen Xie

[PATCH 3/5 2.6.30] cxgb3i - re-initialize ddp settings after chip reset

From: Karen Xie 

Re-initialize the ddp settings after chip reset. It includes re-initialize
the related registers and the ddp map.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |  242 ++
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |3 
 2 files changed, 118 insertions(+), 127 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 4eb6f55..52df2c2 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -66,9 +66,6 @@ static unsigned char ddp_page_order[DDP_PGIDX_MAX] = {0, 1, 
2, 4};
 static unsigned char ddp_page_shift[DDP_PGIDX_MAX] = {12, 13, 14, 16};
 static unsigned char page_idx = DDP_PGIDX_MAX;
 
-static LIST_HEAD(cxgb3i_ddp_list);
-static DEFINE_RWLOCK(cxgb3i_ddp_rwlock);
-
 /*
  * functions to program the pagepod in h/w
  */
@@ -113,8 +110,8 @@ static int set_ddp_map(struct cxgb3i_ddp_info *ddp, struct 
pagepod_hdr *hdr,
return 0;
 }
 
-static int clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int idx,
-unsigned int npods)
+static void clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int tag,
+unsigned int idx, unsigned int npods)
 {
unsigned int pm_addr = (idx << PPOD_SIZE_SHIFT) + ddp->llimit;
int i;
@@ -122,13 +119,17 @@ static int clear_ddp_map(struct cxgb3i_ddp_info *ddp, 
unsigned int idx,
for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
struct sk_buff *skb = ddp->gl_skb[idx];
 
+   if (!skb) {
+   ddp_log_error("ddp tag 0x%x, 0x%x, %d/%u, skb NULL.\n",
+   tag, idx, i, npods);
+   continue;
+   }
ddp->gl_skb[idx] = NULL;
memset((skb->head + sizeof(struct ulp_mem_io)), 0, PPOD_SIZE);
ulp_mem_io_set_hdr(skb, pm_addr);
skb->priority = CPL_PRIORITY_CONTROL;
cxgb3_ofld_send(ddp->tdev, skb);
}
-   return 0;
 }
 
 static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp,
@@ -453,15 +454,15 @@ void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
struct cxgb3i_gather_list *gl = ddp->gl_map[idx];
unsigned int npods;
 
-   if (!gl) {
-   ddp_log_error("release ddp 0x%x, idx 0x%x, gl NULL.\n",
- tag, idx);
+   if (!gl || !gl->nelem) {
+   ddp_log_error("release 0x%x, idx 0x%x, gl 0x%p, %u.\n",
+ tag, idx, gl, gl ? gl->nelem : 0);
return;
}
npods = (gl->nelem + PPOD_PAGES_MAX - 1) >> PPOD_PAGES_SHIFT;
ddp_log_debug("ddp tag 0x%x, release idx 0x%x, npods %u.\n",
  tag, idx, npods);
-   clear_ddp_map(ddp, idx, npods);
+   clear_ddp_map(ddp, tag, idx, npods);
ddp_unmark_entries(ddp, idx, npods);
cxgb3i_ddp_release_gl(gl, ddp->pdev);
} else
@@ -564,7 +565,87 @@ int cxgb3i_setup_conn_digest(struct t3cdev *tdev, unsigned 
int tid,
 }
 EXPORT_SYMBOL_GPL(cxgb3i_setup_conn_digest);
 
-static int ddp_init(struct t3cdev *tdev)
+
+/**
+ * cxgb3i_adapter_ddp_info - read the adapter's ddp information
+ * @tdev: t3cdev adapter
+ * @tformat: tag format
+ * @txsz: max tx pdu payload size, filled in by this func.
+ * @rxsz: max rx pdu payload size, filled in by this func.
+ * setup the tag format for a given iscsi entity
+ */
+int cxgb3i_adapter_ddp_info(struct t3cdev *tdev,
+   struct cxgb3i_tag_format *tformat,
+   unsigned int *txsz, unsigned int *rxsz)
+{
+   struct cxgb3i_ddp_info *ddp;
+   unsigned char idx_bits;
+
+   if (!tformat)
+   return -EINVAL;
+
+   if (!tdev->ulp_iscsi)
+   return -EINVAL;
+
+   ddp = (struct cxgb3i_ddp_info *)tdev->ulp_iscsi;
+
+   idx_bits = 32 - tformat->sw_bits;
+   tformat->rsvd_bits = ddp->idx_bits;
+   tformat->rsvd_shift = PPOD_IDX_SHIFT;
+   tformat->rsvd_mask = (1 << tformat->rsvd_bits) - 1;
+
+   ddp_log_info("tag format: sw %u, rsvd %u,%u, mask 0x%x.\n",
+ tformat->sw_bits, tformat->rsvd_bits,
+ tformat->rsvd_shift, tformat->rsvd_mask);
+
+   *txsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
+   ddp->max_txsz - ISCSI_PDU_NONPAYLOAD_LEN);
+   *rxsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
+   ddp->max_rxsz - ISCSI_PDU_NONPAYLOAD_LEN);
+   ddp_log_info("max paylo

[PATCH 2/5 2.6.30] cxgb3i - subscribe to error notification from cxgb3 driver

2009-02-26 Thread Karen Xie

[PATCH 2/5 2.6.30] cxgb3i - subscribe to error notification from cxgb3 driver

From: Karen Xie 

Add error notification handling function which is called during chip reset.

Signed-off-by: Karen Xie  
---

 drivers/scsi/cxgb3i/cxgb3i.h   |   10 ++
 drivers/scsi/cxgb3i/cxgb3i_init.c  |   25 +++--
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c |   27 +++
 3 files changed, 52 insertions(+), 10 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index a7cf550..1120c70 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -66,10 +66,12 @@ struct cxgb3i_hba {
  * @pdev:  pointer to pci dev
  * @hba_cnt:   # of hbas (the same as # of ports)
  * @hba:   all the hbas on this adapter
+ * @flags: bit flag for adapter event/status
  * @tx_max_size: max. tx packet size supported
  * @rx_max_size: max. rx packet size supported
  * @tag_format: ddp tag format settings
  */
+#define CXGB3I_ADAPTER_FLAG_RESET  0x1
 struct cxgb3i_adapter {
struct list_head list_head;
spinlock_t lock;
@@ -78,6 +80,7 @@ struct cxgb3i_adapter {
unsigned char hba_cnt;
struct cxgb3i_hba *hba[MAX_NPORTS];
 
+   unsigned int flags;
unsigned int tx_max_size;
unsigned int rx_max_size;
 
@@ -137,10 +140,9 @@ struct cxgb3i_task_data {
 int cxgb3i_iscsi_init(void);
 void cxgb3i_iscsi_cleanup(void);
 
-struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *);
-void cxgb3i_adapter_remove(struct t3cdev *);
-int cxgb3i_adapter_ulp_init(struct cxgb3i_adapter *);
-void cxgb3i_adapter_ulp_cleanup(struct cxgb3i_adapter *);
+struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *);
+struct cxgb3i_adapter *cxgb3i_adapter_open(struct t3cdev *);
+void cxgb3i_adapter_close(struct t3cdev *);
 
 struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *);
 struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *,
diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c 
b/drivers/scsi/cxgb3i/cxgb3i_init.c
index 1ce9f24..833dbfa 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_init.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_init.c
@@ -26,6 +26,7 @@ MODULE_VERSION(DRV_MODULE_VERSION);
 
 static void open_s3_dev(struct t3cdev *);
 static void close_s3_dev(struct t3cdev *);
+static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error);
 
 static cxgb3_cpl_handler_func cxgb3i_cpl_handlers[NUM_CPL_CMDS];
 static struct cxgb3_client t3c_client = {
@@ -33,6 +34,7 @@ static struct cxgb3_client t3c_client = {
.handlers = cxgb3i_cpl_handlers,
.add = open_s3_dev,
.remove = close_s3_dev,
+   .err_handler = s3_err_handler,
 };
 
 /**
@@ -49,7 +51,7 @@ static void open_s3_dev(struct t3cdev *t3dev)
}
 
cxgb3i_sdev_add(t3dev, &t3c_client);
-   cxgb3i_adapter_add(t3dev);
+   cxgb3i_adapter_open(t3dev);
 }
 
 /**
@@ -58,10 +60,29 @@ static void open_s3_dev(struct t3cdev *t3dev)
  */
 static void close_s3_dev(struct t3cdev *t3dev)
 {
-   cxgb3i_adapter_remove(t3dev);
+   cxgb3i_adapter_close(t3dev);
cxgb3i_sdev_remove(t3dev);
 }
 
+static void s3_err_handler(struct t3cdev *tdev, u32 status, u32 error)
+{
+   struct cxgb3i_adapter *snic = cxgb3i_adapter_find_by_tdev(tdev);
+
+   cxgb3i_log_info("snic 0x%p, tdev 0x%p, status 0x%x, err 0x%x.\n",
+   snic, tdev, status, error);
+   if (!snic)
+   return;
+
+   switch (status) {
+   case OFFLOAD_STATUS_DOWN:
+   snic->flags |= CXGB3I_ADAPTER_FLAG_RESET;
+   break;
+   case OFFLOAD_STATUS_UP:
+   snic->flags &= ~CXGB3I_ADAPTER_FLAG_RESET;
+   break;
+   }
+}
+
 /**
  * cxgb3i_init_module - module init entry point
  *
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index aa5db70..7e879c0 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -53,11 +53,30 @@ static LIST_HEAD(cxgb3i_snic_list);
 static DEFINE_RWLOCK(cxgb3i_snic_rwlock);
 
 /**
- * cxgb3i_adapter_add - init a s3 adapter structure and any h/w settings
+ * cxgb3i_adpater_find_by_tdev - find the cxgb3i_adapter structure via t3cdev
+ * @tdev: t3cdev pointer
+ */
+struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *tdev)
+{
+   struct cxgb3i_adapter *snic;
+
+   read_lock(&cxgb3i_snic_rwlock);
+   list_for_each_entry(snic, &cxgb3i_snic_list, list_head) {
+   if (snic->tdev == tdev) {
+   read_unlock(&cxgb3i_snic_rwlock);
+   return snic;
+   }
+   }
+   read_unlock(&cxgb3i_snic_rwlock);
+   return NULL;
+}
+
+/**
+ * cxgb3i_adapter_open - init a s3 adapter structure and any h/w settings
  * @t3dev: t3cdev adapter
  * return the resulting cxgb3i_adapter struct
  */
-struct cxgb3i_adapter *cxgb3i_adapter_add(s

[PATCH 1/5 2.6.30] cxgb3i - fixed function descriptions

2009-02-26 Thread Karen Xie

[PATCH 1/5 2.6.30] cxgb3i - fixed function descriptions

From: Karen Xie 

Limit function descriptions to be one line.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |5 ++---
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |8 +++-
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c   |   17 +++--
 drivers/scsi/cxgb3i/cxgb3i_offload.c |3 +--
 drivers/scsi/cxgb3i/cxgb3i_offload.h |1 +
 5 files changed, 14 insertions(+), 20 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index a83d36e..4eb6f55 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -196,7 +196,7 @@ static inline int ddp_alloc_gl_skb(struct cxgb3i_ddp_info 
*ddp, int idx,
 }
 
 /**
- * cxgb3i_ddp_find_page_index - return ddp page index for a given page size.
+ * cxgb3i_ddp_find_page_index - return ddp page index for a given page size
  * @pgsz: page size
  * return the ddp page index, if no match is found return DDP_PGIDX_MAX.
  */
@@ -355,8 +355,7 @@ EXPORT_SYMBOL_GPL(cxgb3i_ddp_release_gl);
  * @tdev: t3cdev adapter
  * @tid: connection id
  * @tformat: tag format
- * @tagp: the s/w tag, if ddp setup is successful, it will be updated with
- *   ddp/hw tag
+ * @tagp: contains s/w tag initially, will be updated with ddp/hw tag
  * @gl: the page momory list
  * @gfp: allocation mode
  *
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 3faae78..75a63a8 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -185,12 +185,11 @@ static inline int cxgb3i_is_ddp_tag(struct 
cxgb3i_tag_format *tformat, u32 tag)
 }
 
 /**
- * cxgb3i_sw_tag_usable - check if a given s/w tag has enough bits left for
- *   the reserved/hw bits
+ * cxgb3i_sw_tag_usable - check if s/w tag has enough bits left for hw bits
  * @tformat: tag format information
  * @sw_tag: s/w tag to be checked
  *
- * return true if the tag is a ddp tag, false otherwise.
+ * return true if the tag can be used for hw ddp tag, false otherwise.
  */
 static inline int cxgb3i_sw_tag_usable(struct cxgb3i_tag_format *tformat,
u32 sw_tag)
@@ -222,8 +221,7 @@ static inline u32 cxgb3i_set_non_ddp_tag(struct 
cxgb3i_tag_format *tformat,
 }
 
 /**
- * cxgb3i_ddp_tag_base - shift the s/w tag bits so that reserved bits are not
- *  used.
+ * cxgb3i_ddp_tag_base - shift s/w tag bits so that reserved bits are not used
  * @tformat: tag format information
  * @sw_tag: s/w tag to be checked
  */
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index fa2a44f..aa5db70 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -101,8 +101,7 @@ free_snic:
 }
 
 /**
- * cxgb3i_adapter_remove - release all the resources held and cleanup any
- * h/w settings
+ * cxgb3i_adapter_remove - release the resources held and cleanup h/w settings
  * @t3dev: t3cdev adapter
  */
 void cxgb3i_adapter_remove(struct t3cdev *t3dev)
@@ -135,8 +134,7 @@ void cxgb3i_adapter_remove(struct t3cdev *t3dev)
 }
 
 /**
- * cxgb3i_hba_find_by_netdev - find the cxgb3i_hba structure with a given
- * net_device
+ * cxgb3i_hba_find_by_netdev - find the cxgb3i_hba structure via net_device
  * @t3dev: t3cdev adapter
  */
 struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *ndev)
@@ -394,9 +392,9 @@ static void cxgb3i_session_destroy(struct iscsi_cls_session 
*cls_session)
 }
 
 /**
- * cxgb3i_conn_max_xmit_dlength -- check the max. xmit pdu segment size,
- * reduce it to be within the hardware limit if needed
+ * cxgb3i_conn_max_xmit_dlength -- calc the max. xmit pdu segment size
  * @conn: iscsi connection
+ * check the max. xmit pdu payload, reduce it if needed
  */
 static inline int cxgb3i_conn_max_xmit_dlength(struct iscsi_conn *conn)
 
@@ -417,8 +415,7 @@ static inline int cxgb3i_conn_max_xmit_dlength(struct 
iscsi_conn *conn)
 }
 
 /**
- * cxgb3i_conn_max_recv_dlength -- check the max. recv pdu segment size against
- * the hardware limit
+ * cxgb3i_conn_max_recv_dlength -- check the max. recv pdu segment size
  * @conn: iscsi connection
  * return 0 if the value is valid, < 0 otherwise.
  */
@@ -759,9 +756,9 @@ static void cxgb3i_parse_itt(struct iscsi_conn *conn, itt_t 
itt,
 
 /**
  * cxgb3i_reserve_itt - generate tag for a give task
- * Try to set up ddp for a scsi read task.
  * @task: iscsi task
  * @hdr_itt: tag, filled in by this function
+ * Set up ddp for scsi read tasks if possible.
  */
 int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt)
 {
@@ -809,9 +806,9 @@ int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t 
*hdr_itt)
 
 /**
  * cxgb3i_release_itt - release the tag for a given task
- * if the tag is a ddp tag, release the ddp setup
  * @task:  iscsi task
  * @hdr_itt:   tag
+ * If the tag is a ddp tag, release the ddp setup
  */
 void cxgb3i_release_

[PATCH 0/5 2.6.30] cxgb3i -- handles chip reset

2009-02-26 Thread Karen Xie

[PATCH 0/5 2.6.30] cxgb3i -- handles chip reset

From: Karen Xie 

The following patches added support of the cxgb3 chip reset.

The reset could happen due to EEH event or a fatal error. The cxgb3i would
re-initialize the hardware and its offload function.

The patch requires the following cxgb3 patch in net-next-2.6 git tree:
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commitdiff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e.

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-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
-~--~~~~--~~--~--~---



RE: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset

2009-02-25 Thread Karen Xie



-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Wednesday, February 25, 2009 9:30 AM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset

Some other comments about the host and snic allocation.

Karen Xie wrote:
> +/**
> + * cxgb3i_adapter_open - initiate or update a s3 adapter structure
and
> + *   any h/w settings
> + * @t3dev: t3cdev adapter
> + */
> +static inline int adapter_update(struct cxgb3i_adapter *snic)


The function name and comment got out of sync.

[Karen] Thanks, will fix it.


> -void cxgb3i_adapter_remove(struct t3cdev *t3dev)
> +void cxgb3i_adapter_open(struct t3cdev *t3dev)
>  {
> - int i;
> - struct cxgb3i_adapter *snic;
> + struct cxgb3i_adapter *snic =
cxgb3i_adapter_find_by_tdev(t3dev);
> + int err;
>  
> - /* remove from the list */
> - write_lock(&cxgb3i_snic_rwlock);
> - list_for_each_entry(snic, &cxgb3i_snic_list, list_head) {
> - if (snic->tdev == t3dev) {
> - list_del(&snic->list_head);
> - break;
> - }
> + if (snic)
> + err = adapter_update(snic);
> + else {
> + snic = kzalloc(sizeof(*snic), GFP_KERNEL);
> + if (snic) {
> + spin_lock_init(&snic->lock);
> + snic->tdev = t3dev;
> + err = adapter_add(snic);
> + } else
> + err = -ENOMEM;
>

Does the snic represent the actual card. So if I had a dual ported card,

I would have one snic and then have multple shosts/cxgb3i_hba for each 
port right?

[Karen] Yes.

It seemed strange because cxgb3i_hba_host_add sets the shost's parent to

the pci device, and we get the pci device from the snic->pdev. And so I 
thought we see a pci device per port, so we would also should have a 
snic per port?

[Karen] Each port/cxgb3i_hba has a pointer point back to the
snic/adapter. So one snic per adapter, each snic contains one or more
ports, each port corresponds to one shost.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset

2009-02-25 Thread Karen Xie



-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Wednesday, February 25, 2009 9:22 AM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2/2 2.6.29-rc] cxgb3i - add handling of chip reset

Karen Xie wrote:
> [PATCH 2/2 2.6.29-rc] cxgb3i - add support of chip reset
> 
> From: Karen Xie 
> 
> The cxgb3 driver would reset the chip due to an EEH event or a fatal
error
> and notifies the upper layer modules (iscsi, rdma).
> Upon receiving the notification the cxgb3i driver would 
> - close all the iscsi tcp connections and mark the associated sessions
as
>   failed due to connection error,
> - re-initialize its offload functions,
> - re-initialize the chip's ddp functions.
> 
> The iscsi error recovery mechanism will re-establish the tcp
connection after
> reset. 
> 
> This patch requires the the following cxgb3 patch in the linux-next
git tree
>
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdi
ff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).
> 


>  
>  static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info
*ddp,
> @@ -439,14 +444,15 @@ EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_reserve);
>   * @tag: ddp tag
>   * ddp cleanup for a given ddp tag and release all the resources held
>   */
> -void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
> +int cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
>  {
>   struct cxgb3i_ddp_info *ddp = tdev->ulp_iscsi;
>   u32 idx;
> + int err = -EINVAL;
>  
>   if (!ddp) {
>   ddp_log_error("release ddp tag 0x%x, ddp NULL.\n", tag);
> - return;
> + return err;
>   }
>  
>   idx = (tag >> PPOD_IDX_SHIFT) & ddp->idx_mask;
> @@ -457,17 +463,26 @@ void cxgb3i_ddp_tag_release(struct t3cdev *tdev,
u32 tag)
>   if (!gl) {
>   ddp_log_error("release ddp 0x%x, idx 0x%x, gl
NULL.\n",
> tag, idx);
> - return;
> + return err;
>   }
>   npods = (gl->nelem + PPOD_PAGES_MAX - 1) >>
PPOD_PAGES_SHIFT;
> + if (!npods) {
> + ddp_log_error("release ddp 0x%x, 0x%x, gl elem
%u.\n",
> +   tag, idx, gl->nelem);
> + return err;
> + }
>   ddp_log_debug("ddp tag 0x%x, release idx 0x%x, npods
%u.\n",
> tag, idx, npods);
> - clear_ddp_map(ddp, idx, npods);
> + if (clear_ddp_map(ddp, tag, idx, npods) == npods)
> + err = 0;
>   ddp_unmark_entries(ddp, idx, npods);
>   cxgb3i_ddp_release_gl(gl, ddp->pdev);


If this fails, do we leak this memory?

[Karen] The only memory allocated is the gl structure, even if it is not
freed here, it will be freed at the cleanup of the ddp function.

When is ddp_release called? Would it be called to clean up in situati 
this could fail?
[Karen] it is called in cleanup_task().


> +/**
> + * cxgb3i_adapter_remove - release all the resources held and cleanup
any
> + *   h/w settings

The docbook comment for the function description should only be one 
line. I think you did this in some other places.

[Karen] Thanks, I will fix them.

>  
> -void cxgb3i_conn_closing(struct s3_conn *c3cn)
> +void cxgb3i_conn_closing(struct s3_conn *c3cn, int error)
>  {
>   struct iscsi_conn *conn;
>  
>   read_lock(&c3cn->callback_lock);
>   conn = c3cn->user_data;
> - if (conn && c3cn->state != C3CN_STATE_ESTABLISHED)
> - iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
> + if (conn && c3cn->state != C3CN_STATE_ESTABLISHED) {
> + if (error)
> + iscsi_session_failure(conn->session,
> + ISCSI_ERR_CONN_FAILED);
> + else
> + iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
> + }
>   read_unlock(&c3cn->callback_lock);


If you have a ref to the conn, you can just use iscsi_conn_failure here.

I thought when you got the pci error event you were just going to use 
the host session iter and loop over the session and fail them.

[Karen] Yes, I could do it via iscsi_host_for_each_session() too.

--~--~-~--~~~---~--~~
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.29-rc] cxgb3i - add handling of chip reset

2009-02-24 Thread Karen Xie

[PATCH 2/2 2.6.29-rc] cxgb3i - add support of chip reset

From: Karen Xie 

The cxgb3 driver would reset the chip due to an EEH event or a fatal error
and notifies the upper layer modules (iscsi, rdma).
Upon receiving the notification the cxgb3i driver would 
- close all the iscsi tcp connections and mark the associated sessions as
  failed due to connection error,
- re-initialize its offload functions,
- re-initialize the chip's ddp functions.

The iscsi error recovery mechanism will re-establish the tcp connection after
reset. 

This patch requires the the following cxgb3 patch in the linux-next git tree
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i.h |   10 +
 drivers/scsi/cxgb3i/cxgb3i_ddp.c |  258 +-
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |5 -
 drivers/scsi/cxgb3i/cxgb3i_init.c|   25 +++
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c   |  145 +--
 drivers/scsi/cxgb3i/cxgb3i_offload.c |  102 +
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   10 +
 drivers/scsi/cxgb3i/cxgb3i_pdu.c |   11 +
 drivers/scsi/cxgb3i/cxgb3i_pdu.h |2 
 9 files changed, 338 insertions(+), 230 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index a7cf550..e13c98a 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -66,10 +66,12 @@ struct cxgb3i_hba {
  * @pdev:  pointer to pci dev
  * @hba_cnt:   # of hbas (the same as # of ports)
  * @hba:   all the hbas on this adapter
+ * @flag:  bit flag for adapter event/status
  * @tx_max_size: max. tx packet size supported
  * @rx_max_size: max. rx packet size supported
  * @tag_format: ddp tag format settings
  */
+#define CXGB3I_ADAPTER_FLAG_RESET  0x1
 struct cxgb3i_adapter {
struct list_head list_head;
spinlock_t lock;
@@ -78,6 +80,7 @@ struct cxgb3i_adapter {
unsigned char hba_cnt;
struct cxgb3i_hba *hba[MAX_NPORTS];
 
+   unsigned int flags;
unsigned int tx_max_size;
unsigned int rx_max_size;
 
@@ -137,10 +140,9 @@ struct cxgb3i_task_data {
 int cxgb3i_iscsi_init(void);
 void cxgb3i_iscsi_cleanup(void);
 
-struct cxgb3i_adapter *cxgb3i_adapter_add(struct t3cdev *);
-void cxgb3i_adapter_remove(struct t3cdev *);
-int cxgb3i_adapter_ulp_init(struct cxgb3i_adapter *);
-void cxgb3i_adapter_ulp_cleanup(struct cxgb3i_adapter *);
+struct cxgb3i_adapter *cxgb3i_adapter_find_by_tdev(struct t3cdev *);
+void cxgb3i_adapter_open(struct t3cdev *);
+void cxgb3i_adapter_close(struct t3cdev *);
 
 struct cxgb3i_hba *cxgb3i_hba_find_by_netdev(struct net_device *);
 struct cxgb3i_hba *cxgb3i_hba_host_add(struct cxgb3i_adapter *,
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index a83d36e..012956b 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -66,9 +66,6 @@ static unsigned char ddp_page_order[DDP_PGIDX_MAX] = {0, 1, 
2, 4};
 static unsigned char ddp_page_shift[DDP_PGIDX_MAX] = {12, 13, 14, 16};
 static unsigned char page_idx = DDP_PGIDX_MAX;
 
-static LIST_HEAD(cxgb3i_ddp_list);
-static DEFINE_RWLOCK(cxgb3i_ddp_rwlock);
-
 /*
  * functions to program the pagepod in h/w
  */
@@ -113,22 +110,30 @@ static int set_ddp_map(struct cxgb3i_ddp_info *ddp, 
struct pagepod_hdr *hdr,
return 0;
 }
 
-static int clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int idx,
-unsigned int npods)
+static int clear_ddp_map(struct cxgb3i_ddp_info *ddp, unsigned int tag,
+unsigned int idx, unsigned int npods)
 {
unsigned int pm_addr = (idx << PPOD_SIZE_SHIFT) + ddp->llimit;
int i;
+   int cnt = 0;
 
for (i = 0; i < npods; i++, idx++, pm_addr += PPOD_SIZE) {
struct sk_buff *skb = ddp->gl_skb[idx];
 
+   if (!skb) {
+   ddp_log_error("ddp tag 0x%x, 0x%x, %d/%u, skb NULL.\n",
+   tag, idx, i, npods);
+   continue;
+   }
+
+   cnt++;
ddp->gl_skb[idx] = NULL;
memset((skb->head + sizeof(struct ulp_mem_io)), 0, PPOD_SIZE);
ulp_mem_io_set_hdr(skb, pm_addr);
skb->priority = CPL_PRIORITY_CONTROL;
cxgb3_ofld_send(ddp->tdev, skb);
}
-   return 0;
+   return cnt;
 }
 
 static inline int ddp_find_unused_entries(struct cxgb3i_ddp_info *ddp,
@@ -439,14 +444,15 @@ EXPORT_SYMBOL_GPL(cxgb3i_ddp_tag_reserve);
  * @tag: ddp tag
  * ddp cleanup for a given ddp tag and release all the resources held
  */
-void cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
+int cxgb3i_ddp_tag_release(struct t3cdev *tdev, u32 tag)
 {
struct cxgb3i_ddp_info *ddp = tdev->ulp_iscs

[PATCH 1/2 2.6.29-rc] libiscsi - change iscsi_session_failure() to take iscsi_session pointer

2009-02-24 Thread Karen Xie

[PATCH 1/2 2.6.29-rc] libiscsi - change iscsi_session_failure() to take 
iscsi_session pointer

From: Karen Xie 

change iscsi_session_failure() to take a pointer to iscsi_session instead of 
iscsi_cls_session.

Signed-off-by: Mike Christie
Signed-off-by: Karen Xie 
---

 drivers/scsi/libiscsi.c |5 ++---
 include/scsi/libiscsi.h |2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 809d32d..5ad87e8 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -1034,10 +1034,9 @@ struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn 
*conn, itt_t itt)
 }
 EXPORT_SYMBOL_GPL(iscsi_itt_to_ctask);
 
-void iscsi_session_failure(struct iscsi_cls_session *cls_session,
+void iscsi_session_failure(struct iscsi_session *session,
   enum iscsi_err err)
 {
-   struct iscsi_session *session = cls_session->dd_data;
struct iscsi_conn *conn;
struct device *dev;
unsigned long flags;
@@ -2043,7 +2042,7 @@ EXPORT_SYMBOL_GPL(iscsi_host_alloc);
 
 static void iscsi_notify_host_removed(struct iscsi_cls_session *cls_session)
 {
-   iscsi_session_failure(cls_session, ISCSI_ERR_INVALID_HOST);
+   iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_INVALID_HOST);
 }
 
 /**
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h
index 7360e19..07c3cd3 100644
--- a/include/scsi/libiscsi.h
+++ b/include/scsi/libiscsi.h
@@ -382,7 +382,7 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
 extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
   int);
 extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
-extern void iscsi_session_failure(struct iscsi_cls_session *cls_session,
+extern void iscsi_session_failure(struct iscsi_session *session,
  enum iscsi_err err);
 extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
enum iscsi_param param, char *buf);

--~--~-~--~~~---~--~~
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 0/2 2.6.29-rc] cxgb3i -- handles chip reset

2009-02-24 Thread Karen Xie

[PATCH 0/2 2.6.29-rc] cxgb3i -- handling of chip reset

From: Karen Xie 

The following patches added support of the cxgb3 chip reset. The reset could
happen due to EEH event or a fatal error. The cxgb3i would re-initialize the
hardware and its offload function. The iscsi error recovery mechanism will
re-establish the tcp connection after reset.

The patches are based on scsi-rc-fixes-2.6 git.

The cxgb3i portion of the patch requires the the following cxgb3 patch in the
linux-next git tree:
(http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=commitdiff;h=cb0bc205959bf8c60acae9c71f3da0597e756f8e).

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-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 5/6 2.6.29-rc] cxgb3i -- spelling errors in the documentation

2009-02-13 Thread Karen Xie

[PATCH v2 5/6 2.6.29-rc] cxgb3i - spelling errors in the documentation

From: Karen Xie 

fixed spelling errors.

Signed-off-by: Karen Xie 
---

 0 files changed, 0 insertions(+), 0 deletions(-)


diff --git a/Documentation/scsi/cxgb3i.txt b/Documentation/scsi/cxgb3i.txt
index 8141fa0..7ac8032 100644
--- a/Documentation/scsi/cxgb3i.txt
+++ b/Documentation/scsi/cxgb3i.txt
@@ -4,7 +4,7 @@ Introduction
 
 
 The Chelsio T3 ASIC based Adapters (S310, S320, S302, S304, Mezz cards, etc.
-series of products) supports iSCSI acceleration and iSCSI Direct Data Placement
+series of products) support iSCSI acceleration and iSCSI Direct Data Placement
 (DDP) where the hardware handles the expensive byte touching operations, such
 as CRC computation and verification, and direct DMA to the final host memory
 destination:
@@ -31,9 +31,9 @@ destination:
  the TCP segments onto the wire. It handles TCP retransmission if
  needed.
 
- On receving, S3 h/w recovers the iSCSI PDU by reassembling TCP
+ On receiving, S3 h/w recovers the iSCSI PDU by reassembling TCP
  segments, separating the header and data, calculating and verifying
- the digests, then forwards the header to the host. The payload data,
+ the digests, then forwarding the header to the host. The payload data,
  if possible, will be directly placed into the pre-posted host DDP
  buffer. Otherwise, the payload data will be sent to the host too.
 
@@ -68,9 +68,8 @@ The following steps need to be taken to accelerates the 
open-iscsi initiator:
sure the ip address is unique in the network.
 
 3. edit /etc/iscsi/iscsid.conf
-   The default setting for MaxRecvDataSegmentLength (131072) is too big,
-   replace "node.conn[0].iscsi.MaxRecvDataSegmentLength" to be a value no
-   bigger than 15360 (for example 8192):
+   The default setting for MaxRecvDataSegmentLength (131072) is too big;
+   replace with a value no bigger than 15360 (for example 8192):
 
node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192
 

--~--~-~--~~~---~--~~
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 6/6 2.6.29-rc] cxgb3i -- update the driver version to 1.0.1

2009-02-13 Thread Karen Xie

[PATCH v2 6/6 2.6.29-rc] cxgb3i - update the driver version to 1.0.1

From: Karen Xie 

Bump the driver version up to 1.0.1.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c 
b/drivers/scsi/cxgb3i/cxgb3i_init.c
index 091ecb4..1ce9f24 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_init.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_init.c
@@ -12,8 +12,8 @@
 #include "cxgb3i.h"
 
 #define DRV_MODULE_NAME "cxgb3i"
-#define DRV_MODULE_VERSION "1.0.0"
-#define DRV_MODULE_RELDATE "Jun. 1, 2008"
+#define DRV_MODULE_VERSION "1.0.1"
+#define DRV_MODULE_RELDATE "Jan. 2009"
 
 static char version[] =
"Chelsio S3xx iSCSI Driver " DRV_MODULE_NAME

--~--~-~--~~~---~--~~
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 4/6 2.6.29-rc] cxgb3i - added missing include in cxgb3i_ddp.h

2009-02-13 Thread Karen Xie

[PATCH v2 4/6 2.6.29-rc] cxgb3i - added missing include in cxgb3i_ddp.h

From: Karen Xie 

Added missing include file in cxgb3i_ddp.h.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 5c7c4d9..f675807 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -13,6 +13,8 @@
 #ifndef __CXGB3I_ULP2_DDP_H__
 #define __CXGB3I_ULP2_DDP_H__
 
+#include 
+
 /**
  * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity
  *

--~--~-~--~~~---~--~~
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 3/6 2.6.29-rc] cxgb3i - Outgoing pdus need to observe skb's MAX_SKB_FRAGS

2009-02-13 Thread Karen Xie

[PATCH v2 3/6 2.6.29-rc] cxgb3i - Outgoing pdus need to observe skb's 
MAX_SKB_FRAGS

From: Karen Xie 

Need to make sure the outgoing pdu can fit into a single skb.
When calulating the max. outgoing pdu payload size, take into consideration of
- data can be held in the skb's fragment list, assume 512 bytes per fragment, 
and
- data can be held in the headroom.
 
Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.c |   19 +-
 drivers/scsi/cxgb3i/cxgb3i_ddp.h |3 
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c   |   17 +-
 drivers/scsi/cxgb3i/cxgb3i_offload.h |1 
 drivers/scsi/cxgb3i/cxgb3i_pdu.c |  275 +++---
 drivers/scsi/cxgb3i/cxgb3i_pdu.h |2 
 6 files changed, 205 insertions(+), 112 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
index 08f3a09..a83d36e 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c
@@ -639,10 +639,11 @@ static int ddp_init(struct t3cdev *tdev)
write_unlock(&cxgb3i_ddp_rwlock);
 
ddp_log_info("nppods %u (0x%x ~ 0x%x), bits %u, mask 0x%x,0x%x "
-   "pkt %u,%u.\n",
+   "pkt %u/%u, %u/%u.\n",
ppmax, ddp->llimit, ddp->ulimit, ddp->idx_bits,
ddp->idx_mask, ddp->rsvd_tag_mask,
-   ddp->max_txsz, ddp->max_rxsz);
+   ddp->max_txsz, uinfo.max_txsz,
+   ddp->max_rxsz, uinfo.max_rxsz);
return 0;
 
 free_ddp_map:
@@ -654,8 +655,8 @@ free_ddp_map:
  * cxgb3i_adapter_ddp_init - initialize the adapter's ddp resource
  * @tdev: t3cdev adapter
  * @tformat: tag format
- * @txsz: max tx pkt size, filled in by this func.
- * @rxsz: max rx pkt size, filled in by this func.
+ * @txsz: max tx pdu payload size, filled in by this func.
+ * @rxsz: max rx pdu payload size, filled in by this func.
  * initialize the ddp pagepod manager for a given adapter if needed and
  * setup the tag format for a given iscsi entity
  */
@@ -685,10 +686,12 @@ int cxgb3i_adapter_ddp_init(struct t3cdev *tdev,
  tformat->sw_bits, tformat->rsvd_bits,
  tformat->rsvd_shift, tformat->rsvd_mask);
 
-   *txsz = ddp->max_txsz;
-   *rxsz = ddp->max_rxsz;
-   ddp_log_info("ddp max pkt size: %u, %u.\n",
-ddp->max_txsz, ddp->max_rxsz);
+   *txsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
+   ddp->max_txsz - ISCSI_PDU_NONPAYLOAD_LEN);
+   *rxsz = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
+   ddp->max_rxsz - ISCSI_PDU_NONPAYLOAD_LEN);
+   ddp_log_info("max payload size: %u/%u, %u/%u.\n",
+*txsz, ddp->max_txsz, *rxsz, ddp->max_rxsz);
return 0;
 }
 EXPORT_SYMBOL_GPL(cxgb3i_adapter_ddp_init);
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index f675807..3faae78 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -87,8 +87,9 @@ struct cxgb3i_ddp_info {
struct sk_buff **gl_skb;
 };
 
+#define ISCSI_PDU_NONPAYLOAD_LEN   312 /* bhs(48) + ahs(256) + digest(8) */
 #define ULP2_MAX_PKT_SIZE  16224
-#define ULP2_MAX_PDU_PAYLOAD   (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_MAX)
+#define ULP2_MAX_PDU_PAYLOAD   (ULP2_MAX_PKT_SIZE - ISCSI_PDU_NONPAYLOAD_LEN)
 #define PPOD_PAGES_MAX 4
 #define PPOD_PAGES_SHIFT   2   /* 4 pages per pod */
 
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index f0434b7..fa2a44f 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -403,17 +403,15 @@ static inline int cxgb3i_conn_max_xmit_dlength(struct 
iscsi_conn *conn)
 {
struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
struct cxgb3i_conn *cconn = tcp_conn->dd_data;
-   unsigned int max = min_t(unsigned int, ULP2_MAX_PDU_PAYLOAD,
-cconn->hba->snic->tx_max_size -
-ISCSI_PDU_NONPAYLOAD_MAX);
+   unsigned int max = max(512 * MAX_SKB_FRAGS, SKB_TX_HEADROOM);
 
+   max = min(cconn->hba->snic->tx_max_size, max);
if (conn->max_xmit_dlength)
-   conn->max_xmit_dlength = min_t(unsigned int,
-   conn->max_xmit_dlength, max);
+   conn->max_xmit_dlength = min(conn->max_xmit_dlength, max);
else
conn->max_xmit_dlength = max;
align_pdu_size(conn->max_xmit_dlength);
-   cxgb3i_log_info("conn 0x%p, max xmit %u.\n",
+   cxgb3i_api_debug("conn 0x%p, max xmit %u.\n",
 conn, conn->max_xmit_dlength);
return 0;
 }
@@ -42

[PATCH v2 2/6 2.6.29-rc] cxgb3i - added per-task data to track transmit progress

2009-02-13 Thread Karen Xie

[PATCH v2 2/6 2.6.29-rc] cxgb3i - added per-task data to track transmit progress

From: Karen Xie 

added per-task struct cxgb3i_task_data to track the data transmiting
progress and the state of the pdus to be transmitted.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i.h   |   21 +
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c |5 +++--
 2 files changed, 24 insertions(+), 2 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index fde6e4c..a7cf550 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* from cxgb3 LLD */
@@ -113,6 +114,26 @@ struct cxgb3i_endpoint {
struct cxgb3i_conn *cconn;
 };
 
+/**
+ * struct cxgb3i_task_data - private iscsi task data
+ *
+ * @nr_frags:  # of coalesced page frags (from scsi sgl)
+ * @frags: coalesced page frags (from scsi sgl)
+ * @skb:   tx pdu skb
+ * @offset:data offset for the next pdu
+ * @count: max. possible pdu payload
+ * @sgoffset:  offset to the first sg entry for a given offset
+ */
+#define MAX_PDU_FRAGS  ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
+struct cxgb3i_task_data {
+   unsigned short nr_frags;
+   skb_frag_t frags[MAX_PDU_FRAGS];
+   struct sk_buff *skb;
+   unsigned int offset;
+   unsigned int count;
+   unsigned int sgoffset;
+};
+
 int cxgb3i_iscsi_init(void);
 void cxgb3i_iscsi_cleanup(void);
 
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index d83464b..f0434b7 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -364,7 +364,8 @@ cxgb3i_session_create(struct iscsi_endpoint *ep, u16 
cmds_max, u16 qdepth,
 
cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost,
  cmds_max,
- sizeof(struct iscsi_tcp_task),
+ sizeof(struct iscsi_tcp_task) +
+ sizeof(struct cxgb3i_task_data),
  initial_cmdsn, ISCSI_MAX_TARGET);
if (!cls_session)
return NULL;
@@ -844,7 +845,7 @@ static struct scsi_host_template cxgb3i_host_template = {
.proc_name  = "cxgb3i",
.queuecommand   = iscsi_queuecommand,
.change_queue_depth = iscsi_change_queue_depth,
-   .can_queue  = 128 * (ISCSI_DEF_XMIT_CMDS_MAX - 1),
+   .can_queue  = CXGB3I_SCSI_QDEPTH_DFLT - 1,
.sg_tablesize   = SG_ALL,
.max_sectors= 0x,
.cmd_per_lun= ISCSI_DEF_CMD_PER_LUN,

--~--~-~--~~~---~--~~
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 1/6 2.6.29-rc] cxgb3i - transmit work-request fixes

2009-02-13 Thread Karen Xie

[PATCH v2 1/6 2.6.29-rc] cxgb3i - transmit work-request fixes

From: Karen Xie 

- resize the work-request credit array to be based on skb's MAX_SKB_FRAGS.
- split the skb cb into tx and rx portion
- increase the default transmit window to 128K.
- stop queueing up the outgoing pdus if transmit window is full.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_offload.c |  146 --
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   28 ---
 2 files changed, 121 insertions(+), 53 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index a865f1f..de3b3b6 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -23,19 +23,19 @@
 #include "cxgb3i_ddp.h"
 
 #ifdef __DEBUG_C3CN_CONN__
-#define c3cn_conn_debug cxgb3i_log_info
+#define c3cn_conn_debugcxgb3i_log_debug
 #else
 #define c3cn_conn_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_TX__
-#define c3cn_tx_debug cxgb3i_log_debug
+#define c3cn_tx_debug  cxgb3i_log_debug
 #else
 #define c3cn_tx_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_RX__
-#define c3cn_rx_debug cxgb3i_log_debug
+#define c3cn_rx_debug  cxgb3i_log_debug
 #else
 #define c3cn_rx_debug(fmt...)
 #endif
@@ -47,9 +47,9 @@ static int cxgb3_rcv_win = 256 * 1024;
 module_param(cxgb3_rcv_win, int, 0644);
 MODULE_PARM_DESC(cxgb3_rcv_win, "TCP receive window in bytes (default=256KB)");
 
-static int cxgb3_snd_win = 64 * 1024;
+static int cxgb3_snd_win = 128 * 1024;
 module_param(cxgb3_snd_win, int, 0644);
-MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=64KB)");
+MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=128KB)");
 
 static int cxgb3_rx_credit_thres = 10 * 1024;
 module_param(cxgb3_rx_credit_thres, int, 0644);
@@ -301,8 +301,8 @@ static void act_open_req_arp_failure(struct t3cdev *dev, 
struct sk_buff *skb)
 static void skb_entail(struct s3_conn *c3cn, struct sk_buff *skb,
   int flags)
 {
-   CXGB3_SKB_CB(skb)->seq = c3cn->write_seq;
-   CXGB3_SKB_CB(skb)->flags = flags;
+   skb_tcp_seq(skb) = c3cn->write_seq;
+   skb_flags(skb) = flags;
__skb_queue_tail(&c3cn->write_queue, skb);
 }
 
@@ -457,12 +457,9 @@ static unsigned int wrlen __read_mostly;
  * The number of WRs needed for an skb depends on the number of fragments
  * in the skb and whether it has any payload in its main body.  This maps the
  * length of the gather list represented by an skb into the # of necessary WRs.
- *
- * The max. length of an skb is controlled by the max pdu size which is ~16K.
- * Also, assume the min. fragment length is the sector size (512), then add
- * extra fragment counts for iscsi bhs and payload padding.
+ * The extra two fragments are for iscsi bhs and payload padding.
  */
-#define SKB_WR_LIST_SIZE   (16384/512 + 3)
+#define SKB_WR_LIST_SIZE   (MAX_SKB_FRAGS + 2)
 static unsigned int skb_wrs[SKB_WR_LIST_SIZE] __read_mostly;
 
 static void s3_init_wr_tab(unsigned int wr_len)
@@ -485,7 +482,7 @@ static void s3_init_wr_tab(unsigned int wr_len)
 
 static inline void reset_wr_list(struct s3_conn *c3cn)
 {
-   c3cn->wr_pending_head = NULL;
+   c3cn->wr_pending_head = c3cn->wr_pending_tail = NULL;
 }
 
 /*
@@ -496,7 +493,7 @@ static inline void reset_wr_list(struct s3_conn *c3cn)
 static inline void enqueue_wr(struct s3_conn *c3cn,
  struct sk_buff *skb)
 {
-   skb_wr_data(skb) = NULL;
+   skb_tx_wr_next(skb) = NULL;
 
/*
 * We want to take an extra reference since both us and the driver
@@ -509,10 +506,22 @@ static inline void enqueue_wr(struct s3_conn *c3cn,
if (!c3cn->wr_pending_head)
c3cn->wr_pending_head = skb;
else
-   skb_wr_data(skb) = skb;
+   skb_tx_wr_next(c3cn->wr_pending_tail) = skb;
c3cn->wr_pending_tail = skb;
 }
 
+static int count_pending_wrs(struct s3_conn *c3cn)
+{
+   int n = 0;
+   const struct sk_buff *skb = c3cn->wr_pending_head;
+
+   while (skb) {
+   n += skb->csum;
+   skb = skb_tx_wr_next(skb);
+   }
+   return n;
+}
+
 static inline struct sk_buff *peek_wr(const struct s3_conn *c3cn)
 {
return c3cn->wr_pending_head;
@@ -529,8 +538,8 @@ static inline struct sk_buff *dequeue_wr(struct s3_conn 
*c3cn)
 
if (likely(skb)) {
/* Don't bother clearing the tail */
-   c3cn->wr_pending_head = skb_wr_data(skb);
-   skb_wr_data(skb) = NULL;
+   c3cn->wr_pending_head = skb_tx_wr_next(skb);
+   skb_tx_wr_next(skb) = NULL;
}
return skb;
 }
@@ -543,13 +552,14 @@ static void purge_wr_queue(struct s3_conn *c3cn)
 }
 
 static inline void make_tx_data_wr(struct s3_conn *c3cn, st

[PATCH v2 0/6 2.6.29-rc] cxgb3i -- bug fixes for 2.6.29-rcX

2009-02-13 Thread Karen Xie

[PATCH v2 0/6 2.6.29-rc] cxgb3i -- bug fixes for 2.6.29-rcX 

From: Karen Xie 

Hi, Mike,

Could you review the following patches?

I've clamped down the max. outgoing pdu payload based on how much data can be 
fitted into a skb (either in the headroom or the frag_list), and removed the 
extra memory allocation in alloc_pdu(). The scanning of the scsi scatter-gather 
list is moved from alloc_pdu() to init_pdu().

The patches are based on scsi-rc-fixes-2.6 git.

The changes include:

- fixed tx work-request credit list.
- Added per-task data to track the state of the pdus to be transmitted.
- fixed a bug in tx pdu construction where we could over-run the skb's fragment 
list.
- Added missing include file in cxgb3i_ddp.h.
- fixed spelling error in the documentation.
- Update version number to 1.0.1.


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-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.6.29-rc v2] iscsi - add offset and count to alloc_pdu()

2009-02-11 Thread Karen Xie

[PATCH 2.6.29-rc v2] iscsi - add offset and count to alloc_pdu().

From: Karen Xie 

Second try: update iser and cxgb3i alloc_pdu() function prototypes.

Added the offset and count as additional parameters to alloc_pdu(). So that
the pdu payload is known at the time of pdu memory allocation.

Signed-off-by: Karen Xie 
---

 drivers/infiniband/ulp/iser/iscsi_iser.c |3 +
 drivers/scsi/cxgb3i/cxgb3i.h |2 -
 drivers/scsi/cxgb3i/cxgb3i_pdu.c |3 +
 drivers/scsi/iscsi_tcp.c |3 +
 drivers/scsi/libiscsi.c  |   93 +++---
 drivers/scsi/libiscsi_tcp.c  |6 ++
 include/scsi/libiscsi.h  |   12 
 include/scsi/scsi_transport_iscsi.h  |3 +
 8 files changed, 72 insertions(+), 53 deletions(-)


diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c 
b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 1287639..fc97ae4 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -119,7 +119,8 @@ error:
iscsi_conn_failure(conn, rc);
 }
 
-static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
+static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode,
+   unsigned int offset, unsigned int count)
 {
struct iscsi_iser_task *iser_task = task->dd_data;
 
diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index fde6e4c..12937ad 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -129,7 +129,7 @@ void cxgb3i_hba_host_remove(struct cxgb3i_hba *);
 int cxgb3i_pdu_init(void);
 void cxgb3i_pdu_cleanup(void);
 void cxgb3i_conn_cleanup_task(struct iscsi_task *);
-int cxgb3i_conn_alloc_pdu(struct iscsi_task *, u8);
+int cxgb3i_conn_alloc_pdu(struct iscsi_task *, u8, unsigned int, unsigned int);
 int cxgb3i_conn_init_pdu(struct iscsi_task *, unsigned int, unsigned int);
 int cxgb3i_conn_xmit_pdu(struct iscsi_task *);
 
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
index ce7ce8c..3d30ed0 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
@@ -162,7 +162,8 @@ void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
 /*
  * We do not support ahs yet
  */
-int cxgb3i_conn_alloc_pdu(struct iscsi_task *task, u8 opcode)
+int cxgb3i_conn_alloc_pdu(struct iscsi_task *task, u8 opcode,
+ unsigned int offset, unsigned int count)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
struct sk_buff *skb;
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 23808df..7fe0c68 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -458,7 +458,8 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task,
return 0;
 }
 
-static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
+static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode,
+unsigned int offset, unsigned int count)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
 
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 809d32d..22c84ed 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -104,7 +104,6 @@ void iscsi_prep_data_out_pdu(struct iscsi_task *task, 
struct iscsi_r2t_info *r2t
   struct iscsi_data *hdr)
 {
struct iscsi_conn *conn = task->conn;
-   unsigned int left = r2t->data_length - r2t->sent;
 
task->hdr_len = sizeof(struct iscsi_data);
 
@@ -117,15 +116,11 @@ void iscsi_prep_data_out_pdu(struct iscsi_task *task, 
struct iscsi_r2t_info *r2t
hdr->itt = task->hdr_itt;
hdr->exp_statsn = r2t->exp_statsn;
hdr->offset = cpu_to_be32(r2t->data_offset + r2t->sent);
-   if (left > conn->max_xmit_dlength) {
-   hton24(hdr->dlength, conn->max_xmit_dlength);
-   r2t->data_count = conn->max_xmit_dlength;
-   hdr->flags = 0;
-   } else {
-   hton24(hdr->dlength, left);
-   r2t->data_count = left;
+   hton24(hdr->dlength, r2t->data_count);
+   if (r2t->data_length == (r2t->sent + r2t->data_count))
hdr->flags = ISCSI_FLAG_CMD_FINAL;
-   }
+   else
+   hdr->flags = 0;
conn->dataout_pdus_cnt++;
 }
 EXPORT_SYMBOL_GPL(iscsi_prep_data_out_pdu);
@@ -225,7 +220,45 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
itt_t itt;
int rc;
 
-   rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD);
+   if (sc->sc_data_direction == DMA_TO_DEVICE) {
+   unsigned out_len = scsi_out(sc)->length;
+   struct iscsi_r2t_info *r2t = &task->unsol_r2t;
+
+   /*
+  

[PATCH 2.6.29-rc] iscsi - add offset and count to alloc_pdu()

2009-02-10 Thread Karen Xie

[PATCH 2.6.29-rc] iscsi - add offset and count to alloc_pdu().

From: Karen Xie 

Hi, Mike,

I looked through libiscsi.c, libiscsi_tcp.c and iscsi_tcp.c. It does seem to be 
a little messy to merge the two functions. Especially the BHS is constructed 
after pdu_alloc(), and iscsi_tcp uses the BHS fields in init_pdu(). 

So I only added the offset and count as additional parameters to alloc_pdu(). 
So that the pdu payload is known at the time of pdu memory allocation.

Thanks,
Karen

Signed-off-by: Karen Xie 
---

 drivers/scsi/iscsi_tcp.c|3 +
 drivers/scsi/libiscsi.c |   93 +--
 drivers/scsi/libiscsi_tcp.c |6 ++
 include/scsi/libiscsi.h |   12 +
 include/scsi/scsi_transport_iscsi.h |3 +
 5 files changed, 67 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 23808df..7fe0c68 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -458,7 +458,8 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task,
return 0;
 }
 
-static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
+static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode,
+unsigned int offset, unsigned int count)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
 
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 257c241..81956ac 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -104,7 +104,6 @@ void iscsi_prep_data_out_pdu(struct iscsi_task *task, 
struct iscsi_r2t_info *r2t
   struct iscsi_data *hdr)
 {
struct iscsi_conn *conn = task->conn;
-   unsigned int left = r2t->data_length - r2t->sent;
 
task->hdr_len = sizeof(struct iscsi_data);
 
@@ -117,15 +116,11 @@ void iscsi_prep_data_out_pdu(struct iscsi_task *task, 
struct iscsi_r2t_info *r2t
hdr->itt = task->hdr_itt;
hdr->exp_statsn = r2t->exp_statsn;
hdr->offset = cpu_to_be32(r2t->data_offset + r2t->sent);
-   if (left > conn->max_xmit_dlength) {
-   hton24(hdr->dlength, conn->max_xmit_dlength);
-   r2t->data_count = conn->max_xmit_dlength;
-   hdr->flags = 0;
-   } else {
-   hton24(hdr->dlength, left);
-   r2t->data_count = left;
+   hton24(hdr->dlength, r2t->data_count);
+   if (r2t->data_length == (r2t->sent + r2t->data_count))
hdr->flags = ISCSI_FLAG_CMD_FINAL;
-   }
+   else
+   hdr->flags = 0;
conn->dataout_pdus_cnt++;
 }
 EXPORT_SYMBOL_GPL(iscsi_prep_data_out_pdu);
@@ -225,7 +220,45 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
itt_t itt;
int rc;
 
-   rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD);
+   if (sc->sc_data_direction == DMA_TO_DEVICE) {
+   unsigned out_len = scsi_out(sc)->length;
+   struct iscsi_r2t_info *r2t = &task->unsol_r2t;
+
+   /*
+* Write counters:
+*
+*  imm_count   bytes to be sent right after
+*  SCSI PDU Header
+*
+*  unsol_count bytes(as Data-Out) to be sent
+*  without R2T ack right after
+*  immediate data
+*
+*  r2t data_length bytes to be sent via R2T ack's
+*
+*  pad_count   bytes to be sent as zero-padding
+*/
+   if (session->imm_data_en) {
+   if (out_len >= session->first_burst)
+   task->imm_count = min(session->first_burst,
+   conn->max_xmit_dlength);
+   else
+   task->imm_count = min(out_len,
+   conn->max_xmit_dlength);
+   }
+
+   memset(r2t, 0, sizeof(*r2t));
+   if (!session->initial_r2t_en) {
+   r2t->data_length = min(session->first_burst, out_len) -
+  task->imm_count;
+   r2t->data_offset = task->imm_count;
+   r2t->ttt = cpu_to_be32(ISCSI_RESERVED_TAG);
+   r2t->exp_statsn = cpu_to_be32(conn->exp_statsn);
+   }
+   }
+
+   rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD, 0,
+   task->imm_count);
if (rc)
return rc;
hdr = (struct iscsi_cmd *) task->h

RE: [PATCH 3/5 2.6.29-rc] cxgb3i -- tx pdu need to observe skb's MAX_SKB_FRAGS

2009-02-10 Thread Karen Xie

Hi, Mike,

My comments in-line below.

Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Monday, February 09, 2009 9:24 PM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 3/5 2.6.29-rc] cxgb3i -- tx pdu need to observe
skb's MAX_SKB_FRAGS

Karen Xie wrote:
> [PATCH 3/5 2.6.29-rc] cxgb3i -- tx pdu need to observe skb's
MAX_SKB_FRAGS
> 
> From: Karen Xie 
> 
> While fitting the whole pdu into a skb, need to observe the max. # of
fragments in skb (MAX_SKB_FRAGS).  Allow max. payload size and check for
# of scatter-gather entries it may use when allocating the pdus for
transmit. If the data can not fit into the skb's frag list, copy the
data.
> 
> Signed-off-by: Karen Xie 
> ---
> 
>  drivers/scsi/cxgb3i/cxgb3i_pdu.c |  410
++
>  drivers/scsi/cxgb3i/cxgb3i_pdu.h |   15 +
>  2 files changed, 337 insertions(+), 88 deletions(-)
> 
> 
> diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
> index ce7ce8c..165fb75 100644
> --- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
> +++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
> @@ -32,6 +32,10 @@
>  #define cxgb3i_tx_debug(fmt...)
>  #endif
>  
> +#define SKB_TX_HEADROOM  SKB_MAX_HEAD(TX_HEADER_LEN)
> +/* always allocate rooms for AHS */
> +#define SKB_TX_PDU_HEADER_LEN\
> + (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE)
>  static struct page *pad_page;
>  
>  /*
> @@ -146,12 +150,18 @@ static inline void tx_skb_setmode(struct sk_buff
*skb, int hcrc, int dcrc)
>  
>  void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
>  {
> - struct iscsi_tcp_task *tcp_task = task->dd_data;
> + struct cxgb3i_task_data *tdata = task->dd_data +
> + sizeof(struct iscsi_tcp_task);
> + int i;
>  
>   /* never reached the xmit task callout */
> - if (tcp_task->dd_data)
> - kfree_skb(tcp_task->dd_data);
> - tcp_task->dd_data = NULL;
> + for (i = 0; i < MAX_PDU_FULL_PAGES; i++)
> + if (tdata->pages[i])
> + __free_page(tdata->pages[i]);
> +
> + if (tdata->skb)
> + __kfree_skb(tdata->skb);
> + memset(tdata, 0, sizeof(struct cxgb3i_task_data));
>  
>   /* MNC - Do we need a check in case this is called but
>* cxgb3i_conn_alloc_pdu has never been called on the task */
> @@ -159,27 +169,162 @@ void cxgb3i_conn_cleanup_task(struct iscsi_task
*task)
>   iscsi_tcp_cleanup_task(task);
>  }
>  
> -/*
> - * We do not support ahs yet
> - */
> +static int sgl_seek_offset(struct scatterlist *sgl, unsigned int
sgcnt,
> + unsigned int offset, unsigned int *off,
> + struct scatterlist **sgp)
> +{
> + int i;
> + struct scatterlist *sg;
> +
> + for_each_sg(sgl, sg, sgcnt, i) {
> + if (offset < sg->length) {
> + *off = offset;
> + *sgp = sg;
> + return 0;
> + }
> + offset -= sg->length;
> + }
> + return -EFAULT;
> +}
> +
> +static int sgl_read_to_frags(struct scatterlist *sg, unsigned int
sgoffset,
> + unsigned int dlen, skb_frag_t *frags,
> + int frag_max)
> +{
> + unsigned int datalen = dlen;
> + unsigned int sglen = sg->length - sgoffset;
> + struct page *page = sg_page(sg);
> + int i;
> +
> + i = 0;
> + do {
> + unsigned int copy;
> +
> + if (!sglen) {
> + sg = sg_next(sg);
> + if (!sg) {
> + cxgb3i_log_error("%s, sg NULL, len
%u/%u.\n",
> +  __func__, datalen,
dlen);
> + return -EINVAL;
> + }
> + sgoffset = 0;
> + sglen = sg->length;
> + page = sg_page(sg);
> +
> + }
> + copy = min(datalen, sglen);
> + if (i && page == frags[i - 1].page &&



I always forget this. I just want to make sure. It is only the same frag

if it is the same page? If the pages were contiguous it still has to be 
different frags?

[Karen] It is the same page. This is really for backward compatibility
since the frag->size used to be 16 bit integer.


> + sgoffset + sg->offset ==
> + frags[i - 1].page_o

RE: [RFC] : network configuration for iscsi hba

2009-02-10 Thread Karen Xie

Hi, Mike,

Do you have any details on how to hook up with the DHCP software client?
I can look into it and see how much effort it is. We were not planning
it but it could be supported if needed.

Thanks,
Karen


-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Mike Christie
Sent: Monday, February 09, 2009 8:06 PM
To: open-iscsi@googlegroups.com
Cc: mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: Re: [RFC] : network configuration for iscsi hba


Karen Xie wrote:
> Hi, Mike,
> 
> I don't plan to support DHCP for cxgb3i. 

Ah you wuss :) The other day, you know when I asked if you needed a 
software client or if you could do it in firmware I was asking for iscsi

right :)



--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [RFC] : network configuration for iscsi hba

2009-02-09 Thread Karen Xie

Hi, Mike,

I don't plan to support DHCP for cxgb3i. We do have a dependency on the
interface to be configured (i.e., cxgb3 driver brought up and IP address
set) before it can be used for iSCSI, though the IP address configured
on the interface does not needed to be used for iscsi.

Thanks,
Karen 

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Mike Christie
Sent: Monday, February 09, 2009 11:07 AM
To: open-iscsi@googlegroups.com
Cc: mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: Re: [RFC] : network configuration for iscsi hba


Karen Xie wrote:
> Okay, I think cxgb3i driver can work with the proposed mechanism.
> 

Do you have a plan to support DHCP (the non boot case where you need a 
software client)? Do you need details on how to hook into that part, or 
have you started working on it with broadcom already?



--~--~-~--~~~---~--~~
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 5/5 2.6.29-rc] cxgb3i -- update the driver version to 1.0.1

2009-02-09 Thread Karen Xie

[PATCH 5/5 2.6.29-rc] cxgb3i -- update the driver version to 1.0.1

From: Karen Xie 

Bump the driver version up to 1.0.1.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/cxgb3i/cxgb3i_init.c 
b/drivers/scsi/cxgb3i/cxgb3i_init.c
index 091ecb4..fcbf5af 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_init.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_init.c
@@ -12,7 +12,7 @@
 #include "cxgb3i.h"
 
 #define DRV_MODULE_NAME "cxgb3i"
-#define DRV_MODULE_VERSION "1.0.0"
+#define DRV_MODULE_VERSION "1.0.1"
 #define DRV_MODULE_RELDATE "Jun. 1, 2008"
 
 static char version[] =

--~--~-~--~~~---~--~~
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 4/5 2.6.29-rc] cxgb3i - added missing include in cxgb3i_ddp.h

2009-02-09 Thread Karen Xie

[PATCH 4/5 2.6.29-rc] cxgb3i - added missing include in cxgb3i_ddp.h

From: Karen Xie 

Added missing include file in cxgb3i_ddp.h.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 5c7c4d9..99e0b50 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -13,6 +13,7 @@
 #ifndef __CXGB3I_ULP2_DDP_H__
 #define __CXGB3I_ULP2_DDP_H__
 
+#include 
 /**
  * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity
  *

--~--~-~--~~~---~--~~
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/5 2.6.29-rc] cxgb3i - transmit work-request fixes

2009-02-09 Thread Karen Xie

[PATCH 2/5 2.6.29-rc] cxgb3i - transmit work-request fixes

From: Karen Xie 

- resize the work-request credit array to be based on skb's MAX_SKB_FRAGS.
- split the skb cb into tx and rx portion
- increase the default transmit window to 128K.
- stop queueing up the outgoing pdus if transmit window is full.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_offload.c |  146 --
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   28 ---
 2 files changed, 121 insertions(+), 53 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index a865f1f..de3b3b6 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -23,19 +23,19 @@
 #include "cxgb3i_ddp.h"
 
 #ifdef __DEBUG_C3CN_CONN__
-#define c3cn_conn_debug cxgb3i_log_info
+#define c3cn_conn_debugcxgb3i_log_debug
 #else
 #define c3cn_conn_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_TX__
-#define c3cn_tx_debug cxgb3i_log_debug
+#define c3cn_tx_debug  cxgb3i_log_debug
 #else
 #define c3cn_tx_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_RX__
-#define c3cn_rx_debug cxgb3i_log_debug
+#define c3cn_rx_debug  cxgb3i_log_debug
 #else
 #define c3cn_rx_debug(fmt...)
 #endif
@@ -47,9 +47,9 @@ static int cxgb3_rcv_win = 256 * 1024;
 module_param(cxgb3_rcv_win, int, 0644);
 MODULE_PARM_DESC(cxgb3_rcv_win, "TCP receive window in bytes (default=256KB)");
 
-static int cxgb3_snd_win = 64 * 1024;
+static int cxgb3_snd_win = 128 * 1024;
 module_param(cxgb3_snd_win, int, 0644);
-MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=64KB)");
+MODULE_PARM_DESC(cxgb3_snd_win, "TCP send window in bytes (default=128KB)");
 
 static int cxgb3_rx_credit_thres = 10 * 1024;
 module_param(cxgb3_rx_credit_thres, int, 0644);
@@ -301,8 +301,8 @@ static void act_open_req_arp_failure(struct t3cdev *dev, 
struct sk_buff *skb)
 static void skb_entail(struct s3_conn *c3cn, struct sk_buff *skb,
   int flags)
 {
-   CXGB3_SKB_CB(skb)->seq = c3cn->write_seq;
-   CXGB3_SKB_CB(skb)->flags = flags;
+   skb_tcp_seq(skb) = c3cn->write_seq;
+   skb_flags(skb) = flags;
__skb_queue_tail(&c3cn->write_queue, skb);
 }
 
@@ -457,12 +457,9 @@ static unsigned int wrlen __read_mostly;
  * The number of WRs needed for an skb depends on the number of fragments
  * in the skb and whether it has any payload in its main body.  This maps the
  * length of the gather list represented by an skb into the # of necessary WRs.
- *
- * The max. length of an skb is controlled by the max pdu size which is ~16K.
- * Also, assume the min. fragment length is the sector size (512), then add
- * extra fragment counts for iscsi bhs and payload padding.
+ * The extra two fragments are for iscsi bhs and payload padding.
  */
-#define SKB_WR_LIST_SIZE   (16384/512 + 3)
+#define SKB_WR_LIST_SIZE   (MAX_SKB_FRAGS + 2)
 static unsigned int skb_wrs[SKB_WR_LIST_SIZE] __read_mostly;
 
 static void s3_init_wr_tab(unsigned int wr_len)
@@ -485,7 +482,7 @@ static void s3_init_wr_tab(unsigned int wr_len)
 
 static inline void reset_wr_list(struct s3_conn *c3cn)
 {
-   c3cn->wr_pending_head = NULL;
+   c3cn->wr_pending_head = c3cn->wr_pending_tail = NULL;
 }
 
 /*
@@ -496,7 +493,7 @@ static inline void reset_wr_list(struct s3_conn *c3cn)
 static inline void enqueue_wr(struct s3_conn *c3cn,
  struct sk_buff *skb)
 {
-   skb_wr_data(skb) = NULL;
+   skb_tx_wr_next(skb) = NULL;
 
/*
 * We want to take an extra reference since both us and the driver
@@ -509,10 +506,22 @@ static inline void enqueue_wr(struct s3_conn *c3cn,
if (!c3cn->wr_pending_head)
c3cn->wr_pending_head = skb;
else
-   skb_wr_data(skb) = skb;
+   skb_tx_wr_next(c3cn->wr_pending_tail) = skb;
c3cn->wr_pending_tail = skb;
 }
 
+static int count_pending_wrs(struct s3_conn *c3cn)
+{
+   int n = 0;
+   const struct sk_buff *skb = c3cn->wr_pending_head;
+
+   while (skb) {
+   n += skb->csum;
+   skb = skb_tx_wr_next(skb);
+   }
+   return n;
+}
+
 static inline struct sk_buff *peek_wr(const struct s3_conn *c3cn)
 {
return c3cn->wr_pending_head;
@@ -529,8 +538,8 @@ static inline struct sk_buff *dequeue_wr(struct s3_conn 
*c3cn)
 
if (likely(skb)) {
/* Don't bother clearing the tail */
-   c3cn->wr_pending_head = skb_wr_data(skb);
-   skb_wr_data(skb) = NULL;
+   c3cn->wr_pending_head = skb_tx_wr_next(skb);
+   skb_tx_wr_next(skb) = NULL;
}
return skb;
 }
@@ -543,13 +552,14 @@ static void purge_wr_queue(struct s3_conn *c3cn)
 }
 
 static inline void make_tx_data_wr(struct s3_conn *c3cn, st

[PATCH 3/5 2.6.29-rc] cxgb3i -- tx pdu need to observe skb's MAX_SKB_FRAGS

2009-02-09 Thread Karen Xie

[PATCH 3/5 2.6.29-rc] cxgb3i -- tx pdu need to observe skb's MAX_SKB_FRAGS

From: Karen Xie 

While fitting the whole pdu into a skb, need to observe the max. # of fragments 
in skb (MAX_SKB_FRAGS).  Allow max. payload size and check for # of 
scatter-gather entries it may use when allocating the pdus for transmit. If the 
data can not fit into the skb's frag list, copy the data.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_pdu.c |  410 ++
 drivers/scsi/cxgb3i/cxgb3i_pdu.h |   15 +
 2 files changed, 337 insertions(+), 88 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
index ce7ce8c..165fb75 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c
@@ -32,6 +32,10 @@
 #define cxgb3i_tx_debug(fmt...)
 #endif
 
+#define SKB_TX_HEADROOMSKB_MAX_HEAD(TX_HEADER_LEN)
+/* always allocate rooms for AHS */
+#define SKB_TX_PDU_HEADER_LEN  \
+   (sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE)
 static struct page *pad_page;
 
 /*
@@ -146,12 +150,18 @@ static inline void tx_skb_setmode(struct sk_buff *skb, 
int hcrc, int dcrc)
 
 void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
 {
-   struct iscsi_tcp_task *tcp_task = task->dd_data;
+   struct cxgb3i_task_data *tdata = task->dd_data +
+   sizeof(struct iscsi_tcp_task);
+   int i;
 
/* never reached the xmit task callout */
-   if (tcp_task->dd_data)
-   kfree_skb(tcp_task->dd_data);
-   tcp_task->dd_data = NULL;
+   for (i = 0; i < MAX_PDU_FULL_PAGES; i++)
+   if (tdata->pages[i])
+   __free_page(tdata->pages[i]);
+
+   if (tdata->skb)
+   __kfree_skb(tdata->skb);
+   memset(tdata, 0, sizeof(struct cxgb3i_task_data));
 
/* MNC - Do we need a check in case this is called but
 * cxgb3i_conn_alloc_pdu has never been called on the task */
@@ -159,27 +169,162 @@ void cxgb3i_conn_cleanup_task(struct iscsi_task *task)
iscsi_tcp_cleanup_task(task);
 }
 
-/*
- * We do not support ahs yet
- */
+static int sgl_seek_offset(struct scatterlist *sgl, unsigned int sgcnt,
+   unsigned int offset, unsigned int *off,
+   struct scatterlist **sgp)
+{
+   int i;
+   struct scatterlist *sg;
+
+   for_each_sg(sgl, sg, sgcnt, i) {
+   if (offset < sg->length) {
+   *off = offset;
+   *sgp = sg;
+   return 0;
+   }
+   offset -= sg->length;
+   }
+   return -EFAULT;
+}
+
+static int sgl_read_to_frags(struct scatterlist *sg, unsigned int sgoffset,
+   unsigned int dlen, skb_frag_t *frags,
+   int frag_max)
+{
+   unsigned int datalen = dlen;
+   unsigned int sglen = sg->length - sgoffset;
+   struct page *page = sg_page(sg);
+   int i;
+
+   i = 0;
+   do {
+   unsigned int copy;
+
+   if (!sglen) {
+   sg = sg_next(sg);
+   if (!sg) {
+   cxgb3i_log_error("%s, sg NULL, len %u/%u.\n",
+__func__, datalen, dlen);
+   return -EINVAL;
+   }
+   sgoffset = 0;
+   sglen = sg->length;
+   page = sg_page(sg);
+
+   }
+   copy = min(datalen, sglen);
+   if (i && page == frags[i - 1].page &&
+   sgoffset + sg->offset ==
+   frags[i - 1].page_offset + frags[i - 1].size) {
+   frags[i - 1].size += copy;
+   } else {
+   if (i >= frag_max) {
+   cxgb3i_log_error("%s, too many pages %u, "
+"dlen %u.\n", __func__,
+frag_max, dlen);
+   return -EINVAL;
+   }
+
+   frags[i].page = page;
+   frags[i].page_offset = sg->offset + sgoffset;
+   frags[i].size = copy;
+   i++;
+   }
+   datalen -= copy;
+   sgoffset += copy;
+   sglen -= copy;
+   } while (datalen);
+
+   return i;
+}
+   
+static inline int task_data_fill_pages(struct cxgb3i_task_data *tdata)
+{
+   int i;
+   for (i = 0; i < tdata->nr_pages; i++)
+   if (!tdata->pages[i]) {
+   tdata->pages[i] = alloc_page(GFP_ATOMIC);
+   if (!tdata->

[PATCH 0/5 2.6.29-rc] cxgb3i -- bug fixes for 2.6.29-rcX

2009-02-09 Thread Karen Xie

[PATCH 0/5 2.6.29-rc] cxgb3i -- bug fixes for 2.6.29-rcX 

From: Karen Xie 

The patches are based on scsi-rc-fixes-2.6 git.

The changes include:

- Added per-task data to track the state of the pdus to be transmitted.
- fixed tx work-request credit array.
- fixed a bug in tx pdu construction where we could over-run the skb's fragment 
list.
- Added missing include file in cxgb3i_ddp.h.
- Update version number to 1.0.1.


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-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/5 2.6.29-rc] cxgb3i -- added per-task data to track transmit progress

2009-02-09 Thread Karen Xie

[PATCH 1/5 2.6.29-rc] cxgb3i -- added per-task data to track transmit progress

From: Karen Xie 

added per-task struct cxgb3i_task_data to track the data transmiting progress 
and the state of the pdus to be transmitted.

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i.h   |   28 
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c |5 +++--
 2 files changed, 31 insertions(+), 2 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index fde6e4c..ba45c1d 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* from cxgb3 LLD */
@@ -113,6 +114,33 @@ struct cxgb3i_endpoint {
struct cxgb3i_conn *cconn;
 };
 
+/**
+ * struct cxgb3i_task_data - private iscsi task data
+ *
+ * @nr_pages:  # tx pages
+ * @nr_frags:  # of coalesced page frags (from scsi sgl)
+ * @frags: coalesced page frags (from scsi sgl)
+ * @pages: tx pages
+ * @skb:   tx pdu skb
+ * @offset:data offset for the next pdu
+ * @count: max. possible pdu payload
+ * @sgoffset:  offset to the first sg entry for a given offset
+ */
+#define MAX_PDU_FULL_PAGES \
+   ((ULP2_MAX_PDU_PAYLOAD + PAGE_SIZE - 1) >> PAGE_SHIFT)
+#define MAX_PDU_FRAGS  ((ULP2_MAX_PDU_PAYLOAD + 512 - 1) / 512)
+
+struct cxgb3i_task_data {
+   unsigned short nr_pages;
+   unsigned short nr_frags;
+   skb_frag_t frags[MAX_PDU_FRAGS];
+   struct page *pages[MAX_PDU_FULL_PAGES];
+   struct sk_buff *skb;
+   unsigned int offset;
+   unsigned int count;
+   unsigned int sgoffset;
+};
+
 int cxgb3i_iscsi_init(void);
 void cxgb3i_iscsi_cleanup(void);
 
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index d83464b..f0434b7 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -364,7 +364,8 @@ cxgb3i_session_create(struct iscsi_endpoint *ep, u16 
cmds_max, u16 qdepth,
 
cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost,
  cmds_max,
- sizeof(struct iscsi_tcp_task),
+ sizeof(struct iscsi_tcp_task) +
+ sizeof(struct cxgb3i_task_data),
  initial_cmdsn, ISCSI_MAX_TARGET);
if (!cls_session)
return NULL;
@@ -844,7 +845,7 @@ static struct scsi_host_template cxgb3i_host_template = {
.proc_name  = "cxgb3i",
.queuecommand   = iscsi_queuecommand,
.change_queue_depth = iscsi_change_queue_depth,
-   .can_queue  = 128 * (ISCSI_DEF_XMIT_CMDS_MAX - 1),
+   .can_queue  = CXGB3I_SCSI_QDEPTH_DFLT - 1,
.sg_tablesize   = SG_ALL,
.max_sectors= 0x,
.cmd_per_lun= ISCSI_DEF_CMD_PER_LUN,

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [RFC] : network configuration for iscsi hba

2009-02-05 Thread Karen Xie

Okay, I think cxgb3i driver can work with the proposed mechanism.

Thanks,
Karen

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Anil Veerabhadrappa
Sent: Thursday, February 05, 2009 6:29 PM
To: open-iscsi@googlegroups.com
Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: RE: [RFC] : network configuration for iscsi hba


On Thu, 2009-02-05 at 17:34 -0800, Karen Xie wrote:
> For dhcp, I am just thinking of the cases where one physical NIC have
> multiple IP addresses, maybe one is for iscsi only, one for RDMA, or
> another for admin/control traffic. They can operate in different
subnet

RDMA shares ip/mac address with host stack, right? Even in the example
provided above the device should support 3 at least separate MAC
addresses, so by specifying multiple iface definitions user should be
able to get this configuration working.

> and managed by different DHCP servers. Maybe this is not typical
setup?
> 
> For the set_config, say a NIC does not support IPv6 but received a
> request to set it. So how should the driver treat any setting it does
> not support? Ignore or return an error?
> 

This should be considered as user error. Users are expected to create
iface definitions based on guidelines (supported parameter list)
outlined in driver's README file.



> -Original Message-
> From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
> On Behalf Of Anil Veerabhadrappa
> Sent: Thursday, February 05, 2009 5:01 PM
> To: open-iscsi@googlegroups.com
> Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin
Li
> Subject: RE: [RFC] : network configuration for iscsi hba
> 
> 
> On Thu, 2009-02-05 at 16:36 -0800, Karen Xie wrote:
> > If it is dhcp, does the dhcp server settings need to be provided? Or
> it
> > is going to be handled outside of iscsi?
> >
> dhcp setting should be zero-conf right? It works based on initial
> broadcast request, DHCPDISCOVER and subsequent unicast exchange
between
> dhcp client and the server. Are you referring to choosing the
preferred
> dhcp server if more than one is present in the network?
> 
> 
> > Also a question about the set_net_config, suppose a list of
parameters
> > are send down, if one or more values are not supported, does the
> > operation marked as fail and the user has re-do the iface file (to
> edit
> > out the unsupported values)?
> >
> 
> Please provide specific examples for discussion. Any device specific
> limitation will be handled by the corresponding driver, our objective
> here is to define a generic interface that works for
> cxgb3i/qla4xxx/bnx2i/...
> 
> > Thanks,
> > Karen
> >
> > -Original Message-
> > From: open-iscsi@googlegroups.com
[mailto:open-is...@googlegroups.com]
> > On Behalf Of Anil Veerabhadrappa
> > Sent: Thursday, February 05, 2009 4:21 PM
> > To: open-iscsi@googlegroups.com
> > Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan;
Benjamin
> Li
> > Subject: RE: [RFC] : network configuration for iscsi hba
> >
> >
> > On Thu, 2009-02-05 at 16:00 -0800, Karen Xie wrote:
> > > Thanks,
> > > What are the possible values of "ISCSI_NET_CFG_BOOTPROTO"?
> > >
> >
> > static and dhcp
> >
> >
> > > Karen
> > >
> > > -Original Message-
> > > From: open-iscsi@googlegroups.com
> [mailto:open-is...@googlegroups.com]
> > > On Behalf Of Anil Veerabhadrappa
> > > Sent: Thursday, February 05, 2009 3:23 PM
> > > To: open-iscsi@googlegroups.com
> > > Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan;
> Benjamin
> > Li
> > > Subject: RE: [RFC] : network configuration for iscsi hba
> > >
> > >
> > > On Thu, 2009-02-05 at 14:33 -0800, Karen Xie wrote:
> > > > -Original Message-
> > > > From: open-iscsi@googlegroups.com
> > [mailto:open-is...@googlegroups.com]
> > > > On Behalf Of Anil Veerabhadrappa
> > > > Sent: Thursday, February 05, 2009 11:23 AM
> > > > To: open-iscsi@googlegroups.com; micha...@cs.wisc.edu
> > > > Cc: mchri...@redhat.com; mc...@broadcom.com; be...@broadcom.com;
> > > > ani...@broadcom.com
> > > > Subject: [RFC] : network configuration for iscsi hba
> > > >
> > > >
> > > > Hi,
> > > >
> > > >We'd like to propose a general scheme for configuring network
> > > > parameters (IP address/mask/DHCP, etc) for iSCSI NICs that use a
> > > private
> > > > IP address. The cur

RE: [RFC] : network configuration for iscsi hba

2009-02-05 Thread Karen Xie

For dhcp, I am just thinking of the cases where one physical NIC have
multiple IP addresses, maybe one is for iscsi only, one for RDMA, or
another for admin/control traffic. They can operate in different subnet
and managed by different DHCP servers. Maybe this is not typical setup?

For the set_config, say a NIC does not support IPv6 but received a
request to set it. So how should the driver treat any setting it does
not support? Ignore or return an error?

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Anil Veerabhadrappa
Sent: Thursday, February 05, 2009 5:01 PM
To: open-iscsi@googlegroups.com
Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: RE: [RFC] : network configuration for iscsi hba


On Thu, 2009-02-05 at 16:36 -0800, Karen Xie wrote:
> If it is dhcp, does the dhcp server settings need to be provided? Or
it
> is going to be handled outside of iscsi?
> 
dhcp setting should be zero-conf right? It works based on initial
broadcast request, DHCPDISCOVER and subsequent unicast exchange between
dhcp client and the server. Are you referring to choosing the preferred
dhcp server if more than one is present in the network?


> Also a question about the set_net_config, suppose a list of parameters
> are send down, if one or more values are not supported, does the
> operation marked as fail and the user has re-do the iface file (to
edit
> out the unsupported values)?
> 

Please provide specific examples for discussion. Any device specific
limitation will be handled by the corresponding driver, our objective
here is to define a generic interface that works for
cxgb3i/qla4xxx/bnx2i/...

> Thanks,
> Karen
> 
> -Original Message-
> From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
> On Behalf Of Anil Veerabhadrappa
> Sent: Thursday, February 05, 2009 4:21 PM
> To: open-iscsi@googlegroups.com
> Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin
Li
> Subject: RE: [RFC] : network configuration for iscsi hba
> 
> 
> On Thu, 2009-02-05 at 16:00 -0800, Karen Xie wrote:
> > Thanks,
> > What are the possible values of "ISCSI_NET_CFG_BOOTPROTO"?
> >
> 
> static and dhcp
> 
> 
> > Karen
> >
> > -Original Message-
> > From: open-iscsi@googlegroups.com
[mailto:open-is...@googlegroups.com]
> > On Behalf Of Anil Veerabhadrappa
> > Sent: Thursday, February 05, 2009 3:23 PM
> > To: open-iscsi@googlegroups.com
> > Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan;
Benjamin
> Li
> > Subject: RE: [RFC] : network configuration for iscsi hba
> >
> >
> > On Thu, 2009-02-05 at 14:33 -0800, Karen Xie wrote:
> > > -Original Message-
> > > From: open-iscsi@googlegroups.com
> [mailto:open-is...@googlegroups.com]
> > > On Behalf Of Anil Veerabhadrappa
> > > Sent: Thursday, February 05, 2009 11:23 AM
> > > To: open-iscsi@googlegroups.com; micha...@cs.wisc.edu
> > > Cc: mchri...@redhat.com; mc...@broadcom.com; be...@broadcom.com;
> > > ani...@broadcom.com
> > > Subject: [RFC] : network configuration for iscsi hba
> > >
> > >
> > > Hi,
> > >
> > >We'd like to propose a general scheme for configuring network
> > > parameters (IP address/mask/DHCP, etc) for iSCSI NICs that use a
> > private
> > > IP address. The current scheme of using sysfs is not very good
> because
> > > bootproto, IP address, netmask, VLAN ID, etc all need to be set
> > > together. Having separate sysfs entries and updating them
separately
> > and
> > > independently will not work. Putting everything in a netlink
message
> > > seems to be a better solution. After weighing different solutions,
> we
> > > feel expanding existing netlink family, NETLINK_ISCSI between
iscsid
> > and
> > > scsi_transport_iscsi is a flexible solution which allows
information
> > > flow to be initiated from either side. Also this solution is
> flexible
> > > and elegantly handles network devices with multiple IP addresses.
> > >
> > >The objective of this proposal is to make this interface common
> for
> > > all iscsi offload solutions supported by open-iscsi. We would like
> to
> > > hear comments and suggestions from other iscsi offload vendors in
> > > defining this interface.
> > >
> > > Regards,
> > > Anil Veerabhadrappa
> > >
> > >
> > > Proposal to add netlink message type:
> > > -
> > > 3 new netlink message types are required to sup

RE: [RFC] : network configuration for iscsi hba

2009-02-05 Thread Karen Xie

If it is dhcp, does the dhcp server settings need to be provided? Or it
is going to be handled outside of iscsi?

Also a question about the set_net_config, suppose a list of parameters
are send down, if one or more values are not supported, does the
operation marked as fail and the user has re-do the iface file (to edit
out the unsupported values)?

Thanks,
Karen

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Anil Veerabhadrappa
Sent: Thursday, February 05, 2009 4:21 PM
To: open-iscsi@googlegroups.com
Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: RE: [RFC] : network configuration for iscsi hba


On Thu, 2009-02-05 at 16:00 -0800, Karen Xie wrote:
> Thanks,
> What are the possible values of "ISCSI_NET_CFG_BOOTPROTO"?
> 

static and dhcp


> Karen
> 
> -Original Message-
> From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
> On Behalf Of Anil Veerabhadrappa
> Sent: Thursday, February 05, 2009 3:23 PM
> To: open-iscsi@googlegroups.com
> Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin
Li
> Subject: RE: [RFC] : network configuration for iscsi hba
> 
> 
> On Thu, 2009-02-05 at 14:33 -0800, Karen Xie wrote:
> > -Original Message-
> > From: open-iscsi@googlegroups.com
[mailto:open-is...@googlegroups.com]
> > On Behalf Of Anil Veerabhadrappa
> > Sent: Thursday, February 05, 2009 11:23 AM
> > To: open-iscsi@googlegroups.com; micha...@cs.wisc.edu
> > Cc: mchri...@redhat.com; mc...@broadcom.com; be...@broadcom.com;
> > ani...@broadcom.com
> > Subject: [RFC] : network configuration for iscsi hba
> >
> >
> > Hi,
> >
> >We'd like to propose a general scheme for configuring network
> > parameters (IP address/mask/DHCP, etc) for iSCSI NICs that use a
> private
> > IP address. The current scheme of using sysfs is not very good
because
> > bootproto, IP address, netmask, VLAN ID, etc all need to be set
> > together. Having separate sysfs entries and updating them separately
> and
> > independently will not work. Putting everything in a netlink message
> > seems to be a better solution. After weighing different solutions,
we
> > feel expanding existing netlink family, NETLINK_ISCSI between iscsid
> and
> > scsi_transport_iscsi is a flexible solution which allows information
> > flow to be initiated from either side. Also this solution is
flexible
> > and elegantly handles network devices with multiple IP addresses.
> >
> >The objective of this proposal is to make this interface common
for
> > all iscsi offload solutions supported by open-iscsi. We would like
to
> > hear comments and suggestions from other iscsi offload vendors in
> > defining this interface.
> >
> > Regards,
> > Anil Veerabhadrappa
> >
> >
> > Proposal to add netlink message type:
> > -
> > 3 new netlink message types are required to support network
config
> > message exchange between user and kernel components,
> >   1. ISCSI_UEVENT_SET_NET_CONFIG  - push iface info to driver to
> > configure
> > an iscsi network interface
> >   2. ISCSI_UEVENT_GET_NET_CONFIG  - get MAC address list, etc'
> >   3. ISCSI_KEVENT_NET_CONFIG  - propagate attribute changes
> > from
> > adapter to iscsid (e.g. advertise newly obtained dhcp address)
> >
> > iscsid will use this netlink messages to pass network
> configuration
> > between user mode application and the driver. Once this message is
> > received by scsi_transport_iscsi module it will call driver's newly
> > added callback handlers in the iscsi_transport structure(net_config
&
> > get_net_config) and also broadcast netlink message back to any
> hardware
> > vendor's user level daemons
> >
> >
> > ISCSI_XEVENT_NET_CONFIG message payload format:
> > ---
> > Payload consists of one or more config parameters defined in TLV
> > (Type - Length - Value) format.
> >
> > struct net_cfg_tlv {
> >   uint32_t type;
> > uint32_t length;
> > uint8_t value[0];
> > };
> >
> >
> > Message types:
> > --
> > This interface is envisioned to support standard network
> parameters
> > such as netdev name, MAC address, IPv4/IPv6 address, VLAN, boot
> protocol
> > (static or dhcp), etc'. Please refer to 'net_cfg_e' in proposed
header
> > file changes below

RE: [RFC] : network configuration for iscsi hba

2009-02-05 Thread Karen Xie

Thanks,
What are the possible values of "ISCSI_NET_CFG_BOOTPROTO"?

Karen

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Anil Veerabhadrappa
Sent: Thursday, February 05, 2009 3:23 PM
To: open-iscsi@googlegroups.com
Cc: micha...@cs.wisc.edu; mchri...@redhat.com; Michael Chan; Benjamin Li
Subject: RE: [RFC] : network configuration for iscsi hba


On Thu, 2009-02-05 at 14:33 -0800, Karen Xie wrote:
> -Original Message-
> From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
> On Behalf Of Anil Veerabhadrappa
> Sent: Thursday, February 05, 2009 11:23 AM
> To: open-iscsi@googlegroups.com; micha...@cs.wisc.edu
> Cc: mchri...@redhat.com; mc...@broadcom.com; be...@broadcom.com;
> ani...@broadcom.com
> Subject: [RFC] : network configuration for iscsi hba
> 
> 
> Hi,
> 
>We'd like to propose a general scheme for configuring network
> parameters (IP address/mask/DHCP, etc) for iSCSI NICs that use a
private
> IP address. The current scheme of using sysfs is not very good because
> bootproto, IP address, netmask, VLAN ID, etc all need to be set
> together. Having separate sysfs entries and updating them separately
and
> independently will not work. Putting everything in a netlink message
> seems to be a better solution. After weighing different solutions, we
> feel expanding existing netlink family, NETLINK_ISCSI between iscsid
and
> scsi_transport_iscsi is a flexible solution which allows information
> flow to be initiated from either side. Also this solution is flexible
> and elegantly handles network devices with multiple IP addresses.
> 
>The objective of this proposal is to make this interface common for
> all iscsi offload solutions supported by open-iscsi. We would like to
> hear comments and suggestions from other iscsi offload vendors in
> defining this interface.
> 
> Regards,
> Anil Veerabhadrappa
> 
> 
> Proposal to add netlink message type:
> -
> 3 new netlink message types are required to support network config
> message exchange between user and kernel components,
>   1. ISCSI_UEVENT_SET_NET_CONFIG  - push iface info to driver to
> configure
> an iscsi network interface
>   2. ISCSI_UEVENT_GET_NET_CONFIG  - get MAC address list, etc'
>   3. ISCSI_KEVENT_NET_CONFIG  - propagate attribute changes
> from
> adapter to iscsid (e.g. advertise newly obtained dhcp address)
> 
> iscsid will use this netlink messages to pass network
configuration
> between user mode application and the driver. Once this message is
> received by scsi_transport_iscsi module it will call driver's newly
> added callback handlers in the iscsi_transport structure(net_config &
> get_net_config) and also broadcast netlink message back to any
hardware
> vendor's user level daemons
> 
> 
> ISCSI_XEVENT_NET_CONFIG message payload format:
> ---
> Payload consists of one or more config parameters defined in TLV
> (Type - Length - Value) format.
> 
> struct net_cfg_tlv {
>   uint32_t type;
> uint32_t length;
> uint8_t value[0];
> };
> 
> 
> Message types:
> --
> This interface is envisioned to support standard network
parameters
> such as netdev name, MAC address, IPv4/IPv6 address, VLAN, boot
protocol
> (static or dhcp), etc'. Please refer to 'net_cfg_e' in proposed header
> file changes below.
> 
> 
> Advantages:
> ---
> This approach is much cleaner and delinks network configuration
> parameters currently bound to host attributes. Old scheme actually
> breaks the layering scheme as seen below,
> 
>SCSI   (net config parametes currently resides here)
>  |
>iSCSI 
>  |
>   TCP/IP
> 
> This new approach is a deviation from current host attributes
> approach and places emphasis in iface components of iscsid and the
LLD.
> 
> 
> Changes to iscsi transport headers:
> ---
> 
> diff --git a/include/iscsi_if.h b/include/iscsi_if.h
> index afa86e8..76eea8c 100644
> --- a/include/iscsi_if.h
> +++ b/include/iscsi_if.h
> @@ -51,6 +51,8 @@ enum iscsi_uevent_e {
>   ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
>   ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
>   ISCSI_UEVENT_CREATE_BOUND_SESSION   = UEVENT_BASE + 18,
> + ISCSI_UEVENT_SET_NET_CONFIG = UEVENT_BASE + 19,
> + ISCSI_UEVENT_GET_NET_CONFIG = UEVENT_BASE + 20,
>  
>   /* up events */
>   ISCSI_KEVENT_RECV_PDU   = KEVENT_BASE + 1,
> @@

RE: [PATCH 2.6.29 1/1] cxgb3i - more transmit work-request checks

2009-02-05 Thread Karen Xie

Thanks, Mike,

I will re-submit the patch against scsi-rc-fixes. This one was based on
scsi-misc-2.6/linux-2.6-iscsi.

Karen 

-Original Message-
From: Mike Christie [mailto:micha...@cs.wisc.edu] 
Sent: Thursday, February 05, 2009 1:43 PM
To: Karen Xie
Cc: open-iscsi@googlegroups.com; linux-s...@vger.kernel.org;
james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 2.6.29 1/1] cxgb3i - more transmit work-request
checks

Karen Xie wrote:
> [PATCH 2.6.29 1/1] cxgb3i - more transmit work-request checks
> 
> From: Karen Xie 
> 
> - added more checkings for transmit work-request.
> - reserve one work-request for credit return.
> - stop queueing up the outgoing pdus if transmit window is full.
> - split the skb cb into tx and rx portion
> 

What kernel was this made against? I think the patch might include some 
changes that already went upstream. You might want to rebase the patch 
against scsi-rc-fixes.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [RFC] : network configuration for iscsi hba

2009-02-05 Thread Karen Xie

-Original Message-
From: open-iscsi@googlegroups.com [mailto:open-is...@googlegroups.com]
On Behalf Of Anil Veerabhadrappa
Sent: Thursday, February 05, 2009 11:23 AM
To: open-iscsi@googlegroups.com; micha...@cs.wisc.edu
Cc: mchri...@redhat.com; mc...@broadcom.com; be...@broadcom.com;
ani...@broadcom.com
Subject: [RFC] : network configuration for iscsi hba


Hi,

   We'd like to propose a general scheme for configuring network
parameters (IP address/mask/DHCP, etc) for iSCSI NICs that use a private
IP address. The current scheme of using sysfs is not very good because
bootproto, IP address, netmask, VLAN ID, etc all need to be set
together. Having separate sysfs entries and updating them separately and
independently will not work. Putting everything in a netlink message
seems to be a better solution. After weighing different solutions, we
feel expanding existing netlink family, NETLINK_ISCSI between iscsid and
scsi_transport_iscsi is a flexible solution which allows information
flow to be initiated from either side. Also this solution is flexible
and elegantly handles network devices with multiple IP addresses.

   The objective of this proposal is to make this interface common for
all iscsi offload solutions supported by open-iscsi. We would like to
hear comments and suggestions from other iscsi offload vendors in
defining this interface.

Regards,
Anil Veerabhadrappa


Proposal to add netlink message type:
-
3 new netlink message types are required to support network config
message exchange between user and kernel components,
1. ISCSI_UEVENT_SET_NET_CONFIG  - push iface info to driver to
configure
an iscsi network interface
2. ISCSI_UEVENT_GET_NET_CONFIG  - get MAC address list, etc'
3. ISCSI_KEVENT_NET_CONFIG  - propagate attribute changes
from
adapter to iscsid (e.g. advertise newly obtained dhcp address)

iscsid will use this netlink messages to pass network configuration
between user mode application and the driver. Once this message is
received by scsi_transport_iscsi module it will call driver's newly
added callback handlers in the iscsi_transport structure(net_config &
get_net_config) and also broadcast netlink message back to any hardware
vendor's user level daemons


ISCSI_XEVENT_NET_CONFIG message payload format:
---
Payload consists of one or more config parameters defined in TLV
(Type - Length - Value) format.

struct net_cfg_tlv {
uint32_t type;
uint32_t length;
uint8_t value[0];
};


Message types:
--
This interface is envisioned to support standard network parameters
such as netdev name, MAC address, IPv4/IPv6 address, VLAN, boot protocol
(static or dhcp), etc'. Please refer to 'net_cfg_e' in proposed header
file changes below.


Advantages:
---
This approach is much cleaner and delinks network configuration
parameters currently bound to host attributes. Old scheme actually
breaks the layering scheme as seen below,

   SCSI   (net config parametes currently resides here)
 |
   iSCSI 
 |
  TCP/IP

This new approach is a deviation from current host attributes
approach and places emphasis in iface components of iscsid and the LLD.


Changes to iscsi transport headers:
---

diff --git a/include/iscsi_if.h b/include/iscsi_if.h
index afa86e8..76eea8c 100644
--- a/include/iscsi_if.h
+++ b/include/iscsi_if.h
@@ -51,6 +51,8 @@ enum iscsi_uevent_e {
ISCSI_UEVENT_SET_HOST_PARAM = UEVENT_BASE + 16,
ISCSI_UEVENT_UNBIND_SESSION = UEVENT_BASE + 17,
ISCSI_UEVENT_CREATE_BOUND_SESSION   = UEVENT_BASE + 18,
+   ISCSI_UEVENT_SET_NET_CONFIG = UEVENT_BASE + 19,
+   ISCSI_UEVENT_GET_NET_CONFIG = UEVENT_BASE + 20,
 
/* up events */
ISCSI_KEVENT_RECV_PDU   = KEVENT_BASE + 1,
@@ -59,6 +61,7 @@ enum iscsi_uevent_e {
ISCSI_KEVENT_DESTROY_SESSION= KEVENT_BASE + 4,
ISCSI_KEVENT_UNBIND_SESSION = KEVENT_BASE + 5,
ISCSI_KEVENT_CREATE_SESSION = KEVENT_BASE + 6,
+   ISCSI_KEVENT_NET_CONFIG = KEVENT_BASE + 7,
 };
 
 enum iscsi_tgt_dscvr {
@@ -317,6 +320,42 @@ enum iscsi_host_param {
 #define ISCSI_HOST_NETDEV_NAME (1ULL <<
ISCSI_HOST_PARAM_NETDEV_NAME)
 #define ISCSI_HOST_IPADDRESS   (1ULL <<
ISCSI_HOST_PARAM_IPADDRESS)
 
+/* iscsi network stack parameters */
+enum iscsi_net_cfg_e {
+   ISCSI_NET_CFG_UNKNOWN   0x00,
+
+   ISCSI_NET_CFG_NETDEV_NAME   ISCSI_NET_CFG_UNKNOWN +
1,
+   ISCSI_NET_CFG_MAC_ADDR  ISCSI_NET_CFG_UNKNOWN +
2,
+   ISCSI_NET_CFG_IPV4_ADDR ISCSI_NET_CFG_UNKNOWN +
3,
+   ISCSI_NET_CFG_IPV6_ADDR ISCSI_NET_CFG_UNKNOWN +
4,
+   ISCSI_NET_CFG_IPV4_NETMASK  ISCSI_NET_CFG_UNKNOWN +
5,
+   ISCSI_NET_CFG_IPV6_NETMASK 

[PATCH 2.6.29 1/1] cxgb3i - more transmit work-request checks

2009-02-03 Thread Karen Xie

[PATCH 2.6.29 1/1] cxgb3i - more transmit work-request checks

From: Karen Xie 

- added more checkings for transmit work-request.
- reserve one work-request for credit return.
- stop queueing up the outgoing pdus if transmit window is full.
- split the skb cb into tx and rx portion

Signed-off-by: Karen Xie 
---

 drivers/scsi/cxgb3i/cxgb3i_ddp.h |2 +
 drivers/scsi/cxgb3i/cxgb3i_offload.c |  132 --
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   28 +--
 drivers/scsi/cxgb3i/cxgb3i_pdu.c |2 -
 4 files changed, 114 insertions(+), 50 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
index 5c7c4d9..f675807 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h
+++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h
@@ -13,6 +13,8 @@
 #ifndef __CXGB3I_ULP2_DDP_H__
 #define __CXGB3I_ULP2_DDP_H__
 
+#include 
+
 /**
  * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity
  *
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c 
b/drivers/scsi/cxgb3i/cxgb3i_offload.c
index a865f1f..faa7a36 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_offload.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c
@@ -23,19 +23,19 @@
 #include "cxgb3i_ddp.h"
 
 #ifdef __DEBUG_C3CN_CONN__
-#define c3cn_conn_debug cxgb3i_log_info
+#define c3cn_conn_debugcxgb3i_log_debug
 #else
 #define c3cn_conn_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_TX__
-#define c3cn_tx_debug cxgb3i_log_debug
+#define c3cn_tx_debug  cxgb3i_log_debug
 #else
 #define c3cn_tx_debug(fmt...)
 #endif
 
 #ifdef __DEBUG_C3CN_RX__
-#define c3cn_rx_debug cxgb3i_log_debug
+#define c3cn_rx_debug  cxgb3i_log_debug
 #else
 #define c3cn_rx_debug(fmt...)
 #endif
@@ -301,8 +301,8 @@ static void act_open_req_arp_failure(struct t3cdev *dev, 
struct sk_buff *skb)
 static void skb_entail(struct s3_conn *c3cn, struct sk_buff *skb,
   int flags)
 {
-   CXGB3_SKB_CB(skb)->seq = c3cn->write_seq;
-   CXGB3_SKB_CB(skb)->flags = flags;
+   skb_tcp_seq(skb) = c3cn->write_seq;
+   skb_flags(skb) = flags;
__skb_queue_tail(&c3cn->write_queue, skb);
 }
 
@@ -457,12 +457,9 @@ static unsigned int wrlen __read_mostly;
  * The number of WRs needed for an skb depends on the number of fragments
  * in the skb and whether it has any payload in its main body.  This maps the
  * length of the gather list represented by an skb into the # of necessary WRs.
- *
- * The max. length of an skb is controlled by the max pdu size which is ~16K.
- * Also, assume the min. fragment length is the sector size (512), then add
- * extra fragment counts for iscsi bhs and payload padding.
+ * The extra two fragments are for iscsi bhs and payload padding.
  */
-#define SKB_WR_LIST_SIZE   (16384/512 + 3)
+#define SKB_WR_LIST_SIZE   (MAX_SKB_FRAGS + 2)
 static unsigned int skb_wrs[SKB_WR_LIST_SIZE] __read_mostly;
 
 static void s3_init_wr_tab(unsigned int wr_len)
@@ -485,7 +482,7 @@ static void s3_init_wr_tab(unsigned int wr_len)
 
 static inline void reset_wr_list(struct s3_conn *c3cn)
 {
-   c3cn->wr_pending_head = NULL;
+   c3cn->wr_pending_head = c3cn->wr_pending_tail = NULL;
 }
 
 /*
@@ -496,7 +493,7 @@ static inline void reset_wr_list(struct s3_conn *c3cn)
 static inline void enqueue_wr(struct s3_conn *c3cn,
  struct sk_buff *skb)
 {
-   skb_wr_data(skb) = NULL;
+   skb_tx_wr_next(skb) = NULL;
 
/*
 * We want to take an extra reference since both us and the driver
@@ -509,10 +506,22 @@ static inline void enqueue_wr(struct s3_conn *c3cn,
if (!c3cn->wr_pending_head)
c3cn->wr_pending_head = skb;
else
-   skb_wr_data(skb) = skb;
+   skb_tx_wr_next(c3cn->wr_pending_tail) = skb;
c3cn->wr_pending_tail = skb;
 }
 
+static int count_pending_wrs(struct s3_conn *c3cn)
+{
+   int n = 0;
+   const struct sk_buff *skb = c3cn->wr_pending_head;
+
+   while (skb) {
+   n += skb->csum;
+   skb = skb_tx_wr_next(skb);
+   }
+   return n;
+}
+
 static inline struct sk_buff *peek_wr(const struct s3_conn *c3cn)
 {
return c3cn->wr_pending_head;
@@ -529,8 +538,8 @@ static inline struct sk_buff *dequeue_wr(struct s3_conn 
*c3cn)
 
if (likely(skb)) {
/* Don't bother clearing the tail */
-   c3cn->wr_pending_head = skb_wr_data(skb);
-   skb_wr_data(skb) = NULL;
+   c3cn->wr_pending_head = skb_tx_wr_next(skb);
+   skb_tx_wr_next(skb) = NULL;
}
return skb;
 }
@@ -543,13 +552,14 @@ static void purge_wr_queue(struct s3_conn *c3cn)
 }
 
 static inline void make_tx_data_wr(struct s3_conn *c3cn, struct sk_buff *skb,
-  int len)
+  int len, int req_completion)
 {
struct tx_data_wr 

[PATCH v2] iscsi_tcp - make padbuf non-static

2009-01-10 Thread Karen Xie

[PATCH v2] iscsi_tcp - make padbuf non-static

From: Karen Xie 

Rebased patch on scsi-misc tree head.

virt_to_page() call should not be used on kernel text and data addresses.
virt_to_page() is used by sg_init_one(). So change padbuf to be allocated 
within iscsi_segment.

Signed-off-by: Karen Xie 
---

 drivers/scsi/libiscsi_tcp.c |3 +--
 include/scsi/libiscsi_tcp.h |1 +
 2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index a745f91..e7705d3 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -177,7 +177,6 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
   struct iscsi_segment *segment, int recv,
   unsigned copied)
 {
-   static unsigned char padbuf[ISCSI_PAD_LEN];
struct scatterlist sg;
unsigned int pad;
 
@@ -233,7 +232,7 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
debug_tcp("consume %d pad bytes\n", pad);
segment->total_size += pad;
segment->size = pad;
-   segment->data = padbuf;
+   segment->data = segment->padbuf;
return 0;
}
}
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h
index 83e32f6..9e3182e 100644
--- a/include/scsi/libiscsi_tcp.h
+++ b/include/scsi/libiscsi_tcp.h
@@ -39,6 +39,7 @@ struct iscsi_segment {
unsigned inttotal_copied;
 
struct hash_desc*hash;
+   unsigned char   padbuf[ISCSI_PAD_LEN];
unsigned char   recv_digest[ISCSI_DIGEST_SIZE];
unsigned char   digest[ISCSI_DIGEST_SIZE];
unsigned intdigest_len;

--~--~-~--~~~---~--~~
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] iscsi_tcp - make padbuf non-static

2009-01-08 Thread Karen Xie

[PATCH] iscsi_tcp - make padbuf non-static

From: Karen Xie 

virt_to_page() call should not be used on kernel text and data addresses.
virt_to_page() is used by sg_init_one(). So change padbuf to be allocated 
within iscsi_segment.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index ed6c54c..3b07868 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -190,7 +190,6 @@ iscsi_tcp_segment_splice_digest(struct iscsi_segment 
*segment, void *digest)
 static inline int
 iscsi_tcp_segment_done(struct iscsi_segment *segment, int recv, unsigned 
copied)
 {
-   static unsigned char padbuf[ISCSI_PAD_LEN];
struct scatterlist sg;
unsigned int pad;
 
@@ -245,7 +244,7 @@ iscsi_tcp_segment_done(struct iscsi_segment *segment, int 
recv, unsigned copied)
debug_tcp("consume %d pad bytes\n", pad);
segment->total_size += pad;
segment->size = pad;
-   segment->data = padbuf;
+   segment->data = segment->padbuf;
return 0;
}
 
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index 498d8ca..a906db2 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -40,6 +40,7 @@ struct iscsi_segment {
unsigned inttotal_copied;
 
struct hash_desc*hash;
+   unsigned char   padbuf[ISCSI_PAD_LEN];
unsigned char   recv_digest[ISCSI_DIGEST_SIZE];
unsigned char   digest[ISCSI_DIGEST_SIZE];
unsigned intdigest_len;

--~--~-~--~~~---~--~~
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] iscsi_tcp - make padbuf non-static

2009-01-08 Thread Karen Xie

[PATCH] iscsi_tcp - make padbuf non-static

From: Karen Xie 

virt_to_page() call should not be used on kernel text and data addresses.
virt_to_page() is used by sg_init_one(). So change padbuf to be allocated 
within iscsi_segment.

Signed-off-by: Karen Xie 
---

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


diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index ed6c54c..3b07868 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -190,7 +190,6 @@ iscsi_tcp_segment_splice_digest(struct iscsi_segment 
*segment, void *digest)
 static inline int
 iscsi_tcp_segment_done(struct iscsi_segment *segment, int recv, unsigned 
copied)
 {
-   static unsigned char padbuf[ISCSI_PAD_LEN];
struct scatterlist sg;
unsigned int pad;
 
@@ -245,7 +244,7 @@ iscsi_tcp_segment_done(struct iscsi_segment *segment, int 
recv, unsigned copied)
debug_tcp("consume %d pad bytes\n", pad);
segment->total_size += pad;
segment->size = pad;
-   segment->data = padbuf;
+   segment->data = segment->padbuf;
return 0;
}
 
diff --git a/drivers/scsi/iscsi_tcp.h b/drivers/scsi/iscsi_tcp.h
index 498d8ca..a906db2 100644
--- a/drivers/scsi/iscsi_tcp.h
+++ b/drivers/scsi/iscsi_tcp.h
@@ -40,6 +40,7 @@ struct iscsi_segment {
unsigned inttotal_copied;
 
struct hash_desc*hash;
+   unsigned char   padbuf[ISCSI_PAD_LEN];
unsigned char   recv_digest[ISCSI_DIGEST_SIZE];
unsigned char   digest[ISCSI_DIGEST_SIZE];
unsigned intdigest_len;

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [PATCH v2 0/2 2.6.29] cxgb3i -- open-iscsi initiator acceleration

2008-12-15 Thread Karen Xie

Hi, Pasi,

Here are some throughput numbers we see with disktest, one tcp connection 
(iscsi session).

The setup are between a pair of chelsio 10G adapters. The target is Chelsio's 
ramdisk target with data discarded (similiar to IET's NULLIO mode). The Chelsio 
target is used because of the digest offload and payload ddp. 

The ethernet frame is standard 1500 bytes.

The numbers are about 3 months old, but you get the idea :) For cxgb3i driver, 
since the digest is offloaded the performance is very similar in the digest off 
case, so only the numbers for digest on are shown.

We will re-run the tests and get the cpu stats too, will keep you posted.


Test cxgb3i iscsi-tcp iscsi-tcp
 digest on  digest on digest off
 (MB/sec)   (MB/sec)  (MB/sec)
===

512-read 36.85   34.1336.69
1k-read  71.91   58.5266.81
2k-read  137.24  97.75128.46
4k-read  280.61 137.98214.04
8k-read  531.34 201.87325.09
16k-read 953.67 226.49429.32
64k-read 1099.57248.57626.30
128k-read1102.65256.04613.94
256k-read1105.28262.28642.73
 
512-write39.54   34.18 38.36
1k-write 79.52   56.51 75.06
2k-write 158.03  84.12140.85
4k-write 314.56 126.33282.72
8k-write 559.83 155.49528.24
16k-write968.84 168.50676.38
64k-write1099.31182.82978.82
128k-write   1074.62182.55974.18
256k-write   1063.85185.67972.88


-Original Message-
From: Pasi Kärkkäinen [mailto:pa...@iki.fi] 
Sent: Monday, December 15, 2008 6:06 AM
To: open-iscsi@googlegroups.com
Cc: linux-s...@vger.kernel.org; micha...@cs.wisc.edu; 
james.bottom...@hansenpartnership.com; Karen Xie
Subject: Re: [PATCH v2 0/2 2.6.29] cxgb3i -- open-iscsi initiator acceleration

On Tue, Dec 09, 2008 at 02:15:22PM -0800, Karen Xie wrote:
> 
> [PATCH v2 0/2 2.6.29] cxgb3i -- open-iscsi initiator acceleration 
> 
> From: Karen Xie 
> 
> Here is the updated patchset for adding cxgb3i iscsi initiator.
> 
> The updated version incorporates the comments from Mike and Boaz:
> - remove the cxgb3 sysfs entry for the private iscsi ip address, it can be
>   accessed from iscsi.
> - in cxgb3i.txt, added error message logged for not setting 
> MaxRecvDataSegmentLength properly.
> - renamed cxgb3i Makefile to Kbuild
> - removed "select ISCSI_TCP" in Kconfig
> - consistent handling of AHS: on tx, reserve rooms for AHS; on rx, assume we 
> could receive AHS.
> - add support of bi-directional commands for ddp setup,
> 
> The cxgb3i driver, especially the part handles the offloaded iscsi tcp 
> connection mangement, has gone through the netdev review 
> (http://marc.info/?l=linux-netdev&m=121944339211552, 
> http://marc.info/?l=linux-netdev&m=121989660016124).
> 
> The cxgb3i driver provides iscsi acceleration (PDU offload and payload data 
> direct placement) to the open-iscsi initiator. It accesses the hardware 
> through the cxgb3 module.
> 

Hello!

Do you guys have performance comparison/numbers for normal open-iscsi over tcp 
vs. cxgb3i accelerated?

Would be nice to see throughput/iops/cpu-usage statistics..

-- Pasi

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



RE: [PATCH 3/3 2.6.29] cxgb3i -- documentation

2008-12-15 Thread Karen Xie

Thanks for the spell check. Will fix them.

Thanks,
Karen

-Original Message-
From: Randy Dunlap [mailto:randy.dun...@oracle.com] 
Sent: Sunday, December 14, 2008 4:46 PM
To: Karen Xie
Cc: linux-s...@vger.kernel.org; open-iscsi@googlegroups.com;
micha...@cs.wisc.edu; james.bottom...@hansenpartnership.com
Subject: Re: [PATCH 3/3 2.6.29] cxgb3i -- documentation

Karen Xie wrote:
> [PATCH 3/3 2.6.29] cxgb3i -- documentation
> 
> From: Karen Xie 
> 
> - document cxgb3i driver's capablity and setup steps to be used with
>   open-iscsi initiator.
> 
> Signed-off-by: Karen Xie 
> ---
> 
>  Documentation/scsi/cxgb3i.txt |   81
+
>  1 files changed, 81 insertions(+), 0 deletions(-)
>  create mode 100644 Documentation/scsi/cxgb3i.txt
> 
> 
> diff --git a/Documentation/scsi/cxgb3i.txt
b/Documentation/scsi/cxgb3i.txt
> new file mode 100644
> index 000..9456013
> --- /dev/null
> +++ b/Documentation/scsi/cxgb3i.txt
> @@ -0,0 +1,81 @@
> +Chelsio S3 iSCSI Driver for Linux
> +
> +Introduction
> +
> +
> +The Chelsio T3 ASIC based Adapters (S310, S320, S302, S304, Mezz
cards, etc.
> +series of products) supports iSCSI acceleration and iSCSI Direct Data
Placement

   support

> +(DDP) where the hardware handles the expensive byte touching
operations, such
> +as CRC computation and verification, and direct DMA to the final host
memory
> +destination:
> +
> + - iSCSI PDU digest generation and verification
> +
> +   On transmitting, Chelsio S3 h/w computes and inserts the
Header and
> +   Data digest into the PDUs.
> +   On receiving, Chelsio S3 h/w computes and verifies the Header
and
> +   Data digest of the PDUs.
> +
> + - Direct Data Placement (DDP)
> +
> +   S3 h/w can directly place the iSCSI Data-In or Data-Out PDU's
> +   payload into pre-posted final destination host-memory buffers
based
> +   on the Initiator Task Tag (ITT) in Data-In or Target Task Tag
(TTT)
> +   in Data-Out PDUs.
> +
> + - PDU Transmit and Recovery
> +
> +   On transmitting, S3 h/w accepts the complete PDU (header +
data)
> +   from the host driver, computes and inserts the digests,
decomposes
> +   the PDU into multiple TCP segments if necessary, and transmit
all
> +   the TCP segments onto the wire. It handles TCP retransmission
if
> +   needed.
> +
> +   On receving, S3 h/w recovers the iSCSI PDU by reassembling TCP

 receiving,

> +   segments, separating the header and data, calculating and
verifying
> +   the digests, then forwards the header to the host. The payload
data,

forwarding

> +   if possible, will be directly placed into the pre-posted host
DDP
> +   buffer. Otherwise, the payload data will be sent to the host
too.
> +
> +The cxgb3i driver interfaces with open-iscsi initiator and provides
the iSCSI
> +acceleration through Chelsio hardware wherever applicable.
> +
> +Using the cxgb3i Driver
> +===
> +
> +The following steps need to be taken to accelerates the open-iscsi
initiator:
> +
> +1. Load the cxgb3i driver: "modprobe cxgb3i"
> +
> +   The cxgb3i module registers a new transport class "cxgb3i" with
open-iscsi.
> +
> +   * in the case of recompiling the kernel, the cxgb3i selection is
located at
> + Device Drivers
> + SCSI device support --->
> + [*] SCSI low-level drivers  --->
> +Chelsio S3xx iSCSI support
> +
> +2. Create an interface file located under /etc/iscsi/ifaces/ for the
new
> +   transport class "cxgb3i".
> +
> +   The content of the file should be in the following format:
> + iface.transport_name = cxgb3i
> + iface.net_ifacename = 
> + iface.ipaddress = 
> +
> +   * if iface.ipaddress is specified,  needs to be
either the
> + same as the ethX's ip address or an address on the same subnet.
Make
> + sure the ip address is unique in the network.
> +
> +3. edit /etc/iscsi/iscsid.conf
> +   The default setting for MaxRecvDataSegmentLength (131072) is too
big, search

 
big;

> +   and replace all occurances of "xxx.iscsi.MaxRecvDataSegmentLength"
to be a

  occurrences

> +   value no bigger than 15872 (for example 8192):
> +
> + discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 8192
> + node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192
> +
> +4. To direct open-iscsi traffic to go through cxgb3i's accelerated
path,
> +   "-I " option needs to be specified with most of
the
> +   iscsiadm command.  is t

[PATCH v2 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

2008-12-09 Thread Karen Xie

[PATCH v2 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

The accelerated iSCSI traffic could use a private IP address unknown to the OS:
- The IP address is required in both drivers to manage ARP requests and 
connection set up.
- Added an control call to retrieve the ip address.
- Reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/adapter.h|1 +
 drivers/net/cxgb3/cxgb3_ctl_defs.h |7 
 drivers/net/cxgb3/cxgb3_main.c |1 +
 drivers/net/cxgb3/cxgb3_offload.c  |   65 -
 drivers/net/cxgb3/sge.c|   72 ++--
 5 files changed, 124 insertions(+), 22 deletions(-)


diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index bc8e241..0c60f40 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -63,6 +63,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
+   __be32 iscsi_ipv4addr;
 };
 
 enum { /* adapter flags */
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 1d8d46e..58b5bf9 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,6 +57,7 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+   GET_ISCSI_IPV4ADDR  = 51,
 };
 
 /*
@@ -86,6 +87,12 @@ struct iff_mac {
u16 vlan_tag;
 };
 
+/* Structure used to request a port's iSCSI IPv4 address */
+struct iscsi_ipv4addr {
+   struct net_device *dev; /* the net_device */
+   __be32 ipv4addr;/* the return iSCSI IPv4 address */
+};
+
 struct pci_dev;
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 2c341f8..809aa9f 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 265aa8a..35dc683 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -182,7 +182,9 @@ static struct net_device *get_iff_from_mac(struct adapter 
*adapter,
 static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req,
  void *data)
 {
+   int i;
int ret = 0;
+   unsigned int val = 0;
struct ulp_iscsi_info *uiip = data;
 
switch (req) {
@@ -191,31 +193,54 @@ static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, 
unsigned int req,
uiip->llimit = t3_read_reg(adapter, A_ULPRX_ISCSI_LLIMIT);
uiip->ulimit = t3_read_reg(adapter, A_ULPRX_ISCSI_ULIMIT);
uiip->tagmask = t3_read_reg(adapter, A_ULPRX_ISCSI_TAGMASK);
+
+   val = t3_read_reg(adapter, A_ULPRX_ISCSI_PSZ);
+   for (i = 0; i < 4; i++, val >>= 8)
+   uiip->pgsz_factor[i] = val & 0xFF;
+
+   val = t3_read_reg(adapter, A_TP_PARA_REG7);
+   uiip->max_txsz =
+   uiip->max_rxsz = min((val >> S_PMMAXXFERLEN0)&M_PMMAXXFERLEN0,
+(val >> S_PMMAXXFERLEN1)&M_PMMAXXFERLEN1);
/*
 * On tx, the iscsi pdu has to be <= tx page size and has to
 * fit into the Tx PM FIFO.
 */
-   uiip->max_txsz = min(adapter->params.tp.tx_pg_size,
-t3_read_reg(adapter, A_PM1_TX_CFG) >> 17);
-   /* on rx, the iscsi pdu has to be < rx page size and the
-  whole pdu + cpl headers has to fit into one sge buffer */
-   uiip->max_rxsz = min_t(unsigned int,
-  adapter->params.tp.rx_pg_size,
-  (adapter->sge.qs[0].fl[1].buf_size -
-   sizeof(struct cpl_rx_data) * 2 -
-   sizeof(struct cpl_rx_data_ddp)));
+   val = min(adapter->params.tp.tx_pg_size,
+ t3_read_reg(adapter, A_PM1_TX_CFG) >> 17);
+   uiip->max_txsz = min(val, uiip->max_txsz);
+
+   /* set MaxRxData to 16224 */
+   val = t3_read_reg(adapter, A_TP_PARA_REG2);
+   if ((val >> S_MAXRXDATA) != 0x3f60) {
+   val &= (M_RXCOALESCESIZE << S_RXCOALESCESIZE);
+   val |= V_MAXRXDATA(0x3f60);
+   printk(KERN_INFO
+   "%s, iscsi set MaxRxData to

[PATCH v2 0/2 2.6.29] cxgb3i -- open-iscsi initiator acceleration

2008-12-09 Thread Karen Xie

[PATCH v2 0/2 2.6.29] cxgb3i -- open-iscsi initiator acceleration 

From: Karen Xie <[EMAIL PROTECTED]>

Here is the updated patchset for adding cxgb3i iscsi initiator.

The updated version incorporates the comments from Mike and Boaz:
- remove the cxgb3 sysfs entry for the private iscsi ip address, it can be
  accessed from iscsi.
- in cxgb3i.txt, added error message logged for not setting 
MaxRecvDataSegmentLength properly.
- renamed cxgb3i Makefile to Kbuild
- removed "select ISCSI_TCP" in Kconfig
- consistent handling of AHS: on tx, reserve rooms for AHS; on rx, assume we 
could receive AHS.
- add support of bi-directional commands for ddp setup,

The cxgb3i driver, especially the part handles the offloaded iscsi tcp 
connection mangement, has gone through the netdev review 
(http://marc.info/?l=linux-netdev&m=121944339211552, 
http://marc.info/?l=linux-netdev&m=121989660016124).

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

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-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



RE: [PATCH 2/2 2.6.29] cxgb3i - accelerating open-iscsi initiator

2008-12-09 Thread Karen Xie


-Original Message-
From: Boaz Harrosh [mailto:[EMAIL PROTECTED] 
Subject: Re: [PATCH 2/2 2.6.29] cxgb3i - accelerating open-iscsi initiator

> +3. edit /etc/iscsi/iscsid.conf
> +   The default setting for MaxRecvDataSegmentLength (131072) is too big, 
> search
> +   and replace all occurances of "xxx.iscsi.MaxRecvDataSegmentLength" to be a
> +   value no bigger than 15360 (for example 8192):
> +
> + discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 8192
> + node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192
> +

What happens if you don't do this? it will then not use acceleration and fall 
back
to SW tcp? or it will not work at all? Can the driver limit that no matter what 
the user
put?

[Karen] If node.conn[0].iscsi.MaxRecvDataSegmentLength is not changed, the 
login will fail and a message will be printed to dmesg in the format of 
"cxgb3i: ERR! MaxRecvSegmentLength  too big. Need to be <= ." The 
discovery session is not accelerated, so it will go through. I will update the 
.txt file.

> +config SCSI_CXGB3_ISCSI
> + tristate "Chelsio S3xx iSCSI support"
> + select CHELSIO_T3
> + select SCSI_ISCSI_ATTRS
> + select ISCSI_TCP

Looks like you don't need ISCSI_TCP since Mike's last changes. ISCSI_TCP will
give you iscsi_tcp.ko, but all you need is libiscsi_tcp.ko which will be enabled
by default. (I think)

[Karen] Will remove select ISCSI_TCP.

> + ---help---
> + This driver supports iSCSI offload for the Chelsio S3 series devices.
> diff --git a/drivers/scsi/cxgb3i/Makefile b/drivers/scsi/cxgb3i/Makefile

> new file mode 100644
> index 000..ee7d6d2
> --- /dev/null
> +++ b/drivers/scsi/cxgb3i/Makefile
> @@ -0,0 +1,4 @@
> +EXTRA_CFLAGS += -I$(TOPDIR)/drivers/net/cxgb3
> +

+ccflags-y += -I$(TOPDIR)/drivers/net/cxgb3

Make Sam's life easier.

It's better to put this in a Kbuild file. It is not a real Makefile anyway.

[Karen] Will rename Makefile to Kbuild.

> +#define ISCSI_PDU_HEADER_MAX (56 + 256) /* bhs + digests + ahs */
> +

Actually sizeof(iscsi_sw_tcp_hdrbuf), which is ? I'm not sure a bit
less I think like 308. 
or:
+#define ISCSI_PDU_HEADER_MAX \
+   sizeof(struct iscsi_hdr) + ISCSI_MAX_AHS_SIZE + ISCSI_DIGEST_SIZE;

[Karen] Will use defines instead of actual numbers.

> +
> + ddp = cxgb3i_alloc_big_mem(sizeof(struct cxgb3i_ddp_info) +
> +ppmax *
> + (sizeof(struct cxgb3i_gather_list *) +
> + sizeof(struct sk_buff *)),
> +GFP_KERNEL);

From what I understand so far:
DDP is only used for read of PDU, right? so we only need space for the read DDP.
the writes are made by regular SKBs right?

How is then the acceleration works with out-going data? OK I guess that is a 
separate
issue. DDP acceleration for reads, and separately, digest accelerations for 
both.

[Karen] Yes, ddp is for read only, the write will have digest acceleration.

> + if (!ddp) {
> + ddp_log_warn("%s unable to alloc ddp 0x%d, ddp disabled.\n",
> +  tdev->name, ppmax);
> + return 0;
> + }
> + ddp->gl_map = (struct cxgb3i_gather_list **)(ddp + 1);
> + ddp->gl_skb = (struct sk_buff **)(((char *)ddp->gl_map) +
> +   ppmax *
> +   sizeof(struct cxgb3i_gather_list *));
> + spin_lock_init(&ddp->map_lock);
> +
> + ddp->tdev = tdev;
> + ddp->pdev = uinfo.pdev;
> + ddp->max_txsz = min_t(unsigned int, uinfo.max_txsz, ULP2_MAX_PKT_SIZE);
> + ddp->max_rxsz = min_t(unsigned int, uinfo.max_rxsz, ULP2_MAX_PKT_SIZE);

Please note that from what I understand, only the out-going headers can be
big, like iscsi_cmd header. But the in-coming headers are always size_of(struct 
iscsi_hdr).
So there is no symmetry here. Actually only iscsi_cmd can get big, the other 
out-going 
data packets are with small headers, but I guess that is an open-iscsi 
limitation.

[Karen] Here the max size is the packet size (i.e., the total pdu size). The 
h/w does support sending and recv AHS. I will make sure the code is consistent 
in handling of AHS.

Mike correct me if I'm wrong?

> +/**
> + * cxgb3i_reserve_itt - generate tag for a give task
> + * Try to set up ddp for a scsi read task.
> + * @task: iscsi task
> + * @hdr_itt: tag, filled in by this function
> + */
> +int cxgb3i_reserve_itt(struct iscsi_task *task, itt_t *hdr_itt)
> +{
> + struct scsi_cmnd *sc = task->sc;
> + struct iscsi_conn *conn = task->conn;
> + struct iscsi_session *sess = conn->session;
> + struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
> + struct cxgb3i_conn *cconn = tcp_conn->dd_data;
> + struct cxgb3i_adapter *snic = cconn->hba->snic;
> + struct cxgb3i_tag_format *tformat = &snic->tag_format;
> + u32 sw_tag = (sess->age << cconn->task_idx_bits) | task->itt;
> + u32 tag;
> + int err = -EINVAL;
> +
> + i

RE: [PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

2008-12-08 Thread Karen Xie

Sorry, forgot to add my signed off line, it should be:

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
Signed-off-by: Karen Xie <[EMAIL PROTECTED]>


-Original Message-
From: Karen Xie [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 12:30 PM
To: open-iscsi@googlegroups.com; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Karen
Xie
Subject: [PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

[PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

The accelerated iSCSI traffic could use a private IP address unknown to
the OS:
- Create a per port sysfs entry to pass an IP address to the NIC driver,
and a
  control call for the iSCSI driver to grab it.
- The IP address is required in both drivers to manage ARP requests and
  connection set up.
- Reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

2008-12-08 Thread Karen Xie

[PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

The accelerated iSCSI traffic could use a private IP address unknown to the OS:
- Create a per port sysfs entry to pass an IP address to the NIC driver, and a
  control call for the iSCSI driver to grab it.
- The IP address is required in both drivers to manage ARP requests and
  connection set up.
- Reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/adapter.h|1 +
 drivers/net/cxgb3/cxgb3_ctl_defs.h |7 
 drivers/net/cxgb3/cxgb3_main.c |   46 +++
 drivers/net/cxgb3/cxgb3_offload.c  |   66 +
 drivers/net/cxgb3/sge.c|   72 ++--
 5 files changed, 170 insertions(+), 22 deletions(-)


diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index bc8e241..0c60f40 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -63,6 +63,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
+   __be32 iscsi_ipv4addr;
 };
 
 enum { /* adapter flags */
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 1d8d46e..b61ceaf 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,6 +57,7 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+   GET_ISCSI_IPV4ADDR  = 51,
 };
 
 /*
@@ -86,6 +87,12 @@ struct iff_mac {
u16 vlan_tag;
 };
 
+/* Structure used to request a port's iSCSI IPv4 address */
+struct iscsi_ipv4addr {
+   struct net_device *dev; /* the net_device */
+   __be32 ipv4addr;/* the return iSCSI IPv4 address */
+};
+
 struct pci_dev;
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 2c341f8..181588b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -732,6 +733,47 @@ static struct attribute *offload_attrs[] = {
 
 static struct attribute_group offload_attr_group = {.attrs = offload_attrs };
 
+static ssize_t iscsi_ipv4addr_attr_show(struct device *d, char *buf)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   __be32 a = pi->iscsi_ipv4addr;
+
+   return sprintf(buf, NIPQUAD_FMT "\n", NIPQUAD(a));
+}
+
+static ssize_t iscsi_ipv4addr_attr_store(struct device *d,
+  const char *buf, size_t len)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+
+   pi->iscsi_ipv4addr = in_aton(buf);
+   return len;
+}
+
+#define ISCSI_IPADDR_ATTR(name) \
+static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
+  char *buf) \
+{ \
+   return iscsi_ipv4addr_attr_show(d, buf); \
+} \
+static ssize_t store_##name(struct device *d, struct device_attribute *attr, \
+   const char *buf, size_t len) \
+{ \
+   return iscsi_ipv4addr_attr_store(d, buf, len); \
+} \
+static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_##name)
+
+ISCSI_IPADDR_ATTR(iscsi_ipv4addr);
+
+static struct attribute *iscsi_offload_attrs[] = {
+   &dev_attr_iscsi_ipv4addr.attr,
+   NULL
+};
+
+static struct attribute_group iscsi_offload_attr_group = {
+   .attrs = iscsi_offload_attrs
+};
+
 /*
  * Sends an sk_buff to an offload queue driver
  * after dealing with any active network taps.
@@ -1134,6 +1176,7 @@ static int cxgb_open(struct net_device *dev)
if (err)
printk(KERN_WARNING
   "Could not initialize offload capabilities\n");
+   sysfs_create_group(&dev->dev.kobj, &iscsi_offload_attr_group);
}
 
link_start(dev);
@@ -1156,6 +1199,9 @@ static int cxgb_close(struct net_device *dev)
netif_carrier_off(dev);
t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
 
+   if (is_offload(adapter) && !ofld_disable)
+   sysfs_remove_group(&dev->dev.kobj, &iscsi_offload_attr_group);
+
spin_lock_irq(&adapter->work_lock); /* sync with update task */
clear_bit(pi->port_id, &adapter->open_device_map);
spin_unlock_irq(&adapter->work_lock);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 265aa8a..bebb5a8 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -182,7 +182,9 @@ static struct net_device *get_iff_from_mac(struct adapter 
*adapter,
 static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req,
 

[PATCH 0/3 2.6.29] cxgb3i -- add open-iscsi initiator acceleration

2008-12-08 Thread Karen Xie

[PATCH 0/3 2.6.29] cxgb3i -- open-iscsi initiator acceleration 

From: Karen Xie <[EMAIL PROTECTED]>

Hi, James,

Here is the complete patchset for adding cxgb3i iscsi initiator. This patchset 
is for 2.6.29. It is based on the scsi-misc-2.6 git tree.

The cxgb3i driver, especially the part handles the offloaded iscsi tcp
connection mangement, has gone through the netdev review (
http://marc.info/?l=linux-netdev&m=121944339211552,
http://marc.info/?l=linux-netdev&m=121989660016124).

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

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-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH

2008-12-08 Thread Karen Xie

[PATCH 1/2 2.6.29] cxgb3 - manage private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

The accelerated iSCSI traffic could use a private IP address unknown to the OS:
- Create a per port sysfs entry to pass an IP address to the NIC driver, and a
  control call for the iSCSI driver to grab it.
- The IP address is required in both drivers to manage ARP requests and
  connection set up.
- Reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/adapter.h|1 +
 drivers/net/cxgb3/cxgb3_ctl_defs.h |7 
 drivers/net/cxgb3/cxgb3_main.c |   46 +++
 drivers/net/cxgb3/cxgb3_offload.c  |   66 +
 drivers/net/cxgb3/sge.c|   72 ++--
 5 files changed, 170 insertions(+), 22 deletions(-)


diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index bc8e241..0c60f40 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -63,6 +63,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
+   __be32 iscsi_ipv4addr;
 };
 
 enum { /* adapter flags */
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 1d8d46e..b61ceaf 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,6 +57,7 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+   GET_ISCSI_IPV4ADDR  = 51,
 };
 
 /*
@@ -86,6 +87,12 @@ struct iff_mac {
u16 vlan_tag;
 };
 
+/* Structure used to request a port's iSCSI IPv4 address */
+struct iscsi_ipv4addr {
+   struct net_device *dev; /* the net_device */
+   __be32 ipv4addr;/* the return iSCSI IPv4 address */
+};
+
 struct pci_dev;
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 2c341f8..181588b 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -732,6 +733,47 @@ static struct attribute *offload_attrs[] = {
 
 static struct attribute_group offload_attr_group = {.attrs = offload_attrs };
 
+static ssize_t iscsi_ipv4addr_attr_show(struct device *d, char *buf)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   __be32 a = pi->iscsi_ipv4addr;
+
+   return sprintf(buf, NIPQUAD_FMT "\n", NIPQUAD(a));
+}
+
+static ssize_t iscsi_ipv4addr_attr_store(struct device *d,
+  const char *buf, size_t len)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+
+   pi->iscsi_ipv4addr = in_aton(buf);
+   return len;
+}
+
+#define ISCSI_IPADDR_ATTR(name) \
+static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
+  char *buf) \
+{ \
+   return iscsi_ipv4addr_attr_show(d, buf); \
+} \
+static ssize_t store_##name(struct device *d, struct device_attribute *attr, \
+   const char *buf, size_t len) \
+{ \
+   return iscsi_ipv4addr_attr_store(d, buf, len); \
+} \
+static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_##name)
+
+ISCSI_IPADDR_ATTR(iscsi_ipv4addr);
+
+static struct attribute *iscsi_offload_attrs[] = {
+   &dev_attr_iscsi_ipv4addr.attr,
+   NULL
+};
+
+static struct attribute_group iscsi_offload_attr_group = {
+   .attrs = iscsi_offload_attrs
+};
+
 /*
  * Sends an sk_buff to an offload queue driver
  * after dealing with any active network taps.
@@ -1134,6 +1176,7 @@ static int cxgb_open(struct net_device *dev)
if (err)
printk(KERN_WARNING
   "Could not initialize offload capabilities\n");
+   sysfs_create_group(&dev->dev.kobj, &iscsi_offload_attr_group);
}
 
link_start(dev);
@@ -1156,6 +1199,9 @@ static int cxgb_close(struct net_device *dev)
netif_carrier_off(dev);
t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
 
+   if (is_offload(adapter) && !ofld_disable)
+   sysfs_remove_group(&dev->dev.kobj, &iscsi_offload_attr_group);
+
spin_lock_irq(&adapter->work_lock); /* sync with update task */
clear_bit(pi->port_id, &adapter->open_device_map);
spin_unlock_irq(&adapter->work_lock);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index 265aa8a..bebb5a8 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -182,7 +182,9 @@ static struct net_device *get_iff_from_mac(struct adapter 
*adapter,
 static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, unsigned int req,
 

RE: [PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates

2008-12-08 Thread Karen Xie

Hi, Mike,

Thanks for the reply.

True, there is no dependency on the network driver part.

I will send out the new patch with the entire driver soon.

Thanks,
Karen

-Original Message-
From: Mike Christie [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 08, 2008 7:57 AM
To: Karen Xie
Cc: David Miller; [EMAIL PROTECTED];
open-iscsi@googlegroups.com; [EMAIL PROTECTED]
Subject: Re: [PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates

Karen Xie wrote:
> Hi, Dave & Mike,
> 
> I guess I need some clarification on how this driver code could be
merged.
> 

I think you want to send a patch with the entire driver like you were 
before. Do not send against my branch so James and others do not have to

dig around in there.


> The cxgb3i driver addition consists of 2 parts:
> 
> 1. the new cxgb3i driver. It resides under drivers/scsi, this part has
the dependency on the open-iscsi core changes I referred in the previous
email. I was under the impression this goes into scsi-misc?
> 
> 2. some iscsi related changes in cxgb3 driver (driver/net). This part
does not have any dependency. Dave, I suppose this part goes into
net-next? If so, this does not need Mike's patch at all.
> 

There is no dependency with network stuff right (just the cxgb3 driver 
which is upstream already)? If so I think it would be easier to just 
send the driver through James.


> Thanks a lot.
> Karen
> 
> -Original Message-
> From: David Miller [mailto:[EMAIL PROTECTED]
> Sent: Sat 12/6/2008 11:53 PM
> To: Karen Xie
> Cc: [EMAIL PROTECTED]; open-iscsi@googlegroups.com;
[EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: [PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates
>  
> From: Karen Xie <[EMAIL PROTECTED]>
> Date: Sat, 6 Dec 2008 23:09:36 -0800
> 
>> It is based on the cxgb3i branch of Mike's linux-2.6-iscsi tree. It
needs the
>> patch Mike sent several days ago on preparing the iscsi core libary
for pdu
>> offload (http://marc.info/?l=linux-scsi&m=122819956917473).
> 
> If this dependency exists I probably can't pull this into the
> net-next-2.6 then, just FYI but you probably already understand
> this :-)
> 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



RE: [PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates

2008-12-07 Thread Karen Xie

Hi, Dave & Mike,

I guess I need some clarification on how this driver code could be merged.

The cxgb3i driver addition consists of 2 parts:

1. the new cxgb3i driver. It resides under drivers/scsi, this part has the 
dependency on the open-iscsi core changes I referred in the previous email. I 
was under the impression this goes into scsi-misc?

2. some iscsi related changes in cxgb3 driver (driver/net). This part does not 
have any dependency. Dave, I suppose this part goes into net-next? If so, this 
does not need Mike's patch at all.

Thanks a lot.
Karen

-Original Message-
From: David Miller [mailto:[EMAIL PROTECTED]
Sent: Sat 12/6/2008 11:53 PM
To: Karen Xie
Cc: [EMAIL PROTECTED]; open-iscsi@googlegroups.com; [EMAIL PROTECTED]; [EMAIL 
PROTECTED]
Subject: Re: [PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates
 
From: Karen Xie <[EMAIL PROTECTED]>
Date: Sat, 6 Dec 2008 23:09:36 -0800

> It is based on the cxgb3i branch of Mike's linux-2.6-iscsi tree. It needs the
> patch Mike sent several days ago on preparing the iscsi core libary for pdu
> offload (http://marc.info/?l=linux-scsi&m=122819956917473).

If this dependency exists I probably can't pull this into the
net-next-2.6 then, just FYI but you probably already understand
this :-)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 3/3 2.6.29] cxgb3i -- documentation

2008-12-06 Thread Karen Xie

[PATCH 3/3 2.6.29] cxgb3i -- documentation

From: Karen Xie <[EMAIL PROTECTED]>

- document cxgb3i driver's capablity and setup steps to be used with
  open-iscsi initiator.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 Documentation/scsi/cxgb3i.txt |   81 +
 1 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/scsi/cxgb3i.txt


diff --git a/Documentation/scsi/cxgb3i.txt b/Documentation/scsi/cxgb3i.txt
new file mode 100644
index 000..9456013
--- /dev/null
+++ b/Documentation/scsi/cxgb3i.txt
@@ -0,0 +1,81 @@
+Chelsio S3 iSCSI Driver for Linux
+
+Introduction
+
+
+The Chelsio T3 ASIC based Adapters (S310, S320, S302, S304, Mezz cards, etc.
+series of products) supports iSCSI acceleration and iSCSI Direct Data Placement
+(DDP) where the hardware handles the expensive byte touching operations, such
+as CRC computation and verification, and direct DMA to the final host memory
+destination:
+
+   - iSCSI PDU digest generation and verification
+
+ On transmitting, Chelsio S3 h/w computes and inserts the Header and
+ Data digest into the PDUs.
+ On receiving, Chelsio S3 h/w computes and verifies the Header and
+ Data digest of the PDUs.
+
+   - Direct Data Placement (DDP)
+
+ S3 h/w can directly place the iSCSI Data-In or Data-Out PDU's
+ payload into pre-posted final destination host-memory buffers based
+ on the Initiator Task Tag (ITT) in Data-In or Target Task Tag (TTT)
+ in Data-Out PDUs.
+
+   - PDU Transmit and Recovery
+
+ On transmitting, S3 h/w accepts the complete PDU (header + data)
+ from the host driver, computes and inserts the digests, decomposes
+ the PDU into multiple TCP segments if necessary, and transmit all
+ the TCP segments onto the wire. It handles TCP retransmission if
+ needed.
+
+ On receving, S3 h/w recovers the iSCSI PDU by reassembling TCP
+ segments, separating the header and data, calculating and verifying
+ the digests, then forwards the header to the host. The payload data,
+ if possible, will be directly placed into the pre-posted host DDP
+ buffer. Otherwise, the payload data will be sent to the host too.
+
+The cxgb3i driver interfaces with open-iscsi initiator and provides the iSCSI
+acceleration through Chelsio hardware wherever applicable.
+
+Using the cxgb3i Driver
+===
+
+The following steps need to be taken to accelerates the open-iscsi initiator:
+
+1. Load the cxgb3i driver: "modprobe cxgb3i"
+
+   The cxgb3i module registers a new transport class "cxgb3i" with open-iscsi.
+
+   * in the case of recompiling the kernel, the cxgb3i selection is located at
+   Device Drivers
+   SCSI device support --->
+   [*] SCSI low-level drivers  --->
+  Chelsio S3xx iSCSI support
+
+2. Create an interface file located under /etc/iscsi/ifaces/ for the new
+   transport class "cxgb3i".
+
+   The content of the file should be in the following format:
+   iface.transport_name = cxgb3i
+   iface.net_ifacename = 
+   iface.ipaddress = 
+
+   * if iface.ipaddress is specified,  needs to be either the
+   same as the ethX's ip address or an address on the same subnet. Make
+   sure the ip address is unique in the network.
+
+3. edit /etc/iscsi/iscsid.conf
+   The default setting for MaxRecvDataSegmentLength (131072) is too big, search
+   and replace all occurances of "xxx.iscsi.MaxRecvDataSegmentLength" to be a
+   value no bigger than 15872 (for example 8192):
+
+   discovery.sendtargets.iscsi.MaxRecvDataSegmentLength = 8192
+   node.conn[0].iscsi.MaxRecvDataSegmentLength = 8192
+
+4. To direct open-iscsi traffic to go through cxgb3i's accelerated path,
+   "-I " option needs to be specified with most of the
+   iscsiadm command.  is the transport interface file created
+   in step 2.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 0/3 2.6.29] cxgb3i -- driver fixes & updates

2008-12-06 Thread Karen Xie

[PATCH 0/3 2.6.29] cxgb3i -- open-iscsi initiator acceleration 

From: Karen Xie <[EMAIL PROTECTED]>

Hi, everyone,

This patchset is for 2.6.29.

It is based on the cxgb3i branch of Mike's linux-2.6-iscsi tree. It needs the
patch Mike sent several days ago on preparing the iscsi core libary for pdu
offload (http://marc.info/?l=linux-scsi&m=122819956917473).

The cxgb3i driver, especially the part handles the offloaded iscsi tcp
connection mangement, has gone through the netdev review (
http://marc.info/?l=linux-netdev&m=121944339211552,
http://marc.info/?l=linux-netdev&m=121989660016124).

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

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-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 2/3 2.6.28] cxgb3 - add ioctl to set iscsi ipv4 address

2008-09-09 Thread Karen Xie

[PATCH 2/3 2.6.28] cxgb3 - add ioctl to set iscsi ipv4 address.

From: Karen Xie <[EMAIL PROTECTED]>

add ioctl to set private ipv4 address for iscsi traffic.

This patch is based on the cxgb3 branch of the git tree.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/cxgb3_ctl_defs.h |2 ++
 drivers/net/cxgb3/cxgb3_offload.c  |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 2bf5027..4df0d91 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,7 +57,9 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+
GET_ISCSI_IPV4ADDR  = 51,
+   SET_ISCSI_IPV4ADDR  = 52,
 };
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index f8f4faa..723fa6d 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -413,6 +413,12 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
p->ipv4addr = pi->iscsi_ipv4addr;
break;
}
+   case SET_ISCSI_IPV4ADDR: {
+   struct iscsi_ipv4addr *p = data;
+   struct port_info *pi = netdev_priv(p->dev);
+   pi->iscsi_ipv4addr = p->ipv4addr;
+   break;
+   }
default:
return -EOPNOTSUPP;
}

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 3/3 2.6.28] cxgb3i - add host_set_param() and fixed ddp tag generation

2008-09-09 Thread Karen Xie

[PATCH 3/3 2.6.28] cxgb3i - add host_set_param() and fixed ddp tag generation.

From: Karen Xie <[EMAIL PROTECTED]>

- added host_set_param() to set private ipv4 address for iscsi traffic.
- fixed ddp tag generation when upper 16 bits are used.

This patch is based on the cxgb3 branch of the git tree.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/scsi/cxgb3i/cxgb3i.h |4 -
 drivers/scsi/cxgb3i/cxgb3i_iscsi.c   |   62 +
 drivers/scsi/cxgb3i/cxgb3i_offload.c |  222 ++
 drivers/scsi/cxgb3i/cxgb3i_offload.h |   21 ++-
 drivers/scsi/cxgb3i/cxgb3i_ulp2.c|   61 ++---
 5 files changed, 261 insertions(+), 109 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i.h b/drivers/scsi/cxgb3i/cxgb3i.h
index a65995d..e8eca78 100644
--- a/drivers/scsi/cxgb3i/cxgb3i.h
+++ b/drivers/scsi/cxgb3i/cxgb3i.h
@@ -47,6 +47,7 @@ struct cxgb3i_endpoint;
  * @rsvd_bits: # of bits used by h/w
  * @rsvd_shift:shift left
  * @rsvd_mask:  bit mask
+ * @rsvd_tag_mask:  h/w tag bit mask
  *
  */
 struct cxgb3i_tag_format {
@@ -55,6 +56,7 @@ struct cxgb3i_tag_format {
unsigned char rsvd_bits;
unsigned char rsvd_shift;
u32 rsvd_mask;
+   u32 rsvd_tag_mask;
 };
 
 /**
@@ -172,6 +174,4 @@ u32 cxgb3i_ddp_tag_reserve(struct cxgb3i_adapter *, 
unsigned int,
   u32, unsigned int, struct scatterlist *,
   unsigned int);
 int cxgb3i_conn_ulp2_xmit(struct iscsi_conn *);
-
-void cxgb3i_display_byte_string(char *, unsigned char *, int, int);
 #endif
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index e3a7443..c2324fe 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -9,6 +9,7 @@
  * Written by: Karen Xie ([EMAIL PROTECTED])
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -253,9 +254,6 @@ static int cxgb3i_ep_poll(struct iscsi_endpoint *ep, int 
timeout_ms)
struct cxgb3i_endpoint *cep = ep->dd_data;
struct s3_conn *c3cn = cep->c3cn;
 
-   cxgb3i_log_debug("ep 0x%p, timeout %d, c3cn 0x%p, state 0x%x.\n",
-ep, timeout_ms, c3cn, c3cn->state);
-
if (!c3cn_in_state(c3cn, C3CN_STATE_ESTABLISHED)) {
cxgb3i_log_info("not in established state.\n");
return 0;
@@ -409,12 +407,11 @@ static int cxgb3i_conn_xmit_segment(struct iscsi_conn 
*conn)
struct iscsi_segment *segment = &tcp_conn->out.segment;
 
if (segment->total_copied < segment->total_size)
-   return cxgb3i_conn_ulp2_xmit(conn);
+   return cxgb3i_conn_ulp2_xmit(conn);
return 0;
 }
 
 
-
 /**
  * cxgb3i_conn_bind - binds iscsi sess, conn and endpoint together
  * @cls_session:   pointer to iscsi cls session
@@ -559,6 +556,48 @@ static int cxgb3i_conn_set_param(struct iscsi_cls_conn 
*cls_conn,
 }
 
 /**
+ * cxgb3i_host_set_param - configure host (adapter) related parameters
+ * @shost: scsi host pointer
+ * @param: parameter type identifier
+ * @buf:   buffer pointer
+ */
+static int cxgb3i_host_set_param(struct Scsi_Host *shost,
+enum iscsi_host_param param,
+char *buf, int buflen)
+{
+   static struct cxgb3i_hba *hba;
+   int rc = -EINVAL;
+
+   cxgb3i_log_debug("param %d, buf %s.\n", param, buf);
+
+   switch (param) {
+   case ISCSI_HOST_PARAM_NETDEV_NAME:
+   {
+   struct net_device *ndev = dev_get_by_name(&init_net, buf);
+
+   if (ndev) {
+   hba = cxgb3i_hba_find_by_netdev(ndev);
+   if (hba)
+   rc = 0;
+   else
+   cxgb3i_log_info("%s not a cxgb3i device.\n",
+   buf);
+   }
+   break;
+   }
+   case ISCSI_HOST_PARAM_IPADDRESS:
+   if (hba) {
+   __be32 addr = in_aton(buf);
+   rc = cxgb3i_set_private_ipv4addr(hba->ndev, addr);
+   }
+   break;
+   default:
+   return iscsi_host_get_param(shost, param, buf);
+   }
+   return rc;
+}
+
+/**
  * cxgb3i_host_get_param - returns host (adapter) related parameters
  * @shost: scsi host pointer
  * @param: parameter type identifier
@@ -571,6 +610,8 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
int i;
int len = 0;
 
+   cxgb3i_log_debug("hba %s, param %d.\n", hba->ndev->name, param);
+
switch (param) {
case ISCSI_HOST_PARAM_HWADDRESS:
for (i = 0; i < 6; i++)
@@ -583,6 +624,16 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost,
case ISCSI_HOST_PARAM_NETDEV

[PATCH 2/2] userspace - setting interface ip address

2008-09-09 Thread Karen Xie

[PATCH 2/2] userspace - setting interface ip address

From: Karen Xie <[EMAIL PROTECTED]>

Enable setting of the ip address for iscsi traffic on a network interface via 
iface files.

The format of the iface files are:
iface.transport_name = 
iface.net_ifacename = 
iface.ipaddress = 

This patch is based on the master branch of the git tree.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 usr/idbm.c  |6 +++---
 usr/iface.c |   11 +++
 usr/initiator.c |   47 ++-
 3 files changed, 56 insertions(+), 8 deletions(-)


diff --git a/usr/idbm.c b/usr/idbm.c
index 0cb3c44..48aec4f 100644
--- a/usr/idbm.c
+++ b/usr/idbm.c
@@ -274,8 +274,8 @@ idbm_recinfo_node(node_rec_t *r, recinfo_t *ri)
 */
__recinfo_str("iface.hwaddress", ri, r, iface.hwaddress, IDBM_SHOW,
  num, 1);
-// __recinfo_str("iface.ipaddress", ri, r, iface.ipaddress,
-//  IDBM_SHOW, num);
+   __recinfo_str("iface.ipaddress", ri, r, iface.ipaddress, IDBM_SHOW,
+ num, 1);
__recinfo_str("iface.iscsi_ifacename", ri, r, iface.name, IDBM_SHOW,
  num, 1);
__recinfo_str("iface.net_ifacename", ri, r, iface.netdev, IDBM_SHOW,
@@ -413,7 +413,7 @@ void idbm_recinfo_iface(iface_rec_t *r, recinfo_t *ri)
 
__recinfo_str("iface.iscsi_ifacename", ri, r, name, IDBM_SHOW, num, 0);
__recinfo_str("iface.net_ifacename", ri, r, netdev, IDBM_SHOW, num, 1);
-// __recinfo_str("iface.ipaddress", ri, r, ipaddress, IDBM_SHOW, num, 1);
+   __recinfo_str("iface.ipaddress", ri, r, ipaddress, IDBM_SHOW, num, 1);
__recinfo_str("iface.hwaddress", ri, r, hwaddress, IDBM_SHOW, num, 1);
__recinfo_str("iface.transport_name", ri, r, transport_name,
  IDBM_SHOW, num, 1);
diff --git a/usr/iface.c b/usr/iface.c
index 01b87da..3273197 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -104,7 +104,7 @@ static void iface_init(struct iface_rec *iface)
 void iface_setup_defaults(struct iface_rec *iface)
 {
sprintf(iface->netdev, DEFAULT_NETDEV);
-// sprintf(iface->ipaddress, DEFAULT_IPADDRESS);
+   sprintf(iface->ipaddress, DEFAULT_IPADDRESS);
sprintf(iface->hwaddress, DEFAULT_HWADDRESS);
sprintf(iface->transport_name, DEFAULT_TRANSPORT);
iface_init(iface);
@@ -494,8 +494,8 @@ void iface_copy(struct iface_rec *dst, struct iface_rec 
*src)
strcpy(dst->name, src->name);
if (strlen(src->netdev))
strcpy(dst->netdev, src->netdev);
-// if (strlen(src->ipaddress))
-// strcpy(dst->ipaddress, src->ipaddress);
+   if (strlen(src->ipaddress))
+   strcpy(dst->ipaddress, src->ipaddress);
if (strlen(src->hwaddress))
strcpy(dst->hwaddress, src->hwaddress);
if (strlen(src->transport_name))
@@ -594,6 +594,8 @@ int iface_print_tree(void *data, struct iface_rec *iface)
   UNKNOWN_VALUE);
printf("\tHW Address: %s\n",
   strlen(iface->hwaddress) ? iface->hwaddress : UNKNOWN_VALUE);
+   printf("\tIP Address: %s\n",
+  strlen(iface->ipaddress) ? iface->ipaddress : UNKNOWN_VALUE);
printf("\tNetdev: %s\n",
   strlen(iface->netdev) ? iface->netdev : UNKNOWN_VALUE);
printf("\tInitiator Name: %s\n",
@@ -603,11 +605,12 @@ int iface_print_tree(void *data, struct iface_rec *iface)
 
 int iface_print_flat(void *data, struct iface_rec *iface)
 {
-   printf("%s %s,%s,%s,%s\n",
+   printf("%s %s,%s,%s,%s,%s\n",
strlen(iface->name) ? iface->name : UNKNOWN_VALUE,
strlen(iface->transport_name) ? iface->transport_name :
UNKNOWN_VALUE,
strlen(iface->hwaddress) ? iface->hwaddress : UNKNOWN_VALUE,
+   strlen(iface->ipaddress) ? iface->ipaddress : UNKNOWN_VALUE,
strlen(iface->netdev) ? iface->netdev : UNKNOWN_VALUE,
strlen(iface->iname) ? iface->iname : UNKNOWN_VALUE);
return 0;
diff --git a/usr/initiator.c b/usr/initiator.c
index 2f29ffc..1cfcc7f 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1909,6 +1909,46 @@ int session_is_running(node_rec_t *rec)
return 0;
 }
 
+static int iface_set_param(struct iscsi_transport *t, iface_rec_t *iface,
+  int hostno)
+{
+   int rc = 0;
+
+   log_debug(3, "iface %s, netdev %s, ipaddr %s, hwaddr %s, tranport 
%s.\n",
+ iface->name, iface->netdev, iface->i

[PATCH 1/3 2.6.28] cxgb3i/open-iscsi - modified tcp out segment xmiting

2008-09-09 Thread Karen Xie

[PATCH 1/3 2.6.28] cxgb3i/open-iscsi - modified tcp out segment xmiting.

From: Karen Xie <[EMAIL PROTECTED]>

removed flush_conn() from the transport template, added xmit_segment() to
tcp_conn. For tcp transport, xmit_segment points to iscsi_xmit().

This patch is based on the cxgb3 branch of the git tree.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/scsi/cxgb3i/cxgb3i_iscsi.c  |   37 +--
 drivers/scsi/iscsi_tcp.c|   10 +
 drivers/scsi/iscsi_tcp.h|2 ++
 include/scsi/scsi_transport_iscsi.h |2 --
 4 files changed, 25 insertions(+), 26 deletions(-)


diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c 
b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
index df97e15..e3a7443 100644
--- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
+++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c
@@ -399,6 +399,23 @@ static struct iscsi_cls_conn *cxgb3i_conn_create(struct 
iscsi_cls_session
 }
 
 /**
+ * cxgb3i_conn_xmit_segment - transmit segment
+ * @conn:  pointer to iscsi conn
+ */
+static int cxgb3i_conn_xmit_segment(struct iscsi_conn *conn)
+{
+   struct cxgb3i_conn *cconn = conn->dd_data;
+   struct iscsi_tcp_conn *tcp_conn = &cconn->tcp_conn;
+   struct iscsi_segment *segment = &tcp_conn->out.segment;
+
+   if (segment->total_copied < segment->total_size)
+   return cxgb3i_conn_ulp2_xmit(conn);
+   return 0;
+}
+
+
+
+/**
  * cxgb3i_conn_bind - binds iscsi sess, conn and endpoint together
  * @cls_session:   pointer to iscsi cls session
  * @cls_conn:  pointer to iscsi cls conn
@@ -456,30 +473,13 @@ static int cxgb3i_conn_bind(struct iscsi_cls_session 
*cls_session,
conn->portal_port = ntohs(c3cn->daddr.sin_port);
spin_unlock_bh(&conn->session->lock);
 
+   tcp_conn->xmit_segment = cxgb3i_conn_xmit_segment;
iscsi_tcp_hdr_recv_prep(tcp_conn);
 
return 0;
 }
 
 /**
- * cxgb3i_conn_flush - flush tx
- * @conn:  pointer to iscsi conn
- */
-static int cxgb3i_conn_flush(struct iscsi_conn *conn)
-{
-   struct cxgb3i_conn *cconn = conn->dd_data;
-   struct iscsi_tcp_conn *tcp_conn = &cconn->tcp_conn;
-   struct iscsi_segment *segment = &tcp_conn->out.segment;
-
-   cxgb3i_log_debug("conn 0x%p, segment sent %u/%u.\n",
-conn, segment->total_copied, segment->total_size);
-
-   if (segment->total_copied < segment->total_size)
-   return cxgb3i_conn_ulp2_xmit(conn);
-   return 0;
-}
-
-/**
  * cxgb3i_conn_get_param - return iscsi connection parameter to caller
  * @cls_conn:  pointer to iscsi cls conn
  * @param: parameter type identifier
@@ -756,7 +756,6 @@ static struct iscsi_transport cxgb3i_iscsi_transport = {
.destroy_conn = iscsi_conn_teardown,
.start_conn = iscsi_conn_start,
.stop_conn = iscsi_conn_stop,
-   .flush_conn = cxgb3i_conn_flush,
.get_conn_param = cxgb3i_conn_get_param,
.set_param = cxgb3i_conn_set_param,
.get_stats = cxgb3i_conn_get_stats,
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index c207fd1..4035676 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -1170,13 +1170,14 @@ iscsi_tcp_xmit_qlen(struct iscsi_conn *conn)
return segment->total_copied - segment->total_size;
 }
 
-static int
+static inline int
 iscsi_tcp_flush(struct iscsi_conn *conn)
 {
int rc;
+   struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
 
while (iscsi_tcp_xmit_qlen(conn)) {
-   rc = iscsi_xmit(conn);
+   rc = tcp_conn->xmit_segment(conn);
if (rc == 0)
return -EAGAIN;
if (rc < 0)
@@ -1414,7 +1415,7 @@ iscsi_tcp_task_xmit(struct iscsi_task *task)
 
 flush:
/* Flush any pending data first. */
-   rc = conn->session->tt->flush_conn(conn);
+   rc = iscsi_tcp_flush(conn);
if (rc < 0)
return rc;
 
@@ -1702,6 +1703,7 @@ iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session,
 
iscsi_conn_set_callbacks(conn);
tcp_conn->sendpage = tcp_conn->sock->ops->sendpage;
+   tcp_conn->xmit_segment = iscsi_xmit;
/*
 * set receive state machine into initial state
 */
@@ -1923,7 +1925,6 @@ static void iscsi_tcp_session_destroy(struct 
iscsi_cls_session *cls_session)
struct Scsi_Host *shost = iscsi_session_to_shost(cls_session);
 
iscsi_r2tpool_free(cls_session->dd_data);
-   iscsi_session_teardown(cls_session);
 
iscsi_host_remove(shost);
iscsi_host_free(shost);
@@ -1998,7 +1999,6 @@ static struct iscsi_transport iscsi_tcp_transport = {
.get_session_param  = iscsi_session_get_param,
.start_conn = iscsi_conn_start,
.stop_con

[PATCH 1/2] userspace - add new transport cxgb3i

2008-09-09 Thread Karen Xie

[PATCH 1/2] userspace - add new transport cxgb3i

From: Karen Xie <[EMAIL PROTECTED]>

added new transport cxgb3i.

This patch is based on the master branch of the git tree.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 doc/iscsiadm.8|7 +++
 etc/iface.example |9 +
 usr/transport.c   |8 
 utils/iscsi_discovery |   17 +
 4 files changed, 33 insertions(+), 8 deletions(-)


diff --git a/doc/iscsiadm.8 b/doc/iscsiadm.8
index b488ad5..9a26dc6 100644
--- a/doc/iscsiadm.8
+++ b/doc/iscsiadm.8
@@ -63,10 +63,9 @@ specific hardware resource and instead allow the network or 
infinniband layer
 to decide what to do. There is no need to create a iface config with the 
default
 behavior. If you do not specify a iface, then the default behavior is used.
 
-As mentioned above there is a special iface name default. There are two others
-bnx2i and iser, which does not bind the session to a specific card, but
-will bind the session to either the bnx2i or iser transport. These are
-experimental and the use is not supported as a stable interface yet.
+As mentioned above there is a special iface name default. There are three 
+others -- cxgb3i, bnx2i and iser, which does not bind the session to a 
specific card, but will bind the session to the cxgb3i, bnx2i or iser 
transport. These
+are experimental and the use is not supported as a stable interface yet.
 
 In discovery mode multiple interfaces can be specific by passing in multiple
 -I/--interface instances. For example, 
diff --git a/etc/iface.example b/etc/iface.example
index 7fb7951..82cf21b 100644
--- a/etc/iface.example
+++ b/etc/iface.example
@@ -20,6 +20,7 @@
 # - iser (Software iSCSI over infinniband
 # - qla4xxx (Qlogic QLA4XXX HBAs)
 # - bnx2i (Broadcom bnx iSCSI HBAs);
+# - cxgb3i (Chelsio cxgb S3 iSCSI HBAs);
 #
 #OPTIONAL: iface.initiatorname
 # To use a initiator name other than the one set in
@@ -51,3 +52,11 @@
 
 # Note you can only bind using one value. If you set multiple values
 # the bahavior is not defined.
+
+# For some transport (cxgb3i), a user could to set the private ip address for 
+# the iscsi traffic for an network interface:
+# example:
+#  - set iscsi ip on eth0 to be 102.50.50.101, eth0 needs to be up and be on
+#the same subnet.
+# iface.net_ifacename = eth0
+# iface.ipaddress = 102.50.50.101
diff --git a/usr/transport.c b/usr/transport.c
index c2edbcc..07b61db 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -41,6 +41,13 @@ struct iscsi_transport_template iscsi_iser = {
.ep_disconnect  = ktransport_ep_disconnect,
 };
 
+struct iscsi_transport_template cxgb3i = {
+   .name   = "cxgb3i",
+   .ep_connect = ktransport_ep_connect,
+   .ep_poll= ktransport_ep_poll,
+   .ep_disconnect  = ktransport_ep_disconnect,
+};
+
 struct iscsi_transport_template bnx2i = {
.name   = "bnx2i",
.ep_connect = ktransport_ep_connect,
@@ -55,6 +62,7 @@ struct iscsi_transport_template qla4xxx = {
 static struct iscsi_transport_template *iscsi_transport_templates[] = {
&iscsi_tcp,
&iscsi_iser,
+   &cxgb3i,
&bnx2i,
&qla4xxx,
NULL
diff --git a/utils/iscsi_discovery b/utils/iscsi_discovery
index 9f1e7cf..6f259f6 100755
--- a/utils/iscsi_discovery
+++ b/utils/iscsi_discovery
@@ -147,12 +147,21 @@ try_login()
 set_transport()
 {
transport=$1
-   if [ "$transport" == "iser" ];then
+   case "$transport" in
+   iser)
+   # iSER does not use digest
iscsiadm -m node --targetname ${target} --portal ${portal} \
-   --op update -n node.conn[0].iscsi.HeaderDigest 
-v None
+   --op update -n node.conn[0].iscsi.HeaderDigest -v None
iscsiadm -m node --targetname ${target} --portal ${portal} \
-   --op update -n node.conn[0].iscsi.DataDigest -v 
None
-   fi
+   --op update -n node.conn[0].iscsi.DataDigest -v None
+   ;;
+   cxgb3i)
+   # cxgb3i supports <= 16K packet (BHS + AHS + pdu payload + 
digests) 
+   iscsiadm -m node --targetname ${target} --portal ${portal} \
+   --op update -n 
node.conn[0].iscsi.MaxRecvDataSegmentLength \
+   -v 8192
+   ;;
+   esac
transport_name=`iscsiadm  -m node -p ${portal} -T ${target} |awk 
'/transport_name/ {print $1}'`
iscsiadm -m node --targetname ${target} --portal ${portal} \
--op update -n ${transport_name} -v ${transport}

--~--~-~--~~~---~--~~
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 t

[PATCH 0/4 2.6.28] cxgb3i iscsi initiator driver

2008-08-27 Thread Karen Xie

Hi, everyone,

Please review our new version of the iSCSI Initiator drivers for Chelsio S3 
adapters. We have updated the code with the feedbacks received, including 
getting rid of most of the __GFP_NOFAIL allocation.

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

The accelerated iscsi traffic uses a private IP address which is unknown to the 
OS.

netdev list, please review part 1, 2 and cxgb3i_offload.[ch] in part 4 which 
handle the iscsi connection APIs to the adapter.

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-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address

2008-08-27 Thread Karen Xie

[PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

The accelerated iSCSI traffic uses a private IP address unknown to the OS.
The driver has to reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/sge.c |   72 ---
 1 files changed, 67 insertions(+), 5 deletions(-)


diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 1b0861d..2f17cf3 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "common.h"
 #include "regs.h"
 #include "sge_defs.h"
@@ -1859,6 +1860,54 @@ static void restart_tx(struct sge_qset *qs)
 }
 
 /**
+ * cxgb3_arp_process - process an ARP request probing a private IP address
+ * @adapter: the adapter
+ * @skb: the skbuff containing the ARP request
+ *
+ * Check if the ARP request is probing the private IP address
+ * dedicated to iSCSI, generate an ARP reply if so.
+ */
+static void cxgb3_arp_process(struct adapter *adapter, struct sk_buff *skb)
+{
+   struct net_device *dev = skb->dev;
+   struct port_info *pi;
+   struct arphdr *arp;
+   unsigned char *arp_ptr;
+   unsigned char *sha;
+   __be32 sip, tip;
+
+   if (!dev)
+   return;
+
+   skb_reset_network_header(skb);
+   arp = arp_hdr(skb);
+
+   if (arp->ar_op != htons(ARPOP_REQUEST))
+   return;
+
+   arp_ptr = (unsigned char *)(arp + 1);
+   sha = arp_ptr;
+   arp_ptr += dev->addr_len;
+   memcpy(&sip, arp_ptr, sizeof(sip));
+   arp_ptr += sizeof(sip);
+   arp_ptr += dev->addr_len;
+   memcpy(&tip, arp_ptr, sizeof(tip));
+
+   pi = netdev_priv(dev);
+   if (tip != pi->iscsi_ipv4addr)
+   return;
+
+   arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
+dev->dev_addr, sha);
+
+}
+
+static inline int is_arp(struct sk_buff *skb)
+{
+   return skb->protocol == htons(ETH_P_ARP);
+}
+
+/**
  * rx_eth - process an ingress ethernet packet
  * @adap: the adapter
  * @rq: the response queue that received the packet
@@ -1882,7 +1931,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq 
*rq,
pi = netdev_priv(skb->dev);
if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0x) &&
!p->fragment) {
-   rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
+   qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
skb->ip_summed = CHECKSUM_UNNECESSARY;
} else
skb->ip_summed = CHECKSUM_NONE;
@@ -1891,22 +1940,35 @@ static void rx_eth(struct adapter *adap, struct 
sge_rspq *rq,
struct vlan_group *grp = pi->vlan_grp;
 
qs->port_stats[SGE_PSTAT_VLANEX]++;
-   if (likely(grp))
+
+   if (likely(grp)) {
if (lro)
lro_vlan_hwaccel_receive_skb(&qs->lro_mgr, skb,
 grp,
 ntohs(p->vlan),
 p);
-   else
+   else {
+   if (unlikely(pi->iscsi_ipv4addr &&
+is_arp(skb))) {
+   unsigned short vtag = ntohs(p->vlan) &
+   VLAN_VID_MASK;
+   skb->dev = vlan_group_get_device(grp,
+vtag);
+   cxgb3_arp_process(adap, skb);
+   }
__vlan_hwaccel_rx(skb, grp, ntohs(p->vlan),
  rq->polling);
-   else
+   }
+   } else
dev_kfree_skb_any(skb);
} else if (rq->polling) {
if (lro)
lro_receive_skb(&qs->lro_mgr, skb, p);
-   else
+   else {
+   if (unlikely(pi->iscsi_ipv4addr && is_arp(skb)))
+   cxgb3_arp_process(adap, skb);
netif_receive_skb(skb);
+   }
} else
netif_rx(skb);
 }

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI

2008-08-27 Thread Karen Xie

[PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI

From: Karen Xie <[EMAIL PROTECTED]>

Create a per port sysfs entry to pass an IP address to the NIC driver, and a 
control call for the iSCSI driver to grab it.
The IP address is required in both drivers to manage ARP requests and 
connection set up.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/adapter.h|1 +
 drivers/net/cxgb3/cxgb3_ctl_defs.h |7 +
 drivers/net/cxgb3/cxgb3_main.c |   46 
 drivers/net/cxgb3/cxgb3_offload.c  |6 +
 4 files changed, 60 insertions(+), 0 deletions(-)


diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 2711404..adc2f13 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -64,6 +64,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
+   __be32 iscsi_ipv4addr;
 };
 
 enum { /* adapter flags */
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 6ad9240..2bf5027 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,6 +57,7 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+   GET_ISCSI_IPV4ADDR  = 51,
 };
 
 /*
@@ -86,6 +87,12 @@ struct iff_mac {
u16 vlan_tag;
 };
 
+/* Structure used to request a port's iSCSI IPv4 address */
+struct iscsi_ipv4addr {
+   struct net_device *dev; /* the net_device */
+   __be32 ipv4addr;/* the return iSCSI IPv4 address */
+};
+
 struct pci_dev;
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 5447f3e..4f72c06 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -687,6 +688,47 @@ static struct attribute *offload_attrs[] = {
 
 static struct attribute_group offload_attr_group = {.attrs = offload_attrs };
 
+static ssize_t iscsi_ipv4addr_attr_show(struct device *d, char *buf)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   __be32 a = pi->iscsi_ipv4addr;
+
+   return sprintf(buf, NIPQUAD_FMT "\n", NIPQUAD(a));
+}
+
+static ssize_t iscsi_ipv4addr_attr_store(struct device *d,
+  const char *buf, size_t len)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+
+   pi->iscsi_ipv4addr = in_aton(buf);
+   return len;
+}
+
+#define ISCSI_IPADDR_ATTR(name) \
+static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
+  char *buf) \
+{ \
+   return iscsi_ipv4addr_attr_show(d, buf); \
+} \
+static ssize_t store_##name(struct device *d, struct device_attribute *attr, \
+   const char *buf, size_t len) \
+{ \
+   return iscsi_ipv4addr_attr_store(d, buf, len); \
+} \
+static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_##name)
+
+ISCSI_IPADDR_ATTR(iscsi_ipv4addr);
+
+static struct attribute *iscsi_offload_attrs[] = {
+   &dev_attr_iscsi_ipv4addr.attr,
+   NULL
+};
+
+static struct attribute_group iscsi_offload_attr_group = {
+   .attrs = iscsi_offload_attrs
+};
+
 /*
  * Sends an sk_buff to an offload queue driver
  * after dealing with any active network taps.
@@ -1078,6 +1120,7 @@ static int cxgb_open(struct net_device *dev)
if (err)
printk(KERN_WARNING
   "Could not initialize offload capabilities\n");
+   sysfs_create_group(&dev->dev.kobj, &iscsi_offload_attr_group);
}
 
link_start(dev);
@@ -1100,6 +1143,9 @@ static int cxgb_close(struct net_device *dev)
netif_carrier_off(dev);
t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
 
+   if (is_offload(adapter) && !ofld_disable)
+   sysfs_remove_group(&dev->dev.kobj, &iscsi_offload_attr_group);
+
spin_lock(&adapter->work_lock); /* sync with update task */
clear_bit(pi->port_id, &adapter->open_device_map);
spin_unlock(&adapter->work_lock);
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index c5b3de1..f8f4faa 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -407,6 +407,12 @@ static int cxgb_offload_ctl(struct t3cdev *tdev, unsigned 
int req, void *data)
rx_page_info->page_size = tp->rx_pg_size;
rx_page_info->num = tp->rx_num_pgs;
break;
+   case GET_ISCSI_IPV4ADDR: {
+   struct iscsi_ipv4addr *p = data;
+   struct port_info *pi = netdev_priv(p->dev);
+  

[PATCH 1/1] open-iscsi - add cxgb3i transport iface

2008-08-27 Thread Karen Xie

[PATCH 1/1] open-iscsi - add cxgb3i transport iface

From: Karen Xie <[EMAIL PROTECTED]>

Add cxgb3i transport interface for open-iscsi user space tool.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 usr/transport.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)


diff --git a/usr/transport.c b/usr/transport.c
index c2edbcc..923766a 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -48,6 +48,13 @@ struct iscsi_transport_template bnx2i = {
.ep_disconnect  = ktransport_ep_disconnect,
 };
 
+struct iscsi_transport_template cxgb3i = {
+   .name   = "cxgb3i",
+   .ep_connect = ktransport_ep_connect,
+   .ep_poll= ktransport_ep_poll,
+   .ep_disconnect  = ktransport_ep_disconnect,
+};
+
 struct iscsi_transport_template qla4xxx = {
.name   = "qla4xxx",
 };
@@ -56,6 +63,7 @@ static struct iscsi_transport_template 
*iscsi_transport_templates[] = {
&iscsi_tcp,
&iscsi_iser,
&bnx2i,
+   &cxgb3i,
&qla4xxx,
NULL
 };

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 3/4 2.6.28] open-iscsi - support for digest offload and payload DDP

2008-08-27 Thread Karen Xie

[PATCH 3/4 2.6.28] open-iscsi - support for digest offload and payload DDP.

From: Karen Xie <[EMAIL PROTECTED]>

Added PDU digest offload and payload direct-placement support in
open-iscsi.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/scsi/iscsi_tcp.c|   56 ---
 drivers/scsi/iscsi_tcp.h|   14 +
 drivers/scsi/libiscsi.c |   54 +++---
 include/scsi/iscsi_if.h |1 +
 include/scsi/libiscsi.h |2 +
 include/scsi/scsi_transport_iscsi.h |9 ++
 6 files changed, 106 insertions(+), 30 deletions(-)


diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 2a2f009..ec73a31 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -97,7 +97,7 @@ static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn 
*tcp_conn,
  * data is copied to the indicated sg entry, at the given
  * offset.
  */
-static inline void
+void
 iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  struct scatterlist *sg, unsigned int offset)
 {
@@ -107,6 +107,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
segment->total_size - segment->total_copied);
segment->data = NULL;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_init_sg);
 
 /**
  * iscsi_tcp_segment_map - map the current S/G page
@@ -117,7 +118,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  * because the iscsi passthrough and internal IO paths will never use high
  * mem pages.
  */
-static inline void
+void
 iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
 {
struct scatterlist *sg;
@@ -143,8 +144,9 @@ iscsi_tcp_segment_map(struct iscsi_segment *segment, int 
recv)
segment->sg_mapped = kmap_atomic(sg_page(sg), KM_SOFTIRQ0);
segment->data = segment->sg_mapped + sg->offset + segment->sg_offset;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_map);
 
-static inline void
+void
 iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
 {
debug_tcp("iscsi_tcp_segment_unmap %p\n", segment);
@@ -156,6 +158,7 @@ iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
segment->data = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_unmap);
 
 /*
  * Splice the digest buffer into the buffer
@@ -376,6 +379,9 @@ static inline int
 iscsi_tcp_dgst_verify(struct iscsi_tcp_conn *tcp_conn,
  struct iscsi_segment *segment)
 {
+   if (tcp_conn->iscsi_conn->session->tt->caps & CAP_DIGEST_OFFLOAD)
+   return (segment->status & ISCSI_SEGMENT_DGST_ERR) ? 0 : 1;
+
if (!segment->digest_len)
return 1;
 
@@ -448,7 +454,7 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment,
  * function is called we do not yet know the final size of the header and want
  * to delay the digest processing until we know that.
  */
-static void
+void
 iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 {
debug_tcp("iscsi_tcp_hdr_recv_prep(%p%s)\n", tcp_conn,
@@ -457,6 +463,7 @@ iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
tcp_conn->in.hdr_buf, sizeof(struct iscsi_hdr),
iscsi_tcp_hdr_recv_done, NULL);
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_hdr_recv_prep);
 
 /*
  * Handle incoming reply to any other type of command
@@ -486,7 +493,8 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
struct iscsi_conn *conn = tcp_conn->iscsi_conn;
struct hash_desc *rx_hash = NULL;
 
-   if (conn->datadgst_en)
+   if (conn->datadgst_en &&
+   !(conn->session->tt->caps & CAP_DIGEST_OFFLOAD))
rx_hash = &tcp_conn->rx_hash;
 
iscsi_segment_init_linear(&tcp_conn->in.segment,
@@ -497,7 +505,7 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 /*
  * must be called with session lock
  */
-static void
+void
 iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
@@ -521,6 +529,7 @@ iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct 
iscsi_task *task)
tcp_task->r2t = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_cleanup_task);
 
 /**
  * iscsi_data_rsp - SCSI Data-In Response processing
@@ -737,7 +746,7 @@ iscsi_tcp_process_data_in(struct iscsi_tcp_conn *tcp_conn,
  * by data, the receive buffer is set up to copy the incoming data
  * to the correct location.
  */
-static int
+int
 iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
 {
int rc = 0, opcode, ahslen;
@@ -793,7 +802,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct 
iscsi_hdr *hdr)
 * we move on to the next scatterlist entry and
 * update the 

[PATCH 3/4 2.6.28] open-iscsi - support for digest offload and payload DDP

2008-08-22 Thread Karen Xie

[PATCH 3/4 2.6.28] open-iscsi - support for digest offload and payload DDP.

From: Karen Xie <[EMAIL PROTECTED]>

Added PDU digest offload and payload direct-placement support in open-iscsi.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/scsi/iscsi_tcp.c|   61 ---
 drivers/scsi/iscsi_tcp.h|   14 
 drivers/scsi/libiscsi.c |   51 +++--
 include/scsi/iscsi_if.h |1 +
 include/scsi/libiscsi.h |2 +
 include/scsi/scsi_transport_iscsi.h |9 +
 6 files changed, 106 insertions(+), 32 deletions(-)


diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 2a2f009..915416c 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -97,7 +97,7 @@ static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn 
*tcp_conn,
  * data is copied to the indicated sg entry, at the given
  * offset.
  */
-static inline void
+void
 iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  struct scatterlist *sg, unsigned int offset)
 {
@@ -107,6 +107,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
segment->total_size - segment->total_copied);
segment->data = NULL;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_init_sg);
 
 /**
  * iscsi_tcp_segment_map - map the current S/G page
@@ -117,7 +118,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  * because the iscsi passthrough and internal IO paths will never use high
  * mem pages.
  */
-static inline void
+void
 iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
 {
struct scatterlist *sg;
@@ -143,8 +144,9 @@ iscsi_tcp_segment_map(struct iscsi_segment *segment, int 
recv)
segment->sg_mapped = kmap_atomic(sg_page(sg), KM_SOFTIRQ0);
segment->data = segment->sg_mapped + sg->offset + segment->sg_offset;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_map);
 
-static inline void
+void
 iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
 {
debug_tcp("iscsi_tcp_segment_unmap %p\n", segment);
@@ -156,6 +158,7 @@ iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
segment->data = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_unmap);
 
 /*
  * Splice the digest buffer into the buffer
@@ -376,6 +379,8 @@ static inline int
 iscsi_tcp_dgst_verify(struct iscsi_tcp_conn *tcp_conn,
  struct iscsi_segment *segment)
 {
+   if (tcp_conn->iscsi_conn->session->tt->caps & CAP_DIGEST_OFFLOAD)
+   return ((segment->status & ISCSI_SEGMENT_DGST_ERR) ? 0 : 1);
if (!segment->digest_len)
return 1;
 
@@ -448,7 +453,7 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment,
  * function is called we do not yet know the final size of the header and want
  * to delay the digest processing until we know that.
  */
-static void
+void
 iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 {
debug_tcp("iscsi_tcp_hdr_recv_prep(%p%s)\n", tcp_conn,
@@ -457,6 +462,7 @@ iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
tcp_conn->in.hdr_buf, sizeof(struct iscsi_hdr),
iscsi_tcp_hdr_recv_done, NULL);
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_hdr_recv_prep);
 
 /*
  * Handle incoming reply to any other type of command
@@ -486,7 +492,8 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
struct iscsi_conn *conn = tcp_conn->iscsi_conn;
struct hash_desc *rx_hash = NULL;
 
-   if (conn->datadgst_en)
+   if (conn->datadgst_en &&
+   !(conn->session->tt->caps & CAP_DIGEST_OFFLOAD))
rx_hash = &tcp_conn->rx_hash;
 
iscsi_segment_init_linear(&tcp_conn->in.segment,
@@ -497,7 +504,7 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 /*
  * must be called with session lock
  */
-static void
+void
 iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
@@ -521,6 +528,7 @@ iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct 
iscsi_task *task)
tcp_task->r2t = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_cleanup_task);
 
 /**
  * iscsi_data_rsp - SCSI Data-In Response processing
@@ -737,7 +745,7 @@ iscsi_tcp_process_data_in(struct iscsi_tcp_conn *tcp_conn,
  * by data, the receive buffer is set up to copy the incoming data
  * to the correct location.
  */
-static int
+int
 iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
 {
int rc = 0, opcode, ahslen;
@@ -793,7 +801,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct 
iscsi_hdr *hdr)
 * we move on to the next scatterlist entry and
 * update the 

[PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI

2008-08-22 Thread Karen Xie

[PATCH 1/4 2.6.28] cxgb3 - manage a private ip address for iSCSI

From: Karen Xie <[EMAIL PROTECTED]>

Create a per port sysfs entry to pass an IP address to the NIC driver, and a 
control call for the iSCSI driver to grab it.
The IP address is required in both drivers to manage ARP requests and 
connection set up.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/adapter.h|1 +
 drivers/net/cxgb3/cxgb3_ctl_defs.h |7 
 drivers/net/cxgb3/cxgb3_main.c |   65 
 drivers/net/cxgb3/cxgb3_offload.c  |6 +++
 4 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cxgb3/adapter.h b/drivers/net/cxgb3/adapter.h
index 2711404..0e4fe95 100644
--- a/drivers/net/cxgb3/adapter.h
+++ b/drivers/net/cxgb3/adapter.h
@@ -64,6 +64,7 @@ struct port_info {
struct link_config link_config;
struct net_device_stats netstats;
int activity;
+   __be32 iscsi_ipaddr;
 };
 
 enum { /* adapter flags */
diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 6ad9240..e171aa8 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -57,6 +57,7 @@ enum {
RDMA_GET_MIB= 19,
 
GET_RX_PAGE_INFO= 50,
+   GET_ISCSI_IPADDR= 51,
 };
 
 /*
@@ -86,6 +87,12 @@ struct iff_mac {
u16 vlan_tag;
 };
 
+/* Structure used to request a port's iSCSI IP address */
+struct iscsi_ipaddr {
+   struct net_device *dev; /* the net_device */
+   __be32 ipaddr;  /* the return iSCSI IP address */
+};
+
 struct pci_dev;
 
 /*
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 5447f3e..1c8952c 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -687,6 +687,66 @@ static struct attribute *offload_attrs[] = {
 
 static struct attribute_group offload_attr_group = {.attrs = offload_attrs };
 
+static ssize_t iscsi_ipaddr_attr_show(struct device *d,
+ char *buf)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   __be32 a = ntohl(pi->iscsi_ipaddr);
+
+   return sprintf(buf, "%d.%d.%d.%d\n",
+  (a >> 24) & 0xff,
+  (a >> 16) & 0xff,
+  (a >>  8) & 0xff,
+  (a >>  0) & 0xff);
+}
+
+static ssize_t iscsi_ipaddr_attr_store(struct device *d,
+  const char *buf, size_t len)
+{
+   struct port_info *pi = netdev_priv(to_net_dev(d));
+   __be32 a = 0;
+   unsigned long octet;
+   const char *parse = buf;
+   char *endp;
+   int i;
+
+   for (i = 1; i <= 4; i++) {
+   octet = simple_strtoul(parse, &endp, 10);
+   if (endp == buf || octet > 255 ||
+   (i < 4 && *endp != '.') ||
+   (i == 4 && *endp != '\0' && *endp != '\n'))
+   return -EINVAL;
+   a = (a << 8) | octet;
+   parse = endp+1;
+   }
+   pi->iscsi_ipaddr = htonl(a);
+   return endp-buf;
+}
+
+#define ISCSI_IPADDR_ATTR(name) \
+static ssize_t show_##name(struct device *d, struct device_attribute *attr, \
+  char *buf) \
+{ \
+   return iscsi_ipaddr_attr_show(d, buf); \
+} \
+static ssize_t store_##name(struct device *d, struct device_attribute *attr, \
+const char *buf, size_t len) \
+{ \
+   return iscsi_ipaddr_attr_store(d, buf, len); \
+} \
+static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_##name, store_##name)
+
+ISCSI_IPADDR_ATTR(iscsi_ipaddr);
+
+static struct attribute *iscsi_offload_attrs[] = {
+   &dev_attr_iscsi_ipaddr.attr,
+   NULL
+};
+
+static struct attribute_group iscsi_offload_attr_group = {
+.attrs = iscsi_offload_attrs
+};
+
 /*
  * Sends an sk_buff to an offload queue driver
  * after dealing with any active network taps.
@@ -1078,6 +1138,7 @@ static int cxgb_open(struct net_device *dev)
if (err)
printk(KERN_WARNING
   "Could not initialize offload capabilities\n");
+   sysfs_create_group(&dev->dev.kobj, &iscsi_offload_attr_group);
}
 
link_start(dev);
@@ -1100,6 +1161,9 @@ static int cxgb_close(struct net_device *dev)
netif_carrier_off(dev);
t3_mac_disable(&pi->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX);
 
+if (is_offload(adapter) && !ofld_disable)
+   sysfs_remove_group(&dev->dev.kobj, &iscsi_offload_attr_group);
+
spin_lock(&adapter->work_lock); /* sync with update task */
clear_bit(pi->port_id, &

[PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address

2008-08-22 Thread Karen Xie

[PATCH 2/4 2.6.28] cxgb3 - handle ARP replies for private iSCSI IP address

From: Karen Xie <[EMAIL PROTECTED]>

stg can be tricky ...
[adding @adapter in cxgb3_arp_process doxygen header]
The accelerated iSCSI traffic uses a private IP address unknown to the OS.
The driver has to reply to ARP requests dedicated to the private IP address.

Signed-off-by: Divy Le Ray <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/sge.c |   71 ---
 1 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 1b0861d..d2a9285 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "common.h"
 #include "regs.h"
 #include "sge_defs.h"
@@ -1859,6 +1860,54 @@ static void restart_tx(struct sge_qset *qs)
 }
 
 /**
+ * cxgb3_arp_process - process an ARP request probing a private IP address
+ * @adapter: the adapter
+ * @skb: the skbuff containing the ARP request
+ *
+ * Check if the ARP request is probing the private IP address
+ * dedicated to iSCSI, generate an ARP reply if so.
+ */
+static void cxgb3_arp_process(struct adapter *adapter, struct sk_buff *skb)
+{
+   struct net_device *dev = skb->dev;
+   struct port_info *pi;
+   struct arphdr *arp;
+   unsigned char *arp_ptr;
+   unsigned char *sha;
+   u32 sip, tip;
+
+   if (!dev)
+   return;
+
+   skb_reset_network_header(skb);
+   arp = arp_hdr(skb);
+
+   if (arp->ar_op != htons(ARPOP_REQUEST))
+   return;
+
+   arp_ptr = (unsigned char *)(arp + 1);
+   sha = arp_ptr;
+   arp_ptr += dev->addr_len;
+   memcpy(&sip, arp_ptr, 4);
+   arp_ptr += 4;
+   arp_ptr += dev->addr_len;
+   memcpy(&tip, arp_ptr, 4);
+
+   pi = netdev_priv(dev);
+   if (ntohl(tip) != pi->iscsi_ipaddr)
+   return;
+
+   arp_send(ARPOP_REPLY, ETH_P_ARP, sip, dev, tip, sha,
+dev->dev_addr, sha);
+
+}
+
+static inline int is_arp(struct sk_buff *skb)
+{
+   return skb->protocol == htons(ETH_P_ARP);
+}
+
+/**
  * rx_eth - process an ingress ethernet packet
  * @adap: the adapter
  * @rq: the response queue that received the packet
@@ -1882,7 +1931,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq 
*rq,
pi = netdev_priv(skb->dev);
if (pi->rx_csum_offload && p->csum_valid && p->csum == htons(0x) &&
!p->fragment) {
-   rspq_to_qset(rq)->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
+   qs->port_stats[SGE_PSTAT_RX_CSUM_GOOD]++;
skb->ip_summed = CHECKSUM_UNNECESSARY;
} else
skb->ip_summed = CHECKSUM_NONE;
@@ -1891,22 +1940,34 @@ static void rx_eth(struct adapter *adap, struct 
sge_rspq *rq,
struct vlan_group *grp = pi->vlan_grp;
 
qs->port_stats[SGE_PSTAT_VLANEX]++;
-   if (likely(grp))
+
+   if (likely(grp)) {
if (lro)
lro_vlan_hwaccel_receive_skb(&qs->lro_mgr, skb,
 grp,
 ntohs(p->vlan),
 p);
-   else
+   else {
+   if (unlikely(pi->iscsi_ipaddr && is_arp(skb))) {
+   unsigned short vtag = ntohs(p->vlan) &
+ VLAN_VID_MASK;
+   skb->dev = vlan_group_get_device(grp,
+vtag);
+   cxgb3_arp_process(adap, skb);
+   }
__vlan_hwaccel_rx(skb, grp, ntohs(p->vlan),
  rq->polling);
-   else
+   }
+   } else
dev_kfree_skb_any(skb);
} else if (rq->polling) {
if (lro)
lro_receive_skb(&qs->lro_mgr, skb, p);
-   else
+   else {
+   if (unlikely(pi->iscsi_ipaddr && is_arp(skb)))
+   cxgb3_arp_process(adap, skb);
netif_receive_skb(skb);
+   }
} else
netif_rx(skb);
 }

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 0/4 2.6.28] cxgb3i - Add iSCSI driver

2008-08-22 Thread Karen Xie

Hi, everyone,

Please review our new version of the iSCSI Initiator drivers for Chelsio S3 
adapters. The cxgb3i driver provides iscsi acceleration (PDU digest offload and 
payload direct-placement) to the open-iscsi initiator. It accesses the hardware 
through the cxgb3 module.

The accelerated iscsi traffic uses a private IP address which is unknown to the 
OS.

netdev list, please review part 1, 2 and cxgb3i_offload.[ch] in part 4 which 
handle the iscsi connection APIs to the adapter.

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-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



RE: [Security] [PATCH 0/3 2.6.27] cxgb3i: Add iSCSI driver

2008-06-25 Thread Karen Xie

Greg,

We'd like to export security_inet_conn_established() from
security/security.c.

Thanks.
Karen

-Original Message-
From: Greg KH [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2008 11:52 PM
To: Karen Xie
Cc: [EMAIL PROTECTED]; Divy Le Ray; [EMAIL PROTECTED];
[EMAIL PROTECTED]; open-iscsi@googlegroups.com;
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [Security] [PATCH 0/3 2.6.27] cxgb3i: Add iSCSI driver

On Wed, Jun 18, 2008 at 10:10:00PM -0700, Karen Xie wrote:
> 
> Please review the iSCSI drivers for Chelsio CXGB3 (S3XX) devices.  

Is there some reason you send this to [EMAIL PROTECTED]

confused,

greg k-h

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 0/3 2.6.27] cxgb3i: Add iSCSI driver

2008-06-25 Thread Karen Xie


Please review the iSCSI drivers for Chelsio CXGB3 (S3XX) devices.  

Here is a brief description of the patch series:
- added iscsi support to cxgb3 driver
- added pdu digest offload and payload direct-placement support to open-iscsi
- the cxgb3i iscsi driver

Thanks.


















--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~--~~~~--~~--~--~---



[PATCH 2/3 2.6.27] open-iscsi - add support for pdu digest offload and payload direct-placement

2008-06-25 Thread Karen Xie


Add support for pdu digest offload and payload direct-placement capabilities.

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/scsi/iscsi_tcp.c|   58 ---
 drivers/scsi/iscsi_tcp.h|   14 
 drivers/scsi/libiscsi.c |   51 ---
 include/scsi/iscsi_if.h |1 +
 include/scsi/libiscsi.h |2 +
 include/scsi/scsi_transport_iscsi.h |9 +
 6 files changed, 104 insertions(+), 31 deletions(-)


diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index 29bf0b5..8e2848e 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -97,7 +97,7 @@ static int iscsi_tcp_hdr_recv_done(struct iscsi_tcp_conn 
*tcp_conn,
  * data is copied to the indicated sg entry, at the given
  * offset.
  */
-static inline void
+void
 iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  struct scatterlist *sg, unsigned int offset)
 {
@@ -107,6 +107,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
segment->total_size - segment->total_copied);
segment->data = NULL;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_init_sg);
 
 /**
  * iscsi_tcp_segment_map - map the current S/G page
@@ -117,7 +118,7 @@ iscsi_tcp_segment_init_sg(struct iscsi_segment *segment,
  * because the iscsi passthrough and internal IO paths will never use high
  * mem pages.
  */
-static inline void
+void
 iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
 {
struct scatterlist *sg;
@@ -143,8 +144,9 @@ iscsi_tcp_segment_map(struct iscsi_segment *segment, int 
recv)
segment->sg_mapped = kmap_atomic(sg_page(sg), KM_SOFTIRQ0);
segment->data = segment->sg_mapped + sg->offset + segment->sg_offset;
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_map);
 
-static inline void
+void
 iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
 {
debug_tcp("iscsi_tcp_segment_unmap %p\n", segment);
@@ -156,6 +158,7 @@ iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
segment->data = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_segment_unmap);
 
 /*
  * Splice the digest buffer into the buffer
@@ -376,6 +379,8 @@ static inline int
 iscsi_tcp_dgst_verify(struct iscsi_tcp_conn *tcp_conn,
  struct iscsi_segment *segment)
 {
+   if (tcp_conn->iscsi_conn->session->tt->caps & CAP_DIGEST_OFFLOAD)
+   return ((segment->status & ISCSI_SEGMENT_DGST_ERR) ? 0 : 1);
if (!segment->digest_len)
return 1;
 
@@ -448,7 +453,7 @@ iscsi_segment_seek_sg(struct iscsi_segment *segment,
  * function is called we do not yet know the final size of the header and want
  * to delay the digest processing until we know that.
  */
-static void
+void
 iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 {
debug_tcp("iscsi_tcp_hdr_recv_prep(%p%s)\n", tcp_conn,
@@ -457,6 +462,7 @@ iscsi_tcp_hdr_recv_prep(struct iscsi_tcp_conn *tcp_conn)
tcp_conn->in.hdr_buf, sizeof(struct iscsi_hdr),
iscsi_tcp_hdr_recv_done, NULL);
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_hdr_recv_prep);
 
 /*
  * Handle incoming reply to any other type of command
@@ -486,7 +492,8 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
struct iscsi_conn *conn = tcp_conn->iscsi_conn;
struct hash_desc *rx_hash = NULL;
 
-   if (conn->datadgst_en)
+   if (conn->datadgst_en &&
+   !(conn->session->tt->caps & CAP_DIGEST_OFFLOAD))
rx_hash = &tcp_conn->rx_hash;
 
iscsi_segment_init_linear(&tcp_conn->in.segment,
@@ -497,7 +504,7 @@ iscsi_tcp_data_recv_prep(struct iscsi_tcp_conn *tcp_conn)
 /*
  * must be called with session lock
  */
-static void
+void
 iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct iscsi_task *task)
 {
struct iscsi_tcp_task *tcp_task = task->dd_data;
@@ -521,6 +528,7 @@ iscsi_tcp_cleanup_task(struct iscsi_conn *conn, struct 
iscsi_task *task)
tcp_task->r2t = NULL;
}
 }
+EXPORT_SYMBOL_GPL(iscsi_tcp_cleanup_task);
 
 /**
  * iscsi_data_rsp - SCSI Data-In Response processing
@@ -737,7 +745,7 @@ iscsi_tcp_process_data_in(struct iscsi_tcp_conn *tcp_conn,
  * by data, the receive buffer is set up to copy the incoming data
  * to the correct location.
  */
-static int
+int
 iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr)
 {
int rc = 0, opcode, ahslen;
@@ -793,7 +801,8 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct 
iscsi_hdr *hdr)
 * we move on to the next scatterlist entry and
 * update the digest per-entry.
 */
-   if (conn->d

[PATCH 1/3 2.6.27] cxgb3 - Add iSCSI support

2008-06-25 Thread Karen Xie

From: Karen Xie <[EMAIL PROTECTED]>

Add iSCSI support:
- read and write iSCSI related registers
- additional types of chelsio-protocol-language used by iscsi. 

Signed-off-by: Karen Xie <[EMAIL PROTECTED]>
---

 drivers/net/cxgb3/cxgb3_ctl_defs.h |5 +---
 drivers/net/cxgb3/cxgb3_offload.c  |   11 ++
 drivers/net/cxgb3/regs.h   |   10 +
 drivers/net/cxgb3/t3_cpl.h |   41 
 drivers/net/cxgb3/t3cdev.h |4 +++-
 5 files changed, 62 insertions(+), 9 deletions(-)


diff --git a/drivers/net/cxgb3/cxgb3_ctl_defs.h 
b/drivers/net/cxgb3/cxgb3_ctl_defs.h
index 6c4f320..d38e6cc 100644
--- a/drivers/net/cxgb3/cxgb3_ctl_defs.h
+++ b/drivers/net/cxgb3/cxgb3_ctl_defs.h
@@ -110,10 +110,7 @@ struct ulp_iscsi_info {
unsigned int llimit;
unsigned int ulimit;
unsigned int tagmask;
-   unsigned int pgsz3;
-   unsigned int pgsz2;
-   unsigned int pgsz1;
-   unsigned int pgsz0;
+   u8 pgsz_factor[4];
unsigned int max_rxsz;
unsigned int max_txsz;
struct pci_dev *pdev;
diff --git a/drivers/net/cxgb3/cxgb3_offload.c 
b/drivers/net/cxgb3/cxgb3_offload.c
index ff9c013..ddf3d2d 100644
--- a/drivers/net/cxgb3/cxgb3_offload.c
+++ b/drivers/net/cxgb3/cxgb3_offload.c
@@ -207,6 +207,17 @@ static int cxgb_ulp_iscsi_ctl(struct adapter *adapter, 
unsigned int req,
break;
case ULP_ISCSI_SET_PARAMS:
t3_write_reg(adapter, A_ULPRX_ISCSI_TAGMASK, uiip->tagmask);
+   /* set MaxRxData and MaxCoalesceSize to 16224 */
+   t3_write_reg(adapter, A_TP_PARA_REG2, 0x3f603f60);
+   /* program the ddp page sizes */
+   {
+   int i;
+   unsigned int val = 0;
+   for (i = 0; i < 4; i++)
+   val |= (uiip->pgsz_factor[i] & 0xF) << (8 * i);
+   if (val)
+   t3_write_reg(adapter, A_ULPRX_ISCSI_PSZ, val);
+   }
break;
default:
ret = -EOPNOTSUPP;
diff --git a/drivers/net/cxgb3/regs.h b/drivers/net/cxgb3/regs.h
index 5671788..4bda27c 100644
--- a/drivers/net/cxgb3/regs.h
+++ b/drivers/net/cxgb3/regs.h
@@ -1517,16 +1517,18 @@
 
 #define A_ULPRX_ISCSI_TAGMASK 0x514
 
-#define S_HPZ00
-#define M_HPZ00xf
-#define V_HPZ0(x) ((x) << S_HPZ0)
-#define G_HPZ0(x) (((x) >> S_HPZ0) & M_HPZ0)
+#define A_ULPRX_ISCSI_PSZ 0x518
 
 #define A_ULPRX_TDDP_LLIMIT 0x51c
 
 #define A_ULPRX_TDDP_ULIMIT 0x520
 #define A_ULPRX_TDDP_PSZ 0x528
 
+#define S_HPZ00
+#define M_HPZ00xf
+#define V_HPZ0(x) ((x) << S_HPZ0)
+#define G_HPZ0(x) (((x) >> S_HPZ0) & M_HPZ0)
+
 #define A_ULPRX_STAG_LLIMIT 0x52c
 
 #define A_ULPRX_STAG_ULIMIT 0x530
diff --git a/drivers/net/cxgb3/t3_cpl.h b/drivers/net/cxgb3/t3_cpl.h
index b7a1a31..db25ada 100644
--- a/drivers/net/cxgb3/t3_cpl.h
+++ b/drivers/net/cxgb3/t3_cpl.h
@@ -184,6 +184,9 @@ union opcode_tid {
 #define G_OPCODE(x) (((x) >> S_OPCODE) & 0xFF)
 #define G_TID(x)((x) & 0xFF)
 
+#define S_QNUM 0
+#define G_QNUM(x) (((x) >> S_QNUM) & 0x)
+
 /* tid is assumed to be 24-bits */
 #define MK_OPCODE_TID(opcode, tid) (V_OPCODE(opcode) | (tid))
 
@@ -768,6 +771,12 @@ struct tx_data_wr {
__be32 param;
 };
 
+/* tx_data_wr.flags fields */
+#define S_TX_ACK_PAGES   21
+#define M_TX_ACK_PAGES0x7
+#define V_TX_ACK_PAGES(x) ((x) << S_TX_ACK_PAGES)
+#define G_TX_ACK_PAGES(x) (((x) >> S_TX_ACK_PAGES) & M_TX_ACK_PAGES)
+
 /* tx_data_wr.param fields */
 #define S_TX_PORT0
 #define M_TX_PORT0x7
@@ -1441,4 +1450,36 @@ struct cpl_rdma_terminate {
 #define M_TERM_TID0xF
 #define V_TERM_TID(x) ((x) << S_TERM_TID)
 #define G_TERM_TID(x) (((x) >> S_TERM_TID) & M_TERM_TID)
+
+/* ULP_TX opcodes */
+enum { ULP_MEM_READ = 2, ULP_MEM_WRITE = 3, ULP_TXPKT = 4 };
+
+#define S_ULPTX_CMD  28
+#define M_ULPTX_CMD  0xF
+#define V_ULPTX_CMD(x)((x) << S_ULPTX_CMD)
+
+#define S_ULPTX_NFLITS0
+#define M_ULPTX_NFLITS0xFF
+#define V_ULPTX_NFLITS(x) ((x) << S_ULPTX_NFLITS)
+
+struct ulp_mem_io {
+   WR_HDR;
+   __be32 cmd_lock_addr;
+   __be32 len;
+};
+
+/* ulp_mem_io.cmd_lock_addr fields */
+#define S_ULP_MEMIO_ADDR0
+#define M_ULP_MEMIO_ADDR0x7FF
+#define V_ULP_MEMIO_ADDR(x) ((x) << S_ULP_MEMIO_ADDR)
+
+#define S_ULP_MEMIO_LOCK27
+#define V_ULP_MEMIO_LOCK(x) ((x) << S_ULP_MEMIO_LOCK)
+#define F_ULP_MEMIO_LOCKV_ULP_MEMIO_LOCK(1U)
+
+/* ulp_mem_io.len fields */
+#define S_ULP_MEMIO_DATA_LEN28
+#define M_ULP_MEMIO_DATA_LEN0xF
+#define V_ULP_MEMIO_DATA_LEN(x) ((x) << S_ULP_MEMIO_DATA_LEN)
+
 #endif /* T3_CPL_H */
diff --git a/drivers/net/cxgb3/t3cdev.h b/drivers/net/cxgb3/t3cdev.h
index a18c8a1..0a21