Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Feb 2019 22:16:59 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r344642 - head/sys/dev/nvme
Message-ID:  <201902272216.x1RMGxjY064173@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Wed Feb 27 22:16:59 2019
New Revision: 344642
URL: https://svnweb.freebsd.org/changeset/base/344642

Log:
  Unconditionally support unmapped BIOs. This was another shim for
  supporting older kernels. However, all supported versions of FreeBSD
  have unmapped I/Os (as do several that have gone EOL), remove it. It's
  unlikely the driver would work on the older kernels anyway at this
  point.

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c
  head/sys/dev/nvme/nvme_ns.c
  head/sys/dev/nvme/nvme_private.h
  head/sys/dev/nvme/nvme_qpair.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Wed Feb 27 22:12:04 2019	(r344641)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Wed Feb 27 22:16:59 2019	(r344642)
@@ -1056,11 +1056,7 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr
 			buf->b_data = pt->buf;
 			buf->b_bufsize = pt->len;
 			buf->b_iocmd = pt->is_read ? BIO_READ : BIO_WRITE;
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 			if (vmapbuf(buf, 1) < 0) {
-#else
-			if (vmapbuf(buf) < 0) {
-#endif
 				ret = EFAULT;
 				goto err;
 			}

Modified: head/sys/dev/nvme/nvme_ns.c
==============================================================================
--- head/sys/dev/nvme/nvme_ns.c	Wed Feb 27 22:12:04 2019	(r344641)
+++ head/sys/dev/nvme/nvme_ns.c	Wed Feb 27 22:16:59 2019	(r344642)
@@ -357,10 +357,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t ali
 	caddr_t		data;
 	uint32_t	rem_bcount;
 	int		i;
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 	struct vm_page	**ma;
 	uint32_t	ma_offset;
-#endif
 
 	*num_bios = nvme_get_num_segments(bp->bio_offset, bp->bio_bcount,
 	    alignment);
@@ -373,10 +371,8 @@ nvme_construct_child_bios(struct bio *bp, uint32_t ali
 	cur_offset = bp->bio_offset;
 	rem_bcount = bp->bio_bcount;
 	data = bp->bio_data;
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 	ma_offset = bp->bio_ma_offset;
 	ma = bp->bio_ma;
-#endif
 
 	for (i = 0; i < *num_bios; i++) {
 		child = child_bios[i];
@@ -386,7 +382,6 @@ nvme_construct_child_bios(struct bio *bp, uint32_t ali
 		child->bio_bcount = min(rem_bcount,
 		    alignment - (cur_offset & (alignment - 1)));
 		child->bio_flags = bp->bio_flags;
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 		if (bp->bio_flags & BIO_UNMAPPED) {
 			child->bio_ma_offset = ma_offset;
 			child->bio_ma = ma;
@@ -398,9 +393,7 @@ nvme_construct_child_bios(struct bio *bp, uint32_t ali
 			ma += child->bio_ma_n;
 			if (ma_offset != 0)
 				ma -= 1;
-		} else
-#endif
-		{
+		} else {
 			child->bio_data = data;
 			data += child->bio_bcount;
 		}
@@ -599,9 +592,7 @@ nvme_ns_construct(struct nvme_namespace *ns, uint32_t 
 	if (res != 0)
 		return (ENXIO);
 
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 	ns->cdev->si_flags |= SI_UNMAPPED;
-#endif
 
 	return (0);
 }

Modified: head/sys/dev/nvme/nvme_private.h
==============================================================================
--- head/sys/dev/nvme/nvme_private.h	Wed Feb 27 22:12:04 2019	(r344641)
+++ head/sys/dev/nvme/nvme_private.h	Wed Feb 27 22:16:59 2019	(r344642)
@@ -112,16 +112,6 @@ MALLOC_DECLARE(M_NVME);
 #define CACHE_LINE_SIZE		(64)
 #endif
 
-/*
- * Use presence of the BIO_UNMAPPED flag to determine whether unmapped I/O
- *  support and the bus_dmamap_load_bio API are available on the target
- *  kernel.  This will ease porting back to earlier stable branches at a
- *  later point.
- */
-#ifdef BIO_UNMAPPED
-#define NVME_UNMAPPED_BIO_SUPPORT
-#endif
-
 extern uma_zone_t	nvme_request_zone;
 extern int32_t		nvme_retry_count;
 
@@ -134,9 +124,7 @@ struct nvme_completion_poll_status {
 #define NVME_REQUEST_VADDR	1
 #define NVME_REQUEST_NULL	2 /* For requests with no payload. */
 #define NVME_REQUEST_UIO	3
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 #define NVME_REQUEST_BIO	4
-#endif
 #define NVME_REQUEST_CCB        5
 
 struct nvme_request {
@@ -506,14 +494,8 @@ nvme_allocate_request_bio(struct bio *bio, nvme_cb_fn_
 
 	req = _nvme_allocate_request(cb_fn, cb_arg);
 	if (req != NULL) {
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 		req->type = NVME_REQUEST_BIO;
 		req->u.bio = bio;
-#else
-		req->type = NVME_REQUEST_VADDR;
-		req->u.payload = bio->bio_data;
-		req->payload_size = bio->bio_bcount;
-#endif
 	}
 	return (req);
 }

Modified: head/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- head/sys/dev/nvme/nvme_qpair.c	Wed Feb 27 22:12:04 2019	(r344641)
+++ head/sys/dev/nvme/nvme_qpair.c	Wed Feb 27 22:16:59 2019	(r344642)
@@ -954,7 +954,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, s
 	case NVME_REQUEST_NULL:
 		nvme_qpair_submit_tracker(tr->qpair, tr);
 		break;
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
 	case NVME_REQUEST_BIO:
 		KASSERT(req->u.bio->bio_bcount <= qpair->ctrlr->max_xfer_size,
 		    ("bio->bio_bcount (%jd) exceeds max_xfer_size (%d)\n",
@@ -966,7 +965,6 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, s
 			nvme_printf(qpair->ctrlr,
 			    "bus_dmamap_load_bio returned 0x%x!\n", err);
 		break;
-#endif
 	case NVME_REQUEST_CCB:
 		err = bus_dmamap_load_ccb(tr->qpair->dma_tag_payload,
 		    tr->payload_dma_map, req->u.payload,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902272216.x1RMGxjY064173>