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.
void fcpeerstat (struct fc_peer *peer)
 Print status of Fibre Channel peer.
int fcels (struct fc_port *port, struct fc_port_id *peer_port_id, struct fc_els_handler *handler)
 Issue Fibre Channel ELS.

Detailed Description

Fibre Channel management.

Definition in file fcmgmt.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
void fcportstat ( struct fc_port port)

Print status of Fibre Channel port.

Parameters:
portFibre Channel port

Definition at line 45 of file fcmgmt.c.

References fc_id_ntoa(), fc_link_ok(), fc_ntoa(), FC_PORT_HAS_FABRIC, fc_port::flags, fc_port::link, fc_port::link_node_wwn, fc_port::link_port_wwn, fc_port::name, fc_port::node_wwn, fc_port::port_id, fc_port::port_wwn, printf(), fc_port::ptp_link_port_id, fc_link_state::rc, and strerror().

Referenced by fcstat_exec().

                                         {
        printf ( "%s: %s id %s", port->name, fc_ntoa ( &port->port_wwn ),
                 fc_id_ntoa ( &port->port_id ) );
        printf ( " node %s\n  [Link:", fc_ntoa ( &port->node_wwn ) );
        if ( fc_link_ok ( &port->link ) ) {
                printf ( " up, %s", fc_ntoa ( &port->link_port_wwn ) );
                if ( ( port->flags & FC_PORT_HAS_FABRIC ) ) {
                        printf ( " fabric" );
                } else {
                        printf ( " id %s",
                                 fc_id_ntoa ( &port->ptp_link_port_id ) );
                }
                printf ( " node %s]\n", fc_ntoa ( &port->link_node_wwn ) );
        } else {
                printf ( " down: %s]\n", strerror ( port->link.rc ) );
        }
}
void fcpeerstat ( struct fc_peer peer)

Print status of Fibre Channel peer.

Parameters:
peerFibre Channel peer

Definition at line 68 of file fcmgmt.c.

References fc_id_ntoa(), fc_link_ok(), fc_ntoa(), fc_peer::link, fc_ulp::link, fc_ulp::list, list_for_each_entry, fc_port::name, param, fc_ulp::param, fc_ulp::param_len, fc_peer::port, fc_peer::port_id, fc_peer::port_wwn, printf(), fc_link_state::rc, strerror(), fc_ulp::type, and fc_peer::ulps.

Referenced by fcstat_exec().

                                         {
        struct fc_ulp *ulp;
        uint8_t *param;
        unsigned int i;

        printf ( "%s:\n  [Link:", fc_ntoa ( &peer->port_wwn ) );
        if ( fc_link_ok ( &peer->link ) ) {
                printf ( " up, port %s id %s]\n", peer->port->name,
                         fc_id_ntoa ( &peer->port_id ) );
        } else {
                printf ( " down: %s]\n", strerror ( peer->link.rc ) );
        }

        list_for_each_entry ( ulp, &peer->ulps, list ) {
                printf ( "  [Type %02x link:", ulp->type );
                if ( fc_link_ok ( &ulp->link ) ) {
                        printf ( " up, params" );
                        param = ulp->param;
                        for ( i = 0 ; i < ulp->param_len ; i++ ) {
                                printf ( "%c%02x", ( ( i == 0 ) ? ' ' : ':' ),
                                         param[i] );
                        }
                } else {
                        printf ( " down: %s", strerror ( ulp->link.rc ) );
                }
                printf ( "]\n" );
        }
}
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.

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

Referenced by fcels_exec().

                                             {
        int rc;

        /* Initiate ELS */
        printf ( "%s %s to %s...",
                 port->name, handler->name, fc_id_ntoa ( peer_port_id ) );
        if ( ( rc = fc_els_request ( &monojob, port, peer_port_id,
                                     handler ) ) != 0 ) {
                printf ( "%s\n", strerror ( rc ) );
                return rc;
        }

        /* Wait for ELS to complete */
        return monojob_wait ( "", 0 );
}