fm10k/base: use bit shift for ITR scale
authorXiao Wang <xiao.w.wang@intel.com>
Fri, 19 Feb 2016 11:06:51 +0000 (19:06 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 17:51:44 +0000 (18:51 +0100)
Use bitshift instead of a divisor, because this is faster, and
eliminates any need for a '0' check. In our case, this even works
out because default Gen3 will be 0.

Because of this, we are also able to remove the check for non-zero value
in the VF code path since that will already be the default Gen3 case.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
Tested-by: Heng Ding <hengx.ding@intel.com>
Acked-by: Jing Chen <jing.d.chen@intel.com>
drivers/net/fm10k/base/fm10k_type.h
drivers/net/fm10k/base/fm10k_vf.c

index df1d276..4bc0d53 100644 (file)
@@ -352,9 +352,9 @@ struct fm10k_hw;
 #define FM10K_TDLEN(_n)                ((0x40 * (_n)) + 0x8002)
 #define FM10K_TDLEN_ITR_SCALE_SHIFT            9
 #define FM10K_TDLEN_ITR_SCALE_MASK             0x00000E00
-#define FM10K_TDLEN_ITR_SCALE_GEN1             4
-#define FM10K_TDLEN_ITR_SCALE_GEN2             2
-#define FM10K_TDLEN_ITR_SCALE_GEN3             1
+#define FM10K_TDLEN_ITR_SCALE_GEN1             2
+#define FM10K_TDLEN_ITR_SCALE_GEN2             1
+#define FM10K_TDLEN_ITR_SCALE_GEN3             0
 #define FM10K_TPH_TXCTRL(_n)   ((0x40 * (_n)) + 0x8003)
 #define FM10K_TPH_TXCTRL_DESC_TPHEN            0x00000020
 #define FM10K_TPH_TXCTRL_DESC_RROEN            0x00000200
index 7822ab6..39bc927 100644 (file)
@@ -159,10 +159,6 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
                             FM10K_TDLEN_ITR_SCALE_MASK) >>
                            FM10K_TDLEN_ITR_SCALE_SHIFT;
 
-       /* ensure a non-zero itr scale */
-       if (!hw->mac.itr_scale)
-               hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
-
        return FM10K_SUCCESS;
 }