summaryrefslogtreecommitdiffstats
path: root/src/net/fcels.c
diff options
context:
space:
mode:
authorMichael Brown2010-09-21 01:55:14 +0200
committerMichael Brown2010-09-21 03:06:06 +0200
commit654da534ada4624d20bd1e2835f86ee9c95ca165 (patch)
treed0c9868837954947d3ff034d7d1a2870f3555536 /src/net/fcels.c
parent[lotest] Add loopback testing commands (diff)
downloadipxe-654da534ada4624d20bd1e2835f86ee9c95ca165.tar.gz
ipxe-654da534ada4624d20bd1e2835f86ee9c95ca165.tar.xz
ipxe-654da534ada4624d20bd1e2835f86ee9c95ca165.zip
[fc] Allow FLOGI response to be sent to newly-assigned peer port ID
The response to a received FLOGI should probably be sent to the peer port ID assigned as a result of the WWPN comparison. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/fcels.c')
-rw-r--r--src/net/fcels.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/net/fcels.c b/src/net/fcels.c
index 63063ca3..fe2f5c22 100644
--- a/src/net/fcels.c
+++ b/src/net/fcels.c
@@ -119,15 +119,26 @@ static struct fc_els_handler * fc_els_detect ( struct fc_els *els,
* @ret rc Return status code
*/
int fc_els_tx ( struct fc_els *els, const void *data, size_t len ) {
- struct xfer_metadata meta = {
- .flags = ( fc_els_is_request ( els ) ?
- XFER_FL_OVER : ( XFER_FL_RESPONSE | XFER_FL_OUT ) ),
- };
+ union {
+ struct sockaddr sa;
+ struct sockaddr_fc fc;
+ } dest;
+ struct xfer_metadata meta;
int rc;
DBGC2 ( els, FCELS_FMT " transmitting:\n", FCELS_ARGS ( els ) );
DBGC2_HDA ( els, 0, data, len );
+ /* Construct metadata */
+ memset ( &dest, 0, sizeof ( dest ) );
+ dest.fc.sfc_family = AF_FC;
+ memcpy ( &dest.fc.sfc_port_id, &els->peer_port_id,
+ sizeof ( dest.fc.sfc_port_id ) );
+ memset ( &meta, 0, sizeof ( meta ) );
+ meta.flags = ( fc_els_is_request ( els ) ?
+ XFER_FL_OVER : ( XFER_FL_RESPONSE | XFER_FL_OUT ) );
+ meta.dest = &dest.sa;
+
/* Transmit frame */
if ( ( rc = xfer_deliver_raw_meta ( &els->xchg, data, len,
&meta ) ) != 0 ) {
@@ -524,6 +535,14 @@ static int fc_els_flogi_rx ( struct fc_els *els, const void *data,
return rc;
}
+ /* Send any responses to the newly-assigned peer port ID, if
+ * applicable.
+ */
+ if ( ! has_fabric ) {
+ memcpy ( &els->peer_port_id, &els->port->ptp_link_port_id,
+ sizeof ( els->peer_port_id ) );
+ }
+
return 0;
}