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 /* Returns true if able to open a connection. */ 22 bool tcp_qpair_params(struct nvmf_qpair_params *params, int adrfam, 23 const char *address, const char *port); 24 25 /* Connect to a discovery controller and return the Admin qpair. */ 26 struct nvmf_qpair *connect_discovery_adminq(enum nvmf_trtype trtype, 27 const char *address, const char *port, const char *hostnqn); 28 29 /* 30 * Connect to an NVM controller establishing an Admin qpair and one or 31 * more I/O qpairs. The controller's controller data is returned in 32 * *cdata on success. Returns a non-zero value from <sysexits.h> on 33 * failure. 34 */ 35 int connect_nvm_queues(const struct nvmf_association_params *aparams, 36 enum nvmf_trtype trtype, int adrfam, const char *address, 37 const char *port, uint16_t cntlid, const char *subnqn, const char *hostnqn, 38 uint32_t kato, struct nvmf_qpair **admin, struct nvmf_qpair **io, 39 u_int num_io_queues, u_int queue_size, struct nvme_controller_data *cdata); 40 41 #endif /* !__FABRICS_H__ */ 42