bfa_fcs_fabric.h 3.9 KB

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