iPXE
Data Structures | Macros | Enumerations | Functions
fcns.h File Reference

Fibre Channel name server lookups. More...

#include <stdint.h>
#include <ipxe/fc.h>

Go to the source code of this file.

Data Structures

struct  fc_ct_header
 A Fibre Channel Common Transport header. More...
 
struct  fc_ns_port_id
 A Fibre Channel name server port ID. More...
 
struct  fc_ns_gid_pn_request
 A Fibre Channel name server GID_PN request. More...
 
union  fc_ns_request
 A Fibre Channel name server request. More...
 
struct  fc_ns_reject_response
 A Fibre Channel name server rejection response. More...
 
struct  fc_ns_gid_pn_response
 A Fibre Channel name server GID_PN response. More...
 
union  fc_ns_response
 A Fibre Channel name server response. More...
 

Macros

#define FC_CT_REVISION   1
 Fibre Channel Common Transport revision. More...
 
#define FC_NS_CODE(command, key, value)   ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )
 Construct Fibre Channel name server command code. More...
 
#define FC_NS_GET(key, value)   FC_NS_CODE ( FC_NS_GET, key, value )
 Construct Fibre Channel name server "get" command code. More...
 
#define FC_NS_REGISTER(key, value)   FC_NS_CODE ( FC_NS_REGISTER, key, value )
 Construct Fibre Channel name server "register" command code. More...
 
#define FC_NS_COMMAND(code)   ( ( (code) >> 8 ) & 0xf )
 Extract Fibre Channel name server command. More...
 
#define FC_NS_KEY(code)   ( ( (code) >> 4 ) & 0xf )
 Extract Fibre Channel name server key. More...
 
#define FC_NS_VALUE(code)   ( ( (code) >> 0 ) & 0xf )
 Extract Fibre Channel name server value. More...
 

Enumerations

enum  fc_gs_type { FC_GS_TYPE_DS = 0xfc }
 Fibre Channel generic service type. More...
 
enum  fc_gs_response_code { FC_GS_ACCEPT = 0x8002, FC_GS_REJECT = 0x8001 }
 Fibre Channel generic service response codes. More...
 
enum  fc_gs_reason_code {
  FC_GS_BAD_COMMAND = 0x01, FC_GS_BAD_VERSION = 0x02, FC_GS_ERROR = 0x03, FC_GS_BAD_SIZE = 0x04,
  FC_GS_BUSY = 0x05, FC_GS_EPROTO = 0x07, FC_GS_UNABLE = 0x09, FC_GS_ENOTSUP = 0x0b,
  FC_GS_UNAVAILABLE = 0x0d, FC_GS_SESSION = 0x0e
}
 Fibre Channel generic service rejection reason codes. More...
 
enum  fc_ds_subtype { FC_DS_SUBTYPE_NAME = 0x02 }
 Fibre Channel directory service subtype. More...
 
enum  fc_ns_command_nibble { FC_NS_GET = 0x1, FC_NS_REGISTER = 0x2, FC_NS_DEREGISTER = 0x3 }
 Fibre Channel name server commands. More...
 
enum  fc_ns_object_nibble {
  FC_NS_PORT_ID = 0x1, FC_NS_PORT_NAME = 0x2, FC_NS_NODE_NAME = 0x3, FC_NS_FC4_TYPES = 0x7,
  FC_NS_SYM_PORT_NAME = 0x8, FC_NS_SYM_NODE_NAME = 0x9, FC_NS_FC4_FEATURES = 0xf
}
 Fibre Channel name server objects. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int fc_ns_query (struct fc_peer *peer, struct fc_port *port, int(*done)(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id))
 Issue Fibre Channel name server query. More...
 

Detailed Description

Fibre Channel name server lookups.

Definition in file fcns.h.

Macro Definition Documentation

◆ FC_CT_REVISION

#define FC_CT_REVISION   1

Fibre Channel Common Transport revision.

Definition at line 45 of file fcns.h.

◆ FC_NS_CODE

#define FC_NS_CODE (   command,
  key,
  value 
)    ( ( (command) << 8 ) | ( (key) << 4 ) | ( (value) << 0 ) )

Construct Fibre Channel name server command code.

Parameters
commandName server command
keyName server key
valueName server value
Return values
codeName server command code

Definition at line 126 of file fcns.h.

◆ FC_NS_GET

#define FC_NS_GET (   key,
  value 
)    FC_NS_CODE ( FC_NS_GET, key, value )

Construct Fibre Channel name server "get" command code.

Parameters
keyName server key
valueName server value to get
Return values
codeName server command code

Definition at line 135 of file fcns.h.

◆ FC_NS_REGISTER

#define FC_NS_REGISTER (   key,
  value 
)    FC_NS_CODE ( FC_NS_REGISTER, key, value )

Construct Fibre Channel name server "register" command code.

Parameters
keyName server key
valueName server value to register
Return values
codeName server command code

Definition at line 143 of file fcns.h.

◆ FC_NS_COMMAND

#define FC_NS_COMMAND (   code)    ( ( (code) >> 8 ) & 0xf )

Extract Fibre Channel name server command.

Parameters
codeName server command code
Return values
commandName server command

Definition at line 150 of file fcns.h.

◆ FC_NS_KEY

#define FC_NS_KEY (   code)    ( ( (code) >> 4 ) & 0xf )

Extract Fibre Channel name server key.

Parameters
codeName server command code
Return values
keyName server key

Definition at line 157 of file fcns.h.

◆ FC_NS_VALUE

#define FC_NS_VALUE (   code)    ( ( (code) >> 0 ) & 0xf )

Extract Fibre Channel name server value.

Parameters
codeName server command code
Return values
valueNAme server value

Definition at line 164 of file fcns.h.

Enumeration Type Documentation

◆ fc_gs_type

enum fc_gs_type

Fibre Channel generic service type.

Enumerator
FC_GS_TYPE_DS 

Directory service.

Definition at line 48 of file fcns.h.

48  {
49  /** Directory service */
50  FC_GS_TYPE_DS = 0xfc,
51 };
Directory service.
Definition: fcns.h:50

◆ fc_gs_response_code

Fibre Channel generic service response codes.

Enumerator
FC_GS_ACCEPT 

Accepted.

FC_GS_REJECT 

Rejected.

Definition at line 54 of file fcns.h.

54  {
55  /** Accepted */
56  FC_GS_ACCEPT = 0x8002,
57  /** Rejected */
58  FC_GS_REJECT = 0x8001,
59 };
Rejected.
Definition: fcns.h:58
Accepted.
Definition: fcns.h:56

◆ fc_gs_reason_code

Fibre Channel generic service rejection reason codes.

Enumerator
FC_GS_BAD_COMMAND 

Invalid command code.

FC_GS_BAD_VERSION 

Invalid version level.

FC_GS_ERROR 

Logical error.

FC_GS_BAD_SIZE 

Invalid CT_IU size.

FC_GS_BUSY 

Logical busy.

FC_GS_EPROTO 

Protocol error.

FC_GS_UNABLE 

Unable to perform command request.

FC_GS_ENOTSUP 

Command not supported.

FC_GS_UNAVAILABLE 

Server not available.

FC_GS_SESSION 

Session could not be established.

Definition at line 62 of file fcns.h.

62  {
63  /** Invalid command code */
64  FC_GS_BAD_COMMAND = 0x01,
65  /** Invalid version level */
66  FC_GS_BAD_VERSION = 0x02,
67  /** Logical error */
68  FC_GS_ERROR = 0x03,
69  /** Invalid CT_IU size */
70  FC_GS_BAD_SIZE = 0x04,
71  /** Logical busy */
72  FC_GS_BUSY = 0x05,
73  /** Protocol error */
74  FC_GS_EPROTO = 0x07,
75  /** Unable to perform command request */
76  FC_GS_UNABLE = 0x09,
77  /** Command not supported */
78  FC_GS_ENOTSUP = 0x0b,
79  /** Server not available */
80  FC_GS_UNAVAILABLE = 0x0d,
81  /** Session could not be established */
82  FC_GS_SESSION = 0x0e,
83 };
Server not available.
Definition: fcns.h:80
Invalid version level.
Definition: fcns.h:66
Logical busy.
Definition: fcns.h:72
Protocol error.
Definition: fcns.h:74
Unable to perform command request.
Definition: fcns.h:76
Command not supported.
Definition: fcns.h:78
Invalid command code.
Definition: fcns.h:64
Invalid CT_IU size.
Definition: fcns.h:70
Session could not be established.
Definition: fcns.h:82
Logical error.
Definition: fcns.h:68

◆ fc_ds_subtype

Fibre Channel directory service subtype.

Enumerator
FC_DS_SUBTYPE_NAME 

Name server.

Definition at line 86 of file fcns.h.

86  {
87  /** Name server */
88  FC_DS_SUBTYPE_NAME = 0x02,
89 };
Name server.
Definition: fcns.h:88

◆ fc_ns_command_nibble

Fibre Channel name server commands.

Enumerator
FC_NS_GET 

Get.

FC_NS_REGISTER 

Register.

FC_NS_DEREGISTER 

De-register.

Definition at line 92 of file fcns.h.

92  {
93  /** Get */
94  FC_NS_GET = 0x1,
95  /** Register */
96  FC_NS_REGISTER = 0x2,
97  /** De-register */
98  FC_NS_DEREGISTER = 0x3,
99 };
#define FC_NS_REGISTER(key, value)
Construct Fibre Channel name server "register" command code.
Definition: fcns.h:143
De-register.
Definition: fcns.h:98
#define FC_NS_GET(key, value)
Construct Fibre Channel name server "get" command code.
Definition: fcns.h:135

◆ fc_ns_object_nibble

Fibre Channel name server objects.

Enumerator
FC_NS_PORT_ID 

Port ID.

FC_NS_PORT_NAME 

Port name.

FC_NS_NODE_NAME 

Node name.

FC_NS_FC4_TYPES 

FC-4 types.

FC_NS_SYM_PORT_NAME 

Symbolic port name.

FC_NS_SYM_NODE_NAME 

Symbolic node name.

FC_NS_FC4_FEATURES 

FC-4 features.

Definition at line 102 of file fcns.h.

102  {
103  /** Port ID */
104  FC_NS_PORT_ID = 0x1,
105  /** Port name */
106  FC_NS_PORT_NAME = 0x2,
107  /** Node name */
108  FC_NS_NODE_NAME = 0x3,
109  /** FC-4 types */
110  FC_NS_FC4_TYPES = 0x7,
111  /** Symbolic port name */
112  FC_NS_SYM_PORT_NAME = 0x8,
113  /** Symbolic node name */
114  FC_NS_SYM_NODE_NAME = 0x9,
115  /** FC-4 features */
116  FC_NS_FC4_FEATURES = 0xf,
117 };
Port name.
Definition: fcns.h:106
Node name.
Definition: fcns.h:108
Symbolic node name.
Definition: fcns.h:114
Port ID.
Definition: fcns.h:104
FC-4 types.
Definition: fcns.h:110
Symbolic port name.
Definition: fcns.h:112
FC-4 features.
Definition: fcns.h:116

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ fc_ns_query()

int fc_ns_query ( struct fc_peer peer,
struct fc_port port,
int(*)(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id)  done 
)

Issue Fibre Channel name server query.

Parameters
peerFibre Channel peer
portFibre Channel port
Return values
rcReturn status code

Definition at line 222 of file fcns.c.

224  {
225  struct fc_ns_query *query;
226 
227  /* Allocate and initialise structure */
228  query = zalloc ( sizeof ( *query ) );
229  if ( ! query )
230  return -ENOMEM;
231  ref_init ( &query->refcnt, fc_ns_query_free );
232  intf_init ( &query->xchg, &fc_ns_query_xchg_desc, &query->refcnt );
234  &query->refcnt );
235  query->peer = fc_peer_get ( peer );
236  query->port = fc_port_get ( port );
237  query->done = done;
238 
239  DBGC ( query, "FCNS %p querying %s via %s\n",
240  query, fc_ntoa ( &query->peer->port_wwn ), port->name );
241 
242  /* Mortalise self and return */
243  ref_put ( &query->refcnt );
244  return 0;
245 }
static void fc_ns_query_free(struct refcnt *refcnt)
Free name server query.
Definition: fcns.c:74
struct interface xchg
Fibre Channel exchange.
Definition: fcns.c:49
A Fibre Channel name server query.
Definition: fcns.c:45
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
static void process_init(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process and add to process list.
Definition: process.h:161
#define DBGC(...)
Definition: compiler.h:505
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
static struct process_descriptor fc_ns_query_process_desc
Name server process descriptor.
Definition: fcns.c:212
struct refcnt refcnt
Reference count.
Definition: fcns.c:47
#define ENOMEM
Not enough space.
Definition: errno.h:534
u8 port
Port number.
Definition: CIB_PRM.h:31
int(* done)(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id)
Success handler.
Definition: fcns.c:65
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct fc_name port_wwn
Port name.
Definition: fc.h:347
struct process process
Process.
Definition: fcns.c:57
static struct fc_peer * fc_peer_get(struct fc_peer *peer)
Get reference to Fibre Channel peer.
Definition: fc.h:379
static struct fc_port * fc_port_get(struct fc_port *port)
Get reference to Fibre Channel port.
Definition: fc.h:304
static struct interface_descriptor fc_ns_query_xchg_desc
Name server exchange interface descriptor.
Definition: fcns.c:208
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:173
struct fc_peer * peer
Fibre Channel peer.
Definition: fcns.c:52
struct bofm_section_header done
Definition: bofm_test.c:46
struct fc_port * port
Fibre Channel port.
Definition: fcns.c:54
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References DBGC, fc_ns_query::done, done, ENOMEM, fc_ns_query_free(), fc_ns_query_process_desc, fc_ns_query_xchg_desc, fc_ntoa(), fc_peer_get(), fc_port_get(), intf_init(), fc_ns_query::peer, port, fc_ns_query::port, fc_peer::port_wwn, fc_ns_query::process, process_init(), ref_init, ref_put, fc_ns_query::refcnt, fc_ns_query::xchg, and zalloc().