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/** 19 * bfa_fcs_fcpim.h BFA FCS FCP Initiator Mode interfaces/defines. 20 */ 21 22#ifndef __BFA_FCS_FCPIM_H__ 23#define __BFA_FCS_FCPIM_H__ 24 25#include <defs/bfa_defs_status.h> 26#include <defs/bfa_defs_itnim.h> 27#include <fcs/bfa_fcs.h> 28#include <fcs/bfa_fcs_rport.h> 29#include <fcs/bfa_fcs_lport.h> 30#include <bfa_fcpim.h> 31 32/* 33 * forward declarations 34 */ 35struct bfad_itnim_s; 36 37struct bfa_fcs_itnim_s { 38 bfa_sm_t sm; /* state machine */ 39 struct bfa_fcs_rport_s *rport; /* parent remote rport */ 40 struct bfad_itnim_s *itnim_drv; /* driver peer instance */ 41 struct bfa_fcs_s *fcs; /* fcs instance */ 42 struct bfa_timer_s timer; /* timer functions */ 43 struct bfa_itnim_s *bfa_itnim; /* BFA itnim struct */ 44 u32 prli_retries; /* max prli retry attempts */ 45 bfa_boolean_t seq_rec; /* seq recovery support */ 46 bfa_boolean_t rec_support; /* REC supported */ 47 bfa_boolean_t conf_comp; /* FCP_CONF support */ 48 bfa_boolean_t task_retry_id; /* task retry id supp */ 49 struct bfa_fcxp_wqe_s fcxp_wqe; /* wait qelem for fcxp */ 50 struct bfa_fcxp_s *fcxp; /* FCXP in use */ 51 struct bfa_itnim_stats_s stats; /* itn statistics */ 52}; 53 54 55static inline struct bfad_port_s * 56bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim) 57{ 58 return itnim->rport->port->bfad_port; 59} 60 61 62static inline struct bfa_fcs_port_s * 63bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim) 64{ 65 return itnim->rport->port; 66} 67 68 69static inline wwn_t 70bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim) 71{ 72 return itnim->rport->nwwn; 73} 74 75 76static inline wwn_t 77bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim) 78{ 79 return itnim->rport->pwwn; 80} 81 82 83static inline u32 84bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim) 85{ 86 return itnim->rport->pid; 87} 88 89 90static inline u32 91bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim) 92{ 93 return itnim->rport->maxfrsize; 94} 95 96 97static inline enum fc_cos 98bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim) 99{ 100 return itnim->rport->fc_cos; 101} 102 103 104static inline struct bfad_itnim_s * 105bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim) 106{ 107 return itnim->itnim_drv; 108} 109 110 111static inline struct bfa_itnim_s * 112bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim) 113{ 114 return itnim->bfa_itnim; 115} 116 117/** 118 * bfa fcs FCP Initiator mode API functions 119 */ 120void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim, 121 struct bfa_itnim_attr_s *attr); 122void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim, 123 struct bfa_itnim_stats_s *stats); 124struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_port_s *port, 125 wwn_t rpwwn); 126bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_port_s *port, wwn_t rpwwn, 127 struct bfa_itnim_attr_s *attr); 128bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_port_s *port, wwn_t rpwwn, 129 struct bfa_itnim_stats_s *stats); 130bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_port_s *port, 131 wwn_t rpwwn); 132#endif /* __BFA_FCS_FCPIM_H__ */ 133