Commit | Line | Data |
---|---|---|
7725ccfd JH |
1 | /* |
2 | * Copyright (c) 2005-2009 Brocade Communications Systems, Inc. | |
3 | * All rights reserved | |
4 | * www.brocade.com | |
5 | * | |
6 | * Linux driver for Brocade Fibre Channel Host Bus Adapter. | |
7 | * | |
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 | |
11 | * | |
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. | |
16 | */ | |
17 | ||
18 | /** | |
19 | * fcs_lport.h FCS logical port interfaces | |
20 | */ | |
21 | ||
22 | #ifndef __FCS_LPORT_H__ | |
23 | #define __FCS_LPORT_H__ | |
24 | ||
25 | #define __VPORT_H__ | |
26 | #include <defs/bfa_defs_port.h> | |
27 | #include <bfa_svc.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> | |
32 | #include <fcs_ms.h> | |
33 | #include <cs/bfa_q.h> | |
34 | #include <fcbuild.h> | |
35 | ||
36 | /* | |
37 | * PID used in P2P/N2N ( In Big Endian) | |
38 | */ | |
39 | #define N2N_LOCAL_PID 0x010000 | |
40 | #define N2N_REMOTE_PID 0x020000 | |
41 | ||
42 | /* | |
43 | * Misc Timeouts | |
44 | */ | |
45 | /* | |
46 | * To be used when spawning a timer before retrying a failed command. Milli | |
47 | * Secs. | |
48 | */ | |
49 | #define BFA_FCS_RETRY_TIMEOUT 2000 | |
50 | ||
51 | /* | |
52 | * Check for Port/Vport Mode/Role | |
53 | */ | |
54 | #define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \ | |
55 | (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IM) | |
56 | ||
57 | #define BFA_FCS_VPORT_IS_TARGET_MODE(port) \ | |
58 | (port->port_cfg.roles & BFA_PORT_ROLE_FCP_TM) | |
59 | ||
60 | #define BFA_FCS_VPORT_IS_IPFC_MODE(port) \ | |
61 | (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IPFC) | |
62 | ||
63 | /* | |
64 | * Is this a Well Known Address | |
65 | */ | |
66 | #define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0) | |
67 | ||
68 | /* | |
69 | * Pointer to elements within Port | |
70 | */ | |
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) | |
76 | ||
77 | /* | |
78 | * handler for unsolicied frames | |
79 | */ | |
80 | void bfa_fcs_port_uf_recv(struct bfa_fcs_port_s *lport, struct fchs_s *fchs, | |
81 | u16 len); | |
82 | ||
83 | /* | |
84 | * Following routines will be called by Fabric to indicate port | |
85 | * online/offline to vport. | |
86 | */ | |
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); | |
94 | ||
95 | /* | |
96 | * Lookup rport based on PID | |
97 | */ | |
98 | struct bfa_fcs_rport_s *bfa_fcs_port_get_rport_by_pid( | |
99 | struct bfa_fcs_port_s *port, u32 pid); | |
100 | ||
101 | /* | |
102 | * Lookup rport based on PWWN | |
103 | */ | |
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); | |
112 | ||
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); | |
116 | ||
117 | #endif /* __FCS_LPORT_H__ */ |