ixgbe/base: allow to read rtrup2tc register
authorJijiang Liu <jijiang.liu@intel.com>
Wed, 18 Jun 2014 18:46:21 +0000 (20:46 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 18 Jun 2014 21:31:09 +0000 (23:31 +0200)
Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
Tested-by: Waterman Cao <waterman.cao@intel.com>
[Thomas: split code drop]

lib/librte_pmd_ixgbe/ixgbe/ixgbe_82598.c
lib/librte_pmd_ixgbe/ixgbe/ixgbe_82599.c
lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.c
lib/librte_pmd_ixgbe/ixgbe/ixgbe_api.h
lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.c
lib/librte_pmd_ixgbe/ixgbe/ixgbe_common.h
lib/librte_pmd_ixgbe/ixgbe/ixgbe_dcb_82599.h
lib/librte_pmd_ixgbe/ixgbe/ixgbe_type.h
lib/librte_pmd_ixgbe/ixgbe/ixgbe_x540.c

index 0425cf9..37f572d 100644 (file)
@@ -173,6 +173,8 @@ s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw)
        /* Manageability interface */
        mac->ops.set_fw_drv_ver = NULL;
 
+       mac->ops.get_rtrup2tc = NULL;
+
        return ret_val;
 }
 
index 26ff26c..b97be6b 100644 (file)
@@ -299,6 +299,8 @@ s32 ixgbe_init_ops_82599(struct ixgbe_hw *hw)
        mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic;
 
 
+       mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
+
        return ret_val;
 }
 
index 20c014c..57869a7 100644 (file)
@@ -35,6 +35,19 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "ixgbe_common.h"
 #ident "$Id: ixgbe_api.c,v 1.187 2012/11/08 10:11:52 jtkirshe Exp $"
 
+/**
+ * ixgbe_dcb_get_rtrup2tc - read rtrup2tc reg
+ * @hw: pointer to hardware structure
+ * @map: pointer to u8 arr for returning map
+ *
+ * Read the rtrup2tc HW register and resolve its content into map
+ **/
+void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map)
+{
+       if (hw->mac.ops.get_rtrup2tc)
+               hw->mac.ops.get_rtrup2tc(hw, map);
+}
+
 /**
  *  ixgbe_init_shared_code - Initialize the shared code
  *  @hw: pointer to hardware structure
index 048cde9..ae40e46 100644 (file)
@@ -37,6 +37,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "ixgbe_type.h"
 #ident "$Id: ixgbe_api.h,v 1.115 2012/08/23 23:30:15 jtkirshe Exp $"
 
+void ixgbe_dcb_get_rtrup2tc(struct ixgbe_hw *hw, u8 *map);
+
 s32 ixgbe_init_shared_code(struct ixgbe_hw *hw);
 
 extern s32 ixgbe_init_ops_82598(struct ixgbe_hw *hw);
index 1cb6e4e..9c1fe26 100644 (file)
@@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
+#include "ixgbe_dcb.h"
+#include "ixgbe_dcb_82599.h"
 #include "ixgbe_api.h"
 #ident "$Id: ixgbe_common.c,v 1.382 2013/11/22 01:02:01 jtkirshe Exp $"
 
@@ -4527,3 +4529,21 @@ void ixgbe_clear_tx_pending(struct ixgbe_hw *hw)
        IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
 }
 
+
+/**
+ * ixgbe_dcb_get_rtrup2tc_generic - read rtrup2tc reg
+ * @hw: pointer to hardware structure
+ * @map: pointer to u8 arr for returning map
+ *
+ * Read the rtrup2tc HW register and resolve its content into map
+ **/
+void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map)
+{
+       u32 reg, i;
+
+       reg = IXGBE_READ_REG(hw, IXGBE_RTRUP2TC);
+       for (i = 0; i < IXGBE_DCB_MAX_USER_PRIORITY; i++)
+               map[i] = IXGBE_RTRUP2TC_UP_MASK &
+                       (reg >> (i * IXGBE_RTRUP2TC_UP_SHIFT));
+       return;
+}
index 6c70ca7..38177b3 100644 (file)
@@ -49,6 +49,8 @@ struct ixgbe_pba {
        u16 *pba_block;
 };
 
+void ixgbe_dcb_get_rtrup2tc_generic(struct ixgbe_hw *hw, u8 *map);
+
 u16 ixgbe_get_pcie_msix_count_generic(struct ixgbe_hw *hw);
 s32 ixgbe_init_ops_generic(struct ixgbe_hw *hw);
 s32 ixgbe_init_hw_generic(struct ixgbe_hw *hw);
index 1d78113..05d9232 100644 (file)
@@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* Receive UP2TC mapping */
 #define IXGBE_RTRUP2TC_UP_SHIFT        3
+#define IXGBE_RTRUP2TC_UP_MASK 7
 /* Transmit UP2TC mapping */
 #define IXGBE_RTTUP2TC_UP_SHIFT        3
 
index 61e2054..454ff29 100644 (file)
@@ -3075,6 +3075,7 @@ struct ixgbe_mac_operations {
 
        /* Manageability interface */
        s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
+       void (*get_rtrup2tc)(struct ixgbe_hw *hw, u8 *map);
 };
 
 struct ixgbe_phy_operations {
index 5983f94..ea1cef6 100644 (file)
@@ -148,6 +148,8 @@ s32 ixgbe_init_ops_X540(struct ixgbe_hw *hw)
        /* Manageability interface */
        mac->ops.set_fw_drv_ver = &ixgbe_set_fw_drv_ver_generic;
 
+       mac->ops.get_rtrup2tc = &ixgbe_dcb_get_rtrup2tc_generic;
+
        return ret_val;
 }