bfa_fcs_rport.h 3.9 KB

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