iPXE
Functions
fcmgmt.c File Reference

Fibre Channel management. More...

#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <ipxe/fc.h>
#include <ipxe/fcels.h>
#include <ipxe/monojob.h>
#include <usr/fcmgmt.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
void fcportstat (struct fc_port *port)
 Print status of Fibre Channel port. More...
 
void fcpeerstat (struct fc_peer *peer)
 Print status of Fibre Channel peer. More...
 
int fcels (struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
 Issue Fibre Channel ELS. More...
 

Detailed Description

Fibre Channel management.

Definition in file fcmgmt.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ fcportstat()

void fcportstat ( struct fc_port port)

Print status of Fibre Channel port.

Parameters
portFibre Channel port

Definition at line 45 of file fcmgmt.c.

45  {
46  printf ( "%s: %s id %s", port->name, fc_ntoa ( &port->port_wwn ),
47  fc_id_ntoa ( &port->port_id ) );
48  printf ( " node %s\n [Link:", fc_ntoa ( &port->node_wwn ) );
49  if ( fc_link_ok ( &port->link ) ) {
50  printf ( " up, %s", fc_ntoa ( &port->link_port_wwn ) );
51  if ( ( port->flags & FC_PORT_HAS_FABRIC ) ) {
52  printf ( " fabric" );
53  } else {
54  printf ( " id %s",
55  fc_id_ntoa ( &port->ptp_link_port_id ) );
56  }
57  printf ( " node %s]\n", fc_ntoa ( &port->link_node_wwn ) );
58  } else {
59  printf ( " down: %s]\n", strerror ( port->link.rc ) );
60  }
61 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
u8 port
Port number.
Definition: CIB_PRM.h:31
Port is attached to a fabric.
Definition: fc.h:292
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

References fc_id_ntoa(), fc_link_ok(), fc_ntoa(), FC_PORT_HAS_FABRIC, port, printf(), and strerror().

Referenced by fcstat_exec().

◆ fcpeerstat()

void fcpeerstat ( struct fc_peer peer)

Print status of Fibre Channel peer.

Parameters
peerFibre Channel peer

Definition at line 68 of file fcmgmt.c.

68  {
69  struct fc_ulp *ulp;
70  uint8_t *param;
71  unsigned int i;
72 
73  printf ( "%s:\n [Link:", fc_ntoa ( &peer->port_wwn ) );
74  if ( fc_link_ok ( &peer->link ) ) {
75  printf ( " up, port %s id %s]\n", peer->port->name,
76  fc_id_ntoa ( &peer->port_id ) );
77  } else {
78  printf ( " down: %s]\n", strerror ( peer->link.rc ) );
79  }
80 
81  list_for_each_entry ( ulp, &peer->ulps, list ) {
82  printf ( " [Type %02x link:", ulp->type );
83  if ( fc_link_ok ( &ulp->link ) ) {
84  printf ( " up, params" );
85  param = ulp->param;
86  for ( i = 0 ; i < ulp->param_len ; i++ ) {
87  printf ( "%c%02x", ( ( i == 0 ) ? ' ' : ':' ),
88  param[i] );
89  }
90  } else {
91  printf ( " down: %s", strerror ( ulp->link.rc ) );
92  }
93  printf ( "]\n" );
94  }
95 }
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
const char * fc_id_ntoa(const struct fc_port_id *id)
Format Fibre Channel port ID.
Definition: fc.c:92
struct list_head list
List of upper-layer protocols.
Definition: fc.h:419
const char * fc_ntoa(const struct fc_name *wwn)
Format Fibre Channel WWN.
Definition: fc.c:127
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:431
size_t param_len
Service parameter length.
Definition: fc.h:433
static int fc_link_ok(struct fc_link_state *link)
Check Fibre Channel link state.
Definition: fc.h:108
unsigned int type
Type.
Definition: fc.h:422
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
void * param
Service parameters, if any.
Definition: fc.h:431
struct hv_monitor_parameter param[4][32]
Parameters.
Definition: hyperv.h:24
struct fc_link_state link
Link state monitor.
Definition: fc.h:427
unsigned char uint8_t
Definition: stdint.h:10
struct mschapv2_challenge peer
Peer challenge.
Definition: mschapv2.h:12
A Fibre Channel upper-layer protocol.
Definition: fc.h:413

References fc_id_ntoa(), fc_link_ok(), fc_ntoa(), fc_ulp::link, fc_ulp::list, list_for_each_entry, param, fc_ulp::param, fc_ulp::param_len, peer, printf(), fc_link_state::rc, strerror(), and fc_ulp::type.

Referenced by fcstat_exec().

◆ fcels()

int fcels ( struct fc_port port,
struct fc_port_id peer_port_id,
struct fc_els_handler handler 
)

Issue Fibre Channel ELS.

Parameters
portFibre Channel port
peer_port_idPeer port ID
handlerELS handler
Return values
rcReturn status code

Definition at line 105 of file fcmgmt.c.

106  {
107  int rc;
108 
109  /* Initiate ELS */
110  printf ( "%s %s to %s...",
111  port->name, handler->name, fc_id_ntoa ( peer_port_id ) );
112  if ( ( rc = fc_els_request ( &monojob, port, peer_port_id,
113  handler ) ) != 0 ) {
114  printf ( "%s\n", strerror ( rc ) );
115  return rc;
116  }
117 
118  /* Wait for ELS to complete */
119  return monojob_wait ( "", 0 );
120 }
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 arbelprm_rc_send_wqe rc
Definition: arbel.h:14
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
int monojob_wait(const char *string, unsigned long timeout)
Wait for single foreground job to complete.
Definition: monojob.c:81
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
const char * name
Name.
Definition: fcels.h:354
struct interface monojob
Definition: monojob.c:56
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78

References fc_els_request(), fc_id_ntoa(), monojob, monojob_wait(), fc_els_handler::name, port, printf(), rc, and strerror().

Referenced by fcels_exec().