linux/drivers/scsi/bfa/include/defs/bfa_defs_port.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_DEFS_PORT_H__
  19#define __BFA_DEFS_PORT_H__
  20
  21#include <bfa_os_inc.h>
  22#include <protocol/types.h>
  23#include <defs/bfa_defs_pport.h>
  24#include <defs/bfa_defs_ioc.h>
  25
  26#define BFA_FCS_FABRIC_IPADDR_SZ  16
  27
  28/**
  29 * symbolic names for base port/virtual port
  30 */
  31#define BFA_SYMNAME_MAXLEN      128     /* vmware/windows uses 128 bytes */
  32struct bfa_port_symname_s {
  33        char            symname[BFA_SYMNAME_MAXLEN];
  34};
  35
  36/**
  37* Roles of FCS port:
  38 *     - FCP IM and FCP TM roles cannot be enabled together for a FCS port
  39 *     - Create multiple ports if both IM and TM functions required.
  40 *     - Atleast one role must be specified.
  41 */
  42enum bfa_port_role {
  43        BFA_PORT_ROLE_FCP_IM    = 0x01, /*  FCP initiator role */
  44        BFA_PORT_ROLE_FCP_TM    = 0x02, /*  FCP target role */
  45        BFA_PORT_ROLE_FCP_IPFC  = 0x04, /*  IP over FC role */
  46        BFA_PORT_ROLE_FCP_MAX   = BFA_PORT_ROLE_FCP_IPFC | BFA_PORT_ROLE_FCP_IM
  47};
  48
  49/**
  50 * FCS port configuration.
  51 */
  52struct bfa_port_cfg_s {
  53    wwn_t               pwwn;       /*  port wwn */
  54    wwn_t               nwwn;       /*  node wwn */
  55    struct bfa_port_symname_s  sym_name;   /*  vm port symbolic name */
  56    enum bfa_port_role     roles;      /*  FCS port roles */
  57        u32                     rsvd;
  58    u8             tag[16];     /*  opaque tag from application */
  59};
  60
  61/**
  62 * FCS port states
  63 */
  64enum bfa_port_state {
  65        BFA_PORT_UNINIT  = 0,   /*  PORT is not yet initialized */
  66        BFA_PORT_FDISC   = 1,   /*  FDISC is in progress */
  67        BFA_PORT_ONLINE  = 2,   /*  login to fabric is complete */
  68        BFA_PORT_OFFLINE = 3,   /*  No login to fabric */
  69};
  70
  71/**
  72 * FCS port type. Required for VmWare.
  73 */
  74enum bfa_port_type {
  75        BFA_PORT_TYPE_PHYSICAL = 0,
  76        BFA_PORT_TYPE_VIRTUAL,
  77};
  78
  79/**
  80 * FCS port offline reason. Required for VmWare.
  81 */
  82enum bfa_port_offline_reason {
  83        BFA_PORT_OFFLINE_UNKNOWN = 0,
  84        BFA_PORT_OFFLINE_LINKDOWN,
  85        BFA_PORT_OFFLINE_FAB_UNSUPPORTED,       /*  NPIV not supported by the
  86                                                 *    fabric */
  87        BFA_PORT_OFFLINE_FAB_NORESOURCES,
  88        BFA_PORT_OFFLINE_FAB_LOGOUT,
  89};
  90
  91/**
  92 * FCS lport info. Required for VmWare.
  93 */
  94struct bfa_port_info_s {
  95        u8         port_type;   /* bfa_port_type_t : physical or
  96                                         * virtual */
  97        u8         port_state;  /* one of bfa_port_state values */
  98        u8         offline_reason;      /* one of bfa_port_offline_reason_t
  99                                         * values */
 100        wwn_t           port_wwn;
 101        wwn_t           node_wwn;
 102
 103        /*
 104         * following 4 feilds are valid for Physical Ports only
 105         */
 106        u32        max_vports_supp;     /* Max supported vports */
 107        u32        num_vports_inuse;    /* Num of in use vports */
 108        u32        max_rports_supp;     /* Max supported rports */
 109        u32        num_rports_inuse;    /* Num of doscovered rports */
 110
 111};
 112
 113/**
 114 * FCS port statistics
 115 */
 116struct bfa_port_stats_s {
 117        u32        ns_plogi_sent;
 118        u32        ns_plogi_rsp_err;
 119        u32        ns_plogi_acc_err;
 120        u32        ns_plogi_accepts;
 121        u32        ns_rejects;  /* NS command rejects */
 122        u32        ns_plogi_unknown_rsp;
 123        u32        ns_plogi_alloc_wait;
 124
 125        u32        ns_retries;  /* NS command retries */
 126        u32        ns_timeouts; /* NS command timeouts */
 127
 128        u32        ns_rspnid_sent;
 129        u32        ns_rspnid_accepts;
 130        u32        ns_rspnid_rsp_err;
 131        u32        ns_rspnid_rejects;
 132        u32        ns_rspnid_alloc_wait;
 133
 134        u32        ns_rftid_sent;
 135        u32        ns_rftid_accepts;
 136        u32        ns_rftid_rsp_err;
 137        u32        ns_rftid_rejects;
 138        u32        ns_rftid_alloc_wait;
 139
 140        u32     ns_rffid_sent;
 141        u32     ns_rffid_accepts;
 142        u32     ns_rffid_rsp_err;
 143        u32     ns_rffid_rejects;
 144        u32     ns_rffid_alloc_wait;
 145
 146        u32        ns_gidft_sent;
 147        u32        ns_gidft_accepts;
 148        u32        ns_gidft_rsp_err;
 149        u32        ns_gidft_rejects;
 150        u32        ns_gidft_unknown_rsp;
 151        u32        ns_gidft_alloc_wait;
 152
 153        /*
 154         * Mgmt Server stats
 155         */
 156        u32        ms_retries;  /* MS command retries */
 157        u32        ms_timeouts; /* MS command timeouts */
 158        u32        ms_plogi_sent;
 159        u32        ms_plogi_rsp_err;
 160        u32        ms_plogi_acc_err;
 161        u32        ms_plogi_accepts;
 162        u32        ms_rejects;  /* NS command rejects */
 163        u32        ms_plogi_unknown_rsp;
 164        u32        ms_plogi_alloc_wait;
 165
 166        u32        num_rscn;    /* Num of RSCN received */
 167        u32        num_portid_rscn;/* Num portid format RSCN
 168                                                                * received */
 169
 170        u32     uf_recvs;       /* unsolicited recv frames      */
 171        u32     uf_recv_drops;  /* dropped received frames      */
 172
 173        u32     rsvd;           /* padding for 64 bit alignment */
 174};
 175
 176/**
 177 * BFA port attribute returned in queries
 178 */
 179struct bfa_port_attr_s {
 180        enum bfa_port_state state;              /*  port state */
 181        u32         pid;                /*  port ID */
 182        struct bfa_port_cfg_s   port_cfg;       /*  port configuration */
 183        enum bfa_pport_type port_type;  /*  current topology */
 184        u32         loopback;   /*  cable is externally looped back */
 185        wwn_t           fabric_name; /*  attached switch's nwwn */
 186        u8              fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ]; /*  attached
 187                                                        * fabric's ip addr */
 188};
 189
 190/**
 191 * BFA physical port Level events
 192 * Arguments below are in BFAL context from Mgmt
 193 * BFA_PORT_AEN_ONLINE:     [in]: pwwn  [out]: pwwn
 194 * BFA_PORT_AEN_OFFLINE:    [in]: pwwn  [out]: pwwn
 195 * BFA_PORT_AEN_RLIR:       [in]: None  [out]: pwwn, rlir_data, rlir_len
 196 * BFA_PORT_AEN_SFP_INSERT: [in]: pwwn  [out]: port_id, pwwn
 197 * BFA_PORT_AEN_SFP_REMOVE: [in]: pwwn  [out]: port_id, pwwn
 198 * BFA_PORT_AEN_SFP_POM:    [in]: pwwn  [out]: level, port_id, pwwn
 199 * BFA_PORT_AEN_ENABLE:     [in]: pwwn  [out]: pwwn
 200 * BFA_PORT_AEN_DISABLE:    [in]: pwwn  [out]: pwwn
 201 * BFA_PORT_AEN_AUTH_ON:    [in]: pwwn  [out]: pwwn
 202 * BFA_PORT_AEN_AUTH_OFF:   [in]: pwwn  [out]: pwwn
 203 * BFA_PORT_AEN_DISCONNECT: [in]: pwwn  [out]: pwwn
 204 * BFA_PORT_AEN_QOS_NEG:    [in]: pwwn  [out]: pwwn
 205 * BFA_PORT_AEN_FABRIC_NAME_CHANGE: [in]: pwwn, [out]: pwwn, fwwn
 206 *
 207 */
 208enum bfa_port_aen_event {
 209        BFA_PORT_AEN_ONLINE     = 1,    /*  Physical Port online event */
 210        BFA_PORT_AEN_OFFLINE    = 2,    /*  Physical Port offline event */
 211        BFA_PORT_AEN_RLIR       = 3,    /*  RLIR event, not supported */
 212        BFA_PORT_AEN_SFP_INSERT = 4,    /*  SFP inserted event */
 213        BFA_PORT_AEN_SFP_REMOVE = 5,    /*  SFP removed event */
 214        BFA_PORT_AEN_SFP_POM    = 6,    /*  SFP POM event */
 215        BFA_PORT_AEN_ENABLE     = 7,    /*  Physical Port enable event */
 216        BFA_PORT_AEN_DISABLE    = 8,    /*  Physical Port disable event */
 217        BFA_PORT_AEN_AUTH_ON    = 9,    /*  Physical Port auth success event */
 218        BFA_PORT_AEN_AUTH_OFF   = 10,   /*  Physical Port auth fail event */
 219        BFA_PORT_AEN_DISCONNECT = 11,   /*  Physical Port disconnect event */
 220        BFA_PORT_AEN_QOS_NEG    = 12,   /*  Base Port QOS negotiation event */
 221        BFA_PORT_AEN_FABRIC_NAME_CHANGE = 13, /*  Fabric Name/WWN change
 222                                               * event */
 223        BFA_PORT_AEN_SFP_ACCESS_ERROR = 14, /*  SFP read error event */
 224        BFA_PORT_AEN_SFP_UNSUPPORT = 15, /*  Unsupported SFP event */
 225};
 226
 227enum bfa_port_aen_sfp_pom {
 228        BFA_PORT_AEN_SFP_POM_GREEN = 1, /*  Normal */
 229        BFA_PORT_AEN_SFP_POM_AMBER = 2, /*  Warning */
 230        BFA_PORT_AEN_SFP_POM_RED   = 3, /*  Critical */
 231        BFA_PORT_AEN_SFP_POM_MAX   = BFA_PORT_AEN_SFP_POM_RED
 232};
 233
 234struct bfa_port_aen_data_s {
 235        enum bfa_ioc_type_e ioc_type;
 236        wwn_t           pwwn;         /*  WWN of the physical port */
 237        wwn_t           fwwn;         /*  WWN of the fabric port */
 238        mac_t           mac;          /*  MAC addres of the ethernet port,
 239                                       * applicable to CNA port only */
 240        int             phy_port_num; /*! For SFP related events */
 241        enum bfa_port_aen_sfp_pom level; /*  Only transitions will
 242                                          * be informed */
 243};
 244
 245#endif /* __BFA_DEFS_PORT_H__ */
 246