upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / scsi / bfa / include / defs / bfa_defs_tin.h
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 #ifndef __BFA_DEFS_TIN_H__
19 #define __BFA_DEFS_TIN_H__
20
21 #include <protocol/types.h>
22 #include <protocol/fc.h>
23
24 /**
25  * FCS tin states
26  */
27 enum bfa_tin_state_e {
28         BFA_TIN_SM_OFFLINE = 0,         /*  tin is offline */
29         BFA_TIN_SM_WOS_LOGIN = 1,       /*  Waiting PRLI ACC/RJT from ULP */
30         BFA_TIN_SM_WFW_ONLINE = 2,      /*  Waiting ACK to PRLI ACC from FW */
31         BFA_TIN_SM_ONLINE = 3,          /*  tin login is complete */
32         BFA_TIN_SM_WIO_RELOGIN = 4,     /*  tin relogin is in progress */
33         BFA_TIN_SM_WIO_LOGOUT = 5,      /*  Processing of PRLO req from
34                                          *   Initiator is in progress
35                                          */
36         BFA_TIN_SM_WOS_LOGOUT = 6,      /*  Processing of PRLO req from
37                                          *   Initiator is in progress
38                                          */
39         BFA_TIN_SM_WIO_CLEAN = 7,       /*  Waiting for IO cleanup before tin
40                                          *   is offline. This can be triggered
41                                          *   by RPORT LOGO (rcvd/sent) or by
42                                          *   PRLO (rcvd/sent)
43                                          */
44 };
45
46 struct bfa_prli_req_s {
47         struct fchs_s fchs;
48         struct fc_prli_s prli_payload;
49 };
50
51 struct bfa_prlo_req_s {
52         struct fchs_s fchs;
53         struct fc_prlo_s prlo_payload;
54 };
55
56 void bfa_tin_send_login_rsp(void *bfa_tin, u32 login_rsp,
57                                 struct fc_ls_rjt_s rjt_payload);
58 void bfa_tin_send_logout_rsp(void *bfa_tin, u32 logout_rsp,
59                                 struct fc_ls_rjt_s rjt_payload);
60 /**
61  * FCS target port statistics
62  */
63 struct bfa_tin_stats_s {
64         u32 onlines;    /*  ITN nexus onlines (PRLI done) */
65         u32 offlines;   /*  ITN Nexus offlines  */
66         u32 prli_req_parse_err; /*  prli req parsing errors */
67         u32 prli_rsp_rjt;       /*  num prli rsp rejects sent */
68         u32 prli_rsp_acc;       /*  num prli rsp accepts sent */
69         u32 cleanup_comps;      /*  ITN cleanup completions */
70 };
71
72 /**
73  * FCS tin attributes returned in queries
74  */
75 struct bfa_tin_attr_s {
76         enum bfa_tin_state_e state;
77         u8      seq_retry;    /*  Sequence retry supported      */
78         u8      rsvd[3];
79 };
80
81 /**
82  * BFA TIN async event data structure for BFAL
83  */
84 enum bfa_tin_aen_event {
85         BFA_TIN_AEN_ONLINE      = 1,    /*  Target online */
86         BFA_TIN_AEN_OFFLINE     = 2,    /*  Target offline */
87         BFA_TIN_AEN_DISCONNECT  = 3,    /*  Target disconnected */
88 };
89
90 /**
91  * BFA TIN event data structure.
92  */
93 struct bfa_tin_aen_data_s {
94         u16 vf_id;      /*  vf_id of the IT nexus */
95         u16 rsvd[3];
96         wwn_t lpwwn;    /*  WWN of logical port */
97         wwn_t rpwwn;    /*  WWN of remote(target) port */
98 };
99
100 /**
101  * Below APIs are needed from BFA driver
102  * Move these to BFA driver public header file?
103  */
104 /*  TIN rcvd new PRLI & gets bfad_tin_t ptr from driver this callback */
105 void *bfad_tin_rcvd_login_req(void *bfad_tm_port, void *bfa_tin,
106                                 wwn_t rp_wwn, u32 rp_fcid,
107                                 struct bfa_prli_req_s prli_req);
108 /*  TIN rcvd new PRLO */
109 void bfad_tin_rcvd_logout_req(void *bfad_tin, wwn_t rp_wwn, u32 rp_fcid,
110                                 struct bfa_prlo_req_s prlo_req);
111 /*  TIN is online and ready for IO */
112 void bfad_tin_online(void *bfad_tin);
113 /*  TIN is offline and BFA driver can shutdown its upper stack */
114 void bfad_tin_offline(void *bfad_tin);
115 /*  TIN does not need this BFA driver tin tag anymore, so can be freed */
116 void bfad_tin_res_free(void *bfad_tin);
117
118 #endif /* __BFA_DEFS_TIN_H__ */