scsi: csiostor: fix incorrect port capabilities
- use be32_to_cpu() instead of ntohs() for 32 bit port capabilities. - add a new function fwcaps32_to_caps16() to convert 32 bit port capabilities to 16 bit port capabilities. Signed-off-by: Varun Prakash <varun@chelsio.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Este commit está contenido en:

cometido por
Martin K. Petersen

padre
89809b028b
commit
68bdc63072
@@ -1601,6 +1601,46 @@ fw_port_cap32_t fwcaps16_to_caps32(fw_port_cap16_t caps16)
|
||||
return caps32;
|
||||
}
|
||||
|
||||
/**
|
||||
* fwcaps32_to_caps16 - convert 32-bit Port Capabilities to 16-bits
|
||||
* @caps32: a 32-bit Port Capabilities value
|
||||
*
|
||||
* Returns the equivalent 16-bit Port Capabilities value. Note that
|
||||
* not all 32-bit Port Capabilities can be represented in the 16-bit
|
||||
* Port Capabilities and some fields/values may not make it.
|
||||
*/
|
||||
fw_port_cap16_t fwcaps32_to_caps16(fw_port_cap32_t caps32)
|
||||
{
|
||||
fw_port_cap16_t caps16 = 0;
|
||||
|
||||
#define CAP32_TO_CAP16(__cap) \
|
||||
do { \
|
||||
if (caps32 & FW_PORT_CAP32_##__cap) \
|
||||
caps16 |= FW_PORT_CAP_##__cap; \
|
||||
} while (0)
|
||||
|
||||
CAP32_TO_CAP16(SPEED_100M);
|
||||
CAP32_TO_CAP16(SPEED_1G);
|
||||
CAP32_TO_CAP16(SPEED_10G);
|
||||
CAP32_TO_CAP16(SPEED_25G);
|
||||
CAP32_TO_CAP16(SPEED_40G);
|
||||
CAP32_TO_CAP16(SPEED_100G);
|
||||
CAP32_TO_CAP16(FC_RX);
|
||||
CAP32_TO_CAP16(FC_TX);
|
||||
CAP32_TO_CAP16(802_3_PAUSE);
|
||||
CAP32_TO_CAP16(802_3_ASM_DIR);
|
||||
CAP32_TO_CAP16(ANEG);
|
||||
CAP32_TO_CAP16(FORCE_PAUSE);
|
||||
CAP32_TO_CAP16(MDIAUTO);
|
||||
CAP32_TO_CAP16(MDISTRAIGHT);
|
||||
CAP32_TO_CAP16(FEC_RS);
|
||||
CAP32_TO_CAP16(FEC_BASER_RS);
|
||||
|
||||
#undef CAP32_TO_CAP16
|
||||
|
||||
return caps16;
|
||||
}
|
||||
|
||||
/**
|
||||
* lstatus_to_fwcap - translate old lstatus to 32-bit Port Capabilities
|
||||
* @lstatus: old FW_PORT_ACTION_GET_PORT_INFO lstatus value
|
||||
@@ -1759,7 +1799,7 @@ csio_enable_ports(struct csio_hw *hw)
|
||||
val = 1;
|
||||
|
||||
csio_mb_params(hw, mbp, CSIO_MB_DEFAULT_TMO,
|
||||
hw->pfn, 0, 1, ¶m, &val, false,
|
||||
hw->pfn, 0, 1, ¶m, &val, true,
|
||||
NULL);
|
||||
|
||||
if (csio_mb_issue(hw, mbp)) {
|
||||
@@ -1769,16 +1809,9 @@ csio_enable_ports(struct csio_hw *hw)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
csio_mb_process_read_params_rsp(hw, mbp, &retval, 1,
|
||||
&val);
|
||||
if (retval != FW_SUCCESS) {
|
||||
csio_err(hw, "FW_PARAMS_CMD(r) port:%d failed: 0x%x\n",
|
||||
portid, retval);
|
||||
mempool_free(mbp, hw->mb_mempool);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
fw_caps = val;
|
||||
csio_mb_process_read_params_rsp(hw, mbp, &retval,
|
||||
0, NULL);
|
||||
fw_caps = retval ? FW_CAPS16 : FW_CAPS32;
|
||||
}
|
||||
|
||||
/* Read PORT information */
|
||||
|
Referencia en una nueva incidencia
Block a user