Commit f16a1750 authored by Maggie Zhang's avatar Maggie Zhang Committed by James Bottomley

[SCSI] bfa: remove all OS wrappers

Remove OS wrapper functions/macros, and as a result remove bfa_os_inc.h.
Signed-off-by: default avatarMaggie Zhang <xmzhang@brocade.com>
Signed-off-by: default avatarJing Huang <huangj@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent f314878a
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#ifndef __BFA_H__ #ifndef __BFA_H__
#define __BFA_H__ #define __BFA_H__
#include "bfa_os_inc.h" #include "bfad_drv.h"
#include "bfa_cs.h" #include "bfa_cs.h"
#include "bfa_plog.h" #include "bfa_plog.h"
#include "bfa_defs_svc.h" #include "bfa_defs_svc.h"
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfi_ctreg.h" #include "bfi_ctreg.h"
#include "bfad_drv.h"
BFA_TRC_FILE(HAL, CORE); BFA_TRC_FILE(HAL, CORE);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef __BFA_CS_H__ #ifndef __BFA_CS_H__
#define __BFA_CS_H__ #define __BFA_CS_H__
#include "bfa_os_inc.h" #include "bfad_drv.h"
/* /*
* BFA TRC * BFA TRC
...@@ -32,12 +32,20 @@ ...@@ -32,12 +32,20 @@
#define BFA_TRC_MAX (4 * 1024) #define BFA_TRC_MAX (4 * 1024)
#endif #endif
#define BFA_TRC_TS(_trcm) \
({ \
struct timeval tv; \
\
do_gettimeofday(&tv); \
(tv.tv_sec*1000000+tv.tv_usec); \
})
#ifndef BFA_TRC_TS #ifndef BFA_TRC_TS
#define BFA_TRC_TS(_trcm) ((_trcm)->ticks++) #define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)
#endif #endif
struct bfa_trc_s { struct bfa_trc_s {
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u16 fileno; u16 fileno;
u16 line; u16 line;
#else #else
...@@ -361,4 +369,43 @@ bfa_wc_wait(struct bfa_wc_s *wc) ...@@ -361,4 +369,43 @@ bfa_wc_wait(struct bfa_wc_s *wc)
bfa_wc_down(wc); bfa_wc_down(wc);
} }
static inline void
wwn2str(char *wwn_str, u64 wwn)
{
union {
u64 wwn;
u8 byte[8];
} w;
w.wwn = wwn;
sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0],
w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5],
w.byte[6], w.byte[7]);
}
static inline void
fcid2str(char *fcid_str, u32 fcid)
{
union {
u32 fcid;
u8 byte[4];
} f;
f.fcid = fcid;
sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]);
}
#define bfa_swap_3b(_x) \
((((_x) & 0xff) << 16) | \
((_x) & 0x00ff00) | \
(((_x) & 0xff0000) >> 16))
#ifndef __BIG_ENDIAN
#define bfa_hton3b(_x) bfa_swap_3b(_x)
#else
#define bfa_hton3b(_x) (_x)
#endif
#define bfa_ntoh3b(_x) bfa_hton3b(_x)
#endif /* __BFA_CS_H__ */ #endif /* __BFA_CS_H__ */
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#define __BFA_DEFS_H__ #define __BFA_DEFS_H__
#include "bfa_fc.h" #include "bfa_fc.h"
#include "bfa_os_inc.h" #include "bfad_drv.h"
#define BFA_MFG_SERIALNUM_SIZE 11 #define BFA_MFG_SERIALNUM_SIZE 11
#define STRSZ(_n) (((_n) + 4) & ~3) #define STRSZ(_n) (((_n) + 4) & ~3)
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#ifndef __BFA_FC_H__ #ifndef __BFA_FC_H__
#define __BFA_FC_H__ #define __BFA_FC_H__
#include "bfa_os_inc.h" #include "bfad_drv.h"
typedef u64 wwn_t; typedef u64 wwn_t;
...@@ -62,7 +62,7 @@ struct scsi_cdb_s { ...@@ -62,7 +62,7 @@ struct scsi_cdb_s {
* Fibre Channel Header Structure (FCHS) definition * Fibre Channel Header Structure (FCHS) definition
*/ */
struct fchs_s { struct fchs_s {
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 routing:4; /* routing bits */ u32 routing:4; /* routing bits */
u32 cat_info:4; /* category info */ u32 cat_info:4; /* category info */
#else #else
...@@ -317,7 +317,7 @@ struct fc_plogi_csp_s { ...@@ -317,7 +317,7 @@ struct fc_plogi_csp_s {
u8 verlo; /* FC-PH low version */ u8 verlo; /* FC-PH low version */
__be16 bbcred; /* BB_Credit */ __be16 bbcred; /* BB_Credit */
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u8 ciro:1, /* continuously increasing RO */ u8 ciro:1, /* continuously increasing RO */
rro:1, /* random relative offset */ rro:1, /* random relative offset */
npiv_supp:1, /* NPIV supported */ npiv_supp:1, /* NPIV supported */
...@@ -367,7 +367,7 @@ struct fc_plogi_csp_s { ...@@ -367,7 +367,7 @@ struct fc_plogi_csp_s {
* FC-PH-x. Figure 78. pg. 318. * FC-PH-x. Figure 78. pg. 318.
*/ */
struct fc_plogi_clp_s { struct fc_plogi_clp_s {
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 class_valid:1; u32 class_valid:1;
u32 intermix:1; /* class intermix supported if set =1. u32 intermix:1; /* class intermix supported if set =1.
* valid only for class1. Reserved for * valid only for class1. Reserved for
...@@ -532,7 +532,7 @@ struct fc_rsi_s { ...@@ -532,7 +532,7 @@ struct fc_rsi_s {
*/ */
struct fc_prli_params_s { struct fc_prli_params_s {
u32 reserved:16; u32 reserved:16;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 reserved1:5; u32 reserved1:5;
u32 rec_support:1; u32 rec_support:1;
u32 task_retry_id:1; u32 task_retry_id:1;
...@@ -574,7 +574,7 @@ enum { ...@@ -574,7 +574,7 @@ enum {
struct fc_prli_params_page_s { struct fc_prli_params_page_s {
u32 type:8; u32 type:8;
u32 codext:8; u32 codext:8;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 origprocasv:1; u32 origprocasv:1;
u32 rsppav:1; u32 rsppav:1;
u32 imagepair:1; u32 imagepair:1;
...@@ -610,7 +610,7 @@ struct fc_prli_s { ...@@ -610,7 +610,7 @@ struct fc_prli_s {
struct fc_prlo_params_page_s { struct fc_prlo_params_page_s {
u32 type:8; u32 type:8;
u32 type_ext:8; u32 type_ext:8;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 opa_valid:1; /* originator process associator u32 opa_valid:1; /* originator process associator
* valid * valid
*/ */
...@@ -646,7 +646,7 @@ struct fc_prlo_acc_params_page_s { ...@@ -646,7 +646,7 @@ struct fc_prlo_acc_params_page_s {
u32 type:8; u32 type:8;
u32 type_ext:8; u32 type_ext:8;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 opa_valid:1; /* originator process associator u32 opa_valid:1; /* originator process associator
* valid * valid
*/ */
...@@ -803,7 +803,7 @@ struct fc_tprlo_params_page_s { ...@@ -803,7 +803,7 @@ struct fc_tprlo_params_page_s {
u32 type:8; u32 type:8;
u32 type_ext:8; u32 type_ext:8;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 opa_valid:1; u32 opa_valid:1;
u32 rpa_valid:1; u32 rpa_valid:1;
u32 tpo_nport_valid:1; u32 tpo_nport_valid:1;
...@@ -1177,7 +1177,7 @@ struct fc_srr_s { ...@@ -1177,7 +1177,7 @@ struct fc_srr_s {
struct fcp_cmnd_s { struct fcp_cmnd_s {
struct scsi_lun lun; /* 64-bit LU number */ struct scsi_lun lun; /* 64-bit LU number */
u8 crn; /* command reference number */ u8 crn; /* command reference number */
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u8 resvd:1, u8 resvd:1,
priority:4, /* FCP-3: SAM-3 priority */ priority:4, /* FCP-3: SAM-3 priority */
taskattr:3; /* scsi task attribute */ taskattr:3; /* scsi task attribute */
...@@ -1187,7 +1187,7 @@ struct fcp_cmnd_s { ...@@ -1187,7 +1187,7 @@ struct fcp_cmnd_s {
resvd:1; resvd:1;
#endif #endif
u8 tm_flags; /* task management flags */ u8 tm_flags; /* task management flags */
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u8 addl_cdb_len:6, /* additional CDB length words */ u8 addl_cdb_len:6, /* additional CDB length words */
iodir:2; /* read/write FCP_DATA IUs */ iodir:2; /* read/write FCP_DATA IUs */
#else #else
...@@ -1273,7 +1273,7 @@ struct fcp_rspinfo_s { ...@@ -1273,7 +1273,7 @@ struct fcp_rspinfo_s {
struct fcp_resp_s { struct fcp_resp_s {
u32 reserved[2]; /* 2 words reserved */ u32 reserved[2]; /* 2 words reserved */
u16 reserved2; u16 reserved2;
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u8 reserved3:3; u8 reserved3:3;
u8 fcp_conf_req:1; /* FCP_CONF is requested */ u8 fcp_conf_req:1; /* FCP_CONF is requested */
u8 resid_flags:2; /* underflow/overflow */ u8 resid_flags:2; /* underflow/overflow */
......
This diff is collapsed.
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#ifndef __FCBUILD_H__ #ifndef __FCBUILD_H__
#define __FCBUILD_H__ #define __FCBUILD_H__
#include "bfa_os_inc.h" #include "bfad_drv.h"
#include "bfa_fc.h" #include "bfa_fc.h"
#include "bfa_defs_fcs.h" #include "bfa_defs_fcs.h"
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfa_os_inc.h"
BFA_TRC_FILE(HAL, FCPIM); BFA_TRC_FILE(HAL, FCPIM);
BFA_MODULE(fcpim); BFA_MODULE(fcpim);
...@@ -1560,24 +1560,6 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim) ...@@ -1560,24 +1560,6 @@ bfa_itnim_hold_io(struct bfa_itnim_s *itnim)
bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable)); bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable));
} }
bfa_status_t
bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
struct bfa_itnim_ioprofile_s *ioprofile)
{
struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(itnim->bfa);
if (!fcpim->io_profile)
return BFA_STATUS_IOPROFILE_OFF;
itnim->ioprofile.index = BFA_IOBUCKET_MAX;
itnim->ioprofile.io_profile_start_time =
bfa_io_profile_start_time(itnim->bfa);
itnim->ioprofile.clock_res_mul = bfa_io_lat_clock_res_mul;
itnim->ioprofile.clock_res_div = bfa_io_lat_clock_res_div;
*ioprofile = itnim->ioprofile;
return BFA_STATUS_OK;
}
void void
bfa_itnim_clear_stats(struct bfa_itnim_s *itnim) bfa_itnim_clear_stats(struct bfa_itnim_s *itnim)
{ {
...@@ -2352,7 +2334,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) ...@@ -2352,7 +2334,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
scsi_for_each_sg(cmnd, sg, ioim->nsges, i) { scsi_for_each_sg(cmnd, sg, ioim->nsges, i) {
if (i == 0) { if (i == 0) {
/* build inline IO SG element */ /* build inline IO SG element */
addr = bfa_os_sgaddr(sg_dma_address(sg)); addr = bfa_sgaddr_le(sg_dma_address(sg));
sge->sga = *(union bfi_addr_u *) &addr; sge->sga = *(union bfi_addr_u *) &addr;
pgdlen = sg_dma_len(sg); pgdlen = sg_dma_len(sg);
sge->sg_len = pgdlen; sge->sg_len = pgdlen;
...@@ -2364,7 +2346,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim) ...@@ -2364,7 +2346,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
if (sge_id == 0) if (sge_id == 0)
sgpge = sgpg->sgpg->sges; sgpge = sgpg->sgpg->sges;
addr = bfa_os_sgaddr(sg_dma_address(sg)); addr = bfa_sgaddr_le(sg_dma_address(sg));
sgpge->sga = *(union bfi_addr_u *) &addr; sgpge->sga = *(union bfi_addr_u *) &addr;
sgpge->sg_len = sg_dma_len(sg); sgpge->sg_len = sg_dma_len(sg);
pgcumsz += sgpge->sg_len; pgcumsz += sgpge->sg_len;
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* bfa_fcs.c BFA FCS main * bfa_fcs.c BFA FCS main
*/ */
#include "bfad_drv.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
#include "bfa_fcbuild.h" #include "bfa_fcbuild.h"
#include "bfad_drv.h"
BFA_TRC_FILE(FCS, FCS); BFA_TRC_FILE(FCS, FCS);
...@@ -1097,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, ...@@ -1097,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
* external loopback cable is in place. Our own FLOGI frames are * external loopback cable is in place. Our own FLOGI frames are
* sometimes looped back when switch port gets temporarily bypassed. * sometimes looped back when switch port gets temporarily bypassed.
*/ */
if ((pid == bfa_os_ntoh3b(FC_FABRIC_PORT)) && if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) &&
(els_cmd->els_code == FC_ELS_FLOGI) && (els_cmd->els_code == FC_ELS_FLOGI) &&
(flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) {
bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK);
...@@ -1107,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs, ...@@ -1107,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
/* /*
* FLOGI/EVFP exchanges should be consumed by base fabric. * FLOGI/EVFP exchanges should be consumed by base fabric.
*/ */
if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) {
bfa_trc(fabric->fcs, pid); bfa_trc(fabric->fcs, pid);
bfa_fcs_fabric_process_uf(fabric, fchs, len); bfa_fcs_fabric_process_uf(fabric, fchs, len);
return; return;
...@@ -1220,7 +1220,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) ...@@ -1220,7 +1220,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
return; return;
reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
bfa_os_hton3b(FC_FABRIC_PORT), bfa_hton3b(FC_FABRIC_PORT),
n2n_port->reply_oxid, pcfg->pwwn, n2n_port->reply_oxid, pcfg->pwwn,
pcfg->nwwn, pcfg->nwwn,
bfa_fcport_get_maxfrsize(bfa), bfa_fcport_get_maxfrsize(bfa),
......
...@@ -61,7 +61,7 @@ struct bfa_fcs_s; ...@@ -61,7 +61,7 @@ struct bfa_fcs_s;
#define N2N_LOCAL_PID 0x010000 #define N2N_LOCAL_PID 0x010000
#define N2N_REMOTE_PID 0x020000 #define N2N_REMOTE_PID 0x020000
#define BFA_FCS_RETRY_TIMEOUT 2000 #define BFA_FCS_RETRY_TIMEOUT 2000
#define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0) #define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* fcpim.c - FCP initiator mode i-t nexus state machine * fcpim.c - FCP initiator mode i-t nexus state machine
*/ */
#include "bfad_drv.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
#include "bfa_fcbuild.h" #include "bfa_fcbuild.h"
#include "bfad_drv.h"
#include "bfad_im.h" #include "bfad_im.h"
BFA_TRC_FILE(FCS, FCPIM); BFA_TRC_FILE(FCS, FCPIM);
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
#include "bfa_fcbuild.h" #include "bfa_fcbuild.h"
#include "bfa_fc.h" #include "bfa_fc.h"
#include "bfad_drv.h"
BFA_TRC_FILE(FCS, PORT); BFA_TRC_FILE(FCS, PORT);
...@@ -2818,7 +2818,7 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced) ...@@ -2818,7 +2818,7 @@ bfa_fcs_lport_ms_send_plogi(void *ms_cbarg, struct bfa_fcxp_s *fcxp_alloced)
ms->fcxp = fcxp; ms->fcxp = fcxp;
len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
bfa_os_hton3b(FC_MGMT_SERVER), bfa_hton3b(FC_MGMT_SERVER),
bfa_fcs_lport_get_fcid(port), 0, bfa_fcs_lport_get_fcid(port), 0,
port->port_cfg.pwwn, port->port_cfg.nwwn, port->port_cfg.pwwn, port->port_cfg.nwwn,
bfa_fcport_get_maxfrsize(port->fcs->bfa)); bfa_fcport_get_maxfrsize(port->fcs->bfa));
...@@ -3575,7 +3575,7 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); ...@@ -3575,7 +3575,7 @@ fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs);
ns->fcxp = fcxp; ns->fcxp = fcxp;
len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
bfa_os_hton3b(FC_NAME_SERVER), bfa_hton3b(FC_NAME_SERVER),
bfa_fcs_lport_get_fcid(port), 0, bfa_fcs_lport_get_fcid(port), 0,
port->port_cfg.pwwn, port->port_cfg.nwwn, port->port_cfg.pwwn, port->port_cfg.nwwn,
bfa_fcport_get_maxfrsize(port->fcs->bfa)); bfa_fcport_get_maxfrsize(port->fcs->bfa));
...@@ -4654,7 +4654,7 @@ bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index, ...@@ -4654,7 +4654,7 @@ bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn, int index,
while ((qe != qh) && (i < nrports)) { while ((qe != qh) && (i < nrports)) {
rport = (struct bfa_fcs_rport_s *) qe; rport = (struct bfa_fcs_rport_s *) qe;
if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { if (bfa_ntoh3b(rport->pid) > 0xFFF000) {
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
bfa_trc(fcs, (u32) rport->pwwn); bfa_trc(fcs, (u32) rport->pwwn);
bfa_trc(fcs, rport->pid); bfa_trc(fcs, rport->pid);
...@@ -4702,7 +4702,7 @@ bfa_fcs_lport_get_rports(struct bfa_fcs_lport_s *port, ...@@ -4702,7 +4702,7 @@ bfa_fcs_lport_get_rports(struct bfa_fcs_lport_s *port,
while ((qe != qh) && (i < *nrports)) { while ((qe != qh) && (i < *nrports)) {
rport = (struct bfa_fcs_rport_s *) qe; rport = (struct bfa_fcs_rport_s *) qe;
if (bfa_os_ntoh3b(rport->pid) > 0xFFF000) { if (bfa_ntoh3b(rport->pid) > 0xFFF000) {
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
bfa_trc(fcs, (u32) rport->pwwn); bfa_trc(fcs, (u32) rport->pwwn);
bfa_trc(fcs, rport->pid); bfa_trc(fcs, rport->pid);
...@@ -4753,7 +4753,7 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port) ...@@ -4753,7 +4753,7 @@ bfa_fcs_lport_get_rport_max_speed(bfa_fcs_lport_t *port)
while (qe != qh) { while (qe != qh) {
rport = (struct bfa_fcs_rport_s *) qe; rport = (struct bfa_fcs_rport_s *) qe;
if ((bfa_os_ntoh3b(rport->pid) > 0xFFF000) || if ((bfa_ntoh3b(rport->pid) > 0xFFF000) ||
(bfa_fcs_rport_get_state(rport) == (bfa_fcs_rport_get_state(rport) ==
BFA_RPORT_OFFLINE)) { BFA_RPORT_OFFLINE)) {
qe = bfa_q_next(qe); qe = bfa_q_next(qe);
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
* rport.c Remote port implementation. * rport.c Remote port implementation.
*/ */
#include "bfad_drv.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
#include "bfa_fcbuild.h" #include "bfa_fcbuild.h"
#include "bfad_drv.h"
BFA_TRC_FILE(FCS, RPORT); BFA_TRC_FILE(FCS, RPORT);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfi_cbreg.h" #include "bfi_cbreg.h"
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfi_ctreg.h" #include "bfi_ctreg.h"
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_ioc.h" #include "bfa_ioc.h"
#include "bfi_ctreg.h" #include "bfi_ctreg.h"
#include "bfa_defs.h" #include "bfa_defs.h"
#include "bfa_defs_svc.h" #include "bfa_defs_svc.h"
#include "bfad_drv.h"
BFA_TRC_FILE(CNA, IOC); BFA_TRC_FILE(CNA, IOC);
...@@ -1428,12 +1428,12 @@ static void ...@@ -1428,12 +1428,12 @@ static void
bfa_ioc_send_enable(struct bfa_ioc_s *ioc) bfa_ioc_send_enable(struct bfa_ioc_s *ioc)
{ {
struct bfi_ioc_ctrl_req_s enable_req; struct bfi_ioc_ctrl_req_s enable_req;
struct bfa_timeval_s tv; struct timeval tv;
bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ, bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ,
bfa_ioc_portid(ioc)); bfa_ioc_portid(ioc));
enable_req.ioc_class = ioc->ioc_mc; enable_req.ioc_class = ioc->ioc_mc;
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
enable_req.tv_sec = be32_to_cpu(tv.tv_sec); enable_req.tv_sec = be32_to_cpu(tv.tv_sec);
bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s)); bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req_s));
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#ifndef __BFA_IOC_H__ #ifndef __BFA_IOC_H__
#define __BFA_IOC_H__ #define __BFA_IOC_H__
#include "bfa_os_inc.h" #include "bfad_drv.h"
#include "bfa_cs.h" #include "bfa_cs.h"
#include "bfi.h" #include "bfi.h"
...@@ -74,7 +74,7 @@ struct bfa_sge_s { ...@@ -74,7 +74,7 @@ struct bfa_sge_s {
#define bfa_swap_words(_x) ( \ #define bfa_swap_words(_x) ( \
((_x) << 32) | ((_x) >> 32)) ((_x) << 32) | ((_x) >> 32))
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
#define bfa_sge_to_be(_x) #define bfa_sge_to_be(_x)
#define bfa_sge_to_le(_x) bfa_sge_word_swap(_x) #define bfa_sge_to_le(_x) bfa_sge_word_swap(_x)
#define bfa_sgaddr_le(_x) bfa_swap_words(_x) #define bfa_sgaddr_le(_x) bfa_swap_words(_x)
...@@ -120,7 +120,7 @@ static inline void ...@@ -120,7 +120,7 @@ static inline void
__bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa) __bfa_dma_addr_set(union bfi_addr_u *dma_addr, u64 pa)
{ {
dma_addr->a32.addr_lo = (__be32) pa; dma_addr->a32.addr_lo = (__be32) pa;
dma_addr->a32.addr_hi = (__be32) (bfa_os_u32(pa)); dma_addr->a32.addr_hi = (__be32) (pa >> 32);
} }
...@@ -130,7 +130,7 @@ static inline void ...@@ -130,7 +130,7 @@ static inline void
__bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa) __bfa_dma_be_addr_set(union bfi_addr_u *dma_addr, u64 pa)
{ {
dma_addr->a32.addr_lo = cpu_to_be32(pa); dma_addr->a32.addr_lo = cpu_to_be32(pa);
dma_addr->a32.addr_hi = cpu_to_be32(bfa_os_u32(pa)); dma_addr->a32.addr_hi = cpu_to_be32(pa >> 32);
} }
struct bfa_ioc_regs_s { struct bfa_ioc_regs_s {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_ioc.h" #include "bfa_ioc.h"
#include "bfi_cbreg.h" #include "bfi_cbreg.h"
#include "bfa_defs.h" #include "bfa_defs.h"
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_ioc.h" #include "bfa_ioc.h"
#include "bfi_ctreg.h" #include "bfi_ctreg.h"
#include "bfa_defs.h" #include "bfa_defs.h"
......
/*
* Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
* All rights reserved
* www.brocade.com
*
* Linux driver for Brocade Fibre Channel Host Bus Adapter.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) Version 2 as
* published by the Free Software Foundation
*
* 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.
*/
#ifndef __BFA_OS_INC_H__
#define __BFA_OS_INC_H__
#include <linux/types.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/scsi_transport.h>
#ifdef __BIG_ENDIAN
#define __BIGENDIAN
#endif
static inline u64 bfa_os_get_log_time(void)
{
u64 system_time = 0;
struct timeval tv;
do_gettimeofday(&tv);
/* We are interested in seconds only. */
system_time = tv.tv_sec;
return system_time;
}
#define bfa_io_lat_clock_res_div HZ
#define bfa_io_lat_clock_res_mul 1000
#define BFA_LOG(level, bfad, mask, fmt, arg...) \
do { \
if (((mask) == 4) || (level[1] <= '4')) \
dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \
} while (0)
#define bfa_swap_3b(_x) \
((((_x) & 0xff) << 16) | \
((_x) & 0x00ff00) | \
(((_x) & 0xff0000) >> 16))
#define bfa_os_swap_sgaddr(_x) ((u64)( \
(((u64)(_x) & (u64)0x00000000000000ffull) << 32) | \
(((u64)(_x) & (u64)0x000000000000ff00ull) << 32) | \
(((u64)(_x) & (u64)0x0000000000ff0000ull) << 32) | \
(((u64)(_x) & (u64)0x00000000ff000000ull) << 32) | \
(((u64)(_x) & (u64)0x000000ff00000000ull) >> 32) | \
(((u64)(_x) & (u64)0x0000ff0000000000ull) >> 32) | \
(((u64)(_x) & (u64)0x00ff000000000000ull) >> 32) | \
(((u64)(_x) & (u64)0xff00000000000000ull) >> 32)))
#ifndef __BIGENDIAN
#define bfa_os_hton3b(_x) bfa_swap_3b(_x)
#define bfa_os_sgaddr(_x) (_x)
#else
#define bfa_os_hton3b(_x) (_x)
#define bfa_os_sgaddr(_x) bfa_os_swap_sgaddr(_x)
#endif
#define bfa_os_ntoh3b(_x) bfa_os_hton3b(_x)
#define bfa_os_u32(__pa64) ((__pa64) >> 32)
#define BFA_TRC_TS(_trcm) \
({ \
struct timeval tv; \
\
do_gettimeofday(&tv); \
(tv.tv_sec*1000000+tv.tv_usec); \
})
#define boolean_t int
/*
* For current time stamp, OS API will fill-in
*/
struct bfa_timeval_s {
u32 tv_sec; /* seconds */
u32 tv_usec; /* microseconds */
};
static inline void
bfa_os_gettimeofday(struct bfa_timeval_s *tv)
{
struct timeval tmp_tv;
do_gettimeofday(&tmp_tv);
tv->tv_sec = (u32) tmp_tv.tv_sec;
tv->tv_usec = (u32) tmp_tv.tv_usec;
}
static inline void
wwn2str(char *wwn_str, u64 wwn)
{
union {
u64 wwn;
u8 byte[8];
} w;
w.wwn = wwn;
sprintf(wwn_str, "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", w.byte[0],
w.byte[1], w.byte[2], w.byte[3], w.byte[4], w.byte[5],
w.byte[6], w.byte[7]);
}
static inline void
fcid2str(char *fcid_str, u32 fcid)
{
union {
u32 fcid;
u8 byte[4];
} f;
f.fcid = fcid;
sprintf(fcid_str, "%02x:%02x:%02x", f.byte[1], f.byte[2], f.byte[3]);
}
#endif /* __BFA_OS_INC_H__ */
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfad_drv.h"
#include "bfa_defs_svc.h" #include "bfa_defs_svc.h"
#include "bfa_port.h" #include "bfa_port.h"
#include "bfi.h" #include "bfi.h"
...@@ -36,7 +37,7 @@ bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats) ...@@ -36,7 +37,7 @@ bfa_port_stats_swap(struct bfa_port_s *port, union bfa_port_stats_u *stats)
i += 2) { i += 2) {
t0 = dip[i]; t0 = dip[i];
t1 = dip[i + 1]; t1 = dip[i + 1];
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
dip[i] = be32_to_cpu(t0); dip[i] = be32_to_cpu(t0);
dip[i + 1] = be32_to_cpu(t1); dip[i + 1] = be32_to_cpu(t1);
#else #else
...@@ -96,13 +97,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) ...@@ -96,13 +97,13 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
port->stats_busy = BFA_FALSE; port->stats_busy = BFA_FALSE;
if (status == BFA_STATUS_OK) { if (status == BFA_STATUS_OK) {
struct bfa_timeval_s tv; struct timeval tv;
memcpy(port->stats, port->stats_dma.kva, memcpy(port->stats, port->stats_dma.kva,
sizeof(union bfa_port_stats_u)); sizeof(union bfa_port_stats_u));
bfa_port_stats_swap(port, port->stats); bfa_port_stats_swap(port, port->stats);
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time; port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time;
} }
...@@ -124,7 +125,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status) ...@@ -124,7 +125,7 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
static void static void
bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
{ {
struct bfa_timeval_s tv; struct timeval tv;
port->stats_status = status; port->stats_status = status;
port->stats_busy = BFA_FALSE; port->stats_busy = BFA_FALSE;
...@@ -132,7 +133,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status) ...@@ -132,7 +133,7 @@ bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
/* /*
* re-initialize time stamp for stats reset * re-initialize time stamp for stats reset
*/ */
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
port->stats_reset_time = tv.tv_sec; port->stats_reset_time = tv.tv_sec;
if (port->stats_cbfn) { if (port->stats_cbfn) {
...@@ -432,7 +433,7 @@ void ...@@ -432,7 +433,7 @@ void
bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
void *dev, struct bfa_trc_mod_s *trcmod) void *dev, struct bfa_trc_mod_s *trcmod)
{ {
struct bfa_timeval_s tv; struct timeval tv;
bfa_assert(port); bfa_assert(port);
...@@ -452,7 +453,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, ...@@ -452,7 +453,7 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc,
/* /*
* initialize time stamp for stats reset * initialize time stamp for stats reset
*/ */
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
port->stats_reset_time = tv.tv_sec; port->stats_reset_time = tv.tv_sec;
bfa_trc(port, 0); bfa_trc(port, 0);
......
...@@ -15,11 +15,10 @@ ...@@ -15,11 +15,10 @@
* General Public License for more details. * General Public License for more details.
*/ */
#include "bfa_os_inc.h" #include "bfad_drv.h"
#include "bfa_plog.h" #include "bfa_plog.h"
#include "bfa_cs.h" #include "bfa_cs.h"
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfad_drv.h"
BFA_TRC_FILE(HAL, FCXP); BFA_TRC_FILE(HAL, FCXP);
BFA_MODULE(fcxp); BFA_MODULE(fcxp);
...@@ -286,6 +285,18 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec) ...@@ -286,6 +285,18 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec)
return 0; return 0;
} }
static u64
bfa_get_log_time(void)
{
u64 system_time = 0;
struct timeval tv;
do_gettimeofday(&tv);
/* We are interested in seconds only. */
system_time = tv.tv_sec;
return system_time;
}
static void static void
bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
{ {
...@@ -306,7 +317,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) ...@@ -306,7 +317,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec)
memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s));
pl_recp->tv = bfa_os_get_log_time(); pl_recp->tv = bfa_get_log_time();
BFA_PL_LOG_REC_INCR(plog->tail); BFA_PL_LOG_REC_INCR(plog->tail);
if (plog->head == plog->tail) if (plog->head == plog->tail)
...@@ -2728,7 +2739,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, ...@@ -2728,7 +2739,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
struct bfa_port_cfg_s *port_cfg = &fcport->cfg; struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
struct bfa_fcport_ln_s *ln = &fcport->ln; struct bfa_fcport_ln_s *ln = &fcport->ln;
struct bfa_timeval_s tv; struct timeval tv;
memset(fcport, 0, sizeof(struct bfa_fcport_s)); memset(fcport, 0, sizeof(struct bfa_fcport_s));
fcport->bfa = bfa; fcport->bfa = bfa;
...@@ -2742,7 +2753,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, ...@@ -2742,7 +2753,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
/* /*
* initialize time stamp for stats reset * initialize time stamp for stats reset
*/ */
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
fcport->stats_reset_time = tv.tv_sec; fcport->stats_reset_time = tv.tv_sec;
/* /*
...@@ -2967,7 +2978,7 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d, ...@@ -2967,7 +2978,7 @@ bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d,
for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32)); for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32));
i = i + 2) { i = i + 2) {
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
dip[i] = be32_to_cpu(sip[i]); dip[i] = be32_to_cpu(sip[i]);
dip[i + 1] = be32_to_cpu(sip[i + 1]); dip[i + 1] = be32_to_cpu(sip[i + 1]);
#else #else
...@@ -2984,7 +2995,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) ...@@ -2984,7 +2995,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
if (complete) { if (complete) {
if (fcport->stats_status == BFA_STATUS_OK) { if (fcport->stats_status == BFA_STATUS_OK) {
struct bfa_timeval_s tv; struct timeval tv;
/* Swap FC QoS or FCoE stats */ /* Swap FC QoS or FCoE stats */
if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
...@@ -2996,7 +3007,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete) ...@@ -2996,7 +3007,7 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
&fcport->stats_ret->fcoe, &fcport->stats_ret->fcoe,
&fcport->stats->fcoe); &fcport->stats->fcoe);
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
fcport->stats_ret->fcoe.secs_reset = fcport->stats_ret->fcoe.secs_reset =
tv.tv_sec - fcport->stats_reset_time; tv.tv_sec - fcport->stats_reset_time;
} }
...@@ -3055,12 +3066,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete) ...@@ -3055,12 +3066,12 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
struct bfa_fcport_s *fcport = cbarg; struct bfa_fcport_s *fcport = cbarg;
if (complete) { if (complete) {
struct bfa_timeval_s tv; struct timeval tv;
/* /*
* re-initialize time stamp for stats reset * re-initialize time stamp for stats reset
*/ */
bfa_os_gettimeofday(&tv); do_gettimeofday(&tv);
fcport->stats_reset_time = tv.tv_sec; fcport->stats_reset_time = tv.tv_sec;
fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status); fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
...@@ -4930,10 +4941,6 @@ bfa_uf_start(struct bfa_s *bfa) ...@@ -4930,10 +4941,6 @@ bfa_uf_start(struct bfa_s *bfa)
bfa_uf_post_all(BFA_UF_MOD(bfa)); bfa_uf_post_all(BFA_UF_MOD(bfa));
} }
/*
* hal_uf_api
*/
/* /*
* Register handler for all unsolicted recieve frames. * Register handler for all unsolicted recieve frames.
* *
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "bfad_drv.h" #include "bfad_drv.h"
#include "bfad_im.h" #include "bfad_im.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
#include "bfa_os_inc.h"
#include "bfa_defs.h" #include "bfa_defs.h"
#include "bfa.h" #include "bfa.h"
...@@ -1102,15 +1101,15 @@ bfad_start_ops(struct bfad_s *bfad) { ...@@ -1102,15 +1101,15 @@ bfad_start_ops(struct bfad_s *bfad) {
/* /*
* If bfa_linkup_delay is set to -1 default; try to retrive the * If bfa_linkup_delay is set to -1 default; try to retrive the
* value using the bfad_os_get_linkup_delay(); else use the * value using the bfad_get_linkup_delay(); else use the
* passed in module param value as the bfa_linkup_delay. * passed in module param value as the bfa_linkup_delay.
*/ */
if (bfa_linkup_delay < 0) { if (bfa_linkup_delay < 0) {
bfa_linkup_delay = bfad_os_get_linkup_delay(bfad); bfa_linkup_delay = bfad_get_linkup_delay(bfad);
bfad_os_rport_online_wait(bfad); bfad_rport_online_wait(bfad);
bfa_linkup_delay = -1; bfa_linkup_delay = -1;
} else } else
bfad_os_rport_online_wait(bfad); bfad_rport_online_wait(bfad);
BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n"); BFA_LOG(KERN_INFO, bfad, bfa_log_level, "bfa device claimed\n");
......
...@@ -40,7 +40,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget) ...@@ -40,7 +40,7 @@ bfad_im_get_starget_port_id(struct scsi_target *starget)
bfad = im_port->bfad; bfad = im_port->bfad;
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
itnim = bfad_os_get_itnim(im_port, starget->id); itnim = bfad_get_itnim(im_port, starget->id);
if (itnim) if (itnim)
fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim); fc_id = bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim);
...@@ -66,7 +66,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget) ...@@ -66,7 +66,7 @@ bfad_im_get_starget_node_name(struct scsi_target *starget)
bfad = im_port->bfad; bfad = im_port->bfad;
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
itnim = bfad_os_get_itnim(im_port, starget->id); itnim = bfad_get_itnim(im_port, starget->id);
if (itnim) if (itnim)
node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim); node_name = bfa_fcs_itnim_get_nwwn(&itnim->fcs_itnim);
...@@ -92,7 +92,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget) ...@@ -92,7 +92,7 @@ bfad_im_get_starget_port_name(struct scsi_target *starget)
bfad = im_port->bfad; bfad = im_port->bfad;
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
itnim = bfad_os_get_itnim(im_port, starget->id); itnim = bfad_get_itnim(im_port, starget->id);
if (itnim) if (itnim)
port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim); port_name = bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim);
...@@ -111,7 +111,7 @@ bfad_im_get_host_port_id(struct Scsi_Host *shost) ...@@ -111,7 +111,7 @@ bfad_im_get_host_port_id(struct Scsi_Host *shost)
struct bfad_port_s *port = im_port->port; struct bfad_port_s *port = im_port->port;
fc_host_port_id(shost) = fc_host_port_id(shost) =
bfa_os_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port)); bfa_hton3b(bfa_fcs_lport_get_fcid(port->fcs_port));
} }
/* /*
...@@ -487,7 +487,7 @@ bfad_im_vport_delete(struct fc_vport *fc_vport) ...@@ -487,7 +487,7 @@ bfad_im_vport_delete(struct fc_vport *fc_vport)
wait_for_completion(vport->comp_del); wait_for_completion(vport->comp_del);
free_scsi_host: free_scsi_host:
bfad_os_scsi_host_free(bfad, im_port); bfad_scsi_host_free(bfad, im_port);
kfree(vport); kfree(vport);
......
...@@ -26,7 +26,23 @@ ...@@ -26,7 +26,23 @@
#ifndef __BFAD_DRV_H__ #ifndef __BFAD_DRV_H__
#define __BFAD_DRV_H__ #define __BFAD_DRV_H__
#include "bfa_os_inc.h" #include <linux/types.h>
#include <linux/version.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/cdev.h>
#include <linux/fs.h>
#include <linux/delay.h>
#include <linux/vmalloc.h>
#include <linux/workqueue.h>
#include <linux/bitops.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_tcq.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/scsi_transport.h>
#include "bfa_modules.h" #include "bfa_modules.h"
#include "bfa_fcs.h" #include "bfa_fcs.h"
...@@ -272,19 +288,12 @@ do { \ ...@@ -272,19 +288,12 @@ do { \
} while (0) } while (0)
#define list_remove_head(list, entry, type, member) \ #define BFA_LOG(level, bfad, mask, fmt, arg...) \
do { \ do { \
entry = NULL; \ if (((mask) == 4) || (level[1] <= '4')) \
if (!list_empty(list)) { \ dev_printk(level, &((bfad)->pcidev)->dev, fmt, ##arg); \
entry = list_entry((list)->next, type, member); \
list_del_init(&entry->member); \
} \
} while (0) } while (0)
#define list_get_first(list, type, member) \
((list_empty(list)) ? NULL : \
list_entry((list)->next, type, member))
bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id, bfa_status_t bfad_vport_create(struct bfad_s *bfad, u16 vf_id,
struct bfa_lport_cfg_s *port_cfg, struct bfa_lport_cfg_s *port_cfg,
struct device *dev); struct device *dev);
...@@ -316,8 +325,8 @@ void bfad_debugfs_exit(struct bfad_port_s *port); ...@@ -316,8 +325,8 @@ void bfad_debugfs_exit(struct bfad_port_s *port);
void bfad_pci_remove(struct pci_dev *pdev); void bfad_pci_remove(struct pci_dev *pdev);
int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid); int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid);
void bfad_os_rport_online_wait(struct bfad_s *bfad); void bfad_rport_online_wait(struct bfad_s *bfad);
int bfad_os_get_linkup_delay(struct bfad_s *bfad); int bfad_get_linkup_delay(struct bfad_s *bfad);
int bfad_install_msix_handler(struct bfad_s *bfad); int bfad_install_msix_handler(struct bfad_s *bfad);
extern struct idr bfad_im_port_index; extern struct idr bfad_im_port_index;
......
...@@ -92,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio, ...@@ -92,10 +92,10 @@ bfa_cb_ioim_done(void *drv, struct bfad_ioim_s *dio,
if (!cmnd->result && itnim && if (!cmnd->result && itnim &&
(bfa_lun_queue_depth > cmnd->device->queue_depth)) { (bfa_lun_queue_depth > cmnd->device->queue_depth)) {
/* Queue depth adjustment for good status completion */ /* Queue depth adjustment for good status completion */
bfad_os_ramp_up_qdepth(itnim, cmnd->device); bfad_ramp_up_qdepth(itnim, cmnd->device);
} else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) { } else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) {
/* qfull handling */ /* qfull handling */
bfad_os_handle_qfull(itnim, cmnd->device); bfad_handle_qfull(itnim, cmnd->device);
} }
} }
...@@ -123,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio) ...@@ -123,7 +123,7 @@ bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)
if (itnim_data) { if (itnim_data) {
itnim = itnim_data->itnim; itnim = itnim_data->itnim;
if (itnim) if (itnim)
bfad_os_ramp_up_qdepth(itnim, cmnd->device); bfad_ramp_up_qdepth(itnim, cmnd->device);
} }
} }
...@@ -366,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd) ...@@ -366,7 +366,7 @@ bfad_im_reset_bus_handler(struct scsi_cmnd *cmnd)
spin_lock_irqsave(&bfad->bfad_lock, flags); spin_lock_irqsave(&bfad->bfad_lock, flags);
for (i = 0; i < MAX_FCP_TARGET; i++) { for (i = 0; i < MAX_FCP_TARGET; i++) {
itnim = bfad_os_get_itnim(im_port, i); itnim = bfad_get_itnim(im_port, i);
if (itnim) { if (itnim) {
cmnd->SCp.ptr = (char *)&wq; cmnd->SCp.ptr = (char *)&wq;
rc = bfad_im_target_reset_send(bfad, cmnd, itnim); rc = bfad_im_target_reset_send(bfad, cmnd, itnim);
...@@ -547,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, ...@@ -547,7 +547,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
mutex_unlock(&bfad_mutex); mutex_unlock(&bfad_mutex);
im_port->shost = bfad_os_scsi_host_alloc(im_port, bfad); im_port->shost = bfad_scsi_host_alloc(im_port, bfad);
if (!im_port->shost) { if (!im_port->shost) {
error = 1; error = 1;
goto out_free_idr; goto out_free_idr;
...@@ -573,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, ...@@ -573,7 +573,7 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port,
} }
/* setup host fixed attribute if the lk supports */ /* setup host fixed attribute if the lk supports */
bfad_os_fc_host_init(im_port); bfad_fc_host_init(im_port);
return 0; return 0;
...@@ -684,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad) ...@@ -684,7 +684,7 @@ bfad_im_probe(struct bfad_s *bfad)
bfad->im = im; bfad->im = im;
im->bfad = bfad; im->bfad = bfad;
if (bfad_os_thread_workq(bfad) != BFA_STATUS_OK) { if (bfad_thread_workq(bfad) != BFA_STATUS_OK) {
kfree(im); kfree(im);
rc = BFA_STATUS_FAILED; rc = BFA_STATUS_FAILED;
} }
...@@ -697,14 +697,14 @@ void ...@@ -697,14 +697,14 @@ void
bfad_im_probe_undo(struct bfad_s *bfad) bfad_im_probe_undo(struct bfad_s *bfad)
{ {
if (bfad->im) { if (bfad->im) {
bfad_os_destroy_workq(bfad->im); bfad_destroy_workq(bfad->im);
kfree(bfad->im); kfree(bfad->im);
bfad->im = NULL; bfad->im = NULL;
} }
} }
struct Scsi_Host * struct Scsi_Host *
bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
{ {
struct scsi_host_template *sht; struct scsi_host_template *sht;
...@@ -719,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) ...@@ -719,7 +719,7 @@ bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad)
} }
void void
bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) bfad_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
{ {
if (!(im_port->flags & BFAD_PORT_DELETE)) if (!(im_port->flags & BFAD_PORT_DELETE))
flush_workqueue(bfad->im->drv_workq); flush_workqueue(bfad->im->drv_workq);
...@@ -729,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port) ...@@ -729,7 +729,7 @@ bfad_os_scsi_host_free(struct bfad_s *bfad, struct bfad_im_port_s *im_port)
} }
void void
bfad_os_destroy_workq(struct bfad_im_s *im) bfad_destroy_workq(struct bfad_im_s *im)
{ {
if (im && im->drv_workq) { if (im && im->drv_workq) {
flush_workqueue(im->drv_workq); flush_workqueue(im->drv_workq);
...@@ -739,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im) ...@@ -739,7 +739,7 @@ bfad_os_destroy_workq(struct bfad_im_s *im)
} }
bfa_status_t bfa_status_t
bfad_os_thread_workq(struct bfad_s *bfad) bfad_thread_workq(struct bfad_s *bfad)
{ {
struct bfad_im_s *im = bfad->im; struct bfad_im_s *im = bfad->im;
...@@ -843,7 +843,7 @@ bfad_im_module_exit(void) ...@@ -843,7 +843,7 @@ bfad_im_module_exit(void)
} }
void void
bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
{ {
struct scsi_device *tmp_sdev; struct scsi_device *tmp_sdev;
...@@ -871,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev) ...@@ -871,7 +871,7 @@ bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
} }
void void
bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
{ {
struct scsi_device *tmp_sdev; struct scsi_device *tmp_sdev;
...@@ -885,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev) ...@@ -885,7 +885,7 @@ bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev)
} }
struct bfad_itnim_s * struct bfad_itnim_s *
bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id) bfad_get_itnim(struct bfad_im_port_s *im_port, int id)
{ {
struct bfad_itnim_s *itnim = NULL; struct bfad_itnim_s *itnim = NULL;
...@@ -946,7 +946,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa) ...@@ -946,7 +946,7 @@ bfad_im_supported_speeds(struct bfa_s *bfa)
} }
void void
bfad_os_fc_host_init(struct bfad_im_port_s *im_port) bfad_fc_host_init(struct bfad_im_port_s *im_port)
{ {
struct Scsi_Host *host = im_port->shost; struct Scsi_Host *host = im_port->shost;
struct bfad_s *bfad = im_port->bfad; struct bfad_s *bfad = im_port->bfad;
...@@ -990,7 +990,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim) ...@@ -990,7 +990,7 @@ bfad_im_fc_rport_add(struct bfad_im_port_s *im_port, struct bfad_itnim_s *itnim)
rport_ids.port_name = rport_ids.port_name =
cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim)); cpu_to_be64(bfa_fcs_itnim_get_pwwn(&itnim->fcs_itnim));
rport_ids.port_id = rport_ids.port_id =
bfa_os_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim)); bfa_hton3b(bfa_fcs_itnim_get_fcid(&itnim->fcs_itnim));
rport_ids.roles = FC_RPORT_ROLE_UNKNOWN; rport_ids.roles = FC_RPORT_ROLE_UNKNOWN;
itnim->fc_rport = fc_rport = itnim->fc_rport = fc_rport =
...@@ -1192,7 +1192,7 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd ...@@ -1192,7 +1192,7 @@ bfad_im_queuecommand_lck(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd
static DEF_SCSI_QCMD(bfad_im_queuecommand) static DEF_SCSI_QCMD(bfad_im_queuecommand)
void void
bfad_os_rport_online_wait(struct bfad_s *bfad) bfad_rport_online_wait(struct bfad_s *bfad)
{ {
int i; int i;
int rport_delay = 10; int rport_delay = 10;
...@@ -1220,7 +1220,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad) ...@@ -1220,7 +1220,7 @@ bfad_os_rport_online_wait(struct bfad_s *bfad)
} }
int int
bfad_os_get_linkup_delay(struct bfad_s *bfad) bfad_get_linkup_delay(struct bfad_s *bfad)
{ {
u8 nwwns = 0; u8 nwwns = 0;
wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX]; wwn_t wwns[BFA_PREBOOT_BOOTLUN_MAX];
......
...@@ -117,17 +117,17 @@ struct bfad_im_s { ...@@ -117,17 +117,17 @@ struct bfad_im_s {
char drv_workq_name[KOBJ_NAME_LEN]; char drv_workq_name[KOBJ_NAME_LEN];
}; };
struct Scsi_Host *bfad_os_scsi_host_alloc(struct bfad_im_port_s *im_port, struct Scsi_Host *bfad_scsi_host_alloc(struct bfad_im_port_s *im_port,
struct bfad_s *); struct bfad_s *);
bfa_status_t bfad_os_thread_workq(struct bfad_s *bfad); bfa_status_t bfad_thread_workq(struct bfad_s *bfad);
void bfad_os_destroy_workq(struct bfad_im_s *im); void bfad_destroy_workq(struct bfad_im_s *im);
void bfad_os_fc_host_init(struct bfad_im_port_s *im_port); void bfad_fc_host_init(struct bfad_im_port_s *im_port);
void bfad_os_scsi_host_free(struct bfad_s *bfad, void bfad_scsi_host_free(struct bfad_s *bfad,
struct bfad_im_port_s *im_port); struct bfad_im_port_s *im_port);
void bfad_os_ramp_up_qdepth(struct bfad_itnim_s *itnim, void bfad_ramp_up_qdepth(struct bfad_itnim_s *itnim,
struct scsi_device *sdev); struct scsi_device *sdev);
void bfad_os_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev); void bfad_handle_qfull(struct bfad_itnim_s *itnim, struct scsi_device *sdev);
struct bfad_itnim_s *bfad_os_get_itnim(struct bfad_im_port_s *im_port, int id); struct bfad_itnim_s *bfad_get_itnim(struct bfad_im_port_s *im_port, int id);
extern struct scsi_host_template bfad_im_scsi_host_template; extern struct scsi_host_template bfad_im_scsi_host_template;
extern struct scsi_host_template bfad_im_vport_template; extern struct scsi_host_template bfad_im_vport_template;
......
...@@ -104,7 +104,7 @@ union bfi_addr_u { ...@@ -104,7 +104,7 @@ union bfi_addr_u {
* Scatter Gather Element * Scatter Gather Element
*/ */
struct bfi_sge_s { struct bfi_sge_s {
#ifdef __BIGENDIAN #ifdef __BIG_ENDIAN
u32 flags:2, u32 flags:2,
rsvd:2, rsvd:2,
sg_len:28; sg_len:28;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment