iPXE
|
Fibre Channel. More...
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <ipxe/refcnt.h>
#include <ipxe/list.h>
#include <ipxe/tables.h>
#include <ipxe/timer.h>
#include <ipxe/retry.h>
#include <ipxe/interface.h>
#include <ipxe/xfer.h>
#include <ipxe/iobuf.h>
#include <ipxe/fc.h>
#include <ipxe/fcels.h>
#include <ipxe/fcns.h>
Go to the source code of this file.
Data Structures | |
struct | fc_exchange |
A Fibre Channel exchange. More... | |
Macros | |
#define | EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS ) |
Default link status code. More... | |
#define | EINFO_EUNKNOWN_LINK_STATUS __einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" ) |
#define | FC_TIMEOUT ( 1 * TICKS_PER_SEC ) |
Fibre Channel timeout. More... | |
Enumerations | |
enum | fc_exchange_flags { FC_XCHG_ORIGINATOR = 0x0001, FC_XCHG_SEQ_INITIATIVE = 0x0002, FC_XCHG_SEQ_FIRST = 0x0004 } |
Fibre Channel exchange flags. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
LIST_HEAD (fc_ports) | |
List of Fibre Channel ports. More... | |
LIST_HEAD (fc_peers) | |
List of Fibre Channel peers. More... | |
const char * | fc_id_ntoa (const struct fc_port_id *id) |
Format Fibre Channel port ID. More... | |
int | fc_id_aton (const char *id_text, struct fc_port_id *id) |
Parse Fibre Channel port ID. More... | |
const char * | fc_ntoa (const struct fc_name *wwn) |
Format Fibre Channel WWN. More... | |
int | fc_aton (const char *wwn_text, struct fc_name *wwn) |
Parse Fibre Channel WWN. More... | |
struct sockaddr * | fc_fill_sockaddr (struct sockaddr_fc *sa_fc, struct fc_port_id *id) |
Fill Fibre Channel socket address. More... | |
static void | fc_link_up (struct fc_link_state *link) |
Mark Fibre Channel link as up. More... | |
static void | fc_link_err (struct fc_link_state *link, int rc) |
Mark Fibre Channel link as down. More... | |
static void | fc_link_examine (struct fc_link_state *link) |
Examine Fibre Channel link state. More... | |
static void | fc_link_expired (struct retry_timer *timer, int over __unused) |
Handle Fibre Channel link retry timer expiry. More... | |
static void | fc_link_init (struct fc_link_state *link, void(*examine)(struct fc_link_state *link), struct refcnt *refcnt) |
Initialise Fibre Channel link state monitor. More... | |
static void | fc_link_start (struct fc_link_state *link) |
Start monitoring Fibre Channel link state. More... | |
static void | fc_link_stop (struct fc_link_state *link) |
Stop monitoring Fibre Channel link state. More... | |
static unsigned int | fc_new_xchg_id (void) |
Create local Fibre Channel exchange identifier. More... | |
static unsigned int | fc_new_seq_id (void) |
Create local Fibre Channel sequence identifier. More... | |
static void | fc_xchg_free (struct refcnt *refcnt) |
Free Fibre Channel exchange. More... | |
static void | fc_xchg_close (struct fc_exchange *xchg, int rc) |
Close Fibre Channel exchange. More... | |
static void | fc_xchg_expired (struct retry_timer *timer, int over __unused) |
Handle exchange timeout. More... | |
static size_t | fc_xchg_window (struct fc_exchange *xchg __unused) |
Check Fibre Channel exchange window. More... | |
static struct io_buffer * | fc_xchg_alloc_iob (struct fc_exchange *xchg, size_t len) |
Allocate Fibre Channel I/O buffer. More... | |
static int | fc_xchg_tx (struct fc_exchange *xchg, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Transmit data as part of a Fibre Channel exchange. More... | |
static int | fc_xchg_rx (struct fc_exchange *xchg, struct io_buffer *iobuf, struct xfer_metadata *meta __unused) |
Receive data as part of a Fibre Channel exchange. More... | |
static struct fc_exchange * | fc_xchg_create (struct fc_port *port, struct fc_port_id *peer_port_id, unsigned int type) |
Create new Fibre Channel exchange. More... | |
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. More... | |
static struct fc_exchange * | fc_xchg_respond (struct fc_port *port, struct fc_frame_header *fchdr) |
Open a new responder Fibre Channel exchange. More... | |
static void | fc_port_close (struct fc_port *port, int rc) |
Close Fibre Channel port. More... | |
static struct fc_exchange * | fc_port_demux (struct fc_port *port, unsigned int xchg_id) |
Identify Fibre Channel exchange by local exchange ID. More... | |
static int | fc_port_deliver (struct fc_port *port, struct io_buffer *iobuf, struct xfer_metadata *meta) |
Handle received frame from Fibre Channel port. More... | |
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. More... | |
void | fc_port_logout (struct fc_port *port, int rc) |
Log out Fibre Channel port. More... | |
static void | fc_port_flogi_done (struct fc_port *port, int rc) |
Handle FLOGI completion. More... | |
static void | fc_port_ns_plogi_done (struct fc_port *port, int rc) |
Handle name server PLOGI completion. More... | |
static void | fc_port_examine (struct fc_link_state *link) |
Examine Fibre Channel port link state. More... | |
static void | fc_port_window_changed (struct fc_port *port) |
Handle change of flow control window. More... | |
int | fc_port_open (struct interface *transport, const struct fc_name *node_wwn, const struct fc_name *port_wwn, const char *name) |
Create Fibre Channel port. More... | |
struct fc_port * | fc_port_find (const char *name) |
Find Fibre Channel port by name. More... | |
static void | fc_peer_close (struct fc_peer *peer, int rc) |
Close Fibre Channel peer. More... | |
static void | fc_peer_increment (struct fc_peer *peer) |
Increment Fibre Channel peer active usage count. More... | |
static void | fc_peer_decrement (struct fc_peer *peer) |
Decrement Fibre Channel peer active usage count. More... | |
int | fc_peer_login (struct fc_peer *peer, struct fc_port *port, struct fc_port_id *port_id) |
Log in Fibre Channel peer. More... | |
void | fc_peer_logout (struct fc_peer *peer, int rc) |
Log out Fibre Channel peer. More... | |
static void | fc_peer_plogi_done (struct fc_peer *peer, int rc) |
Handle PLOGI completion. More... | |
static int | fc_peer_plogi (struct fc_peer *peer, struct fc_port *port, struct fc_port_id *peer_port_id) |
Initiate PLOGI. More... | |
static void | fc_peer_examine (struct fc_link_state *link) |
Examine Fibre Channel peer link state. More... | |
static struct fc_peer * | fc_peer_create (const struct fc_name *port_wwn) |
Create Fibre Channel peer. More... | |
struct fc_peer * | fc_peer_get_wwn (const struct fc_name *port_wwn) |
Get Fibre Channel peer by node name. More... | |
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. More... | |
static void | fc_ulp_free (struct refcnt *refcnt) |
Free Fibre Channel upper-layer protocol. More... | |
static void | fc_ulp_close (struct fc_ulp *ulp, int rc) |
Close Fibre Channel upper-layer protocol. More... | |
void | fc_ulp_attach (struct fc_ulp *ulp, struct fc_ulp_user *user) |
Attach Fibre Channel upper-layer protocol user. More... | |
void | fc_ulp_detach (struct fc_ulp_user *user) |
Detach Fibre Channel upper-layer protocol user. More... | |
int | fc_ulp_login (struct fc_ulp *ulp, const void *param, size_t param_len, int originated) |
Log in Fibre Channel upper-layer protocol. More... | |
void | fc_ulp_logout (struct fc_ulp *ulp, int rc) |
Log out Fibre Channel upper-layer protocol. More... | |
static void | fc_ulp_prli_done (struct fc_ulp *ulp, int rc) |
Handle PRLI completion. More... | |
static void | fc_ulp_examine (struct fc_link_state *link) |
Examine Fibre Channel upper-layer protocol link state. More... | |
static struct fc_ulp * | fc_ulp_create (struct fc_peer *peer, unsigned int type) |
Create Fibre Channel upper-layer protocl. More... | |
static struct fc_ulp * | fc_ulp_get_type (struct fc_peer *peer, unsigned int type) |
Get Fibre Channel upper-layer protocol by peer and type. More... | |
struct fc_ulp * | fc_ulp_get_wwn_type (const struct fc_name *port_wwn, unsigned int type) |
Get Fibre Channel upper-layer protocol by port name and type. More... | |
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. More... | |
REQUIRING_SYMBOL (fc_ports) | |
REQUIRE_OBJECT (config_fc) | |
Variables | |
struct fc_port_id | fc_empty_port_id = { .bytes = { 0x00, 0x00, 0x00 } } |
Unassigned port ID. More... | |
struct fc_port_id | fc_f_port_id = { .bytes = { 0xff, 0xff, 0xfe } } |
F_Port contoller port ID. More... | |
struct fc_port_id | fc_gs_port_id = { .bytes = { 0xff, 0xff, 0xfc } } |
Generic services port ID. More... | |
struct fc_port_id | fc_ptp_low_port_id = { .bytes = { 0x01, 0x01, 0x01 } } |
Point-to-point low port ID. More... | |
struct fc_port_id | fc_ptp_high_port_id = { .bytes = { 0x01, 0x01, 0x02 } } |
Point-to-point high port ID. More... | |
static const uint8_t | fc_r_ctl_info_meta_flags [FC_R_CTL_INFO_MASK+1] |
Mapping from Fibre Channel routing control information to xfer metadata. More... | |
static struct interface_operation | fc_xchg_ulp_op [] |
Fibre Channel exchange ULP interface operations. More... | |
static struct interface_descriptor | fc_xchg_ulp_desc |
Fibre Channel exchange ULP interface descriptor. More... | |
static struct interface_operation | fc_port_transport_op [] |
Fibre Channel port transport interface operations. More... | |
static struct interface_descriptor | fc_port_transport_desc |
Fibre Channel port transport interface descriptor. More... | |
static struct interface_operation | fc_port_flogi_op [] |
Fibre Channel port FLOGI interface operations. More... | |
static struct interface_descriptor | fc_port_flogi_desc |
Fibre Channel port FLOGI interface descriptor. More... | |
static struct interface_operation | fc_port_ns_plogi_op [] |
Fibre Channel port name server PLOGI interface operations. More... | |
static struct interface_descriptor | fc_port_ns_plogi_desc |
Fibre Channel port name server PLOGI interface descriptor. More... | |
static struct interface_operation | fc_peer_plogi_op [] |
Fibre Channel peer PLOGI interface operations. More... | |
static struct interface_descriptor | fc_peer_plogi_desc |
Fibre Channel peer PLOGI interface descriptor. More... | |
static struct interface_operation | fc_ulp_prli_op [] |
Fibre Channel upper-layer protocol PRLI interface operations. More... | |
static struct interface_descriptor | fc_ulp_prli_desc |
Fibre Channel upper-layer protocol PRLI interface descriptor. More... | |
Fibre Channel.
Definition in file fc.c.
#define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS ) |
#define EINFO_EUNKNOWN_LINK_STATUS __einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" ) |
#define FC_TIMEOUT ( 1 * TICKS_PER_SEC ) |
enum fc_exchange_flags |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
LIST_HEAD | ( | fc_ports | ) |
List of Fibre Channel ports.
LIST_HEAD | ( | fc_peers | ) |
List of Fibre Channel peers.
const char* fc_id_ntoa | ( | const struct fc_port_id * | id | ) |
Format Fibre Channel port ID.
id | Fibre Channel port ID |
id_text | Port ID text |
Definition at line 92 of file fc.c.
References FC_PORT_ID_STRLEN, id, and snprintf().
Referenced by fc_els_flogi_rx(), fc_els_logo_rx_request(), fc_els_plogi_rx(), fc_ns_query_deliver(), fc_peer_login(), fc_port_deliver(), fc_port_login(), fc_xchg_originate(), fc_xchg_respond(), fcels(), fcpeerstat(), and fcportstat().
int fc_id_aton | ( | const char * | id_text, |
struct fc_port_id * | id | ||
) |
Parse Fibre Channel port ID.
id_text | Port ID text |
id | Fibre Channel port ID |
rc | Return status code |
Definition at line 107 of file fc.c.
References EINVAL, id, and strtoul().
Referenced by parse_fc_port_id().
const char* fc_ntoa | ( | const struct fc_name * | wwn | ) |
Format Fibre Channel WWN.
wwn | Fibre Channel WWN |
wwn_text | WWN text |
Definition at line 127 of file fc.c.
References FC_NAME_STRLEN, snprintf(), and wwn.
Referenced by fc_els_flogi_rx(), fc_els_logo_rx_request(), fc_els_plogi_rx(), fc_ns_query(), fc_ns_query_deliver(), fc_peer_close(), fc_peer_create(), fc_peer_examine(), fc_peer_login(), fc_peer_logout(), fc_peer_plogi(), fc_port_login(), fc_port_open(), fc_ulp_close(), fc_ulp_create(), fc_ulp_examine(), fc_ulp_login(), fc_ulp_logout(), fcoe_probe(), fcpdev_open(), fcpeerstat(), and fcportstat().
int fc_aton | ( | const char * | wwn_text, |
struct fc_name * | wwn | ||
) |
Parse Fibre Channel WWN.
wwn_text | WWN text |
wwn | Fibre Channel WWN |
rc | Return status code |
Definition at line 144 of file fc.c.
References EINVAL, strtoul(), and wwn.
Referenced by fcp_parse_uri().
struct sockaddr* fc_fill_sockaddr | ( | struct sockaddr_fc * | sa_fc, |
struct fc_port_id * | id | ||
) |
Fill Fibre Channel socket address.
sa_fc | Fibre Channel socket address to fill in |
id | Fibre Channel port ID |
sa | Socket address |
Definition at line 165 of file fc.c.
References AF_FC, container_of, fc, memcpy(), memset(), sa, sockaddr_fc::sfc_family, sockaddr_fc::sfc_port_id, typeof(), and u.
Referenced by fc_els_tx(), and fc_xchg_rx().
|
static |
Mark Fibre Channel link as up.
link | Fibre Channel link state monitor |
Definition at line 195 of file fc.c.
References link, and stop_timer().
Referenced by fc_peer_login(), fc_port_login(), and fc_ulp_login().
|
static |
Mark Fibre Channel link as down.
link | Fibre Channel link state monitor |
rc | Link state |
Definition at line 210 of file fc.c.
References EUNKNOWN_LINK_STATUS, FC_LINK_RETRY_DELAY, link, rc, and start_timer_fixed().
Referenced by fc_peer_logout(), fc_port_logout(), and fc_ulp_logout().
|
static |
Examine Fibre Channel link state.
link | Fibre Channel link state monitor |
Definition at line 226 of file fc.c.
References link.
Referenced by fc_link_expired(), fc_peer_login(), fc_peer_logout(), fc_port_login(), and fc_port_logout().
|
static |
Handle Fibre Channel link retry timer expiry.
Definition at line 234 of file fc.c.
References container_of, fc_link_examine(), FC_LINK_RETRY_DELAY, link, and start_timer_fixed().
Referenced by fc_link_init().
|
static |
Initialise Fibre Channel link state monitor.
link | Fibre Channel link state monitor |
examine | Examine link state method |
refcnt | Reference counter |
Definition at line 252 of file fc.c.
References EUNKNOWN_LINK_STATUS, fc_link_state::examine, fc_link_expired(), and link.
Referenced by fc_peer_create(), fc_port_open(), and fc_ulp_create().
|
static |
Start monitoring Fibre Channel link state.
link | Fibre Channel link state monitor |
Definition at line 266 of file fc.c.
References link, and start_timer_nodelay().
Referenced by fc_peer_create(), fc_port_window_changed(), fc_ulp_create(), and fc_ulp_login().
|
static |
Stop monitoring Fibre Channel link state.
link | Fibre Channel link state monitor |
Definition at line 275 of file fc.c.
References link, and stop_timer().
Referenced by fc_peer_close(), fc_port_close(), fc_port_window_changed(), fc_ulp_close(), and fc_ulp_login().
|
static |
Create local Fibre Channel exchange identifier.
xchg_id | Local exchange ID |
Definition at line 335 of file fc.c.
Referenced by fc_xchg_create().
|
static |
Create local Fibre Channel sequence identifier.
seq_id | Local sequence identifier |
Definition at line 348 of file fc.c.
Referenced by fc_xchg_create(), and fc_xchg_rx().
|
static |
Free Fibre Channel exchange.
refcnt | Reference count |
Definition at line 359 of file fc.c.
References assert(), container_of, fc_port_put(), free, fc_exchange::list, list_empty, fc_exchange::port, and fc_exchange::timer.
Referenced by fc_xchg_create().
|
static |
Close Fibre Channel exchange.
xchg | Fibre Channel exchange |
rc | Reason for close |
Definition at line 376 of file fc.c.
References DBGC2, INIT_LIST_HEAD, intf_shutdown(), fc_exchange::list, list_del, list_empty, port, fc_exchange::port, rc, ref_put, fc_exchange::refcnt, stop_timer(), strerror(), fc_exchange::timer, fc_exchange::ulp, and fc_exchange::xchg_id.
Referenced by fc_port_close(), fc_xchg_expired(), and fc_xchg_rx().
|
static |
Handle exchange timeout.
timer | Timeout timer |
over | Failure indicator |
Definition at line 406 of file fc.c.
References container_of, DBGC, ETIMEDOUT, fc_xchg_close(), port, fc_exchange::port, and fc_exchange::xchg_id.
Referenced by fc_xchg_create().
|
static |
Check Fibre Channel exchange window.
xchg | Fibre Channel exchange |
len | Length opf window |
Definition at line 423 of file fc.c.
References FC_LOGIN_DEFAULT_MTU.
|
static |
Allocate Fibre Channel I/O buffer.
xchg | Fibre Channel exchange |
len | Payload length |
iobuf | I/O buffer, or NULL |
Definition at line 436 of file fc.c.
References iob_reserve, len, port, fc_exchange::port, and xfer_alloc_iob().
|
static |
Transmit data as part of a Fibre Channel exchange.
xchg | Fibre Channel exchange |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 457 of file fc.c.
References fc_frame_header::d_id, DBGC, dest, done, EBUSY, fc_frame_header::f_ctl_es, fc_frame_header::f_ctl_misc, FC_F_CTL_ES_END, FC_F_CTL_ES_FIRST, FC_F_CTL_ES_LAST, FC_F_CTL_ES_RESPONDER, FC_F_CTL_ES_TRANSFER, FC_F_CTL_MISC_REL_OFF, FC_R_CTL_CMD_STAT, FC_R_CTL_DATA, FC_R_CTL_ELS, FC_R_CTL_SOL_CTRL, FC_R_CTL_SOL_DATA, FC_R_CTL_UNSOL_CMD, FC_R_CTL_UNSOL_CTRL, FC_R_CTL_UNSOL_DATA, FC_TIMEOUT, FC_TYPE_CT, FC_TYPE_ELS, FC_XCHG_ORIGINATOR, FC_XCHG_SEQ_FIRST, FC_XCHG_SEQ_INITIATIVE, fc_exchange::flags, free_iob(), htonl, htons, iob_disown, iob_push, memcpy(), memset(), meta(), fc_frame_header::ox_id, fc_frame_header::parameter, fc_exchange::peer_port_id, fc_exchange::peer_xchg_id, port, fc_exchange::port, fc_frame_header::r_ctl, rc, fc_frame_header::rx_id, fc_frame_header::s_id, fc_frame_header::seq_cnt, fc_exchange::seq_cnt, fc_frame_header::seq_id, fc_exchange::seq_id, start_timer_fixed(), strerror(), fc_exchange::timer, fc_frame_header::type, fc_exchange::type, fc_exchange::xchg_id, xfer_deliver_iob(), XFER_FL_ABS_OFFSET, XFER_FL_CMD_STAT, XFER_FL_OUT, XFER_FL_OVER, and XFER_FL_RESPONSE.
|
static |
Receive data as part of a Fibre Channel exchange.
xchg | Fibre Channel exchange |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 587 of file fc.c.
References fc_frame_header::d_id, io_buffer::data, DBGC, xfer_metadata::dest, dest, done, EBUSY, EPIPE, fc_frame_header::f_ctl_es, fc_frame_header::f_ctl_misc, FC_F_CTL_ES_END, FC_F_CTL_ES_LAST, FC_F_CTL_ES_RESPONDER, FC_F_CTL_ES_TRANSFER, FC_F_CTL_MISC_REL_OFF, fc_fill_sockaddr(), fc_new_seq_id(), FC_R_CTL_INFO_MASK, fc_r_ctl_info_meta_flags, FC_TIMEOUT, fc_xchg_close(), FC_XCHG_SEQ_INITIATIVE, xfer_metadata::flags, fc_exchange::flags, free_iob(), iob_disown, iob_pull, memset(), ntohl, ntohs, xfer_metadata::offset, fc_frame_header::ox_id, fc_frame_header::parameter, fc_exchange::peer_xchg_id, port, fc_exchange::port, fc_frame_header::r_ctl, rc, fc_frame_header::rx_id, fc_frame_header::s_id, fc_frame_header::seq_cnt, fc_exchange::seq_cnt, fc_frame_header::seq_id, fc_exchange::seq_id, xfer_metadata::src, src, start_timer_fixed(), strerror(), fc_exchange::timer, fc_exchange::ulp, fc_exchange::xchg_id, xfer_deliver(), XFER_FL_ABS_OFFSET, XFER_FL_OUT, and XFER_FL_OVER.
Referenced by fc_port_deliver().
|
static |
Create new Fibre Channel exchange.
port | Fibre Channel port |
peer_port_id | Peer port ID |
xchg | Exchange, or NULL |
Definition at line 695 of file fc.c.
References fc_new_seq_id(), fc_new_xchg_id(), fc_port_get(), FC_RX_ID_UNKNOWN, fc_xchg_expired(), fc_xchg_free(), fc_xchg_ulp_desc, intf_init(), fc_exchange::list, list_add, memcpy(), NULL, fc_exchange::peer_port_id, fc_exchange::peer_xchg_id, port, fc_exchange::port, ref_init, fc_exchange::refcnt, fc_exchange::seq_id, fc_exchange::timer, type, fc_exchange::type, fc_exchange::ulp, fc_exchange::xchg_id, and zalloc().
Referenced by fc_xchg_originate(), and fc_xchg_respond().
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.
parent | Interface to which to attach |
port | Fibre Channel port |
peer_port_id | Peer port ID |
xchg_id | Exchange ID, or negative error |
Definition at line 728 of file fc.c.
References DBGC2, ENOMEM, fc_id_ntoa(), fc_xchg_create(), FC_XCHG_ORIGINATOR, FC_XCHG_SEQ_FIRST, FC_XCHG_SEQ_INITIATIVE, fc_exchange::flags, intf_plug_plug(), fc_exchange::peer_port_id, port, type, fc_exchange::type, fc_exchange::ulp, and fc_exchange::xchg_id.
Referenced by fc_els_step(), fc_ns_query_step(), and fcpdev_scsi_command().
|
static |
Open a new responder Fibre Channel exchange.
port | Fibre Channel port |
fchdr | Fibre Channel frame header |
xchg | Fibre Channel exchange, or NULL |
Definition at line 755 of file fc.c.
References fc_frame_header::d_id, DBGC, DBGC2, fc_id_ntoa(), FC_RESPONDERS, fc_xchg_create(), for_each_table_entry, ntohs, NULL, fc_frame_header::ox_id, fc_exchange::peer_port_id, port, rc, fc_responder::respond, fc_frame_header::s_id, fc_frame_header::seq_id, fc_exchange::seq_id, strerror(), type, fc_frame_header::type, fc_responder::type, fc_exchange::type, fc_exchange::ulp, and fc_exchange::xchg_id.
Referenced by fc_port_deliver().
|
static |
Close Fibre Channel port.
port | Fibre Channel port |
rc | Reason for close |
Definition at line 806 of file fc.c.
References DBGC, fc_link_ok(), fc_link_stop(), fc_port_logout(), fc_xchg_close(), INIT_LIST_HEAD, intf_shutdown(), fc_exchange::list, list_del, list_for_each_entry_safe, port, rc, and tmp.
|
static |
Identify Fibre Channel exchange by local exchange ID.
port | Fibre Channel port |
xchg_id | Local exchange ID |
xchg | Fibre Channel exchange, or NULL |
Definition at line 840 of file fc.c.
References fc_exchange::list, list_for_each_entry, NULL, port, and fc_exchange::xchg_id.
Referenced by fc_port_deliver().
|
static |
Handle received frame from Fibre Channel port.
port | Fibre Channel port |
iobuf | I/O buffer |
meta | Data transfer metadata |
rc | Return status code |
Definition at line 859 of file fc.c.
References fc_frame_header::d_id, io_buffer::data, DBGC, EINVAL, ENOMEM, ENOTCONN, fc_frame_header::f_ctl_es, fc_empty_port_id, FC_F_CTL_ES_FIRST, FC_F_CTL_ES_RESPONDER, fc_f_port_id, fc_id_ntoa(), fc_port_demux(), fc_xchg_respond(), fc_xchg_rx(), free_iob(), iob_disown, iob_len(), memcmp(), meta(), ntohs, fc_frame_header::ox_id, port, rc, ref_get, ref_put, fc_exchange::refcnt, fc_frame_header::rx_id, fc_frame_header::seq_cnt, and fc_exchange::xchg_id.
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.
port | Fibre Channel port |
port_id | Local port ID |
link_node_wwn | Link node name |
link_port_wwn | Link port name |
has_fabric | Link is to a fabric |
rc | Return status code |
Definition at line 941 of file fc.c.
References DBGC, ECANCELED, fc_els_plogi(), fc_gs_port_id, fc_id_ntoa(), fc_link_examine(), fc_link_ok(), fc_link_up(), fc_ntoa(), fc_peer_get(), fc_peer_put(), fc_peers, FC_PORT_HAS_FABRIC, FC_PORT_HAS_NS, fc_port_logout(), fc_ptp_high_port_id, fc_ptp_low_port_id, intf_restart(), fc_peer::list, list_for_each_entry_safe, memcmp(), memcpy(), peer, port, fc_peer::port_id, rc, strerror(), and tmp.
Referenced by fc_els_flogi_rx().
void fc_port_logout | ( | struct fc_port * | port, |
int | rc | ||
) |
Log out Fibre Channel port.
port | Fibre Channel port |
rc | Reason for logout |
Definition at line 1039 of file fc.c.
References DBGC, fc_link_err(), fc_link_examine(), fc_peer_get(), fc_peer_put(), fc_peers, fc_peer::list, list_for_each_entry_safe, memset(), peer, port, rc, strerror(), and tmp.
Referenced by fc_els_logo_logout(), fc_port_close(), fc_port_examine(), fc_port_flogi_done(), fc_port_login(), and fc_port_window_changed().
|
static |
Handle FLOGI completion.
port | Fibre Channel port |
rc | Reason for completion |
Definition at line 1067 of file fc.c.
References fc_port_logout(), intf_restart(), port, and rc.
|
static |
Handle name server PLOGI completion.
port | Fibre Channel port |
rc | Reason for completion |
Definition at line 1081 of file fc.c.
References DBGC, FC_PORT_HAS_NS, intf_restart(), port, rc, and strerror().
|
static |
Examine Fibre Channel port link state.
@ link Fibre Channel link state monitor
Definition at line 1101 of file fc.c.
References container_of, DBGC, ECANCELED, fc_els_flogi(), fc_link_ok(), fc_port_logout(), intf_restart(), link, port, rc, and strerror().
Referenced by fc_port_open().
|
static |
Handle change of flow control window.
port | Fibre Channel port |
Definition at line 1126 of file fc.c.
References ENOTCONN, fc_link_ok(), fc_link_start(), fc_link_stop(), fc_port_logout(), port, and xfer_window().
int fc_port_open | ( | struct interface * | transport, |
const struct fc_name * | node_wwn, | ||
const struct fc_name * | port_wwn, | ||
const char * | name | ||
) |
Create Fibre Channel port.
transport | Transport interface |
node | Fibre Channel node name |
port | Fibre Channel port name |
name | Symbolic port name |
rc | Return status code |
Definition at line 1189 of file fc.c.
References DBGC, ENOMEM, fc_link_init(), fc_ntoa(), fc_port_examine(), fc_port_flogi_desc, fc_port_ns_plogi_desc, fc_port_transport_desc, fc_ports, INIT_LIST_HEAD, intf_init(), intf_plug_plug(), list_add_tail, memcpy(), name, fc_port::node_wwn, NULL, port, fc_port::port_wwn, ref_init, ref_put, snprintf(), fc_port::transport, and zalloc().
Referenced by fcoe_expired().
struct fc_port* fc_port_find | ( | const char * | name | ) |
Find Fibre Channel port by name.
name | Fibre Channel port name |
port | Fibre Channel port, or NULL |
Definition at line 1224 of file fc.c.
References fc_ports, fc_port::list, list_for_each_entry, name, NULL, port, and strcmp().
Referenced by parse_fc_port().
|
static |
Close Fibre Channel peer.
peer | Fibre Channel peer |
rc | Reason for close |
Definition at line 1247 of file fc.c.
References assert(), DBGC, fc_link_stop(), fc_ntoa(), INIT_LIST_HEAD, intf_shutdown(), list_del, list_empty, peer, rc, and strerror().
Referenced by fc_peer_logout().
|
static |
Increment Fibre Channel peer active usage count.
peer | Fibre Channel peer |
Definition at line 1271 of file fc.c.
References peer.
Referenced by fc_ulp_attach().
|
static |
Decrement Fibre Channel peer active usage count.
peer | Fibre Channel peer |
Definition at line 1282 of file fc.c.
References assert(), fc_peer_logout(), and peer.
Referenced by fc_ulp_detach().
int fc_peer_login | ( | struct fc_peer * | peer, |
struct fc_port * | port, | ||
struct fc_port_id * | port_id | ||
) |
Log in Fibre Channel peer.
peer | Fibre Channel peer |
port | Fibre Channel port |
port_id | Port ID |
rc | Return status code |
Definition at line 1300 of file fc.c.
References assert(), DBGC, fc_id_ntoa(), fc_link_examine(), fc_link_ok(), fc_link_up(), fc_ntoa(), fc_peer_get(), fc_peer_logout(), fc_port_get(), fc_ulp_get(), fc_ulp_put(), fc_ulp::link, fc_ulp::list, list_for_each_entry_safe, memcmp(), memcpy(), NULL, peer, port, and tmp.
Referenced by fc_els_plogi_rx().
void fc_peer_logout | ( | struct fc_peer * | peer, |
int | rc | ||
) |
Log out Fibre Channel peer.
peer | Fibre Channel peer |
rc | Reason for logout |
Definition at line 1347 of file fc.c.
References DBGC, fc_link_err(), fc_link_examine(), fc_link_ok(), fc_ntoa(), fc_peer_close(), fc_peer_put(), fc_port_put(), fc_ulp_get(), fc_ulp_put(), fc_ulp::link, fc_ulp::list, list_for_each_entry_safe, NULL, peer, rc, strerror(), and tmp.
Referenced by fc_els_logo_logout(), fc_peer_decrement(), fc_peer_examine(), fc_peer_login(), fc_peer_plogi(), and fc_peer_plogi_done().
|
static |
Handle PLOGI completion.
peer | Fibre Channel peer |
rc | Reason for completion |
Definition at line 1383 of file fc.c.
References fc_peer_logout(), intf_restart(), peer, and rc.
|
static |
Initiate PLOGI.
peer | Fibre Channel peer |
port | Fibre Channel port |
peer_port_id | Peer port ID |
rc | Return status code |
Definition at line 1399 of file fc.c.
References DBGC, ECANCELED, fc_els_plogi(), fc_ntoa(), fc_peer_logout(), intf_restart(), peer, port, rc, and strerror().
Referenced by fc_peer_examine().
|
static |
Examine Fibre Channel peer link state.
@ link Fibre Channel link state monitor
Definition at line 1420 of file fc.c.
References assert(), container_of, DBGC, ENOTCONN, fc_link_ok(), fc_ntoa(), fc_peer_logout(), fc_peer_plogi(), FC_PORT_HAS_FABRIC, FC_PORT_HAS_NS, fc_ports, link, fc_port::list, list_for_each_entry, memcmp(), NULL, peer, port, rc, and strerror().
Referenced by fc_peer_create().
Create Fibre Channel peer.
port_wwn | Node name |
peer | Fibre Channel peer, or NULL |
Definition at line 1489 of file fc.c.
References DBGC, fc_link_init(), fc_link_start(), fc_ntoa(), fc_peer_examine(), fc_peer_plogi_desc, fc_peers, INIT_LIST_HEAD, intf_init(), list_add_tail, memcpy(), NULL, peer, fc_peer::port_wwn, ref_init, and zalloc().
Referenced by fc_peer_get_wwn().
Get Fibre Channel peer by node name.
port_wwn | Node name |
peer | Fibre Channel peer, or NULL |
Definition at line 1516 of file fc.c.
References fc_peer_create(), fc_peer_get(), fc_peers, fc_peer::list, list_for_each_entry, memcmp(), NULL, peer, and fc_peer::port_wwn.
Referenced by fc_els_plogi_rx(), and fc_ulp_get_wwn_type().
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.
port | Fibre Channel port |
peer_port_id | Peer port ID |
peer | Fibre Channel peer, or NULL |
Definition at line 1541 of file fc.c.
References fc_peer_get(), fc_peers, fc_peer::list, list_for_each_entry, memcmp(), NULL, peer, and port.
Referenced by fc_els_logo_logout(), and fc_ulp_get_port_id_type().
|
static |
Free Fibre Channel upper-layer protocol.
refcnt | Reference count |
Definition at line 1569 of file fc.c.
References container_of, fc_peer_put(), free, and fc_ulp::peer.
Referenced by fc_ulp_create().
|
static |
Close Fibre Channel upper-layer protocol.
ulp | Fibre Channel upper-layer protocol |
rc | Reason for close |
Definition at line 1582 of file fc.c.
References assert(), DBGC, fc_link_stop(), fc_ntoa(), INIT_LIST_HEAD, intf_shutdown(), fc_ulp::link, fc_ulp::list, list_del, list_empty, fc_ulp::peer, fc_peer::port_wwn, fc_ulp::prli, rc, strerror(), fc_ulp::type, and fc_ulp::users.
Referenced by fc_ulp_logout().
void fc_ulp_attach | ( | struct fc_ulp * | ulp, |
struct fc_ulp_user * | user | ||
) |
Attach Fibre Channel upper-layer protocol user.
ulp | Fibre Channel upper-layer protocol |
user | Fibre Channel upper-layer protocol user |
Definition at line 1607 of file fc.c.
References assert(), fc_peer_increment(), fc_ulp_get(), fc_ulp_user::list, list_add, NULL, fc_ulp::peer, fc_ulp_user::ulp, and fc_ulp::users.
Referenced by fcpdev_open().
void fc_ulp_detach | ( | struct fc_ulp_user * | user | ) |
Detach Fibre Channel upper-layer protocol user.
user | Fibre Channel upper-layer protocol user |
Definition at line 1625 of file fc.c.
References fc_peer_decrement(), fc_ulp_logout(), fc_ulp_put(), fc_ulp::list, fc_ulp_user::list, list_check_contains_entry, list_del, list_empty, NULL, fc_ulp::peer, fc_ulp_user::ulp, and fc_ulp::users.
Referenced by fcpdev_close().
Log in Fibre Channel upper-layer protocol.
ulp | Fibre Channel upper-layer protocol |
param | Service parameters |
param_len | Length of service parameters |
originated | Login was originated by us |
rc | Return status code |
Definition at line 1657 of file fc.c.
References assert(), DBGC, DBGC_HDA, ENOMEM, fc_ulp_user::examine, fc_link_ok(), fc_link_start(), fc_link_stop(), fc_link_up(), fc_ntoa(), fc_ulp_get(), fc_ulp_logout(), FC_ULP_ORIGINATED_LOGIN_OK, fc_ulp_user_get(), fc_ulp_user_put(), fc_ulp::flags, fc_ulp::link, fc_ulp_user::list, list_for_each_entry_safe, malloc(), memcmp(), memcpy(), NULL, param, fc_ulp::param, fc_ulp::param_len, fc_ulp::peer, fc_peer::port_wwn, tmp, fc_ulp::type, fc_ulp_user::ulp, and fc_ulp::users.
Referenced by fc_els_prli_rx().
void fc_ulp_logout | ( | struct fc_ulp * | ulp, |
int | rc | ||
) |
Log out Fibre Channel upper-layer protocol.
ulp | Fibre Channel upper-layer protocol |
rc | Reason for logout |
Definition at line 1727 of file fc.c.
References DBGC, fc_ulp_user::examine, fc_link_err(), fc_link_ok(), fc_ntoa(), fc_ulp_close(), fc_ulp_put(), fc_ulp_user_get(), fc_ulp_user_put(), fc_ulp::flags, free, fc_ulp::link, fc_ulp_user::list, list_empty, list_for_each_entry_safe, NULL, fc_ulp::param, fc_ulp::param_len, fc_ulp::peer, fc_peer::port_wwn, rc, strerror(), tmp, fc_ulp::type, fc_ulp_user::ulp, and fc_ulp::users.
Referenced by fc_els_prli_rx(), fc_ulp_detach(), fc_ulp_examine(), fc_ulp_login(), and fc_ulp_prli_done().
|
static |
Handle PRLI completion.
ulp | Fibre Channel upper-layer protocol |
rc | Reason for completion |
Definition at line 1765 of file fc.c.
References fc_ulp_logout(), intf_restart(), fc_ulp::prli, rc, and fc_ulp_user::ulp.
|
static |
Examine Fibre Channel upper-layer protocol link state.
@ link Fibre Channel link state monitor
Definition at line 1778 of file fc.c.
References container_of, DBGC, ECANCELED, ENOTCONN, fc_els_prli(), fc_link_ok(), fc_ntoa(), fc_ulp_logout(), FC_ULP_ORIGINATED_LOGIN_OK, fc_ulp::flags, intf_restart(), link, fc_peer::link, fc_ulp::link, fc_ulp::peer, fc_peer::port, fc_peer::port_id, fc_peer::port_wwn, fc_ulp::prli, rc, strerror(), and fc_ulp::type.
Referenced by fc_ulp_create().
Create Fibre Channel upper-layer protocl.
peer | Fibre Channel peer |
type | Type |
ulp | Fibre Channel upper-layer protocol, or NULL |
Definition at line 1824 of file fc.c.
References DBGC, fc_link_init(), fc_link_start(), fc_ntoa(), fc_peer_get(), fc_ulp_examine(), fc_ulp_free(), fc_ulp_prli_desc, INIT_LIST_HEAD, intf_init(), fc_ulp::link, fc_ulp::list, list_add_tail, NULL, peer, fc_ulp::peer, fc_peer::port_wwn, fc_ulp::prli, ref_init, fc_ulp::refcnt, type, fc_ulp::type, fc_ulp::users, and zalloc().
Referenced by fc_ulp_get_type().
Get Fibre Channel upper-layer protocol by peer and type.
peer | Fibre Channel peer |
type | Type |
ulp | Fibre Channel upper-layer protocol, or NULL |
Definition at line 1855 of file fc.c.
References fc_ulp_create(), fc_ulp_get(), fc_ulp::list, list_for_each_entry, NULL, peer, type, and fc_ulp::type.
Referenced by fc_ulp_get_port_id_type(), and fc_ulp_get_wwn_type().
Get Fibre Channel upper-layer protocol by port name and type.
port_wwn | Port name |
type | Type |
ulp | Fibre Channel upper-layer protocol, or NULL |
Definition at line 1880 of file fc.c.
References fc_peer_get_wwn(), fc_peer_put(), fc_ulp_get_type(), fc_ulp_put(), NULL, peer, fc_peer::port_wwn, and type.
Referenced by fcpdev_open().
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.
port | Fibre Channel port |
peer_port_id | Peer port ID |
type | Type |
ulp | Fibre Channel upper-layer protocol, or NULL |
Definition at line 1915 of file fc.c.
References fc_peer_get_port_id(), fc_peer_put(), fc_ulp_get_type(), fc_ulp_put(), NULL, peer, port, and type.
Referenced by fc_els_prli_rx(), and fc_els_prli_tx().
REQUIRING_SYMBOL | ( | fc_ports | ) |
REQUIRE_OBJECT | ( | config_fc | ) |
struct fc_port_id fc_empty_port_id = { .bytes = { 0x00, 0x00, 0x00 } } |
Unassigned port ID.
Definition at line 65 of file fc.c.
Referenced by fc_port_deliver(), and fcels_exec().
struct fc_port_id fc_f_port_id = { .bytes = { 0xff, 0xff, 0xfe } } |
F_Port contoller port ID.
Definition at line 68 of file fc.c.
Referenced by fc_els_flogi(), fc_els_logo_logout(), fc_port_deliver(), and fcels_exec().
struct fc_port_id fc_gs_port_id = { .bytes = { 0xff, 0xff, 0xfc } } |
Generic services port ID.
Definition at line 71 of file fc.c.
Referenced by fc_ns_query_step(), and fc_port_login().
struct fc_port_id fc_ptp_low_port_id = { .bytes = { 0x01, 0x01, 0x01 } } |
struct fc_port_id fc_ptp_high_port_id = { .bytes = { 0x01, 0x01, 0x02 } } |
|
static |
Mapping from Fibre Channel routing control information to xfer metadata.
Definition at line 568 of file fc.c.
Referenced by fc_xchg_rx().
|
static |
Fibre Channel exchange ULP interface operations.
|
static |
Fibre Channel exchange ULP interface descriptor.
Definition at line 685 of file fc.c.
Referenced by fc_xchg_create().
|
static |
Fibre Channel port transport interface operations.
|
static |
Fibre Channel port transport interface descriptor.
Definition at line 1159 of file fc.c.
Referenced by fc_port_open().
|
static |
Fibre Channel port FLOGI interface operations.
|
static |
Fibre Channel port FLOGI interface descriptor.
Definition at line 1168 of file fc.c.
Referenced by fc_port_open().
|
static |
Fibre Channel port name server PLOGI interface operations.
|
static |
Fibre Channel port name server PLOGI interface descriptor.
Definition at line 1177 of file fc.c.
Referenced by fc_port_open().
|
static |
Fibre Channel peer PLOGI interface operations.
|
static |
Fibre Channel peer PLOGI interface descriptor.
Definition at line 1480 of file fc.c.
Referenced by fc_peer_create().
|
static |
Fibre Channel upper-layer protocol PRLI interface operations.
|
static |
Fibre Channel upper-layer protocol PRLI interface descriptor.
Definition at line 1814 of file fc.c.
Referenced by fc_ulp_create().