Re: [PATCH] Add iSCSI IBFT support (v0.4.2)

2007-12-21 Thread Greg KH
On Wed, Dec 05, 2007 at 03:47:08PM -0400, Konrad Rzeszutek wrote:
> On Tue, Dec 04, 2007 at 09:12:11PM -0600, Doug Maxey wrote:
> > Overall, looks nice.  Good work.
> 
> Thank you.
> 
> > 
> > comments inline below...
> > 
> > On Tue, 04 Dec 2007 20:44:19 -0400, [EMAIL PROTECTED] wrote:
> > > On Wed, Nov 28, 2007 at 07:34:22PM -0400, Konrad Rzeszutek wrote:
> > > >
> > > > This patch adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX]
> > > > directories along with text properties which export the the iSCSI Boot
> > > > Firmware Table (iBFT) structure.
> > > >
> > > > What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI
> > > > tools to extract from the machine NICs the iSCSI connection information
> > > > so that they can automagically mount the iSCSI share/target. Currently
> > > > the iSCSI information is hard-coded in the initrd.
> > > >
> > > > For full details of the IBFT structure please take a look at:
> > > > ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
> > >
> > > Here is an updated version which provides an attribute symlink (in the
> > > ethernetX directory) called 'device' to the NIC device, instead of
> > > exporting a 'pci_bdf' file which had the "bus:slot:func" values.
> > >
> > > Review would be much appreciated.
> 
> This next version (0.4.2) includes: much better error unrolling
> when kobject registration fails, fixes from Doug's review, and uses the
> 'kset_create_and_add' API that Greg KH posted. It has been tested on
> todays 2.6.24-rc4-gkh tree.

Looks much nicer, good job.

However I changed the kobject api again, so some minor changes will need
to happen (kobject_init() and kobject_add() parameters have changed),
and you don't need to call kobject_del() right before kobject_put().
Hm, that last one was always true, so that wasn't needed before...

Do you want me to add this to my driver/ tree and fix up the kobject
issues there so it all builds properly, and it gets sent to Linus for
2.6.25?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Add iSCSI IBFT support (v0.4.2)

2007-12-05 Thread Konrad Rzeszutek
On Tue, Dec 04, 2007 at 09:12:11PM -0600, Doug Maxey wrote:
> Overall, looks nice.  Good work.

Thank you.

> 
> comments inline below...
> 
> On Tue, 04 Dec 2007 20:44:19 -0400, [EMAIL PROTECTED] wrote:
> > On Wed, Nov 28, 2007 at 07:34:22PM -0400, Konrad Rzeszutek wrote:
> > >
> > > This patch adds /sysfs/firmware/ibft/[initiator|targetX|ethernetX]
> > > directories along with text properties which export the the iSCSI Boot
> > > Firmware Table (iBFT) structure.
> > >
> > > What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI
> > > tools to extract from the machine NICs the iSCSI connection information
> > > so that they can automagically mount the iSCSI share/target. Currently
> > > the iSCSI information is hard-coded in the initrd.
> > >
> > > For full details of the IBFT structure please take a look at:
> > > ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf
> >
> > Here is an updated version which provides an attribute symlink (in the
> > ethernetX directory) called 'device' to the NIC device, instead of
> > exporting a 'pci_bdf' file which had the "bus:slot:func" values.
> >
> > Review would be much appreciated.

This next version (0.4.2) includes: much better error unrolling
when kobject registration fails, fixes from Doug's review, and uses the
'kset_create_and_add' API that Greg KH posted. It has been tested on
todays 2.6.24-rc4-gkh tree.

Signed-off-by: Konrad Rzeszutek <[EMAIL PROTECTED]>

diff --git a/Documentation/ABI/testing/sysfs-ibft 
b/Documentation/ABI/testing/sysfs-ibft
new file mode 100644
index 000..4898740
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-ibft
@@ -0,0 +1,31 @@
+What:  /sys/firmware/ibft/initiator
+Date:  November 2007
+Contact:   Konrad Rzeszutek <[EMAIL PROTECTED]>
+Description:   The /sys/firmware/ibft/initiator directory will contain
+   files that expose the iSCSI Boot Firmware Table initiator data.
+   Usually this contains the Initiator name.
+
+What:  /sys/firmware/ibft/targetX
+Date:  November 2007
+Contact:   Konrad Rzeszutek <[EMAIL PROTECTED]>
+Description:   The /sys/firmware/ibft/targetX directory will contain
+   files that expose the iSCSI Boot Firmware Table target data.
+   Usually this contains the target's IP address, boot LUN,
+   target name, and what NIC it is associated with. It can also
+   contain the CHAP name (and password), the reverse CHAP
+   name (and password)
+
+What:  /sys/firmware/ibft/ethernetX
+Date:  November 2007
+Contact:   Konrad Rzeszutek <[EMAIL PROTECTED]>
+Description:   The /sys/firmware/ibft/ethernetX directory will contain
+   files that expose the iSCSI Boot Firmware Table NIC data.
+   This can this can the IP address, MAC, and gateway of the NIC.
+
+What:  /sys/firmware/ibft/extensionX
+Date:  November 2007
+Contact:   Konrad Rzeszutek <[EMAIL PROTECTED]>
+Description:   The /sys/firmware/ibft/extensionX directory will contain
+   files that expose the iSCSI Boot Firmware Table extension data.
+   The extended data structure is not supported so there would be
+   no files in this directory.
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index e1e18c3..7c36a28 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -148,6 +149,20 @@ static inline void copy_edd(void)
 }
 #endif
 
+#if defined(CONFIG_ISCSI_IBFT_FIND)
+static void __init reserve_ibft_region(void)
+{
+   unsigned int ibft_len;
+
+   ibft_len = find_ibft();
+   if (ibft_len)
+   reserve_bootmem((unsigned int)ibft_phys,
+   PAGE_ALIGN(ibft_len));
+}
+#else
+static void __init reserve_ibft_region(void) { }
+#endif
+
 int __initdata user_defined_memmap = 0;
 
 /*
@@ -496,6 +511,7 @@ void __init setup_bootmem_allocator(void)
}
 #endif
reserve_crashkernel();
+   reserve_ibft_region();
 }
 
 /*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 30d94d1..d5b73c6 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -198,6 +199,20 @@ static inline void copy_edd(void)
 }
 #endif
 
+#if defined(CONFIG_ISCSI_IBFT_FIND)
+static void __init reserve_ibft_region(void)
+{
+   unsigned int ibft_len;
+
+   ibft_len = find_ibft();
+   if (ibft_len)
+   reserve_bootmem_generic((unsigned long)ibft_phys,
+   PAGE_ALIGN(ibft_len));
+}
+#else
+static void __init reserve_ibft_region(void) { }
+#endif
+
 #ifdef CONFIG_KEXEC
 static void __init reserve_crashkernel(void)
 {
@@ -403,6 +418,7 @@ void __init setup_arch(char