Commit 86800194 authored by Dmitry Kravkov's avatar Dmitry Kravkov Committed by David S. Miller

bnx2x: Count number of possible FCoE interfaces

Commit 0eb43b4b
"bnx2x, bnx2fc: Use per port max exchange resources" has changed the number
of available FCoE exchanges, even in scenarios when some of the functions has
no FCoE support; This needlessly degraded the available resources.

Remedy this by calculating the maximal number of functions that may actually
utilize said connection.
Signed-off-by: default avatarDmitry Kravkov <dmitry@broadcom.com>
CC: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarAriel Elior <ariele@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 70ca5d74
...@@ -10795,12 +10795,56 @@ static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func) ...@@ -10795,12 +10795,56 @@ static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func)
bp->cnic_eth_dev.fcoe_wwn_node_name_lo = bp->cnic_eth_dev.fcoe_wwn_node_name_lo =
MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower); MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower);
} }
static int bnx2x_shared_fcoe_funcs(struct bnx2x *bp)
{
u8 count = 0;
if (IS_MF(bp)) {
u8 fid;
/* iterate over absolute function ids for this path: */
for (fid = BP_PATH(bp); fid < E2_FUNC_MAX * 2; fid += 2) {
if (IS_MF_SD(bp)) {
u32 cfg = MF_CFG_RD(bp,
func_mf_config[fid].config);
if (!(cfg & FUNC_MF_CFG_FUNC_HIDE) &&
((cfg & FUNC_MF_CFG_PROTOCOL_MASK) ==
FUNC_MF_CFG_PROTOCOL_FCOE))
count++;
} else {
u32 cfg = MF_CFG_RD(bp,
func_ext_config[fid].
func_cfg);
if ((cfg & MACP_FUNC_CFG_FLAGS_ENABLED) &&
(cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD))
count++;
}
}
} else { /* SF */
int port, port_cnt = CHIP_MODE_IS_4_PORT(bp) ? 2 : 1;
for (port = 0; port < port_cnt; port++) {
u32 lic = SHMEM_RD(bp,
drv_lic_key[port].max_fcoe_conn) ^
FW_ENCODE_32BIT_PATTERN;
if (lic)
count++;
}
}
return count;
}
static void bnx2x_get_fcoe_info(struct bnx2x *bp) static void bnx2x_get_fcoe_info(struct bnx2x *bp)
{ {
int port = BP_PORT(bp); int port = BP_PORT(bp);
int func = BP_ABS_FUNC(bp); int func = BP_ABS_FUNC(bp);
u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
drv_lic_key[port].max_fcoe_conn); drv_lic_key[port].max_fcoe_conn);
u8 num_fcoe_func = bnx2x_shared_fcoe_funcs(bp);
if (!CNIC_SUPPORT(bp)) { if (!CNIC_SUPPORT(bp)) {
bp->flags |= NO_FCOE_FLAG; bp->flags |= NO_FCOE_FLAG;
...@@ -10814,9 +10858,10 @@ static void bnx2x_get_fcoe_info(struct bnx2x *bp) ...@@ -10814,9 +10858,10 @@ static void bnx2x_get_fcoe_info(struct bnx2x *bp)
/* Calculate the number of maximum allowed FCoE tasks */ /* Calculate the number of maximum allowed FCoE tasks */
bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE; bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE;
if (IS_MF(bp) || CHIP_MODE_IS_4_PORT(bp))
bp->cnic_eth_dev.max_fcoe_exchanges /= /* check if FCoE resources must be shared between different functions */
MAX_FCOE_FUNCS_PER_ENGINE; if (num_fcoe_func)
bp->cnic_eth_dev.max_fcoe_exchanges /= num_fcoe_func;
/* Read the WWN: */ /* Read the WWN: */
if (!IS_MF(bp)) { if (!IS_MF(bp)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment