libnvmf: Fix a typo in a source code comment- s/tranfers/transfers/MFC after: 3 days
Remove redundant PACKAGE for INTERNALLIB librariesThese libraries don't install anything, so they shouldn't have aPACKAGE setting. This avoids surprising behaviour in future ife.g. manpages are
Remove redundant PACKAGE for INTERNALLIB librariesThese libraries don't install anything, so they shouldn't have aPACKAGE setting. This avoids surprising behaviour in future ife.g. manpages are added to an internal library.Reported by: desDifferential Revision: https://reviews.freebsd.org/D51901
show more ...
libnvmf: Fix header to work with C++Sponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D51727
libnvmf: Add nvmf_nqn_valid_strict() functionThis moves the checks previously under #ifdef STRICT innvmf_nqn_valid() into a separate helper for userland. Thisrequires that the NQN starts with "n
libnvmf: Add nvmf_nqn_valid_strict() functionThis moves the checks previously under #ifdef STRICT innvmf_nqn_valid() into a separate helper for userland. Thisrequires that the NQN starts with "nqn.YYYY-MM." followed by atleast one additional character.Reviewed by: asomersDifferential Revision: https://reviews.freebsd.org/D48767
nvmf: Auto-reconnect periodically after a disconnectUse a timer in the nvmf(4) driver to periodically trigger a devctl"RECONNECT" notification. A trigger in the /etc/devd/nvmf.conf fileinvokes "
nvmf: Auto-reconnect periodically after a disconnectUse a timer in the nvmf(4) driver to periodically trigger a devctl"RECONNECT" notification. A trigger in the /etc/devd/nvmf.conf fileinvokes "nvmecontrol reconnect nvmeX" upon each notification. Thisdiffers from iSCSI which uses a dedicated daemon (iscsid(8)) to waitinside a custom ioctl for an iSCSI initiator event to occur, but Ithink this design might be simpler.Similar to nvme-cli, the interval between reconnection attempts isspecified in seconds by the --reconnect-delay argument to the connectand reconnect commands. Note that nvme-cli uses -c for short letterof this command, but that was already taken so nvmecontrol uses -r.The default is 10 seconds to match Linux.In addition, a second timeout can be used to force a full detach of adisconnected the nvmeX device after the controller loss timeoutexpires. The timeout for this is specified in seconds by the--ctrl-loss-tmo/-l options (identical to nvme-cli). The default is600 seconds.Either of these timers can be disabled by setting the timer to 0. Inthat case, the associated action (devctl notifications or full detach)will not occur after a disconnect.Note that this adds a dedicated taskqueue for nvmf tasks instead ofusing taskqueue_thread as the controller loss task could deadlockwaiting for the completion of other tasks queued to taskqueue_thread.(Specifically, tearing down the CAM SIM can triggerdestroy_dev_sched_cb() and waits for the callback to run, but thecallback is scheduled to run in a task on taskqueue_thread. Possibly,destroy_dev_sched should be using a dedicated taskqueue.)Reviewed by: imp (earlier version)Sponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D50222
nvmf: Add NVMF_CONNECTION_STATUS ioctlThis returns an nvlist indicating if a Fabrics host is connected andthe time of the most recent disconnection.Reviewed by: impSponsored by: Chelsio Communi
nvmf: Add NVMF_CONNECTION_STATUS ioctlThis returns an nvlist indicating if a Fabrics host is connected andthe time of the most recent disconnection.Reviewed by: impSponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D48219
nvmf: Refactor reconnection supportSave more data associated with a new association including the networkaddress of the remote controller. This permits reconnecting anassociation without providi
nvmf: Refactor reconnection supportSave more data associated with a new association including the networkaddress of the remote controller. This permits reconnecting anassociation without providing the address or other details. To usethis new mode, provide only an existing device ID to nvmecontrol'sreconnect command. An address can still be provided to request adifferent address or other different settings for the new association.The saved data includes an entire Discovery Log page entry to aim tobe compatible with other transports in the future. When a remotecontroller is connected to via a Discovery Log page entry (nvmecontrolconnect-all), the raw entry is used. When a remote controller isconnected to via an explicit address, an entry is synthesized from theparameters.Note that this is a pseudo-ABI break for the ioctls used by nvmf(4) inthat the nvlists for handoff and reconnect now use a slightlydifferent set of elements. Since this is only present in main I didnot bother implementing compatability shims.Sponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D48214
nvmf: Switch several ioctls to using nvlistsFor requests that handoff queues from userspace to the kernel as wellas the request to fetch reconnect parameters from the kernel, switchfrom using fla
nvmf: Switch several ioctls to using nvlistsFor requests that handoff queues from userspace to the kernel as wellas the request to fetch reconnect parameters from the kernel, switchfrom using flat structures to nvlists. In particular, this willpermit adding support for additional transports in the future withoutbreaking the ABI of the structures.Note that this is an ABI break for the ioctls used by nvmf(4) andnvmft(4). Since this is only present in main I did not botherimplementing compatability shims.Inspired by: imp (suggestion on a different review)Reviewed by: impSponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D48230
nvmf_tcp: Correct padding calculationPDU data alignment (PDA) isn't necessarily a power of 2, just amultiple of 4, so use roundup() instead of roundup2() to compute thePDU data offset (PDO).Spo
nvmf_tcp: Correct padding calculationPDU data alignment (PDA) isn't necessarily a power of 2, just amultiple of 4, so use roundup() instead of roundup2() to compute thePDU data offset (PDO).Sponsored by: Chelsio Communications
libnvmf: Correctly set the controller and host PDA fieldsThe caller supplied PDU data alignment (PDA) field fromnvmf_association_params is the caller's restriction on data alignment(so affects re
libnvmf: Correctly set the controller and host PDA fieldsThe caller supplied PDU data alignment (PDA) field fromnvmf_association_params is the caller's restriction on data alignment(so affects received PDUs), and the PDA value received from the otherend is the remote end's restriction (so affects transmitted PDUs).I had these backwards so that if the remote end advertised a PDA itwas used as the receive PDA instead of the transmit PDA.Sponsored by: Chelsio Communications
Update Makefile.depend filesAfter building packages we have a number of newand updated Makefile.depend filesReviewed by: stevek
libnvmf: Reject invalid values of MAXH2CDATA for new associationsSponsored by: Chelsio Communications
libnvmf: Require MAXH2CDATA to be a multiple of 4The spec says MAXH2CDATA to is "a multiple of dwords and should be noless than 4,096".Sponsored by: Chelsio Communications
libnvmf: Zero controller data template for I/O controllersThis prevents stack garbage from leaking into the cdata used for theuserspace I/O controller in nvmfd(8).Sponsored by: Chelsio Communica
libnvmf: Zero controller data template for I/O controllersThis prevents stack garbage from leaking into the cdata used for theuserspace I/O controller in nvmfd(8).Sponsored by: Chelsio Communications
libnvmf: avoid resource leakIn nvmf_host_fetch_discovery_log_page(), the log variable may have beenallocated on the heap during the first loop cycle, and should befree()'d before exiting upon err
libnvmf: avoid resource leakIn nvmf_host_fetch_discovery_log_page(), the log variable may have beenallocated on the heap during the first loop cycle, and should befree()'d before exiting upon errors.Reported by: CoverityCID: 1545034Sponsored by: The FreeBSD FoundationReviewed by: imp,jhbPull Request: https://github.com/freebsd/freebsd-src/pull/1239
nvmf_tcp: Correct tests for PDU directionAdd parentheses to ensure the correct order of operations.Reported by: GCC
libnvmf: Add internal library to support NVMe over Fabricslibnvmf provides APIs for transmitting and receiving Command andResponse capsules along with data associated with NVMe commands.Capsules
libnvmf: Add internal library to support NVMe over Fabricslibnvmf provides APIs for transmitting and receiving Command andResponse capsules along with data associated with NVMe commands.Capsules are represented by 'struct nvmf_capsule' objects.Capsules are transmitted and received on queue pairs represented by'struct nvmf_qpair' objects.Queue pairs belong to an association represented by a 'structnvmf_association' object.libnvmf provides additional helper APIs to assist with constructingcommand capsules for a host, response capsules for a controller,connecting queue pairs to a remote controller and optionallyoffloading connected queues to an in-kernel host, accepting queue pairconnections from remote hosts and optionally offloading connectedqueues to an in-kernel controller, constructing controller datastructures for local controllers, etc.libnvmf also includes an internal transport abstraction as well as animplementation of a userspace TCP transport.libnvmf is primarily intended for ease of use and low-traffic use casessuch as establishing connections that are handed off to the kernel.As such, it uses a simple API built on blocking I/O.For a host, a consumer first populates an 'structnvmf_association_params' with a set of parameters shared by all queuepairs for a single association such as whether or not to use SQ flowcontrol and header and data digests and creates a 'structnvmf_association' object. The consumer is responsible forestablishing a TCP socket for each queue pair. This socket isincluded in the 'struct nvmf_qpair_params' passed to 'nvmf_connect' tocomplete transport-specific negotiation, send a Fabrics Connectcommand, and wait for the Connect reply. Upon success, a new 'structnvmf_qpair' object is returned. This queue pair can then be used tosend and receive capsules. A command capsule is allocated, populatedwith an SQE and optional data buffer, and transmitted vianvmf_host_transmit_command. The consumer can then wait for a replyvia nvmf_host_wait_for_response. The library also provides somewrapper functions such as nvmf_read_property and nvmf_write_propertywhich send a command and wait for a response synchronously.For a controller, a consumer uses a single association for a set ofincoming connections. A consumer can choose to use multipleassociations (e.g. a separate association for connections to adiscovery controller listening on a different port than I/Ocontrollers). The consumer is responsible for accepting TCP socketsdirectly, but once a socket has been accepted it is passed tonvmf_accept to perform transport-specific negotiation and wait for theConnect command. Similar to nvmf_connect, nvmf_accept returns a newlyconstruct nvmf_qpair. However, in contrast to nvmf_connect,nvmf_accept does not complete the Fabrics negotiation. The consumermust explicitly send a response capsule before waiting for additionalcommand capsules to arrive. In particular, in the kernel offloadcase, the Connect command and data are provided to the kernelcontroller and the Connect response capsule is sent by the kernel onceit is ready to handle the new queue pair.For userspace controller command handling, the consumer usesnvmf_controller_receive_capsule to wait for a command capsule.nvmf_receive_controller_data is used to retrieve any data from acommand (e.g. the data for a WRITE command). It can be calledmultiple times to split the data transfer into smaller sizes.nvmf_send_controller_data is used to send data to a remote host inresponse to a command. It also sends a response capsule indicatingsuccess, or an error if an internal error occurs. nvmf_send_responseis used to send a response without associated data. There are alsoseveral convenience wrappers such as nvmf_send_success andnvmf_send_generic_error.Reviewed by: impSponsored by: Chelsio CommunicationsDifferential Revision: https://reviews.freebsd.org/D44710