]> git.droids-corp.org - dpdk.git/commitdiff
i40e/base: add checks for CEE APP priority validity
authorJingjing Wu <jingjing.wu@intel.com>
Sun, 6 Sep 2015 07:11:43 +0000 (15:11 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 1 Oct 2015 23:35:22 +0000 (01:35 +0200)
The firmware has added additional status information to allow software
to determine if the APP priority for FCoE/iSCSI/FIP is valid or not in
CEE DCBX mode.

This patch adds to support those additional checks and will only add
applications to the software table that have oper and sync bits set
without any error.

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Huilong Xu <huilongx.xu@intel.com>
drivers/net/i40e/base/i40e_dcb.c

index 65d74fae268b0282fd87ed11b95a7a07459238fe..d71387ffdc6bcbe082c66c7e449d6591ff569933 100644 (file)
@@ -697,14 +697,17 @@ static void i40e_cee_to_dcb_config(
        /* CEE PG data to ETS config */
        dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;
 
+       /* Note that the FW creates the oper_prio_tc nibbles reversed
+        * from those in the CEE Priority Group sub-TLV.
+        */
        for (i = 0; i < 4; i++) {
-               tc = (u8)((cee_cfg->oper_prio_tc[i] &
-                        I40E_CEE_PGID_PRIO_1_MASK) >>
-                        I40E_CEE_PGID_PRIO_1_SHIFT);
-               dcbcfg->etscfg.prioritytable[i*2] =  tc;
                tc = (u8)((cee_cfg->oper_prio_tc[i] &
                         I40E_CEE_PGID_PRIO_0_MASK) >>
                         I40E_CEE_PGID_PRIO_0_SHIFT);
+               dcbcfg->etscfg.prioritytable[i*2] =  tc;
+               tc = (u8)((cee_cfg->oper_prio_tc[i] &
+                        I40E_CEE_PGID_PRIO_1_MASK) >>
+                        I40E_CEE_PGID_PRIO_1_SHIFT);
                dcbcfg->etscfg.prioritytable[i*2 + 1] = tc;
        }
 
@@ -726,37 +729,55 @@ static void i40e_cee_to_dcb_config(
        dcbcfg->pfc.pfcenable = cee_cfg->oper_pfc_en;
        dcbcfg->pfc.pfccap = I40E_MAX_TRAFFIC_CLASS;
 
-       status = (tlv_status & I40E_AQC_CEE_APP_STATUS_MASK) >>
-                 I40E_AQC_CEE_APP_STATUS_SHIFT;
+       i = 0;
+       status = (tlv_status & I40E_AQC_CEE_FCOE_STATUS_MASK) >>
+                 I40E_AQC_CEE_FCOE_STATUS_SHIFT;
        err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
        sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
        oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
-       /* Add APPs if Error is False and Oper/Sync is True */
+       /* Add FCoE APP if Error is False and Oper/Sync is True */
        if (!err && sync && oper) {
-               /* CEE operating configuration supports FCoE/iSCSI/FIP only */
-               dcbcfg->numapps = I40E_CEE_OPER_MAX_APPS;
-
                /* FCoE APP */
-               dcbcfg->app[0].priority =
+               dcbcfg->app[i].priority =
                        (app_prio & I40E_AQC_CEE_APP_FCOE_MASK) >>
                         I40E_AQC_CEE_APP_FCOE_SHIFT;
-               dcbcfg->app[0].selector = I40E_APP_SEL_ETHTYPE;
-               dcbcfg->app[0].protocolid = I40E_APP_PROTOID_FCOE;
+               dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE;
+               dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FCOE;
+               i++;
+       }
 
+       status = (tlv_status & I40E_AQC_CEE_ISCSI_STATUS_MASK) >>
+                 I40E_AQC_CEE_ISCSI_STATUS_SHIFT;
+       err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
+       sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
+       oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
+       /* Add iSCSI APP if Error is False and Oper/Sync is True */
+       if (!err && sync && oper) {
                /* iSCSI APP */
-               dcbcfg->app[1].priority =
+               dcbcfg->app[i].priority =
                        (app_prio & I40E_AQC_CEE_APP_ISCSI_MASK) >>
                         I40E_AQC_CEE_APP_ISCSI_SHIFT;
-               dcbcfg->app[1].selector = I40E_APP_SEL_TCPIP;
-               dcbcfg->app[1].protocolid = I40E_APP_PROTOID_ISCSI;
+               dcbcfg->app[i].selector = I40E_APP_SEL_TCPIP;
+               dcbcfg->app[i].protocolid = I40E_APP_PROTOID_ISCSI;
+               i++;
+       }
 
+       status = (tlv_status & I40E_AQC_CEE_FIP_STATUS_MASK) >>
+                 I40E_AQC_CEE_FIP_STATUS_SHIFT;
+       err = (status & I40E_TLV_STATUS_ERR) ? 1 : 0;
+       sync = (status & I40E_TLV_STATUS_SYNC) ? 1 : 0;
+       oper = (status & I40E_TLV_STATUS_OPER) ? 1 : 0;
+       /* Add FIP APP if Error is False and Oper/Sync is True */
+       if (!err && sync && oper) {
                /* FIP APP */
-               dcbcfg->app[2].priority =
+               dcbcfg->app[i].priority =
                        (app_prio & I40E_AQC_CEE_APP_FIP_MASK) >>
                         I40E_AQC_CEE_APP_FIP_SHIFT;
-               dcbcfg->app[2].selector = I40E_APP_SEL_ETHTYPE;
-               dcbcfg->app[2].protocolid = I40E_APP_PROTOID_FIP;
+               dcbcfg->app[i].selector = I40E_APP_SEL_ETHTYPE;
+               dcbcfg->app[i].protocolid = I40E_APP_PROTOID_FIP;
+               i++;
        }
+       dcbcfg->numapps = i;
 }
 
 /**