1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2013, Nexenta Systems, Inc. All rights reserved.
24 */
25
26 #include <sys/cpuvar.h>
27 #include <sys/types.h>
28 #include <sys/conf.h>
29 #include <sys/file.h>
30 #include <sys/ddi.h>
31 #include <sys/sunddi.h>
32 #include <sys/modctl.h>
33 #include <sys/sysmacros.h>
34
35 #include <sys/socket.h>
36 #include <sys/strsubr.h>
37 #include <sys/door.h>
38
39 #include <sys/stmf.h>
40 #include <sys/stmf_ioctl.h>
41 #include <sys/portif.h>
42
43 #include "pppt.h"
314 * Allocate STMF task context
315 */
316 ptask->pt_stmf_task = stmf_task_alloc(lport, stmf_sess,
317 scmd->icsc_task_lun_no,
318 scmd->icsc_task_cdb_length, 0);
319 if (ptask->pt_stmf_task == NULL) {
320 /* NOTE: pppt_task_done() will free ptask. */
321 (void) pppt_task_done(ptask);
322 pppt_sess_rele(pppt_sess);
323 pppt_msg_tx_status(msg, STMF_ALLOC_FAILURE);
324 stmf_ic_msg_free(msg);
325 PPPT_INC_STAT(es_scmd_stask_alloc_fail);
326 return;
327 }
328
329 task = ptask->pt_stmf_task;
330 /* task_port_private reference is a real reference. */
331 (void) pppt_task_hold(ptask);
332 task->task_port_private = ptask;
333 task->task_flags = scmd->icsc_task_flags;
334 task->task_additional_flags = 0;
335 task->task_priority = 0;
336
337 /*
338 * Set task->task_mgmt_function to TM_NONE for a normal SCSI task
339 * or one of these values for a task management command:
340 *
341 * TM_ABORT_TASK ***
342 * TM_ABORT_TASK_SET
343 * TM_CLEAR_ACA
344 * TM_CLEAR_TASK_SET
345 * TM_LUN_RESET
346 * TM_TARGET_WARM_RESET
347 * TM_TARGET_COLD_RESET
348 *
349 * *** Note that STMF does not currently support TM_ABORT_TASK so
350 * port providers must implement this command on their own
351 * (e.g. lookup the desired task and call stmf_abort).
352 */
353 task->task_mgmt_function = scmd->icsc_task_mgmt_function;
354
|
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 #include <sys/cpuvar.h>
28 #include <sys/types.h>
29 #include <sys/conf.h>
30 #include <sys/file.h>
31 #include <sys/ddi.h>
32 #include <sys/sunddi.h>
33 #include <sys/modctl.h>
34 #include <sys/sysmacros.h>
35
36 #include <sys/socket.h>
37 #include <sys/strsubr.h>
38 #include <sys/door.h>
39
40 #include <sys/stmf.h>
41 #include <sys/stmf_ioctl.h>
42 #include <sys/portif.h>
43
44 #include "pppt.h"
315 * Allocate STMF task context
316 */
317 ptask->pt_stmf_task = stmf_task_alloc(lport, stmf_sess,
318 scmd->icsc_task_lun_no,
319 scmd->icsc_task_cdb_length, 0);
320 if (ptask->pt_stmf_task == NULL) {
321 /* NOTE: pppt_task_done() will free ptask. */
322 (void) pppt_task_done(ptask);
323 pppt_sess_rele(pppt_sess);
324 pppt_msg_tx_status(msg, STMF_ALLOC_FAILURE);
325 stmf_ic_msg_free(msg);
326 PPPT_INC_STAT(es_scmd_stask_alloc_fail);
327 return;
328 }
329
330 task = ptask->pt_stmf_task;
331 /* task_port_private reference is a real reference. */
332 (void) pppt_task_hold(ptask);
333 task->task_port_private = ptask;
334 task->task_flags = scmd->icsc_task_flags;
335 task->task_additional_flags = TASK_AF_PPPT_TASK;
336 task->task_priority = 0;
337
338 /*
339 * Set task->task_mgmt_function to TM_NONE for a normal SCSI task
340 * or one of these values for a task management command:
341 *
342 * TM_ABORT_TASK ***
343 * TM_ABORT_TASK_SET
344 * TM_CLEAR_ACA
345 * TM_CLEAR_TASK_SET
346 * TM_LUN_RESET
347 * TM_TARGET_WARM_RESET
348 * TM_TARGET_COLD_RESET
349 *
350 * *** Note that STMF does not currently support TM_ABORT_TASK so
351 * port providers must implement this command on their own
352 * (e.g. lookup the desired task and call stmf_abort).
353 */
354 task->task_mgmt_function = scmd->icsc_task_mgmt_function;
355
|