[PATCH] [Target_Core_Mod]: Make RELATIVE TARGET PORT IDENTIFER assignment always non zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings all,

This patch makes RELATIVE TARGET PORT IDENTIFER assignment always a non zero value.
This SCSI device unique 16-bit counter is allocated each time a new port is created,
and is unique within a SCSI device.

Using a zero value is defined as Reserved in spc4r17 section 7.7.3.8.

This patch is made against lio-core-2.6.git/master
and tested on v2.6.29-rc2 x86 32-bit HVM.  The lio-core-2.6.git tree can be
found at:

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=summary


Signed-off-by: Nicholas A. Bellinger
---
 drivers/lio-core/target_core_device.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/lio-core/target_core_device.c b/drivers/lio-core/target_core_device.c
index ced583a..9f1503c 100644
--- a/drivers/lio-core/target_core_device.c
+++ b/drivers/lio-core/target_core_device.c
@@ -508,7 +508,21 @@ extern se_port_t *core_alloc_port (se_device_t *dev)
 		return(NULL);
 	}
 again:
-	port->sep_rtpi = dev->dev_rpti_counter++;
+	/*
+	 * Allocate the next RELATIVE TARGET PORT IDENTIFER for this se_device_t.
+	 * Here is the table from spc4r17 section 7.7.3.8.
+	 * 
+	 *    Table 473 -- RELATIVE TARGET PORT IDENTIFIER field
+	 *
+	 * Code      Description
+	 * 0h        Reserved
+	 * 1h        Relative port 1, historically known as port A
+	 * 2h        Relative port 2, historically known as port B
+	 * 3h to FFFFh    Relative port 3 through 65 535
+	 */
+	if (!(port->sep_rtpi = dev->dev_rpti_counter++))
+		goto again;
+
 	list_for_each_entry(port_tmp, &dev->dev_sep_list, sep_list) {
 		/*
 		 * Make sure RELATIVE TARGET PORT IDENTIFER is unique
-- 
1.5.4.1



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux