mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-22 03:04:34 +01:00
a8089ea5ae
This daemon can operate as a purely userspace controller exporting one or more simulated RAM disks or local block devices as NVMe namespaces to a remote host. In this case the daemon provides a discovery controller with a single entry for an I/O controller. nvmfd can also offload I/O controller queue pairs to the nvmft.ko in-kernel Fabrics controller when -K is passed. In this mode, nvmfd still accepts connections and performs initial transport-specific negotitation in userland. The daemon still provides a userspace-only discovery controller with a single entry for an I/O controller. However, queue pairs for the I/O controller are handed off to the CTL NVMF frontend. Eventually ctld(8) should be refactored to to provide an abstraction for the frontend protocol and the discovery and the kernel mode of this daemon should be merged into ctld(8). At that point this daemon can be moved to tools/tools/nvmf as a debugging tool (mostly as sample code for a userspace controller using libnvmf). Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44731
66 lines
1.9 KiB
C
66 lines
1.9 KiB
C
/*-
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2023-2024 Chelsio Communications, Inc.
|
|
* Written by: John Baldwin <jhb@FreeBSD.org>
|
|
*/
|
|
|
|
#ifndef __INTERNAL_H__
|
|
#define __INTERNAL_H__
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct controller;
|
|
struct nvme_command;
|
|
struct nvme_controller_data;
|
|
struct nvme_ns_list;
|
|
struct nvmf_capsule;
|
|
struct nvmf_qpair;
|
|
|
|
typedef bool handle_command(const struct nvmf_capsule *,
|
|
const struct nvme_command *, void *);
|
|
|
|
extern bool data_digests;
|
|
extern bool header_digests;
|
|
extern bool flow_control_disable;
|
|
extern bool kernel_io;
|
|
|
|
/* controller.c */
|
|
void controller_handle_admin_commands(struct controller *c,
|
|
handle_command *cb, void *cb_arg);
|
|
struct controller *init_controller(struct nvmf_qpair *qp,
|
|
const struct nvme_controller_data *cdata);
|
|
void free_controller(struct controller *c);
|
|
|
|
/* discovery.c */
|
|
void init_discovery(void);
|
|
void handle_discovery_socket(int s);
|
|
void discovery_add_io_controller(int s, const char *subnqn);
|
|
|
|
/* io.c */
|
|
void init_io(const char *subnqn);
|
|
void handle_io_socket(int s);
|
|
void shutdown_io(void);
|
|
|
|
/* devices.c */
|
|
void register_devices(int ac, char **av);
|
|
u_int device_count(void);
|
|
void device_active_nslist(uint32_t nsid, struct nvme_ns_list *nslist);
|
|
bool device_identification_descriptor(uint32_t nsid, void *buf);
|
|
bool device_namespace_data(uint32_t nsid, struct nvme_namespace_data *nsdata);
|
|
void device_read(uint32_t nsid, uint64_t lba, u_int nlb,
|
|
const struct nvmf_capsule *nc);
|
|
void device_write(uint32_t nsid, uint64_t lba, u_int nlb,
|
|
const struct nvmf_capsule *nc);
|
|
void device_flush(uint32_t nsid, const struct nvmf_capsule *nc);
|
|
|
|
/* ctl.c */
|
|
void init_ctl_port(const char *subnqn,
|
|
const struct nvmf_association_params *params);
|
|
void ctl_handoff_qpair(struct nvmf_qpair *qp,
|
|
const struct nvmf_fabric_connect_cmd *cmd,
|
|
const struct nvmf_fabric_connect_data *data);
|
|
void shutdown_ctl_port(const char *subnqn);
|
|
|
|
#endif /* !__INTERNAL_H__ */
|