Hello all,

I would like to get some information about open-fcoe initiator and target.
Kindly answer following questions,

1. Is this initiator-target setup for back to back connection or with FCoE 
switch?
2. To trigger for NPIV what are the steps we need to follow??


Evelyn Richie M S


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of [email protected]
Sent: Thursday, May 21, 2009 3:13 AM
To: [email protected]
Subject: devel Digest, Vol 19, Issue 25

Send devel mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://www.open-fcoe.org/mailman/listinfo/devel
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of devel digest..."


Today's Topics:

   1. [PATCH] libhbalinux: Reading HBA device infomation from   sysfs
      (Steve Ma)
   2. [PATCH] libhbalinux: Support description string for       unknown
      HBA (Steve Ma)
   3. [PATCH] libhbalinux: sg devices opened for ioctl are      not
      closed. (Steve Ma)
   4. [PATCH] libhbalinux: Return model string for
      HBA_GetAdapterAttributes (Steve Ma)
   5. [RFC PATCH 0/9] NPIV support (Chris Leech)
   6. [RFC PATCH 1/9] fcoe: interface changes to        fcoe_if_create and
      fcoe_if_destroy (Chris Leech)
   7. [RFC PATCH 2/9] libfc: add VN_Port flag for NPIV ports
      (Chris Leech)
   8. [RFC PATCH 4/9] fcoe: rename scsi_transport_fcoe_sw       to
      fcoe_transport_template (Chris Leech)
   9. [RFC PATCH 5/9] fcoe: add a separate scsi transport       template
      for NPIV  vports (Chris Leech)


----------------------------------------------------------------------

Message: 1
Date: Wed, 20 May 2009 13:53:24 -0700
From: Steve Ma <[email protected]>
Subject: [Open-FCoE] [PATCH] libhbalinux: Reading HBA device
        infomation from sysfs
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

The HBA device information: vendor_id, device_id, subsystem_vendor_id,
subsystem_device_id, and device_class are available in sysfs. There is
no need to get these data via libpciaccess.

Signed-off-by: Steve Ma <[email protected]>
---

 pci.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/pci.c b/pci.c
index 0a06d86..e559ae8 100644
--- a/pci.c
+++ b/pci.c
@@ -158,11 +158,6 @@ get_pci_device_info(struct pci_device *dev, struct 
hba_info *hba_info)
        u_int8_t hdr_type;
        char *unknown = "Unknown";

-       hba_info->vendor_id = dev->vendor_id;
-       hba_info->device_id = dev->device_id;
-       hba_info->subsystem_vendor_id = dev->subvendor_id;
-       hba_info->subsystem_device_id = dev->subdevice_id;
-
        name = pci_device_get_vendor_name(dev);
        if (!name)
                name = unknown;
@@ -178,12 +173,9 @@ get_pci_device_info(struct pci_device *dev, struct 
hba_info *hba_info)
                        name, sizeof(hba_info->ModelDescription));

        /*
-        * Reading device class and revision from PCIe
+        * Reading hardware revision from PCIe
         * configuration header space.
         */
-       pci_device_cfg_read_u16(dev, &class, PCI_CLASS_DEVICE);
-       hba_info->device_class = class;
-
        pci_device_cfg_read_u8(dev, &revision, PCI_REVISION_ID);
        snprintf(hba_info->HardwareVersion,
                 sizeof(hba_info->HardwareVersion),



------------------------------

Message: 2
Date: Wed, 20 May 2009 13:54:59 -0700
From: Steve Ma <[email protected]>
Subject: [Open-FCoE] [PATCH] libhbalinux: Support description string
        for     unknown HBA
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

For new HBAs that do not have descriptions in the pci.ids file,
the description will be shown as Unknown in the "fcoeadm -i"
output. This patch is to show the following string instead of
"Unknown": [<A>:<B>]-[<C>:<D>]-(<E>)
where A = vendor_id, B = device_id, C = subsystem_vendor_id,
D = subsystem_device_id, E = device_class

Signed-off-by: Steve Ma <[email protected]>
---

 lport.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lport.c b/lport.c
index 3cd0304..f7a6616 100644
--- a/lport.c
+++ b/lport.c
@@ -356,6 +356,15 @@ sysfs_scan(struct dirent *dp, void *arg)
        sa_strncpy_safe(atp->ModelDescription, sizeof(atp->ModelDescription),
                        hba_info.ModelDescription,
                        sizeof(hba_info.ModelDescription));
+       if (!strncmp(hba_info.ModelDescription, "Unknown",
+                sizeof(hba_info.ModelDescription))) {
+               snprintf(atp->ModelDescription, sizeof(atp->ModelDescription),
+                       "[%04x:%04x]-[%04x:%04x]-(%04x)",
+                       hba_info.vendor_id, hba_info.device_id,
+                       hba_info.subsystem_vendor_id,
+                       hba_info.subsystem_device_id,
+                       hba_info.device_class);
+       }

        /* Get HardwareVersion */
        sa_strncpy_safe(atp->HardwareVersion, sizeof(atp->HardwareVersion),



------------------------------

Message: 3
Date: Wed, 20 May 2009 13:55:33 -0700
From: Steve Ma <[email protected]>
Subject: [Open-FCoE] [PATCH] libhbalinux: sg devices opened for ioctl
        are     not closed.
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

The routines in sg.c to issue SCSI commands via ioctl open
sg devices before calling ioctl, but they do not close
the file descriptors when ioctl fails.

Signed-off-by: Steve Ma <[email protected]>
---

 sg.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/sg.c b/sg.c
index f324b9a..1088ae5 100644
--- a/sg.c
+++ b/sg.c
@@ -75,6 +75,7 @@ sg_issue_inquiry(const char *file, HBA_UINT8 cdb_byte1,
                rc = errno;
                fprintf(stderr, "%s: SG_IO error. file %s, errno=0x%x\n",
                        __func__, file, errno);
+               close(fd);
                return HBA_STATUS_ERROR;
        }
        close(fd);
@@ -199,6 +200,7 @@ sg_issue_read_capacity(const char *file, void *resp, 
HBA_UINT32 *resp_lenp,
                rc = errno;
                fprintf(stderr, "%s: SG_IO error. file %s, errno=0x%x\n",
                        __func__, file, errno);
+               close(fd);
                return HBA_STATUS_ERROR;
        }
        close(fd);
@@ -251,6 +253,7 @@ sg_issue_report_luns(const char *file, void *resp, 
HBA_UINT32 *resp_lenp,
                rc = errno;
                fprintf(stderr, "%s: SG_IO error. file %s, errno=0x%x\n",
                        __func__, file, errno);
+               close(fd);
                return HBA_STATUS_ERROR;
        }
        close(fd);



------------------------------

Message: 4
Date: Wed, 20 May 2009 13:56:35 -0700
From: Steve Ma <[email protected]>
Subject: [Open-FCoE] [PATCH] libhbalinux: Return model string for
        HBA_GetAdapterAttributes
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset="utf-8"

The model string of HBA_GetAdapterAttributes is currently
always returned as "Unknown". This patch is to return a better
meaningful string as the model string.

If the device is a newly developed product, and the model description
has not been added into pci.ids yet, use the model description
constructed for new product as the model string.

If the device name (model description) has already been added into
the pci.ids file, use the first word of the model description as
the model string. If the space after the first word is not found
(new product), use the entire model description as the model string.

Signed-off-by: Steve Ma <[email protected]>
---

 lport.c |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/lport.c b/lport.c
index f7a6616..b3fb98b 100644
--- a/lport.c
+++ b/lport.c
@@ -29,7 +29,6 @@
  * The following are temporary settings until we can find a way to
  * collect these information.
  */
-#define HBA_MODEL               "(Unknown)"
 #define HBA_ROM_VERSION         ""
 #define HBA_FW_VERSION          ""
 #define HBA_VENDOR_SPECIFIC_ID  0
@@ -112,6 +111,7 @@ sysfs_scan(struct dirent *dp, void *arg)
        char *driverName;
        int data[32], rc, i;
        char *cp;
+       char *saveptr;  /* for strtok_r */

        memset(&hba_info, 0, sizeof(hba_info));

@@ -348,9 +348,6 @@ sysfs_scan(struct dirent *dp, void *arg)
        sa_strncpy_safe(atp->SerialNumber, sizeof(atp->SerialNumber),
                        hba_info.SerialNumber, sizeof(hba_info.SerialNumber));

-       /* Get Model (TODO) */
-       sa_strncpy_safe(atp->Model, sizeof(atp->Model),
-                       HBA_MODEL, sizeof(HBA_MODEL));

        /* Get ModelDescription */
        sa_strncpy_safe(atp->ModelDescription, sizeof(atp->ModelDescription),
@@ -364,8 +361,38 @@ sysfs_scan(struct dirent *dp, void *arg)
                        hba_info.subsystem_vendor_id,
                        hba_info.subsystem_device_id,
                        hba_info.device_class);
+               /*
+                * Get Model
+                *
+                * If the device is a newly developed product, and
+                * the model description is not in pci.ids yet, use
+                * the model description constructed above as the
+                * model string.
+                */
+               sa_strncpy_safe(atp->Model, sizeof(atp->Model),
+                               atp->ModelDescription,
+                               sizeof(atp->ModelDescription));
        }

+       /*
+        * Get Model
+        *
+        * If the device name has already been added into
+        * the pci.ids file, use the first word of the model
+        * description as the model. If the space after the
+        * first word is not found (new product), use the
+        * model description as the model.
+        */
+       sa_strncpy_safe(buf, sizeof(buf), atp->ModelDescription,
+                       sizeof(atp->ModelDescription));
+       if (strtok_r(buf, " ", &saveptr))
+               sa_strncpy_safe(atp->Model, sizeof(atp->Model),
+                               buf, strnlen(buf, sizeof(buf)));
+       else
+               sa_strncpy_safe(atp->Model, sizeof(atp->Model),
+                               atp->ModelDescription,
+                               sizeof(atp->ModelDescription));
+
        /* Get HardwareVersion */
        sa_strncpy_safe(atp->HardwareVersion, sizeof(atp->HardwareVersion),
                        hba_info.HardwareVersion,



------------------------------

Message: 5
Date: Wed, 20 May 2009 14:39:26 -0700
From: Chris Leech <[email protected]>
Subject: [Open-FCoE] [RFC PATCH 0/9] NPIV support
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

The following series add NPIV support for libfc/libfcoe/fcoe.

It's functioning now, but there are still several areas I need to address
before this will be ready for inclusion.

1) FIP interaction is wrong.  When a VN_Port is created it will currently go
through the FIP discovery process.  It should skip to sending the encapsulated
FDISC request.

2) Receive demux is still a problem.  NPIV breaks the 1:1 association of
N_Port to network device.  That means that we can't just use the protocol
handlers to get directly to an fc_lport structure.  I don't like the way these
patches currently handle it, potentially walking the vport list for every
received frame.  Handling the FLOGI and FDISC responses is an added
difficulty here, because the can't be matched by fabric ID.

        Chris

---

Chris Leech (9):
      fcoe: NPIV vport create/destroy
      libfc, libfcoe: FDISC ELS for NPIV
      fcoe: fcoe_netdev_config differences for VN_Ports
      fcoe: move the host-list add/remove to keep out VN_Ports
      fcoe: add a separate scsi transport template for NPIV vports
      fcoe: rename scsi_transport_fcoe_sw to fcoe_transport_template
      fcoe: NPIV VN_Port lookup in fcoe_rcv and fcoe_fip_recv
      libfc: add VN_Port flag for NPIV ports
      fcoe: interface changes to fcoe_if_create and fcoe_if_destroy


 drivers/scsi/fcoe/fcoe.c      |  298 +++++++++++++++++++++++++++++++----------
 drivers/scsi/fcoe/libfcoe.c   |    7 +
 drivers/scsi/libfc/fc_lport.c |    8 +
 include/scsi/fc_encode.h      |   28 ++++
 include/scsi/libfc.h          |    1
 5 files changed, 267 insertions(+), 75 deletions(-)

--


------------------------------

Message: 6
Date: Wed, 20 May 2009 14:39:32 -0700
From: Chris Leech <[email protected]>
Subject: [Open-FCoE] [RFC PATCH 1/9] fcoe: interface changes to
        fcoe_if_create and      fcoe_if_destroy
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

By passing in the parent device instead of assuming the netdev is what
should be used, fcoe_if_create becomes usable for NPIV vports as well.
You still need a netdev, because that's how FCoE works.  Also removed some
duplicate checks from fcoe_if_create that are already in fcoe_create.

fcoe_if_destroy needs to take an lport as it's only argument, not a netdev.
That removes the 1:1 netdev:lport assumption from the destroy path.

Signed-off-by: Chris Leech <[email protected]>
---

 drivers/scsi/fcoe/fcoe.c |   61 ++++++++++++++++------------------------------
 1 files changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 9394c8c..381e4e2 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -436,25 +436,15 @@ static inline int fcoe_em_config(struct fc_lport *lp)

 /**
  * fcoe_if_destroy() - FCoE software HBA tear-down function
- * @netdev: ptr to the associated net_device
- *
- * Returns: 0 if link is OK for use by FCoE.
+ * @lp: fc_lport to destroy
  */
-static int fcoe_if_destroy(struct net_device *netdev)
+static void fcoe_if_destroy(struct fc_lport *lp)
 {
-       struct fc_lport *lp = NULL;
-       struct fcoe_softc *fc;
-
-       BUG_ON(!netdev);
+       struct fcoe_softc *fc = lport_priv(lp);
+       struct net_device *netdev = fc->real_dev;

        FCOE_NETDEV_DBG(netdev, "Destroying interface\n");

-       lp = fcoe_hostlist_lookup(netdev);
-       if (!lp)
-               return -ENODEV;
-
-       fc = lport_priv(lp);
-
        /* Logout of the fabric */
        fc_fabric_logoff(lp);

@@ -494,8 +484,6 @@ static int fcoe_if_destroy(struct net_device *netdev)
        /* Release the net_device and Scsi_Host */
        dev_put(fc->real_dev);
        scsi_host_put(lp->host);
-
-       return 0;
 }

 /*
@@ -543,32 +531,28 @@ static struct libfc_function_template 
fcoe_libfc_fcn_templ = {
 /**
  * fcoe_if_create() - this function creates the fcoe interface
  * @netdev: pointer the associated netdevice
+ * @parent: device pointer to be the parent in sysfs for the SCSI host
  *
  * Creates fc_lport struct and scsi_host for lport, configures lport
  * and starts fabric login.
  *
- * Returns : 0 on success
+ * Returns : The allocated fc_lport or an error pointer
  */
-static int fcoe_if_create(struct net_device *netdev)
+static struct fc_lport *fcoe_if_create(struct net_device *netdev,
+                                      struct device *parent)
 {
        int rc;
        struct fc_lport *lp = NULL;
        struct fcoe_softc *fc;
        struct Scsi_Host *shost;

-       BUG_ON(!netdev);
-
        FCOE_NETDEV_DBG(netdev, "Create Interface\n");

-       lp = fcoe_hostlist_lookup(netdev);
-       if (lp)
-               return -EEXIST;
-
        shost = libfc_host_alloc(&fcoe_shost_template,
                                 sizeof(struct fcoe_softc));
        if (!shost) {
                FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
        }
        lp = shost_priv(shost);
        fc = lport_priv(lp);
@@ -597,7 +581,7 @@ static int fcoe_if_create(struct net_device *netdev)
        }

        /* configure lport scsi host properties */
-       rc = fcoe_shost_config(lp, shost, &netdev->dev);
+       rc = fcoe_shost_config(lp, shost, parent);
        if (rc) {
                FCOE_NETDEV_DBG(netdev, "Could not configure shost for the "
                                "interface\n");
@@ -632,7 +616,7 @@ static int fcoe_if_create(struct net_device *netdev)

        dev_hold(netdev);

-       return rc;
+       return lp;

 out_lp_destroy:
        fc_exch_mgr_free(lp->emp); /* Free the EM */
@@ -640,7 +624,7 @@ out_netdev_cleanup:
        fcoe_netdev_cleanup(fc);
 out_host_put:
        scsi_host_put(lp->host);
-       return rc;
+       return ERR_PTR(rc);
 }

 /**
@@ -1543,8 +1527,9 @@ static int fcoe_ethdrv_put(const struct net_device 
*netdev)
  */
 static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
 {
-       int rc;
        struct net_device *netdev;
+       struct fc_lport *lport;
+       int rc;

        netdev = fcoe_if_to_netdev(buffer);
        if (!netdev) {
@@ -1552,17 +1537,12 @@ static int fcoe_destroy(const char *buffer, struct 
kernel_param *kp)
                goto out_nodev;
        }
        /* look for existing lport */
-       if (!fcoe_hostlist_lookup(netdev)) {
+       lport = fcoe_hostlist_lookup(netdev);
+       if (!lport) {
                rc = -ENODEV;
                goto out_putdev;
        }
-       rc = fcoe_if_destroy(netdev);
-       if (rc) {
-               printk(KERN_ERR "fcoe: Failed to destroy interface (%s)\n",
-                      netdev->name);
-               rc = -EIO;
-               goto out_putdev;
-       }
+       fcoe_if_destroy(lport);
        fcoe_ethdrv_put(netdev);
        rc = 0;
 out_putdev:
@@ -1581,6 +1561,7 @@ out_nodev:
 static int fcoe_create(const char *buffer, struct kernel_param *kp)
 {
        int rc;
+       struct fc_lport *lport;
        struct net_device *netdev;

        netdev = fcoe_if_to_netdev(buffer);
@@ -1595,8 +1576,8 @@ static int fcoe_create(const char *buffer, struct 
kernel_param *kp)
        }
        fcoe_ethdrv_get(netdev);

-       rc = fcoe_if_create(netdev);
-       if (rc) {
+       lport = fcoe_if_create(netdev, &netdev->dev);
+       if (IS_ERR(lport)) {
                printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
                       netdev->name);
                fcoe_ethdrv_put(netdev);
@@ -1858,7 +1839,7 @@ static void __exit fcoe_exit(void)

        /* releases the associated fcoe hosts */
        list_for_each_entry_safe(fc, tmp, &fcoe_hostlist, list)
-               fcoe_if_destroy(fc->real_dev);
+               fcoe_if_destroy(fc->ctlr.lp);

        unregister_hotcpu_notifier(&fcoe_cpu_notifier);




------------------------------

Message: 7
Date: Wed, 20 May 2009 14:39:37 -0700
From: Chris Leech <[email protected]>
Subject: [Open-FCoE] [RFC PATCH 2/9] libfc: add VN_Port flag for NPIV
        ports
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

Add a flag to tell NPIV VN_Ports from "real" N_Ports

Signed-off-by: Chris Leech <[email protected]>
---

 include/scsi/libfc.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index bceb00b..d8320ec 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -729,6 +729,7 @@ struct fc_lport {
        u32                     seq_offload:1;  /* seq offload supported */
        u32                     crc_offload:1;  /* crc offload supported */
        u32                     lro_enabled:1;  /* large receive offload */
+       u32                     vn_port:1;      /* is this a virtual port? */
        u32                     mfs;            /* max FC payload size */
        unsigned int            service_params;
        unsigned int            e_d_tov;



------------------------------

Message: 8
Date: Wed, 20 May 2009 14:39:49 -0700
From: Chris Leech <[email protected]>
Subject: [Open-FCoE] [RFC PATCH 4/9] fcoe: rename
        scsi_transport_fcoe_sw  to      fcoe_transport_template
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

I just didn't like the name, especially when I was looking at adding a second
transport_template for NPIV.

Signed-off-by: Chris Leech <[email protected]>
---

 drivers/scsi/fcoe/fcoe.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 86d8b23..e380dd2 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -78,7 +78,7 @@ static struct notifier_block fcoe_notifier = {
        .notifier_call = fcoe_device_notification,
 };

-static struct scsi_transport_template *scsi_transport_fcoe_sw;
+static struct scsi_transport_template *fcoe_transport_template;

 struct fc_function_template fcoe_transport_function = {
        .show_host_node_name = 1,
@@ -438,7 +438,7 @@ static int fcoe_shost_config(struct fc_lport *lp, struct 
Scsi_Host *shost,
        lp->host->max_lun = FCOE_MAX_LUN;
        lp->host->max_id = FCOE_MAX_FCP_TARGET;
        lp->host->max_channel = 0;
-       lp->host->transportt = scsi_transport_fcoe_sw;
+       lp->host->transportt = fcoe_transport_template;

        /* add the new host to the SCSI-ml */
        rc = scsi_add_host(lp->host, dev);
@@ -673,10 +673,9 @@ out_host_put:
 static int __init fcoe_if_init(void)
 {
        /* attach to scsi transport */
-       scsi_transport_fcoe_sw =
-               fc_attach_transport(&fcoe_transport_function);
+       fcoe_transport_template = fc_attach_transport(&fcoe_transport_function);

-       if (!scsi_transport_fcoe_sw) {
+       if (!fcoe_transport_template) {
                printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n");
                return -ENODEV;
        }
@@ -691,7 +690,7 @@ static int __init fcoe_if_init(void)
  */
 int __exit fcoe_if_exit(void)
 {
-       fc_release_transport(scsi_transport_fcoe_sw);
+       fc_release_transport(fcoe_transport_template);
        return 0;
 }




------------------------------

Message: 9
Date: Wed, 20 May 2009 14:39:55 -0700
From: Chris Leech <[email protected]>
Subject: [Open-FCoE] [RFC PATCH 5/9] fcoe: add a separate scsi
        transport       template for NPIV       vports
To: [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset="utf-8"

Right now it's exactly the same as the physical port template,
and there is no way to create a port on anything other than the
netdev.  When the vport_create entry point gets hooked up it will
create lports on top of vport devices, which will use this.

Signed-off-by: Chris Leech <[email protected]>
---

 drivers/scsi/fcoe/fcoe.c |   41 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index e380dd2..0cdfd09 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -79,6 +79,7 @@ static struct notifier_block fcoe_notifier = {
 };

 static struct scsi_transport_template *fcoe_transport_template;
+static struct scsi_transport_template *fcoe_vport_template;

 struct fc_function_template fcoe_transport_function = {
        .show_host_node_name = 1,
@@ -113,6 +114,39 @@ struct fc_function_template fcoe_transport_function = {
        .terminate_rport_io = fc_rport_terminate_io,
 };

+struct fc_function_template fcoe_vport_function = {
+       .show_host_node_name = 1,
+       .show_host_port_name = 1,
+       .show_host_supported_classes = 1,
+       .show_host_supported_fc4s = 1,
+       .show_host_active_fc4s = 1,
+       .show_host_maxframe_size = 1,
+
+       .show_host_port_id = 1,
+       .show_host_supported_speeds = 1,
+       .get_host_speed = fc_get_host_speed,
+       .show_host_speed = 1,
+       .show_host_port_type = 1,
+       .get_host_port_state = fc_get_host_port_state,
+       .show_host_port_state = 1,
+       .show_host_symbolic_name = 1,
+
+       .dd_fcrport_size = sizeof(struct fc_rport_libfc_priv),
+       .show_rport_maxframe_size = 1,
+       .show_rport_supported_classes = 1,
+
+       .show_host_fabric_name = 1,
+       .show_starget_node_name = 1,
+       .show_starget_port_name = 1,
+       .show_starget_port_id = 1,
+       .set_rport_dev_loss_tmo = fc_set_rport_loss_tmo,
+       .show_rport_dev_loss_tmo = 1,
+       .get_fc_host_stats = fc_get_host_stats,
+       .issue_fc_host_lip = fcoe_reset,
+
+       .terminate_rport_io = fc_rport_terminate_io,
+};
+
 static struct scsi_host_template fcoe_shost_template = {
        .module = THIS_MODULE,
        .name = "FCoE Driver",
@@ -438,7 +472,10 @@ static int fcoe_shost_config(struct fc_lport *lp, struct 
Scsi_Host *shost,
        lp->host->max_lun = FCOE_MAX_LUN;
        lp->host->max_id = FCOE_MAX_FCP_TARGET;
        lp->host->max_channel = 0;
-       lp->host->transportt = fcoe_transport_template;
+       if (lp->vn_port)
+               lp->host->transportt = fcoe_vport_template;
+       else
+               lp->host->transportt = fcoe_transport_template;

        /* add the new host to the SCSI-ml */
        rc = scsi_add_host(lp->host, dev);
@@ -674,6 +711,7 @@ static int __init fcoe_if_init(void)
 {
        /* attach to scsi transport */
        fcoe_transport_template = fc_attach_transport(&fcoe_transport_function);
+       fcoe_vport_template = fc_attach_transport(&fcoe_vport_function);

        if (!fcoe_transport_template) {
                printk(KERN_ERR "fcoe: Failed to attach to the FC transport\n");
@@ -691,6 +729,7 @@ static int __init fcoe_if_init(void)
 int __exit fcoe_if_exit(void)
 {
        fc_release_transport(fcoe_transport_template);
+       fc_release_transport(fcoe_vport_template);
        return 0;
 }




------------------------------

_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel


End of devel Digest, Vol 19, Issue 25
*************************************

DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have 
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------
_______________________________________________
devel mailing list
[email protected]
http://www.open-fcoe.org/mailman/listinfo/devel

Reply via email to