HardenedBSD/sbin/nvmecontrol/fabrics.h
John Baldwin 1058c12197 nvmecontrol: New commands to support Fabrics hosts
- discover: Connects to a remote Discovery controller, fetches its
  Discovery Log Page, and enumerates the remote controllers described
  in the log page.

  The -v option can be used to display the Identify Controller data
  structure for the Discovery controller.  This is only really useful
  for debugging.

- connect: Connects to a remote I/O controller and establishes an
  association of an admin queue and a single I/O queue.  The
  association is handed off to the in-kernel host to create a new
  nvmeX device.

- connect-all: Connects to a Discovery controller and attempts to
  create an association with each I/O controller enumerated in the
  Discovery controller's Discovery Log Page.

- reconnect: Establishes a new association with a remote I/O
  controller for an existing nvmeX device.  This can be used to
  restore access to a remote I/O controller after the loss of a prior
  association due to a transport error, controller reboot, etc.

- disconnect: Deletes one or more nvmeX devices after detaching its
  namespaces and terminating any active associations.  The devices to
  delete can be identified by either a nvmeX device name or the NQN of
  the remote controller.

- disconnect-all: Deletes all active associations with remote
  controllers.

Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44715
2024-05-02 16:30:10 -07:00

42 lines
1.5 KiB
C

/*-
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2023-2024 Chelsio Communications, Inc.
* Written by: John Baldwin <jhb@FreeBSD.org>
*/
#ifndef __FABRICS_H__
#define __FABRICS_H__
/*
* Splits 'in_address' into separate 'address' and 'port' strings. If
* a separate buffer for the address was allocated, 'tofree' is set to
* the allocated buffer, otherwise 'tofree' is set to NULL.
*/
void nvmf_parse_address(const char *in_address, const char **address,
const char **port, char **tofree);
uint16_t nvmf_parse_cntlid(const char *cntlid);
/* Returns true if able to open a connection. */
bool tcp_qpair_params(struct nvmf_qpair_params *params, int adrfam,
const char *address, const char *port);
/* Connect to a discovery controller and return the Admin qpair. */
struct nvmf_qpair *connect_discovery_adminq(enum nvmf_trtype trtype,
const char *address, const char *port, const char *hostnqn);
/*
* Connect to an NVM controller establishing an Admin qpair and one or
* more I/O qpairs. The controller's controller data is returned in
* *cdata on success. Returns a non-zero value from <sysexits.h> on
* failure.
*/
int connect_nvm_queues(const struct nvmf_association_params *aparams,
enum nvmf_trtype trtype, int adrfam, const char *address,
const char *port, uint16_t cntlid, const char *subnqn, const char *hostnqn,
uint32_t kato, struct nvmf_qpair **admin, struct nvmf_qpair **io,
u_int num_io_queues, u_int queue_size, struct nvme_controller_data *cdata);
#endif /* !__FABRICS_H__ */