Re: [PATCH 3/4] ISCSID: Added the extraction of the session boot_nic info
On Wed, 2012-10-24 at 01:27 -0500, Mike Christie wrote: On 10/22/2012 05:13 PM, Eddie Wai wrote: @@ -920,6 +921,28 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session) iscsi_sysfs_read_iface(info-iface, host_no, session, NULL); + ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_nic, + boot_nic, NAME_SIZE); + if (!ret) { + /* If boot_nic exist, then extract the info from the boot nic */ + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + vlan, id, NAME_SIZE); + if (ret) + log_debug(5, could not read %s/vlan: %d, + boot_nic, ret); + else + info-iface.vlan_id = atoi(id); + + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + subnet-mask, info-iface.subnet_mask, + NI_MAXHOST); + if (ret) + log_debug(5, could not read %s/subnet: %d, + boot_nic, ret); + } else { + log_debug(5, could not read boot_nic: %d, ret); + } + It seems like this should go in iscsi_sysfs_read_iface. Yeah, I think so also. Why only boot nic? Why don't we also export the boot target and initiator? The ibft-initiator only has the initiator-name that is of interest. But this info is already in the session sysfs, so I wouldn't think this would be too helpful. The ibft-targetN contains the following info: chap-type, ip-addr, lun, nic-assoc, port, target-name Many of which are also in the session sysfs as well. Is there something in particular that we might be interested in that I missed? Or are you just thinking its best to populate all the associated ibft info first and have a choice to pick and choose what we need for future augmentations? The main reason why we need the ethernetN is just because the few net params in the ibft doesn't get passed over to the session sysfs. One of which is the vlan_id which is something that we really need. Thanks, Eddie -- 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 3/4] ISCSID: Added the extraction of the session boot_nic info
On 10/24/2012 01:03 PM, Eddie Wai wrote: On Wed, 2012-10-24 at 01:27 -0500, Mike Christie wrote: On 10/22/2012 05:13 PM, Eddie Wai wrote: @@ -920,6 +921,28 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session) iscsi_sysfs_read_iface(info-iface, host_no, session, NULL); + ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_nic, + boot_nic, NAME_SIZE); + if (!ret) { + /* If boot_nic exist, then extract the info from the boot nic */ + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + vlan, id, NAME_SIZE); + if (ret) + log_debug(5, could not read %s/vlan: %d, + boot_nic, ret); + else + info-iface.vlan_id = atoi(id); + + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + subnet-mask, info-iface.subnet_mask, + NI_MAXHOST); + if (ret) + log_debug(5, could not read %s/subnet: %d, + boot_nic, ret); + } else { + log_debug(5, could not read boot_nic: %d, ret); + } + It seems like this should go in iscsi_sysfs_read_iface. Yeah, I think so also. Why only boot nic? Why don't we also export the boot target and initiator? The ibft-initiator only has the initiator-name that is of interest. But this info is already in the session sysfs, so I wouldn't think this would be too helpful. The ibft-targetN contains the following info: chap-type, ip-addr, lun, nic-assoc, port, target-name Many of which are also in the session sysfs as well. Is there something in particular that we might be interested in that I missed? Or are you just thinking its best to populate all the associated ibft info first and have a choice to pick and choose what we need for future augmentations? For the future, and to be complete. Also for debugging to make sure things got setup/associated correctly. -- You received this message because you are subscribed to the Google Groups open-iscsi group. To post to this group, send email to open-iscsi@googlegroups.com. To unsubscribe from this group, send email to open-iscsi+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/open-iscsi?hl=en.
[PATCH 3/4] ISCSID: Added the extraction of the session boot_nic info
This patch does the work to extract the corresponding ibft-ethernetN net params as specified from the kernel session boot_nic sysfs entry. Signed-off-by: Eddie Wai eddie@broadcom.com --- include/iscsi_if.h |3 +++ usr/iscsi_sysfs.c | 25 - 2 files changed, 27 insertions(+), 1 deletions(-) diff --git a/include/iscsi_if.h b/include/iscsi_if.h index dad9fd8..498117d 100644 --- a/include/iscsi_if.h +++ b/include/iscsi_if.h @@ -460,6 +460,9 @@ enum iscsi_param { ISCSI_PARAM_TGT_RESET_TMO, ISCSI_PARAM_TARGET_ALIAS, + + ISCSI_PARAM_BOOT_NIC, + /* must always be last */ ISCSI_PARAM_MAX, }; diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c index 4015b35..a4095b5 100644 --- a/usr/iscsi_sysfs.c +++ b/usr/iscsi_sysfs.c @@ -53,6 +53,7 @@ #define ISCSI_IFACE_SUBSYS iscsi_iface #define SCSI_HOST_SUBSYS scsi_host #define SCSI_SUBSYSscsi +#define ISCSI_IBFT_SUBSYS ibft #define ISCSI_SESSION_ID session%d #define ISCSI_CONN_ID connection%d:0 @@ -793,7 +794,7 @@ int iscsi_sysfs_get_sid_from_path(char *session) int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session) { - char id[NAME_SIZE]; + char id[NAME_SIZE], boot_nic[NAME_SIZE]; int ret, pers_failed = 0; uint32_t host_no; @@ -920,6 +921,28 @@ int iscsi_sysfs_get_sessioninfo_by_id(struct session_info *info, char *session) iscsi_sysfs_read_iface(info-iface, host_no, session, NULL); + ret = sysfs_get_str(session, ISCSI_SESSION_SUBSYS, boot_nic, + boot_nic, NAME_SIZE); + if (!ret) { + /* If boot_nic exist, then extract the info from the boot nic */ + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + vlan, id, NAME_SIZE); + if (ret) + log_debug(5, could not read %s/vlan: %d, + boot_nic, ret); + else + info-iface.vlan_id = atoi(id); + + ret = sysfs_get_str(boot_nic, ISCSI_IBFT_SUBSYS, + subnet-mask, info-iface.subnet_mask, + NI_MAXHOST); + if (ret) + log_debug(5, could not read %s/subnet: %d, + boot_nic, ret); + } else { + log_debug(5, could not read boot_nic: %d, ret); + } + log_debug(7, found targetname %s address %s pers address %s port %d pers port %d driver %s iface name %s ipaddress %s netdev %s hwaddress %s iname %s, -- 1.7.7.4 -- 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.