Commit d39c4443 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Remove OCSSD support



As far as we're aware, this is not in use by anyone. OCSSD has largely
been replaced by ZNS and no OCSSD drives made it to the market.

Change-Id: I020ee277da5292f8c4777f224acafd87586f8238
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9328


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 5deb77ad
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ with new `spdk_bdev_module_fini_start_done` API.
Deprecated `spdk_bdev_module_finish_done()` API, which will be removed in SPDK 22.01.
Bdev modules should use `spdk_bdev_module_fini_done()` instead.

The `ocssd` bdev has been removed. The Open Channel specification has been largely superceded by
zoned namespaces, few if any devices have been brough to market, and there is little reason to
continue to support this. OCSSD support in the nvme driver will remain for now.

### dma

A new library, lib/dma, has been added. This library provides the necessary infrastructure for
+0 −90
Original line number Diff line number Diff line
@@ -150,62 +150,6 @@ Both interfaces require the same arguments which are described by the `--help` o
- base bdev's name (base bdev must implement bdev_zone API)
- UUID of the FTL device (if the FTL is to be restored from the SSD)

### FTL usage with OCSSD nvme bdev {#ftl_ocssd}

This option requires an Open Channel SSD, which can be emulated using QEMU.

The QEMU with the patches providing Open Channel support can be found on the SPDK's QEMU fork
on [spdk-3.0.0](https://github.com/spdk/qemu/tree/spdk-3.0.0) branch.

## Configuring QEMU {#ftl_qemu_config}

To emulate an Open Channel device, QEMU expects parameters describing the characteristics and
geometry of the SSD:

- `serial` - serial number,
- `lver` - version of the OCSSD standard (0 - disabled, 1 - "1.2", 2 - "2.0"), libftl only supports
  2.0,
- `lba_index` - default LBA format. Possible values can be found in the table below (libftl only supports lba_index >= 3):
- `lnum_ch` - number of groups,
- `lnum_lun` - number of parallel units
- `lnum_pln` - number of planes (logical blocks from all planes constitute a chunk)
- `lpgs_per_blk` - number of pages (smallest programmable unit) per chunk
- `lsecs_per_pg` - number of sectors in a page
- `lblks_per_pln` - number of chunks in a parallel unit
- `laer_thread_sleep` - timeout in ms between asynchronous events requesting the host to relocate
  the data based on media feedback
- `lmetadata` - metadata file

        |lba_index| data| metadata|
        |---------|-----|---------|
        |    0    | 512B|    0B   |
        |    1    | 512B|    8B   |
        |    2    | 512B|   16B   |
        |    3    |4096B|    0B   |
        |    4    |4096B|   64B   |
        |    5    |4096B|  128B   |
        |    6    |4096B|   16B   |

For more detailed description of the available options, consult the `hw/block/nvme.c` file in
the QEMU repository.

Example:

```
$ /path/to/qemu [OTHER PARAMETERS] -drive format=raw,file=/path/to/data/file,if=none,id=myocssd0
        -device nvme,drive=myocssd0,serial=deadbeef,lver=2,lba_index=3,lnum_ch=1,lnum_lun=8,lnum_pln=4,
        lpgs_per_blk=1536,lsecs_per_pg=4,lblks_per_pln=512,lmetadata=/path/to/md/file
```

In the above example, a device is created with 1 channel, 8 parallel units, 512 chunks per parallel
unit, 24576 (`lnum_pln` * `lpgs_per_blk` * `lsecs_per_pg`) logical blocks in each chunk with logical
block being 4096B. Therefore the data file needs to be at least 384G `(8 * 512 * 24576 * 4096B)`
of size and can be created with the following command:

```
fallocate -l 384G /path/to/data/file
```

## Configuring SPDK {#ftl_spdk_config}

To verify that the drive is emulated correctly, one can check the output of the NVMe identify app
@@ -226,40 +170,6 @@ Model Number: QEMU NVMe Ctrl

... other info ...

Namespace OCSSD Geometry
=======================
OC version: maj:2 min:0

... other info ...

Groups (channels): 1
PUs (LUNs) per group: 8
Chunks per LUN: 512
Logical blks per chunk: 24576

... other info ...

```

In order to create FTL on top Open Channel SSD, the following steps are required:

1) Attach OCSSD NVMe controller
2) Create OCSSD bdev on the controller attached in step 1 (user could specify parallel unit range
and create multiple OCSSD bdevs on single OCSSD NVMe controller)
3) Create FTL bdev on top of bdev created in step 2

Example:
```
$ scripts/rpc.py bdev_nvme_attach_controller -b nvme0 -a 00:0a.0 -t pcie

$ scripts/rpc.py bdev_ocssd_create -c nvme0 -b nvme0n1
	nvme0n1

$ scripts/rpc.py bdev_ftl_create -b ftl0 -d nvme0n1
{
	"name": "ftl0",
	"uuid": "3b469565-1fa5-4bfb-8341-747ec9fca9b9"
}
```

## FTL usage with zone block bdev {#ftl_zone_block}
+0 −73
Original line number Diff line number Diff line
@@ -4137,79 +4137,6 @@ Example response:
}
~~~

### bdev_ocssd_create {#rpc_bdev_ocssd_create}

Create Open Channel zoned bdev on specified Open Channel controller.

#### Parameters

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
ctrlr_name              | Required | string      | OC NVMe controller
name                    | Required | string      | Bdev name to create
nsid                    | Optional | string      | namespace ID

#### Example

Example request:

~~~
{
  "jsonrpc": "2.0",
  "method": "bdev_ocssd_create",
  "id": 1,
  "params": {
    "ctrlr_name": "nvme0",
    "bdev_name": "nvme0n1"
  }
}
~~~

Example response:

~~~
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_ocssd_delete {#rpc_bdev_ocssd_delete}

Delete Open Channel zoned bdev.

#### Parameters

Name                    | Optional | Type        | Description
----------------------- | -------- | ----------- | -----------
name                    | Required | string      | Bdev name to delete

#### Example

Example request:

~~~
{
  "jsonrpc": "2.0",
  "method": "bdev_ocssd_delete",
  "id": 1,
  "params": {
    "name": "nvme0n1"
  }
}
~~~

Example response:

~~~
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}
~~~

### bdev_pmem_create_pool {#rpc_bdev_pmem_create_pool}

Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command:
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 4
SO_MINOR := 0

C_SRCS = bdev_nvme.c bdev_nvme_rpc.c nvme_rpc.c common.c bdev_ocssd.c bdev_ocssd_rpc.c
C_SRCS = bdev_nvme.c bdev_nvme_rpc.c nvme_rpc.c common.c
C_SRCS-$(CONFIG_NVME_CUSE) += bdev_nvme_cuse_rpc.c

ifeq ($(OS),Linux)
+4 −33
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@
#include "spdk/stdinc.h"

#include "bdev_nvme.h"
#include "bdev_ocssd.h"

#include "spdk/accel_engine.h"
#include "spdk/config.h"
@@ -203,7 +202,6 @@ static void nvme_ctrlr_populate_standard_namespace(struct nvme_ctrlr *nvme_ctrlr
static populate_namespace_fn g_populate_namespace_fn[] = {
	NULL,
	nvme_ctrlr_populate_standard_namespace,
	bdev_ocssd_populate_namespace,
};

typedef void (*depopulate_namespace_fn)(struct nvme_ns *nvme_ns);
@@ -212,7 +210,6 @@ static void nvme_ctrlr_depopulate_standard_namespace(struct nvme_ns *nvme_ns);
static depopulate_namespace_fn g_depopulate_namespace_fn[] = {
	NULL,
	nvme_ctrlr_depopulate_standard_namespace,
	bdev_ocssd_depopulate_namespace,
};

typedef void (*config_json_namespace_fn)(struct spdk_json_write_ctx *w,
@@ -223,7 +220,6 @@ static void nvme_ctrlr_config_json_standard_namespace(struct spdk_json_write_ctx
static config_json_namespace_fn g_config_json_namespace_fn[] = {
	NULL,
	nvme_ctrlr_config_json_standard_namespace,
	bdev_ocssd_namespace_config_json,
};

struct spdk_nvme_qpair *
@@ -1083,13 +1079,6 @@ bdev_nvme_create_ctrlr_channel_cb(void *io_device, void *ctx_buf)

	TAILQ_INIT(&ctrlr_ch->pending_resets);

	if (spdk_nvme_ctrlr_is_ocssd_supported(nvme_ctrlr->ctrlr)) {
		rc = bdev_ocssd_create_io_channel(ctrlr_ch);
		if (rc != 0) {
			goto err_ocssd_ch;
		}
	}

	ctrlr_ch->ctrlr = nvme_ctrlr;

	rc = bdev_nvme_create_qpair(ctrlr_ch);
@@ -1100,10 +1089,6 @@ bdev_nvme_create_ctrlr_channel_cb(void *io_device, void *ctx_buf)
	return 0;

err_qpair:
	if (ctrlr_ch->ocssd_ch) {
		bdev_ocssd_destroy_io_channel(ctrlr_ch);
	}
err_ocssd_ch:
	spdk_put_io_channel(pg_ch);

	return rc;
@@ -1116,10 +1101,6 @@ bdev_nvme_destroy_ctrlr_channel_cb(void *io_device, void *ctx_buf)

	assert(ctrlr_ch->group != NULL);

	if (ctrlr_ch->ocssd_ch != NULL) {
		bdev_ocssd_destroy_io_channel(ctrlr_ch);
	}

	bdev_nvme_destroy_qpair(ctrlr_ch);

	spdk_put_io_channel(spdk_io_channel_from_ctx(ctrlr_ch->group));
@@ -1852,11 +1833,7 @@ nvme_ctrlr_populate_namespaces(struct nvme_ctrlr *nvme_ctrlr,
		if (!nvme_ns->populated && ns_is_active) {
			nvme_ns->id = nsid;
			nvme_ns->ctrlr = nvme_ctrlr;
			if (spdk_nvme_ctrlr_is_ocssd_supported(ctrlr)) {
				nvme_ns->type = NVME_NS_OCSSD;
			} else {
			nvme_ns->type = NVME_NS_STANDARD;
			}

			nvme_ns->bdev = NULL;

@@ -1996,10 +1973,6 @@ aer_cb(void *arg, const struct spdk_nvme_cpl *cpl)
	if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
	    (event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED)) {
		nvme_ctrlr_populate_namespaces(nvme_ctrlr, NULL);
	} else if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_VENDOR) &&
		   (event.bits.log_page_identifier == SPDK_OCSSD_LOG_CHUNK_NOTIFICATION) &&
		   spdk_nvme_ctrlr_is_ocssd_supported(nvme_ctrlr->ctrlr)) {
		bdev_ocssd_handle_chunk_notification(nvme_ctrlr);
	} else if ((event.bits.async_event_type == SPDK_NVME_ASYNC_EVENT_TYPE_NOTICE) &&
		   (event.bits.async_event_info == SPDK_NVME_ASYNC_EVENT_ANA_CHANGE)) {
		nvme_ctrlr_read_ana_log_page(nvme_ctrlr);
@@ -2172,12 +2145,10 @@ nvme_ctrlr_create(struct spdk_nvme_ctrlr *ctrlr,
	}

	if (spdk_nvme_ctrlr_is_ocssd_supported(ctrlr)) {
		rc = bdev_ocssd_init_ctrlr(nvme_ctrlr);
		if (spdk_unlikely(rc != 0)) {
			SPDK_ERRLOG("Unable to initialize OCSSD controller\n");
		SPDK_ERRLOG("OCSSDs are not supported");
		rc = -ENOTSUP;
		goto err;
	}
	}

	nvme_ctrlr->prchk_flags = prchk_flags;

Loading