[SCSI] bfa: fix prli retry issues
[pandora-kernel.git] / drivers / scsi / bfa / include / fcs / bfa_fcs_fcpim.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 /**
19  *  bfa_fcs_fcpim.h BFA FCS FCP Initiator Mode interfaces/defines.
20  */
21
22 #ifndef __BFA_FCS_FCPIM_H__
23 #define __BFA_FCS_FCPIM_H__
24
25 #include <defs/bfa_defs_status.h>
26 #include <defs/bfa_defs_itnim.h>
27 #include <fcs/bfa_fcs.h>
28 #include <fcs/bfa_fcs_rport.h>
29 #include <fcs/bfa_fcs_lport.h>
30 #include <bfa_fcpim.h>
31
32 /*
33  * forward declarations
34  */
35 struct bfad_itnim_s;
36
37 struct bfa_fcs_itnim_s {
38         bfa_sm_t                sm;             /*  state machine */
39         struct bfa_fcs_rport_s  *rport;         /*  parent remote rport  */
40         struct bfad_itnim_s     *itnim_drv;     /*  driver peer instance */
41         struct bfa_fcs_s        *fcs;           /*  fcs instance         */
42         struct bfa_timer_s      timer;          /*  timer functions      */
43         struct bfa_itnim_s      *bfa_itnim;     /*  BFA itnim struct     */
44         u32                     prli_retries;   /*  max prli retry attempts */
45         bfa_boolean_t           seq_rec;        /*  seq recovery support */
46         bfa_boolean_t           rec_support;    /*  REC supported        */
47         bfa_boolean_t           conf_comp;      /*  FCP_CONF     support */
48         bfa_boolean_t           task_retry_id;  /*  task retry id supp   */
49         struct bfa_fcxp_wqe_s   fcxp_wqe;       /*  wait qelem for fcxp  */
50         struct bfa_fcxp_s *fcxp;                /*  FCXP in use          */
51         struct bfa_itnim_stats_s        stats;  /*  itn statistics       */
52 };
53
54
55 static inline struct bfad_port_s *
56 bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim)
57 {
58         return itnim->rport->port->bfad_port;
59 }
60
61
62 static inline struct bfa_fcs_port_s *
63 bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim)
64 {
65         return itnim->rport->port;
66 }
67
68
69 static inline wwn_t
70 bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim)
71 {
72         return itnim->rport->nwwn;
73 }
74
75
76 static inline wwn_t
77 bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim)
78 {
79         return itnim->rport->pwwn;
80 }
81
82
83 static inline u32
84 bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim)
85 {
86         return itnim->rport->pid;
87 }
88
89
90 static inline   u32
91 bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim)
92 {
93         return itnim->rport->maxfrsize;
94 }
95
96
97 static inline   enum fc_cos
98 bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim)
99 {
100         return itnim->rport->fc_cos;
101 }
102
103
104 static inline struct bfad_itnim_s *
105 bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim)
106 {
107         return itnim->itnim_drv;
108 }
109
110
111 static inline struct bfa_itnim_s *
112 bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim)
113 {
114         return itnim->bfa_itnim;
115 }
116
117 /**
118  * bfa fcs FCP Initiator mode API functions
119  */
120 void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim,
121                         struct bfa_itnim_attr_s *attr);
122 void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim,
123                         struct bfa_itnim_stats_s *stats);
124 struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_port_s *port,
125                         wwn_t rpwwn);
126 bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_port_s *port, wwn_t rpwwn,
127                         struct bfa_itnim_attr_s *attr);
128 bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_port_s *port, wwn_t rpwwn,
129                         struct bfa_itnim_stats_s *stats);
130 bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_port_s *port,
131                         wwn_t rpwwn);
132 #endif /* __BFA_FCS_FCPIM_H__ */