From: Matt Domsch <Matt_Domsch@dell.com>
To: linux-scsi@vger.kernel.org
Subject: Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure
Date: Tue, 8 Feb 2005 17:23:22 -0600 [thread overview]
Message-ID: <20050208232322.GC30086@lists.us.dell.com> (raw)
In-Reply-To: <20050208231923.GA30086@lists.us.dell.com>
On Tue, Feb 08, 2005 at 05:19:23PM -0600, Matt Domsch wrote:
> On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
> > Below is a patch to add some hotplug infrastructure to the Linux SCSI
> > subsystem.
>
> I've added and reworked the megaraid_mbox driver to make use of this
> new infrastructure. I'll send that patch next. The rest is unchanged
> from yesterday.
And these are the changes megaid_mbox to use the new infrastructure.
--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com & www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.
===================================================================
ChangeSet@1.2132.2.3, 2005-02-08 16:46:03-06:00, Matt_Domsch@dell.com
Release Date : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch <Matt_Domsch@dell.com>
Current Version : 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
1. Added two new megaraid_shost_attrs
/sys/class/scsi_host
|-- host0
| |-- logical_drive_created
| |-- logical_drive_destroyed
and helper functions for them. Written to from userspace by
a management application, these invoke SCSI hotplug
infrastructure for informing the kernel that a logical drive
has been created, or will be destroyed quite soon.
echo "2" > logical_drive_created
after creating logical drive #2 in the management app
echo "4" > logical_drive_destroyed
immediately before destroying logical drive #4 in the
management app. Eventually these functions should be called
directly from the management app.
2. Made class_device_megaraid_mbox_app_hndl and
dev_attr_megaraid_mbox_ld static.
Signed-off-by: Matt Domsch <Matt_Domsch@dell.com>
Documentation/scsi/ChangeLog.megaraid | 26 +++++++++
drivers/scsi/megaraid/megaraid_mbox.c | 97 ++++++++++++++++++++++++++++++----
drivers/scsi/megaraid/megaraid_mbox.h | 4 -
3 files changed, 116 insertions, 11 deletions
diff -Nru a/Documentation/scsi/ChangeLog.megaraid b/Documentation/scsi/ChangeLog.megaraid
--- a/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:27 -06:00
+++ b/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:27 -06:00
@@ -1,3 +1,29 @@
+Release Date : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch <Matt_Domsch@dell.com>
+Current Version : 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
+Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
+
+1. Added two new megaraid_shost_attrs
+ /sys/class/scsi_host
+ |-- host0
+ | |-- logical_drive_created
+ | |-- logical_drive_destroyed
+
+ and helper functions for them. Written to from userspace by
+ a management application, these invoke SCSI hotplug
+ infrastructure for informing the kernel that a logical drive
+ has been created, or will be destroyed quite soon.
+ echo "2" > logical_drive_created
+ after creating logical drive #2 in the management app
+ echo "4" > logical_drive_destroyed
+ immediately before destroying logical drive #4 in the
+ management app. Eventually these functions should be called
+ directly from the management app.
+
+2. Made class_device_megaraid_mbox_app_hndl and
+ dev_attr_megaraid_mbox_ld static.
+
+
+
Release Date : Thu Feb 03 12:27:22 EST 2005 - Seokmann Ju <sju@lsil.com>
Current Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
Older Version : 2.20.4.4 (scsi module), 2.20.2.4 (cmm module)
diff -Nru a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c 2005-02-08 17:16:27 -06:00
+++ b/drivers/scsi/megaraid/megaraid_mbox.c 2005-02-08 17:16:27 -06:00
@@ -69,6 +69,7 @@
* For history of changes, see Documentation/ChangeLog.megaraid
*/
+#include <scsi/scsi_hotplug.h>
#include "megaraid_mbox.h"
static int megaraid_init(void);
@@ -470,29 +471,107 @@
}
};
+/*
+ * sysfs class device support
+ * creates two files:
+ * /sys/class/scsi_host
+ * |-- host0
+ * | |-- logical_drive_created
+ * | |-- logical_drive_destroyed
+ *
+ * These make the midlayer invoke /sbin/hotplug, which then calls back into sysfs
+ * /sys/class/scsi_host
+ * |-- host0
+ * | |-- scan
+ *
+ * and
+ *
+ * /sys/devices/pci0000:0x/0000:0x:0x.0/host0
+ * |-- 0:0:0:0
+ * | |-- delete
+ *
+ * respectively. This allows userspace applications to work
+ * using their logical drive number, and lets the driver translate
+ * that into host, channel, id, and lun values which the other
+ * mechanisms require. This is similar to how hot plug CPU works.
+ */
+/**
+ * lda_to_hcil()
+ * @adapter
+ * @lda - logical drive address
+ * @host_no
+ * @channel
+ * @id
+ * @lun
+ *
+ * converts a logical drive address into a host, channel id, lun tuple.
+ */
-// definitions for the device attributes for exporting logical drive number
-// for a scsi address (Host, Channel, Id, Lun)
-
-CLASS_DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl,
+static inline int megaraid_lda_to_hcil(struct Scsi_Host *shost, u32 lda,
+ u32 *host_no, u32 *channel, u32 *id, u32 *lun)
+{
+ if (lda > MAX_LOGICAL_DRIVES_40LD)
+ return -EINVAL;
+ *host_no = shost->host_no;
+ *channel = shost->max_channel;
+ *id = (lda < shost->this_id) ? lda : lda + 1;
+ *lun = 0;
+ return 0;
+}
+
+static int megaraid_host_store(struct class_device *class_dev, const char *buf, size_t count,
+ enum scsi_topology_action action)
+{
+ struct Scsi_Host *shost = class_to_shost(class_dev);
+ int fields=0, rc=-EINVAL;
+ u32 lda=0, host_no=0, channel=0, id=0, lun=0;
+ fields = sscanf(buf, "%u", &lda);
+ if (fields != 1)
+ return rc;
+ if (lda > MAX_LOGICAL_DRIVES_40LD)
+ return rc;
+ rc = megaraid_lda_to_hcil(shost, lda, &host_no, &channel, &id, &lun);
+ if (rc)
+ return rc;
+
+ rc = scsi_topology_hctl_action(shost, channel, id, lun, action);
+
+ if (rc)
+ return rc;
+ return count;
+}
+
+static ssize_t megaraid_host_store_ld_created(struct class_device *class_dev, const char *buf, size_t count)
+{
+ return megaraid_host_store(class_dev, buf, count, SCSI_TOPOLOGY_ADDED);
+}
+static ssize_t megaraid_host_store_ld_destroyed(struct class_device *class_dev, const char *buf, size_t count)
+{
+ return megaraid_host_store(class_dev, buf, count, SCSI_TOPOLOGY_REMOVED);
+}
+
+#define MEGARAID_HOST_WOATTR(_name,_store) \
+CLASS_DEVICE_ATTR(_name, S_IWUSR|S_IWGRP, NULL, _store)
+
+static MEGARAID_HOST_WOATTR(logical_drive_created, megaraid_host_store_ld_created);
+static MEGARAID_HOST_WOATTR(logical_drive_destroyed, megaraid_host_store_ld_destroyed);
+static CLASS_DEVICE_ATTR(megaraid_mbox_app_hndl, S_IRUSR, megaraid_sysfs_show_app_hndl,
NULL);
-// Host template initializer for megaraid mbox sysfs device attributes
static struct class_device_attribute *megaraid_shost_attrs[] = {
&class_device_attr_megaraid_mbox_app_hndl,
+ &class_device_attr_logical_drive_created,
+ &class_device_attr_logical_drive_destroyed,
NULL,
};
+static DEVICE_ATTR(megaraid_mbox_ld, S_IRUSR, megaraid_sysfs_show_ldnum, NULL);
-DEVICE_ATTR(megaraid_mbox_ld, S_IRUSR, megaraid_sysfs_show_ldnum, NULL);
-
-// Host template initializer for megaraid mbox sysfs device attributes
static struct device_attribute *megaraid_sdev_attrs[] = {
&dev_attr_megaraid_mbox_ld,
NULL,
};
-
/*
* Scsi host template for megaraid unified driver
diff -Nru a/drivers/scsi/megaraid/megaraid_mbox.h b/drivers/scsi/megaraid/megaraid_mbox.h
--- a/drivers/scsi/megaraid/megaraid_mbox.h 2005-02-08 17:16:27 -06:00
+++ b/drivers/scsi/megaraid/megaraid_mbox.h 2005-02-08 17:16:27 -06:00
@@ -21,8 +21,8 @@
#include "megaraid_ioctl.h"
-#define MEGARAID_VERSION "2.20.4.5"
-#define MEGARAID_EXT_VERSION "(Release Date: Thu Feb 03 12:27:22 EST 2005)"
+#define MEGARAID_VERSION "2.20.4.6"
+#define MEGARAID_EXT_VERSION "(Release Date: Tue Feb 08 12:27:22 EST 2005)"
/*
===================================================================
This BitKeeper patch contains the following changesets:
1.2132.2.3
## Wrapped with gzip_uu ##
M'XL( $M("4( \U9^U/;2!+^V?HK^D@=!:P?>OJ5P,%B7]:U)% VD+U:ME1C
M:8P4]/!I) BWWO_]ND>2'\$$ \G5&<>6QC-?=W_=T]VCO($+P9-NY0-+4[L7
MA\+QE#?P2RS2;L7E05!WXA 'AG&, PTO#GDC=.6TQOBF(1SA-P(_RK[4]'JS
M1K<U+TZG07:MX*HSECH>W/)$="M:W9B/I/=3WJT,^^\O3HZ&BK*_#\<>BZ[Y
MB*>POZ^D<7++ E<<LM0+XJB>)BP2(4\9*3.;3YWIJJKCGZ6U#-5JSK2F:K9F
MCN9J&C,U[JJZV6Z:RI)EAZ5%OQ<V_+&*9B%:&P$-39^9;4-M*CW0ZKIFZ'6]
M;H!J-52]H;9!:W;-9E<U:BI^JK!. OQD0$U5?H;O:\RQXL"0!YP)#CV6\DH7
MSC,._^1C(+WTKM[JZCKT1^= ]D!-*@>Y<O!NG:8'"'F<)0F/4KA$5_EQA*AH
ML5HWZTW8(:="&+M9P'>K^;A>MV#'"<-R&!%. Y<G#]=;FZ['MU:O'+DN=R&]
MBR'B=Q#R:Y8PW[6%A_%HH^Z)P'F5AK@7#2=@0L@ M.E7&I_5:D#7JKP! !H(
MXFO?88'M)OXMMYV$(VONXQ-<+M(DOL^GT#\6N>#Q8(K63;+(2=$\ 9,X@=3C
M81W@4^*G*8_0SS!)T.\9;B<Q90Z'\;U<#R&+V#4/B5\VG08HC$"J!(!>]*/;
M^(;#Z'@T@'+KX#(_FB0,5<F<-$NX%(A#<1+ZT36MA!N>1#S 2X:PI1$@C:#U
M'A,PYJA787$5$.'.#P(<A;F1\._,3SF(& .35B$EP!TOABU]"PX>Y:Y\L4F*
MM,AQ4FM%"7BCH\92U54"5N68#^6LN, /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;?
MW)-("BK?!@._.A:B;WHZ\K[#Z6C#YWC?X73DK9Z.+'J@IW;DZ:CSW.==4--_
MR-GHYRR<E@^[Z/&6?.3X@J.,]X*C3$\W,7 'NH6?#_+&97\X&IQ^K&R5SZ:V
M'L[I_W:^F+>S_)SLVX_)=K<6_VWJ>-RY$5FXKXW52=,<6\I_ 9(%20&L'0
next prev parent reply other threads:[~2005-02-08 23:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-07 18:27 [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure Matt Domsch
2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:29 ` Matt Domsch
2005-02-07 18:30 ` Matt Domsch
2005-02-07 19:22 ` Brian King
2005-02-07 19:40 ` Matt Domsch
2005-02-08 23:19 ` Matt Domsch
2005-02-08 23:22 ` Matt Domsch
2005-02-08 23:23 ` Matt Domsch [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-04-14 18:24 Matt Domsch
2005-04-14 19:00 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050208232322.GC30086@lists.us.dell.com \
--to=matt_domsch@dell.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox