linux/include/scsi/fc/fc_fip.h
<<
>>
Prefs
   1/*
   2 * Copyright 2008 Cisco Systems, Inc.  All rights reserved.
   3 *
   4 * This program is free software; you may redistribute it and/or modify
   5 * it under the terms of the GNU General Public License as published by
   6 * the Free Software Foundation; version 2 of the License.
   7 *
   8 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
   9 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  11 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  12 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  13 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  14 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  15 * SOFTWARE.
  16 */
  17#ifndef _FC_FIP_H_
  18#define _FC_FIP_H_
  19
  20/*
  21 * This version is based on:
  22 * http://www.t11.org/ftp/t11/pub/fc/bb-5/08-543v1.pdf
  23 */
  24
  25#define FIP_DEF_PRI     128     /* default selection priority */
  26#define FIP_DEF_FC_MAP  0x0efc00 /* default FCoE MAP (MAC OUI) value */
  27#define FIP_DEF_FKA     8000    /* default FCF keep-alive/advert period (mS) */
  28#define FIP_VN_KA_PERIOD 90000  /* required VN_port keep-alive period (mS) */
  29#define FIP_FCF_FUZZ    100     /* random time added by FCF (mS) */
  30
  31/*
  32 * Multicast MAC addresses.  T11-adopted.
  33 */
  34#define FIP_ALL_FCOE_MACS       ((u8[6]) { 1, 0x10, 0x18, 1, 0, 0 })
  35#define FIP_ALL_ENODE_MACS      ((u8[6]) { 1, 0x10, 0x18, 1, 0, 1 })
  36#define FIP_ALL_FCF_MACS        ((u8[6]) { 1, 0x10, 0x18, 1, 0, 2 })
  37
  38#define FIP_VER         1               /* version for fip_header */
  39
  40struct fip_header {
  41        __u8    fip_ver;                /* upper 4 bits are the version */
  42        __u8    fip_resv1;              /* reserved */
  43        __be16  fip_op;                 /* operation code */
  44        __u8    fip_resv2;              /* reserved */
  45        __u8    fip_subcode;            /* lower 4 bits are sub-code */
  46        __be16  fip_dl_len;             /* length of descriptors in words */
  47        __be16  fip_flags;              /* header flags */
  48} __attribute__((packed));
  49
  50#define FIP_VER_SHIFT   4
  51#define FIP_VER_ENCAPS(v) ((v) << FIP_VER_SHIFT)
  52#define FIP_VER_DECAPS(v) ((v) >> FIP_VER_SHIFT)
  53#define FIP_BPW         4               /* bytes per word for lengths */
  54
  55/*
  56 * fip_op.
  57 */
  58enum fip_opcode {
  59        FIP_OP_DISC =   1,              /* discovery, advertisement, etc. */
  60        FIP_OP_LS =     2,              /* Link Service request or reply */
  61        FIP_OP_CTRL =   3,              /* Keep Alive / Link Reset */
  62        FIP_OP_VLAN =   4,              /* VLAN discovery */
  63        FIP_OP_VENDOR_MIN = 0xfff8,     /* min vendor-specific opcode */
  64        FIP_OP_VENDOR_MAX = 0xfffe,     /* max vendor-specific opcode */
  65};
  66
  67/*
  68 * Subcodes for FIP_OP_DISC.
  69 */
  70enum fip_disc_subcode {
  71        FIP_SC_SOL =    1,              /* solicitation */
  72        FIP_SC_ADV =    2,              /* advertisement */
  73};
  74
  75/*
  76 * Subcodes for FIP_OP_LS.
  77 */
  78enum fip_trans_subcode {
  79        FIP_SC_REQ =    1,              /* request */
  80        FIP_SC_REP =    2,              /* reply */
  81};
  82
  83/*
  84 * Subcodes for FIP_OP_RESET.
  85 */
  86enum fip_reset_subcode {
  87        FIP_SC_KEEP_ALIVE = 1,          /* keep-alive from VN_Port */
  88        FIP_SC_CLR_VLINK = 2,           /* clear virtual link from VF_Port */
  89};
  90
  91/*
  92 * Subcodes for FIP_OP_VLAN.
  93 */
  94enum fip_vlan_subcode {
  95        FIP_SC_VL_REQ = 1,              /* request */
  96        FIP_SC_VL_REP = 2,              /* reply */
  97};
  98
  99/*
 100 * flags in header fip_flags.
 101 */
 102enum fip_flag {
 103        FIP_FL_FPMA =   0x8000,         /* supports FPMA fabric-provided MACs */
 104        FIP_FL_SPMA =   0x4000,         /* supports SPMA server-provided MACs */
 105        FIP_FL_AVAIL =  0x0004,         /* available for FLOGI/ELP */
 106        FIP_FL_SOL =    0x0002,         /* this is a solicited message */
 107        FIP_FL_FPORT =  0x0001,         /* sent from an F port */
 108};
 109
 110/*
 111 * Common descriptor header format.
 112 */
 113struct fip_desc {
 114        __u8    fip_dtype;              /* type - see below */
 115        __u8    fip_dlen;               /* length - in 32-bit words */
 116};
 117
 118enum fip_desc_type {
 119        FIP_DT_PRI =    1,              /* priority for forwarder selection */
 120        FIP_DT_MAC =    2,              /* MAC address */
 121        FIP_DT_MAP_OUI = 3,             /* FC-MAP OUI */
 122        FIP_DT_NAME =   4,              /* switch name or node name */
 123        FIP_DT_FAB =    5,              /* fabric descriptor */
 124        FIP_DT_FCOE_SIZE = 6,           /* max FCoE frame size */
 125        FIP_DT_FLOGI =  7,              /* FLOGI request or response */
 126        FIP_DT_FDISC =  8,              /* FDISC request or response */
 127        FIP_DT_LOGO =   9,              /* LOGO request or response */
 128        FIP_DT_ELP =    10,             /* ELP request or response */
 129        FIP_DT_VN_ID =  11,             /* VN_Node Identifier */
 130        FIP_DT_FKA =    12,             /* advertisement keep-alive period */
 131        FIP_DT_VENDOR = 13,             /* vendor ID */
 132        FIP_DT_VLAN =   14,             /* vlan number */
 133        FIP_DT_LIMIT,                   /* max defined desc_type + 1 */
 134        FIP_DT_VENDOR_BASE = 128,       /* first vendor-specific desc_type */
 135};
 136
 137/*
 138 * FIP_DT_PRI - priority descriptor.
 139 */
 140struct fip_pri_desc {
 141        struct fip_desc fd_desc;
 142        __u8            fd_resvd;
 143        __u8            fd_pri;         /* FCF priority:  higher is better */
 144} __attribute__((packed));
 145
 146/*
 147 * FIP_DT_MAC - MAC address descriptor.
 148 */
 149struct fip_mac_desc {
 150        struct fip_desc fd_desc;
 151        __u8            fd_mac[ETH_ALEN];
 152} __attribute__((packed));
 153
 154/*
 155 * FIP_DT_MAP - descriptor.
 156 */
 157struct fip_map_desc {
 158        struct fip_desc fd_desc;
 159        __u8            fd_resvd[3];
 160        __u8            fd_map[3];
 161} __attribute__((packed));
 162
 163/*
 164 * FIP_DT_NAME descriptor.
 165 */
 166struct fip_wwn_desc {
 167        struct fip_desc fd_desc;
 168        __u8            fd_resvd[2];
 169        __be64          fd_wwn;         /* 64-bit WWN, unaligned */
 170} __attribute__((packed));
 171
 172/*
 173 * FIP_DT_FAB descriptor.
 174 */
 175struct fip_fab_desc {
 176        struct fip_desc fd_desc;
 177        __be16          fd_vfid;        /* virtual fabric ID */
 178        __u8            fd_resvd;
 179        __u8            fd_map[3];      /* FC-MAP value */
 180        __be64          fd_wwn;         /* fabric name, unaligned */
 181} __attribute__((packed));
 182
 183/*
 184 * FIP_DT_FCOE_SIZE descriptor.
 185 */
 186struct fip_size_desc {
 187        struct fip_desc fd_desc;
 188        __be16          fd_size;
 189} __attribute__((packed));
 190
 191/*
 192 * Descriptor that encapsulates an ELS or ILS frame.
 193 * The encapsulated frame immediately follows this header, without
 194 * SOF, EOF, or CRC.
 195 */
 196struct fip_encaps {
 197        struct fip_desc fd_desc;
 198        __u8            fd_resvd[2];
 199} __attribute__((packed));
 200
 201/*
 202 * FIP_DT_VN_ID - VN_Node Identifier descriptor.
 203 */
 204struct fip_vn_desc {
 205        struct fip_desc fd_desc;
 206        __u8            fd_mac[ETH_ALEN];
 207        __u8            fd_resvd;
 208        __u8            fd_fc_id[3];
 209        __be64          fd_wwpn;        /* port name, unaligned */
 210} __attribute__((packed));
 211
 212/*
 213 * FIP_DT_FKA - Advertisement keep-alive period.
 214 */
 215struct fip_fka_desc {
 216        struct fip_desc fd_desc;
 217        __u8            fd_resvd[2];
 218        __be32          fd_fka_period;  /* adv./keep-alive period in mS */
 219} __attribute__((packed));
 220
 221/*
 222 * FIP_DT_VENDOR descriptor.
 223 */
 224struct fip_vendor_desc {
 225        struct fip_desc fd_desc;
 226        __u8            fd_resvd[2];
 227        __u8            fd_vendor_id[8];
 228} __attribute__((packed));
 229
 230#endif /* _FC_FIP_H_ */
 231