[SCSI] zfcp: Replace status modifier functions.
[linux-2.6-block.git] / drivers / scsi / bfa / include / fcs / bfa_fcs_rport.h
CommitLineData
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#ifndef __BFA_FCS_RPORT_H__
19#define __BFA_FCS_RPORT_H__
20
21#include <defs/bfa_defs_status.h>
22#include <cs/bfa_q.h>
23#include <fcs/bfa_fcs.h>
24#include <defs/bfa_defs_rport.h>
25
26#define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90 /* in secs */
27/*
28 * forward declarations
29 */
30struct bfad_rport_s;
31
32struct bfa_fcs_itnim_s;
33struct bfa_fcs_tin_s;
34struct bfa_fcs_iprp_s;
35
36/* Rport Features (RPF) */
37struct bfa_fcs_rpf_s {
38 bfa_sm_t sm; /* state machine */
39 struct bfa_fcs_rport_s *rport; /* parent rport */
40 struct bfa_timer_s timer; /* general purpose timer */
41 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */
42 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */
43 int rpsc_retries; /* max RPSC retry attempts */
44 enum bfa_pport_speed rpsc_speed; /* Current Speed from RPSC.
45 * O if RPSC fails */
46 enum bfa_pport_speed assigned_speed; /* Speed assigned by the user.
47 * will be used if RPSC is not
48 * supported by the rport */
49};
50
51struct bfa_fcs_rport_s {
52 struct list_head qe; /* used by port/vport */
53 struct bfa_fcs_port_s *port; /* parent FCS port */
54 struct bfa_fcs_s *fcs; /* fcs instance */
55 struct bfad_rport_s *rp_drv; /* driver peer instance */
56 u32 pid; /* port ID of rport */
57 u16 maxfrsize; /* maximum frame size */
58 u16 reply_oxid; /* OX_ID of inbound requests */
59 enum fc_cos fc_cos; /* FC classes of service supp */
60 bfa_boolean_t cisc; /* CISC capable device */
4b5e759d 61 bfa_boolean_t prlo; /* processing prlo or LOGO */
7725ccfd
JH
62 wwn_t pwwn; /* port wwn of rport */
63 wwn_t nwwn; /* node wwn of rport */
64 struct bfa_rport_symname_s psym_name; /* port symbolic name */
65 bfa_sm_t sm; /* state machine */
66 struct bfa_timer_s timer; /* general purpose timer */
67 struct bfa_fcs_itnim_s *itnim; /* ITN initiator mode role */
68 struct bfa_fcs_tin_s *tin; /* ITN initiator mode role */
69 struct bfa_fcs_iprp_s *iprp; /* IP/FC role */
70 struct bfa_rport_s *bfa_rport; /* BFA Rport */
71 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */
72 int plogi_retries; /* max plogi retry attempts */
73 int ns_retries; /* max NS query retry attempts */
74 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */
75 struct bfa_rport_stats_s stats; /* rport stats */
76 enum bfa_rport_function scsi_function; /* Initiator/Target */
77 struct bfa_fcs_rpf_s rpf; /* Rport features module */
78};
79
80static inline struct bfa_rport_s *
81bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
82{
83 return rport->bfa_rport;
84}
85
86/**
87 * bfa fcs rport API functions
88 */
89bfa_status_t bfa_fcs_rport_add(struct bfa_fcs_port_s *port, wwn_t *pwwn,
90 struct bfa_fcs_rport_s *rport,
91 struct bfad_rport_s *rport_drv);
92bfa_status_t bfa_fcs_rport_remove(struct bfa_fcs_rport_s *rport);
93void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
94 struct bfa_rport_attr_s *attr);
95void bfa_fcs_rport_get_stats(struct bfa_fcs_rport_s *rport,
96 struct bfa_rport_stats_s *stats);
97void bfa_fcs_rport_clear_stats(struct bfa_fcs_rport_s *rport);
98struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_port_s *port,
99 wwn_t rpwwn);
100struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
101 struct bfa_fcs_port_s *port, wwn_t rnwwn);
102void bfa_fcs_rport_set_del_timeout(u8 rport_tmo);
103void bfa_fcs_rport_set_speed(struct bfa_fcs_rport_s *rport,
104 enum bfa_pport_speed speed);
105#endif /* __BFA_FCS_RPORT_H__ */