cxgb4/cxgb4vf: check fw caps to set link mode mask
authorGanesh Goudar <ganeshgr@chelsio.com>
Sat, 10 Mar 2018 13:57:52 +0000 (19:27 +0530)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Mar 2018 15:05:08 +0000 (11:05 -0400)
check firmware capabilities before setting ethtool
link mode mask, also add few missing speeds.

Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/cxgb4_ethtool.c
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c

index 7852d98bad75810d357d4155bbf129149cf88621..59d04d73c672614c4281f8865a559a0c3fb193e5 100644 (file)
@@ -597,22 +597,22 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
 
        case FW_PORT_TYPE_KR:
                SET_LMM(Backplane);
-               SET_LMM(10000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
                break;
 
        case FW_PORT_TYPE_BP_AP:
                SET_LMM(Backplane);
-               SET_LMM(10000baseR_FEC);
-               SET_LMM(10000baseKR_Full);
-               SET_LMM(1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
                break;
 
        case FW_PORT_TYPE_BP4_AP:
                SET_LMM(Backplane);
-               SET_LMM(10000baseR_FEC);
-               SET_LMM(10000baseKR_Full);
-               SET_LMM(1000baseKX_Full);
-               SET_LMM(10000baseKX4_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKX4_Full);
                break;
 
        case FW_PORT_TYPE_FIBER_XFI:
@@ -628,7 +628,9 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
        case FW_PORT_TYPE_BP40_BA:
        case FW_PORT_TYPE_QSFP:
                SET_LMM(FIBRE);
-               SET_LMM(40000baseSR4_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full);
                break;
 
        case FW_PORT_TYPE_CR_QSFP:
@@ -655,12 +657,14 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
 
        case FW_PORT_TYPE_CR2_QSFP:
                SET_LMM(FIBRE);
-               SET_LMM(50000baseSR2_Full);
+               FW_CAPS_TO_LMM(SPEED_50G, 50000baseSR2_Full);
                break;
 
        case FW_PORT_TYPE_KR4_100G:
        case FW_PORT_TYPE_CR4_QSFP:
                SET_LMM(FIBRE);
+               FW_CAPS_TO_LMM(SPEED_1G,  1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseSR_Full);
                FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full);
                FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full);
                FW_CAPS_TO_LMM(SPEED_50G, 50000baseCR2_Full);
index 361de86b65b93e31160eeb3a9542eb66a39b1d7b..7bd8497fd9be6bcd07dd88569156eee5fc44fd96 100644 (file)
@@ -1289,22 +1289,22 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
 
        case FW_PORT_TYPE_KR:
                SET_LMM(Backplane);
-               SET_LMM(10000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
                break;
 
        case FW_PORT_TYPE_BP_AP:
                SET_LMM(Backplane);
-               SET_LMM(10000baseR_FEC);
-               SET_LMM(10000baseKR_Full);
-               SET_LMM(1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
                break;
 
        case FW_PORT_TYPE_BP4_AP:
                SET_LMM(Backplane);
-               SET_LMM(10000baseR_FEC);
-               SET_LMM(10000baseKR_Full);
-               SET_LMM(1000baseKX_Full);
-               SET_LMM(10000baseKX4_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseKX_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseR_FEC);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKX4_Full);
                break;
 
        case FW_PORT_TYPE_FIBER_XFI:
@@ -1320,18 +1320,24 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
        case FW_PORT_TYPE_BP40_BA:
        case FW_PORT_TYPE_QSFP:
                SET_LMM(FIBRE);
-               SET_LMM(40000baseSR4_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full);
                break;
 
        case FW_PORT_TYPE_CR_QSFP:
        case FW_PORT_TYPE_SFP28:
                SET_LMM(FIBRE);
-               SET_LMM(25000baseCR_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full);
                break;
 
        case FW_PORT_TYPE_KR_SFP28:
                SET_LMM(Backplane);
-               SET_LMM(25000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_1G, 1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseKR_Full);
+               FW_CAPS_TO_LMM(SPEED_25G, 25000baseKR_Full);
                break;
 
        case FW_PORT_TYPE_KR_XLAUI:
@@ -1343,13 +1349,18 @@ static void fw_caps_to_lmm(enum fw_port_type port_type,
 
        case FW_PORT_TYPE_CR2_QSFP:
                SET_LMM(FIBRE);
-               SET_LMM(50000baseSR2_Full);
+               FW_CAPS_TO_LMM(SPEED_50G, 50000baseSR2_Full);
                break;
 
        case FW_PORT_TYPE_KR4_100G:
        case FW_PORT_TYPE_CR4_QSFP:
                SET_LMM(FIBRE);
-               SET_LMM(100000baseCR4_Full);
+               FW_CAPS_TO_LMM(SPEED_1G,  1000baseT_Full);
+               FW_CAPS_TO_LMM(SPEED_10G, 10000baseSR_Full);
+               FW_CAPS_TO_LMM(SPEED_40G, 40000baseSR4_Full);
+               FW_CAPS_TO_LMM(SPEED_25G, 25000baseCR_Full);
+               FW_CAPS_TO_LMM(SPEED_50G, 50000baseCR2_Full);
+               FW_CAPS_TO_LMM(SPEED_100G, 100000baseCR4_Full);
                break;
 
        default: