We try to build FC SAN on Sun T2 server, FC HBA cards used are

QLE2560 and QLE2562, the OS is RHEL6.0 with kernel linux-2.6.32,
scst code version from svn is 3952.

As T2 (SPARC64) is big-endian, which may not be tested sufficently,
we had to fix some endian swap to make qla2x00t work good on it.

The first fix is in q24_build_ctio_pkt(), loop_id from prm->cmd, which
was generated by CPU, should be converted to little-endian when wrapped
in pkt, which will be used by HBA ASIC.

The second fix in qla2x_tgt_def.h, reorder the bit-order of structs'
member, is an attempt in despair, cannot explain why, but it just works!

Besides the programming skills, we cannot get QLogic FC HBA databook,
and have little acknowledge about the driver, the fixes may need to
be refined, so don't hold the comments :)

Signed-off-by: Linwen Deng <linwendeng@gmail.com>



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3958 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2011-12-07 02:56:31 +00:00
parent 63a6094cad
commit 9ea7b8b4c9
3 changed files with 33 additions and 2 deletions
+1 -1
View File
@@ -2215,7 +2215,7 @@ static int q24_build_ctio_pkt(struct q2t_prm *prm)
ha->cmds[h-1] = prm->cmd;
pkt->common.handle = h | CTIO_COMPLETION_HANDLE_MARK;
pkt->common.nport_handle = prm->cmd->loop_id;
pkt->common.nport_handle = cpu_to_le16(prm->cmd->loop_id);
pkt->common.timeout = cpu_to_le16(Q2T_TIMEOUT);
pkt->common.initiator_id[0] = atio->fcp_hdr.s_id[2];
pkt->common.initiator_id[1] = atio->fcp_hdr.s_id[1];
+31
View File
@@ -420,17 +420,28 @@ typedef struct {
typedef struct {
uint64_t lun;
uint8_t cmnd_ref;
#ifdef __LITTLE_ENDIAN
uint8_t task_attr:3;
uint8_t reserved:5;
#else
uint8_t reserved:5;
uint8_t task_attr:3;
#endif
uint8_t task_mgmt_flags;
#define FCP_CMND_TASK_MGMT_CLEAR_ACA 6
#define FCP_CMND_TASK_MGMT_TARGET_RESET 5
#define FCP_CMND_TASK_MGMT_LU_RESET 4
#define FCP_CMND_TASK_MGMT_CLEAR_TASK_SET 2
#define FCP_CMND_TASK_MGMT_ABORT_TASK_SET 1
#ifdef __LITTLE_ENDIAN
uint8_t wrdata:1;
uint8_t rddata:1;
uint8_t add_cdb_len:6;
#else
uint8_t add_cdb_len:6;
uint8_t rddata:1;
uint8_t wrdata:1;
#endif
uint8_t cdb[16];
/*
* add_cdb is optional and can absent from fcp_cmnd_t. Size 4 only to
@@ -449,8 +460,13 @@ typedef struct {
uint8_t entry_type; /* Entry type. */
uint8_t entry_count; /* Entry count. */
uint8_t fcp_cmnd_len_low;
#ifdef __LITTLE_ENDIAN
uint8_t fcp_cmnd_len_high:4;
uint8_t attr:4;
#else
uint8_t attr:4;
uint8_t fcp_cmnd_len_high:4;
#endif
uint32_t exchange_addr;
#define ATIO_EXCHANGE_ADDRESS_UNKNOWN 0xFFFFFFFF
fcp_hdr_t fcp_hdr;
@@ -626,8 +642,13 @@ typedef struct {
uint16_t nport_handle;
uint8_t reserved_2[2];
uint8_t vp_index;
#ifdef __LITTLE_ENDIAN
uint8_t reserved_3:4;
uint8_t sof_type:4;
#else
uint8_t sof_type:4;
uint8_t reserved_3:4;
#endif
uint32_t exchange_address;
fcp_hdr_le_t fcp_hdr_le;
uint8_t reserved_4[16];
@@ -668,8 +689,13 @@ typedef struct {
uint16_t control_flags;
#define ABTS_CONTR_FLG_TERM_EXCHG BIT_0
uint8_t vp_index;
#ifdef __LITTLE_ENDIAN
uint8_t reserved_3:4;
uint8_t sof_type:4;
#else
uint8_t sof_type:4;
uint8_t reserved_3:4;
#endif
uint32_t exchange_address;
fcp_hdr_le_t fcp_hdr_le;
union {
@@ -692,8 +718,13 @@ typedef struct {
uint16_t nport_handle;
uint16_t reserved_1;
uint8_t reserved_2;
#ifdef __LITTLE_ENDIAN
uint8_t reserved_3:4;
uint8_t sof_type:4;
#else
uint8_t sof_type:4;
uint8_t reserved_3:4;
#endif
uint32_t exchange_address;
fcp_hdr_le_t fcp_hdr_le;
uint8_t reserved_4[8];
+1 -1
View File
@@ -3769,7 +3769,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
}
#endif
/* out-of-order frames reassembly */
nv->firmware_options_3 |= BIT_6|BIT_9;
nv->firmware_options_3 |= __constant_cpu_to_le32(BIT_6|BIT_9);
if (ha->enable_class_2) {
if (ha->flags.init_done) {