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

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)
 FILE_SECBOOT (PERMITTED)
static int fc_els_is_request (struct fc_els *els)
 Check if Fibre Channel ELS transaction is a request.
static unsigned int fc_els_tx_command (struct fc_els *els, unsigned int request_command)
 Calculate ELS command to transmit.
int fc_els_tx (struct fc_els *els, const void *data, size_t len)
 Transmit Fibre Channel ELS frame.
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.
int fc_els_flogi (struct interface *parent, struct fc_port *port)
 Create FLOGI request.
int fc_els_plogi (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create PLOGI request.
int fc_els_logo (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create LOGO request.
int fc_els_prli (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id, unsigned int type)
 Create PRLI request.
int fc_els_prli_tx (struct fc_els *els, struct fc_els_prli_descriptor *descriptor, void *param)
 Transmit PRLI.
int fc_els_prli_rx (struct fc_els *els, struct fc_els_prli_descriptor *descriptor, void *data, size_t len)
 Receive PRLI.
int fc_els_prli_detect (struct fc_els *els __unused, struct fc_els_prli_descriptor *descriptor, const void *data, size_t len)
 Detect PRLI.

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 103 of file fcels.h.

Referenced by fc_els_flogi_tx(), and fc_els_plogi_tx().

◆ FC_LOGIN_DEFAULT_B2B

#define FC_LOGIN_DEFAULT_B2B   10

Fibre Channel default buffer-to-buffer credit.

Definition at line 106 of file fcels.h.

Referenced by fc_els_flogi_tx(), and fc_els_plogi_tx().

◆ FC_LOGIN_CONTINUOUS_OFFSET

#define FC_LOGIN_CONTINUOUS_OFFSET   0x8000

Continuously increasing relative offset.

Definition at line 109 of file fcels.h.

Referenced by fc_els_flogi_tx(), and fc_els_plogi_tx().

◆ FC_LOGIN_CLEAN

#define FC_LOGIN_CLEAN   0x8000

Clean address.

Definition at line 112 of file fcels.h.

◆ FC_LOGIN_MULTI_N

#define FC_LOGIN_MULTI_N   0x8000

Multiple N_Port_ID support.

Definition at line 115 of file fcels.h.

◆ FC_LOGIN_RANDOM_OFFSET

#define FC_LOGIN_RANDOM_OFFSET   0x4000

Random relative offset.

Definition at line 118 of file fcels.h.

◆ FC_LOGIN_VIRTUAL

#define FC_LOGIN_VIRTUAL   0x4000

Virtual fabrics.

Definition at line 121 of file fcels.h.

◆ FC_LOGIN_VENDOR

#define FC_LOGIN_VENDOR   0x2000

Vendor version level.

Definition at line 124 of file fcels.h.

◆ FC_LOGIN_MULTI_F

#define FC_LOGIN_MULTI_F   0x2000

Multiple N_Port_ID support.

Definition at line 127 of file fcels.h.

◆ FC_LOGIN_F_PORT

#define FC_LOGIN_F_PORT   0x1000

Forwarder port.

Definition at line 130 of file fcels.h.

Referenced by fc_els_flogi_rx().

◆ FC_LOGIN_ALT_CREDIT

#define FC_LOGIN_ALT_CREDIT   0x0800

Alternative credit management.

Definition at line 133 of file fcels.h.

◆ FC_LOGIN_NSS_STARTED

#define FC_LOGIN_NSS_STARTED   0x0800

Name server session started.

Definition at line 136 of file fcels.h.

◆ FC_LOGIN_NSS_BEGIN

#define FC_LOGIN_NSS_BEGIN   0x0400

Begin name server session.

Definition at line 139 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 142 of file fcels.h.

◆ FC_LOGIN_BROADCAST

#define FC_LOGIN_BROADCAST   0x0100

Broadcast supported.

Definition at line 145 of file fcels.h.

◆ FC_LOGIN_QUERY_BUF

#define FC_LOGIN_QUERY_BUF   0x0040

Query buffer conditions.

Definition at line 148 of file fcels.h.

◆ FC_LOGIN_SECURITY

#define FC_LOGIN_SECURITY   0x0020

Security.

Definition at line 151 of file fcels.h.

◆ FC_LOGIN_CLOCK_SYNC

#define FC_LOGIN_CLOCK_SYNC   0x0010

Clock sync primitive capable.

Definition at line 154 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 157 of file fcels.h.

◆ FC_LOGIN_DHD

#define FC_LOGIN_DHD   0x0004

Dynamic half duplex.

Definition at line 160 of file fcels.h.

◆ FC_LOGIN_CONTINUOUS_SEQ

#define FC_LOGIN_CONTINUOUS_SEQ   0x0002

Continuously increasing sequence count.

Definition at line 163 of file fcels.h.

◆ FC_LOGIN_PAYLOAD

#define FC_LOGIN_PAYLOAD   0x0001

Payload.

Definition at line 166 of file fcels.h.

◆ FC_LOGIN_DEFAULT_MTU

#define FC_LOGIN_DEFAULT_MTU   1452

Fibre Channel default MTU.

Definition at line 169 of file fcels.h.

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

◆ FC_LOGIN_DEFAULT_MAX_SEQ

#define FC_LOGIN_DEFAULT_MAX_SEQ   255

Default maximum number of concurrent sequences.

Definition at line 172 of file fcels.h.

Referenced by fc_els_plogi_tx().

◆ FC_LOGIN_DEFAULT_REL_OFFS

#define FC_LOGIN_DEFAULT_REL_OFFS   0x1f

Default relative offset by info category.

Definition at line 175 of file fcels.h.

Referenced by fc_els_plogi_tx().

◆ FC_LOGIN_DEFAULT_E_D_TOV

#define FC_LOGIN_DEFAULT_E_D_TOV   2000

Default E_D timeout value.

Definition at line 178 of file fcels.h.

Referenced by fc_els_plogi_tx(), and fc_els_rtv_tx_response().

◆ FC_LOGIN_CLASS_VALID

#define FC_LOGIN_CLASS_VALID   0x8000

Class valid.

Definition at line 203 of file fcels.h.

Referenced by fc_els_flogi_tx(), and fc_els_plogi_tx().

◆ FC_LOGIN_CLASS_SEQUENTIAL

#define FC_LOGIN_CLASS_SEQUENTIAL   0x0800

Sequential delivery requested.

Definition at line 206 of file fcels.h.

Referenced by fc_els_flogi_tx(), and fc_els_plogi_tx().

◆ FC_PRLI_ESTABLISH

#define FC_PRLI_ESTABLISH   0x2000

Establish image pair.

Definition at line 265 of file fcels.h.

Referenced by fc_els_prli_rx(), and fc_els_prli_tx().

◆ FC_PRLI_RESPONSE_MASK

#define FC_PRLI_RESPONSE_MASK   0x0f00

Response code mask.

Definition at line 268 of file fcels.h.

◆ FC_PRLI_RESPONSE_SUCCESS

#define FC_PRLI_RESPONSE_SUCCESS   0x0100

Request was executed successfully.

Definition at line 271 of file fcels.h.

Referenced by fc_els_prli_tx().

◆ FC_RTV_HIRES_E_D_TOV

#define FC_RTV_HIRES_E_D_TOV   0x0400

1ns error detection timer resolution

Definition at line 310 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 313 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 381 of file fcels.h.

Referenced by fc_els_detect(), and parse_fc_els_handler().

◆ __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 384 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 397 of file fcels.h.

397#define FC_ELS_PRLI_DESCRIPTORS \
398 __table ( struct fc_els_prli_descriptor, "fc_els_prli_descriptors" )

Referenced by fc_els_prli_descriptor().

◆ __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 401 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 31 of file fcels.h.

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

◆ 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 58 of file fcels.h.

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

◆ fc_els_flags

Fibre Channel extended link services transaction flags.

Enumerator
FC_ELS_REQUEST 

ELS transaction is a request.

Definition at line 347 of file fcels.h.

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

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ fc_els_is_request()

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 409 of file fcels.h.

409 {
410 return ( els->flags & FC_ELS_REQUEST );
411}
unsigned int flags
Flags.
Definition fcels.h:343

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()

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 420 of file fcels.h.

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

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 )
extern

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:3
if(len >=6 *4) __asm__ __volatile__("movsl" if(len >=5 *4) __asm__ __volatile__("movsl" if(len >=4 *4) __asm__ __volatile__("movsl" if(len >=3 *4) __asm__ __volatile__("movsl" if(len >=2 *4) __asm__ __volatile__("movsl" if(len >=1 *4) __asm__ __volatile__("movsl" if((len % 4) >=2) __asm__ __volatile__("movsw" if((len % 2) >=1) __asm__ __volatile__("movsb" retur dest)
Definition string.h:151
ring len
Length.
Definition dwmac.h:226
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint8_t meta
Metadata flags.
Definition ena.h:3
struct sockaddr * fc_fill_sockaddr(struct sockaddr_fc *sa_fc, struct fc_port_id *id)
Fill Fibre Channel socket address.
Definition fc.c:165
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition fcels.c:46
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition fcels.c:49
#define DBGC2(...)
Definition compiler.h:522
#define DBGC2_HDA(...)
Definition compiler.h:523
#define DBGC(...)
Definition compiler.h:505
void * memset(void *dest, int character, size_t len) __nonnull
char * strerror(int errno)
Retrieve string representation of error number.
Definition strerror.c:79
struct interface xchg
Fibre Channel exchange.
Definition fcels.h:330
struct fc_port_id peer_port_id
Peer port ID.
Definition fcels.h:339
Fibre Channel socket address.
Definition fc.h:48
Data transfer metadata.
Definition xfer.h:23
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:269
#define XFER_FL_OVER
Sender is relinquishing use of half-duplex channel.
Definition xfer.h:51
#define XFER_FL_RESPONSE
Data content is a response.
Definition xfer.h:64
#define XFER_FL_OUT
This is the final data transfer.
Definition xfer.h:54

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 )
extern

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}
u8 port
Port number.
Definition CIB_PRM.h:3
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
#define ENOMEM
Not enough space.
Definition errno.h:535
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition interface.c:108
void process_add(struct process *process)
Add process to process list.
Definition process.c:60
#define ref_put(refcnt)
Drop reference to object.
Definition refcnt.h:107
A Fibre Channel extended link services transaction.
Definition fcels.h:324
struct fc_els_handler * handler
ELS handler, if known.
Definition fcels.h:341
struct interface job
Job control interface.
Definition fcels.h:328
struct refcnt refcnt
Reference count.
Definition fcels.h:326
struct process process
Request sending process.
Definition fcels.h:332

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 )
extern

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}
struct fc_port_id fc_f_port_id
F_Port contoller port ID.
Definition fc.c:68
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

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 )
extern

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}

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 )
extern

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}

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 )
extern

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}
uint32_t type
Operating system type.
Definition ena.h:1
static struct fc_els_prli_descriptor * fc_els_prli_descriptor(unsigned int type)
Find PRLI descriptor.
Definition fcels.c:932
#define ENOTSUP
Operation not supported.
Definition errno.h:590
A Fibre Channel ELS PRLI descriptor.
Definition fcels.h:387
struct fc_els_handler * handler
Fibre Channel ELS handler.
Definition fcels.h:393

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 )
extern

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}
unsigned char uint8_t
Definition stdint.h:10
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
static void fc_ulp_put(struct fc_ulp *ulp)
Drop reference to Fibre Channel upper-layer protocol.
Definition fc.h:486
static int fc_link_ok(struct fc_link_state *link)
Check Fibre Channel link state.
Definition fc.h:109
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition fcels.c:126
#define FC_PRLI_RESPONSE_SUCCESS
Request was executed successfully.
Definition fcels.h:271
static unsigned int fc_els_tx_command(struct fc_els *els, unsigned int request_command)
Calculate ELS command to transmit.
Definition fcels.h:420
#define FC_PRLI_ESTABLISH
Establish image pair.
Definition fcels.h:265
#define htons(value)
Definition byteswap.h:136
#define __attribute__(x)
Definition compiler.h:10
struct hv_monitor_parameter param[4][32]
Parameters.
Definition hyperv.h:13
void * memcpy(void *dest, const void *src, size_t len) __nonnull
size_t param_len
Service parameter length.
Definition fcels.h:391
unsigned int type
Upper-layer protocol type.
Definition fcels.h:389
struct fc_port * port
Fibre Channel port.
Definition fcels.h:335
A Fibre Channel PRLI frame.
Definition fcels.h:274
A Fibre Channel upper-layer protocol.
Definition fc.h:414
struct interface prli
PRLI interface.
Definition fc.h:430
struct fc_link_state link
Link state monitor.
Definition fc.h:428
unsigned long frame
Definition xengrant.h:180

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 )
extern

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}
void fc_ulp_logout(struct fc_ulp *ulp, int rc)
Log out Fibre Channel upper-layer protocol.
Definition fc.c:1727
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
#define DBGC_HDA(...)
Definition compiler.h:506
#define EINVAL
Invalid argument.
Definition errno.h:429
#define EACCES
Permission denied.
Definition errno.h:299
int(* tx)(struct fc_els *els)
Transmit ELS frame.
Definition fcels.h:361
struct fc_link_state link
Link state monitor.
Definition fc.h:351
struct fc_peer * peer
Fibre Channel peer.
Definition fc.h:418

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, 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 )
extern

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}

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

Referenced by fcp_prli_detect().