iPXE
Data Structures | Macros | Functions | Variables
fcels.c File Reference

Fibre Channel Extended Link Services. More...

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/interface.h>
#include <ipxe/xfer.h>
#include <ipxe/iobuf.h>
#include <ipxe/process.h>
#include <ipxe/fc.h>
#include <ipxe/fcels.h>

Go to the source code of this file.

Data Structures

struct  fc_echo_request_frame
 ECHO request data. More...
 

Macros

#define FCELS_FMT   "FCELS %s %s %s %s"
 Fibre Channel ELS transaction debug message format. More...
 
#define FCELS_ARGS(els)
 Fibre Channel ELS transaction debug message arguments. More...
 
#define FC_ECHO_MAGIC   0x69505845
 ECHO magic marker. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static void fc_els_free (struct refcnt *refcnt)
 Free Fibre Channel ELS transaction. More...
 
static void fc_els_close (struct fc_els *els, int rc)
 Close Fibre Channel ELS transaction. More...
 
static struct fc_els_handlerfc_els_detect (struct fc_els *els, const void *data, size_t len)
 Detect Fibre Channel ELS frame handler. More...
 
int fc_els_tx (struct fc_els *els, const void *data, size_t len)
 Transmit Fibre Channel ELS frame. More...
 
static int fc_els_rx (struct fc_els *els, struct io_buffer *iobuf, struct xfer_metadata *meta)
 Receive Fibre Channel ELS frame. More...
 
static void fc_els_step (struct fc_els *els)
 Fibre Channel ELS process. More...
 
static struct fc_elsfc_els_create (struct fc_port *port, struct fc_port_id *port_id, struct fc_port_id *peer_port_id)
 Create ELS transaction. 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...
 
static int fc_els_respond (struct interface *xchg, struct fc_port *port, struct fc_port_id *port_id, struct fc_port_id *peer_port_id)
 Create ELS response. More...
 
static int fc_els_unknown_tx (struct fc_els *els __unused)
 Transmit unknown ELS request. More...
 
static int fc_els_unknown_tx_response (struct fc_els *els)
 Transmit unknown ELS response. More...
 
static int fc_els_unknown_rx (struct fc_els *els, void *data, size_t len)
 Receive unknown ELS. More...
 
static int fc_els_unknown_detect (struct fc_els *els __unused, const void *data __unused, size_t len __unused)
 Detect unknown ELS. More...
 
static int fc_els_flogi_tx (struct fc_els *els)
 Transmit FLOGI. More...
 
static int fc_els_flogi_rx (struct fc_els *els, void *data, size_t len)
 Receive FLOGI. More...
 
static int fc_els_flogi_detect (struct fc_els *els __unused, const void *data, size_t len __unused)
 Detect FLOGI. More...
 
int fc_els_flogi (struct interface *parent, struct fc_port *port)
 Create FLOGI request. More...
 
static int fc_els_plogi_tx (struct fc_els *els)
 Transmit PLOGI. More...
 
static int fc_els_plogi_rx (struct fc_els *els, void *data, size_t len)
 Receive PLOGI. More...
 
static int fc_els_plogi_detect (struct fc_els *els __unused, const void *data, size_t len __unused)
 Detect PLOGI. More...
 
int fc_els_plogi (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create PLOGI request. More...
 
static int fc_els_logo_tx (struct fc_els *els)
 Transmit LOGO request. More...
 
static int fc_els_logo_tx_response (struct fc_els *els)
 Transmit LOGO response. More...
 
static void fc_els_logo_logout (struct fc_els *els, struct fc_port_id *peer_port_id)
 Log out individual peer or whole port as applicable. More...
 
static int fc_els_logo_rx_request (struct fc_els *els, void *data, size_t len)
 Receive LOGO request. More...
 
static int fc_els_logo_rx_response (struct fc_els *els, void *data __unused, size_t len __unused)
 Receive LOGO response. More...
 
static int fc_els_logo_rx (struct fc_els *els, void *data, size_t len)
 Receive LOGO. More...
 
static int fc_els_logo_detect (struct fc_els *els __unused, const void *data, size_t len __unused)
 Detect LOGO. More...
 
int fc_els_logo (struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id)
 Create LOGO request. More...
 
static struct fc_els_prli_descriptorfc_els_prli_descriptor (unsigned int type)
 Find PRLI descriptor. 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...
 
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...
 
static int fc_els_rtv_tx_response (struct fc_els *els)
 Transmit RTV response. More...
 
static int fc_els_rtv_rx (struct fc_els *els, void *data __unused, size_t len __unused)
 Receive RTV. More...
 
static int fc_els_rtv_detect (struct fc_els *els __unused, const void *data, size_t len __unused)
 Detect RTV. More...
 
static int fc_els_echo_tx (struct fc_els *els)
 Transmit ECHO. More...
 
static int fc_els_echo_rx_request (struct fc_els *els, void *data, size_t len)
 Receive ECHO request. More...
 
static int fc_els_echo_rx_response (struct fc_els *els, void *data, size_t len)
 Receive ECHO response. More...
 
static int fc_els_echo_rx (struct fc_els *els, void *data, size_t len)
 Receive ECHO. More...
 
static int fc_els_echo_detect (struct fc_els *els __unused, const void *data, size_t len __unused)
 Detect ECHO. More...
 

Variables

struct fc_els_handler fc_els_unknown_handler __fc_els_handler
 Unknown ELS handler. More...
 
static struct interface_operation fc_els_xchg_op []
 Fibre Channel ELS exchange interface operations. More...
 
static struct interface_descriptor fc_els_xchg_desc
 Fibre Channel ELS exchange interface descriptor. More...
 
static struct interface_operation fc_els_job_op []
 Fibre Channel ELS job control interface operations. More...
 
static struct interface_descriptor fc_els_job_desc
 Fibre Channel ELS job control interface descriptor. More...
 
static struct process_descriptor fc_els_process_desc
 Fibre Channel ELS process descriptor. More...
 
struct fc_responder fc_els_responder __fc_responder
 Fibre Channel ELS responder. More...
 

Detailed Description

Fibre Channel Extended Link Services.

Definition in file fcels.c.

Macro Definition Documentation

◆ FCELS_FMT

#define FCELS_FMT   "FCELS %s %s %s %s"

Fibre Channel ELS transaction debug message format.

Definition at line 46 of file fcels.c.

◆ FCELS_ARGS

#define FCELS_ARGS (   els)
Value:
(els)->port->name, \
( (els)->handler ? (els)->handler->name : "unknown ELS" ), \
( fc_els_is_request ( els ) ? "to" : "from" ), \
fc_id_ntoa ( &(els)->peer_port_id )
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
u8 port
Port number.
Definition: CIB_PRM.h:31
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408

Fibre Channel ELS transaction debug message arguments.

Definition at line 49 of file fcels.c.

◆ FC_ECHO_MAGIC

#define FC_ECHO_MAGIC   0x69505845

ECHO magic marker.

Definition at line 1228 of file fcels.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ fc_els_free()

static void fc_els_free ( struct refcnt refcnt)
static

Free Fibre Channel ELS transaction.

Parameters
refcntReference count

Definition at line 62 of file fcels.c.

62  {
63  struct fc_els *els = container_of ( refcnt, struct fc_els, refcnt );
64 
65  assert ( ! process_running ( &els->process ) );
66  fc_port_put ( els->port );
67  free ( els );
68 }
static void fc_port_put(struct fc_port *port)
Drop reference to Fibre Channel port.
Definition: fc.h:315
A reference counter.
Definition: refcnt.h:26
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
static int process_running(struct process *process)
Check if process is running.
Definition: process.h:175
struct process process
Request sending process.
Definition: fcels.h:331

References assert(), container_of, fc_port_put(), free, fc_els::port, fc_els::process, and process_running().

Referenced by fc_els_create().

◆ fc_els_close()

static void fc_els_close ( struct fc_els els,
int  rc 
)
static

Close Fibre Channel ELS transaction.

Parameters
elsFibre Channel ELS transaction
rcReason for close

Definition at line 76 of file fcels.c.

76  {
77 
78  if ( rc != 0 ) {
79  DBGC ( els, FCELS_FMT " complete (%s)\n",
80  FCELS_ARGS ( els ), strerror ( rc ) );
81  }
82 
83  /* Stop process */
84  process_del ( &els->process );
85 
86  /* Shut down interfaces */
87  intf_shutdown ( &els->xchg, rc );
88  intf_shutdown ( &els->job, rc );
89 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void intf_shutdown(struct interface *intf, int rc)
Shut down an object interface.
Definition: interface.c:278
#define DBGC(...)
Definition: compiler.h:505
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
void process_del(struct process *process)
Remove process from process list.
Definition: process.c:79
struct interface xchg
Fibre Channel exchange.
Definition: fcels.h:329
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
struct interface job
Job control interface.
Definition: fcels.h:327
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
struct process process
Request sending process.
Definition: fcels.h:331

References DBGC, FCELS_ARGS, FCELS_FMT, intf_shutdown(), fc_els::job, fc_els::process, process_del(), rc, strerror(), and fc_els::xchg.

Referenced by fc_els_rx(), and fc_els_step().

◆ fc_els_detect()

static struct fc_els_handler* fc_els_detect ( struct fc_els els,
const void *  data,
size_t  len 
)
static

Detect Fibre Channel ELS frame handler.

Parameters
elsFibre Channel ELS transaction
commandELS command code
Return values
handlerELS handler, or NULL

Definition at line 98 of file fcels.c.

100  {
101  const struct fc_els_frame_common *frame = data;
102  struct fc_els_handler *handler;
103  int rc;
104 
105  /* Sanity check */
106  if ( len < sizeof ( *frame ) )
107  return NULL;
108 
109  /* Try each handler in turn */
111  if ( ( rc = handler->detect ( els, data, len ) ) == 0 )
112  return handler;
113  }
114 
115  return NULL;
116 }
Fibre Channel ELS frame common parameters.
Definition: fcels.h:22
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
A Fibre Channel extended link services handler.
Definition: fcels.h:352
unsigned long frame
Definition: xengrant.h:179
int(* detect)(struct fc_els *els, const void *data, size_t len)
Detect ELS frame.
Definition: fcels.h:376
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
#define FC_ELS_HANDLERS
Fibre Channel ELS handler table.
Definition: fcels.h:380
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References data, fc_els_handler::detect, FC_ELS_HANDLERS, for_each_table_entry, frame, len, NULL, and rc.

Referenced by fc_els_rx().

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

static int fc_els_rx ( struct fc_els els,
struct io_buffer iobuf,
struct xfer_metadata meta 
)
static

Receive Fibre Channel ELS frame.

Parameters
elsFibre Channel ELS transaction
iobufI/O buffer
metaData transfer metadata
Return values
rcReturn status code

Definition at line 159 of file fcels.c.

161  {
162  struct fc_els_frame_common *frame = iobuf->data;
163  struct sockaddr_fc *src = ( ( struct sockaddr_fc * ) meta->src );
164  struct sockaddr_fc *dest = ( ( struct sockaddr_fc * ) meta->dest );
165  size_t len = iob_len ( iobuf );
166  int rc;
167 
168  /* Sanity check */
169  if ( len < sizeof ( *frame ) ) {
170  DBGC ( els, FCELS_FMT " received underlength frame:\n",
171  FCELS_ARGS ( els ) );
172  DBGC_HDA ( els, 0, frame, len );
173  rc = -EINVAL;
174  goto done;
175  }
176  if ( ! src ) {
177  DBGC ( els, FCELS_FMT " received frame missing source "
178  "address:\n", FCELS_ARGS ( els ) );
179  rc = -EINVAL;
180  goto done;
181  }
182  if ( ! dest ) {
183  DBGC ( els, FCELS_FMT " received frame missing destination "
184  "address:\n", FCELS_ARGS ( els ) );
185  rc = -EINVAL;
186  goto done;
187  }
188 
189  /* Check for rejection responses */
190  if ( fc_els_is_request ( els ) &&
191  ( frame->command != FC_ELS_LS_ACC ) ) {
192  DBGC ( els, FCELS_FMT " rejected:\n", FCELS_ARGS ( els ) );
193  DBGC_HDA ( els, 0, frame, len );
194  rc = -EACCES;
195  goto done;
196  }
197 
198  /* Update port IDs */
199  memcpy ( &els->port_id, &dest->sfc_port_id, sizeof ( els->port_id ) );
200  memcpy ( &els->peer_port_id, &src->sfc_port_id,
201  sizeof ( els->peer_port_id ) );
202 
203  /* Determine handler, if necessary */
204  if ( ! els->handler )
205  els->handler = fc_els_detect ( els, frame, len );
206  if ( ! els->handler )
207  els->handler = &fc_els_unknown_handler;
208 
209  DBGC2 ( els, FCELS_FMT " received:\n", FCELS_ARGS ( els ) );
210  DBGC2_HDA ( els, 0, frame, len );
211 
212  /* Handle received frame */
213  if ( ( rc = els->handler->rx ( els, frame, len ) ) != 0 ) {
214  DBGC ( els, FCELS_FMT " could not handle received frame: "
215  "%s\n", FCELS_ARGS ( els ), strerror ( rc ) );
216  DBGC_HDA ( els, 0, frame, len );
217  goto done;
218  }
219 
220  done:
221  /* Free I/O buffer */
222  free_iob ( iobuf );
223 
224  /* Close transaction */
225  fc_els_close ( els, rc );
226 
227  return rc;
228 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Fibre Channel ELS frame common parameters.
Definition: fcels.h:22
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
Definition: iobuf.c:146
static void const void * src
Definition: crypto.h:244
#define DBGC(...)
Definition: compiler.h:505
struct fc_els_handler * handler
ELS handler, if known.
Definition: fcels.h:340
Fibre Channel socket address.
Definition: fc.h:47
#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
static void fc_els_close(struct fc_els *els, int rc)
Close Fibre Channel ELS transaction.
Definition: fcels.c:76
static struct fc_els_handler * fc_els_detect(struct fc_els *els, const void *data, size_t len)
Detect Fibre Channel ELS frame handler.
Definition: fcels.c:98
unsigned long frame
Definition: xengrant.h:179
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define DBGC_HDA(...)
Definition: compiler.h:506
Link Service Accept.
Definition: fcels.h:32
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
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
Definition: iobuf.h:155
int(* rx)(struct fc_els *els, void *data, size_t len)
Receive ELS frame.
Definition: fcels.h:368
#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
void * data
Start of data.
Definition: iobuf.h:48
struct bofm_section_header done
Definition: bofm_test.c:46
struct fc_port_id port_id
Local port ID.
Definition: fcels.h:336

References io_buffer::data, DBGC, DBGC2, DBGC2_HDA, DBGC_HDA, dest, done, EACCES, EINVAL, fc_els_close(), fc_els_detect(), fc_els_is_request(), FC_ELS_LS_ACC, FCELS_ARGS, FCELS_FMT, frame, free_iob(), fc_els::handler, iob_len(), len, memcpy(), meta(), fc_els::peer_port_id, fc_els::port_id, rc, fc_els_handler::rx, src, and strerror().

◆ fc_els_step()

static void fc_els_step ( struct fc_els els)
static

Fibre Channel ELS process.

Parameters
elsFibre Channel ELS transaction

Definition at line 254 of file fcels.c.

254  {
255  int xchg_id;
256  int rc;
257 
258  /* Sanity check */
259  assert ( fc_els_is_request ( els ) );
260 
261  /* Create exchange */
262  if ( ( xchg_id = fc_xchg_originate ( &els->xchg, els->port,
263  &els->peer_port_id,
264  FC_TYPE_ELS ) ) < 0 ) {
265  rc = xchg_id;
266  DBGC ( els, FCELS_FMT " could not create exchange: %s\n",
267  FCELS_ARGS ( els ), strerror ( rc ) );
268  fc_els_close ( els, rc );
269  return;
270  }
271 
272  /* Transmit request */
273  if ( ( rc = els->handler->tx ( els ) ) != 0 ) {
274  DBGC ( els, FCELS_FMT " could not transmit request: %s\n",
275  FCELS_ARGS ( els ), strerror ( rc ) );
276  fc_els_close ( els, rc );
277  return;
278  }
279 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int fc_xchg_originate(struct interface *parent, struct fc_port *port, struct fc_port_id *peer_port_id, unsigned int type)
Originate a new Fibre Channel exchange.
Definition: fc.c:728
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 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
static void fc_els_close(struct fc_els *els, int rc)
Close Fibre Channel ELS transaction.
Definition: fcels.c:76
Extended Link Service.
Definition: fc.h:192
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct interface xchg
Fibre Channel exchange.
Definition: fcels.h:329
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
#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

References assert(), DBGC, fc_els_close(), fc_els_is_request(), FC_TYPE_ELS, fc_xchg_originate(), FCELS_ARGS, FCELS_FMT, fc_els::handler, fc_els::peer_port_id, fc_els::port, rc, strerror(), fc_els_handler::tx, and fc_els::xchg.

◆ fc_els_create()

static struct fc_els* fc_els_create ( struct fc_port port,
struct fc_port_id port_id,
struct fc_port_id peer_port_id 
)
static

Create ELS transaction.

Parameters
portFibre Channel port
port_idLocal port ID
peer_port_idPeer port ID
Return values
elsFibre Channel ELS transaction, or NULL

Definition at line 293 of file fcels.c.

295  {
296  struct fc_els *els;
297 
298  /* Allocate and initialise structure */
299  els = zalloc ( sizeof ( *els ) );
300  if ( ! els )
301  return NULL;
302  ref_init ( &els->refcnt, fc_els_free );
303  intf_init ( &els->job, &fc_els_job_desc, &els->refcnt );
304  intf_init ( &els->xchg, &fc_els_xchg_desc, &els->refcnt );
306  &els->refcnt );
307  els->port = fc_port_get ( port );
308  memcpy ( &els->port_id, port_id, sizeof ( els->port_id ) );
310  sizeof ( els->peer_port_id ) );
311  return els;
312 }
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
void * memcpy(void *dest, const void *src, size_t len) __nonnull
u8 port
Port number.
Definition: CIB_PRM.h:31
struct interface xchg
Fibre Channel exchange.
Definition: fcels.h:329
struct refcnt refcnt
Reference count.
Definition: fcels.h:325
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
static struct process_descriptor fc_els_process_desc
Fibre Channel ELS process descriptor.
Definition: fcels.c:282
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
struct interface job
Job control interface.
Definition: fcels.h:327
static void process_init_stopped(struct process *process, struct process_descriptor *desc, struct refcnt *refcnt)
Initialise process without adding to process list.
Definition: process.h:145
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_els_job_desc
Fibre Channel ELS job control interface descriptor.
Definition: fcels.c:246
struct process process
Request sending process.
Definition: fcels.h:331
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
static void fc_els_free(struct refcnt *refcnt)
Free Fibre Channel ELS transaction.
Definition: fcels.c:62
struct fc_port_id port_id
Local port ID.
Definition: fcels.h:336
static struct interface_descriptor fc_els_xchg_desc
Fibre Channel ELS exchange interface descriptor.
Definition: fcels.c:237

References fc_els_free(), fc_els_job_desc, fc_els_process_desc, fc_els_xchg_desc, fc_port_get(), intf_init(), fc_els::job, memcpy(), NULL, fc_els::peer_port_id, port, fc_els::port, fc_els::port_id, fc_els::process, process_init_stopped(), ref_init, fc_els::refcnt, fc_els::xchg, and zalloc().

Referenced by fc_els_request(), and fc_els_respond().

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

static int fc_els_respond ( struct interface xchg,
struct fc_port port,
struct fc_port_id port_id,
struct fc_port_id peer_port_id 
)
static

Create ELS response.

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

Definition at line 351 of file fcels.c.

353  {
354  struct fc_els *els;
355 
356  /* Allocate and initialise structure */
358  if ( ! els )
359  return -ENOMEM;
360 
361  /* Attach to exchange interface, mortalise self, and return */
362  intf_plug_plug ( &els->xchg, xchg );
363  ref_put ( &els->refcnt );
364  return 0;
365 }
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
struct interface xchg
Fibre Channel exchange.
Definition: fcels.h:329
struct refcnt refcnt
Reference count.
Definition: fcels.h:325
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
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
struct fc_port_id port_id
Local port ID.
Definition: fcels.h:336
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References ENOMEM, fc_els_create(), intf_plug_plug(), fc_els::peer_port_id, port, fc_els::port_id, ref_put, fc_els::refcnt, and fc_els::xchg.

◆ fc_els_unknown_tx()

static int fc_els_unknown_tx ( struct fc_els *els  __unused)
static

Transmit unknown ELS request.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 386 of file fcels.c.

386  {
387  return -ENOTSUP;
388 }
#define ENOTSUP
Operation not supported.
Definition: errno.h:589

References ENOTSUP.

◆ fc_els_unknown_tx_response()

static int fc_els_unknown_tx_response ( struct fc_els els)
static

Transmit unknown ELS response.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 396 of file fcels.c.

396  {
397  struct fc_ls_rjt_frame ls_rjt;
398 
399  /* Construct LS_RJT */
400  memset ( &ls_rjt, 0, sizeof ( ls_rjt ) );
401  ls_rjt.command = FC_ELS_LS_RJT;
402  ls_rjt.reason = FC_ELS_RJT_UNSUPPORTED;
403 
404  /* Transmit LS_RJT */
405  return fc_els_tx ( els, &ls_rjt, sizeof ( ls_rjt ) );
406 }
Link Service Reject.
Definition: fcels.h:31
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
Command not supported.
Definition: fcels.h:69
A Fibre Channel LS_RJT frame.
Definition: fcels.h:43
void * memset(void *dest, int character, size_t len) __nonnull

References fc_ls_rjt_frame::command, FC_ELS_LS_RJT, FC_ELS_RJT_UNSUPPORTED, fc_els_tx(), memset(), and fc_ls_rjt_frame::reason.

Referenced by fc_els_unknown_rx().

◆ fc_els_unknown_rx()

static int fc_els_unknown_rx ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive unknown ELS.

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

Definition at line 416 of file fcels.c.

416  {
417  int rc;
418 
419  DBGC ( els, FCELS_FMT ":\n", FCELS_ARGS ( els ) );
420  DBGC_HDA ( els, 0, data, len );
421 
422  /* Transmit response, if applicable */
423  if ( ! fc_els_is_request ( els ) ) {
424  if ( ( rc = fc_els_unknown_tx_response ( els ) ) != 0 )
425  return rc;
426  }
427 
428  return 0;
429 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC(...)
Definition: compiler.h:505
static int fc_els_unknown_tx_response(struct fc_els *els)
Transmit unknown ELS response.
Definition: fcels.c:396
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
#define DBGC_HDA(...)
Definition: compiler.h:506
#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
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References data, DBGC, DBGC_HDA, fc_els_is_request(), fc_els_unknown_tx_response(), FCELS_ARGS, FCELS_FMT, len, and rc.

◆ fc_els_unknown_detect()

static int fc_els_unknown_detect ( struct fc_els *els  __unused,
const void *data  __unused,
size_t len  __unused 
)
static

Detect unknown ELS.

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

Definition at line 439 of file fcels.c.

441  {
442  return -ENOTSUP;
443 }
#define ENOTSUP
Operation not supported.
Definition: errno.h:589

References ENOTSUP.

◆ fc_els_flogi_tx()

static int fc_els_flogi_tx ( struct fc_els els)
static

Transmit FLOGI.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 466 of file fcels.c.

466  {
467  struct fc_login_frame flogi;
468 
469  /* Construct FLOGI */
470  memset ( &flogi, 0, sizeof ( flogi ) );
471  flogi.command = fc_els_tx_command ( els, FC_ELS_FLOGI );
472  flogi.common.version = htons ( FC_LOGIN_VERSION );
473  flogi.common.credit = htons ( FC_LOGIN_DEFAULT_B2B );
474  flogi.common.flags = htons ( FC_LOGIN_CONTINUOUS_OFFSET );
475  flogi.common.mtu = htons ( FC_LOGIN_DEFAULT_MTU );
476  memcpy ( &flogi.port_wwn, &els->port->port_wwn,
477  sizeof ( flogi.port_wwn ) );
478  memcpy ( &flogi.node_wwn, &els->port->node_wwn,
479  sizeof ( flogi.node_wwn ) );
480  flogi.class3.flags = htons ( FC_LOGIN_CLASS_VALID |
482 
483  /* Transmit FLOGI */
484  return fc_els_tx ( els, &flogi, sizeof ( flogi ) );
485 }
#define FC_LOGIN_CONTINUOUS_OFFSET
Continuously increasing relative offset.
Definition: fcels.h:108
struct fc_name port_wwn
Port name.
Definition: fc.h:265
Fabric Login.
Definition: fcels.h:34
struct fc_name node_wwn
Node name.
Definition: fc.h:263
#define FC_LOGIN_CLASS_SEQUENTIAL
Sequential delivery requested.
Definition: fcels.h:205
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
void * memcpy(void *dest, const void *src, size_t len) __nonnull
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
#define FC_LOGIN_DEFAULT_MTU
Fibre Channel default MTU.
Definition: fcels.h:168
#define FC_LOGIN_DEFAULT_B2B
Fibre Channel default buffer-to-buffer credit.
Definition: fcels.h:105
#define FC_LOGIN_CLASS_VALID
Class valid.
Definition: fcels.h:202
#define FC_LOGIN_VERSION
Fibre Channel default login version.
Definition: fcels.h:102
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208
#define htons(value)
Definition: byteswap.h:135
void * memset(void *dest, int character, size_t len) __nonnull

References fc_login_frame::class3, fc_login_frame::command, fc_login_frame::common, fc_login_common::credit, FC_ELS_FLOGI, fc_els_tx(), fc_els_tx_command(), FC_LOGIN_CLASS_SEQUENTIAL, FC_LOGIN_CLASS_VALID, FC_LOGIN_CONTINUOUS_OFFSET, FC_LOGIN_DEFAULT_B2B, FC_LOGIN_DEFAULT_MTU, FC_LOGIN_VERSION, fc_login_common::flags, fc_login_class::flags, htons, memcpy(), memset(), fc_login_common::mtu, fc_login_frame::node_wwn, fc_port::node_wwn, fc_els::port, fc_login_frame::port_wwn, fc_port::port_wwn, and fc_login_common::version.

Referenced by fc_els_flogi_rx().

◆ fc_els_flogi_rx()

static int fc_els_flogi_rx ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive FLOGI.

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

Definition at line 495 of file fcels.c.

495  {
496  struct fc_login_frame *flogi = data;
497  int has_fabric;
498  int rc;
499 
500  /* Sanity check */
501  if ( len < sizeof ( *flogi ) ) {
502  DBGC ( els, FCELS_FMT " received underlength frame:\n",
503  FCELS_ARGS ( els ) );
504  DBGC_HDA ( els, 0, data, len );
505  return -EINVAL;
506  }
507 
508  /* Extract parameters */
509  has_fabric = ( flogi->common.flags & htons ( FC_LOGIN_F_PORT ) );
510  DBGC ( els, FCELS_FMT " has node %s\n", FCELS_ARGS ( els ),
511  fc_ntoa ( &flogi->node_wwn ) );
512  DBGC ( els, FCELS_FMT " has port %s\n", FCELS_ARGS ( els ),
513  fc_ntoa ( &flogi->port_wwn ) );
514  if ( has_fabric ) {
515  DBGC ( els, FCELS_FMT " has fabric with", FCELS_ARGS ( els ) );
516  DBGC ( els, " local ID %s\n", fc_id_ntoa ( &els->port_id ) );
517  } else {
518  DBGC ( els, FCELS_FMT " has point-to-point link\n",
519  FCELS_ARGS ( els ) );
520  }
521 
522  /* Log in port */
523  if ( ( rc = fc_port_login ( els->port, &els->port_id, &flogi->node_wwn,
524  &flogi->port_wwn, has_fabric ) ) != 0 ) {
525  DBGC ( els, FCELS_FMT " could not log in port: %s\n",
526  FCELS_ARGS ( els ), strerror ( rc ) );
527  return rc;
528  }
529 
530  /* Send any responses to the newly-assigned peer port ID, if
531  * applicable.
532  */
533  if ( ! has_fabric ) {
534  memcpy ( &els->peer_port_id, &els->port->ptp_link_port_id,
535  sizeof ( els->peer_port_id ) );
536  }
537 
538  /* Transmit response, if applicable */
539  if ( ! fc_els_is_request ( els ) ) {
540  if ( ( rc = fc_els_flogi_tx ( els ) ) != 0 )
541  return rc;
542  }
543 
544  return 0;
545 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct fc_login_common common
Common service parameters.
Definition: fcels.h:214
struct fc_port_id ptp_link_port_id
Link port ID (for point-to-point links only)
Definition: fc.h:280
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
#define DBGC(...)
Definition: compiler.h:505
int fc_port_login(struct fc_port *port, struct fc_port_id *port_id, const struct fc_name *link_node_wwn, const struct fc_name *link_port_wwn, int has_fabric)
Log in Fibre Channel port.
Definition: fc.c:941
static int fc_els_flogi_tx(struct fc_els *els)
Transmit FLOGI.
Definition: fcels.c:466
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
#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
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define FC_LOGIN_F_PORT
Forwarder port.
Definition: fcels.h:129
#define DBGC_HDA(...)
Definition: compiler.h:506
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
struct fc_name node_wwn
Node name.
Definition: fcels.h:218
#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
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct fc_name port_wwn
Port name.
Definition: fcels.h:216
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208
#define htons(value)
Definition: byteswap.h:135
struct fc_port_id port_id
Local port ID.
Definition: fcels.h:336
uint16_t flags
Flags.
Definition: fcels.h:81

References fc_login_frame::common, data, DBGC, DBGC_HDA, EINVAL, fc_els_flogi_tx(), fc_els_is_request(), fc_id_ntoa(), FC_LOGIN_F_PORT, fc_ntoa(), fc_port_login(), FCELS_ARGS, FCELS_FMT, fc_login_common::flags, htons, len, memcpy(), fc_login_frame::node_wwn, fc_els::peer_port_id, fc_els::port, fc_els::port_id, fc_login_frame::port_wwn, fc_port::ptp_link_port_id, rc, and strerror().

◆ fc_els_flogi_detect()

static int fc_els_flogi_detect ( struct fc_els *els  __unused,
const void *  data,
size_t len  __unused 
)
static

Detect FLOGI.

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

Definition at line 555 of file fcels.c.

556  {
557  const struct fc_login_frame *flogi = data;
558 
559  /* Check for FLOGI */
560  if ( flogi->command != FC_ELS_FLOGI )
561  return -EINVAL;
562 
563  return 0;
564 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Fabric Login.
Definition: fcels.h:34
uint8_t command
ELS command code.
Definition: fcels.h:210
uint8_t data[48]
Additional event data.
Definition: ena.h:22
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208

References fc_login_frame::command, data, EINVAL, and FC_ELS_FLOGI.

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

static int fc_els_plogi_tx ( struct fc_els els)
static

Transmit PLOGI.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 600 of file fcels.c.

600  {
601  struct fc_login_frame plogi;
602 
603  /* Construct PLOGI */
604  memset ( &plogi, 0, sizeof ( plogi ) );
605  plogi.command = fc_els_tx_command ( els, FC_ELS_PLOGI );
606  plogi.common.version = htons ( FC_LOGIN_VERSION );
607  plogi.common.credit = htons ( FC_LOGIN_DEFAULT_B2B );
608  plogi.common.flags = htons ( FC_LOGIN_CONTINUOUS_OFFSET );
609  plogi.common.mtu = htons ( FC_LOGIN_DEFAULT_MTU );
610  plogi.common.u.plogi.max_seq = htons ( FC_LOGIN_DEFAULT_MAX_SEQ );
611  plogi.common.u.plogi.rel_offs = htons ( FC_LOGIN_DEFAULT_REL_OFFS );
612  plogi.common.e_d_tov = htonl ( FC_LOGIN_DEFAULT_E_D_TOV );
613  memcpy ( &plogi.port_wwn, &els->port->port_wwn,
614  sizeof ( plogi.port_wwn ) );
615  memcpy ( &plogi.node_wwn, &els->port->node_wwn,
616  sizeof ( plogi.node_wwn ) );
617  plogi.class3.flags = htons ( FC_LOGIN_CLASS_VALID |
619  plogi.class3.mtu = htons ( FC_LOGIN_DEFAULT_MTU );
620  plogi.class3.max_seq = htons ( FC_LOGIN_DEFAULT_MAX_SEQ );
621  plogi.class3.max_seq_per_xchg = 1;
622 
623  /* Transmit PLOGI */
624  return fc_els_tx ( els, &plogi, sizeof ( plogi ) );
625 }
#define FC_LOGIN_DEFAULT_REL_OFFS
Default relative offset by info category.
Definition: fcels.h:174
#define FC_LOGIN_DEFAULT_E_D_TOV
Default E_D timeout value.
Definition: fcels.h:177
#define FC_LOGIN_CONTINUOUS_OFFSET
Continuously increasing relative offset.
Definition: fcels.h:108
struct fc_name port_wwn
Port name.
Definition: fc.h:265
struct fc_name node_wwn
Node name.
Definition: fc.h:263
#define FC_LOGIN_CLASS_SEQUENTIAL
Sequential delivery requested.
Definition: fcels.h:205
#define htonl(value)
Definition: byteswap.h:133
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
void * memcpy(void *dest, const void *src, size_t len) __nonnull
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
#define FC_LOGIN_DEFAULT_MTU
Fibre Channel default MTU.
Definition: fcels.h:168
#define FC_LOGIN_DEFAULT_B2B
Fibre Channel default buffer-to-buffer credit.
Definition: fcels.h:105
#define FC_LOGIN_DEFAULT_MAX_SEQ
Default maximum number of concurrent sequences.
Definition: fcels.h:171
Port Login.
Definition: fcels.h:33
#define FC_LOGIN_CLASS_VALID
Class valid.
Definition: fcels.h:202
#define FC_LOGIN_VERSION
Fibre Channel default login version.
Definition: fcels.h:102
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208
#define htons(value)
Definition: byteswap.h:135
void * memset(void *dest, int character, size_t len) __nonnull

References fc_login_frame::class3, fc_login_frame::command, fc_login_frame::common, fc_login_common::credit, fc_login_common::e_d_tov, FC_ELS_PLOGI, fc_els_tx(), fc_els_tx_command(), FC_LOGIN_CLASS_SEQUENTIAL, FC_LOGIN_CLASS_VALID, FC_LOGIN_CONTINUOUS_OFFSET, FC_LOGIN_DEFAULT_B2B, FC_LOGIN_DEFAULT_E_D_TOV, FC_LOGIN_DEFAULT_MAX_SEQ, FC_LOGIN_DEFAULT_MTU, FC_LOGIN_DEFAULT_REL_OFFS, FC_LOGIN_VERSION, fc_login_common::flags, fc_login_class::flags, htonl, htons, fc_login_class::max_seq, fc_login_class::max_seq_per_xchg, memcpy(), memset(), fc_login_common::mtu, fc_login_class::mtu, fc_login_frame::node_wwn, fc_port::node_wwn, fc_login_common::plogi, fc_els::port, fc_login_frame::port_wwn, fc_port::port_wwn, fc_login_common::u, and fc_login_common::version.

Referenced by fc_els_plogi_rx().

◆ fc_els_plogi_rx()

static int fc_els_plogi_rx ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive PLOGI.

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

Definition at line 635 of file fcels.c.

635  {
636  struct fc_login_frame *plogi = data;
637  struct fc_peer *peer;
638  int rc;
639 
640  /* Sanity checks */
641  if ( len < sizeof ( *plogi ) ) {
642  DBGC ( els, FCELS_FMT " received underlength frame:\n",
643  FCELS_ARGS ( els ) );
644  DBGC_HDA ( els, 0, data, len );
645  rc = -EINVAL;
646  goto err_sanity;
647  }
648  if ( ! fc_link_ok ( &els->port->link ) ) {
649  DBGC ( els, FCELS_FMT " received while port link is down\n",
650  FCELS_ARGS ( els ) );
651  rc = -EINVAL;
652  goto err_sanity;
653  }
654 
655  /* Extract parameters */
656  DBGC ( els, FCELS_FMT " has node %s\n", FCELS_ARGS ( els ),
657  fc_ntoa ( &plogi->node_wwn ) );
658  DBGC ( els, FCELS_FMT " has port %s as %s\n",
659  FCELS_ARGS ( els ), fc_ntoa ( &plogi->port_wwn ),
660  fc_id_ntoa ( &els->peer_port_id ) );
661 
662  /* Get peer */
663  peer = fc_peer_get_wwn ( &plogi->port_wwn );
664  if ( ! peer ) {
665  DBGC ( els, FCELS_FMT " could not create peer\n",
666  FCELS_ARGS ( els ) );
667  rc = -ENOMEM;
668  goto err_peer_get_wwn;
669  }
670 
671  /* Record login */
672  if ( ( rc = fc_peer_login ( peer, els->port,
673  &els->peer_port_id ) ) != 0 ) {
674  DBGC ( els, FCELS_FMT " could not log in peer: %s\n",
675  FCELS_ARGS ( els ), strerror ( rc ) );
676  goto err_login;
677  }
678 
679  /* Transmit response, if applicable */
680  if ( ! fc_els_is_request ( els ) ) {
681  if ( ( rc = fc_els_plogi_tx ( els ) ) != 0 )
682  goto err_plogi_tx;
683  }
684 
685  /* Drop temporary reference to peer */
686  fc_peer_put ( peer );
687 
688  return 0;
689 
690  err_plogi_tx:
691  err_login:
692  fc_peer_put ( peer );
693  err_peer_get_wwn:
694  err_sanity:
695  return rc;
696 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int fc_els_plogi_tx(struct fc_els *els)
Transmit PLOGI.
Definition: fcels.c:600
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
struct fc_peer * fc_peer_get_wwn(const struct fc_name *port_wwn)
Get Fibre Channel peer by node name.
Definition: fc.c:1516
#define DBGC(...)
Definition: compiler.h:505
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
#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
int fc_peer_login(struct fc_peer *peer, struct fc_port *port, struct fc_port_id *port_id)
Log in Fibre Channel peer.
Definition: fc.c:1300
#define ENOMEM
Not enough space.
Definition: errno.h:534
#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
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void fc_peer_put(struct fc_peer *peer)
Drop reference to Fibre Channel peer.
Definition: fc.h:390
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
struct fc_link_state link
Link state monitor.
Definition: fc.h:272
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
A Fibre Channel peer.
Definition: fc.h:340
struct interface plogi
PLOGI interface.
Definition: fc.h:352
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
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct mschapv2_challenge peer
Peer challenge.
Definition: mschapv2.h:12
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208

References data, DBGC, DBGC_HDA, EINVAL, ENOMEM, fc_els_is_request(), fc_els_plogi_tx(), fc_id_ntoa(), fc_link_ok(), fc_ntoa(), fc_peer_get_wwn(), fc_peer_login(), fc_peer_put(), FCELS_ARGS, FCELS_FMT, len, fc_port::link, peer, fc_els::peer_port_id, fc_peer::plogi, fc_els::port, rc, and strerror().

◆ fc_els_plogi_detect()

static int fc_els_plogi_detect ( struct fc_els *els  __unused,
const void *  data,
size_t len  __unused 
)
static

Detect PLOGI.

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

Definition at line 706 of file fcels.c.

707  {
708  const struct fc_login_frame *plogi = data;
709 
710  /* Check for PLOGI */
711  if ( plogi->command != FC_ELS_PLOGI )
712  return -EINVAL;
713 
714  return 0;
715 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
uint8_t command
ELS command code.
Definition: fcels.h:210
Port Login.
Definition: fcels.h:33
uint8_t data[48]
Additional event data.
Definition: ena.h:22
A Fibre Channel FLOGI/PLOGI frame.
Definition: fcels.h:208

References fc_login_frame::command, data, EINVAL, and FC_ELS_PLOGI.

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

static int fc_els_logo_tx ( struct fc_els els)
static

Transmit LOGO request.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 753 of file fcels.c.

753  {
754  struct fc_logout_request_frame logo;
755 
756  /* Construct LOGO */
757  memset ( &logo, 0, sizeof ( logo ) );
758  logo.command = FC_ELS_LOGO;
759  memcpy ( &logo.port_id, &els->port->port_id, sizeof ( logo.port_id ) );
760  memcpy ( &logo.port_wwn, &els->port->port_wwn,
761  sizeof ( logo.port_wwn ) );
762 
763  /* Transmit LOGO */
764  return fc_els_tx ( els, &logo, sizeof ( logo ) );
765 }
struct fc_name port_wwn
Port name.
Definition: fc.h:265
Logout.
Definition: fcels.h:35
struct fc_port_id port_id
Local port ID.
Definition: fc.h:267
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
A Fibre Channel LOGO request frame.
Definition: fcels.h:232
void * memset(void *dest, int character, size_t len) __nonnull

References fc_logout_request_frame::command, FC_ELS_LOGO, fc_els_tx(), memcpy(), memset(), fc_els::port, fc_logout_request_frame::port_id, fc_port::port_id, fc_logout_request_frame::port_wwn, and fc_port::port_wwn.

◆ fc_els_logo_tx_response()

static int fc_els_logo_tx_response ( struct fc_els els)
static

Transmit LOGO response.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 773 of file fcels.c.

773  {
774  struct fc_logout_response_frame logo;
775 
776  /* Construct LOGO */
777  memset ( &logo, 0, sizeof ( logo ) );
778  logo.command = FC_ELS_LS_ACC;
779 
780  /* Transmit LOGO */
781  return fc_els_tx ( els, &logo, sizeof ( logo ) );
782 }
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
Link Service Accept.
Definition: fcels.h:32
A Fibre Channel LOGO response frame.
Definition: fcels.h:244
void * memset(void *dest, int character, size_t len) __nonnull

References fc_logout_response_frame::command, FC_ELS_LS_ACC, fc_els_tx(), and memset().

Referenced by fc_els_logo_rx_request().

◆ fc_els_logo_logout()

static void fc_els_logo_logout ( struct fc_els els,
struct fc_port_id peer_port_id 
)
static

Log out individual peer or whole port as applicable.

Parameters
elsFibre Channel ELS transaction
port_idPeer port ID

Definition at line 790 of file fcels.c.

791  {
792  struct fc_peer *peer;
793 
794  if ( ( memcmp ( peer_port_id, &fc_f_port_id,
795  sizeof ( *peer_port_id ) ) == 0 ) ||
796  ( memcmp ( peer_port_id, &els->port->port_id,
797  sizeof ( *peer_port_id ) ) == 0 ) ) {
798  fc_port_logout ( els->port, 0 );
799  } else {
800  peer = fc_peer_get_port_id ( els->port, peer_port_id );
801  if ( peer ) {
802  fc_peer_logout ( peer, 0 );
803  fc_peer_put ( peer );
804  }
805  }
806 }
struct fc_port_id fc_f_port_id
F_Port contoller port ID.
Definition: fc.c:68
struct fc_port_id port_id
Local port ID.
Definition: fc.h:267
struct fc_peer * fc_peer_get_port_id(struct fc_port *port, const struct fc_port_id *peer_port_id)
Get Fibre Channel peer by port ID.
Definition: fc.c:1541
static void fc_peer_put(struct fc_peer *peer)
Drop reference to Fibre Channel peer.
Definition: fc.h:390
struct fc_port * port
Fibre Channel port.
Definition: fcels.h:334
void fc_peer_logout(struct fc_peer *peer, int rc)
Log out Fibre Channel peer.
Definition: fc.c:1347
A Fibre Channel peer.
Definition: fc.h:340
struct mschapv2_challenge peer
Peer challenge.
Definition: mschapv2.h:12
void fc_port_logout(struct fc_port *port, int rc)
Log out Fibre Channel port.
Definition: fc.c:1039
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:114

References fc_f_port_id, fc_peer_get_port_id(), fc_peer_logout(), fc_peer_put(), fc_port_logout(), memcmp(), peer, fc_els::port, and fc_port::port_id.

Referenced by fc_els_logo_rx_request(), and fc_els_logo_rx_response().

◆ fc_els_logo_rx_request()

static int fc_els_logo_rx_request ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive LOGO request.

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

Definition at line 816 of file fcels.c.

817  {
818  struct fc_logout_request_frame *logo = data;
819  int rc;
820 
821  /* Sanity check */
822  if ( len < sizeof ( *logo ) ) {
823  DBGC ( els, FCELS_FMT " received underlength frame:\n",
824  FCELS_ARGS ( els ) );
825  DBGC_HDA ( els, 0, data, len );
826  return -EINVAL;
827  }
828 
829  DBGC ( els, FCELS_FMT " has port %s as %s\n", FCELS_ARGS ( els ),
830  fc_ntoa ( &logo->port_wwn ), fc_id_ntoa ( &logo->port_id ) );
831 
832  /* Log out individual peer or whole port as applicable */
833  fc_els_logo_logout ( els, &logo->port_id );
834 
835  /* Transmit repsonse */
836  if ( ( rc = fc_els_logo_tx_response ( els ) ) != 0 )
837  return rc;
838 
839  return 0;
840 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
#define DBGC(...)
Definition: compiler.h:505
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
#define DBGC_HDA(...)
Definition: compiler.h:506
struct fc_port_id port_id
Port ID.
Definition: fcels.h:238
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
static int fc_els_logo_tx_response(struct fc_els *els)
Transmit LOGO response.
Definition: fcels.c:773
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
struct fc_name port_wwn
Port name.
Definition: fcels.h:240
static void fc_els_logo_logout(struct fc_els *els, struct fc_port_id *peer_port_id)
Log out individual peer or whole port as applicable.
Definition: fcels.c:790
A Fibre Channel LOGO request frame.
Definition: fcels.h:232

References data, DBGC, DBGC_HDA, EINVAL, fc_els_logo_logout(), fc_els_logo_tx_response(), fc_id_ntoa(), fc_ntoa(), FCELS_ARGS, FCELS_FMT, len, fc_logout_request_frame::port_id, fc_logout_request_frame::port_wwn, and rc.

Referenced by fc_els_logo_rx().

◆ fc_els_logo_rx_response()

static int fc_els_logo_rx_response ( struct fc_els els,
void *data  __unused,
size_t len  __unused 
)
static

Receive LOGO response.

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

Definition at line 850 of file fcels.c.

851  {
852 
853  /* Log out individual peer or whole port as applicable */
854  fc_els_logo_logout ( els, &els->peer_port_id );
855 
856  return 0;
857 }
struct fc_port_id peer_port_id
Peer port ID.
Definition: fcels.h:338
static void fc_els_logo_logout(struct fc_els *els, struct fc_port_id *peer_port_id)
Log out individual peer or whole port as applicable.
Definition: fcels.c:790

References fc_els_logo_logout(), and fc_els::peer_port_id.

Referenced by fc_els_logo_rx().

◆ fc_els_logo_rx()

static int fc_els_logo_rx ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive LOGO.

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

Definition at line 867 of file fcels.c.

867  {
868 
869  if ( fc_els_is_request ( els ) ) {
870  return fc_els_logo_rx_response ( els, data, len );
871  } else {
872  return fc_els_logo_rx_request ( els, data, len );
873  }
874 }
static int fc_els_logo_rx_request(struct fc_els *els, void *data, size_t len)
Receive LOGO request.
Definition: fcels.c:816
static int fc_els_logo_rx_response(struct fc_els *els, void *data __unused, size_t len __unused)
Receive LOGO response.
Definition: fcels.c:850
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
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References data, fc_els_is_request(), fc_els_logo_rx_request(), fc_els_logo_rx_response(), and len.

◆ fc_els_logo_detect()

static int fc_els_logo_detect ( struct fc_els *els  __unused,
const void *  data,
size_t len  __unused 
)
static

Detect LOGO.

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

Definition at line 884 of file fcels.c.

885  {
886  const struct fc_logout_request_frame *logo = data;
887 
888  /* Check for LOGO */
889  if ( logo->command != FC_ELS_LOGO )
890  return -EINVAL;
891 
892  return 0;
893 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Logout.
Definition: fcels.h:35
uint8_t command
ELS command code.
Definition: fcels.h:234
uint8_t data[48]
Additional event data.
Definition: ena.h:22
A Fibre Channel LOGO request frame.
Definition: fcels.h:232

References fc_logout_request_frame::command, data, EINVAL, and FC_ELS_LOGO.

◆ 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
u8 port
Port number.
Definition: CIB_PRM.h:31

References fc_els_request(), and port.

◆ fc_els_prli_descriptor()

static struct fc_els_prli_descriptor* fc_els_prli_descriptor ( unsigned int  type)
static

Find PRLI descriptor.

Parameters
typeUpper-layer protocol type
Return values
descriptorPRLI descriptor, or NULL

Definition at line 932 of file fcels.c.

932  {
933  struct fc_els_prli_descriptor *descriptor;
934 
936  if ( descriptor->type == type )
937  return descriptor;
938  }
939  return NULL;
940 }
#define FC_ELS_PRLI_DESCRIPTORS
Fibre Channel ELS PRLI descriptor table.
Definition: fcels.h:396
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
uint32_t type
Operating system type.
Definition: ena.h:12
unsigned int type
Upper-layer protocol type.
Definition: fcels.h:388
A Fibre Channel ELS PRLI descriptor.
Definition: fcels.h:386
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References FC_ELS_PRLI_DESCRIPTORS, for_each_table_entry, NULL, type, and fc_els_prli_descriptor::type.

Referenced by fc_els_prli().

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

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

static int fc_els_rtv_tx_response ( struct fc_els els)
static

Transmit RTV response.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 1150 of file fcels.c.

1150  {
1151  struct fc_rtv_response_frame rtv;
1152 
1153  /* Construct RTV */
1154  memset ( &rtv, 0, sizeof ( rtv ) );
1155  rtv.command = FC_ELS_LS_ACC;
1156  rtv.e_d_tov = htonl ( FC_LOGIN_DEFAULT_E_D_TOV );
1157 
1158  /* Transmit RTV */
1159  return fc_els_tx ( els, &rtv, sizeof ( rtv ) );
1160 }
#define FC_LOGIN_DEFAULT_E_D_TOV
Default E_D timeout value.
Definition: fcels.h:177
A Fibre Channel RTV response frame.
Definition: fcels.h:293
#define htonl(value)
Definition: byteswap.h:133
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
Link Service Accept.
Definition: fcels.h:32
void * memset(void *dest, int character, size_t len) __nonnull

References fc_rtv_response_frame::command, fc_rtv_response_frame::e_d_tov, FC_ELS_LS_ACC, fc_els_tx(), FC_LOGIN_DEFAULT_E_D_TOV, htonl, and memset().

Referenced by fc_els_rtv_rx().

◆ fc_els_rtv_rx()

static int fc_els_rtv_rx ( struct fc_els els,
void *data  __unused,
size_t len  __unused 
)
static

Receive RTV.

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

Definition at line 1170 of file fcels.c.

1171  {
1172  int rc;
1173 
1174  DBGC ( els, FCELS_FMT "\n", FCELS_ARGS ( els ) );
1175 
1176  /* Transmit response */
1177  if ( ! fc_els_is_request ( els ) ) {
1178  if ( ( rc = fc_els_rtv_tx_response ( els ) ) != 0 )
1179  return rc;
1180  }
1181 
1182  return 0;
1183 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static int fc_els_rtv_tx_response(struct fc_els *els)
Transmit RTV response.
Definition: fcels.c:1150
#define DBGC(...)
Definition: compiler.h:505
#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
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408

References DBGC, fc_els_is_request(), fc_els_rtv_tx_response(), FCELS_ARGS, FCELS_FMT, and rc.

◆ fc_els_rtv_detect()

static int fc_els_rtv_detect ( struct fc_els *els  __unused,
const void *  data,
size_t len  __unused 
)
static

Detect RTV.

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

Definition at line 1193 of file fcels.c.

1194  {
1195  const struct fc_rtv_request_frame *rtv = data;
1196 
1197  /* Check for RTV */
1198  if ( rtv->command != FC_ELS_RTV )
1199  return -EINVAL;
1200 
1201  return 0;
1202 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
A Fibre Channel RTV request frame.
Definition: fcels.h:285
Read Timeout Value.
Definition: fcels.h:36
uint8_t command
ELS command code.
Definition: fcels.h:287
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References fc_rtv_request_frame::command, data, EINVAL, and FC_ELS_RTV.

◆ fc_els_echo_tx()

static int fc_els_echo_tx ( struct fc_els els)
static

Transmit ECHO.

Parameters
elsFibre Channel ELS transaction
Return values
rcReturn status code

Definition at line 1236 of file fcels.c.

1236  {
1237  struct fc_echo_request_frame echo;
1238 
1239  /* Construct ECHO */
1240  memset ( &echo, 0, sizeof ( echo ) );
1241  echo.echo.command = FC_ELS_ECHO;
1242  echo.magic = htonl ( FC_ECHO_MAGIC );
1243 
1244  /* Transmit ECHO */
1245  return fc_els_tx ( els, &echo, sizeof ( echo ) );
1246 }
Echo.
Definition: fcels.h:37
#define FC_ECHO_MAGIC
ECHO magic marker.
Definition: fcels.c:1228
#define htonl(value)
Definition: byteswap.h:133
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
ECHO request data.
Definition: fcels.c:1220
void * memset(void *dest, int character, size_t len) __nonnull
int echo(void)
Definition: kb.c:133

References echo(), FC_ECHO_MAGIC, FC_ELS_ECHO, fc_els_tx(), htonl, and memset().

◆ fc_els_echo_rx_request()

static int fc_els_echo_rx_request ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive ECHO request.

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

Definition at line 1256 of file fcels.c.

1257  {
1258  struct {
1259  struct fc_echo_frame_header echo;
1260  char payload[ len - sizeof ( struct fc_echo_frame_header ) ];
1261  } *echo = data;
1262  int rc;
1263 
1264  DBGC ( els, FCELS_FMT "\n", FCELS_ARGS ( els ) );
1265 
1266  /* Transmit response */
1267  echo->echo.command = FC_ELS_LS_ACC;
1268  if ( ( rc = fc_els_tx ( els, echo, sizeof ( *echo ) ) ) != 0 )
1269  return rc;
1270 
1271  /* Nothing to do */
1272  return 0;
1273 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
A Fibre Channel ECHO frame.
Definition: fcels.h:315
struct fc_echo_frame_header echo
ECHO frame header.
Definition: fcels.c:1222
#define DBGC(...)
Definition: compiler.h:505
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
int fc_els_tx(struct fc_els *els, const void *data, size_t len)
Transmit Fibre Channel ELS frame.
Definition: fcels.c:126
Link Service Accept.
Definition: fcels.h:32
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22
int echo(void)
Definition: kb.c:133

References data, DBGC, echo(), fc_echo_request_frame::echo, FC_ELS_LS_ACC, fc_els_tx(), FCELS_ARGS, FCELS_FMT, len, and rc.

Referenced by fc_els_echo_rx().

◆ fc_els_echo_rx_response()

static int fc_els_echo_rx_response ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive ECHO response.

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

Definition at line 1283 of file fcels.c.

1284  {
1285  struct fc_echo_request_frame *echo = data;
1286 
1287  DBGC ( els, FCELS_FMT "\n", FCELS_ARGS ( els ) );
1288 
1289  /* Check response is correct */
1290  if ( ( len != sizeof ( *echo ) ) ||
1291  ( echo->magic != htonl ( FC_ECHO_MAGIC ) ) ) {
1292  DBGC ( els, FCELS_FMT " received bad echo response\n",
1293  FCELS_ARGS ( els ) );
1294  DBGC_HDA ( els, 0, data, len );
1295  return -EIO;
1296  }
1297 
1298  return 0;
1299 }
#define DBGC(...)
Definition: compiler.h:505
#define FC_ECHO_MAGIC
ECHO magic marker.
Definition: fcels.c:1228
#define FCELS_FMT
Fibre Channel ELS transaction debug message format.
Definition: fcels.c:46
#define htonl(value)
Definition: byteswap.h:133
ECHO request data.
Definition: fcels.c:1220
#define DBGC_HDA(...)
Definition: compiler.h:506
#define FCELS_ARGS(els)
Fibre Channel ELS transaction debug message arguments.
Definition: fcels.c:49
uint32_t len
Length.
Definition: ena.h:14
#define EIO
Input/output error.
Definition: errno.h:433
uint8_t data[48]
Additional event data.
Definition: ena.h:22
int echo(void)
Definition: kb.c:133

References data, DBGC, DBGC_HDA, echo(), EIO, FC_ECHO_MAGIC, FCELS_ARGS, FCELS_FMT, htonl, and len.

Referenced by fc_els_echo_rx().

◆ fc_els_echo_rx()

static int fc_els_echo_rx ( struct fc_els els,
void *  data,
size_t  len 
)
static

Receive ECHO.

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

Definition at line 1309 of file fcels.c.

1309  {
1310 
1311  if ( fc_els_is_request ( els ) ) {
1312  return fc_els_echo_rx_response ( els, data, len );
1313  } else {
1314  return fc_els_echo_rx_request ( els, data, len );
1315  }
1316 }
static int fc_els_echo_rx_request(struct fc_els *els, void *data, size_t len)
Receive ECHO request.
Definition: fcels.c:1256
static int fc_els_is_request(struct fc_els *els)
Check if Fibre Channel ELS transaction is a request.
Definition: fcels.h:408
static int fc_els_echo_rx_response(struct fc_els *els, void *data, size_t len)
Receive ECHO response.
Definition: fcels.c:1283
uint32_t len
Length.
Definition: ena.h:14
uint8_t data[48]
Additional event data.
Definition: ena.h:22

References data, fc_els_echo_rx_request(), fc_els_echo_rx_response(), fc_els_is_request(), and len.

◆ fc_els_echo_detect()

static int fc_els_echo_detect ( struct fc_els *els  __unused,
const void *  data,
size_t len  __unused 
)
static

Detect ECHO.

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

Definition at line 1326 of file fcels.c.

1327  {
1328  const struct fc_echo_frame_header *echo = data;
1329 
1330  /* Check for ECHO */
1331  if ( echo->command != FC_ELS_ECHO )
1332  return -EINVAL;
1333 
1334  return 0;
1335 }
#define EINVAL
Invalid argument.
Definition: errno.h:428
Echo.
Definition: fcels.h:37
A Fibre Channel ECHO frame.
Definition: fcels.h:315
uint8_t data[48]
Additional event data.
Definition: ena.h:22
int echo(void)
Definition: kb.c:133

References data, echo(), EINVAL, and FC_ELS_ECHO.

Variable Documentation

◆ __fc_els_handler

struct fc_els_handler fc_els_echo_handler __fc_els_handler
Initial value:
= {
.name = "UNKNOWN",
}
static int fc_els_unknown_rx(struct fc_els *els, void *data, size_t len)
Receive unknown ELS.
Definition: fcels.c:416
static int fc_els_unknown_detect(struct fc_els *els __unused, const void *data __unused, size_t len __unused)
Detect unknown ELS.
Definition: fcels.c:439
static int fc_els_unknown_tx(struct fc_els *els __unused)
Transmit unknown ELS request.
Definition: fcels.c:386

Unknown ELS handler.

ECHO ELS handler.

RTV ELS handler.

LOGO ELS handler.

PLOGI ELS handler.

FLOGI ELS handler.

Definition at line 55 of file fcels.c.

◆ fc_els_xchg_op

struct interface_operation fc_els_xchg_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void fc_els_close(struct fc_els *els, int rc)
Close Fibre Channel ELS transaction.
Definition: fcels.c:76
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32
int xfer_deliver(struct interface *intf, struct io_buffer *iobuf, struct xfer_metadata *meta)
Deliver datagram.
Definition: xfer.c:194
static int fc_els_rx(struct fc_els *els, struct io_buffer *iobuf, struct xfer_metadata *meta)
Receive Fibre Channel ELS frame.
Definition: fcels.c:159

Fibre Channel ELS exchange interface operations.

Definition at line 231 of file fcels.c.

◆ fc_els_xchg_desc

struct interface_descriptor fc_els_xchg_desc
static
Initial value:
=
INTF_DESC ( struct fc_els, xchg, fc_els_xchg_op )
static struct interface_operation fc_els_xchg_op[]
Fibre Channel ELS exchange interface operations.
Definition: fcels.c:231
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80

Fibre Channel ELS exchange interface descriptor.

Definition at line 237 of file fcels.c.

Referenced by fc_els_create().

◆ fc_els_job_op

struct interface_operation fc_els_job_op[]
static
Initial value:
= {
}
void intf_close(struct interface *intf, int rc)
Close an object interface.
Definition: interface.c:249
static void fc_els_close(struct fc_els *els, int rc)
Close Fibre Channel ELS transaction.
Definition: fcels.c:76
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
#define INTF_OP(op_type, object_type, op_func)
Define an object interface operation.
Definition: interface.h:32

Fibre Channel ELS job control interface operations.

Definition at line 241 of file fcels.c.

◆ fc_els_job_desc

struct interface_descriptor fc_els_job_desc
static
Initial value:
=
INTF_DESC ( struct fc_els, job, fc_els_job_op )
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
#define INTF_DESC(object_type, intf, operations)
Define an object interface descriptor.
Definition: interface.h:80
static struct interface_operation fc_els_job_op[]
Fibre Channel ELS job control interface operations.
Definition: fcels.c:241

Fibre Channel ELS job control interface descriptor.

Definition at line 246 of file fcels.c.

Referenced by fc_els_create().

◆ fc_els_process_desc

struct process_descriptor fc_els_process_desc
static
Initial value:
=
A process.
Definition: process.h:17
#define PROC_DESC_ONCE(object_type, process, _step)
Define a process descriptor for a process that runs only once.
Definition: process.h:97
A Fibre Channel extended link services transaction.
Definition: fcels.h:323
static void fc_els_step(struct fc_els *els)
Fibre Channel ELS process.
Definition: fcels.c:254

Fibre Channel ELS process descriptor.

Definition at line 282 of file fcels.c.

Referenced by fc_els_create().

◆ __fc_responder

struct fc_responder fc_els_responder __fc_responder
Initial value:
= {
.type = FC_TYPE_ELS,
.respond = fc_els_respond,
}
static int fc_els_respond(struct interface *xchg, struct fc_port *port, struct fc_port_id *port_id, struct fc_port_id *peer_port_id)
Create ELS response.
Definition: fcels.c:351
Extended Link Service.
Definition: fc.h:192

Fibre Channel ELS responder.

Definition at line 368 of file fcels.c.