First cut of ocs_fc driver.
Details
- Reviewers
ken mav - Group Reviewers
manpages - Commits
- rS332040: MFC r331766, r331768:
rS331766: Bring in the Broadcom/Emulex Fibre Channel driver, ocs_fc(4).
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Hi Ken,
We support following topologies:
hint.ocs_fc.X.topology: FC topology: • 0 – auto-select; first tries N_Port, then loop. (default) • 1 – N_Port (point-to-point) • 2 – loop
N_Port topology covers both Fabric and point-to-point mode. Driver decides the Port type based on the PLOGI response.
In your test (hint.ocs_fc.0.topology=2) means loop topology. So, Tape drive attach worked with loop topology.
Panic with hint.ocs_fc.0.topology=3: Driver initialization failed specifying "unsupported Topology". I fixed the driver panic here.
Yes, we have SRR and REC support. Our Firmware will do REC and SRR and perform the timers. I missed a change here to update the FW that FCP Error Recovery Protocol should be performed. Fixed the issue.
Regarding CRN, After discussing internally in our team, we thought of ignoring it as only few targets support it. Please let know if ignoring may cause any issue.
Task Retry ID - which is used by sequence level error recovery is automatically stamped by our Firmware.
Regarding Tape drive failure with default topology, From the trace I am not able to find the root cause for link toggle.
Thanks,
Ram
This is not what I was thinking about. When request is handled by wildcard LUN, CAM and CTL should receive real target and LUN IDs. As I understand, your new code still does not set target_lun value, leaving it wildcard.
By the way, looking wider, I've noticed that your code in ocs_fc_decode_lun() decodes 8-byte LUN into flat space. But there is no reason to do it now. Recent FreeBSD versions support full 8-byte LUNs if PIM_EXTLUNS flag is set. While CTL still does not make use of that, I was thinking about making it support LUN conglomerates at some point.
Sorry missed that, Is this what you intended here: I am still not updating the target id as I am not saving that value now, will add that code.
I will do the changes to support EXTLUNS.
- ocs_cam.c (revision 40610)
+++ ocs_cam.c (working copy)
@@ -586,6 +586,7 @@
if ((lun < OCS_MAX_LUN) && ocs->targ_rsrc[lun].enabled) { trsrc = &ocs->targ_rsrc[lun]; } else if (ocs->targ_rsrc_wildcard.enabled) {
+ lun = CAM_LUN_WILDCARD;
trsrc = &ocs->targ_rsrc_wildcard; }
@@ -601,6 +602,9 @@
tmfio->tgt_io.app = abortio; STAILQ_REMOVE_HEAD(&trsrc->inot, sim_links.stqe);
+
+ inot->ccb_h.status = CAM_CDB_RECVD;
+ inot->ccb_h.target_lun = lun;
inot->tag_id = tmfio->tag;
As of now, we are not supporting live role change.
It should better be supported. I've tried to enable target mode, but found expected problems: If target mode enabled via device hints, it won't be able to reply to initiators until target mode is enabled in CTL, leading to command timeouts on initiators. Enabling target in CTL after makes it work, but it seems CTL doesn't receive or drops AC_CONTRACT notifications, as result of what ctladm portlist -i does not report connected initiators until they disconnect and reconnect.
I think if we support the live role change also this issue will happen. As enabling target mode in CTL should be done in any case. So, I think we need to debug why CTL doesn't receive or drops AC_CONTRACT notifications.
Please correct me if I am missing any thing.
I'm sorry, it seems I was wrong about AC_CONTRACT, it does work.
But I still see a problem in fact that target mode is not controller by CTL: when system boots and driver applies target mode tunable, there is no LUNs configured/enabled till ctld start. It makes initiators to see the target which does not respond on requests. I am not sure it is a nice behavior. in case of isp(4) driver FC link remains down until ctld enable the target role when all LUNs are ready. Could you describe how your approach supposed to work in case I miss something?
Yes, you are right. I got it. I will do the necessary changes.
Our approach worked until now because I used to load driver, create LUNs and enable ctl port using script, So initiators used to work with out any issue.
- Added support for live driver role change via CTL.
- Removed some info prints.
- Did some bug fixes.
I tried this out, and this breaks automatic tape drive recognition if I haven't set the topology to 2 (loop mode). If I set the topology to 2, it sees the tape drive without a problem.
I'm looking at traces, and it still looks like REC isn't getting sent. You can trigger a REC by doing a 'mt fsf' to go to the next filemark, if the next filemark is far enough away. e.g.:
dd if=big_file bs=1m | dd of=/dev/nsa0 bs=128k
mt rewind
mt fsf
I do see that REC is getting sent in the trace you sent me on October 10th. I don't see the FC setup, though, so I don't know whether your initiator / tape drive are doing the same thing as mine.
Thanks Ken. Sorry missed the auto-topology fix in this drop. I will update the code.
I will try to trigger the REC with the commands you provided, will update you the status.
- Changed auto topology detection to try FC-AL first and failover to Nport topology.
- Fixed issue of not sending REC for no data commands, by setting the Error Recovery bit in command wrb.
The new diffs fixed both issues: auto negotiation with tape drives and sending RECs for non-data commands. I got a trace to confirm that RECs are getting sent during a long-running SPACE command. It looks like the card sends a REC every 4 seconds, which should be fine. (QLogic seems to send them every 3 seconds. I don't think the spec mandates a specific time.)
I'll try to test target mode a little bit today. One other thing that needs to get done is write a man page for the driver. The man page should cover the following topics at least:
- General description of the driver.
- What hardware it works with.
- Driver kernel configuration options (if any).
- Loader tunables and sysctl variables. Include information on what the different settings do.
For examples of device driver man pages, see:
share/man/man4/isp.4
share/man/man4/mpr.4
share/man/man4/mps.4
One thing to remember when writing man pages is that every sentence should start on a new line.
share/man/man4/ocs_fc.4 | ||
---|---|---|
49 ↗ | (On Diff #35188) | This whole introductory section is the old style with halting and confusing wording. Please see https://www.freebsd.org/doc/en_US.ISO8859-1/books/fdp-primer/manpages-sample-structures.html#manpages-sample-structures-section-4 for a suggested newer style. |
52 ↗ | (On Diff #35188) | s/FibreChannel/Fibre Channel/ |
57 ↗ | (On Diff #35188) | Use the serial comma: s/Point-to-Point/Point-to-Point,/ |
61 ↗ | (On Diff #35188) | Nonspecific "It" here... probably means FC-Tape and would be clearer just saying that. Also, "encompasses" might be a technical term here, but would probably be clearer with just "includes": FC-Tape includes four elements from the T-10 FCP-4 specification: |
75 ↗ | (On Diff #35188) | Another non-specific "it". Does this refer to "link level error recover"? |
76 ↗ | (On Diff #35188) | Use the serial comma: s/part/part,/ |
78 ↗ | (On Diff #35188) | Too many "it"s. FC-Tape is automatically enabled when both the controller and target support it." |
84 ↗ | (On Diff #35188) | s/Driver/driver/ |
88 ↗ | (On Diff #35188) | These would probably look better without the periods. |
93 ↗ | (On Diff #35188) | As above, periods are probably not needed. |
100 ↗ | (On Diff #35188) | s/the steps below/these steps/ |
103 ↗ | (On Diff #35188) | Copy this code to a .Pa Makefile : |
110 ↗ | (On Diff #35188) | Replace .Pa imagename with the name of the GRP file. |
112 ↗ | (On Diff #35188) | Copy the .Pa Makefile and GRP file to a local directory |
114 ↗ | (On Diff #35188) | Execute .Cm make and copy the generated .Pa ocsflash.ko file to |
117 ↗ | (On Diff #35188) | I think this also needs .Cm |
125 ↗ | (On Diff #35188) | Options are controlled by setting values in |
131 ↗ | (On Diff #35188) | This type of thing is usually clearer to read when the items are just the description rather than a full sentence. For example, Enable initiator functionality. Default 1 (enabled), 0 to disable. It's not clear to me whether "hint" is necessary or useful. |
134 ↗ | (On Diff #35188) | Enable target functionality. Default 1 (enabled), 0 to disable. |
137 ↗ | (On Diff #35188) | Topology: 0 for Auto, 1 for NPort only, 2 for Loop only. |
139 ↗ | (On Diff #35188) | As above, but also please start new sentences on new lines. Link speed in megabits per second. Possible values include: |
140 ↗ | (On Diff #35188) | Needs ending period. |
145 ↗ | (On Diff #35188) | As above: skip the introductory part to make it a sentence, and just give the description the reader is looking for anyway. Also, start sentences on new lines. Port state (read/write). Valid values are .Li online and .Li offline . |
147 ↗ | (On Diff #35188) | As above. |
149 ↗ | (On Diff #35188) | As above. |
151 ↗ | (On Diff #35188) | Firmware revision (read-only). |
153 ↗ | (On Diff #35188) | Adapter serial number (read-only). |
155 ↗ | (On Diff #35188) | As above. |
157 ↗ | (On Diff #35188) | As above. |
159 ↗ | (On Diff #35188) | As above. |
161 ↗ | (On Diff #35188) | As above. |
Another thing to note here is that the man page has replaced the entire set of diffs that included the code. Both need to be included in the diffs, and the man page hooked up to the build.
Thanks Warren for the review.
Hi Ken,
Sorry , I messed the diffs update. I uploaded all the code now. Please let me know if you want me to create a new revision.
Thanks ,
Ram
One thing that needs to get fixed is cosmetic. The reported speeds are 10X what they should be.
da45 at ocs_fc0 bus 0 scbus11 target 2 lun 4
da45: <FREEBSD CTLDISK 0001> Fixed Direct Access SPC-5 SCSI device
da45: Serial Number MYSERIAL0004
da45: 16000.000MB/s transfers WWNN 0x2000000e1e222a31 WWPN 0x2100000e1e222a31 Po
rtID 0xef
da45: Command Queueing enabled
da45: 100000MB (204800000 512 byte sectors)
da44 at ocs_fc0 bus 0 scbus11 target 2 lun 3
da44: <FREEBSD CTLDISK 0001> Fixed Direct Access SPC-5 SCSI device
da44: Serial Number MYSERIAL0003
da44: 16000.000MB/s transfers WWNN 0x2000000e1e222a31 WWPN 0x2100000e1e222a31 PortID 0xef
da44: Command Queueing enabled
sa0 at ocs_fc1 bus 0 scbus12 target 0 lun 0
sa0: <IBM ULTRIUM-HH5 G9N1> Removable Sequential Access SPC-4 SCSI device
sa0: Serial Number 101500520A
sa0: 8000.000MB/s transfers WWNN 0x21150090a500520a WWPN 0x21150090a500520a PortID 0x26
sa0: Command Queueing enabled
ch0 at ocs_fc1 bus 0 scbus12 target 0 lun 1
ch0: <SPECTRA PYTHON 2000> Removable Changer SCSI-3 device
ch0: Serial Number 921400520A
ch0: 8000.000MB/s transfers WWNN 0x21150090a500520a WWPN 0x21150090a500520a PortID 0x26
ch0: 10 slots, 1 drive, 1 picker, 1 portal
Hi Ken,
Please clarify,
"da44: 16000.000MB/s transfers"
should be
"da44: 16000.000Mb/s transfers" --> This seems correct to me but camcontrol utility always prints in MB/s transfers.
or
"da44: 1600.000MB/s transfers" --> Do you want me to report this speed?
Thanks,
Ram
Yes, the third one is what we need to report. The numbers printed are in mebibytes/sec (2^20 bytes/sec). Back when we wrote it, the name "mebibytes" and the MiB abbreviation didn't exist. :) So a tape drive attached to a Qlogic controller and running at 8Gb, for example, shows:
sa0 at isp0 bus 0 scbus2 target 0 lun 0
sa0: <IBM ULTRIUM-HH5 G9N1> Removable Sequential Access SPC-4 SCSI device
sa0: Serial Number 101300520A
sa0: 800.000MB/s transfers WWNN 0x21130090a500520a WWPN 0x21130090a500520a PortID 0xef
So found some problems when I did a 'make universe'. See the inline comments for more details.
I don't think you need to fix everything, but it would be good to have the driver compiling on 32-bit and 64-bit little endian platforms. We can just default to building the module on i386 and amd64 for now. I don't expect anyone to run it on actual i386 hardware, but building it there will make sure that we continue to keep it building in 32-bit mode.
sys/modules/Makefile | ||
---|---|---|
296 ↗ | (On Diff #40489) | This is good, but it does cause several problems:
So, I think what I would suggest here is:
|
- Fixed 32-bit print format warnings.
- Enabled building ocs_fc module for amd64 and i386.
- get_cyclecount() to get the TSC value.