svn commit: r273319 - stable/10/sys/cam/ctl

Alexander Motin mav at FreeBSD.org
Mon Oct 20 07:59:31 UTC 2014


Author: mav
Date: Mon Oct 20 07:59:29 2014
New Revision: 273319
URL: https://svnweb.freebsd.org/changeset/base/273319

Log:
  MFC r272947: Give physical and virtual ports numbers some more meaning.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.h
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c	Mon Oct 20 07:58:01 2014	(r273318)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c	Mon Oct 20 07:59:29 2014	(r273319)
@@ -2000,7 +2000,8 @@ cfiscsi_ioctl_port_create(struct ctl_req
 	/* XXX KDM what should the real number be here? */
 	port->num_requested_ctl_io = 4096;
 	port->port_name = "iscsi";
-	port->virtual_port = strtoul(tag, NULL, 0);
+	port->physical_port = strtoul(tag, NULL, 0);
+	port->virtual_port = ct->ct_target_id;
 	port->port_online = cfiscsi_online;
 	port->port_offline = cfiscsi_offline;
 	port->port_info = cfiscsi_info;
@@ -2033,7 +2034,7 @@ cfiscsi_ioctl_port_create(struct ctl_req
 	    SVPD_ID_TYPE_SCSI_NAME;
 	desc->length = idlen;
 	snprintf(desc->identifier, idlen, "%s,t,0x%4.4x",
-	    target, port->virtual_port);
+	    target, port->physical_port);
 
 	/* Generate Target ID. */
 	idlen = strlen(target) + 1;
@@ -2261,6 +2262,9 @@ cfiscsi_target_find_or_create(struct cfi
 		strlcpy(newct->ct_alias, alias, sizeof(newct->ct_alias));
 	refcount_init(&newct->ct_refcount, 1);
 	newct->ct_softc = softc;
+	if (TAILQ_EMPTY(&softc->targets))
+		softc->last_target_id = 0;
+	newct->ct_target_id = ++softc->last_target_id;
 	TAILQ_INSERT_TAIL(&softc->targets, newct, ct_next);
 	mtx_unlock(&softc->lock);
 

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.h	Mon Oct 20 07:58:01 2014	(r273318)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.h	Mon Oct 20 07:59:29 2014	(r273319)
@@ -45,6 +45,7 @@ struct cfiscsi_target {
 	char				ct_alias[CTL_ISCSI_ALIAS_LEN];
 	int				ct_state;
 	int				ct_online;
+	int				ct_target_id;
 	struct ctl_port			ct_port;
 };
 
@@ -110,6 +111,7 @@ struct cfiscsi_softc {
 	struct mtx			lock;
 	char				port_name[32];
 	int				online;
+	int				last_target_id;
 	unsigned int			last_session_id;
 	TAILQ_HEAD(, cfiscsi_target)	targets;
 	TAILQ_HEAD(, cfiscsi_session)	sessions;

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/scsi_ctl.c	Mon Oct 20 07:58:01 2014	(r273318)
+++ stable/10/sys/cam/ctl/scsi_ctl.c	Mon Oct 20 07:59:29 2014	(r273319)
@@ -400,8 +400,8 @@ ctlfeasync(void *callback_arg, uint32_t 
 		 * frontend structure itself.
 	 	 */
 		port->port_name = softc->port_name;
-		port->physical_port = cpi->unit_number;
-		port->virtual_port = cpi->bus_id;
+		port->physical_port = cpi->bus_id;
+		port->virtual_port = 0;
 		port->port_online = ctlfe_online;
 		port->port_offline = ctlfe_offline;
 		port->onoff_arg = softc;


More information about the svn-src-all mailing list