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