]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[SCSI] libfc: Extending lport's roles for target if there is a registered target.
authorKiran Patil <kiran.patil@intel.com>
Sat, 29 Jan 2011 00:05:22 +0000 (16:05 -0800)
committerJames Bottomley <James.Bottomley@suse.de>
Sat, 12 Feb 2011 17:08:22 +0000 (11:08 -0600)
Problem:

From initaitor machine, when queried role of target (other end of connection),
it is "initiator", hence SCSI-ml doesn't send any LUN Inquiry commands.

Fix:

If there is a registered target for FC_TYPE_FCP, extend lport's params
(capability) to be target as well, By default lport params are
INITIATOR only. Having this fix, caused initiator to send SCSI LUN
inquiry command to target.

Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/libfc/fc_libfc.c
drivers/scsi/libfc/fc_libfc.h
drivers/scsi/libfc/fc_lport.c

index 5e40dab8f919aa41bcb593026d59883ae5b9433b..b7735129f1f36ed3b90eff3c3db900659fd42c84 100644 (file)
@@ -232,6 +232,25 @@ void fc_fill_reply_hdr(struct fc_frame *fp, const struct fc_frame *in_fp,
 }
 EXPORT_SYMBOL(fc_fill_reply_hdr);
 
+/**
+ * fc_fc4_conf_lport_params() - Modify "service_params" of specified lport
+ * if there is service provider (target provider) registered with libfc
+ * for specified "fc_ft_type"
+ * @lport: Local port which service_params needs to be modified
+ * @type: FC-4 type, such as FC_TYPE_FCP
+ */
+void fc_fc4_conf_lport_params(struct fc_lport *lport, enum fc_fh_type type)
+{
+       struct fc4_prov *prov_entry;
+       BUG_ON(type >= FC_FC4_PROV_SIZE);
+       BUG_ON(!lport);
+       prov_entry = fc_passive_prov[type];
+       if (type == FC_TYPE_FCP) {
+               if (prov_entry && prov_entry->recv)
+                       lport->service_params |= FCP_SPPF_TARG_FCN;
+       }
+}
+
 void fc_lport_iterate(void (*notify)(struct fc_lport *, void *), void *arg)
 {
        struct fc_lport *lport;
index 8496f7020b971abb3db98c3c6a4d2fabe256cca7..fedc819d70c0259db4dceb8b04e797dd4c5fbd0b 100644 (file)
@@ -125,6 +125,7 @@ void fc_destroy_fcp(void);
 const char *fc_els_resp_type(struct fc_frame *);
 extern void fc_fc4_add_lport(struct fc_lport *);
 extern void fc_fc4_del_lport(struct fc_lport *);
+extern void fc_fc4_conf_lport_params(struct fc_lport *, enum fc_fh_type);
 
 /*
  * Copies a buffer into an sg list
index e0ef81426c33ac4e87997a20716da9b4221d8183..735f1f82ccfd9caafdcf7a32b11c2107abb6250f 100644 (file)
@@ -1597,6 +1597,7 @@ int fc_lport_config(struct fc_lport *lport)
 
        fc_lport_add_fc4_type(lport, FC_TYPE_FCP);
        fc_lport_add_fc4_type(lport, FC_TYPE_CT);
+       fc_fc4_conf_lport_params(lport, FC_TYPE_FCP);
 
        return 0;
 }