* Add fc host dev loss sysfs file
@ 2010-09-15 21:52 michaelc
2010-09-15 21:52 ` [PATCH 1/5] fnic: prep for fc host dev loss tmo support michaelc
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi
These patches add a FC host dev loss sysfs file that stores
the default dev loss tmo value and updates the existing
rport's dev loss setting.
The patchset was made over scsi-misc.
[PATCH 1/5] fnic: prep for fc host dev loss tmo support
[PATCH 2/5] ibmvfc: prep for fc host dev loss tmo support
[PATCH 3/5] qla2xxx: prep for fc host dev loss tmo support
[PATCH 4/5] lpfc: prep for fc host dev loss tmo support
[PATCH 5/5] fc class: add fc host dev loss sysfs file
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] fnic: prep for fc host dev loss tmo support
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
@ 2010-09-15 21:52 ` michaelc
2010-09-15 21:52 ` [PATCH 2/5] ibmvfc: " michaelc
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
This removes the driver's get_host_def_dev_loss_tmo
callback and just has the driver set the dev loss
using the fc class fc_host_dev_loss_tmo macro like is
done for other fc params.
This also adds a set rport dev loss function so the
fc class host dev loss tmp sysfs support being added
in the fc class patch can update rports.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/fnic/fnic_main.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index df91a61..bb63f1a 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -110,12 +110,12 @@ static struct scsi_host_template fnic_host_template = {
};
static void
-fnic_get_host_def_loss_tmo(struct Scsi_Host *shost)
+fnic_set_rport_dev_loss_tmo(struct fc_rport *rport, u32 timeout)
{
- struct fc_lport *lp = shost_priv(shost);
- struct fnic *fnic = lport_priv(lp);
-
- fc_host_def_dev_loss_tmo(shost) = fnic->config.port_down_timeout / 1000;
+ if (timeout)
+ rport->dev_loss_tmo = timeout;
+ else
+ rport->dev_loss_tmo = 1;
}
static void fnic_get_host_speed(struct Scsi_Host *shost);
@@ -145,9 +145,9 @@ static struct fc_function_template fnic_fc_functions = {
.show_starget_port_name = 1,
.show_starget_port_id = 1,
.show_rport_dev_loss_tmo = 1,
+ .set_rport_dev_loss_tmo = fnic_set_rport_dev_loss_tmo,
.issue_fc_host_lip = fnic_reset,
.get_fc_host_stats = fnic_get_stats,
- .get_host_def_dev_loss_tmo = fnic_get_host_def_loss_tmo,
.dd_fcrport_size = sizeof(struct fc_rport_libfc_priv),
.terminate_rport_io = fnic_terminate_rport_io,
.bsg_request = fc_lport_bsg_request,
@@ -712,6 +712,7 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
goto err_out_free_exch_mgr;
}
fc_host_maxframe_size(lp->host) = lp->mfs;
+ fc_host_dev_loss_tmo(lp->host) = fnic->config.port_down_timeout / 1000;
sprintf(fc_host_symbolic_name(lp->host),
DRV_NAME " v" DRV_VERSION " over %s", fnic->name);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] ibmvfc: prep for fc host dev loss tmo support
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
2010-09-15 21:52 ` [PATCH 1/5] fnic: prep for fc host dev loss tmo support michaelc
@ 2010-09-15 21:52 ` michaelc
2010-09-15 21:52 ` [PATCH 3/5] qla2xxx: " michaelc
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
This removes the driver's get_host_def_dev_loss_tmo
callback and just has the driver set the dev loss
using the fc class fc_host_dev_loss_tmo macro like is
done for other fc params.
This patch also removes the module dev loss param.
To override the value the fc host sysfs value being
added in the fc class patch can be used instead of the driver
module param.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
---
drivers/scsi/ibmvscsi/ibmvfc.c | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c
index a5dd9b4..da0926c 100644
--- a/drivers/scsi/ibmvscsi/ibmvfc.c
+++ b/drivers/scsi/ibmvscsi/ibmvfc.c
@@ -50,7 +50,6 @@ static unsigned int max_lun = IBMVFC_MAX_LUN;
static unsigned int max_targets = IBMVFC_MAX_TARGETS;
static unsigned int max_requests = IBMVFC_MAX_REQUESTS_DEFAULT;
static unsigned int disc_threads = IBMVFC_MAX_DISC_THREADS;
-static unsigned int dev_loss_tmo = IBMVFC_DEV_LOSS_TMO;
static unsigned int ibmvfc_debug = IBMVFC_DEBUG;
static unsigned int log_level = IBMVFC_DEFAULT_LOG_LEVEL;
static LIST_HEAD(ibmvfc_head);
@@ -84,11 +83,6 @@ MODULE_PARM_DESC(disc_threads, "Number of device discovery threads to use. "
module_param_named(debug, ibmvfc_debug, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Enable driver debug information. "
"[Default=" __stringify(IBMVFC_DEBUG) "]");
-module_param_named(dev_loss_tmo, dev_loss_tmo, uint, S_IRUGO | S_IWUSR);
-MODULE_PARM_DESC(dev_loss_tmo, "Maximum number of seconds that the FC "
- "transport should insulate the loss of a remote port. Once this "
- "value is exceeded, the scsi target is removed. "
- "[Default=" __stringify(IBMVFC_DEV_LOSS_TMO) "]");
module_param_named(log_level, log_level, uint, 0);
MODULE_PARM_DESC(log_level, "Set to 0 - 4 for increasing verbosity of device driver. "
"[Default=" __stringify(IBMVFC_DEFAULT_LOG_LEVEL) "]");
@@ -1030,11 +1024,6 @@ static void ibmvfc_get_host_port_state(struct Scsi_Host *shost)
spin_unlock_irqrestore(shost->host_lock, flags);
}
-static void ibmvfc_set_host_def_dev_loss_tmo(struct Scsi_Host *shost)
-{
- fc_host_def_dev_loss_tmo(shost) = dev_loss_tmo;
-}
-
/**
* ibmvfc_set_rport_dev_loss_tmo - Set rport's device loss timeout
* @rport: rport struct
@@ -4746,6 +4735,8 @@ static int ibmvfc_probe(struct vio_dev *vdev, const struct vio_device_id *id)
if ((rc = scsi_add_host(shost, dev)))
goto release_event_pool;
+ fc_host_dev_loss_tmo(shost) = IBMVFC_DEV_LOSS_TMO;
+
if ((rc = ibmvfc_create_trace_file(&shost->shost_dev.kobj,
&ibmvfc_trace_attr))) {
dev_err(dev, "Failed to create trace file. rc=%d\n", rc);
@@ -4891,8 +4882,6 @@ static struct fc_function_template ibmvfc_transport_functions = {
.get_host_speed = ibmvfc_get_host_speed,
.show_host_speed = 1,
- .get_host_def_dev_loss_tmo = ibmvfc_set_host_def_dev_loss_tmo,
-
.issue_fc_host_lip = ibmvfc_issue_fc_host_lip,
.terminate_rport_io = ibmvfc_terminate_rport_io,
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] qla2xxx: prep for fc host dev loss tmo support
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
2010-09-15 21:52 ` [PATCH 1/5] fnic: prep for fc host dev loss tmo support michaelc
2010-09-15 21:52 ` [PATCH 2/5] ibmvfc: " michaelc
@ 2010-09-15 21:52 ` michaelc
2010-09-15 21:52 ` [PATCH 4/5] lpfc: " michaelc
2010-09-15 21:52 ` [PATCH 5/5] fc class: add fc host dev loss sysfs file michaelc
4 siblings, 0 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
This removes the driver's get_host_def_dev_loss_tmo
callback and just has the driver set the dev loss
using the fc class fc_host_dev_loss_tmo macro like is
done for other fc params.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
---
drivers/scsi/qla2xxx/qla_attr.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index c978105..029fe6b 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1530,15 +1530,6 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
}
static void
-qla2x00_get_host_def_loss_tmo(struct Scsi_Host *shost)
-{
- scsi_qla_host_t *vha = shost_priv(shost);
- struct qla_hw_data *ha = vha->hw;
-
- fc_host_def_dev_loss_tmo(shost) = ha->port_down_retry_count;
-}
-
-static void
qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
{
struct Scsi_Host *host = rport_to_shost(rport);
@@ -1785,6 +1776,7 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
}
/* initialize attributes */
+ fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
fc_host_supported_classes(vha->host) =
@@ -1912,7 +1904,6 @@ struct fc_function_template qla2xxx_transport_functions = {
.show_host_fabric_name = 1,
.get_host_port_state = qla2x00_get_host_port_state,
.show_host_port_state = 1,
- .get_host_def_dev_loss_tmo = qla2x00_get_host_def_loss_tmo,
.dd_fcrport_size = sizeof(struct fc_port *),
.show_rport_supported_classes = 1,
@@ -1959,7 +1950,6 @@ struct fc_function_template qla2xxx_transport_vport_functions = {
.show_host_fabric_name = 1,
.get_host_port_state = qla2x00_get_host_port_state,
.show_host_port_state = 1,
- .get_host_def_dev_loss_tmo = qla2x00_get_host_def_loss_tmo,
.dd_fcrport_size = sizeof(struct fc_port *),
.show_rport_supported_classes = 1,
@@ -1988,6 +1978,7 @@ qla2x00_init_host_attr(scsi_qla_host_t *vha)
struct qla_hw_data *ha = vha->hw;
u32 speed = FC_PORTSPEED_UNKNOWN;
+ fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
fc_host_supported_classes(vha->host) = FC_COS_CLASS3;
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] lpfc: prep for fc host dev loss tmo support
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
` (2 preceding siblings ...)
2010-09-15 21:52 ` [PATCH 3/5] qla2xxx: " michaelc
@ 2010-09-15 21:52 ` michaelc
2010-09-15 21:52 ` [PATCH 5/5] fc class: add fc host dev loss sysfs file michaelc
4 siblings, 0 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
This removes the driver's get_host_def_dev_loss_tmo
callback and just has the driver set the dev loss
using the fc class fc_host_dev_loss_tmo macro like is
done for other fc params.
It also adds compat support for the driver's existing
dev loss and nodev sysfs and modparams.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/lpfc/lpfc_attr.c | 16 ++++++----------
drivers/scsi/lpfc/lpfc_init.c | 2 ++
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 87c2b6b..f6efc6f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2159,6 +2159,11 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
vport->cfg_nodev_tmo = val;
vport->cfg_devloss_tmo = val;
+ /*
+ * For compat: set the fc_host dev loss so new rports
+ * will get the value.
+ */
+ fc_host_dev_loss_tmo(lpfc_shost_from_vport(vport)) = val;
lpfc_update_rport_devloss_tmo(vport);
return 0;
}
@@ -2208,6 +2213,7 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val)
vport->cfg_nodev_tmo = val;
vport->cfg_devloss_tmo = val;
vport->dev_loss_tmo_changed = 1;
+ fc_host_dev_loss_tmo(lpfc_shost_from_vport(vport)) = val;
lpfc_update_rport_devloss_tmo(vport);
return 0;
}
@@ -4370,14 +4376,6 @@ lpfc_get_starget_port_name(struct scsi_target *starget)
ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0;
}
-static void
-lpfc_get_host_def_loss_tmo(struct Scsi_Host *shost)
-{
- struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
-
- fc_host_def_dev_loss_tmo(shost) = vport->cfg_devloss_tmo;
-}
-
/**
* lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
* @rport: fc rport address.
@@ -4486,7 +4484,6 @@ struct fc_function_template lpfc_transport_functions = {
.get_host_fabric_name = lpfc_get_host_fabric_name,
.show_host_fabric_name = 1,
- .get_host_def_dev_loss_tmo = lpfc_get_host_def_loss_tmo,
/*
* The LPFC driver treats linkdown handling as target loss events
* so there are no sysfs handlers for link_down_tmo.
@@ -4554,7 +4551,6 @@ struct fc_function_template lpfc_vport_transport_functions = {
.get_host_fabric_name = lpfc_get_host_fabric_name,
.show_host_fabric_name = 1,
- .get_host_def_dev_loss_tmo = lpfc_get_host_def_loss_tmo,
/*
* The LPFC driver treats linkdown handling as target loss events
* so there are no sysfs handlers for link_down_tmo.
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index da9ba06..87a4d09 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -2817,6 +2817,8 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
(((uint32_t) vport->fc_sparam.cmn.bbRcvSizeMsb & 0x0F) << 8) |
(uint32_t) vport->fc_sparam.cmn.bbRcvSizeLsb;
+ fc_host_dev_loss_tmo(shost) = vport->cfg_devloss_tmo;
+
/* This value is also unchanging */
memset(fc_host_active_fc4s(shost), 0,
sizeof(fc_host_active_fc4s(shost)));
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] fc class: add fc host dev loss sysfs file
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
` (3 preceding siblings ...)
2010-09-15 21:52 ` [PATCH 4/5] lpfc: " michaelc
@ 2010-09-15 21:52 ` michaelc
4 siblings, 0 replies; 6+ messages in thread
From: michaelc @ 2010-09-15 21:52 UTC (permalink / raw)
To: linux-scsi; +Cc: Mike Christie
From: Mike Christie <michaelc@cs.wisc.edu>
This adds a fc host dev loss sysfs file. Instead of
calling into the driver using the get_host_def_dev_loss_tmo
callback, we allow drivers to init the dev loss like is done
for other fc host params, and then the fc class will handle
updating the value if the user writes to the new sysfs file.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
drivers/scsi/scsi_transport_fc.c | 124 +++++++++++++++++++++++++++-----------
include/scsi/scsi_transport_fc.h | 7 +-
2 files changed, 91 insertions(+), 40 deletions(-)
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 78486d5..998c01b 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -53,6 +53,25 @@ static void fc_bsg_remove(struct request_queue *);
static void fc_bsg_goose_queue(struct fc_rport *);
/*
+ * Module Parameters
+ */
+
+/*
+ * dev_loss_tmo: the default number of seconds that the FC transport
+ * should insulate the loss of a remote port.
+ * The maximum will be capped by the value of SCSI_DEVICE_BLOCK_MAX_TIMEOUT.
+ */
+static unsigned int fc_dev_loss_tmo = 60; /* seconds */
+
+module_param_named(dev_loss_tmo, fc_dev_loss_tmo, uint, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(dev_loss_tmo,
+ "Maximum number of seconds that the FC transport should"
+ " insulate the loss of a remote port. Once this value is"
+ " exceeded, the scsi target is removed. Value should be"
+ " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if"
+ " fast_io_fail_tmo is not set.");
+
+/*
* Redefine so that we can have same named attributes in the
* sdev/starget/host objects.
*/
@@ -408,6 +427,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev,
if (!fc_host->work_q)
return -ENOMEM;
+ fc_host->dev_loss_tmo = fc_dev_loss_tmo;
snprintf(fc_host->devloss_work_q_name,
sizeof(fc_host->devloss_work_q_name),
"fc_dl_%d", shost->host_no);
@@ -462,25 +482,6 @@ static DECLARE_TRANSPORT_CLASS(fc_vport_class,
NULL);
/*
- * Module Parameters
- */
-
-/*
- * dev_loss_tmo: the default number of seconds that the FC transport
- * should insulate the loss of a remote port.
- * The maximum will be capped by the value of SCSI_DEVICE_BLOCK_MAX_TIMEOUT.
- */
-static unsigned int fc_dev_loss_tmo = 60; /* seconds */
-
-module_param_named(dev_loss_tmo, fc_dev_loss_tmo, uint, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(dev_loss_tmo,
- "Maximum number of seconds that the FC transport should"
- " insulate the loss of a remote port. Once this value is"
- " exceeded, the scsi target is removed. Value should be"
- " between 1 and SCSI_DEVICE_BLOCK_MAX_TIMEOUT if"
- " fast_io_fail_tmo is not set.");
-
-/*
* Netlink Infrastructure
*/
@@ -830,24 +831,32 @@ static FC_DEVICE_ATTR(rport, supported_classes, S_IRUGO,
/*
* dev_loss_tmo attribute
*/
-fc_rport_show_function(dev_loss_tmo, "%d\n", 20, )
-static ssize_t
-store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
+static int fc_str_to_dev_loss(const char *buf, unsigned long *val)
+{
+ char *cp;
+
+ *val = simple_strtoul(buf, &cp, 0);
+ if ((*cp && (*cp != '\n')) || (*val < 0))
+ return -EINVAL;
+ /*
+ * Check for overflow; dev_loss_tmo is u32
+ */
+ if (*val > UINT_MAX)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int fc_rport_set_dev_loss_tmo(struct fc_rport *rport,
+ unsigned long val)
{
- unsigned long val;
- struct fc_rport *rport = transport_class_to_rport(dev);
struct Scsi_Host *shost = rport_to_shost(rport);
struct fc_internal *i = to_fc_internal(shost->transportt);
- char *cp;
+
if ((rport->port_state == FC_PORTSTATE_BLOCKED) ||
(rport->port_state == FC_PORTSTATE_DELETED) ||
(rport->port_state == FC_PORTSTATE_NOTPRESENT))
return -EBUSY;
- val = simple_strtoul(buf, &cp, 0);
- if ((*cp && (*cp != '\n')) || (val < 0))
- return -EINVAL;
-
/*
* Check for overflow; dev_loss_tmo is u32
*/
@@ -863,6 +872,25 @@ store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
return -EINVAL;
i->f->set_rport_dev_loss_tmo(rport, val);
+ return 0;
+}
+
+fc_rport_show_function(dev_loss_tmo, "%d\n", 20, )
+static ssize_t
+store_fc_rport_dev_loss_tmo(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct fc_rport *rport = transport_class_to_rport(dev);
+ unsigned long val;
+ int rc;
+
+ rc = fc_str_to_dev_loss(buf, &val);
+ if (rc)
+ return rc;
+
+ rc = fc_rport_set_dev_loss_tmo(rport, val);
+ if (rc)
+ return rc;
return count;
}
static FC_DEVICE_ATTR(rport, dev_loss_tmo, S_IRUGO | S_IWUSR,
@@ -1608,8 +1636,35 @@ store_fc_private_host_issue_lip(struct device *dev,
static FC_DEVICE_ATTR(host, issue_lip, S_IWUSR, NULL,
store_fc_private_host_issue_lip);
-fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20);
+static ssize_t
+store_fc_private_host_dev_loss_tmo(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct Scsi_Host *shost = transport_class_to_shost(dev);
+ struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
+ struct fc_rport *rport;
+ unsigned long val, flags;
+ int rc;
+
+ rc = fc_str_to_dev_loss(buf, &val);
+ if (rc)
+ return rc;
+
+ fc_host_dev_loss_tmo(shost) = val;
+ spin_lock_irqsave(shost->host_lock, flags);
+ list_for_each_entry(rport, &fc_host->rports, peers)
+ fc_rport_set_dev_loss_tmo(rport, val);
+ spin_unlock_irqrestore(shost->host_lock, flags);
+ return count;
+}
+fc_private_host_show_function(dev_loss_tmo, "%d\n", 20, );
+static FC_DEVICE_ATTR(host, dev_loss_tmo, S_IRUGO | S_IWUSR,
+ show_fc_host_dev_loss_tmo,
+ store_fc_private_host_dev_loss_tmo);
+
+fc_private_host_rd_attr(npiv_vports_inuse, "%u\n", 20);
/*
* Host Statistics Management
@@ -2165,6 +2220,7 @@ fc_attach_transport(struct fc_function_template *ft)
SETUP_HOST_ATTRIBUTE_RW(system_hostname);
/* Transport-managed attributes */
+ SETUP_PRIVATE_HOST_ATTRIBUTE_RW(dev_loss_tmo);
SETUP_PRIVATE_HOST_ATTRIBUTE_RW(tgtid_bind_type);
if (ft->issue_fc_host_lip)
SETUP_PRIVATE_HOST_ATTRIBUTE_RW(issue_lip);
@@ -2525,11 +2581,7 @@ fc_rport_create(struct Scsi_Host *shost, int channel,
rport->maxframe_size = -1;
rport->supported_classes = FC_COS_UNSPECIFIED;
- if (fci->f->get_host_def_dev_loss_tmo) {
- fci->f->get_host_def_dev_loss_tmo(shost);
- rport->dev_loss_tmo = fc_host_def_dev_loss_tmo(shost);
- } else
- rport->dev_loss_tmo = fc_dev_loss_tmo;
+ rport->dev_loss_tmo = fc_host->dev_loss_tmo;
memcpy(&rport->node_name, &ids->node_name, sizeof(rport->node_name));
memcpy(&rport->port_name, &ids->port_name, sizeof(rport->port_name));
rport->port_id = ids->port_id;
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 9f98fca..59816fe 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -496,7 +496,7 @@ struct fc_host_attrs {
u64 fabric_name;
char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
char system_hostname[FC_SYMBOLIC_NAME_SIZE];
- u32 def_dev_loss_tmo;
+ u32 dev_loss_tmo;
/* Private (Transport-managed) Attributes */
enum fc_tgtid_binding_type tgtid_bind_type;
@@ -581,8 +581,8 @@ struct fc_host_attrs {
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q_name)
#define fc_host_devloss_work_q(x) \
(((struct fc_host_attrs *)(x)->shost_data)->devloss_work_q)
-#define fc_host_def_dev_loss_tmo(x) \
- (((struct fc_host_attrs *)(x)->shost_data)->def_dev_loss_tmo)
+#define fc_host_dev_loss_tmo(x) \
+ (((struct fc_host_attrs *)(x)->shost_data)->dev_loss_tmo)
struct fc_bsg_buffer {
@@ -643,7 +643,6 @@ struct fc_function_template {
void (*get_host_fabric_name)(struct Scsi_Host *);
void (*get_host_symbolic_name)(struct Scsi_Host *);
void (*set_host_system_hostname)(struct Scsi_Host *);
- void (*get_host_def_dev_loss_tmo)(struct Scsi_Host *);
struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
void (*reset_fc_host_stats)(struct Scsi_Host *);
--
1.7.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-15 21:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 21:52 Add fc host dev loss sysfs file michaelc
2010-09-15 21:52 ` [PATCH 1/5] fnic: prep for fc host dev loss tmo support michaelc
2010-09-15 21:52 ` [PATCH 2/5] ibmvfc: " michaelc
2010-09-15 21:52 ` [PATCH 3/5] qla2xxx: " michaelc
2010-09-15 21:52 ` [PATCH 4/5] lpfc: " michaelc
2010-09-15 21:52 ` [PATCH 5/5] fc class: add fc host dev loss sysfs file michaelc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).