|
@@ -146,6 +146,26 @@ int fc_aton ( const char *wwn_text, struct fc_name *wwn ) {
|
146
|
146
|
}
|
147
|
147
|
}
|
148
|
148
|
|
|
149
|
+/**
|
|
150
|
+ * Fill Fibre Channel socket address
|
|
151
|
+ *
|
|
152
|
+ * @v sa_fc Fibre Channel socket address to fill in
|
|
153
|
+ * @v id Fibre Channel port ID
|
|
154
|
+ * @ret sa Socket address
|
|
155
|
+ */
|
|
156
|
+struct sockaddr * fc_fill_sockaddr ( struct sockaddr_fc *sa_fc,
|
|
157
|
+ struct fc_port_id *id ) {
|
|
158
|
+ union {
|
|
159
|
+ struct sockaddr sa;
|
|
160
|
+ struct sockaddr_fc fc;
|
|
161
|
+ } *u = container_of ( sa_fc, typeof ( *u ), fc );
|
|
162
|
+
|
|
163
|
+ memset ( sa_fc, 0, sizeof ( *sa_fc ) );
|
|
164
|
+ sa_fc->sfc_family = AF_FC;
|
|
165
|
+ memcpy ( &sa_fc->sfc_port_id, id, sizeof ( sa_fc->sfc_port_id ) );
|
|
166
|
+ return &u->sa;
|
|
167
|
+}
|
|
168
|
+
|
149
|
169
|
/******************************************************************************
|
150
|
170
|
*
|
151
|
171
|
* Fibre Channel link state
|
|
@@ -549,6 +569,8 @@ static int fc_xchg_rx ( struct fc_exchange *xchg, struct io_buffer *iobuf,
|
549
|
569
|
struct fc_port *port = xchg->port;
|
550
|
570
|
struct fc_frame_header *fchdr = iobuf->data;
|
551
|
571
|
struct xfer_metadata fc_meta;
|
|
572
|
+ struct sockaddr_fc src;
|
|
573
|
+ struct sockaddr_fc dest;
|
552
|
574
|
int rc;
|
553
|
575
|
|
554
|
576
|
/* Record peer exchange ID */
|
|
@@ -605,6 +627,8 @@ static int fc_xchg_rx ( struct fc_exchange *xchg, struct io_buffer *iobuf,
|
605
|
627
|
fc_meta.flags |= XFER_FL_ABS_OFFSET;
|
606
|
628
|
fc_meta.offset = ntohl ( fchdr->parameter );
|
607
|
629
|
}
|
|
630
|
+ fc_meta.src = fc_fill_sockaddr ( &src, &fchdr->s_id );
|
|
631
|
+ fc_meta.dest = fc_fill_sockaddr ( &dest, &fchdr->d_id );
|
608
|
632
|
|
609
|
633
|
/* Reset timeout */
|
610
|
634
|
start_timer_fixed ( &xchg->timer, FC_TIMEOUT );
|