Skip to content

Commit

Permalink
initiator: add InitiatorMaxRetry to allow 0-255 retries. Default 5.
Browse files Browse the repository at this point in the history
  • Loading branch information
erichelgeson committed Feb 11, 2024
1 parent 908af73 commit e1a1734
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/BlueSCSI_initiator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static struct {
uint32_t max_sector_per_transfer;
uint32_t badSectorCount;
uint8_t ansiVersion;
uint8_t maxRetryCount;

// Retry information for sector reads.
// If a large read fails, retry is done sector-by-sector.
Expand All @@ -89,6 +90,8 @@ void scsiInitiatorInit()
{
log_f("InitiatorID set to ID %d", g_initiator_state.initiator_id);
}
g_initiator_state.maxRetryCount = ini_getl("SCSI", "InitiatorMaxRetry", 5, CONFIGFILE);

// treat initiator id as already imaged drive so it gets skipped
g_initiator_state.drives_imaged = 1 << g_initiator_state.initiator_id;
g_initiator_state.imaging = false;
Expand Down Expand Up @@ -320,9 +323,9 @@ void scsiInitiatorMainLoop()
{
log("Failed to transfer ", numtoread, " sectors starting at ", (int)g_initiator_state.sectors_done);

if (g_initiator_state.retrycount < 5)
if (g_initiator_state.retrycount < g_initiator_state.maxRetryCount)
{
log("Retrying.. ", g_initiator_state.retrycount + 1, "/5");
log("Retrying.. ", g_initiator_state.retrycount + 1, "/", (int)g_initiator_state.maxRetryCount);
delay_with_poll(200);
// This reset causes some drives to hang and seems to have no effect if left off.
// scsiHostPhyReset();
Expand Down

0 comments on commit e1a1734

Please sign in to comment.