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

Fibre Channel Extended Link Services. More...

#include <stdint.h>
#include <ipxe/fc.h>
#include <ipxe/tables.h>
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
#include <ipxe/process.h>
#include <ipxe/interface.h>

Go to the source code of this file.

Data Structures

struct  fc_els_frame_common
 Fibre Channel ELS frame common parameters. More...
 
struct  fc_ls_rjt_frame
 A Fibre Channel LS_RJT frame. More...
 
struct  fc_login_common
 Fibre Channel "common" service parameters. More...
 
struct  fc_login_class
 Fibre Channel class-specific login parameters. More...
 
struct  fc_login_frame
 A Fibre Channel FLOGI/PLOGI frame. More...
 
struct  fc_logout_request_frame
 A Fibre Channel LOGO request frame. More...
 
struct  fc_logout_response_frame
 A Fibre Channel LOGO response frame. More...
 
struct  fc_prli_page
 A Fibre Channel PRLI service parameter page. More...
 
struct  fc_prli_frame
 A Fibre Channel PRLI frame. More...
 
struct  fc_rtv_request_frame
 A Fibre Channel RTV request frame. More...
 
struct  fc_rtv_response_frame
 A Fibre Channel RTV response frame. More...
 
struct  fc_echo_frame_header
 A Fibre Channel ECHO frame. More...
 
struct  fc_els
 A Fibre Channel extended link services transaction. More...
 
struct  fc_els_handler
 A Fibre Channel extended link services handler. More...
 
struct  fc_els_prli_descriptor
 A Fibre Channel ELS PRLI descriptor. More...
 

Macros

#define FC_LOGIN_VERSION   0x2020
 Fibre Channel default login version. More...
 
#define FC_LOGIN_DEFAULT_B2B   10
 Fibre Channel default buffer-to-buffer credit. More...
 
#define FC_LOGIN_CONTINUOUS_OFFSET   0x8000
 Continuously increasing relative offset. More...
 
#define FC_LOGIN_CLEAN   0x8000
 Clean address. More...
 
#define FC_LOGIN_MULTI_N   0x8000
 Multiple N_Port_ID support. More...
 
#define FC_LOGIN_RANDOM_OFFSET   0x4000
 Random relative offset. More...
 
#define FC_LOGIN_VIRTUAL   0x4000
 Virtual fabrics. More...
 
#define FC_LOGIN_VENDOR   0x2000
 Vendor version level. More...
 
#define FC_LOGIN_MULTI_F   0x2000
 Multiple N_Port_ID support. More...
 
#define FC_LOGIN_F_PORT   0x1000
 Forwarder port. More...
 
#define FC_LOGIN_ALT_CREDIT   0x0800
 Alternative credit management. More...
 
#define FC_LOGIN_NSS_STARTED   0x0800
 Name server session started. More...
 
#define FC_LOGIN_NSS_BEGIN   0x0400
 Begin name server session. More...
 
#define FC_LOGIN_HIRES_E_D_TOV   0x0400
 1ns error detection timer resolution More...
 
#define FC_LOGIN_BROADCAST   0x0100
 Broadcast supported. More...
 
#define FC_LOGIN_QUERY_BUF   0x0040
 Query buffer conditions. More...
 
#define FC_LOGIN_SECURITY   0x0020
 Security. More...
 
#define FC_LOGIN_CLOCK_SYNC   0x0010
 Clock sync primitive capable. More...
 
#define FC_LOGIN_SHORT_R_T_TOV   0x0008
 Short R_T timeout. More...
 
#define FC_LOGIN_DHD   0x0004
 Dynamic half duplex. More...
 
#define FC_LOGIN_CONTINUOUS_SEQ   0x0002
 Continuously increasing sequence count. More...
 
#define FC_LOGIN_PAYLOAD   0x0001
 Payload. More...
 
#define FC_LOGIN_DEFAULT_MTU   1452
 Fibre Channel default MTU. More...
 
#define FC_LOGIN_DEFAULT_MAX_SEQ   255
 Default maximum number of concurrent sequences. More...
 
#define FC_LOGIN_DEFAULT_REL_OFFS   0x1f
 Default relative offset by info category. More...
 
#define FC_LOGIN_DEFAULT_E_D_TOV   2000
 Default E_D timeout value. More...
 
#define FC_LOGIN_CLASS_VALID   0x8000
 Class valid. More...
 
#define FC_LOGIN_CLASS_SEQUENTIAL   0x0800
 Sequential delivery requested. More...
 
#define FC_PRLI_ESTABLISH   0x2000
 Establish image pair. More...
 
#define FC_PRLI_RESPONSE_MASK   0x0f00
 Response code mask. More...
 
#define FC_PRLI_RESPONSE_SUCCESS   0x0100
 Request was executed successfully. More...
 
#define FC_RTV_HIRES_E_D_TOV   0x0400
 1ns error detection timer resolution More...
 
#define FC_RTV_SHORT_R_T_TOV   0x0008
 Short R_T timeout. More...
 
#define FC_ELS_HANDLERS   __table ( struct fc_els_handler, "fc_els_handlers" )
 Fibre Channel ELS handler table. More...
 
#define __fc_els_handler   __table_entry ( FC_ELS_HANDLERS, 01 )
 Declare a Fibre Channel ELS handler. More...
 
#define FC_ELS_PRLI_DESCRIPTORS   __table ( struct fc_els_prli_descriptor, "fc_els_prli_descriptors" )
 Fibre Channel ELS PRLI descriptor table. More...
 
#define __fc_els_prli_descriptor   __table_entry ( FC_ELS_PRLI_DESCRIPTORS, 01 )
 Declare a Fibre Channel ELS PRLI descriptor. More...
 

Enumerations

enum  fc_els_command_code {
  FC_ELS_LS_RJT = 0x01, FC_ELS_LS_ACC = 0x02, FC_ELS_PLOGI = 0x03, FC_ELS_FLOGI = 0x04,
  FC_ELS_LOGO = 0x05, FC_ELS_RTV = 0x0e, FC_ELS_ECHO = 0x10, FC_ELS_PRLI = 0x20,
  FC_ELS_PRLO = 0x21
}
 Fibre Channel ELS command codes. More...
 
enum  fc_els_reject_reason {
  FC_ELS_RJT_INVALID_COMMAND = 0x01, FC_ELS_RJT_ILLOGICAL = 0x03, FC_ELS_RJT_BUSY = 0x05, FC_ELS_RJT_PROTOCOL = 0x07,
  FC_ELS_RJT_UNABLE = 0x09, FC_ELS_RJT_UNSUPPORTED = 0x0b, FC_ELS_RJT_IN_PROGRESS = 0x0e
}
 Fibre Channel ELS rejection reason codes. More...
 
enum  fc_els_flags { FC_ELS_REQUEST = 0x0001 }
 Fibre Channel extended link services transaction flags. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static int fc_els_is_request (struct fc_els *els)
 Check if Fibre Channel ELS transaction is a request. More...
 
static unsigned int fc_els_tx_command (struct fc_els *els, unsigned int request_command)
 Calculate ELS command to transmit. More...
 
int fc_els_tx (struct fc_els *els, const void *data, size_t len)
 Transmit Fibre Channel ELS frame. More...
 
int fc_els_request (struct interface *job, struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
 Create ELS request. More...
 
int fc_els_flogi (struct interface *parent, struct fc_port *port)
 Create FLOGI request. More...
 
int fc_els_plogi (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create PLOGI request. More...
 
int fc_els_logo (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create LOGO request. More...
 
int fc_els_prli (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id, unsigned int type)
 Create PRLI request. More...
 
int fc_els_prli_tx (struct fc_els *els, struct fc_els_prli_descriptor *descriptor, void *param)
 Transmit PRLI. More...
 
int fc_els_prli_rx (struct fc_els *els, struct fc_els_prli_descriptor *descriptor, void *data, size_t len)
 Receive PRLI. More...
 
int fc_els_prli_detect (struct fc_els *els __unused, struct fc_els_prli_descriptor *descriptor, const void *data, size_t len)
 Detect PRLI. More...
 

Detailed Description

Fibre Channel Extended Link Services.

Definition in file fcels.h.

Macro Definition Documentation

◆ FC_LOGIN_VERSION

#define FC_LOGIN_VERSION   0x2020

Fibre Channel default login version.

Definition at line 102 of file fcels.h.

◆ FC_LOGIN_DEFAULT_B2B

#define FC_LOGIN_DEFAULT_B2B   10

Fibre Channel default buffer-to-buffer credit.

Definition at line 105 of file fcels.h.

◆ FC_LOGIN_CONTINUOUS_OFFSET

#define FC_LOGIN_CONTINUOUS_OFFSET   0x8000

Continuously increasing relative offset.

Definition at line 108 of file fcels.h.

◆ FC_LOGIN_CLEAN

#define FC_LOGIN_CLEAN   0x8000

Clean address.

Definition at line 111 of file fcels.h.

◆ FC_LOGIN_MULTI_N

#define FC_LOGIN_MULTI_N   0x8000

Multiple N_Port_ID support.

Definition at line 114 of file fcels.h.

◆ FC_LOGIN_RANDOM_OFFSET

#define FC_LOGIN_RANDOM_OFFSET   0x4000

Random relative offset.

Definition at line 117 of file fcels.h.

◆ FC_LOGIN_VIRTUAL

#define FC_LOGIN_VIRTUAL   0x4000

Virtual fabrics.

Definition at line 120 of file fcels.h.

◆ FC_LOGIN_VENDOR

#define FC_LOGIN_VENDOR   0x2000

Vendor version level.

Definition at line 123 of file fcels.h.

◆ FC_LOGIN_MULTI_F

#define FC_LOGIN_MULTI_F   0x2000

Multiple N_Port_ID support.

Definition at line 126 of file fcels.h.

◆ FC_LOGIN_F_PORT

#define FC_LOGIN_F_PORT   0x1000

Forwarder port.

Definition at line 129 of file fcels.h.

◆ FC_LOGIN_ALT_CREDIT

#define FC_LOGIN_ALT_CREDIT   0x0800

Alternative credit management.

Definition at line 132 of file fcels.h.

◆ FC_LOGIN_NSS_STARTED

#define FC_LOGIN_NSS_STARTED   0x0800

Name server session started.

Definition at line 135 of file fcels.h.

◆ FC_LOGIN_NSS_BEGIN

#define FC_LOGIN_NSS_BEGIN   0x0400

Begin name server session.

Definition at line 138 of file fcels.h.

◆ FC_LOGIN_HIRES_E_D_TOV

#define FC_LOGIN_HIRES_E_D_TOV   0x0400

1ns error detection timer resolution

Definition at line 141 of file fcels.h.

◆ FC_LOGIN_BROADCAST

#define FC_LOGIN_BROADCAST   0x0100

Broadcast supported.

Definition at line 144 of file fcels.h.

◆ FC_LOGIN_QUERY_BUF

#define FC_LOGIN_QUERY_BUF   0x0040

Query buffer conditions.

Definition at line 147 of file fcels.h.

◆ FC_LOGIN_SECURITY

#define FC_LOGIN_SECURITY   0x0020

Security.

Definition at line 150 of file fcels.h.

◆ FC_LOGIN_CLOCK_SYNC

#define FC_LOGIN_CLOCK_SYNC   0x0010

Clock sync primitive capable.

Definition at line 153 of file fcels.h.

◆ FC_LOGIN_SHORT_R_T_TOV

#define FC_LOGIN_SHORT_R_T_TOV   0x0008

Short R_T timeout.

Definition at line 156 of file fcels.h.

◆ FC_LOGIN_DHD

#define FC_LOGIN_DHD   0x0004

Dynamic half duplex.

Definition at line 159 of file fcels.h.

◆ FC_LOGIN_CONTINUOUS_SEQ

#define FC_LOGIN_CONTINUOUS_SEQ   0x0002

Continuously increasing sequence count.

Definition at line 162 of file fcels.h.

◆ FC_LOGIN_PAYLOAD

#define FC_LOGIN_PAYLOAD   0x0001

Payload.

Definition at line 165 of file fcels.h.

◆ FC_LOGIN_DEFAULT_MTU

#define FC_LOGIN_DEFAULT_MTU   1452

Fibre Channel default MTU.

Definition at line 168 of file fcels.h.

◆ FC_LOGIN_DEFAULT_MAX_SEQ

#define FC_LOGIN_DEFAULT_MAX_SEQ   255

Default maximum number of concurrent sequences.

Definition at line 171 of file fcels.h.

◆ FC_LOGIN_DEFAULT_REL_OFFS

#define FC_LOGIN_DEFAULT_REL_OFFS   0x1f

Default relative offset by info category.

Definition at line 174 of file fcels.h.

◆ FC_LOGIN_DEFAULT_E_D_TOV

#define FC_LOGIN_DEFAULT_E_D_TOV   2000

Default E_D timeout value.

Definition at line 177 of file fcels.h.

◆ FC_LOGIN_CLASS_VALID

#define FC_LOGIN_CLASS_VALID   0x8000

Class valid.

Definition at line 202 of file fcels.h.

◆ FC_LOGIN_CLASS_SEQUENTIAL

#define FC_LOGIN_CLASS_SEQUENTIAL   0x0800

Sequential delivery requested.

Definition at line 205 of file fcels.h.

◆ FC_PRLI_ESTABLISH

#define FC_PRLI_ESTABLISH   0x2000

Establish image pair.

Definition at line 264 of file fcels.h.

◆ FC_PRLI_RESPONSE_MASK

#define FC_PRLI_RESPONSE_MASK   0x0f00

Response code mask.

Definition at line 267 of file fcels.h.

◆ FC_PRLI_RESPONSE_SUCCESS

#define FC_PRLI_RESPONSE_SUCCESS   0x0100

Request was executed successfully.

Definition at line 270 of file fcels.h.

◆ FC_RTV_HIRES_E_D_TOV

#define FC_RTV_HIRES_E_D_TOV   0x0400

1ns error detection timer resolution

Definition at line 309 of file fcels.h.

◆ FC_RTV_SHORT_R_T_TOV

#define FC_RTV_SHORT_R_T_TOV   0x0008

Short R_T timeout.

Definition at line 312 of file fcels.h.

◆ FC_ELS_HANDLERS

#define FC_ELS_HANDLERS   __table ( struct fc_els_handler, "fc_els_handlers" )

Fibre Channel ELS handler table.

Definition at line 380 of file fcels.h.

◆ __fc_els_handler

struct fc_els_handler fc_els_echo_handler __fc_els_handler   __table_entry ( FC_ELS_HANDLERS, 01 )

Declare a Fibre Channel ELS handler.

ECHO ELS handler.

RTV ELS handler.

LOGO ELS handler.

PLOGI ELS handler.

FLOGI ELS handler.

Unknown ELS handler.

Definition at line 383 of file fcels.h.

◆ FC_ELS_PRLI_DESCRIPTORS

#define FC_ELS_PRLI_DESCRIPTORS   __table ( struct fc_els_prli_descriptor, "fc_els_prli_descriptors" )

Fibre Channel ELS PRLI descriptor table.

Definition at line 396 of file fcels.h.

◆ __fc_els_prli_descriptor

struct fc_els_prli_descriptor fcp_prli_descriptor __fc_els_prli_descriptor   __table_entry ( FC_ELS_PRLI_DESCRIPTORS, 01 )

Declare a Fibre Channel ELS PRLI descriptor.

FCP PRLI descriptor.

Definition at line 400 of file fcels.h.

Enumeration Type Documentation

◆ fc_els_command_code

Fibre Channel ELS command codes.

Enumerator
FC_ELS_LS_RJT 

Link Service Reject.

FC_ELS_LS_ACC 

Link Service Accept.

FC_ELS_PLOGI 

Port Login.

FC_ELS_FLOGI 

Fabric Login.

FC_ELS_LOGO 

Logout.

FC_ELS_RTV 

Read Timeout Value.

FC_ELS_ECHO 

Echo.

FC_ELS_PRLI 

Process Login.

FC_ELS_PRLO 

Process Logout.

Definition at line 30 of file fcels.h.

30  {
31  FC_ELS_LS_RJT = 0x01, /**< Link Service Reject */
32  FC_ELS_LS_ACC = 0x02, /**< Link Service Accept */
33  FC_ELS_PLOGI = 0x03, /**< Port Login */
34  FC_ELS_FLOGI = 0x04, /**< Fabric Login */
35  FC_ELS_LOGO = 0x05, /**< Logout */
36  FC_ELS_RTV = 0x0e, /**< Read Timeout Value */
37  FC_ELS_ECHO = 0x10, /**< Echo */
38  FC_ELS_PRLI = 0x20, /**< Process Login */
39  FC_ELS_PRLO = 0x21, /**< Process Logout */
40 };
Echo.
Definition: fcels.h:37
Logout.
Definition: fcels.h:35
Fabric Login.
Definition: fcels.h:34
Link Service Reject.
Definition: fcels.h:31
Read Timeout Value.
Definition: fcels.h:36
Link Service Accept.
Definition: fcels.h:32
Process Login.
Definition: fcels.h:38
Port Login.
Definition: fcels.h:33
Process Logout.
Definition: fcels.h:39

◆ fc_els_reject_reason

Fibre Channel ELS rejection reason codes.

Enumerator
FC_ELS_RJT_INVALID_COMMAND 

Invalid ELS command code.

FC_ELS_RJT_ILLOGICAL 

Logical error.

FC_ELS_RJT_BUSY 

Logical busy.

FC_ELS_RJT_PROTOCOL 

Protocol error.

FC_ELS_RJT_UNABLE 

Unable to perform command request.

FC_ELS_RJT_UNSUPPORTED 

Command not supported.

FC_ELS_RJT_IN_PROGRESS 

Command already in progress.

Definition at line 57 of file fcels.h.

57  {
58  /** Invalid ELS command code */
60  /** Logical error */
61  FC_ELS_RJT_ILLOGICAL = 0x03,
62  /** Logical busy */
63  FC_ELS_RJT_BUSY = 0x05,
64  /** Protocol error */
65  FC_ELS_RJT_PROTOCOL = 0x07,
66  /** Unable to perform command request */
67  FC_ELS_RJT_UNABLE = 0x09,
68  /** Command not supported */
70  /** Command already in progress */
72 };
Logical busy.
Definition: fcels.h:63
Logical error.
Definition: fcels.h:61
Command not supported.
Definition: fcels.h:69
Invalid ELS command code.
Definition: fcels.h:59
Unable to perform command request.
Definition: fcels.h:67
Command already in progress.
Definition: fcels.h:71
Protocol error.
Definition: fcels.h:65

◆ fc_els_flags

Fibre Channel extended link services transaction flags.

Enumerator
FC_ELS_REQUEST 

ELS transaction is a request.

Definition at line 346 of file fcels.h.

346  {
347  /** ELS transaction is a request */
348  FC_ELS_REQUEST = 0x0001,
349 };
ELS transaction is a request.
Definition: fcels.h:348

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ fc_els_is_request()

static int fc_els_is_request ( struct fc_els els)
inlinestatic

Check if Fibre Channel ELS transaction is a request.

Parameters
elsFibre Channel ELS transaction
Return values
is_requestELS transaction is a request

Definition at line 408 of file fcels.h.

408  {
409  return ( els->flags & FC_ELS_REQUEST );
410 }
ELS transaction is a request.
Definition: fcels.h:348
unsigned int flags
Flags.
Definition: fcels.h:342

References FC_ELS_REQUEST, and fc_els::flags.

Referenced by fc_els_echo_rx(), fc_els_flogi_rx(), fc_els_logo_rx(), fc_els_plogi_rx(), fc_els_prli_rx(), fc_els_prli_tx(), fc_els_rtv_rx(), fc_els_rx(), fc_els_step(), fc_els_tx(), fc_els_tx_command(), and fc_els_unknown_rx().

◆ fc_els_tx_command()

static unsigned int fc_els_tx_command ( struct fc_els els,
unsigned int  request_command 
)
inlinestatic

Calculate ELS command to transmit.

Parameters
elsFibre Channel ELS transaction
request_commandCommand for requests
commandCommand to transmit

Definition at line 419 of file fcels.h.

420  {
421  return ( fc_els_is_request ( els ) ? request_command : FC_ELS_LS_ACC );
422 }
Link Service Accept.
Definition: fcels.h:32
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408

References fc_els_is_request(), and FC_ELS_LS_ACC.

Referenced by fc_els_flogi_tx(), fc_els_plogi_tx(), and fc_els_prli_tx().

◆ fc_els_tx()

int fc_els_tx ( struct fc_els els,
const void *  data,
size_t  len 
)

Transmit Fibre Channel ELS frame.

Parameters
elsFibre Channel ELS transaction
dataData to transmit
lenLength of data
Return values
rcReturn status code

Definition at line 126 of file fcels.c.

126  {
127  struct xfer_metadata meta;
128  struct sockaddr_fc dest;
129  int rc;
130 
131  DBGC2 ( els, FCELS_FMT " transmitting:\n", FCELS_ARGS ( els ) );
132  DBGC2_HDA ( els, 0, data, len );
133 
134  /* Construct metadata */
135  memset ( &meta, 0, sizeof ( meta ) );
136  meta.flags = ( fc_els_is_request ( els ) ?
138  meta.dest = fc_fill_sockaddr ( &dest, &els->peer_port_id );
139 
140  /* Transmit frame */
141  if ( ( rc = xfer_deliver_raw_meta ( &els->xchg, data, len,
142  &meta ) ) != 0 ) {
143  DBGC ( els, FCELS_FMT " could not deliver frame: %s\n",
144  FCELS_ARGS ( els ), strerror ( rc ) );
145  return rc;
146  }
147 
148  return 0;
149 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
Data transfer metadata.
Definition: xfer.h:22
int xfer_deliver_raw_meta(struct interface *intf, const void *data, size_t len, struct xfer_metadata *meta)
Deliver datagram as raw data.
Definition: xfer.c:268
#define DBGC(...)
Definition: compiler.h:505
Fibre Channel socket address.
Definition: fc.h:47
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
#define XFER_FL_RESPONSE
Data content is a response.
Definition: xfer.h:63
struct interface xchg
Fibre Channel exchange.
Definition: fcels.h:329
struct sockaddr * fc_fill_sockaddr(struct sockaddr_fc *sa_fc, struct fc_port_id *id)
Fill Fibre Channel socket address.
Definition: fc.c:165
static void * dest
Definition: strings.h:176
int meta(WINDOW *, bool)
#define DBGC2_HDA(...)
Definition: compiler.h:523
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408
uint32_t len
Length.
Definition: ena.h:14
#define DBGC2(...)
Definition: compiler.h:522
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define XFER_FL_OVER
Sender is relinquishing use of half-duplex channel.
Definition: xfer.h:50
#define XFER_FL_OUT
This is the final data transfer.
Definition: xfer.h:53
void * memset(void *dest, int character, size_t len) __nonnull

References data, DBGC, DBGC2, DBGC2_HDA, dest, fc_els_is_request(), fc_fill_sockaddr(), FCELS_ARGS, FCELS_FMT, len, memset(), meta(), fc_els::peer_port_id, rc, strerror(), fc_els::xchg, xfer_deliver_raw_meta(), XFER_FL_OUT, XFER_FL_OVER, and XFER_FL_RESPONSE.

Referenced by fc_els_echo_rx_request(), fc_els_echo_tx(), fc_els_flogi_tx(), fc_els_logo_tx(), fc_els_logo_tx_response(), fc_els_plogi_tx(), fc_els_prli_tx(), fc_els_rtv_tx_response(), and fc_els_unknown_tx_response().

◆ fc_els_request()

int fc_els_request ( struct interface job,
struct fc_port port,
struct fc_port_id peer_port_id,
struct fc_els_handler handler 
)

Create ELS request.

Parameters
jobParent job-control interface
portFibre Channel port
peer_port_idPeer port ID
handlerELS handler
Return values
rcReturn status code

Definition at line 323 of file fcels.c.

325  {
326  struct fc_els *els;
327 
328  /* Allocate and initialise structure */
329  els = fc_els_create ( port, &port->port_id, peer_port_id );
330  if ( ! els )
331  return -ENOMEM;
332  els->handler = handler;
333  els->flags = FC_ELS_REQUEST;
334  process_add ( &els->process );
335 
336  /* Attach to parent job interface, mortalise self, and return */
337  intf_plug_plug ( &els->job, job );
338  ref_put ( &els->refcnt );
339  return 0;
340 }
struct fc_els_handler * handler
ELS handler, if known.
Definition: fcels.h:340
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
#define ENOMEM
Not enough space.
Definition: errno.h:534
u8 port
Port number.
Definition: CIB_PRM.h:31
ELS transaction is a request.
Definition: fcels.h:348
struct refcnt refcnt
Reference count.
Definition: fcels.h:325
void process_add(struct process *process)
Add process to process list.
Definition: process.c:59
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
struct interface job
Job control interface.
Definition: fcels.h:327
static struct fc_els * fc_els_create(struct fc_port *port, struct fc_port_id *port_id, struct fc_port_id *peer_port_id)
Create ELS transaction.
Definition: fcels.c:293
unsigned int flags
Flags.
Definition: fcels.h:342
struct process process
Request sending process.
Definition: fcels.h:331
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ENOMEM, fc_els_create(), FC_ELS_REQUEST, fc_els::flags, fc_els::handler, intf_plug_plug(), fc_els::job, fc_els::peer_port_id, port, fc_els::process, process_add(), ref_put, and fc_els::refcnt.

Referenced by fc_els_flogi(), fc_els_logo(), fc_els_plogi(), fc_els_prli(), and fcels().

◆ fc_els_flogi()

int fc_els_flogi ( struct interface parent,
struct fc_port port 
)

Create FLOGI request.

Parameters
parentParent interface
portFibre Channel port
Return values
rcReturn status code

Definition at line 581 of file fcels.c.

581  {
582 
583  return fc_els_request ( parent, port, &fc_f_port_id,
584  &fc_els_flogi_handler );
585 }
int fc_els_request(struct interface *job, struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
Create ELS request.
Definition: fcels.c:323
struct fc_port_id fc_f_port_id
F_Port contoller port ID.
Definition: fc.c:68
u8 port
Port number.
Definition: CIB_PRM.h:31

References fc_els_request(), fc_f_port_id, and port.

Referenced by fc_port_examine().

◆ fc_els_plogi()

int fc_els_plogi ( struct interface parent,
struct fc_port port,
struct fc_port_id peer_port_id 
)

Create PLOGI request.

Parameters
parentParent interface
portFibre Channel port
peer_port_idPeer port ID
Return values
rcReturn status code

Definition at line 733 of file fcels.c.

734  {
735 
736  return fc_els_request ( parent, port, peer_port_id,
737  &fc_els_plogi_handler );
738 }
int fc_els_request(struct interface *job, struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
Create ELS request.
Definition: fcels.c:323
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
u8 port
Port number.
Definition: CIB_PRM.h:31

References fc_els_request(), and port.

Referenced by fc_peer_plogi(), and fc_port_login().

◆ fc_els_logo()

int fc_els_logo ( struct interface parent,
struct fc_port port,
struct fc_port_id peer_port_id 
)

Create LOGO request.

Parameters
parentParent interface
portFibre Channel port
peer_port_idPeer port ID
Return values
rcReturn status code

Definition at line 911 of file fcels.c.

912  {
913 
914  return fc_els_request ( parent, port, peer_port_id,
915  &fc_els_logo_handler );
916 }
int fc_els_request(struct interface *job, struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
Create ELS request.
Definition: fcels.c:323
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
u8 port
Port number.
Definition: CIB_PRM.h:31

References fc_els_request(), and port.

◆ fc_els_prli()

int fc_els_prli ( struct interface parent,
struct fc_port port,
struct fc_port_id peer_port_id,
unsigned int  type 
)

Create PRLI request.

Parameters
parentParent interface
portFibre Channel port
peer_port_idPeer port ID
typeUpper-layer protocol type
Return values
rcReturn status code

Definition at line 1124 of file fcels.c.

1125  {
1126  struct fc_els_prli_descriptor *descriptor;
1127 
1128  /* Find a PRLI descriptor */
1129  descriptor = fc_els_prli_descriptor ( type );
1130  if ( ! descriptor )
1131  return -ENOTSUP;
1132 
1133  return fc_els_request ( parent, port, peer_port_id,
1134  descriptor->handler );
1135 }
int fc_els_request(struct interface *job, struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
Create ELS request.
Definition: fcels.c:323
static struct fc_els_prli_descriptor * fc_els_prli_descriptor(unsigned int type)
Find PRLI descriptor.
Definition: fcels.c:932
struct fc_els_handler * handler
Fibre Channel ELS handler.
Definition: fcels.h:392
#define ENOTSUP
Operation not supported.
Definition: errno.h:589
u8 port
Port number.
Definition: CIB_PRM.h:31
uint32_t type
Operating system type.
Definition: ena.h:12
A Fibre Channel ELS PRLI descriptor.
Definition: fcels.h:386

References ENOTSUP, fc_els_prli_descriptor(), fc_els_request(), fc_els_prli_descriptor::handler, port, and type.

Referenced by fc_ulp_examine().

◆ fc_els_prli_tx()

int fc_els_prli_tx ( struct fc_els els,
struct fc_els_prli_descriptor descriptor,
void *  param 
)

Transmit PRLI.

Parameters
elsFibre Channel ELS transaction
descriptorELS PRLI descriptor
paramService parameters
Return values
rcReturn status code

Definition at line 950 of file fcels.c.

951  {
952  struct {
953  struct fc_prli_frame frame;
954  uint8_t param[descriptor->param_len];
955  } __attribute__ (( packed )) prli;
956  struct fc_ulp *ulp;
957  int rc;
958 
959  /* Get ULP */
960  ulp = fc_ulp_get_port_id_type ( els->port, &els->peer_port_id,
961  descriptor->type );
962  if ( ! ulp ) {
963  rc = -ENOMEM;
964  goto err_get_port_id_type;
965  }
966 
967  /* Build frame for transmission */
968  memset ( &prli, 0, sizeof ( prli ) );
969  prli.frame.command = fc_els_tx_command ( els, FC_ELS_PRLI );
970  prli.frame.page_len =
971  ( sizeof ( prli.frame.page ) + sizeof ( prli.param ) );
972  prli.frame.len = htons ( sizeof ( prli ) );
973  prli.frame.page.type = descriptor->type;
974  if ( fc_els_is_request ( els ) ) {
975  prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH );
976  } else if ( fc_link_ok ( &ulp->link ) ) {
977  prli.frame.page.flags |= htons ( FC_PRLI_ESTABLISH |
979  }
980  memcpy ( &prli.param, param, sizeof ( prli.param ) );
981 
982  /* Transmit frame */
983  if ( ( rc = fc_els_tx ( els, &prli, sizeof ( prli ) ) ) != 0 )
984  goto err_tx;
985 
986  /* Drop temporary reference to ULP */
987  fc_ulp_put ( ulp );
988 
989  return 0;
990 
991  err_tx:
992  fc_ulp_put ( ulp );
993  err_get_port_id_type:
994  return rc;
995 }
#define __attribute__(x)
Definition: compiler.h:10
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
size_t param_len
Service parameter length.
Definition: fcels.h:390
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
unsigned long frame
Definition: xengrant.h:179
#define ENOMEM
Not enough space.
Definition: errno.h:534
void * memcpy(void *dest, const void *src, size_t len) __nonnull
A Fibre Channel PRLI frame.
Definition: fcels.h:273
static int fc_link_ok(struct fc_link_state *link)
Check Fibre Channel link state.
Definition: fc.h:108
#define FC_PRLI_ESTABLISH
Establish image pair.
Definition: fcels.h:264
struct interface prli
PRLI interface.
Definition: fc.h:429
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
static unsigned int fc_els_tx_command(struct fc_els *els, unsigned int request_command)
Calculate ELS command to transmit.
Definition: fcels.h:419
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
Process Login.
Definition: fcels.h:38
struct fc_link_state link
Link state monitor.
Definition: fc.h:427
unsigned char uint8_t
Definition: stdint.h:10
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408
static void fc_ulp_put(struct fc_ulp *ulp)
Drop reference to Fibre Channel upper-layer protocol.
Definition: fc.h:485
#define FC_PRLI_RESPONSE_SUCCESS
Request was executed successfully.
Definition: fcels.h:270
struct fc_ulp * fc_ulp_get_port_id_type(struct fc_port *port, const struct fc_port_id *peer_port_id, unsigned int type)
Get Fibre Channel upper-layer protocol by port ID and type.
Definition: fc.c:1915
unsigned int type
Upper-layer protocol type.
Definition: fcels.h:388
#define htons(value)
Definition: byteswap.h:135
A Fibre Channel upper-layer protocol.
Definition: fc.h:413
void * memset(void *dest, int character, size_t len) __nonnull

References __attribute__, ENOMEM, fc_els_is_request(), FC_ELS_PRLI, fc_els_tx(), fc_els_tx_command(), fc_link_ok(), FC_PRLI_ESTABLISH, FC_PRLI_RESPONSE_SUCCESS, fc_ulp_get_port_id_type(), fc_ulp_put(), frame, htons, fc_ulp::link, memcpy(), memset(), param, fc_els_prli_descriptor::param_len, fc_els::peer_port_id, fc_els::port, fc_ulp::prli, rc, and fc_els_prli_descriptor::type.

Referenced by fcp_prli_tx().

◆ fc_els_prli_rx()

int fc_els_prli_rx ( struct fc_els els,
struct fc_els_prli_descriptor descriptor,
void *  data,
size_t  len 
)

Receive PRLI.

Parameters
elsFibre Channel ELS transaction
descriptorELS PRLI descriptor
frameELS frame
lenLength of ELS frame
Return values
rcReturn status code

Definition at line 1006 of file fcels.c.

1008  {
1009  struct {
1010  struct fc_prli_frame frame;
1011  uint8_t param[descriptor->param_len];
1012  } __attribute__ (( packed )) *prli = data;
1013  struct fc_ulp *ulp;
1014  int rc;
1015 
1016  /* Sanity check */
1017  if ( len < sizeof ( *prli ) ) {
1018  DBGC ( els, FCELS_FMT " received underlength frame:\n",
1019  FCELS_ARGS ( els ) );
1020  DBGC_HDA ( els, 0, data, len );
1021  rc = -EINVAL;
1022  goto err_sanity;
1023  }
1024 
1025  DBGC ( els, FCELS_FMT " has parameters:\n", FCELS_ARGS ( els ) );
1026  DBGC_HDA ( els, 0, prli->param, sizeof ( prli->param ) );
1027 
1028  /* Get ULP */
1029  ulp = fc_ulp_get_port_id_type ( els->port, &els->peer_port_id,
1030  descriptor->type );
1031  if ( ! ulp ) {
1032  rc = -ENOMEM;
1033  goto err_get_port_id_type;
1034  }
1035 
1036  /* Sanity check */
1037  if ( ! fc_link_ok ( &ulp->peer->link ) ) {
1038  DBGC ( els, FCELS_FMT " received while peer link is down\n",
1039  FCELS_ARGS ( els ) );
1040  rc = -EINVAL;
1041  goto err_link;
1042  }
1043 
1044  /* Log in ULP, if applicable */
1045  if ( prli->frame.page.flags & htons ( FC_PRLI_ESTABLISH ) ) {
1046  if ( ( rc = fc_ulp_login ( ulp, prli->param,
1047  sizeof ( prli->param ),
1048  fc_els_is_request ( els ) ) ) != 0 ){
1049  DBGC ( els, FCELS_FMT " could not log in ULP: %s\n",
1050  FCELS_ARGS ( els ), strerror ( rc ) );
1051  goto err_login;
1052  }
1053  } else {
1054  if ( fc_els_is_request ( els ) ) {
1055  fc_ulp_logout ( ulp, -EACCES );
1056  } else {
1057  /* This is just an information-gathering PRLI; do not
1058  * log in or out
1059  */
1060  }
1061  }
1062 
1063  /* Transmit response, if applicable */
1064  if ( ! fc_els_is_request ( els ) ) {
1065  if ( ( rc = els->handler->tx ( els ) ) != 0 )
1066  goto err_tx;
1067  }
1068 
1069  /* Drop temporary reference to ULP */
1070  fc_ulp_put ( ulp );
1071 
1072  return 0;
1073 
1074  err_tx:
1075  err_login:
1076  err_link:
1077  fc_ulp_put ( ulp );
1078  err_get_port_id_type:
1079  err_sanity:
1080  return rc;
1081 }
#define __attribute__(x)
Definition: compiler.h:10
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
size_t param_len
Service parameter length.
Definition: fcels.h:390
int(* tx)(struct fc_els *els)
Transmit ELS frame.
Definition: fcels.h:360
#define DBGC(...)
Definition: compiler.h:505
struct fc_els_handler * handler
ELS handler, if known.
Definition: fcels.h:340
#define EACCES
Permission denied.
Definition: errno.h:298
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
struct fc_peer * peer
Fibre Channel peer.
Definition: fc.h:417
unsigned long frame
Definition: xengrant.h:179
#define ENOMEM
Not enough space.
Definition: errno.h:534
A Fibre Channel PRLI frame.
Definition: fcels.h:273
#define DBGC_HDA(...)
Definition: compiler.h:506
static int fc_link_ok(struct fc_link_state *link)
Check Fibre Channel link state.
Definition: fc.h:108
struct fc_link_state link
Link state monitor.
Definition: fc.h:350
#define FC_PRLI_ESTABLISH
Establish image pair.
Definition: fcels.h:264
struct interface prli
PRLI interface.
Definition: fc.h:429
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
void * param
Service parameters, if any.
Definition: fc.h:431
unsigned char uint8_t
Definition: stdint.h:10
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
int fc_ulp_login(struct fc_ulp *ulp, const void *param, size_t param_len, int originated)
Log in Fibre Channel upper-layer protocol.
Definition: fc.c:1657
void fc_ulp_logout(struct fc_ulp *ulp, int rc)
Log out Fibre Channel upper-layer protocol.
Definition: fc.c:1727
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408
uint32_t len
Length.
Definition: ena.h:14
static void fc_ulp_put(struct fc_ulp *ulp)
Drop reference to Fibre Channel upper-layer protocol.
Definition: fc.h:485
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct fc_ulp * fc_ulp_get_port_id_type(struct fc_port *port, const struct fc_port_id *peer_port_id, unsigned int type)
Get Fibre Channel upper-layer protocol by port ID and type.
Definition: fc.c:1915
unsigned int type
Upper-layer protocol type.
Definition: fcels.h:388
#define htons(value)
Definition: byteswap.h:135
A Fibre Channel upper-layer protocol.
Definition: fc.h:413

References __attribute__, data, DBGC, DBGC_HDA, EACCES, EINVAL, ENOMEM, fc_els_is_request(), fc_link_ok(), FC_PRLI_ESTABLISH, fc_ulp_get_port_id_type(), fc_ulp_login(), fc_ulp_logout(), fc_ulp_put(), FCELS_ARGS, FCELS_FMT, frame, fc_els::handler, htons, len, fc_peer::link, fc_ulp::param, fc_els_prli_descriptor::param_len, fc_ulp::peer, fc_els::peer_port_id, fc_els::port, fc_ulp::prli, rc, strerror(), fc_els_handler::tx, and fc_els_prli_descriptor::type.

Referenced by fcp_prli_rx().

◆ fc_els_prli_detect()

int fc_els_prli_detect ( struct fc_els *els  __unused,
struct fc_els_prli_descriptor descriptor,
const void *  data,
size_t  len 
)

Detect PRLI.

Parameters
elsFibre Channel ELS transaction
descriptorELS PRLI descriptor
dataELS frame
lenLength of ELS frame
Return values
rcReturn status code

Definition at line 1092 of file fcels.c.

1094  {
1095  const struct {
1096  struct fc_prli_frame frame;
1097  uint8_t param[descriptor->param_len];
1098  } __attribute__ (( packed )) *prli = data;
1099 
1100  /* Check for PRLI */
1101  if ( prli->frame.command != FC_ELS_PRLI )
1102  return -EINVAL;
1103 
1104  /* Check for sufficient length to contain service parameter page */
1105  if ( len < sizeof ( *prli ) )
1106  return -EINVAL;
1107 
1108  /* Check for upper-layer protocol type */
1109  if ( prli->frame.page.type != descriptor->type )
1110  return -EINVAL;
1111 
1112  return 0;
1113 }
#define __attribute__(x)
Definition: compiler.h:10
#define EINVAL
Invalid argument.
Definition: errno.h:428
size_t param_len
Service parameter length.
Definition: fcels.h:390
unsigned long frame
Definition: xengrant.h:179
A Fibre Channel PRLI frame.
Definition: fcels.h:273
void * param
Service parameters, if any.
Definition: fc.h:431
Process Login.
Definition: fcels.h:38
unsigned char uint8_t
Definition: stdint.h:10
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
unsigned int type
Upper-layer protocol type.
Definition: fcels.h:388

References __attribute__, data, EINVAL, FC_ELS_PRLI, frame, len, fc_ulp::param, fc_els_prli_descriptor::param_len, and fc_els_prli_descriptor::type.

Referenced by fcp_prli_detect().