- patches.suse/slab-handle-memoryless-nodes-v2a.patch: Refresh.
[linux-flexiantxendom0-3.2.10.git] / drivers / scsi / bfa / include / fcs / bfa_fcs_fabric.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_FCS_FABRIC_H__
19 #define __BFA_FCS_FABRIC_H__
20
21 struct bfa_fcs_s;
22
23 #include <defs/bfa_defs_status.h>
24 #include <defs/bfa_defs_vf.h>
25 #include <cs/bfa_q.h>
26 #include <cs/bfa_sm.h>
27 #include <defs/bfa_defs_pport.h>
28 #include <fcs/bfa_fcs_lport.h>
29 #include <protocol/fc_sp.h>
30 #include <fcs/bfa_fcs_auth.h>
31
32 /*
33  * forward declaration
34  */
35 struct bfad_vf_s;
36
37 enum bfa_fcs_fabric_type {
38         BFA_FCS_FABRIC_UNKNOWN = 0,
39         BFA_FCS_FABRIC_SWITCHED = 1,
40         BFA_FCS_FABRIC_PLOOP = 2,
41         BFA_FCS_FABRIC_N2N = 3,
42 };
43
44
45 struct bfa_fcs_fabric_s {
46         struct list_head   qe;          /*  queue element */
47         bfa_sm_t         sm;            /*  state machine */
48         struct bfa_fcs_s *fcs;          /*  FCS instance */
49         struct bfa_fcs_port_s  bport;   /*  base logical port */
50         enum bfa_fcs_fabric_type fab_type; /*  fabric type */
51         enum bfa_pport_type oper_type;  /*  current link topology */
52         u8         is_vf;               /*  is virtual fabric? */
53         u8         is_npiv;     /*  is NPIV supported ? */
54         u8         is_auth;     /*  is Security/Auth supported ? */
55         u16        bb_credit;   /*  BB credit from fabric */
56         u16        vf_id;               /*  virtual fabric ID */
57         u16        num_vports;  /*  num vports */
58         u16        rsvd;
59         struct list_head         vport_q;       /*  queue of virtual ports */
60         struct list_head         vf_q;  /*  queue of virtual fabrics */
61         struct bfad_vf_s      *vf_drv;  /*  driver vf structure */
62         struct bfa_timer_s link_timer;  /*  Link Failure timer. Vport */
63         wwn_t           fabric_name;    /*  attached fabric name */
64         bfa_boolean_t   auth_reqd;      /*  authentication required     */
65         struct bfa_timer_s delay_timer; /*  delay timer         */
66         union {
67                 u16        swp_vfid;/*  switch port VF id               */
68         } event_arg;
69         struct bfa_fcs_auth_s  auth;    /*  authentication config       */
70         struct bfa_wc_s        wc;      /*  wait counter for delete     */
71         struct bfa_vf_stats_s  stats;   /*  fabric/vf stats             */
72         struct bfa_lps_s        *lps;   /*  lport login services        */
73         u8      fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ];  /*  attached
74                                                             * fabric's ip addr
75                                                             */
76 };
77
78 #define bfa_fcs_fabric_npiv_capable(__f)    ((__f)->is_npiv)
79 #define bfa_fcs_fabric_is_switched(__f)                 \
80         ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED)
81
82 /**
83  *   The design calls for a single implementation of base fabric and vf.
84  */
85 #define bfa_fcs_vf_t struct bfa_fcs_fabric_s
86
87 struct bfa_vf_event_s {
88         u32        undefined;
89 };
90
91 /**
92  * bfa fcs vf public functions
93  */
94 bfa_status_t bfa_fcs_vf_mode_enable(struct bfa_fcs_s *fcs, u16 vf_id);
95 bfa_status_t bfa_fcs_vf_mode_disable(struct bfa_fcs_s *fcs);
96 bfa_status_t bfa_fcs_vf_create(bfa_fcs_vf_t *vf, struct bfa_fcs_s *fcs,
97                                u16 vf_id, struct bfa_port_cfg_s *port_cfg,
98                                struct bfad_vf_s *vf_drv);
99 bfa_status_t bfa_fcs_vf_delete(bfa_fcs_vf_t *vf);
100 void bfa_fcs_vf_start(bfa_fcs_vf_t *vf);
101 bfa_status_t bfa_fcs_vf_stop(bfa_fcs_vf_t *vf);
102 void bfa_fcs_vf_list(struct bfa_fcs_s *fcs, u16 *vf_ids, int *nvfs);
103 void bfa_fcs_vf_list_all(struct bfa_fcs_s *fcs, u16 *vf_ids, int *nvfs);
104 void bfa_fcs_vf_get_attr(bfa_fcs_vf_t *vf, struct bfa_vf_attr_s *vf_attr);
105 void bfa_fcs_vf_get_stats(bfa_fcs_vf_t *vf,
106                           struct bfa_vf_stats_s *vf_stats);
107 void bfa_fcs_vf_clear_stats(bfa_fcs_vf_t *vf);
108 void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
109 bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
110 struct bfad_vf_s *bfa_fcs_vf_get_drv_vf(bfa_fcs_vf_t *vf);
111
112 #endif /* __BFA_FCS_FABRIC_H__ */