fcs_lport.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. * fcs_lport.h FCS logical port interfaces
  19. */
  20. #ifndef __FCS_LPORT_H__
  21. #define __FCS_LPORT_H__
  22. #define __VPORT_H__
  23. #include <defs/bfa_defs_port.h>
  24. #include <bfa_svc.h>
  25. #include <fcs/bfa_fcs_lport.h>
  26. #include <fcs/bfa_fcs_rport.h>
  27. #include <fcs/bfa_fcs_vport.h>
  28. #include <fcs_fabric.h>
  29. #include <fcs_ms.h>
  30. #include <cs/bfa_q.h>
  31. #include <fcbuild.h>
  32. /*
  33. * PID used in P2P/N2N ( In Big Endian)
  34. */
  35. #define N2N_LOCAL_PID 0x010000
  36. #define N2N_REMOTE_PID 0x020000
  37. /*
  38. * Misc Timeouts
  39. */
  40. /*
  41. * To be used when spawning a timer before retrying a failed command. Milli
  42. * Secs.
  43. */
  44. #define BFA_FCS_RETRY_TIMEOUT 2000
  45. /*
  46. * Check for Port/Vport Mode/Role
  47. */
  48. #define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \
  49. (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IM)
  50. #define BFA_FCS_VPORT_IS_TARGET_MODE(port) \
  51. (port->port_cfg.roles & BFA_PORT_ROLE_FCP_TM)
  52. #define BFA_FCS_VPORT_IS_IPFC_MODE(port) \
  53. (port->port_cfg.roles & BFA_PORT_ROLE_FCP_IPFC)
  54. /*
  55. * Is this a Well Known Address
  56. */
  57. #define BFA_FCS_PID_IS_WKA(pid) ((bfa_os_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
  58. /*
  59. * Pointer to elements within Port
  60. */
  61. #define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa)
  62. #define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns)
  63. #define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn)
  64. #define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms)
  65. #define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi)
  66. /*
  67. * handler for unsolicied frames
  68. */
  69. void bfa_fcs_port_uf_recv(struct bfa_fcs_port_s *lport, struct fchs_s *fchs,
  70. u16 len);
  71. /*
  72. * Following routines will be called by Fabric to indicate port
  73. * online/offline to vport.
  74. */
  75. void bfa_fcs_lport_init(struct bfa_fcs_port_s *lport, struct bfa_fcs_s *fcs,
  76. u16 vf_id, struct bfa_port_cfg_s *port_cfg,
  77. struct bfa_fcs_vport_s *vport);
  78. void bfa_fcs_port_online(struct bfa_fcs_port_s *port);
  79. void bfa_fcs_port_offline(struct bfa_fcs_port_s *port);
  80. void bfa_fcs_port_delete(struct bfa_fcs_port_s *port);
  81. bfa_boolean_t bfa_fcs_port_is_online(struct bfa_fcs_port_s *port);
  82. /*
  83. * Lookup rport based on PID
  84. */
  85. struct bfa_fcs_rport_s *bfa_fcs_port_get_rport_by_pid(
  86. struct bfa_fcs_port_s *port, u32 pid);
  87. /*
  88. * Lookup rport based on PWWN
  89. */
  90. struct bfa_fcs_rport_s *bfa_fcs_port_get_rport_by_pwwn(
  91. struct bfa_fcs_port_s *port, wwn_t pwwn);
  92. struct bfa_fcs_rport_s *bfa_fcs_port_get_rport_by_nwwn(
  93. struct bfa_fcs_port_s *port, wwn_t nwwn);
  94. void bfa_fcs_port_add_rport(struct bfa_fcs_port_s *port,
  95. struct bfa_fcs_rport_s *rport);
  96. void bfa_fcs_port_del_rport(struct bfa_fcs_port_s *port,
  97. struct bfa_fcs_rport_s *rport);
  98. void bfa_fcs_port_modinit(struct bfa_fcs_s *fcs);
  99. void bfa_fcs_port_modexit(struct bfa_fcs_s *fcs);
  100. void bfa_fcs_port_lip(struct bfa_fcs_port_s *port);
  101. #endif /* __FCS_LPORT_H__ */