Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b2787ec authored by Robert Love's avatar Robert Love Committed by James Bottomley
Browse files

[SCSI] libfc: Move the port_id into lport



This patch creates a port_id member in struct fc_lport.
This allows libfc to just deal with fc_lport instances
instead of calling into the fc_host to get the port_id.

This change helps in only using symbols necessary for
operation from the libfc structures. libfc still needs
to change the fc_host_port_id() if the port_id changes
so the presentation layer (scsi_transport_fc) can provide
the user with the correct value, but libfc shouldn't
rely on the presentation layer for operational values.

Signed-off-by: default avatarRobert Love <robert.w.love@intel.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 5e4f8fe7
Loading
Loading
Loading
Loading
+4 −5
Original line number Original line Diff line number Diff line
@@ -343,7 +343,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip,


	fcf = fip->sel_fcf;
	fcf = fip->sel_fcf;
	lp = fip->lp;
	lp = fip->lp;
	if (!fcf || !fc_host_port_id(lp->host))
	if (!fcf || !lp->port_id)
		return;
		return;


	len = sizeof(*kal) + ports * sizeof(*vn);
	len = sizeof(*kal) + ports * sizeof(*vn);
@@ -374,7 +374,7 @@ static void fcoe_ctlr_send_keep_alive(struct fcoe_ctlr *fip,
		vn->fd_desc.fip_dtype = FIP_DT_VN_ID;
		vn->fd_desc.fip_dtype = FIP_DT_VN_ID;
		vn->fd_desc.fip_dlen = sizeof(*vn) / FIP_BPW;
		vn->fd_desc.fip_dlen = sizeof(*vn) / FIP_BPW;
		memcpy(vn->fd_mac, fip->get_src_addr(lport), ETH_ALEN);
		memcpy(vn->fd_mac, fip->get_src_addr(lport), ETH_ALEN);
		hton24(vn->fd_fc_id, fc_host_port_id(lp->host));
		hton24(vn->fd_fc_id, lp->port_id);
		put_unaligned_be64(lp->wwpn, &vn->fd_wwpn);
		put_unaligned_be64(lp->wwpn, &vn->fd_wwpn);
	}
	}
	skb_put(skb, len);
	skb_put(skb, len);
@@ -949,7 +949,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,


	LIBFCOE_FIP_DBG(fip, "Clear Virtual Link received\n");
	LIBFCOE_FIP_DBG(fip, "Clear Virtual Link received\n");


	if (!fcf || !fc_host_port_id(lport->host))
	if (!fcf || !lport->port_id)
		return;
		return;


	/*
	/*
@@ -987,8 +987,7 @@ static void fcoe_ctlr_recv_clr_vlink(struct fcoe_ctlr *fip,
			if (compare_ether_addr(vp->fd_mac,
			if (compare_ether_addr(vp->fd_mac,
					       fip->get_src_addr(lport)) == 0 &&
					       fip->get_src_addr(lport)) == 0 &&
			    get_unaligned_be64(&vp->fd_wwpn) == lport->wwpn &&
			    get_unaligned_be64(&vp->fd_wwpn) == lport->wwpn &&
			    ntoh24(vp->fd_fc_id) ==
			    ntoh24(vp->fd_fc_id) == lport->port_id)
			    fc_host_port_id(lport->host))
				desc_mask &= ~BIT(FIP_DT_VN_ID);
				desc_mask &= ~BIT(FIP_DT_VN_ID);
			break;
			break;
		default:
		default:
+1 −1
Original line number Original line Diff line number Diff line
@@ -440,7 +440,7 @@ static int fc_disc_gpn_ft_parse(struct fc_disc *disc, void *buf, size_t len)
		ids.port_id = ntoh24(np->fp_fid);
		ids.port_id = ntoh24(np->fp_fid);
		ids.port_name = ntohll(np->fp_wwpn);
		ids.port_name = ntohll(np->fp_wwpn);


		if (ids.port_id != fc_host_port_id(lport->host) &&
		if (ids.port_id != lport->port_id &&
		    ids.port_name != lport->wwpn) {
		    ids.port_name != lport->wwpn) {
			rdata = lport->tt.rport_create(lport, ids.port_id);
			rdata = lport->tt.rport_create(lport, ids.port_id);
			if (rdata) {
			if (rdata) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ struct fc_seq *fc_elsct_send(struct fc_lport *lport, u32 did,
		return NULL;
		return NULL;
	}
	}


	fc_fill_fc_hdr(fp, r_ctl, did, fc_host_port_id(lport->host), fh_type,
	fc_fill_fc_hdr(fp, r_ctl, did, lport->port_id, fh_type,
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);


	return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
	return lport->tt.exch_seq_send(lport, fp, resp, NULL, arg, timer_msec);
+1 −1
Original line number Original line Diff line number Diff line
@@ -1927,7 +1927,7 @@ static void fc_exch_rrq(struct fc_exch *ep)
		did = ep->sid;
		did = ep->sid;


	fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did,
	fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, did,
		       fc_host_port_id(lport->host), FC_TYPE_ELS,
		       lport->port_id, FC_TYPE_ELS,
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);


	if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep,
	if (fc_exch_seq_send(lport, fp, fc_exch_rrq_resp, NULL, ep,
+7 −7
Original line number Original line Diff line number Diff line
@@ -490,7 +490,7 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
			if (stats->InvalidCRCCount++ < 5)
			if (stats->InvalidCRCCount++ < 5)
				printk(KERN_WARNING "libfc: CRC error on data "
				printk(KERN_WARNING "libfc: CRC error on data "
				       "frame for port (%6.6x)\n",
				       "frame for port (%6.6x)\n",
				       fc_host_port_id(lport->host));
				       lport->port_id);
			put_cpu();
			put_cpu();
			/*
			/*
			 * Assume the frame is total garbage.
			 * Assume the frame is total garbage.
@@ -1109,7 +1109,7 @@ static int fc_fcp_cmd_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
	rpriv = rport->dd_data;
	rpriv = rport->dd_data;


	fc_fill_fc_hdr(fp, FC_RCTL_DD_UNSOL_CMD, rport->port_id,
	fc_fill_fc_hdr(fp, FC_RCTL_DD_UNSOL_CMD, rport->port_id,
		       fc_host_port_id(rpriv->local_port->host), FC_TYPE_FCP,
		       rpriv->local_port->port_id, FC_TYPE_FCP,
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);


	seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy,
	seq = lport->tt.exch_seq_send(lport, fp, resp, fc_fcp_pkt_destroy,
@@ -1382,7 +1382,7 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp)


	fr_seq(fp) = fsp->seq_ptr;
	fr_seq(fp) = fsp->seq_ptr;
	fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id,
	fc_fill_fc_hdr(fp, FC_RCTL_ELS_REQ, rport->port_id,
		       fc_host_port_id(rpriv->local_port->host), FC_TYPE_ELS,
		       rpriv->local_port->port_id, FC_TYPE_ELS,
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
	if (lport->tt.elsct_send(lport, rport->port_id, fp, ELS_REC,
	if (lport->tt.elsct_send(lport, rport->port_id, fp, ELS_REC,
				 fc_fcp_rec_resp, fsp,
				 fc_fcp_rec_resp, fsp,
@@ -1640,7 +1640,7 @@ static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset)
	srr->srr_rel_off = htonl(offset);
	srr->srr_rel_off = htonl(offset);


	fc_fill_fc_hdr(fp, FC_RCTL_ELS4_REQ, rport->port_id,
	fc_fill_fc_hdr(fp, FC_RCTL_ELS4_REQ, rport->port_id,
		       fc_host_port_id(rpriv->local_port->host), FC_TYPE_FCP,
		       rpriv->local_port->port_id, FC_TYPE_FCP,
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
		       FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);


	seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp, NULL,
	seq = lport->tt.exch_seq_send(lport, fp, fc_fcp_srr_resp, NULL,
@@ -2101,12 +2101,12 @@ int fc_eh_host_reset(struct scsi_cmnd *sc_cmd)


	if (fc_fcp_lport_queue_ready(lport)) {
	if (fc_fcp_lport_queue_ready(lport)) {
		shost_printk(KERN_INFO, shost, "libfc: Host reset succeeded "
		shost_printk(KERN_INFO, shost, "libfc: Host reset succeeded "
			     "on port (%6.6x)\n", fc_host_port_id(lport->host));
			     "on port (%6.6x)\n", lport->port_id);
		return SUCCESS;
		return SUCCESS;
	} else {
	} else {
		shost_printk(KERN_INFO, shost, "libfc: Host reset failed, "
		shost_printk(KERN_INFO, shost, "libfc: Host reset failed, "
			     "port (%6.6x) is not ready.\n",
			     "port (%6.6x) is not ready.\n",
			     fc_host_port_id(lport->host));
			     lport->port_id);
		return FAILED;
		return FAILED;
	}
	}
}
}
@@ -2191,7 +2191,7 @@ void fc_fcp_destroy(struct fc_lport *lport)


	if (!list_empty(&si->scsi_pkt_queue))
	if (!list_empty(&si->scsi_pkt_queue))
		printk(KERN_ERR "libfc: Leaked SCSI packets when destroying "
		printk(KERN_ERR "libfc: Leaked SCSI packets when destroying "
		       "port (%6.6x)\n", fc_host_port_id(lport->host));
		       "port (%6.6x)\n", lport->port_id);


	mempool_destroy(si->scsi_pkt_pool);
	mempool_destroy(si->scsi_pkt_pool);
	kfree(si);
	kfree(si);
Loading