Re: [PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-08-23 Thread Eddie Wai
Hello Mike,

I just notice that this patch hasn't been included yet for open-iscsi
while the corresponding kernel component already has.  So do we still
have concerns over the enclosed patchset?

I had to spin this to version 5 as a bug as found in the enclosed patch
as-is.  

Thanks,
Eddie

On Tue, 2013-05-28 at 12:13 -0500, Mike Christie wrote:
 On 05/28/2013 12:07 PM, Eddie Wai wrote:
  
  On Tue, 2013-05-28 at 04:05 -0500, Mike Christie wrote:
  On 04/12/2013 12:41 PM, Eddie Wai wrote:
  This patch does the work to extract the corresponding
  boot_root-ethernetN net params as specified from the kernel
  session boot_nic sysfs entry based on the transport param
  use_boot_info.
 
  This is only populated for iscsi_tcp and bnx2i.
 
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   usr/iscsi_sysfs.c |   40 
   usr/transport.c   |2 ++
   usr/transport.h   |1 +
   3 files changed, 43 insertions(+), 0 deletions(-)
 
  diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
  index 4015b35..91c3989 100644
  --- a/usr/iscsi_sysfs.c
  +++ b/usr/iscsi_sysfs.c
  @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
  iface_rec *iface, int *rc)
return host_no;
   }
   
  +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
  +{
  + char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
  + char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
  +
  + /* Extract boot info */
  + strlcpy(boot_name, boot_target, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
  +   boot_content, BOOT_NAME_MAXLEN))
  + return -1;
  + strlcpy(boot_name, boot_nic, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
  +   BOOT_NAME_MAXLEN))
  + return -1;
  + strlcpy(boot_name, boot_root, sizeof(boot_name));
  + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
  +   BOOT_NAME_MAXLEN))
  + return -1;
  +
  + /* If all boot_root/boot_target/boot_nic exist, then extract the
  +info from the boot nic */
  + if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
  +   BOOT_NAME_MAXLEN))
  + log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
  + else
  + iface-vlan_id = atoi(boot_content);
  +
  + if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
  +   iface-subnet_mask, NI_MAXHOST))
  + log_debug(5, could not read %s/%s/subnet, boot_root,
  +   boot_nic);
  +
  + log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
  +   boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
  + return 0;
  +}
  +
   /*
* Read in iface settings based on host and session values. If
* session is not passed in, then the ifacename will not be set. And
  @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
  *iface, int host_no,
}
}
   
  + if (t-template-use_boot_info)
  + iscsi_sysfs_read_boot(iface, session);
  +
 
  I forgot what we were saying for this. For the running boot session is
  it possible to change the network settings while the session is running?
  If so then this would print the old info (info used for boot that might
  not be currently used) right? Was this ok?
  I'm not sure if this applies to iscsi_tcp or not, but for bnx2i, the
  boot session network settings cannot be altered once its booted.  So the
  print out will follow the boot params; which is also the currently used
  params.
 
 For tcp we can. Let's just set use_boot_info for bnx2i for now. Let me
 think about tcp some more or let someone complain :)
 
 I think it then looks ok. Or, at least I do not remember if I had other
 concerns about it :) So send kernel stuff upstream. I can actually hand
 edit the userspace patches to remove the tcp use_boot_info bit if these
 patches are ok with you.
 
 Thanks.
 
 



-- 
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 v4 2/3] ISCSID: Added the extraction of the session boot info

2013-05-28 Thread Mike Christie
On 04/12/2013 12:41 PM, Eddie Wai wrote:
 This patch does the work to extract the corresponding
 boot_root-ethernetN net params as specified from the kernel
 session boot_nic sysfs entry based on the transport param
 use_boot_info.
 
 This is only populated for iscsi_tcp and bnx2i.
 
 Signed-off-by: Eddie Wai eddie@broadcom.com
 ---
  usr/iscsi_sysfs.c |   40 
  usr/transport.c   |2 ++
  usr/transport.h   |1 +
  3 files changed, 43 insertions(+), 0 deletions(-)
 
 diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
 index 4015b35..91c3989 100644
 --- a/usr/iscsi_sysfs.c
 +++ b/usr/iscsi_sysfs.c
 @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
 iface_rec *iface, int *rc)
   return host_no;
  }
  
 +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
 +{
 + char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
 + char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
 +
 + /* Extract boot info */
 + strlcpy(boot_name, boot_target, sizeof(boot_name));
 + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
 +   boot_content, BOOT_NAME_MAXLEN))
 + return -1;
 + strlcpy(boot_name, boot_nic, sizeof(boot_name));
 + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
 +   BOOT_NAME_MAXLEN))
 + return -1;
 + strlcpy(boot_name, boot_root, sizeof(boot_name));
 + if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
 +   BOOT_NAME_MAXLEN))
 + return -1;
 +
 + /* If all boot_root/boot_target/boot_nic exist, then extract the
 +info from the boot nic */
 + if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
 +   BOOT_NAME_MAXLEN))
 + log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
 + else
 + iface-vlan_id = atoi(boot_content);
 +
 + if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
 +   iface-subnet_mask, NI_MAXHOST))
 + log_debug(5, could not read %s/%s/subnet, boot_root,
 +   boot_nic);
 +
 + log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
 +   boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
 + return 0;
 +}
 +
  /*
   * Read in iface settings based on host and session values. If
   * session is not passed in, then the ifacename will not be set. And
 @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
 *iface, int host_no,
   }
   }
  
 + if (t-template-use_boot_info)
 + iscsi_sysfs_read_boot(iface, session);
 +

I forgot what we were saying for this. For the running boot session is
it possible to change the network settings while the session is running?
If so then this would print the old info (info used for boot that might
not be currently used) right? Was this ok?

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-05-28 Thread Eddie Wai

On Tue, 2013-05-28 at 04:05 -0500, Mike Christie wrote:
 On 04/12/2013 12:41 PM, Eddie Wai wrote:
  This patch does the work to extract the corresponding
  boot_root-ethernetN net params as specified from the kernel
  session boot_nic sysfs entry based on the transport param
  use_boot_info.
  
  This is only populated for iscsi_tcp and bnx2i.
  
  Signed-off-by: Eddie Wai eddie@broadcom.com
  ---
   usr/iscsi_sysfs.c |   40 
   usr/transport.c   |2 ++
   usr/transport.h   |1 +
   3 files changed, 43 insertions(+), 0 deletions(-)
  
  diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
  index 4015b35..91c3989 100644
  --- a/usr/iscsi_sysfs.c
  +++ b/usr/iscsi_sysfs.c
  @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
  iface_rec *iface, int *rc)
  return host_no;
   }
   
  +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
  +{
  +   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
  +   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
  +
  +   /* Extract boot info */
  +   strlcpy(boot_name, boot_target, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
  + boot_content, BOOT_NAME_MAXLEN))
  +   return -1;
  +   strlcpy(boot_name, boot_nic, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
  + BOOT_NAME_MAXLEN))
  +   return -1;
  +   strlcpy(boot_name, boot_root, sizeof(boot_name));
  +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
  + BOOT_NAME_MAXLEN))
  +   return -1;
  +
  +   /* If all boot_root/boot_target/boot_nic exist, then extract the
  +  info from the boot nic */
  +   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
  + BOOT_NAME_MAXLEN))
  +   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
  +   else
  +   iface-vlan_id = atoi(boot_content);
  +
  +   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
  + iface-subnet_mask, NI_MAXHOST))
  +   log_debug(5, could not read %s/%s/subnet, boot_root,
  + boot_nic);
  +
  +   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
  + boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
  +   return 0;
  +}
  +
   /*
* Read in iface settings based on host and session values. If
* session is not passed in, then the ifacename will not be set. And
  @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
  *iface, int host_no,
  }
  }
   
  +   if (t-template-use_boot_info)
  +   iscsi_sysfs_read_boot(iface, session);
  +
 
 I forgot what we were saying for this. For the running boot session is
 it possible to change the network settings while the session is running?
 If so then this would print the old info (info used for boot that might
 not be currently used) right? Was this ok?
I'm not sure if this applies to iscsi_tcp or not, but for bnx2i, the
boot session network settings cannot be altered once its booted.  So the
print out will follow the boot params; which is also the currently used
params.

 
 


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-05-28 Thread Mike Christie
On 05/28/2013 12:07 PM, Eddie Wai wrote:
 
 On Tue, 2013-05-28 at 04:05 -0500, Mike Christie wrote:
 On 04/12/2013 12:41 PM, Eddie Wai wrote:
 This patch does the work to extract the corresponding
 boot_root-ethernetN net params as specified from the kernel
 session boot_nic sysfs entry based on the transport param
 use_boot_info.

 This is only populated for iscsi_tcp and bnx2i.

 Signed-off-by: Eddie Wai eddie@broadcom.com
 ---
  usr/iscsi_sysfs.c |   40 
  usr/transport.c   |2 ++
  usr/transport.h   |1 +
  3 files changed, 43 insertions(+), 0 deletions(-)

 diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
 index 4015b35..91c3989 100644
 --- a/usr/iscsi_sysfs.c
 +++ b/usr/iscsi_sysfs.c
 @@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
 iface_rec *iface, int *rc)
 return host_no;
  }
  
 +static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
 +{
 +   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
 +   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
 +
 +   /* Extract boot info */
 +   strlcpy(boot_name, boot_target, sizeof(boot_name));
 +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
 + boot_content, BOOT_NAME_MAXLEN))
 +   return -1;
 +   strlcpy(boot_name, boot_nic, sizeof(boot_name));
 +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
 + BOOT_NAME_MAXLEN))
 +   return -1;
 +   strlcpy(boot_name, boot_root, sizeof(boot_name));
 +   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
 + BOOT_NAME_MAXLEN))
 +   return -1;
 +
 +   /* If all boot_root/boot_target/boot_nic exist, then extract the
 +  info from the boot nic */
 +   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
 + BOOT_NAME_MAXLEN))
 +   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
 +   else
 +   iface-vlan_id = atoi(boot_content);
 +
 +   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
 + iface-subnet_mask, NI_MAXHOST))
 +   log_debug(5, could not read %s/%s/subnet, boot_root,
 + boot_nic);
 +
 +   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
 + boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
 +   return 0;
 +}
 +
  /*
   * Read in iface settings based on host and session values. If
   * session is not passed in, then the ifacename will not be set. And
 @@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec 
 *iface, int host_no,
 }
 }
  
 +   if (t-template-use_boot_info)
 +   iscsi_sysfs_read_boot(iface, session);
 +

 I forgot what we were saying for this. For the running boot session is
 it possible to change the network settings while the session is running?
 If so then this would print the old info (info used for boot that might
 not be currently used) right? Was this ok?
 I'm not sure if this applies to iscsi_tcp or not, but for bnx2i, the
 boot session network settings cannot be altered once its booted.  So the
 print out will follow the boot params; which is also the currently used
 params.

For tcp we can. Let's just set use_boot_info for bnx2i for now. Let me
think about tcp some more or let someone complain :)

I think it then looks ok. Or, at least I do not remember if I had other
concerns about it :) So send kernel stuff upstream. I can actually hand
edit the userspace patches to remove the tcp use_boot_info bit if these
patches are ok with you.

Thanks.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[PATCH v4 2/3] ISCSID: Added the extraction of the session boot info

2013-04-12 Thread Eddie Wai
This patch does the work to extract the corresponding
boot_root-ethernetN net params as specified from the kernel
session boot_nic sysfs entry based on the transport param
use_boot_info.

This is only populated for iscsi_tcp and bnx2i.

Signed-off-by: Eddie Wai eddie@broadcom.com
---
 usr/iscsi_sysfs.c |   40 
 usr/transport.c   |2 ++
 usr/transport.h   |1 +
 3 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index 4015b35..91c3989 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -439,6 +439,43 @@ uint32_t iscsi_sysfs_get_host_no_from_hwinfo(struct 
iface_rec *iface, int *rc)
return host_no;
 }
 
+static int iscsi_sysfs_read_boot(struct iface_rec *iface, char *session)
+{
+   char boot_root[BOOT_NAME_MAXLEN], boot_nic[BOOT_NAME_MAXLEN];
+   char boot_name[BOOT_NAME_MAXLEN], boot_content[BOOT_NAME_MAXLEN];
+
+   /* Extract boot info */
+   strlcpy(boot_name, boot_target, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name,
+ boot_content, BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_nic, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_nic,
+ BOOT_NAME_MAXLEN))
+   return -1;
+   strlcpy(boot_name, boot_root, sizeof(boot_name));
+   if (sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_name, boot_root,
+ BOOT_NAME_MAXLEN))
+   return -1;
+
+   /* If all boot_root/boot_target/boot_nic exist, then extract the
+  info from the boot nic */
+   if (sysfs_get_str(boot_nic, boot_root, vlan, boot_content,
+ BOOT_NAME_MAXLEN))
+   log_debug(5, could not read %s/%s/vlan, boot_root, boot_nic);
+   else
+   iface-vlan_id = atoi(boot_content);
+
+   if (sysfs_get_str(boot_nic, boot_root, subnet-mask,
+ iface-subnet_mask, NI_MAXHOST))
+   log_debug(5, could not read %s/%s/subnet, boot_root,
+ boot_nic);
+
+   log_debug(5, sysfs read boot returns %s/%s/ vlan = %d subnet = %s,
+ boot_root, boot_nic, iface-vlan_id, iface-subnet_mask);
+   return 0;
+}
+
 /*
  * Read in iface settings based on host and session values. If
  * session is not passed in, then the ifacename will not be set. And
@@ -567,6 +604,9 @@ static int iscsi_sysfs_read_iface(struct iface_rec *iface, 
int host_no,
}
}
 
+   if (t-template-use_boot_info)
+   iscsi_sysfs_read_boot(iface, session);
+
if (!iface_kern_id)
goto done;
 
diff --git a/usr/transport.c b/usr/transport.c
index e6e3dfc..c646ff4 100644
--- a/usr/transport.c
+++ b/usr/transport.c
@@ -41,6 +41,7 @@
 
 struct iscsi_transport_template iscsi_tcp = {
.name   = tcp,
+   .use_boot_info  = 1,
.ep_connect = iscsi_io_tcp_connect,
.ep_poll= iscsi_io_tcp_poll,
.ep_disconnect  = iscsi_io_tcp_disconnect,
@@ -76,6 +77,7 @@ struct iscsi_transport_template cxgb4i = {
 struct iscsi_transport_template bnx2i = {
.name   = bnx2i,
.set_host_ip= 1,
+   .use_boot_info  = 1,
.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
index 672561b..3f8b3fe 100644
--- a/usr/transport.h
+++ b/usr/transport.h
@@ -31,6 +31,7 @@ struct iscsi_transport_template {
 * the host's ip address.
 */
uint8_t set_host_ip;
+   uint8_t use_boot_info;
int (*ep_connect) (struct iscsi_conn *conn, int non_blocking);
int (*ep_poll) (struct iscsi_conn *conn, int timeout_ms);
void (*ep_disconnect) (struct iscsi_conn *conn);
-- 
1.7.7.4


-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.