2016-06-06 21:44:30 +00:00
|
|
|
/*-
|
|
|
|
* BSD LICENSE
|
|
|
|
*
|
|
|
|
* Copyright (c) Intel Corporation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* * Neither the name of Intel Corporation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
#ifndef SPDK_NVMF_CTRLR_H
|
|
|
|
#define SPDK_NVMF_CTRLR_H
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2017-05-02 18:18:25 +00:00
|
|
|
#include "spdk/stdinc.h"
|
2016-06-06 21:44:30 +00:00
|
|
|
|
|
|
|
#include "spdk/nvmf_spec.h"
|
|
|
|
#include "spdk/queue.h"
|
|
|
|
|
|
|
|
/* define a virtual controller limit to the number of QPs supported */
|
2017-07-13 21:18:08 +00:00
|
|
|
#define MAX_QPAIRS_PER_CTRLR 64
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2016-07-15 21:45:26 +00:00
|
|
|
struct spdk_nvmf_transport;
|
2016-11-22 22:20:47 +00:00
|
|
|
struct spdk_nvmf_request;
|
2016-07-15 21:45:26 +00:00
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
enum spdk_nvmf_qpair_type {
|
|
|
|
QPAIR_TYPE_AQ = 0,
|
|
|
|
QPAIR_TYPE_IOQ = 1,
|
2016-07-15 21:45:26 +00:00
|
|
|
};
|
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
struct spdk_nvmf_qpair {
|
2017-07-24 23:30:07 +00:00
|
|
|
struct spdk_nvmf_transport *transport;
|
2017-07-13 21:18:08 +00:00
|
|
|
struct spdk_nvmf_ctrlr *ctrlr;
|
2017-07-13 21:30:28 +00:00
|
|
|
enum spdk_nvmf_qpair_type type;
|
2016-07-15 21:45:26 +00:00
|
|
|
|
2017-06-16 17:06:09 +00:00
|
|
|
uint16_t qid;
|
2016-07-15 21:45:26 +00:00
|
|
|
uint16_t sq_head;
|
2016-08-05 22:06:05 +00:00
|
|
|
uint16_t sq_head_max;
|
2016-07-15 21:45:26 +00:00
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
TAILQ_ENTRY(spdk_nvmf_qpair) link;
|
2016-07-15 21:45:26 +00:00
|
|
|
};
|
|
|
|
|
2016-06-06 21:44:30 +00:00
|
|
|
/*
|
2017-07-13 21:18:08 +00:00
|
|
|
* This structure represents an NVMe-oF controller,
|
|
|
|
* which is like a "session" in networking terms.
|
2016-06-06 21:44:30 +00:00
|
|
|
*/
|
2017-07-13 21:18:08 +00:00
|
|
|
struct spdk_nvmf_ctrlr {
|
2017-01-13 22:07:38 +00:00
|
|
|
uint16_t cntlid;
|
2016-09-19 20:29:17 +00:00
|
|
|
struct spdk_nvmf_subsystem *subsys;
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2016-07-07 22:32:04 +00:00
|
|
|
struct {
|
|
|
|
union spdk_nvme_cap_register cap;
|
|
|
|
union spdk_nvme_vs_register vs;
|
|
|
|
union spdk_nvme_cc_register cc;
|
|
|
|
union spdk_nvme_csts_register csts;
|
|
|
|
} vcprop; /* virtual controller properties */
|
2016-06-06 21:44:30 +00:00
|
|
|
struct spdk_nvme_ctrlr_data vcdata; /* virtual controller data */
|
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
TAILQ_HEAD(, spdk_nvmf_qpair) qpairs;
|
|
|
|
int num_qpairs;
|
|
|
|
int max_qpairs_allowed;
|
2016-08-15 01:16:49 +00:00
|
|
|
uint32_t kato;
|
2016-11-18 22:32:02 +00:00
|
|
|
union {
|
|
|
|
uint32_t raw;
|
|
|
|
struct {
|
|
|
|
union spdk_nvme_critical_warning_state crit_warn;
|
|
|
|
uint8_t ns_attr_notice : 1;
|
|
|
|
uint8_t fw_activation_notice : 1;
|
|
|
|
} bits;
|
|
|
|
} async_event_config;
|
2017-02-10 08:34:08 +00:00
|
|
|
struct spdk_nvmf_request *aer_req;
|
2016-11-22 22:20:47 +00:00
|
|
|
uint8_t hostid[16];
|
2017-07-24 23:30:07 +00:00
|
|
|
struct spdk_nvmf_transport *transport;
|
2016-07-26 23:34:12 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
TAILQ_ENTRY(spdk_nvmf_ctrlr) link;
|
2016-06-06 21:44:30 +00:00
|
|
|
};
|
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
void spdk_nvmf_ctrlr_connect(struct spdk_nvmf_qpair *qpair,
|
2017-07-13 21:18:08 +00:00
|
|
|
struct spdk_nvmf_fabric_connect_cmd *cmd,
|
|
|
|
struct spdk_nvmf_fabric_connect_data *data,
|
|
|
|
struct spdk_nvmf_fabric_connect_rsp *rsp);
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
struct spdk_nvmf_qpair *spdk_nvmf_ctrlr_get_qpair(struct spdk_nvmf_ctrlr *ctrlr, uint16_t qid);
|
2017-06-16 17:06:09 +00:00
|
|
|
|
2017-07-13 21:30:28 +00:00
|
|
|
struct spdk_nvmf_request *spdk_nvmf_qpair_get_request(struct spdk_nvmf_qpair *qpair, uint16_t cid);
|
2017-06-16 17:06:09 +00:00
|
|
|
|
2016-06-06 21:44:30 +00:00
|
|
|
void
|
2017-07-13 21:18:08 +00:00
|
|
|
spdk_nvmf_property_get(struct spdk_nvmf_ctrlr *ctrlr,
|
2016-09-23 02:05:45 +00:00
|
|
|
struct spdk_nvmf_fabric_prop_get_cmd *cmd,
|
|
|
|
struct spdk_nvmf_fabric_prop_get_rsp *response);
|
2016-06-06 21:44:30 +00:00
|
|
|
|
|
|
|
void
|
2017-07-13 21:18:08 +00:00
|
|
|
spdk_nvmf_property_set(struct spdk_nvmf_ctrlr *ctrlr,
|
2016-09-23 02:05:45 +00:00
|
|
|
struct spdk_nvmf_fabric_prop_set_cmd *cmd,
|
|
|
|
struct spdk_nvme_cpl *rsp);
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_poll(struct spdk_nvmf_ctrlr *ctrlr);
|
2016-06-06 21:44:30 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
void spdk_nvmf_ctrlr_destruct(struct spdk_nvmf_ctrlr *ctrlr);
|
2016-07-11 21:08:31 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_set_features_host_identifier(struct spdk_nvmf_request *req);
|
|
|
|
int spdk_nvmf_ctrlr_get_features_host_identifier(struct spdk_nvmf_request *req);
|
2016-11-22 22:20:47 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_set_features_keep_alive_timer(struct spdk_nvmf_request *req);
|
|
|
|
int spdk_nvmf_ctrlr_get_features_keep_alive_timer(struct spdk_nvmf_request *req);
|
2016-11-22 22:54:42 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_set_features_number_of_queues(struct spdk_nvmf_request *req);
|
|
|
|
int spdk_nvmf_ctrlr_get_features_number_of_queues(struct spdk_nvmf_request *req);
|
2016-11-22 23:08:50 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_set_features_async_event_configuration(struct spdk_nvmf_request *req);
|
|
|
|
int spdk_nvmf_ctrlr_get_features_async_event_configuration(struct spdk_nvmf_request *req);
|
2017-02-14 23:56:29 +00:00
|
|
|
|
2017-07-13 21:18:08 +00:00
|
|
|
int spdk_nvmf_ctrlr_async_event_request(struct spdk_nvmf_request *req);
|
2017-03-01 17:53:18 +00:00
|
|
|
|
2016-06-06 21:44:30 +00:00
|
|
|
#endif
|