]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_attr.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_attr.c
index 1276bd77b99586299b6e428bfe78060a57bf872f..acae7c48ef7dabeead41c41976e2ca5adb5a7912 100644 (file)
@@ -1,31 +1,29 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
- * Enterprise Fibre Channel Host Bus Adapters.                     *
- * Refer to the README file included with this package for         *
- * driver version and adapter support.                             *
- * Copyright (C) 2004 Emulex Corporation.                          *
+ * Fibre Channel Host Bus Adapters.                                *
+ * Copyright (C) 2004-2005 Emulex.  All rights reserved.           *
+ * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
+ * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
  *                                                                 *
  * This program is free software; you can redistribute it and/or   *
- * modify it under the terms of the GNU General Public License     *
- * as published by the Free Software Foundation; either version 2  *
- * of the License, or (at your option) any later version.          *
- *                                                                 *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of  *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
- * GNU General Public License for more details, a copy of which    *
- * can be found in the file COPYING included with this package.    *
+ * modify it under the terms of version 2 of the GNU General       *
+ * Public License as published by the Free Software Foundation.    *
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package.                                     *
  *******************************************************************/
 
-/*
- * $Id: lpfc_attr.c 1.24 2005/04/13 11:58:55EDT sf_support Exp  $
- */
-
 #include <linux/ctype.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 
+#include <scsi/scsi.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
@@ -968,21 +966,21 @@ static void
 lpfc_get_host_fabric_name (struct Scsi_Host *shost)
 {
        struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0];
-       u64 nodename;
+       u64 node_name;
 
        spin_lock_irq(shost->host_lock);
 
        if ((phba->fc_flag & FC_FABRIC) ||
            ((phba->fc_topology == TOPOLOGY_LOOP) &&
             (phba->fc_flag & FC_PUBLIC_LOOP)))
-               memcpy(&nodename, &phba->fc_fabparam.nodeName, sizeof(u64));
+               node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
        else
                /* fabric is local port if there is no F/FL_Port */
-               memcpy(&nodename, &phba->fc_nodename, sizeof(u64));
+               node_name = wwn_to_u64(phba->fc_nodename.u.wwn);
 
        spin_unlock_irq(shost->host_lock);
 
-       fc_host_fabric_name(shost) = be64_to_cpu(nodename);
+       fc_host_fabric_name(shost) = node_name;
 }
 
 
@@ -991,8 +989,7 @@ lpfc_get_stats(struct Scsi_Host *shost)
 {
        struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
        struct lpfc_sli *psli = &phba->sli;
-       struct fc_host_statistics *hs =
-                       (struct fc_host_statistics *)phba->link_stats;
+       struct fc_host_statistics *hs = &phba->link_stats;
        LPFC_MBOXQ_t *pmboxq;
        MAILBOX_t *pmb;
        int rc=0;
@@ -1023,6 +1020,8 @@ lpfc_get_stats(struct Scsi_Host *shost)
                return NULL;
        }
 
+       memset(hs, 0, sizeof (struct fc_host_statistics));
+
        hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt;
        hs->tx_words = (pmb->un.varRdStatus.xmitByteCnt * 256);
        hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt;
@@ -1104,21 +1103,20 @@ lpfc_get_starget_node_name(struct scsi_target *starget)
 {
        struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
        struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0];
-       uint64_t node_name = 0;
+       u64 node_name = 0;
        struct lpfc_nodelist *ndlp = NULL;
 
        spin_lock_irq(shost->host_lock);
        /* Search the mapped list for this target ID */
        list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
                if (starget->id == ndlp->nlp_sid) {
-                       memcpy(&node_name, &ndlp->nlp_nodename,
-                                               sizeof(struct lpfc_name));
+                       node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
                        break;
                }
        }
        spin_unlock_irq(shost->host_lock);
 
-       fc_starget_node_name(starget) = be64_to_cpu(node_name);
+       fc_starget_node_name(starget) = node_name;
 }
 
 static void
@@ -1126,21 +1124,20 @@ lpfc_get_starget_port_name(struct scsi_target *starget)
 {
        struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
        struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0];
-       uint64_t port_name = 0;
+       u64 port_name = 0;
        struct lpfc_nodelist *ndlp = NULL;
 
        spin_lock_irq(shost->host_lock);
        /* Search the mapped list for this target ID */
        list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
                if (starget->id == ndlp->nlp_sid) {
-                       memcpy(&port_name, &ndlp->nlp_portname,
-                                               sizeof(struct lpfc_name));
+                       port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
                        break;
                }
        }
        spin_unlock_irq(shost->host_lock);
 
-       fc_starget_port_name(starget) = be64_to_cpu(port_name);
+       fc_starget_port_name(starget) = port_name;
 }
 
 static void