[SCSI] bfa: remove unused functions and misc cleanups
[linux-2.6-block.git] / drivers / scsi / bfa / bfa_fcs_rport.c
index 635f0cd887145deeb96b2f24914a8622269b3319..711f2d992a979c0bb1f7bb86986b4f7594bde825 100644 (file)
  * General Public License for more details.
  */
 
-/**
+/*
  *  rport.c Remote port implementation.
  */
 
+#include "bfad_drv.h"
 #include "bfa_fcs.h"
 #include "bfa_fcbuild.h"
-#include "bfad_drv.h"
 
 BFA_TRC_FILE(FCS, RPORT);
 
@@ -75,30 +75,6 @@ static void  bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport,
 static void    bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport,
                                struct fchs_s *rx_fchs, u16 len);
 static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport);
-/**
- *  fcs_rport_sm FCS rport state machine events
- */
-
-enum rport_event {
-       RPSM_EVENT_PLOGI_SEND   = 1,    /*  new rport; start with PLOGI */
-       RPSM_EVENT_PLOGI_RCVD   = 2,    /*  Inbound PLOGI from remote port */
-       RPSM_EVENT_PLOGI_COMP   = 3,    /*  PLOGI completed to rport    */
-       RPSM_EVENT_LOGO_RCVD    = 4,    /*  LOGO from remote device     */
-       RPSM_EVENT_LOGO_IMP     = 5,    /*  implicit logo for SLER      */
-       RPSM_EVENT_FCXP_SENT    = 6,    /*  Frame from has been sent    */
-       RPSM_EVENT_DELETE       = 7,    /*  RPORT delete request        */
-       RPSM_EVENT_SCN          = 8,    /*  state change notification   */
-       RPSM_EVENT_ACCEPTED     = 9,    /*  Good response from remote device */
-       RPSM_EVENT_FAILED       = 10,   /*  Request to rport failed.    */
-       RPSM_EVENT_TIMEOUT      = 11,   /*  Rport SM timeout event      */
-       RPSM_EVENT_HCB_ONLINE  = 12,    /*  BFA rport online callback   */
-       RPSM_EVENT_HCB_OFFLINE = 13,    /*  BFA rport offline callback  */
-       RPSM_EVENT_FC4_OFFLINE = 14,    /*  FC-4 offline complete       */
-       RPSM_EVENT_ADDRESS_CHANGE = 15, /*  Rport's PID has changed     */
-       RPSM_EVENT_ADDRESS_DISC = 16,   /*  Need to Discover rport's PID */
-       RPSM_EVENT_PRLO_RCVD   = 17,    /*  PRLO from remote device     */
-       RPSM_EVENT_PLOGI_RETRY = 18,    /*  Retry PLOGI continously */
-};
 
 static void    bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport,
                                        enum rport_event event);
@@ -172,7 +148,7 @@ static struct bfa_sm_table_s rport_sm_table[] = {
        {BFA_SM(bfa_fcs_rport_sm_nsdisc_sent), BFA_RPORT_NSDISC},
 };
 
-/**
+/*
  *             Beginning state.
  */
 static void
@@ -210,7 +186,7 @@ bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *             PLOGI is being sent.
  */
 static void
@@ -262,7 +238,7 @@ bfa_fcs_rport_sm_plogi_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             PLOGI is being sent.
  */
 static void
@@ -287,7 +263,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_PLOGI_RCVD:
        case RPSM_EVENT_SCN:
-               /**
+               /*
                 * Ignore, SCN is possibly online notification.
                 */
                break;
@@ -309,7 +285,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
                break;
 
        case RPSM_EVENT_HCB_OFFLINE:
-               /**
+               /*
                 * Ignore BFA callback, on a PLOGI receive we call bfa offline.
                 */
                break;
@@ -319,7 +295,7 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             PLOGI is sent.
  */
 static void
@@ -380,7 +356,7 @@ bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             PLOGI is sent.
  */
 static void
@@ -475,7 +451,7 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *             PLOGI is complete. Awaiting BFA rport online callback. FC-4s
  *             are offline.
  */
@@ -498,28 +474,28 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        case RPSM_EVENT_LOGO_IMP:
        case RPSM_EVENT_ADDRESS_CHANGE:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        case RPSM_EVENT_PLOGI_RCVD:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                bfa_fcs_rport_send_plogiacc(rport, NULL);
                break;
 
        case RPSM_EVENT_DELETE:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        case RPSM_EVENT_SCN:
-               /**
+               /*
                 * @todo
                 * Ignore SCN - PLOGI just completed, FC-4 login should detect
                 * device failures.
@@ -531,7 +507,7 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is ONLINE. FC-4s active.
  */
 static void
@@ -580,7 +556,7 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *             An SCN event is received in ONLINE state. NS query is being sent
  *             prior to ADISC authentication with rport. FC-4s are paused.
  */
@@ -604,7 +580,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
                break;
 
        case RPSM_EVENT_SCN:
-               /**
+               /*
                 * ignore SCN, wait for response to query itself
                 */
                break;
@@ -638,7 +614,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *     An SCN event is received in ONLINE state. NS query is sent to rport.
  *     FC-4s are paused.
  */
@@ -697,7 +673,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *     An SCN event is received in ONLINE state. ADISC is being sent for
  *     authenticating with rport. FC-4s are paused.
  */
@@ -748,7 +724,7 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             An SCN event is received in ONLINE state. ADISC is to rport.
  *             FC-4s are paused.
  */
@@ -765,7 +741,7 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event)
                break;
 
        case RPSM_EVENT_PLOGI_RCVD:
-               /**
+               /*
                 * Too complex to cleanup FC-4 & rport and then acc to PLOGI.
                 * At least go offline when a PLOGI is received.
                 */
@@ -787,7 +763,7 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event)
                break;
 
        case RPSM_EVENT_SCN:
-               /**
+               /*
                 * already processing RSCN
                 */
                break;
@@ -810,7 +786,7 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *             Rport has sent LOGO. Awaiting FC-4 offline completion callback.
  */
 static void
@@ -824,7 +800,7 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport,
        switch (event) {
        case RPSM_EVENT_FC4_OFFLINE:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        case RPSM_EVENT_DELETE:
@@ -841,7 +817,7 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             LOGO needs to be sent to rport. Awaiting FC-4 offline completion
  *             callback.
  */
@@ -856,7 +832,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
        switch (event) {
        case RPSM_EVENT_FC4_OFFLINE:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        default:
@@ -864,7 +840,7 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *     Rport is going offline. Awaiting FC-4 offline completion callback.
  */
 static void
@@ -878,7 +854,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
        switch (event) {
        case RPSM_EVENT_FC4_OFFLINE:
                bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
-               bfa_rport_offline(rport->bfa_rport);
+               bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
                break;
 
        case RPSM_EVENT_SCN:
@@ -886,7 +862,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
        case RPSM_EVENT_LOGO_RCVD:
        case RPSM_EVENT_PRLO_RCVD:
        case RPSM_EVENT_ADDRESS_CHANGE:
-               /**
+               /*
                 * rport is already going offline.
                 * SCN - ignore and wait till transitioning to offline state
                 */
@@ -901,7 +877,7 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is offline. FC-4s are offline. Awaiting BFA rport offline
  *             callback.
  */
@@ -945,7 +921,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
        case RPSM_EVENT_SCN:
        case RPSM_EVENT_LOGO_RCVD:
        case RPSM_EVENT_PRLO_RCVD:
-               /**
+               /*
                 * Ignore, already offline.
                 */
                break;
@@ -955,7 +931,7 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is offline. FC-4s are offline. Awaiting BFA rport offline
  *             callback to send LOGO accept.
  */
@@ -1009,7 +985,7 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
 
        case RPSM_EVENT_LOGO_RCVD:
        case RPSM_EVENT_PRLO_RCVD:
-               /**
+               /*
                 * Ignore - already processing a LOGO.
                 */
                break;
@@ -1019,7 +995,7 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is being deleted. FC-4s are offline.
  *  Awaiting BFA rport offline
  *             callback to send LOGO.
@@ -1048,7 +1024,7 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is being deleted. FC-4s are offline. LOGO is being sent.
  */
 static void
@@ -1082,7 +1058,7 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport is offline. FC-4s are offline. BFA rport is offline.
  *             Timer active to delete stale rport.
  */
@@ -1142,7 +1118,7 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event)
        }
 }
 
-/**
+/*
  *     Rport address has changed. Nameserver discovery request is being sent.
  */
 static void
@@ -1199,7 +1175,7 @@ bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Nameserver discovery failed. Waiting for timeout to retry.
  */
 static void
@@ -1263,7 +1239,7 @@ bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport,
        }
 }
 
-/**
+/*
  *             Rport address has changed. Nameserver discovery request is sent.
  */
 static void
@@ -1329,13 +1305,13 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
                bfa_fcs_rport_send_prlo_acc(rport);
                break;
        case RPSM_EVENT_SCN:
-               /**
+               /*
                 * ignore, wait for NS query response
                 */
                break;
 
        case RPSM_EVENT_LOGO_RCVD:
-               /**
+               /*
                 * Not logged-in yet. Accept LOGO.
                 */
                bfa_fcs_rport_send_logo_acc(rport);
@@ -1354,7 +1330,7 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
 
 
 
-/**
+/*
  *  fcs_rport_private FCS RPORT provate functions
  */
 
@@ -1415,7 +1391,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
 
        plogi_rsp = (struct fc_logi_s *) BFA_FCXP_RSP_PLD(fcxp);
 
-       /**
+       /*
         * Check for failure first.
         */
        if (plogi_rsp->els_cmd.els_code != FC_ELS_ACC) {
@@ -1436,7 +1412,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
                return;
        }
 
-       /**
+       /*
         * PLOGI is complete. Make sure this device is not one of the known
         * device with a new FC port address.
         */
@@ -1459,7 +1435,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
                        twin->stats.plogi_rcvd    += rport->stats.plogi_rcvd;
                        twin->stats.plogi_accs++;
 
-                       bfa_fcs_rport_delete(rport);
+                       bfa_sm_send_event(rport, RPSM_EVENT_DELETE);
 
                        bfa_fcs_rport_update(twin, plogi_rsp);
                        twin->pid = rsp_fchs->s_id;
@@ -1468,7 +1444,7 @@ bfa_fcs_rport_plogi_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
                }
        }
 
-       /**
+       /*
         * Normal login path -- no evil twins.
         */
        rport->stats.plogi_accs++;
@@ -1621,7 +1597,7 @@ bfa_fcs_rport_gidpn_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
        bfa_trc(rport->fcs, rport->pwwn);
 
        cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
-       cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code);
+       cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
 
        if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
                /* Check if the pid is the same as before. */
@@ -1691,7 +1667,7 @@ bfa_fcs_rport_gpnid_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
        bfa_trc(rport->fcs, rport->pwwn);
 
        cthdr = (struct ct_hdr_s *) BFA_FCXP_RSP_PLD(fcxp);
-       cthdr->cmd_rsp_code = bfa_os_ntohs(cthdr->cmd_rsp_code);
+       cthdr->cmd_rsp_code = be16_to_cpu(cthdr->cmd_rsp_code);
 
        if (cthdr->cmd_rsp_code == CT_RSP_ACCEPT) {
                bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
@@ -1722,7 +1698,7 @@ bfa_fcs_rport_gpnid_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
        }
 }
 
-/**
+/*
  *     Called to send a logout to the rport.
  */
 static void
@@ -1759,7 +1735,7 @@ bfa_fcs_rport_send_logo(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced)
        bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
 }
 
-/**
+/*
  *     Send ACC for a LOGO received.
  */
 static void
@@ -1788,7 +1764,7 @@ bfa_fcs_rport_send_logo_acc(void *rport_cbarg)
                        FC_CLASS_3, len, &fchs, NULL, NULL, FC_MAX_PDUSZ, 0);
 }
 
-/**
+/*
  *     brief
  *     This routine will be called by bfa_timer on timer timeouts.
  *
@@ -1961,7 +1937,7 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
        struct bfa_fcs_rport_s *rport;
        struct bfad_rport_s     *rport_drv;
 
-       /**
+       /*
         * allocate rport
         */
        if (bfa_fcb_rport_alloc(fcs->bfad, &rport, &rport_drv)
@@ -1979,7 +1955,7 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
        rport->pid = rpid;
        rport->pwwn = pwwn;
 
-       /**
+       /*
         * allocate BFA rport
         */
        rport->bfa_rport = bfa_rport_create(port->fcs->bfa, rport);
@@ -1989,7 +1965,7 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
                return NULL;
        }
 
-       /**
+       /*
         * allocate FC-4s
         */
        bfa_assert(bfa_fcs_lport_is_initiator(port));
@@ -1998,7 +1974,8 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid)
                rport->itnim = bfa_fcs_itnim_create(rport);
                if (!rport->itnim) {
                        bfa_trc(fcs, rpid);
-                       bfa_rport_delete(rport->bfa_rport);
+                       bfa_sm_send_event(rport->bfa_rport,
+                                               BFA_RPORT_SM_DELETE);
                        kfree(rport_drv);
                        return NULL;
                }
@@ -2021,7 +1998,7 @@ bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport)
 {
        struct bfa_fcs_lport_s *port = rport->port;
 
-       /**
+       /*
         * - delete FC-4s
         * - delete BFA rport
         * - remove from queue of rports
@@ -2032,7 +2009,7 @@ bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport)
                        bfa_fcs_rpf_rport_offline(rport);
        }
 
-       bfa_rport_delete(rport->bfa_rport);
+       bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE);
        bfa_fcs_lport_del_rport(port, rport);
        kfree(rport->rp_drv);
 }
@@ -2056,7 +2033,7 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport)
        wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port));
        wwn2str(rpwwn_buf, rport->pwwn);
        if (!BFA_FCS_PID_IS_WKA(rport->pid))
-               BFA_LOG(KERN_INFO, bfad, log_level,
+               BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                "Remote port (WWN = %s) online for logical port (WWN = %s)\n",
                rpwwn_buf, lpwwn_buf);
 }
@@ -2075,12 +2052,12 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport)
        wwn2str(rpwwn_buf, rport->pwwn);
        if (!BFA_FCS_PID_IS_WKA(rport->pid)) {
                if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE)
-                       BFA_LOG(KERN_ERR, bfad, log_level,
+                       BFA_LOG(KERN_ERR, bfad, bfa_log_level,
                                "Remote port (WWN = %s) connectivity lost for "
                                "logical port (WWN = %s)\n",
                                rpwwn_buf, lpwwn_buf);
                else
-                       BFA_LOG(KERN_INFO, bfad, log_level,
+                       BFA_LOG(KERN_INFO, bfad, bfa_log_level,
                                "Remote port (WWN = %s) offlined by "
                                "logical port (WWN = %s)\n",
                                rpwwn_buf, lpwwn_buf);
@@ -2093,7 +2070,7 @@ bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport)
        }
 }
 
-/**
+/*
  * Update rport parameters from PLOGI or PLOGI accept.
  */
 static void
@@ -2101,14 +2078,14 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
 {
        bfa_fcs_lport_t *port = rport->port;
 
-       /**
+       /*
         * - port name
         * - node name
         */
        rport->pwwn = plogi->port_name;
        rport->nwwn = plogi->node_name;
 
-       /**
+       /*
         * - class of service
         */
        rport->fc_cos = 0;
@@ -2118,16 +2095,16 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
        if (plogi->class2.class_valid)
                rport->fc_cos |= FC_CLASS_2;
 
-       /**
+       /*
         * - CISC
         * - MAX receive frame size
         */
        rport->cisc = plogi->csp.cisc;
-       rport->maxfrsize = bfa_os_ntohs(plogi->class3.rxsz);
+       rport->maxfrsize = be16_to_cpu(plogi->class3.rxsz);
 
-       bfa_trc(port->fcs, bfa_os_ntohs(plogi->csp.bbcred));
+       bfa_trc(port->fcs, be16_to_cpu(plogi->csp.bbcred));
        bfa_trc(port->fcs, port->fabric->bb_credit);
-       /**
+       /*
         * Direct Attach P2P mode :
         * This is to handle a bug (233476) in IBM targets in Direct Attach
         *  Mode. Basically, in FLOGI Accept the target would have
@@ -2136,19 +2113,19 @@ bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
         * in PLOGI.
         */
        if ((!bfa_fcs_fabric_is_switched(port->fabric))  &&
-               (bfa_os_ntohs(plogi->csp.bbcred) < port->fabric->bb_credit)) {
+               (be16_to_cpu(plogi->csp.bbcred) < port->fabric->bb_credit)) {
 
-               bfa_trc(port->fcs, bfa_os_ntohs(plogi->csp.bbcred));
+               bfa_trc(port->fcs, be16_to_cpu(plogi->csp.bbcred));
                bfa_trc(port->fcs, port->fabric->bb_credit);
 
-               port->fabric->bb_credit = bfa_os_ntohs(plogi->csp.bbcred);
+               port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred);
                bfa_fcport_set_tx_bbcredit(port->fcs->bfa,
                                          port->fabric->bb_credit);
        }
 
 }
 
-/**
+/*
  *     Called to handle LOGO received from an existing remote port.
  */
 static void
@@ -2164,11 +2141,11 @@ bfa_fcs_rport_process_logo(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs)
 
 
 
-/**
+/*
  *  fcs_rport_public FCS rport public interfaces
  */
 
-/**
+/*
  *     Called by bport/vport to create a remote port instance for a discovered
  *     remote device.
  *
@@ -2191,7 +2168,7 @@ bfa_fcs_rport_create(struct bfa_fcs_lport_s *port, u32 rpid)
        return rport;
 }
 
-/**
+/*
  * Called to create a rport for which only the wwn is known.
  *
  * @param[in] port     - base port
@@ -2211,7 +2188,7 @@ bfa_fcs_rport_create_by_wwn(struct bfa_fcs_lport_s *port, wwn_t rpwwn)
        bfa_sm_send_event(rport, RPSM_EVENT_ADDRESS_DISC);
        return rport;
 }
-/**
+/*
  * Called by bport in private loop topology to indicate that a
  * rport has been discovered and plogi has been completed.
  *
@@ -2233,7 +2210,7 @@ bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *fchs,
        bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_COMP);
 }
 
-/**
+/*
  *     Called by bport/vport to handle PLOGI received from a new remote port.
  *     If an existing rport does a plogi, it will be handled separately.
  */
@@ -2272,7 +2249,7 @@ wwn_compare(wwn_t wwn1, wwn_t wwn2)
        return 0;
 }
 
-/**
+/*
  *     Called by bport/vport to handle PLOGI received from an existing
  *      remote port.
  */
@@ -2280,7 +2257,7 @@ void
 bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
                        struct fc_logi_s *plogi)
 {
-       /**
+       /*
         * @todo Handle P2P and initiator-initiator.
         */
 
@@ -2289,7 +2266,7 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
        rport->reply_oxid = rx_fchs->ox_id;
        bfa_trc(rport->fcs, rport->reply_oxid);
 
-       /**
+       /*
         * In Switched fabric topology,
         * PLOGI to each other. If our pwwn is smaller, ignore it,
         * if it is not a well known address.
@@ -2307,40 +2284,8 @@ bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
        bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD);
 }
 
-/**
- * Called by bport/vport to delete a remote port instance.
- *
- * Rport delete is called under the following conditions:
- *             - vport is deleted
- *             - vf is deleted
- *             - explicit request from OS to delete rport
- */
-void
-bfa_fcs_rport_delete(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_DELETE);
-}
-
-/**
- * Called by bport/vport to  when a target goes offline.
- *
- */
-void
-bfa_fcs_rport_offline(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP);
-}
 
-/**
- * Called by bport in n2n when a target (attached port) becomes online.
- *
- */
-void
-bfa_fcs_rport_online(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND);
-}
-/**
+/*
  *     Called by bport/vport to notify SCN for the remote port
  */
 void
@@ -2350,25 +2295,8 @@ bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport)
        bfa_sm_send_event(rport, RPSM_EVENT_SCN);
 }
 
-/**
- *     Called by       fcpim to notify that the ITN cleanup is done.
- */
-void
-bfa_fcs_rport_itnim_ack(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE);
-}
-
-/**
- *     Called by fcptm to notify that the ITN cleanup is done.
- */
-void
-bfa_fcs_rport_tin_ack(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_FC4_OFFLINE);
-}
 
-/**
+/*
  *     brief
  *     This routine BFA callback for bfa_rport_online() call.
  *
@@ -2391,7 +2319,7 @@ bfa_cb_rport_online(void *cbarg)
        bfa_sm_send_event(rport, RPSM_EVENT_HCB_ONLINE);
 }
 
-/**
+/*
  *     brief
  *     This routine BFA callback for bfa_rport_offline() call.
  *
@@ -2413,7 +2341,7 @@ bfa_cb_rport_offline(void *cbarg)
        bfa_sm_send_event(rport, RPSM_EVENT_HCB_OFFLINE);
 }
 
-/**
+/*
  *     brief
  *     This routine is a static BFA callback when there is a QoS flow_id
  *     change notification
@@ -2437,7 +2365,7 @@ bfa_cb_rport_qos_scn_flowid(void *cbarg,
        bfa_trc(rport->fcs, rport->pwwn);
 }
 
-/**
+/*
  *     brief
  *     This routine is a static BFA callback when there is a QoS priority
  *     change notification
@@ -2461,16 +2389,7 @@ bfa_cb_rport_qos_scn_prio(void *cbarg,
        bfa_trc(rport->fcs, rport->pwwn);
 }
 
-/**
- *             Called to process any unsolicted frames from this remote port
- */
-void
-bfa_fcs_rport_logo_imp(struct bfa_fcs_rport_s *rport)
-{
-       bfa_sm_send_event(rport, RPSM_EVENT_LOGO_IMP);
-}
-
-/**
+/*
  *             Called to process any unsolicted frames from this remote port
  */
 void
@@ -2577,7 +2496,7 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
                        FC_MAX_PDUSZ, 0);
 }
 
-/**
+/*
  * Return state of rport.
  */
 int
@@ -2586,7 +2505,8 @@ bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport)
        return bfa_sm_to_state(rport_sm_table, rport->sm);
 }
 
-/**
+
+/*
  *     brief
  *              Called by the Driver to set rport delete/ageout timeout
  *
@@ -2602,7 +2522,7 @@ bfa_fcs_rport_set_del_timeout(u8 rport_tmo)
                bfa_fcs_rport_del_timeout = rport_tmo * 1000;
 }
 void
-bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, u16 ox_id)
+bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id)
 {
        bfa_trc(rport->fcs, rport->pid);
 
@@ -2613,114 +2533,14 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, u16 ox_id)
 
 
 
-/**
+/*
  * Remote port implementation.
  */
 
-/**
+/*
  *  fcs_rport_api FCS rport API.
  */
 
-/**
- *     Direct API to add a target by port wwn. This interface is used, for
- *     example, by bios when target pwwn is known from boot lun configuration.
- */
-bfa_status_t
-bfa_fcs_rport_add(struct bfa_fcs_lport_s *port, wwn_t *pwwn,
-               struct bfa_fcs_rport_s *rport, struct bfad_rport_s *rport_drv)
-{
-       bfa_trc(port->fcs, *pwwn);
-
-       return BFA_STATUS_OK;
-}
-
-/**
- *     Direct API to remove a target and its associated resources. This
- *     interface is used, for example, by driver to remove target
- *     ports from the target list for a VM.
- */
-bfa_status_t
-bfa_fcs_rport_remove(struct bfa_fcs_rport_s *rport_in)
-{
-
-       struct bfa_fcs_rport_s *rport;
-
-       bfa_trc(rport_in->fcs, rport_in->pwwn);
-
-       rport = bfa_fcs_lport_get_rport_by_pwwn(rport_in->port, rport_in->pwwn);
-       if (rport == NULL) {
-               /*
-                * TBD Error handling
-                */
-               bfa_trc(rport_in->fcs, rport_in->pid);
-               return BFA_STATUS_UNKNOWN_RWWN;
-       }
-
-       /*
-        * TBD if this remote port is online, send a logo
-        */
-       return BFA_STATUS_OK;
-
-}
-
-/**
- *     Remote device status for display/debug.
- */
-void
-bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
-                       struct bfa_rport_attr_s *rport_attr)
-{
-       struct bfa_rport_qos_attr_s qos_attr;
-       bfa_fcs_lport_t *port = rport->port;
-       bfa_port_speed_t rport_speed = rport->rpf.rpsc_speed;
-
-       bfa_os_memset(rport_attr, 0, sizeof(struct bfa_rport_attr_s));
-
-       rport_attr->pid = rport->pid;
-       rport_attr->pwwn = rport->pwwn;
-       rport_attr->nwwn = rport->nwwn;
-       rport_attr->cos_supported = rport->fc_cos;
-       rport_attr->df_sz = rport->maxfrsize;
-       rport_attr->state = bfa_fcs_rport_get_state(rport);
-       rport_attr->fc_cos = rport->fc_cos;
-       rport_attr->cisc = rport->cisc;
-       rport_attr->scsi_function = rport->scsi_function;
-       rport_attr->curr_speed  = rport->rpf.rpsc_speed;
-       rport_attr->assigned_speed  = rport->rpf.assigned_speed;
-
-       bfa_rport_get_qos_attr(rport->bfa_rport, &qos_attr);
-       rport_attr->qos_attr = qos_attr;
-
-       rport_attr->trl_enforced = BFA_FALSE;
-       if (bfa_fcport_is_ratelim(port->fcs->bfa)) {
-               if (rport_speed == BFA_PORT_SPEED_UNKNOWN) {
-                       /* Use default ratelim speed setting */
-                       rport_speed =
-                               bfa_fcport_get_ratelim_speed(rport->fcs->bfa);
-               }
-
-               if (rport_speed < bfa_fcs_lport_get_rport_max_speed(port))
-                       rport_attr->trl_enforced = BFA_TRUE;
-       }
-}
-
-/**
- *     Per remote device statistics.
- */
-void
-bfa_fcs_rport_get_stats(struct bfa_fcs_rport_s *rport,
-                       struct bfa_rport_stats_s *stats)
-{
-       *stats = rport->stats;
-}
-
-void
-bfa_fcs_rport_clear_stats(struct bfa_fcs_rport_s *rport)
-{
-       bfa_os_memset((char *)&rport->stats, 0,
-                       sizeof(struct bfa_rport_stats_s));
-}
-
 struct bfa_fcs_rport_s *
 bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port, wwn_t rpwwn)
 {
@@ -2752,22 +2572,6 @@ bfa_fcs_rport_lookup_by_nwwn(struct bfa_fcs_lport_s *port, wwn_t rnwwn)
 }
 
 /*
- * This API is to set the Rport's speed. Should be used when RPSC is not
- * supported by the rport.
- */
-void
-bfa_fcs_rport_set_speed(struct bfa_fcs_rport_s *rport, bfa_port_speed_t speed)
-{
-       rport->rpf.assigned_speed  = speed;
-
-       /* Set this speed in f/w only if the RPSC speed is not available */
-       if (rport->rpf.rpsc_speed == BFA_PORT_SPEED_UNKNOWN)
-               bfa_rport_speed(rport->bfa_rport, speed);
-}
-
-
-
-/**
  * Remote port features (RPF) implementation.
  */
 
@@ -2786,7 +2590,7 @@ static void     bfa_fcs_rpf_rpsc2_response(void *fcsarg,
 
 static void     bfa_fcs_rpf_timeout(void *arg);
 
-/**
+/*
  *  fcs_rport_ftrs_sm FCS rport state machine events
  */
 
@@ -2827,7 +2631,7 @@ bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
        case RPFSM_EVENT_RPORT_ONLINE:
                /* Send RPSC2 to a Brocade fabric only. */
                if ((!BFA_FCS_PID_IS_WKA(rport->pid)) &&
-                       ((bfa_lps_is_brcd_fabric(rport->port->fabric->lps)) ||
+                       ((rport->port->fabric->lps->brcd_switch) ||
                        (bfa_fcs_fabric_get_switch_oui(fabric) ==
                                                BFA_FCS_BRCD_SWITCH_OUI))) {
                        bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending);
@@ -2981,7 +2785,7 @@ bfa_fcs_rpf_sm_offline(struct bfa_fcs_rpf_s *rpf, enum rpf_event event)
                bfa_sm_fault(rport->fcs, event);
        }
 }
-/**
+/*
  * Called when Rport is created.
  */
 void
@@ -2995,7 +2799,7 @@ bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport)
        bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_uninit);
 }
 
-/**
+/*
  * Called when Rport becomes online
  */
 void
@@ -3010,7 +2814,7 @@ bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport)
                bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_ONLINE);
 }
 
-/**
+/*
  * Called when Rport becomes offline
  */
 void
@@ -3090,16 +2894,16 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
        rpsc2_acc = (struct fc_rpsc2_acc_s *) BFA_FCXP_RSP_PLD(fcxp);
        if (rpsc2_acc->els_cmd == FC_ELS_ACC) {
                rport->stats.rpsc_accs++;
-               num_ents = bfa_os_ntohs(rpsc2_acc->num_pids);
+               num_ents = be16_to_cpu(rpsc2_acc->num_pids);
                bfa_trc(rport->fcs, num_ents);
                if (num_ents > 0) {
                        bfa_assert(rpsc2_acc->port_info[0].pid != rport->pid);
                        bfa_trc(rport->fcs,
-                               bfa_os_ntohs(rpsc2_acc->port_info[0].pid));
+                               be16_to_cpu(rpsc2_acc->port_info[0].pid));
                        bfa_trc(rport->fcs,
-                               bfa_os_ntohs(rpsc2_acc->port_info[0].speed));
+                               be16_to_cpu(rpsc2_acc->port_info[0].speed));
                        bfa_trc(rport->fcs,
-                               bfa_os_ntohs(rpsc2_acc->port_info[0].index));
+                               be16_to_cpu(rpsc2_acc->port_info[0].index));
                        bfa_trc(rport->fcs,
                                rpsc2_acc->port_info[0].type);
 
@@ -3109,7 +2913,7 @@ bfa_fcs_rpf_rpsc2_response(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
                        }
 
                        rpf->rpsc_speed = fc_rpsc_operspeed_to_bfa_speed(
-                               bfa_os_ntohs(rpsc2_acc->port_info[0].speed));
+                               be16_to_cpu(rpsc2_acc->port_info[0].speed));
 
                        bfa_sm_send_event(rpf, RPFSM_EVENT_RPSC_COMP);
                }