- /* Get port_id of device. */
- fcport->d_id.b.al_pa = pd->port_id[2];
- fcport->d_id.b.area = pd->port_id[3];
- fcport->d_id.b.domain = pd->port_id[0];
- fcport->d_id.b.rsvd_1 = 0;
-
- /* Check for device require authentication. */
- pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) :
- (fcport->flags &= ~FCF_AUTH_REQ);
+ if (rval == QLA_SUCCESS) {
+ /* Names are little-endian. */
+ memcpy(fcport->node_name, pd->node_name, WWN_SIZE);
+ memcpy(fcport->port_name, pd->port_name, WWN_SIZE);
+
+ /* Get port_id of device. */
+ fcport->d_id.b.al_pa = pd->port_id[2];
+ fcport->d_id.b.area = pd->port_id[3];
+ fcport->d_id.b.domain = pd->port_id[0];
+ fcport->d_id.b.rsvd_1 = 0;
+
+ /* Check for device require authentication. */
+ pd->common_features & BIT_5 ? (fcport->flags |= FCF_AUTH_REQ) :
+ (fcport->flags &= ~FCF_AUTH_REQ);
+
+ /* If not target must be initiator or unknown type. */
+ if ((pd->prli_svc_param_word_3[0] & BIT_4) == 0) {
+ fcport->port_type = FCT_INITIATOR;
+ } else {
+ fcport->port_type = FCT_TARGET;