Page MenuHomeFreeBSD

ctld: Add abstractions to support multiple target protocols
ClosedPublic

Authored by jhb on Jan 31 2025, 8:16 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 1, 2:36 PM
Unknown Object (File)
Sat, Sep 27, 4:36 AM
Unknown Object (File)
Tue, Sep 23, 1:21 AM
Unknown Object (File)
Sep 17 2025, 2:55 PM
Unknown Object (File)
Sep 17 2025, 6:59 AM
Unknown Object (File)
Sep 15 2025, 8:48 AM
Unknown Object (File)
Sep 10 2025, 12:04 PM
Unknown Object (File)
Sep 10 2025, 2:54 AM
Subscribers

Details

Summary

This is a prerequisite for adding NVMe over Fabrics support.

Convert portal_group, portal_group_port, and target into abstract
classes with virtual methods to support protocol-specific methods.

Add new iscsi_portal_group, iscsi_port, iscsi_portal and iscsi_target
subclasses in a new iscsi.cc file and move some iSCSI-specific logic
there. Rename ctld_connection to iscsi_connection and move it to a
new iscsi.hh header. Move iscsi_connection methods out of ctld.cc and
kernel.cc into iscsi.cc.

Sponsored by: Chelsio Communications

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Jan 31 2025, 8:16 PM

Rebase after fixing previous patch

usr.sbin/ctld/ctld.h
116 ↗(On Diff #150367)

Is there any reason why this couldn't be an enum?

139 ↗(On Diff #150367)

Since it's actually allocating and returning a different string, this function isn't really a validator. How about "normalize_target_name" instead?

usr.sbin/ctld/kernel.c
572 ↗(On Diff #150367)

Frankly, I think that all of these commented-out sections should just be deleted. It's highly likely that they don't all compile anymore.

jhb marked 2 inline comments as done.Feb 7 2025, 1:00 AM
jhb added inline comments.
usr.sbin/ctld/ctld.h
116 ↗(On Diff #150367)

I guess it could be. I was just following the existing convention.

Rebase after C++ prep commits

Rewrite after C++ conversion

usr.sbin/ctld/Makefile
28

Why does Phabricator's web interface show that you removed this MK_ISCSI section, but when I download the code with "arc patch", I see no changes to this section?

usr.sbin/ctld/ctld.hh
59

Here too, Phabricator's web UI shows that you removed a line. But I don't see that when I download the code locally.

You can find the commits directly at https://github.com/freebsd/freebsd-src/compare/main...bsdjhb:freebsd:ctld_nvmf_cxx if that is easier (or you can just pull that branch to look at the changes locally)

usr.sbin/ctld/Makefile
28

Hmm, maybe arc patch is confused? I did remove it. It didn't seem worth keeping. At one point while working on this patch I had made iscsi.cc and discovery.cc conditional on MK_ISCSI, but I'd still need some sort of #ifdef's and it didn't seem worth the effort.

I didn't read this like a hawk, but I spot checked and didn't see anything weird or abnormal and the couple of areas I spot checked were good.

This revision is now accepted and ready to land.Aug 5 2025, 9:49 PM