1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2023-2024 Chelsio Communications, Inc. 5 * Written by: John Baldwin <jhb@FreeBSD.org> 6 */ 7 8 #ifndef __FABRICS_H__ 9 #define __FABRICS_H__ 10 11 /* 12 * Splits 'in_address' into separate 'address' and 'port' strings. If 13 * a separate buffer for the address was allocated, 'tofree' is set to 14 * the allocated buffer, otherwise 'tofree' is set to NULL. 15 */ 16 void nvmf_parse_address(const char *in_address, const char **address, 17 const char **port, char **tofree); 18 19 uint16_t nvmf_parse_cntlid(const char *cntlid); 20 21 const char *nvmf_default_hostnqn(void); 22 23 int nvmf_init_dle_from_address(enum nvmf_trtype trtype, const char *address, 24 const char *port, uint16_t cntlid, const char *subnqn, 25 struct nvme_discovery_log_entry *dle); 26 27 /* Connect to a discovery controller and return the Admin qpair. */ 28 struct nvmf_qpair *connect_discovery_adminq(enum nvmf_trtype trtype, 29 const char *address, const char *port, const char *hostnqn); 30 31 /* 32 * Connect to an NVM controller establishing an Admin qpair and one or 33 * more I/O qpairs. The controller's controller data is returned in 34 * *cdata on success. Returns a non-zero value from <sysexits.h> on 35 * failure. 36 */ 37 int connect_nvm_queues(const struct nvmf_association_params *aparams, 38 enum nvmf_trtype trtype, int adrfam, const char *address, 39 const char *port, uint16_t cntlid, const char *subnqn, const char *hostnqn, 40 uint32_t kato, struct nvmf_qpair **admin, struct nvmf_qpair **io, 41 u_int num_io_queues, u_int queue_size, struct nvme_controller_data *cdata); 42 43 /* 44 * Disconnect from an NVM controller disconnecting all queues and 45 * shutting down the controller. 46 */ 47 void disconnect_nvm_queues(struct nvmf_qpair *admin, struct nvmf_qpair **io, 48 u_int num_io_queues); 49 50 #endif /* !__FABRICS_H__ */ 51