aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2013-05-27 00:08:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-28 00:41:49 -0400
commit868001946e39627ec439921eeb0f5fa020e1e31d (patch)
tree2be31acf1b1faf5f958cee715b57390541ffbfc4
parent70ca5d746cf0c16576cee43fea6a19116ab49d9c (diff)
bnx2x: Count number of possible FCoE interfaces
Commit 0eb43b4bb081a1a22574daab9c05286a600dd7fe "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: Dmitry Kravkov <dmitry@broadcom.com> CC: Bhanu Prakash Gollapudi <bprakash@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 04fa5105ca52..0a3bb53f3eee 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -10795,12 +10795,56 @@ static void bnx2x_get_ext_wwn_info(struct bnx2x *bp, int func)
10795 bp->cnic_eth_dev.fcoe_wwn_node_name_lo = 10795 bp->cnic_eth_dev.fcoe_wwn_node_name_lo =
10796 MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower); 10796 MF_CFG_RD(bp, func_ext_config[func].fcoe_wwn_node_name_lower);
10797} 10797}
10798
10799static int bnx2x_shared_fcoe_funcs(struct bnx2x *bp)
10800{
10801 u8 count = 0;
10802
10803 if (IS_MF(bp)) {
10804 u8 fid;
10805
10806 /* iterate over absolute function ids for this path: */
10807 for (fid = BP_PATH(bp); fid < E2_FUNC_MAX * 2; fid += 2) {
10808 if (IS_MF_SD(bp)) {
10809 u32 cfg = MF_CFG_RD(bp,
10810 func_mf_config[fid].config);
10811
10812 if (!(cfg & FUNC_MF_CFG_FUNC_HIDE) &&
10813 ((cfg & FUNC_MF_CFG_PROTOCOL_MASK) ==
10814 FUNC_MF_CFG_PROTOCOL_FCOE))
10815 count++;
10816 } else {
10817 u32 cfg = MF_CFG_RD(bp,
10818 func_ext_config[fid].
10819 func_cfg);
10820
10821 if ((cfg & MACP_FUNC_CFG_FLAGS_ENABLED) &&
10822 (cfg & MACP_FUNC_CFG_FLAGS_FCOE_OFFLOAD))
10823 count++;
10824 }
10825 }
10826 } else { /* SF */
10827 int port, port_cnt = CHIP_MODE_IS_4_PORT(bp) ? 2 : 1;
10828
10829 for (port = 0; port < port_cnt; port++) {
10830 u32 lic = SHMEM_RD(bp,
10831 drv_lic_key[port].max_fcoe_conn) ^
10832 FW_ENCODE_32BIT_PATTERN;
10833 if (lic)
10834 count++;
10835 }
10836 }
10837
10838 return count;
10839}
10840
10798static void bnx2x_get_fcoe_info(struct bnx2x *bp) 10841static void bnx2x_get_fcoe_info(struct bnx2x *bp)
10799{ 10842{
10800 int port = BP_PORT(bp); 10843 int port = BP_PORT(bp);
10801 int func = BP_ABS_FUNC(bp); 10844 int func = BP_ABS_FUNC(bp);
10802 u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp, 10845 u32 max_fcoe_conn = FW_ENCODE_32BIT_PATTERN ^ SHMEM_RD(bp,
10803 drv_lic_key[port].max_fcoe_conn); 10846 drv_lic_key[port].max_fcoe_conn);
10847 u8 num_fcoe_func = bnx2x_shared_fcoe_funcs(bp);
10804 10848
10805 if (!CNIC_SUPPORT(bp)) { 10849 if (!CNIC_SUPPORT(bp)) {
10806 bp->flags |= NO_FCOE_FLAG; 10850 bp->flags |= NO_FCOE_FLAG;
@@ -10814,9 +10858,10 @@ static void bnx2x_get_fcoe_info(struct bnx2x *bp)
10814 10858
10815 /* Calculate the number of maximum allowed FCoE tasks */ 10859 /* Calculate the number of maximum allowed FCoE tasks */
10816 bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE; 10860 bp->cnic_eth_dev.max_fcoe_exchanges = MAX_NUM_FCOE_TASKS_PER_ENGINE;
10817 if (IS_MF(bp) || CHIP_MODE_IS_4_PORT(bp)) 10861
10818 bp->cnic_eth_dev.max_fcoe_exchanges /= 10862 /* check if FCoE resources must be shared between different functions */
10819 MAX_FCOE_FUNCS_PER_ENGINE; 10863 if (num_fcoe_func)
10864 bp->cnic_eth_dev.max_fcoe_exchanges /= num_fcoe_func;
10820 10865
10821 /* Read the WWN: */ 10866 /* Read the WWN: */
10822 if (!IS_MF(bp)) { 10867 if (!IS_MF(bp)) {