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 bfa_boolean_t seq_rec; /* seq recovery support */ 45 bfa_boolean_t rec_support; /* REC supported */ 46 bfa_boolean_t conf_comp; /* FCP_CONF support */ 47 bfa_boolean_t task_retry_id; /* task retry id supp */ 48 struct bfa_fcxp_wqe_s fcxp_wqe; /* wait qelem for fcxp */ 49 struct bfa_fcxp_s *fcxp; /* FCXP in use */ 50 struct bfa_itnim_stats_s stats; /* itn statistics */ 51}; 52 53 54static inline struct bfad_port_s * 55bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim) 56{ 57 return itnim->rport->port->bfad_port; 58} 59 60 61static inline struct bfa_fcs_port_s * 62bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim) 63{ 64 return itnim->rport->port; 65} 66 67 68static inline wwn_t 69bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim) 70{ 71 return itnim->rport->nwwn; 72} 73 74 75static inline wwn_t 76bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim) 77{ 78 return itnim->rport->pwwn; 79} 80 81 82static inline u32 83bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim) 84{ 85 return itnim->rport->pid; 86} 87 88 89static inline u32 90bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim) 91{ 92 return itnim->rport->maxfrsize; 93} 94 95 96static inline enum fc_cos 97bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim) 98{ 99 return itnim->rport->fc_cos; 100} 101 102 103static inline struct bfad_itnim_s * 104bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim) 105{ 106 return itnim->itnim_drv; 107} 108 109 110static inline struct bfa_itnim_s * 111bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim) 112{ 113 return itnim->bfa_itnim; 114} 115 116/** 117 * bfa fcs FCP Initiator mode API functions 118 */ 119void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim, 120 struct bfa_itnim_attr_s *attr); 121void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim, 122 struct bfa_itnim_stats_s *stats); 123struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_port_s *port, 124 wwn_t rpwwn); 125bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_port_s *port, wwn_t rpwwn, 126 struct bfa_itnim_attr_s *attr); 127bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_port_s *port, wwn_t rpwwn, 128 struct bfa_itnim_stats_s *stats); 129bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_port_s *port, 130 wwn_t rpwwn); 131#endif /* __BFA_FCS_FCPIM_H__ */ 132