From: Rob T. <ro...@rt...> - 2018-12-04 21:34:05
|
Well, some good news I suppose. I have made some minor changes to scst_lib and scst_user as suggested, and I can now post Unit Attentions which arrive at all initiators. Below is the output of a quick-and-dirty SCSI Ping tool that I wrote for Linux and Windows, running side by side. Linux is initiator via scst_local, Windows via iSCSI. Status = host, ASC, ASCQ, Sensekey. [val] is number of seconds that status stayed the same. You can see the single Unit Attentions 02280006H posted when I insert a virtual tape. Z:\pingSCSI>win32\pingdev.exe \\.\Tape0 Pingdev V1.01 - Copyright (c) 2017, Rob Turk. All Rights Reserved This beta version built by Rob Turk - The Netherlands on Dec 4 2018, 22:20:26 Status = 02290006H [1] Status = 023a0002H [12] Status = 02280006H [1] Status = 01000000H [5] Status = 023a0002H [9] Status = 02280006H [1] Status = 01000000H [22] Status = 023a0002H [5] Status = 02280006H [1] Status = 01000000H [19] [root@vmscsi scst-3.3.0]# /projects/pingSCSI/Linux64/pingdev /dev/st0 Pingdev V1.01 - Copyright (c) 2017, Rob Turk. All Rights Reserved This beta version built by Rob Turk - The Netherlands on Dec 4 2018, 22:06:42 Status = 023a0002H [5] Status = 02280006H [1] Status = 01000000H [5] Status = 023a0002H [9] Status = 02280006H [1] Status = 01000000H [22] Status = 023a0002H [5] Status = 02280006H [1] Status = 01000000H [18] I used a clean scst-3.3.0 tarball as start, now I need to figure out how to create something you can pull, but the mechanism seems to work well. Rob On 12/4/2018 10:22 AM, Rob Turk wrote: > On 12/4/2018 6:15 AM, Bart Van Assche wrote: >> On 12/2/18 2:17 AM, Rob Turk wrote: >>> After studying file_io and the scst source code (on trunk 7800 right >>> now), I have not been able to figure out how to properly set a Unit >>> Attention condition through scst_user that registers for all >>> initiators. Does such a mechanism exist at all? >>> >>> When starting the target emulation, scst itself appears to post a >>> Unit Attention (Power on Reset) for every initiator. I also found >>> code in scst_lib.c that does this for all initiators when a Device >>> Reset or LUN change event occurs. How can I post my own Unit >>> Attention through this mechanism? >>> >>> Example: My target emulation is a Tape device. When empty, all >>> initiators poll the device (usually Test Unit Ready) and get a Not >>> Ready sense back. When I insert a virtual tape, the first Test Unit >>> Ready for each initiator should get a Unit Attention, ASC 0x28, ASCQ >>> 0x00 (Not ready to ready transition, medium may have changed). Does >>> my emulation need to keep track of this for each initiator, or is >>> there a way to post the Unit Attention so scst will take care of it? >> >> Hi Rob, >> >> How about the following: >> - Below scst_capacity_data_changed(), add a new function that accepts >> struct scst_device *dev, int key, int asc, int ascq as arguments and >> that calls scst_gen_aen_or_ua() for all tgt_devs associated with >> 'dev'. >> - In scst_user, have a look at how SCST_USER_DEVICE_CAPACITY_CHANGED has >> been implemented and add a new scst_user command that triggers a call >> to the new function in scst_lib. >> >> If you post the resulting patch on the scst-devel mailing list I will >> have a look at it. >> >> Bart. >> > > Hi Bart, > Not sure if I'm up to the task, but willing to try. > > Rather than introducing a new scst_user command, I'd suggest adding a > check in dev_user_process_reply_exec() in the section that handles > sense data, and call the new library function if sense key equals UA. > That way no changes to scst_user API needs to happen, and posting of > UA is automatic for all emulations. Your thoughts? > > Rob > > > > _______________________________________________ > Scst-devel mailing list > https://lists.sourceforge.net/lists/listinfo/scst-devel |