From 8196a934eea3810be6243b307b336136d63bbc48 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Fri, 6 Aug 2010 03:02:40 -0500 Subject: [SCSI] fnic: do not reset dev_loss_tmo in slave callout This fixes a bug where the driver was resetting the rport dev_loss_tmo when devices were added by adding support for the get_host_def_dev_loss_tmo callout. Patch has only been compile tested. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/fnic/fnic_main.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/fnic/fnic_main.c') diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index 9eb7a9ebccae..df91a61591b2 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c @@ -80,8 +80,6 @@ static struct libfc_function_template fnic_transport_template = { static int fnic_slave_alloc(struct scsi_device *sdev) { struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); - struct fc_lport *lp = shost_priv(sdev->host); - struct fnic *fnic = lport_priv(lp); sdev->tagged_supported = 1; @@ -89,8 +87,6 @@ static int fnic_slave_alloc(struct scsi_device *sdev) return -ENXIO; scsi_activate_tcq(sdev, FNIC_DFLT_QUEUE_DEPTH); - rport->dev_loss_tmo = fnic->config.port_down_timeout / 1000; - return 0; } @@ -113,6 +109,15 @@ static struct scsi_host_template fnic_host_template = { .shost_attrs = fnic_attrs, }; +static void +fnic_get_host_def_loss_tmo(struct Scsi_Host *shost) +{ + 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; +} + static void fnic_get_host_speed(struct Scsi_Host *shost); static struct scsi_transport_template *fnic_fc_transport; static struct fc_host_statistics *fnic_get_stats(struct Scsi_Host *); @@ -142,6 +147,7 @@ static struct fc_function_template fnic_fc_functions = { .show_rport_dev_loss_tmo = 1, .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, -- cgit v1.2.3 From 485868208ee833628d49f81b4609001749d92d56 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Wed, 15 Sep 2010 16:52:28 -0500 Subject: [SCSI] fnic: prep for fc host dev loss tmo support 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 Signed-off-by: James Bottomley --- drivers/scsi/fnic/fnic_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'drivers/scsi/fnic/fnic_main.c') diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index df91a61591b2..bb63f1a1f808 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); -- cgit v1.2.3