Skip to content

Conversation

@igaw
Copy link
Collaborator

@igaw igaw commented Dec 16, 2025

In order to be able to really split the logic from the parsing code move the discovery and connect code to the library. Since some interaction between nvme-cli and library is necessary introduce a struct nvmf_context object which holds the configuration state and also callbacks. Since it should be extensible in future, don't expose the data structure. Just introduce setters for it. If we need to extend it, we can just add new setters and don't break existing code.

This series doesn't not really cleanup the existing code, it just moving around and starts introducing this new API. It needs more work but I think it's better to built on top of it instead trying to do all in one go.

This survives simple testing.

igaw added 4 commits December 10, 2025 16:18
This is a useful helper which can be reused inside the library as well.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
This is generic code for discovery, thus move it the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Move more of the discovery code from nvme-cli to the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Move the connect config json code to the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
igaw added 7 commits December 16, 2025 17:34
Move more discovery code to the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
The host_traddr and host_iface are property of the controller not of the
fabric configuration. Because the discovery API was stable, it ended up
in the fabric configuration. The discovery API is reworked thus we can
move it to where it actually belongs.

See also 9a4dd38 ("Move 'host_traddr' and 'host_iface' into fabrics
configuration").

Signed-off-by: Daniel Wagner <wagi@kernel.org>
The NVMF_ARGS macro parses the common arguments for the transport
configuration. Move all those open coded variables into a context, so
it's simpler to pass a complete configuration around.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Move the discovery config file to the library. Add a callback
interface to retrieve the next line to execute.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
The final discovery logic can be moved to the library now. This leaves
the nvme-cli with just the parsing operations and setting up the
discovery context and then the whole logic happens in the library.

The APIs are not final there are very rough and these need more
cleanups. But the important tasks was to move the logic code into the
library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
The connect and discovery APIs use a lot of common context information.
Thus generalize the discovery context into nvmf_context which then can
be used by either APIs types.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Move more of the logic code into the library.

Drop the nvmf_ prefix for the commands in nvme-cli so we can use it for
the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
There a arguments which are already stored in the nvmf_context object,
thus we can remove those.

While at it, also remove the host lookup and configuring code to the
library. Besides making the API more consistent it also more generic
code to the library.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
@igaw igaw force-pushed the refactor-fabrics branch 2 times, most recently from 7b12a63 to e2286c6 Compare December 17, 2025 12:18
Document the new APIs.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
@igaw igaw merged commit 1edfd3c into linux-nvme:master Dec 17, 2025
19 of 20 checks passed
@igaw igaw deleted the refactor-fabrics branch December 17, 2025 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant