Re: [PATCH 1/2] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-08-11 Thread Randy Dunlap
On Mon, 12 Apr 2010 22:20:29 -0400 Konrad Rzeszutek Wilk wrote:

 On Monday 12 April 2010 14:06:17 micha...@cs.wisc.edu wrote:
  From: Mike Christie micha...@cs.wisc.edu
 
  Not all iscsi drivers support ibft. For drivers like be2iscsi
  that do not but are bootable through a vendor firmware specific
  format/process this patch moves the sysfs interface from the ibft code
  to a lib module. This then allows userspace tools to search for iscsi boot
  info in a common place and in a common format.
 
  ibft iscsi boot info is exported in the same place as it was
  before: /sys/firmware/ibft.
 
  vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is
  the scsi host number of the HBA. Underneath these parent dirs, the
  target, ethernet, and initiator dirs are the same as they were before.
 
  This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
  http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=
 refs/heads/ibft-1.03
 
 
  Signed-off-by: Mike Christie micha...@cs.wisc.edu
  ---
 Looks good to my eyes.
 
 Let me run it tomorrow through my regression bucket before I stick on the git 
 tree.

Can we get this patch into linux-next, please?

or if it's there, there are still errors like this that need to be checked.

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

-- 
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] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-08-11 Thread Randy Dunlap
On Wed, 11 Aug 2010 08:54:35 -0700 Randy Dunlap wrote:

 On Mon, 12 Apr 2010 22:20:29 -0400 Konrad Rzeszutek Wilk wrote:
 
  On Monday 12 April 2010 14:06:17 micha...@cs.wisc.edu wrote:
   From: Mike Christie micha...@cs.wisc.edu
  
   Not all iscsi drivers support ibft. For drivers like be2iscsi
   that do not but are bootable through a vendor firmware specific
   format/process this patch moves the sysfs interface from the ibft code
   to a lib module. This then allows userspace tools to search for iscsi boot
   info in a common place and in a common format.
  
   ibft iscsi boot info is exported in the same place as it was
   before: /sys/firmware/ibft.
  
   vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is
   the scsi host number of the HBA. Underneath these parent dirs, the
   target, ethernet, and initiator dirs are the same as they were before.
  
   This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
   http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=
  refs/heads/ibft-1.03
  
  
   Signed-off-by: Mike Christie micha...@cs.wisc.edu
   ---
  Looks good to my eyes.
  
  Let me run it tomorrow through my regression bucket before I stick on the 
  git 
  tree.
 
 Can we get this patch into linux-next, please?
 
 or if it's there, there are still errors like this that need to be checked.

Sorry, I replied to the (a) wrong email (thread).


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

-- 
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] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-04-14 Thread Christopher Barry
On Tue, 2010-04-13 at 14:57 -0500, Mike Christie wrote:
 On 04/12/2010 01:38 PM, Christopher Barry wrote:
  On Mon, 2010-04-12 at 13:06 -0500, micha...@cs.wisc.edu wrote:
  From: Mike Christiemicha...@cs.wisc.edu
 
  Not all iscsi drivers support ibft. For drivers like be2iscsi
  that do not but are bootable through a vendor firmware specific
  format/process this patch moves the sysfs interface from the ibft code
  to a lib module. This then allows userspace tools to search for iscsi boot
  info in a common place and in a common format.
 
  ibft iscsi boot info is exported in the same place as it was
  before: /sys/firmware/ibft.
 
  vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is 
  the
  scsi host number of the HBA. Underneath these parent dirs, the
  target, ethernet, and initiator dirs are the same as they were before.
  ...
  ===8 snip
  +#endif
  --
  1.6.6.1
 
 
  Mike,
  To be clear, this patch will put ibft data into /var/firmware/ibft only
 
 Not, /var. You meant /sys right (I am not moving it to var. It is 
 staying in sys).

Yes - I meant /sys, sorry for typo.

 
  for those devices that actually have it, but not create a tree for say
  NICs that do not currently support it? Wondering if this is a universal
 
 It does not change ibft behavior in any way. If a device supports ibft 
 and it is setup correctly when you load iscsi_ibft it gets exported in 
 the exact same place, with the exact files and the files have the same 
 format.
 
 The patches:
 1. separate the interface from the ibft parsing, so we could add a 
 different interface on like bsg if you wanted.
 2. allow drivers that do not support ibft, but support iscsi boot using 
 some vendor specific process, to be able to export their iscsi boot info 
 in the same format. These drivers just use a different root dir. Instead 
 of /sys/firmware/ibft, they use /sys/firmware/iscsi_bootX where X is the 
 host number of the iscsi HBA that was booted from.
 
 
  gizmo that will always populate the tree that I can rely on from
  userspace during boot.
 
 With these patches, and patches that are being worked on by vendors like 
 ServerEngines that do not support ibft and use some vendor specific 
 process, if you just load the iscsi driver, like be2iscsi or qla4xxx, 
 then they will load the iscsi_boot_sysfs module in the other patch sent 
 in this patchset, and /sys/firmware/iscsi_bootX will all get populated 
 with the boot info automagically for you.
 
 The iscsi tools (iscsistart and iscsiadm) will then parse and use this 
 data like it was ibft data and boot from disks or create records or 
 whatever. I am attaching the iscsi tools patches here. I am still 
 working with the be2iscsi guys to test it out.
 
 So with the patches
 
 iscsistart -b
 
 will look for ibft data. If not found then it would look for vendor 
 specific boot info. If found it would create a session using that 
 drivers's offload engine.
 

Thanks much for clarification, and all of your hard work.


 
  Thanks,
  -C
 
 


-- 
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] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-04-13 Thread Konrad Rzeszutek Wilk
On Monday 12 April 2010 14:06:17 micha...@cs.wisc.edu wrote:
 From: Mike Christie micha...@cs.wisc.edu

 Not all iscsi drivers support ibft. For drivers like be2iscsi
 that do not but are bootable through a vendor firmware specific
 format/process this patch moves the sysfs interface from the ibft code
 to a lib module. This then allows userspace tools to search for iscsi boot
 info in a common place and in a common format.

 ibft iscsi boot info is exported in the same place as it was
 before: /sys/firmware/ibft.

 vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is
 the scsi host number of the HBA. Underneath these parent dirs, the
 target, ethernet, and initiator dirs are the same as they were before.

 This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
 http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=
refs/heads/ibft-1.03


 Signed-off-by: Mike Christie micha...@cs.wisc.edu
 ---
Looks good to my eyes.

Let me run it tomorrow through my regression bucket before I stick on the git 
tree.

-- 
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] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-04-13 Thread Mike Christie

On 04/12/2010 01:38 PM, Christopher Barry wrote:

On Mon, 2010-04-12 at 13:06 -0500, micha...@cs.wisc.edu wrote:

From: Mike Christiemicha...@cs.wisc.edu

Not all iscsi drivers support ibft. For drivers like be2iscsi
that do not but are bootable through a vendor firmware specific
format/process this patch moves the sysfs interface from the ibft code
to a lib module. This then allows userspace tools to search for iscsi boot
info in a common place and in a common format.

ibft iscsi boot info is exported in the same place as it was
before: /sys/firmware/ibft.

vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is the
scsi host number of the HBA. Underneath these parent dirs, the
target, ethernet, and initiator dirs are the same as they were before.
...

===8 snip

+#endif
--
1.6.6.1



Mike,
To be clear, this patch will put ibft data into /var/firmware/ibft only


Not, /var. You meant /sys right (I am not moving it to var. It is 
staying in sys).



for those devices that actually have it, but not create a tree for say
NICs that do not currently support it? Wondering if this is a universal


It does not change ibft behavior in any way. If a device supports ibft 
and it is setup correctly when you load iscsi_ibft it gets exported in 
the exact same place, with the exact files and the files have the same 
format.


The patches:
1. separate the interface from the ibft parsing, so we could add a 
different interface on like bsg if you wanted.
2. allow drivers that do not support ibft, but support iscsi boot using 
some vendor specific process, to be able to export their iscsi boot info 
in the same format. These drivers just use a different root dir. Instead 
of /sys/firmware/ibft, they use /sys/firmware/iscsi_bootX where X is the 
host number of the iscsi HBA that was booted from.




gizmo that will always populate the tree that I can rely on from
userspace during boot.


With these patches, and patches that are being worked on by vendors like 
ServerEngines that do not support ibft and use some vendor specific 
process, if you just load the iscsi driver, like be2iscsi or qla4xxx, 
then they will load the iscsi_boot_sysfs module in the other patch sent 
in this patchset, and /sys/firmware/iscsi_bootX will all get populated 
with the boot info automagically for you.


The iscsi tools (iscsistart and iscsiadm) will then parse and use this 
data like it was ibft data and boot from disks or create records or 
whatever. I am attaching the iscsi tools patches here. I am still 
working with the be2iscsi guys to test it out.


So with the patches

iscsistart -b

will look for ibft data. If not found then it would look for vendor 
specific boot info. If found it would create a session using that 
drivers's offload engine.




Thanks,
-C



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

diff --git a/include/fw_context.h b/include/fw_context.h
index abdff42..770b41a 100644
--- a/include/fw_context.h
+++ b/include/fw_context.h
@@ -54,6 +54,8 @@ struct boot_context {
char mask[18];
char lun[17];
char vlan[15];
+
+   char scsi_host_name[64];
 };
 
 extern int fw_get_entry(struct boot_context *context);
diff --git a/usr/iface.c b/usr/iface.c
index 27b59d0..9c74117 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -778,31 +778,62 @@ void iface_link_ifaces(struct list_head *ifaces)
iface_for_each_iface(ifaces, 1, nr_found, iface_link);
 }
 
-void iface_setup_from_boot_context(struct iface_rec *iface,
+/**
+ * iface_setup_from_boot_context - setup iface from boot context info
+ * @iface: iface t setup
+ * @context: boot context info
+ *
+ * Returns 1 if setup for offload.
+ */
+int iface_setup_from_boot_context(struct iface_rec *iface,
   struct boot_context *context)
 {
if (strlen(context-initiatorname))
strlcpy(iface-iname, context-initiatorname,
sizeof(iface-iname));
 
-   if (strlen(context-iface)) {
-   if (!net_get_transport_name_from_netdev(context-iface,
-   iface-transport_name)) {
-   /* set up for access through offload card */
-   memset(iface-name, 0, sizeof(iface-name));
-   snprintf(iface-name, sizeof(iface-name),
-%s.%s, iface-transport_name,
-context-mac);
-
-   strlcpy(iface-netdev, context-iface,
-   sizeof(iface-netdev));
-   strlcpy(iface-hwaddress, context-mac,
-   sizeof(iface-hwaddress));
-

[PATCH 1/2] RFC: iscsi ibft: separate ibft parsing from sysfs interface

2010-04-12 Thread michaelc
From: Mike Christie micha...@cs.wisc.edu

Not all iscsi drivers support ibft. For drivers like be2iscsi
that do not but are bootable through a vendor firmware specific
format/process this patch moves the sysfs interface from the ibft code
to a lib module. This then allows userspace tools to search for iscsi boot
info in a common place and in a common format.

ibft iscsi boot info is exported in the same place as it was
before: /sys/firmware/ibft.

vendor/fw boot info gets export in /sys/firmware/iscsi_bootX, where X is the
scsi host number of the HBA. Underneath these parent dirs, the
target, ethernet, and initiator dirs are the same as they were before.

This patch was made over the ibft-2.6 tree's ibft-1.03 branch:
http://git.kernel.org/?p=linux/kernel/git/konrad/ibft-2.6.git;a=shortlog;h=refs/heads/ibft-1.03


Signed-off-by: Mike Christie micha...@cs.wisc.edu
---
 drivers/firmware/Kconfig|8 +
 drivers/firmware/Makefile   |1 +
 drivers/firmware/iscsi_boot_sysfs.c |  481 +++
 include/linux/iscsi_boot_sysfs.h|  123 +
 4 files changed, 613 insertions(+), 0 deletions(-)
 create mode 100644 drivers/firmware/iscsi_boot_sysfs.c
 create mode 100644 include/linux/iscsi_boot_sysfs.h

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 1b03ba1..571d218 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -122,6 +122,14 @@ config ISCSI_IBFT_FIND
  is necessary for iSCSI Boot Firmware Table Attributes module to work
  properly.
 
+config ISCSI_BOOT_SYSFS
+   tristate iSCSI Boot Sysfs Interface
+   default n
+   help
+ This option enables support for exposing iSCSI boot information
+ via sysfs to userspace. If you wish to export this information,
+ say Y. Otherwise, say N.
+
 config ISCSI_IBFT
tristate iSCSI Boot Firmware Table Attributes module
depends on ISCSI_IBFT_FIND
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 1c3c173..5fe7e16 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -10,4 +10,5 @@ obj-$(CONFIG_DCDBAS)  += dcdbas.o
 obj-$(CONFIG_DMIID)+= dmi-id.o
 obj-$(CONFIG_ISCSI_IBFT_FIND)  += iscsi_ibft_find.o
 obj-$(CONFIG_ISCSI_IBFT)   += iscsi_ibft.o
+obj-$(CONFIG_ISCSI_BOOT_SYSFS) += iscsi_boot_sysfs.o
 obj-$(CONFIG_FIRMWARE_MEMMAP)  += memmap.o
diff --git a/drivers/firmware/iscsi_boot_sysfs.c 
b/drivers/firmware/iscsi_boot_sysfs.c
new file mode 100644
index 000..df6bff7
--- /dev/null
+++ b/drivers/firmware/iscsi_boot_sysfs.c
@@ -0,0 +1,481 @@
+/*
+ * Export the iSCSI boot info to userland via sysfs.
+ *
+ * Copyright (C) 2010 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2010 Mike Christie
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License v2.0 as published by
+ * the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/module.h
+#include linux/string.h
+#include linux/slab.h
+#include linux/sysfs.h
+#include linux/capability.h
+#include linux/iscsi_boot_sysfs.h
+
+
+MODULE_AUTHOR(Mike Christie micha...@cs.wisc.edu);
+MODULE_DESCRIPTION(sysfs interface and helpers to export iSCSI boot 
information);
+MODULE_LICENSE(GPL);
+/*
+ * The kobject and attribute structures.
+ */
+struct iscsi_boot_attr {
+   struct attribute attr;
+   int type;
+   ssize_t (*show) (void *data, int type, char *buf);
+};
+
+/*
+ * The routine called for all sysfs attributes.
+ */
+static ssize_t iscsi_boot_show_attribute(struct kobject *kobj,
+struct attribute *attr, char *buf)
+{
+   struct iscsi_boot_kobj *boot_kobj =
+   container_of(kobj, struct iscsi_boot_kobj, kobj);
+   struct iscsi_boot_attr *boot_attr =
+   container_of(attr, struct iscsi_boot_attr, attr);
+   ssize_t ret = -EIO;
+   char *str = buf;
+
+   if (!capable(CAP_SYS_ADMIN))
+   return -EACCES;
+
+   if (boot_kobj-show)
+   ret = boot_kobj-show(boot_kobj-data, boot_attr-type, str);
+   return ret;
+}
+
+static const struct sysfs_ops iscsi_boot_attr_ops = {
+   .show = iscsi_boot_show_attribute,
+};
+
+static void iscsi_boot_kobj_release(struct kobject *kobj)
+{
+   struct iscsi_boot_kobj *boot_kobj =
+   container_of(kobj, struct iscsi_boot_kobj, kobj);
+
+   kfree(boot_kobj-data);
+   kfree(boot_kobj);
+}
+
+static struct kobj_type iscsi_boot_ktype = {
+   .release = iscsi_boot_kobj_release,
+   .sysfs_ops = iscsi_boot_attr_ops,
+};
+
+#define iscsi_boot_rd_attr(fnname, sysfs_name, attr_type)