From owner-svn-src-head@FreeBSD.ORG Sun Sep 1 13:02:00 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EE409694; Sun, 1 Sep 2013 13:02:00 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D9A692A6A; Sun, 1 Sep 2013 13:02:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r81D20mJ001398; Sun, 1 Sep 2013 13:02:00 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r81D20sA001391; Sun, 1 Sep 2013 13:02:00 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309011302.r81D20sA001391@svn.freebsd.org> From: Alexander Motin Date: Sun, 1 Sep 2013 13:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255120 - in head: share/examples/scsi_target sys/cam/scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Sep 2013 13:02:01 -0000 Author: mav Date: Sun Sep 1 13:01:59 2013 New Revision: 255120 URL: http://svnweb.freebsd.org/changeset/base/255120 Log: Bring legacy CAM target implementation back into API/KPI-coherent and even functional state. While CTL is much more superior target from all points, there is no reason why this code should not work. Tested with ahc(4) as target side HBA. MFC after: 2 weeks Modified: head/share/examples/scsi_target/scsi_target.c head/sys/cam/scsi/scsi_targ_bh.c head/sys/cam/scsi/scsi_target.c Modified: head/share/examples/scsi_target/scsi_target.c ============================================================================== --- head/share/examples/scsi_target/scsi_target.c Sun Sep 1 12:18:44 2013 (r255119) +++ head/share/examples/scsi_target/scsi_target.c Sun Sep 1 13:01:59 2013 (r255120) @@ -365,7 +365,7 @@ init_ccbs() for (i = 0; i < MAX_INITIATORS; i++) { struct ccb_accept_tio *atio; struct atio_descr *a_descr; - struct ccb_immed_notify *inot; + struct ccb_immediate_notify *inot; atio = (struct ccb_accept_tio *)malloc(sizeof(*atio)); if (atio == NULL) { @@ -382,7 +382,7 @@ init_ccbs() atio->ccb_h.targ_descr = a_descr; send_ccb((union ccb *)atio, /*priority*/1); - inot = (struct ccb_immed_notify *)malloc(sizeof(*inot)); + inot = (struct ccb_immediate_notify *)malloc(sizeof(*inot)); if (inot == NULL) { warn("malloc INOT"); return (-1); @@ -593,7 +593,7 @@ handle_read() oo += run_queue(c_descr->atio); break; } - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: /* INOTs are handled with priority */ TAILQ_INSERT_HEAD(&work_queue, &ccb->ccb_h, periph_links.tqe); @@ -903,7 +903,7 @@ free_ccb(union ccb *ccb) case XPT_ACCEPT_TARGET_IO: free(ccb->ccb_h.targ_descr); /* FALLTHROUGH */ - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: default: free(ccb); break; Modified: head/sys/cam/scsi/scsi_targ_bh.c ============================================================================== --- head/sys/cam/scsi/scsi_targ_bh.c Sun Sep 1 12:18:44 2013 (r255119) +++ head/sys/cam/scsi/scsi_targ_bh.c Sun Sep 1 13:01:59 2013 (r255120) @@ -305,10 +305,10 @@ targbhenlun(struct cam_periph *periph) * so the SIM can tell us of asynchronous target mode events. */ for (i = 0; i < MAX_ACCEPT; i++) { - struct ccb_immed_notify *inot; + struct ccb_immediate_notify *inot; - inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_SCSIBH, - M_NOWAIT); + inot = (struct ccb_immediate_notify*)malloc(sizeof(*inot), + M_SCSIBH, M_NOWAIT); if (inot == NULL) { status = CAM_RESRC_UNAVAIL; @@ -316,7 +316,7 @@ targbhenlun(struct cam_periph *periph) } xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL); - inot->ccb_h.func_code = XPT_IMMED_NOTIFY; + inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY; inot->ccb_h.cbfcnp = targbhdone; SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h, periph_links.sle); @@ -712,7 +712,7 @@ targbhdone(struct cam_periph *periph, un } break; } - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: { int frozen; Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Sun Sep 1 12:18:44 2013 (r255119) +++ head/sys/cam/scsi/scsi_target.c Sun Sep 1 13:01:59 2013 (r255120) @@ -551,6 +551,7 @@ targwrite(struct cdev *dev, struct uio * switch (func_code) { case XPT_ACCEPT_TARGET_IO: case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: cam_periph_lock(softc->periph); ccb = targgetccb(softc, func_code, priority); descr = (struct targ_cmd_descr *)ccb->ccb_h.targ_descr; @@ -781,6 +782,7 @@ targdone(struct cam_periph *periph, unio switch (done_ccb->ccb_h.func_code) { /* All FC_*_QUEUED CCBs go back to userland */ case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: case XPT_ACCEPT_TARGET_IO: case XPT_CONT_TARGET_IO: TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h, @@ -961,6 +963,7 @@ targfreeccb(struct targ_softc *softc, un switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb)); free(ccb, M_TARG); break; @@ -1131,6 +1134,9 @@ targccblen(xpt_opcode func_code) case XPT_IMMED_NOTIFY: len = sizeof(struct ccb_immed_notify); break; + case XPT_IMMEDIATE_NOTIFY: + len = sizeof(struct ccb_immediate_notify); + break; case XPT_REL_SIMQ: len = sizeof(struct ccb_relsim); break;