2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License (GPL) Version 2 as
10 * published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
19 * fcs_lport.h FCS logical port interfaces
22 #ifndef __FCS_LPORT_H__
23 #define __FCS_LPORT_H__
26 #include <defs/bfa_defs_port.h>
28 #include <fcs/bfa_fcs_lport.h>
29 #include <fcs/bfa_fcs_rport.h>
30 #include <fcs/bfa_fcs_vport.h>
31 #include <fcs_fabric.h>
37 * PID used in P2P/N2N ( In Big Endian)
39 #define N2N_LOCAL_PID 0x010000
40 #define N2N_REMOTE_PID 0x020000
46 * To be used when spawning a timer before retrying a failed command. Milli
49 #define BFA_FCS_RETRY_TIMEOUT 2000
52 * Check for Port/Vport Mode/Role
54 #define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \
55 (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IM)
57 #define BFA_FCS_VPORT_IS_TARGET_MODE(port) \
58 (port->port_cfg.roles & BFA_PORT_ROLE_FCP_TM)
60 #define BFA_FCS_VPORT_IS_IPFC_MODE(port) \
61 (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IPFC)
64 * Is this a Well Known Address
66 #define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
69 * Pointer to elements within Port
71 #define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa)
72 #define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns)
73 #define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn)
74 #define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms)
75 #define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi)
78 * handler for unsolicied frames
80 void bfa_fcs_port_uf_recv(struct bfa_fcs_port_s
*lport
, struct fchs_s
*fchs
,
84 * Following routines will be called by Fabric to indicate port
85 * online/offline to vport.
87 void bfa_fcs_lport_init(struct bfa_fcs_port_s
*lport
, struct bfa_fcs_s
*fcs
,
88 u16 vf_id
, struct bfa_port_cfg_s
*port_cfg
,
89 struct bfa_fcs_vport_s
*vport
);
90 void bfa_fcs_port_online(struct bfa_fcs_port_s
*port
);
91 void bfa_fcs_port_offline(struct bfa_fcs_port_s
*port
);
92 void bfa_fcs_port_delete(struct bfa_fcs_port_s
*port
);
93 bfa_boolean_t
bfa_fcs_port_is_online(struct bfa_fcs_port_s
*port
);
96 * Lookup rport based on PID
98 struct bfa_fcs_rport_s
*bfa_fcs_port_get_rport_by_pid(
99 struct bfa_fcs_port_s
*port
, u32 pid
);
102 * Lookup rport based on PWWN
104 struct bfa_fcs_rport_s
*bfa_fcs_port_get_rport_by_pwwn(
105 struct bfa_fcs_port_s
*port
, wwn_t pwwn
);
106 struct bfa_fcs_rport_s
*bfa_fcs_port_get_rport_by_nwwn(
107 struct bfa_fcs_port_s
*port
, wwn_t nwwn
);
108 void bfa_fcs_port_add_rport(struct bfa_fcs_port_s
*port
,
109 struct bfa_fcs_rport_s
*rport
);
110 void bfa_fcs_port_del_rport(struct bfa_fcs_port_s
*port
,
111 struct bfa_fcs_rport_s
*rport
);
113 void bfa_fcs_port_modinit(struct bfa_fcs_s
*fcs
);
114 void bfa_fcs_port_modexit(struct bfa_fcs_s
*fcs
);
115 void bfa_fcs_port_lip(struct bfa_fcs_port_s
*port
);
117 #endif /* __FCS_LPORT_H__ */