mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 06:02:33 +00:00
Remove overwritten initial values, unused offsets and zero-bit flag
operands. Derive the saved sense length from its captured value and rely
on C zero initialization for static-duration userspace objects. The FC
copy path remains unconditional because its buffers outlive the request.
Select CRC availability with the same four CONFIG predicates and use
else for a negative SRP residual only inside the nonzero-residual branch.
Group ternary bit tests and trim the PR filename's newline with strchr(),
retaining the empty-filename fallback. Manual review also identified the
overwritten QLogic tag initializer; every allocator branch assigns it.
Cppcheck reports:
redundantAssignment: Variable 'tp' is reassigned a value before the
old one has been used.
unreadVariable: Variable 'sg_cnt' is assigned a value that is never used.
unreadVariable: Variable 'data_offset' is assigned a value that is
never used.
clarifyCalculation: Clarify calculation precedence for '&' and '?'.
ignoredReturnValue: Return value of function strsep() is not used.
knownConditionTrueFalse: Condition '!crc32c' is always false.
knownConditionTrueFalse: Condition 'resid<0' is always true.
badBitmaskCheck: Operator '|' with one operand equal to zero is redundant.
It also marks the initial rc value in dev_user_process_cleanup() unread.
Checkpatch reports GLOBAL_INITIALISERS:
do not initialise globals to false
About fcst
==========
The fcst kernel module implements an SCST target driver for the FCoE protocol.
FCoE or Fibre Channel over Ethernet is a protocol that allows to communicate
fibre channel frames over an Ethernet network. Since the FCoE protocol
requires a lossless Ethernet network, special network adapters and switches
are required. Ethernet network adapters that support FCoE are called
Converged Network Adapters (CNA). The standard that makes lossless Ethernet
communication possible is called DCB or Data Center Bridging.
Since FCoE frames are a kind of Ethernet frames, communication between FCoE
clients and servers is limited to a single Ethernet broadcast domain.
Building and Installing
=======================
FCST is a kernel module that depends on libfc and SCST to provide FC target
support.
WARNING: The procedure below installs system packages, creates an FCoE
interface, loads kernel modules, changes live SCST sysfs state, exposes LUNs,
and may reset an initiator interface. Use it only with authorization for the
exact host, Ethernet fabric, CNA, initiators, and backing storage. Substitute
and verify every interface name, port name, and SCST device before running a
command.
1. Build and install scst, fcst and scstadmin following the instructions
in the top-level INSTALL.md file.
2. Install the FCoE admin tools:
apt-get install fcoe-utils lldpad ||
dnf install fcoe-utils lldpad ||
zypper install fcoe-utils open-lldp
3. Bring up SCST and configure the devices.
4. Bring up an FCoE initiator (we'll enable target mode on it later):
modprobe fcoe
fcoeadm -c eth3
The other end can be an initiator as well, in point-to-point mode
over a full-duplex loss-less link (enable pause on both sides).
Alternatively, the other end can be an FCoE switch.
5. Use fcc from the open-fcoe contrib tools to inspect the initiator
setup and obtain the FCoE port name for eth3:
# fcc
FC HBAs:
HBA Port Name Port ID State Device
host4 20:00:00:1b:21:06:58:21 01:01:02 Online eth3
host4 Remote Ports:
Path Port Name Port ID State Roles
4:0-0 10:00:50:41:4c:4f:3b:00 01:01:01 Online FCP Initiator
In the above example, there's one local host on eth3, and it's in
a point-to-point connection with the remote initiator with Port_id 010101.
6. Load fcst
modprobe fcst
7. Add the SCST devices configured in step 3 that you want to export.
Many initiators require a LUN 0.
LPORT=20:00:00:1b:21:06:58:21 # the local Port_Name
cd /sys/kernel/scst_tgt/targets/fcst/$LPORT
echo add disk-name 0 > luns/mgmt
echo add disk-name 1 > luns/mgmt
8. Enable the target:
echo 1 > enabled
9. As a temporary workaround, you may need to reset the interface
on the initiator side so it sees the SCST device as a target and
discovers LUNs. You can avoid this by bringing up the initiator last.