Antw: Re: [PATCH 2/2] iscsi tools: Enhance the discovery code for iser

2014-02-02 Thread Ulrich Windl
 Mike Christie micha...@cs.wisc.edu schrieb am 01.02.2014 um 06:14 in
Nachricht 52ec82ce.7040...@cs.wisc.edu:
 On 1/26/14 8:03 AM, Or Gerlitz wrote:
 For proper discovery support, the iser transport needs the
 ISCSI_PARAM_DISCOVERY_SESS hint before the login PDU is sent.

 For that end, issue the call to iscsi_session_set_params before
 starting the login code in case the transport is iser.

 Signed-off-by: Or Gerlitz ogerl...@mellanox.com
 ---
   usr/discovery.c |   13 -
   1 files changed, 12 insertions(+), 1 deletions(-)

 diff --git a/usr/discovery.c b/usr/discovery.c
 index afce6c0..4f02aac 100644
 --- a/usr/discovery.c
 +++ b/usr/discovery.c
 @@ -1116,7 +1116,7 @@ static int iscsi_create_leading_conn(struct 
 iscsi_session *session)
  }

  /* create interconnect endpoint */
 -log_debug(2, %s discovery ep connect\n, __FUNCTION__);
 +log_debug(2, %s discovery ep connect transport %s caps %x\n, 
 __FUNCTION__, t-name, t-caps);
 
 Formatting. You kept it one line here but you tried to break it up 
 below. You should try to follow the existing code.

Though it's not relevant, my personal coding style for printf-like statements 
(like the one above) that don't fint in one 80-character line is to wrap the 
line preferrably between format string and actual output parameters. To too 
seldom you cahnge either the format or the parameter independently. For very 
long format strings I use the ANSI-C string concatenation (you know  what I 
mean) on seperate lines. Just my opinion on style...

Ulrich


-- 
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/groups/opt_out.


Re: [PATCH 2/2] iscsi tools: Enhance the discovery code for iser

2014-02-01 Thread Or Gerlitz
On Sat, Feb 1, 2014 at 7:14 AM, Mike Christie micha...@cs.wisc.edu wrote:

 On 1/26/14 8:03 AM, Or Gerlitz wrote:@@ -1406,6 +1406,17 @@ 
 redirect_reconnect:

 if ((session-t-caps  CAP_LOGIN_OFFLOAD))
 goto start_conn;

 +   if(!strcmp(session-t-name, iser)) {
 +   log_debug(2, %s discovery set params\n, __FUNCTION__);
 +   rc = iscsi_session_set_params(conn);
 +   if (rc) {
 +   log_error(Could not set iscsi params for conn %d:%d 
 (err 
 + %d)\n, session-id, conn-id, rc);
 +   rc = ISCSI_ERR_INTERNAL;
 +   goto login_failed;
 +   }
 +   }
 +


 The check for specifically iser here is a little odd. The discovery type is a 
 generic iscsi attr so we should not have to special case it.

 Do you just need that one setting at this time or do you need any other 
 settings?


At this time (e.g after bind and before sending login) I need only the
session discovery yes/no set param, this goes down to different buffer
management strategy for discovery vs. normal sessions in iser. I
understand that your patch should replace both patches I sent, right?
I will test it  tomorrow.

-- 
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/groups/opt_out.


Re: [PATCH 2/2] iscsi tools: Enhance the discovery code for iser

2014-02-01 Thread Mike Christie

On 2/1/14 2:42 PM, Or Gerlitz wrote:

On Sat, Feb 1, 2014 at 7:14 AM, Mike Christie micha...@cs.wisc.edu wrote:


On 1/26/14 8:03 AM, Or Gerlitz wrote:@@ -1406,6 +1406,17 @@ redirect_reconnect:


 if ((session-t-caps  CAP_LOGIN_OFFLOAD))
 goto start_conn;

+   if(!strcmp(session-t-name, iser)) {
+   log_debug(2, %s discovery set params\n, __FUNCTION__);
+   rc = iscsi_session_set_params(conn);
+   if (rc) {
+   log_error(Could not set iscsi params for conn %d:%d (err 

+ %d)\n, session-id, conn-id, rc);
+   rc = ISCSI_ERR_INTERNAL;
+   goto login_failed;
+   }
+   }
+



The check for specifically iser here is a little odd. The discovery type is a 
generic iscsi attr so we should not have to special case it.

Do you just need that one setting at this time or do you need any other 
settings?



At this time (e.g after bind and before sending login) I need only the
session discovery yes/no set param, this goes down to different buffer
management strategy for discovery vs. normal sessions in iser. I
understand that your patch should replace both patches I sent, right?


Yes.

--
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/groups/opt_out.


Re: [PATCH 2/2] iscsi tools: Enhance the discovery code for iser

2014-02-01 Thread Or Gerlitz

On 02/02/2014 06:12, Mike Christie wrote:

On 2/1/14 2:42 PM, Or Gerlitz wrote:

At this time (e.g after bind and before sending login) I need only the
session discovery yes/no set param, this goes down to different buffer
management strategy for discovery vs. normal sessions in iser. I
understand that your patch should replace both patches I sent, right?


Yes.



Hi Mike,

I applied the patch and tested... for the full half of the glass it 
works with iser :) but for the other half, it breaks with iscsi-tcp :( 
see below logs of iscsiadm and iscsid


$ ./usr/iscsiadm -m discovery --type sendtargets --portal 
192.168.20.17:3260  -d 8

iscsiadm: Max file limits 32768 32768

iscsiadm: updating defaults from '/etc/iscsi/iscsid.conf'
iscsiadm: updated 
'discovery.sendtargets.iscsi.MaxRecvDataSegmentLength', '32768' = '32768'

iscsiadm: updated 'node.startup', 'manual' = 'automatic'
iscsiadm: updated 'node.leading_login', 'No' = 'No'
iscsiadm: updated 'node.session.timeo.replacement_timeout', '120' = '120'
iscsiadm: updated 'node.conn[0].timeo.login_timeout', '30' = '15'
iscsiadm: updated 'node.conn[0].timeo.logout_timeout', '15' = '15'
iscsiadm: updated 'node.conn[0].timeo.noop_out_interval', '5' = '5'
iscsiadm: updated 'node.conn[0].timeo.noop_out_timeout', '5' = '5'
iscsiadm: updated 'node.session.err_timeo.abort_timeout', '15' = '15'
iscsiadm: updated 'node.session.err_timeo.lu_reset_timeout', '30' = '30'
iscsiadm: updated 'node.session.err_timeo.tgt_reset_timeout', '30' = '30'
iscsiadm: updated 'node.session.initial_login_retry_max', '4' = '8'
iscsiadm: updated 'node.session.cmds_max', '128' = '128'
iscsiadm: updated 'node.session.queue_depth', '32' = '32'
iscsiadm: updated 'node.session.xmit_thread_priority', '-20' = '-20'
iscsiadm: updated 'node.session.iscsi.InitialR2T', 'No' = 'No'
iscsiadm: updated 'node.session.iscsi.ImmediateData', 'Yes' = 'Yes'
iscsiadm: updated 'node.session.iscsi.FirstBurstLength', '262144' = 
'262144'
iscsiadm: updated 'node.session.iscsi.MaxBurstLength', '16776192' = 
'16776192'
iscsiadm: updated 'node.conn[0].iscsi.MaxRecvDataSegmentLength', 
'262144' = '262144'

iscsiadm: updated 'node.conn[0].iscsi.MaxXmitDataSegmentLength', '0' = '0'
iscsiadm: updated 'node.conn[0].iscsi.HeaderDigest', 'None' = 'None'
iscsiadm: updated 'node.session.nr_sessions', '1' = '1'
iscsiadm: updated 'node.session.iscsi.FastAbort', 'Yes' = 'Yes'
iscsiadm: Looking for config file /etc/iscsi/send_targets/192.168.20.17,3260

iscsiadm: Looking for config file 
/etc/iscsi/send_targets/192.168.20.17,3260 config st_config.

iscsiadm: updated 'discovery.startup', 'manual' = 'manual'
iscsiadm: updated 'discovery.type', 'sendtargets' = 'sendtargets'
iscsiadm: updated 'discovery.sendtargets.address', '' = '192.168.20.17'
iscsiadm: updated 'discovery.sendtargets.port', '0' = '3260'
iscsiadm: updated 'discovery.sendtargets.auth.authmethod', 'None' = 'None'
iscsiadm: updated 'discovery.sendtargets.timeo.login_timeout', '15' = '15'
iscsiadm: updated 'discovery.sendtargets.use_discoveryd', 'No' = 'No'
iscsiadm: updated 'discovery.sendtargets.discoveryd_poll_inval', '30' = 
'30'

iscsiadm: updated 'discovery.sendtargets.reopen_max', '5' = '5'
iscsiadm: updated 'discovery.sendtargets.timeo.auth_timeout', '45' = '45'
iscsiadm: updated 'discovery.sendtargets.timeo.active_timeout', '30' = '30'
iscsiadm: updated 
'discovery.sendtargets.iscsi.MaxRecvDataSegmentLength', '32768' = '32768'

iscsiadm: disc rec already exists
iscsiadm: Looking for config file /etc/iscsi/send_targets/192.168.20.17,3260

iscsiadm: starting sendtargets discovery, address 192.168.20.17:3260,
iscsiadm: in read_transports
iscsiadm: Adding new transport iser
iscsiadm: Matched transport iser

iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/iser'/'handle'

iscsiadm: sysfs_attr_get_value: new uncached attribute 
'/sys/class/iscsi_transport/iser/handle'


iscsiadm: sysfs_attr_get_value: add to cache 
'/sys/class/iscsi_transport/iser/handle'


iscsiadm: sysfs_attr_get_value: cache 
'/sys/class/iscsi_transport/iser/handle' with attribute value 
'18446744072103880800'


iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/iser'/'caps'

iscsiadm: sysfs_attr_get_value: new uncached attribute 
'/sys/class/iscsi_transport/iser/caps'


iscsiadm: sysfs_attr_get_value: add to cache 
'/sys/class/iscsi_transport/iser/caps'


iscsiadm: sysfs_attr_get_value: cache 
'/sys/class/iscsi_transport/iser/caps' with attribute value '0x89'


iscsiadm: Adding new transport tcp
iscsiadm: Matched transport tcp

iscsiadm: sysfs_attr_get_value: open '/class/iscsi_transport/tcp'/'handle'

iscsiadm: sysfs_attr_get_value: new uncached attribute 
'/sys/class/iscsi_transport/tcp/handle'


iscsiadm: sysfs_attr_get_value: add to cache 
'/sys/class/iscsi_transport/tcp/handle'


iscsiadm: sysfs_attr_get_value: cache 
'/sys/class/iscsi_transport/tcp/handle' with attribute value 
'18446744072099416544'


iscsiadm: sysfs_attr_get_value: open 

Re: [PATCH 2/2] iscsi tools: Enhance the discovery code for iser

2014-01-31 Thread Mike Christie

On 1/26/14 8:03 AM, Or Gerlitz wrote:

For proper discovery support, the iser transport needs the
ISCSI_PARAM_DISCOVERY_SESS hint before the login PDU is sent.

For that end, issue the call to iscsi_session_set_params before
starting the login code in case the transport is iser.

Signed-off-by: Or Gerlitz ogerl...@mellanox.com
---
  usr/discovery.c |   13 -
  1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/usr/discovery.c b/usr/discovery.c
index afce6c0..4f02aac 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1116,7 +1116,7 @@ static int iscsi_create_leading_conn(struct iscsi_session 
*session)
}

/* create interconnect endpoint */
-   log_debug(2, %s discovery ep connect\n, __FUNCTION__);
+   log_debug(2, %s discovery ep connect transport %s caps %x\n, __FUNCTION__, 
t-name, t-caps);


Formatting. You kept it one line here but you tried to break it up 
below. You should try to follow the existing code.



rc = t-template-ep_connect(conn, 1);
if (rc  0) {
rc = ISCSI_ERR_TRANS;
@@ -1406,6 +1406,17 @@ redirect_reconnect:
if ((session-t-caps  CAP_LOGIN_OFFLOAD))
goto start_conn;

+   if(!strcmp(session-t-name, iser)) {
+   log_debug(2, %s discovery set params\n, __FUNCTION__);
+   rc = iscsi_session_set_params(conn);
+   if (rc) {
+   log_error(Could not set iscsi params for conn %d:%d (err 

+ %d)\n, session-id, conn-id, rc);
+   rc = ISCSI_ERR_INTERNAL;
+   goto login_failed;
+   }
+   }
+


The check for specifically iser here is a little odd. The discovery type 
is a generic iscsi attr so we should not have to special case it.


Do you just need that one setting at this time or do you need any other 
settings?


There is a issue where during the initial login if you run iscsiadm -m 
session then you will get some odd error messages for sessions that are 
not yet logged in because the target name and some ips are not setup 
yet. If we just pass them early, along with the discovery type attr, 
then we can do this in a generic way and also fix that issue. I attached 
a completely untested patch.


If you need other settings early let me know.

Also, I was not sure why in the other patch conn_only was set to 1 for 
discovery session. It seems like a session level attr. I changed it to 0 
in my patch.


--
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/groups/opt_out.
diff --git a/usr/discovery.c b/usr/discovery.c
index afce6c0..901b731 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -1406,6 +1406,15 @@ redirect_reconnect:
if ((session-t-caps  CAP_LOGIN_OFFLOAD))
goto start_conn;
 
+   log_debug(2, %s discovery set params\n, __FUNCTION__);
+   rc = iscsi_session_set_params(conn);
+   if (rc) {
+   log_error(Could not set iscsi params for conn %d:%d (err 
+ %d)\n, session-id, conn-id, rc);
+   rc = ISCSI_ERR_INTERNAL;
+   goto login_failed;
+   }
+
status_class = 0;
status_detail = 0;
rc = ISCSI_ERR_LOGIN;
@@ -1510,7 +1519,7 @@ redirect_reconnect:
 
 start_conn:
log_debug(2, %s discovery set params\n, __FUNCTION__);
-   rc = iscsi_session_set_params(conn);
+   rc = iscsi_session_set_neg_params(conn);
if (rc) {
log_error(Could not set iscsi params for conn %d:%d (err 
  %d)\n, session-id, conn-id, rc);
diff --git a/usr/initiator.c b/usr/initiator.c
index 79d1779..05a5b19 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -1048,12 +1048,7 @@ setup_full_feature_phase(iscsi_conn_t *conn)
 
actor_delete(conn-login_timer);
 
-   if (iscsi_session_set_params(conn)) {
-   iscsi_login_eh(conn, c-qtask, ISCSI_ERR_LOGIN);
-   return;
-   }
-
-   if (iscsi_host_set_params(session)) {
+   if (iscsi_session_set_neg_params(conn)) {
iscsi_login_eh(conn, c-qtask, ISCSI_ERR_LOGIN);
return;
}
@@ -1507,6 +1502,11 @@ static void setup_offload_login_phase(iscsi_conn_t *conn)
return;
}
 
+   if (iscsi_session_set_neg_params(conn)) {
+   iscsi_login_eh(conn, c-qtask, ISCSI_ERR_LOGIN);
+   return;
+   }
+
if (iscsi_host_set_params(session)) {
iscsi_login_eh(conn, c-qtask, ISCSI_ERR_LOGIN);
return;
@@ -1618,6 +1618,16 @@ static void session_conn_poll(void