iPXE
xsigo.h
Go to the documentation of this file.
00001 #ifndef _IPXE_XSIGO_H
00002 #define _IPXE_XSIGO_H
00003 
00004 /** @file
00005  *
00006  * Xsigo virtual Ethernet devices
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/infiniband.h>
00014 #include <ipxe/eoib.h>
00015 
00016 /** Xsigo directory service record name */
00017 #define XDS_SERVICE_NAME "XSIGOXDS"
00018 
00019 /** Xsigo configuration manager service ID */
00020 #define XCM_SERVICE_ID { 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x97, 0x01 }
00021 
00022 /** Xsigo management class */
00023 #define XSIGO_MGMT_CLASS 0x0b
00024 
00025 /** Xsigo management class version */
00026 #define XSIGO_MGMT_CLASS_VERSION 2
00027 
00028 /** Xsigo configuration manager request MAD */
00029 #define XSIGO_ATTR_XCM_REQUEST 0xb002
00030 
00031 /** Generic operating system type */
00032 #define XSIGO_OS_TYPE_GENERIC 0x40
00033 
00034 /** Xsigo virtual Ethernet broadcast GID prefix */
00035 #define XVE_PREFIX 0xff15101cUL
00036 
00037 /** Xsigo resource types */
00038 enum xsigo_resource_type {
00039         /** Virtual Ethernet resource type */
00040         XSIGO_RESOURCE_XVE = ( 1 << 6 ),
00041         /** Absence-of-high-availability "resource" type */
00042         XSIGO_RESOURCE_NO_HA = ( 1 << 4 ),
00043 };
00044 
00045 /** A Xsigo server identifier */
00046 struct xsigo_server_id {
00047         /** Virtual machine ID */
00048         uint32_t vm;
00049         /** Port GUID */
00050         union ib_guid guid;
00051 } __attribute__ (( packed ));
00052 
00053 /** A Xsigo configuration manager identifier */
00054 struct xsigo_manager_id {
00055         /** Port GUID */
00056         union ib_guid guid;
00057         /** LID */
00058         uint16_t lid;
00059         /** Reserved */
00060         uint8_t reserved[10];
00061 } __attribute__ (( packed ));
00062 
00063 /** A Xsigo configuration manager request MAD */
00064 struct xsigo_managers_request {
00065         /** MAD header */
00066         struct ib_mad_hdr mad_hdr;
00067         /** Reserved */
00068         uint8_t reserved0[32];
00069         /** Server ID */
00070         struct xsigo_server_id server;
00071         /** Hostname */
00072         char hostname[ 65 /* Seriously, guys? */ ];
00073         /** OS version */
00074         char os_version[32];
00075         /** CPU architecture */
00076         char arch[16];
00077         /** OS type */
00078         uint8_t os_type;
00079         /** Reserved */
00080         uint8_t reserved1[3];
00081         /** Firmware version */
00082         uint64_t firmware_version;
00083         /** Hardware version */
00084         uint32_t hardware_version;
00085         /** Driver version */
00086         uint32_t driver_version;
00087         /** System ID */
00088         union ib_gid system_id;
00089         /** Resource types */
00090         uint16_t resources;
00091         /** Reserved */
00092         uint8_t reserved2[2];
00093         /** Build version */
00094         char build[16];
00095         /** Reserved */
00096         uint8_t reserved3[19];
00097 } __attribute__ (( packed ));
00098 
00099 /** Resource types are present */
00100 #define XSIGO_RESOURCES_PRESENT 0x8000
00101 
00102 /** A Xsigo configuration manager reply MAD */
00103 struct xsigo_managers_reply {
00104         /** MAD header */
00105         struct ib_mad_hdr mad_hdr;
00106         /** Reserved */
00107         uint8_t reserved0[32];
00108         /** Server ID */
00109         struct xsigo_server_id server;
00110         /** Number of XCM records */
00111         uint8_t count;
00112         /** Version */
00113         uint8_t version;
00114         /** Reserved */
00115         uint8_t reserved1[2];
00116         /** Managers */
00117         struct xsigo_manager_id manager[8];
00118         /** Reserved */
00119         uint8_t reserved2[24];
00120 } __attribute__ (( packed ));
00121 
00122 /** A Xsigo MAD */
00123 union xsigo_mad {
00124         /** Generic MAD */
00125         union ib_mad mad;
00126         /** Configuration manager request */
00127         struct xsigo_managers_request request;
00128         /** Configuration manager reply */
00129         struct xsigo_managers_reply reply;
00130 } __attribute__ (( packed ));
00131 
00132 /** An XSMP node identifier */
00133 struct xsmp_node_id {
00134         /** Auxiliary ID (never used) */
00135         uint32_t aux;
00136         /** Port GUID */
00137         union ib_guid guid;
00138 } __attribute__ (( packed ));
00139 
00140 /** An XSMP message header */
00141 struct xsmp_message_header {
00142         /** Message type */
00143         uint8_t type;
00144         /** Reason code */
00145         uint8_t code;
00146         /** Length */
00147         uint16_t len;
00148         /** Sequence number */
00149         uint32_t seq;
00150         /** Source node ID */
00151         struct xsmp_node_id src;
00152         /** Destination node ID */
00153         struct xsmp_node_id dst;
00154 } __attribute__ (( packed ));
00155 
00156 /** XSMP message types */
00157 enum xsmp_message_type {
00158         /** Session message type */
00159         XSMP_TYPE_SESSION = 1,
00160         /** Virtual Ethernet message type */
00161         XSMP_TYPE_XVE = 6,
00162 };
00163 
00164 /** An XSMP session message */
00165 struct xsmp_session_message {
00166         /** Message header */
00167         struct xsmp_message_header hdr;
00168         /** Message type */
00169         uint8_t type;
00170         /** Reason code */
00171         uint8_t code;
00172         /** Length (excluding message header) */
00173         uint16_t len;
00174         /** Operating system type */
00175         uint8_t os_type;
00176         /** Reserved */
00177         uint8_t reserved0;
00178         /** Resource types */
00179         uint16_t resources;
00180         /** Driver version */
00181         uint32_t driver_version;
00182         /** Required chassis version */
00183         uint32_t chassis_version;
00184         /** Boot flags */
00185         uint32_t boot;
00186         /** Firmware version */
00187         uint64_t firmware_version;
00188         /** Hardware version */
00189         uint32_t hardware_version;
00190         /** Vendor part ID */
00191         uint32_t vendor;
00192         /** Protocol version */
00193         uint32_t xsmp_version;
00194         /** Chassis name */
00195         char chassis[32];
00196         /** Session name */
00197         char session[32];
00198         /** Reserved */
00199         uint8_t reserved1[120];
00200 } __attribute__ (( packed ));
00201 
00202 /** XSMP session message types */
00203 enum xsmp_session_type {
00204         /** Keepalive message */
00205         XSMP_SESSION_TYPE_HELLO = 1,
00206         /** Initial registration message */
00207         XSMP_SESSION_TYPE_REGISTER = 2,
00208         /** Registration confirmation message */
00209         XSMP_SESSION_TYPE_CONFIRM = 3,
00210         /** Registration rejection message */
00211         XSMP_SESSION_TYPE_REJECT = 4,
00212         /** Shutdown message */
00213         XSMP_SESSION_TYPE_SHUTDOWN = 5,
00214 };
00215 
00216 /** XSMP boot flags */
00217 enum xsmp_session_boot {
00218         /** PXE boot */
00219         XSMP_BOOT_PXE = ( 1 << 0 ),
00220 };
00221 
00222 /** XSMP virtual Ethernet channel adapter parameters */
00223 struct xsmp_xve_ca {
00224         /** Subnet prefix (little-endian) */
00225         union ib_guid prefix_le;
00226         /** Control queue pair number */
00227         uint32_t ctrl;
00228         /** Data queue pair number */
00229         uint32_t data;
00230         /** Partition key */
00231         uint16_t pkey;
00232         /** Queue key */
00233         uint16_t qkey;
00234 } __attribute__ (( packed ));
00235 
00236 /** XSMP virtual Ethernet MAC address */
00237 struct xsmp_xve_mac {
00238         /** High 16 bits */
00239         uint16_t high;
00240         /** Low 32 bits */
00241         uint32_t low;
00242 } __attribute__ (( packed ));
00243 
00244 /** An XSMP virtual Ethernet message */
00245 struct xsmp_xve_message {
00246         /** Message header */
00247         struct xsmp_message_header hdr;
00248         /** Message type */
00249         uint8_t type;
00250         /** Reason code */
00251         uint8_t code;
00252         /** Length (excluding message header) */
00253         uint16_t len;
00254         /** Update bitmask */
00255         uint32_t update;
00256         /** Resource identifier */
00257         union ib_guid resource;
00258         /** TCA GUID (little-endian) */
00259         union ib_guid guid_le;
00260         /** TCA LID */
00261         uint16_t lid;
00262         /** MAC address (little-endian) */
00263         struct xsmp_xve_mac mac_le;
00264         /** Rate */
00265         uint16_t rate;
00266         /** Administrative state (non-zero = "up") */
00267         uint16_t state;
00268         /** Encapsulation (apparently obsolete and unused) */
00269         uint16_t encap;
00270         /** MTU */
00271         uint16_t mtu;
00272         /** Installation flags (apparently obsolete and unused) */
00273         uint32_t install;
00274         /** Interface name */
00275         char name[16];
00276         /** Service level */
00277         uint16_t sl;
00278         /** Flow control enabled (apparently obsolete and unused) */
00279         uint16_t flow;
00280         /** Committed rate (in Mbps) */
00281         uint16_t committed_mbps;
00282         /** Peak rate (in Mbps) */
00283         uint16_t peak_mbps;
00284         /** Committed burst size (in bytes) */
00285         uint32_t committed_burst;
00286         /** Peak burst size (in bytes) */
00287         uint32_t peak_burst;
00288         /** VMware index */
00289         uint8_t vmware;
00290         /** Reserved */
00291         uint8_t reserved0;
00292         /** Multipath flags */
00293         uint16_t multipath;
00294         /** Multipath group name */
00295         char group[48];
00296         /** Link aggregation flag */
00297         uint8_t agg;
00298         /** Link aggregation policy */
00299         uint8_t policy;
00300         /** Network ID */
00301         uint32_t network;
00302         /** Mode */
00303         uint8_t mode;
00304         /** Uplink type */
00305         uint8_t uplink;
00306         /** Target channel adapter parameters */
00307         struct xsmp_xve_ca tca;
00308         /** Host channel adapter parameters */
00309         struct xsmp_xve_ca hca;
00310         /** Reserved */
00311         uint8_t reserved1[336];
00312 } __attribute__ (( packed ));
00313 
00314 /** XSMP virtual Ethernet message types */
00315 enum xsmp_xve_type {
00316         /** Install virtual NIC */
00317         XSMP_XVE_TYPE_INSTALL = 1,
00318         /** Delete virtual NIC */
00319         XSMP_XVE_TYPE_DELETE = 2,
00320         /** Update virtual NIC */
00321         XSMP_XVE_TYPE_UPDATE = 3,
00322         /** Set operational state up */
00323         XSMP_XVE_TYPE_OPER_UP = 6,
00324         /** Set operational state down */
00325         XSMP_XVE_TYPE_OPER_DOWN = 7,
00326         /** Get operational state */
00327         XSMP_XVE_TYPE_OPER_REQ = 15,
00328         /** Virtual NIC is ready */
00329         XSMP_XVE_TYPE_READY = 20,
00330 };
00331 
00332 /** XSMP virtual Ethernet message codes */
00333 enum xsmp_xve_code {
00334         /* Something went wrong */
00335         XSMP_XVE_CODE_ERROR = 0x84,
00336 };
00337 
00338 /** XSMP virtual Ethernet update bitmask */
00339 enum xsmp_xve_update {
00340         /** Update MTU */
00341         XSMP_XVE_UPDATE_MTU = ( 1 << 2 ),
00342         /** Update administrative state */
00343         XSMP_XVE_UPDATE_STATE = ( 1 << 6 ),
00344         /** Update gateway to mark as down */
00345         XSMP_XVE_UPDATE_GW_DOWN = ( 1 << 30 ),
00346         /** Update gateway information */
00347         XSMP_XVE_UPDATE_GW_CHANGE = ( 1 << 31 ),
00348 };
00349 
00350 /** XSMP virtual Ethernet modes */
00351 enum xsmp_xve_mode {
00352         /** Reliable Connected */
00353         XSMP_XVE_MODE_RC = 1,
00354         /** Unreliable Datagram */
00355         XSMP_XVE_MODE_UD = 2,
00356 };
00357 
00358 /** XSMP virtual Ethernet uplink types */
00359 enum xsmp_xve_uplink {
00360         /** No uplink */
00361         XSMP_XVE_NO_UPLINK = 1,
00362         /** Has uplink */
00363         XSMP_XVE_UPLINK = 2,
00364 };
00365 
00366 /** An XSMP message */
00367 union xsmp_message {
00368         /** Message header */
00369         struct xsmp_message_header hdr;
00370         /** Session message */
00371         struct xsmp_session_message sess;
00372         /** Virtual Ethernet message */
00373         struct xsmp_xve_message xve;
00374 };
00375 
00376 /** Delay between attempts to open the Infiniband device
00377  *
00378  * This is a policy decision.
00379  */
00380 #define XSIGO_OPEN_RETRY_DELAY ( 2 * TICKS_PER_SEC )
00381 
00382 /** Delay between unsuccessful discovery attempts
00383  *
00384  * This is a policy decision.
00385  */
00386 #define XSIGO_DISCOVERY_FAILURE_DELAY ( 10 * TICKS_PER_SEC )
00387 
00388 /** Delay between successful discovery attempts
00389  *
00390  * This is a policy decision.
00391  */
00392 #define XSIGO_DISCOVERY_SUCCESS_DELAY ( 20 * TICKS_PER_SEC )
00393 
00394 /** Delay between keepalive requests
00395  *
00396  * This is a policy decision.
00397  */
00398 #define XSIGO_KEEPALIVE_INTERVAL ( 10 * TICKS_PER_SEC )
00399 
00400 /** Maximum time to wait for a keepalive response
00401  *
00402  * This is a policy decision.
00403  */
00404 #define XSIGO_KEEPALIVE_MAX_WAIT ( 2 * TICKS_PER_SEC )
00405 
00406 #endif /* _IPXE_XSIGO_H */