svn commit: r255120 - in head: share/examples/scsi_target sys/cam/scsi

Alexander Motin mav at FreeBSD.org
Sun Sep 1 13:02:01 UTC 2013


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;


More information about the svn-src-all mailing list