summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-06-25 07:11:48 +0000
committermav <mav@FreeBSD.org>2015-06-25 07:11:48 +0000
commit664699931663665a9d03a24c6930fd09f2f5db9c (patch)
tree93efb7dca6bfe7337470a408c02eda90d888092b /sys/cam
parent0aff133da563ccc9dba6c28050810a7b34cb5476 (diff)
downloadFreeBSD-src-664699931663665a9d03a24c6930fd09f2f5db9c.zip
FreeBSD-src-664699931663665a9d03a24c6930fd09f2f5db9c.tar.gz
MFC r284640: Bring per-port LUN enable/disable code up to date:
- remove last remnants of never implemented multiple targets support; - implement missing support for LUN mapping in this area. Due to existing locking constraints LUN mapping code is practically unlocked at this point. Hopefully it is not racy enough to live until somebody get idea how to call sleeping fronend methods under lock also taken by the same frontend in non-sleepable context. :(
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/ctl/ctl.c115
-rw-r--r--sys/cam/ctl/ctl_frontend.c28
-rw-r--r--sys/cam/ctl/ctl_frontend.h2
-rw-r--r--sys/cam/ctl/ctl_frontend_cam_sim.c8
-rw-r--r--sys/cam/ctl/ctl_frontend_internal.c24
-rw-r--r--sys/cam/ctl/ctl_frontend_iscsi.c10
-rw-r--r--sys/cam/ctl/ctl_private.h3
-rw-r--r--sys/cam/ctl/ctl_tpc_local.c8
-rw-r--r--sys/cam/ctl/scsi_ctl.c18
9 files changed, 102 insertions, 114 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index c56011a..8adff8f 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -385,8 +385,8 @@ static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td);
static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td);
static void ctl_ioctl_online(void *arg);
static void ctl_ioctl_offline(void *arg);
-static int ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id);
-static int ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id);
+static int ctl_ioctl_lun_enable(void *arg, int lun_id);
+static int ctl_ioctl_lun_disable(void *arg, int lun_id);
static int ctl_ioctl_do_datamove(struct ctl_scsiio *ctsio);
static int ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio);
static int ctl_ioctl_submit_wait(union ctl_io *io);
@@ -401,7 +401,7 @@ static int ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num,
static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
struct thread *td);
static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun,
- struct ctl_be_lun *be_lun, struct ctl_id target_id);
+ struct ctl_be_lun *be_lun);
static int ctl_free_lun(struct ctl_lun *lun);
static void ctl_create_lun(struct ctl_be_lun *be_lun);
static struct ctl_port * ctl_io_port(struct ctl_io_hdr *io_hdr);
@@ -1130,13 +1130,6 @@ ctl_init(void)
softc->port_offset = (softc->ha_id - 1) * CTL_MAX_PORTS;
softc->persis_offset = softc->port_offset * CTL_MAX_INIT_PER_PORT;
- /*
- * XXX KDM need to figure out where we want to get our target ID
- * and WWID. Is it different on each port?
- */
- softc->target.id = 0;
- softc->target.wwid[0] = 0x12345678;
- softc->target.wwid[1] = 0x87654321;
STAILQ_INIT(&softc->lun_list);
STAILQ_INIT(&softc->pending_lun_queue);
STAILQ_INIT(&softc->fe_list);
@@ -1649,13 +1642,13 @@ ctl_create_iid(struct ctl_port *port, int iid, uint8_t *buf)
}
static int
-ctl_ioctl_lun_enable(void *arg, struct ctl_id targ_id, int lun_id)
+ctl_ioctl_lun_enable(void *arg, int lun_id)
{
return (0);
}
static int
-ctl_ioctl_lun_disable(void *arg, struct ctl_id targ_id, int lun_id)
+ctl_ioctl_lun_disable(void *arg, int lun_id)
{
return (0);
}
@@ -2480,28 +2473,9 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
mtx_unlock(&softc->ctl_lock);
if (cmd == CTL_ENABLE_PORT) {
- struct ctl_lun *lun;
-
- STAILQ_FOREACH(lun, &softc->lun_list,
- links) {
- port->lun_enable(port->targ_lun_arg,
- lun->target,
- lun->lun);
- }
-
ctl_port_online(port);
} else if (cmd == CTL_DISABLE_PORT) {
- struct ctl_lun *lun;
-
ctl_port_offline(port);
-
- STAILQ_FOREACH(lun, &softc->lun_list,
- links) {
- port->lun_disable(
- port->targ_lun_arg,
- lun->target,
- lun->lun);
- }
}
mtx_lock(&softc->ctl_lock);
@@ -3562,26 +3536,22 @@ ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
mtx_unlock(&softc->ctl_lock);
return (ENXIO);
}
+ mtx_unlock(&softc->ctl_lock); // XXX: port_enable sleeps
if (lm->plun < CTL_MAX_LUNS) {
if (lm->lun == UINT32_MAX)
retval = ctl_lun_map_unset(port, lm->plun);
else if (lm->lun < CTL_MAX_LUNS &&
softc->ctl_luns[lm->lun] != NULL)
retval = ctl_lun_map_set(port, lm->plun, lm->lun);
- else {
- mtx_unlock(&softc->ctl_lock);
+ else
return (ENXIO);
- }
} else if (lm->plun == UINT32_MAX) {
if (lm->lun == UINT32_MAX)
retval = ctl_lun_map_deinit(port);
else
retval = ctl_lun_map_init(port);
- } else {
- mtx_unlock(&softc->ctl_lock);
+ } else
return (ENXIO);
- }
- mtx_unlock(&softc->ctl_lock);
break;
}
default: {
@@ -3651,6 +3621,8 @@ ctl_port_idx(int port_num)
int
ctl_lun_map_init(struct ctl_port *port)
{
+ struct ctl_softc *softc = control_softc;
+ struct ctl_lun *lun;
uint32_t i;
if (port->lun_map == NULL)
@@ -3660,17 +3632,27 @@ ctl_lun_map_init(struct ctl_port *port)
return (ENOMEM);
for (i = 0; i < CTL_MAX_LUNS; i++)
port->lun_map[i] = UINT32_MAX;
+ if (port->status & CTL_PORT_STATUS_ONLINE) {
+ STAILQ_FOREACH(lun, &softc->lun_list, links)
+ port->lun_disable(port->targ_lun_arg, lun->lun);
+ }
return (0);
}
int
ctl_lun_map_deinit(struct ctl_port *port)
{
+ struct ctl_softc *softc = control_softc;
+ struct ctl_lun *lun;
if (port->lun_map == NULL)
return (0);
free(port->lun_map, M_CTL);
port->lun_map = NULL;
+ if (port->status & CTL_PORT_STATUS_ONLINE) {
+ STAILQ_FOREACH(lun, &softc->lun_list, links)
+ port->lun_enable(port->targ_lun_arg, lun->lun);
+ }
return (0);
}
@@ -3678,37 +3660,31 @@ int
ctl_lun_map_set(struct ctl_port *port, uint32_t plun, uint32_t glun)
{
int status;
+ uint32_t old;
if (port->lun_map == NULL) {
status = ctl_lun_map_init(port);
if (status != 0)
return (status);
}
+ old = port->lun_map[plun];
port->lun_map[plun] = glun;
+ if ((port->status & CTL_PORT_STATUS_ONLINE) && old >= CTL_MAX_LUNS)
+ port->lun_enable(port->targ_lun_arg, plun);
return (0);
}
int
ctl_lun_map_unset(struct ctl_port *port, uint32_t plun)
{
+ uint32_t old;
if (port->lun_map == NULL)
return (0);
+ old = port->lun_map[plun];
port->lun_map[plun] = UINT32_MAX;
- return (0);
-}
-
-int
-ctl_lun_map_unsetg(struct ctl_port *port, uint32_t glun)
-{
- int i;
-
- if (port->lun_map == NULL)
- return (0);
- for (i = 0; i < CTL_MAX_LUNS; i++) {
- if (port->lun_map[i] == glun)
- port->lun_map[i] = UINT32_MAX;
- }
+ if ((port->status & CTL_PORT_STATUS_ONLINE) && old < CTL_MAX_LUNS)
+ port->lun_disable(port->targ_lun_arg, plun);
return (0);
}
@@ -4534,7 +4510,7 @@ hex2bin(const char *str, uint8_t *buf, int buf_size)
*/
static int
ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
- struct ctl_be_lun *const be_lun, struct ctl_id target_id)
+ struct ctl_be_lun *const be_lun)
{
struct ctl_lun *nlun, *lun;
struct scsi_vpd_id_descriptor *desc;
@@ -4671,8 +4647,7 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
lun_number = ctl_ffz(ctl_softc->ctl_lun_mask, CTL_MAX_LUNS);
if (lun_number == -1) {
mtx_unlock(&ctl_softc->ctl_lock);
- printf("ctl: can't allocate LUN on target %ju, out of "
- "LUNs\n", (uintmax_t)target_id.id);
+ printf("ctl: can't allocate LUN, out of LUNs\n");
if (lun->flags & CTL_LUN_MALLOCED)
free(lun, M_CTL);
be_lun->lun_config_status(be_lun->be_lun,
@@ -4683,7 +4658,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *ctl_lun,
ctl_set_mask(ctl_softc->ctl_lun_mask, lun_number);
mtx_init(&lun->lun_lock, "CTL LUN", NULL, MTX_DEF);
- lun->target = target_id;
lun->lun = lun_number;
lun->be_lun = be_lun;
/*
@@ -4779,7 +4753,6 @@ static int
ctl_free_lun(struct ctl_lun *lun)
{
struct ctl_softc *softc;
- struct ctl_port *port;
struct ctl_lun *nlun;
int i;
@@ -4787,9 +4760,6 @@ ctl_free_lun(struct ctl_lun *lun)
mtx_assert(&softc->ctl_lock, MA_OWNED);
- STAILQ_FOREACH(port, &softc->port_list, links)
- ctl_lun_map_unsetg(port, lun->lun);
-
STAILQ_REMOVE(&softc->lun_list, lun, ctl_lun, links);
ctl_clear_mask(softc->ctl_lun_mask, lun->lun);
@@ -4837,7 +4807,7 @@ ctl_create_lun(struct ctl_be_lun *be_lun)
/*
* ctl_alloc_lun() should handle all potential failure cases.
*/
- ctl_alloc_lun(softc, NULL, be_lun, softc->target);
+ ctl_alloc_lun(softc, NULL, be_lun);
}
int
@@ -4880,6 +4850,9 @@ ctl_enable_lun(struct ctl_be_lun *be_lun)
for (port = STAILQ_FIRST(&softc->port_list); port != NULL; port = nport) {
nport = STAILQ_NEXT(port, links);
+ if ((port->status & CTL_PORT_STATUS_ONLINE) == 0 ||
+ port->lun_map != NULL)
+ continue;
/*
* Drop the lock while we call the FETD's enable routine.
@@ -4887,13 +4860,13 @@ ctl_enable_lun(struct ctl_be_lun *be_lun)
* case of the internal initiator frontend.
*/
mtx_unlock(&softc->ctl_lock);
- retval = port->lun_enable(port->targ_lun_arg, lun->target,lun->lun);
+ retval = port->lun_enable(port->targ_lun_arg, lun->lun);
mtx_lock(&softc->ctl_lock);
if (retval != 0) {
printf("%s: FETD %s port %d returned error "
- "%d for lun_enable on target %ju lun %jd\n",
- __func__, port->port_name, port->targ_port, retval,
- (uintmax_t)lun->target.id, (intmax_t)lun->lun);
+ "%d for lun_enable on lun %jd\n",
+ __func__, port->port_name, port->targ_port,
+ retval, (intmax_t)lun->lun);
}
}
@@ -4924,6 +4897,9 @@ ctl_disable_lun(struct ctl_be_lun *be_lun)
mtx_unlock(&lun->lun_lock);
STAILQ_FOREACH(port, &softc->port_list, links) {
+ if ((port->status & CTL_PORT_STATUS_ONLINE) == 0 ||
+ port->lun_map != NULL)
+ continue;
mtx_unlock(&softc->ctl_lock);
/*
* Drop the lock before we call the frontend's disable
@@ -4932,14 +4908,13 @@ ctl_disable_lun(struct ctl_be_lun *be_lun)
* XXX KDM what happens if the frontend list changes while
* we're traversing it? It's unlikely, but should be handled.
*/
- retval = port->lun_disable(port->targ_lun_arg, lun->target,
- lun->lun);
+ retval = port->lun_disable(port->targ_lun_arg, lun->lun);
mtx_lock(&softc->ctl_lock);
if (retval != 0) {
printf("%s: FETD %s port %d returned error "
- "%d for lun_disable on target %ju lun %jd\n",
- __func__, port->port_name, port->targ_port, retval,
- (uintmax_t)lun->target.id, (intmax_t)lun->lun);
+ "%d for lun_disable on lun %jd\n",
+ __func__, port->port_name, port->targ_port,
+ retval, (intmax_t)lun->lun);
}
}
diff --git a/sys/cam/ctl/ctl_frontend.c b/sys/cam/ctl/ctl_frontend.c
index c38e527..e22b9d4 100644
--- a/sys/cam/ctl/ctl_frontend.c
+++ b/sys/cam/ctl/ctl_frontend.c
@@ -301,6 +301,20 @@ ctl_port_set_wwns(struct ctl_port *port, int wwnn_valid, uint64_t wwnn,
void
ctl_port_online(struct ctl_port *port)
{
+ struct ctl_softc *softc = control_softc;
+ struct ctl_lun *lun;
+ uint32_t l;
+
+ if (port->lun_map) {
+ for (l = 0; l < CTL_MAX_LUNS; l++) {
+ if (ctl_lun_map_from_port(port, l) >= CTL_MAX_LUNS)
+ continue;
+ port->lun_enable(port->targ_lun_arg, l);
+ }
+ } else {
+ STAILQ_FOREACH(lun, &softc->lun_list, links)
+ port->lun_enable(port->targ_lun_arg, lun->lun);
+ }
port->port_online(port->onoff_arg);
/* XXX KDM need a lock here? */
port->status |= CTL_PORT_STATUS_ONLINE;
@@ -309,7 +323,21 @@ ctl_port_online(struct ctl_port *port)
void
ctl_port_offline(struct ctl_port *port)
{
+ struct ctl_softc *softc = control_softc;
+ struct ctl_lun *lun;
+ uint32_t l;
+
port->port_offline(port->onoff_arg);
+ if (port->lun_map) {
+ for (l = 0; l < CTL_MAX_LUNS; l++) {
+ if (ctl_lun_map_from_port(port, l) >= CTL_MAX_LUNS)
+ continue;
+ port->lun_disable(port->targ_lun_arg, l);
+ }
+ } else {
+ STAILQ_FOREACH(lun, &softc->lun_list, links)
+ port->lun_disable(port->targ_lun_arg, lun->lun);
+ }
/* XXX KDM need a lock here? */
port->status &= ~CTL_PORT_STATUS_ONLINE;
}
diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h
index 5b9789f..470d7a7 100644
--- a/sys/cam/ctl/ctl_frontend.h
+++ b/sys/cam/ctl/ctl_frontend.h
@@ -48,7 +48,7 @@ typedef int (*fe_init_t)(void);
typedef void (*fe_shutdown_t)(void);
typedef void (*port_func_t)(void *onoff_arg);
typedef int (*port_info_func_t)(void *onoff_arg, struct sbuf *sb);
-typedef int (*lun_func_t)(void *arg, struct ctl_id targ_id, int lun_id);
+typedef int (*lun_func_t)(void *arg, int lun_id);
typedef int (*fe_ioctl_t)(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
struct thread *td);
diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c
index e779e48..3abc572 100644
--- a/sys/cam/ctl/ctl_frontend_cam_sim.c
+++ b/sys/cam/ctl/ctl_frontend_cam_sim.c
@@ -99,8 +99,8 @@ int cfcs_init(void);
static void cfcs_poll(struct cam_sim *sim);
static void cfcs_online(void *arg);
static void cfcs_offline(void *arg);
-static int cfcs_lun_enable(void *arg, struct ctl_id target_id, int lun_id);
-static int cfcs_lun_disable(void *arg, struct ctl_id target_id, int lun_id);
+static int cfcs_lun_enable(void *arg, int lun_id);
+static int cfcs_lun_disable(void *arg, int lun_id);
static void cfcs_datamove(union ctl_io *io);
static void cfcs_done(union ctl_io *io);
void cfcs_action(struct cam_sim *sim, union ccb *ccb);
@@ -303,12 +303,12 @@ cfcs_offline(void *arg)
}
static int
-cfcs_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
+cfcs_lun_enable(void *arg, int lun_id)
{
return (0);
}
static int
-cfcs_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
+cfcs_lun_disable(void *arg, int lun_id)
{
return (0);
}
diff --git a/sys/cam/ctl/ctl_frontend_internal.c b/sys/cam/ctl/ctl_frontend_internal.c
index 23bd0cf..4768292 100644
--- a/sys/cam/ctl/ctl_frontend_internal.c
+++ b/sys/cam/ctl/ctl_frontend_internal.c
@@ -144,7 +144,6 @@ typedef enum {
} cfi_lun_state;
struct cfi_lun {
- struct ctl_id target_id;
int lun_id;
struct scsi_inquiry_data inq_data;
uint64_t num_blocks;
@@ -192,8 +191,8 @@ int cfi_init(void);
void cfi_shutdown(void) __unused;
static void cfi_online(void *arg);
static void cfi_offline(void *arg);
-static int cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id);
-static int cfi_lun_disable(void *arg, struct ctl_id target_id, int lun_id);
+static int cfi_lun_enable(void *arg, int lun_id);
+static int cfi_lun_disable(void *arg, int lun_id);
static void cfi_datamove(union ctl_io *io);
static cfi_error_action cfi_checkcond_parse(union ctl_io *io,
struct cfi_lun_io *lun_io);
@@ -324,7 +323,7 @@ cfi_offline(void *arg)
}
static int
-cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
+cfi_lun_enable(void *arg, int lun_id)
{
struct cfi_softc *softc;
struct cfi_lun *lun;
@@ -335,8 +334,7 @@ cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
found = 0;
mtx_lock(&softc->lock);
STAILQ_FOREACH(lun, &softc->lun_list, links) {
- if ((lun->target_id.id == target_id.id)
- && (lun->lun_id == lun_id)) {
+ if (lun->lun_id == lun_id) {
found = 1;
break;
}
@@ -356,7 +354,6 @@ cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
return (1);
}
- lun->target_id = target_id;
lun->lun_id = lun_id;
lun->cur_tag_num = 0;
lun->state = CFI_LUN_INQUIRY;
@@ -373,7 +370,7 @@ cfi_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
}
static int
-cfi_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
+cfi_lun_disable(void *arg, int lun_id)
{
struct cfi_softc *softc;
struct cfi_lun *lun;
@@ -391,8 +388,7 @@ cfi_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
*/
mtx_lock(&softc->lock);
STAILQ_FOREACH(lun, &softc->lun_list, links) {
- if ((lun->target_id.id == target_id.id)
- && (lun->lun_id == lun_id)) {
+ if (lun->lun_id == lun_id) {
found = 1;
break;
}
@@ -403,8 +399,7 @@ cfi_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
mtx_unlock(&softc->lock);
if (found == 0) {
- printf("%s: can't find target %ju lun %d\n", __func__,
- (uintmax_t)target_id.id, lun_id);
+ printf("%s: can't find lun %d\n", __func__, lun_id);
return (1);
}
@@ -700,7 +695,7 @@ cfi_init_io(union ctl_io *io, struct cfi_lun *lun,
io->io_hdr.nexus.initid.id = 7;
io->io_hdr.nexus.targ_port = lun->softc->port.targ_port;
- io->io_hdr.nexus.targ_target.id = lun->target_id.id;
+ io->io_hdr.nexus.targ_target.id = 0;
io->io_hdr.nexus.targ_lun = lun->lun_id;
io->io_hdr.retries = retries;
lun_io = (struct cfi_lun_io *)io->io_hdr.port_priv;
@@ -1008,8 +1003,7 @@ cfi_lun_probe(struct cfi_lun *lun, int have_lock)
M_CTL_CFI, M_NOWAIT);
if (dataptr == NULL) {
printf("%s: unable to allocate SCSI read capacity "
- "buffer for target %ju lun %d\n", __func__,
- (uintmax_t)lun->target_id.id, lun->lun_id);
+ "buffer for lun %d\n", __func__, lun->lun_id);
return;
}
if (lun->state == CFI_LUN_READCAPACITY) {
diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 2985bdd..e19852a 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -150,10 +150,8 @@ int cfiscsi_init(void);
static void cfiscsi_online(void *arg);
static void cfiscsi_offline(void *arg);
static int cfiscsi_info(void *arg, struct sbuf *sb);
-static int cfiscsi_lun_enable(void *arg,
- struct ctl_id target_id, int lun_id);
-static int cfiscsi_lun_disable(void *arg,
- struct ctl_id target_id, int lun_id);
+static int cfiscsi_lun_enable(void *arg, int lun_id);
+static int cfiscsi_lun_disable(void *arg, int lun_id);
static int cfiscsi_ioctl(struct cdev *dev,
u_long cmd, caddr_t addr, int flag, struct thread *td);
static void cfiscsi_datamove(union ctl_io *io);
@@ -2301,14 +2299,14 @@ cfiscsi_target_find_or_create(struct cfiscsi_softc *softc, const char *name,
}
static int
-cfiscsi_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
+cfiscsi_lun_enable(void *arg, int lun_id)
{
return (0);
}
static int
-cfiscsi_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
+cfiscsi_lun_disable(void *arg, int lun_id)
{
return (0);
diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h
index ed63f3f..8a00b5c 100644
--- a/sys/cam/ctl/ctl_private.h
+++ b/sys/cam/ctl/ctl_private.h
@@ -397,7 +397,6 @@ struct ctl_devid {
struct tpc_list;
struct ctl_lun {
struct mtx lun_lock;
- struct ctl_id target;
uint64_t lun;
ctl_lun_flags flags;
ctl_lun_serseq serseq;
@@ -460,7 +459,6 @@ struct ctl_softc {
struct mtx ctl_lock;
struct cdev *dev;
int open_count;
- struct ctl_id target;
int num_disks;
int num_luns;
ctl_gen_flags flags;
@@ -508,7 +506,6 @@ int ctl_lun_map_init(struct ctl_port *port);
int ctl_lun_map_deinit(struct ctl_port *port);
int ctl_lun_map_set(struct ctl_port *port, uint32_t plun, uint32_t glun);
int ctl_lun_map_unset(struct ctl_port *port, uint32_t plun);
-int ctl_lun_map_unsetg(struct ctl_port *port, uint32_t glun);
uint32_t ctl_lun_map_from_port(struct ctl_port *port, uint32_t plun);
uint32_t ctl_lun_map_to_port(struct ctl_port *port, uint32_t glun);
int ctl_pool_create(struct ctl_softc *ctl_softc, const char *pool_name,
diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c
index a8f675b..d0319ee 100644
--- a/sys/cam/ctl/ctl_tpc_local.c
+++ b/sys/cam/ctl/ctl_tpc_local.c
@@ -69,8 +69,8 @@ static int tpcl_init(void);
static void tpcl_shutdown(void);
static void tpcl_online(void *arg);
static void tpcl_offline(void *arg);
-static int tpcl_lun_enable(void *arg, struct ctl_id target_id, int lun_id);
-static int tpcl_lun_disable(void *arg, struct ctl_id target_id, int lun_id);
+static int tpcl_lun_enable(void *arg, int lun_id);
+static int tpcl_lun_disable(void *arg, int lun_id);
static void tpcl_datamove(union ctl_io *io);
static void tpcl_done(union ctl_io *io);
@@ -152,14 +152,14 @@ tpcl_offline(void *arg)
}
static int
-tpcl_lun_enable(void *arg, struct ctl_id target_id, int lun_id)
+tpcl_lun_enable(void *arg, int lun_id)
{
return (0);
}
static int
-tpcl_lun_disable(void *arg, struct ctl_id target_id, int lun_id)
+tpcl_lun_disable(void *arg, int lun_id)
{
return (0);
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c
index a315789..6bd0196 100644
--- a/sys/cam/ctl/scsi_ctl.c
+++ b/sys/cam/ctl/scsi_ctl.c
@@ -202,10 +202,8 @@ static void ctlfedone(struct cam_periph *periph,
static void ctlfe_onoffline(void *arg, int online);
static void ctlfe_online(void *arg);
static void ctlfe_offline(void *arg);
-static int ctlfe_lun_enable(void *arg, struct ctl_id targ_id,
- int lun_id);
-static int ctlfe_lun_disable(void *arg, struct ctl_id targ_id,
- int lun_id);
+static int ctlfe_lun_enable(void *arg, int lun_id);
+static int ctlfe_lun_disable(void *arg, int lun_id);
static void ctlfe_dump_sim(struct cam_sim *sim);
static void ctlfe_dump_queue(struct ctlfe_lun_softc *softc);
static void ctlfe_datamove(union ctl_io *io);
@@ -1800,7 +1798,7 @@ ctlfe_offline(void *arg)
* CTL. So we only need to create a path/periph for this particular bus.
*/
static int
-ctlfe_lun_enable(void *arg, struct ctl_id targ_id, int lun_id)
+ctlfe_lun_enable(void *arg, int lun_id)
{
struct ctlfe_softc *bus_softc;
struct ctlfe_lun_softc *softc;
@@ -1811,8 +1809,7 @@ ctlfe_lun_enable(void *arg, struct ctl_id targ_id, int lun_id)
bus_softc = (struct ctlfe_softc *)arg;
status = xpt_create_path(&path, /*periph*/ NULL,
- bus_softc->path_id,
- targ_id.id, lun_id);
+ bus_softc->path_id, 0, lun_id);
/* XXX KDM need some way to return status to CTL here? */
if (status != CAM_REQ_CMP) {
printf("%s: could not create path, status %#x\n", __func__,
@@ -1863,7 +1860,7 @@ ctlfe_lun_enable(void *arg, struct ctl_id targ_id, int lun_id)
* on every bus that is attached to CTL.
*/
static int
-ctlfe_lun_disable(void *arg, struct ctl_id targ_id, int lun_id)
+ctlfe_lun_disable(void *arg, int lun_id)
{
struct ctlfe_softc *softc;
struct ctlfe_lun_softc *lun_softc;
@@ -1876,15 +1873,14 @@ ctlfe_lun_disable(void *arg, struct ctl_id targ_id, int lun_id)
path = lun_softc->periph->path;
- if ((xpt_path_target_id(path) == targ_id.id)
+ if ((xpt_path_target_id(path) == 0)
&& (xpt_path_lun_id(path) == lun_id)) {
break;
}
}
if (lun_softc == NULL) {
mtx_unlock(&softc->lun_softc_mtx);
- printf("%s: can't find target %d lun %d\n", __func__,
- targ_id.id, lun_id);
+ printf("%s: can't find lun %d\n", __func__, lun_id);
return (1);
}
cam_periph_acquire(lun_softc->periph);
OpenPOWER on IntegriCloud