nvme/opal: introduce a session concept disaggregate data buffers

Althrough the controller can only support 1 session, but we can refactor
the OPAL internal APIs running based on session, then we can allocate
a session from public APIs, currently we just use the session that
embedded in the global device structure.

No actual logic change from this patch.

Change-Id: Ifbc801970f3df6f0753a5796715667f2eaf664aa
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1520
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2020-03-26 23:35:32 +08:00
parent 35aab73cc2
commit a5836c6d99
2 changed files with 356 additions and 342 deletions

File diff suppressed because it is too large Load Diff

View File

@ -268,19 +268,23 @@ struct spdk_opal_header {
struct spdk_opal_data_subpacket sub_packet;
};
struct opal_session {
uint32_t hsn;
uint32_t tsn;
size_t cmd_pos;
uint8_t cmd[IO_BUFFER_LENGTH];
uint8_t resp[IO_BUFFER_LENGTH];
struct spdk_opal_resp_parsed parsed_resp;
};
struct spdk_opal_dev {
bool supported;
struct spdk_nvme_ctrlr *ctrlr;
uint16_t comid;
uint32_t hsn;
uint32_t tsn;
size_t cmd_pos;
uint8_t cmd[IO_BUFFER_LENGTH];
uint8_t resp[IO_BUFFER_LENGTH];
struct spdk_opal_resp_parsed parsed_resp;
/* Only one session can be supported */
struct opal_session sess;
struct spdk_opal_d0_features_info feat_info;