nvmf: add discovery callback to transport
Make the transport responsible for filling out the fabric-specific details in the discovery log entry. Change-Id: I41d871c605becd557dca18f8ef7e80da66950257 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
21c450e187
commit
e3d9e24e20
@ -65,12 +65,6 @@ spdk_nvmf_fabric_intf_create(const struct spdk_nvmf_transport *transport, char *
|
|||||||
fabric_intf->host = host;
|
fabric_intf->host = host;
|
||||||
fabric_intf->sin_port = sin_port;
|
fabric_intf->sin_port = sin_port;
|
||||||
fabric_intf->transport = transport;
|
fabric_intf->transport = transport;
|
||||||
fabric_intf->trtype = SPDK_NVMF_TRANS_RDMA;
|
|
||||||
fabric_intf->adrfam = SPDK_NVMF_ADDR_FAMILY_IPV4;
|
|
||||||
fabric_intf->treq = SPDK_NVMF_TREQ_NOT_SPECIFIED;
|
|
||||||
fabric_intf->tsas.rdma.rdma_qptype = SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED;
|
|
||||||
fabric_intf->tsas.rdma.rdma_prtype = SPDK_NVMF_RDMA_NO_PROVIDER;
|
|
||||||
fabric_intf->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
|
|
||||||
|
|
||||||
return fabric_intf;
|
return fabric_intf;
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,6 @@ struct spdk_nvmf_fabric_intf {
|
|||||||
char *sin_port;
|
char *sin_port;
|
||||||
struct spdk_nvmf_port *port;
|
struct spdk_nvmf_port *port;
|
||||||
const struct spdk_nvmf_transport *transport;
|
const struct spdk_nvmf_transport *transport;
|
||||||
enum spdk_nvmf_transport_types trtype;
|
|
||||||
enum spdk_nvmf_address_family_types adrfam;
|
|
||||||
enum spdk_nvmf_transport_requirements treq;
|
|
||||||
union spdk_nvmf_transport_specific_address_subtype tsas;
|
|
||||||
uint32_t num_sessions;
|
uint32_t num_sessions;
|
||||||
TAILQ_ENTRY(spdk_nvmf_fabric_intf) tailq;
|
TAILQ_ENTRY(spdk_nvmf_fabric_intf) tailq;
|
||||||
};
|
};
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include <rdma/rdma_cma.h>
|
#include <rdma/rdma_cma.h>
|
||||||
#include <rdma/rdma_verbs.h>
|
#include <rdma/rdma_verbs.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <rte_config.h>
|
#include <rte_config.h>
|
||||||
@ -54,6 +55,7 @@
|
|||||||
#include "transport.h"
|
#include "transport.h"
|
||||||
#include "spdk/assert.h"
|
#include "spdk/assert.h"
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
|
#include "spdk/nvmf_spec.h"
|
||||||
#include "spdk/trace.h"
|
#include "spdk/trace.h"
|
||||||
|
|
||||||
#define ACCEPT_TIMEOUT (rte_get_timer_hz() >> 10) /* ~1ms */
|
#define ACCEPT_TIMEOUT (rte_get_timer_hz() >> 10) /* ~1ms */
|
||||||
@ -1175,6 +1177,22 @@ nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn)
|
|||||||
return cq_count;
|
return cq_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvmf_rdma_discover(struct spdk_nvmf_fabric_intf *fabric_intf,
|
||||||
|
struct spdk_nvmf_discovery_log_page_entry *entry)
|
||||||
|
{
|
||||||
|
entry->trtype = SPDK_NVMF_TRANS_RDMA;
|
||||||
|
entry->adrfam = SPDK_NVMF_ADDR_FAMILY_IPV4;
|
||||||
|
entry->treq = SPDK_NVMF_TREQ_NOT_SPECIFIED;
|
||||||
|
|
||||||
|
snprintf(entry->trsvcid, sizeof(entry->trsvcid), "%s", fabric_intf->sin_port);
|
||||||
|
snprintf(entry->traddr, sizeof(entry->traddr), "%s", fabric_intf->host);
|
||||||
|
|
||||||
|
entry->tsas.rdma.rdma_qptype = SPDK_NVMF_QP_TYPE_RELIABLE_CONNECTED;
|
||||||
|
entry->tsas.rdma.rdma_prtype = SPDK_NVMF_RDMA_NO_PROVIDER;
|
||||||
|
entry->tsas.rdma.rdma_cms = SPDK_NVMF_RDMA_CMS_RDMA_CM;
|
||||||
|
}
|
||||||
|
|
||||||
const struct spdk_nvmf_transport spdk_nvmf_transport_rdma = {
|
const struct spdk_nvmf_transport spdk_nvmf_transport_rdma = {
|
||||||
.name = "rdma",
|
.name = "rdma",
|
||||||
.transport_init = spdk_nvmf_rdma_init,
|
.transport_init = spdk_nvmf_rdma_init,
|
||||||
@ -1187,6 +1205,8 @@ const struct spdk_nvmf_transport spdk_nvmf_transport_rdma = {
|
|||||||
.conn_init = spdk_nvmf_rdma_alloc_reqs,
|
.conn_init = spdk_nvmf_rdma_alloc_reqs,
|
||||||
.conn_fini = nvmf_rdma_conn_cleanup,
|
.conn_fini = nvmf_rdma_conn_cleanup,
|
||||||
.conn_poll = nvmf_check_rdma_completions,
|
.conn_poll = nvmf_check_rdma_completions,
|
||||||
|
|
||||||
|
.fabric_intf_discover = nvmf_rdma_discover,
|
||||||
};
|
};
|
||||||
|
|
||||||
SPDK_LOG_REGISTER_TRACE_FLAG("rdma", SPDK_TRACE_RDMA)
|
SPDK_LOG_REGISTER_TRACE_FLAG("rdma", SPDK_TRACE_RDMA)
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "nvmf_internal.h"
|
#include "nvmf_internal.h"
|
||||||
#include "session.h"
|
#include "session.h"
|
||||||
#include "subsystem.h"
|
#include "subsystem.h"
|
||||||
|
#include "transport.h"
|
||||||
#include "spdk/log.h"
|
#include "spdk/log.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
#include "spdk/trace.h"
|
#include "spdk/trace.h"
|
||||||
@ -241,17 +242,13 @@ spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
entry = &disc_log->entries[numrec];
|
entry = &disc_log->entries[numrec];
|
||||||
entry->trtype = fabric_intf->trtype;
|
|
||||||
entry->adrfam = fabric_intf->adrfam;
|
|
||||||
entry->treq = fabric_intf->treq;
|
|
||||||
entry->portid = port->tag;
|
entry->portid = port->tag;
|
||||||
/* Dynamic controllers */
|
/* Dynamic controllers */
|
||||||
entry->cntlid = 0xffff;
|
entry->cntlid = 0xffff;
|
||||||
entry->subtype = subsystem->subtype;
|
entry->subtype = subsystem->subtype;
|
||||||
snprintf(entry->trsvcid, 32, "%s", fabric_intf->sin_port);
|
|
||||||
snprintf(entry->traddr, 256, "%s", fabric_intf->host);
|
|
||||||
snprintf(entry->subnqn, 256, "%s", subsystem->subnqn);
|
snprintf(entry->subnqn, 256, "%s", subsystem->subnqn);
|
||||||
entry->tsas = fabric_intf->tsas;
|
|
||||||
|
fabric_intf->transport->fabric_intf_discover(fabric_intf, entry);
|
||||||
}
|
}
|
||||||
numrec++;
|
numrec++;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#define SPDK_NVMF_TRANSPORT_H
|
#define SPDK_NVMF_TRANSPORT_H
|
||||||
|
|
||||||
struct spdk_nvmf_conn;
|
struct spdk_nvmf_conn;
|
||||||
|
struct spdk_nvmf_discovery_log_page_entry;
|
||||||
|
struct spdk_nvmf_fabric_intf;
|
||||||
struct spdk_nvmf_request;
|
struct spdk_nvmf_request;
|
||||||
|
|
||||||
struct spdk_nvmf_transport {
|
struct spdk_nvmf_transport {
|
||||||
@ -82,6 +84,12 @@ struct spdk_nvmf_transport {
|
|||||||
* Poll a connection for events.
|
* Poll a connection for events.
|
||||||
*/
|
*/
|
||||||
int (*conn_poll)(struct spdk_nvmf_conn *conn);
|
int (*conn_poll)(struct spdk_nvmf_conn *conn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill out a discovery log entry for a specific fabric interface.
|
||||||
|
*/
|
||||||
|
void (*fabric_intf_discover)(struct spdk_nvmf_fabric_intf *fabric_intf,
|
||||||
|
struct spdk_nvmf_discovery_log_page_entry *entry);
|
||||||
};
|
};
|
||||||
|
|
||||||
int spdk_nvmf_transport_init(void);
|
int spdk_nvmf_transport_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user