fm10k/base: document ITR scale workaround
Add comments which properly explain the undocumented use of bits in TDLEN register prior to VF initializing it to the correct value. Note that the mechanism is entirely software-defined and explain its purpose to help reduce confusion in the future. 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>
This commit is contained in:
parent
360c4545e0
commit
a177f52f90
@ -958,7 +958,8 @@ STATIC s32 fm10k_iov_assign_default_mac_vlan_pf(struct fm10k_hw *hw,
|
||||
FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx), tdbah);
|
||||
|
||||
/* Provide the VF the ITR scale, using software-defined fields in TDLEN
|
||||
* to pass the information during VF initialization
|
||||
* to pass the information during VF initialization. See definition of
|
||||
* FM10K_TDLEN_ITR_SCALE_SHIFT for more details.
|
||||
*/
|
||||
FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx), hw->mac.itr_scale <<
|
||||
FM10K_TDLEN_ITR_SCALE_SHIFT);
|
||||
@ -1095,6 +1096,9 @@ STATIC s32 fm10k_iov_reset_resources_pf(struct fm10k_hw *hw,
|
||||
for (i = queues_per_pool; i--;) {
|
||||
FM10K_WRITE_REG(hw, FM10K_TDBAL(vf_q_idx + i), tdbal);
|
||||
FM10K_WRITE_REG(hw, FM10K_TDBAH(vf_q_idx + i), tdbah);
|
||||
/* See definition of FM10K_TDLEN_ITR_SCALE_SHIFT for an
|
||||
* explanation of how TDLEN is used.
|
||||
*/
|
||||
FM10K_WRITE_REG(hw, FM10K_TDLEN(vf_q_idx + i),
|
||||
hw->mac.itr_scale <<
|
||||
FM10K_TDLEN_ITR_SCALE_SHIFT);
|
||||
|
@ -350,6 +350,15 @@ struct fm10k_hw;
|
||||
#define FM10K_TDBAL(_n) ((0x40 * (_n)) + 0x8000)
|
||||
#define FM10K_TDBAH(_n) ((0x40 * (_n)) + 0x8001)
|
||||
#define FM10K_TDLEN(_n) ((0x40 * (_n)) + 0x8002)
|
||||
/* When fist initialized, VFs need to know the Interrupt Throttle Rate (ITR)
|
||||
* scale which is based on the PCIe speed but the speed information in the PCI
|
||||
* configuration space may not be accurate. The PF already knows the ITR scale
|
||||
* but there is no defined method to pass that information from the PF to the
|
||||
* VF. This is accomplished during VF initialization by temporarily co-opting
|
||||
* the yet-to-be-used TDLEN register to have the PF store the ITR shift for
|
||||
* the VF to retrieve before the VF needs to use the TDLEN register for its
|
||||
* intended purpose, i.e. before the Tx resources are allocated.
|
||||
*/
|
||||
#define FM10K_TDLEN_ITR_SCALE_SHIFT 9
|
||||
#define FM10K_TDLEN_ITR_SCALE_MASK 0x00000E00
|
||||
#define FM10K_TDLEN_ITR_SCALE_GEN1 2
|
||||
|
@ -74,6 +74,11 @@ STATIC s32 fm10k_stop_hw_vf(struct fm10k_hw *hw)
|
||||
FM10K_WRITE_REG(hw, FM10K_TDBAH(i), bah);
|
||||
FM10K_WRITE_REG(hw, FM10K_RDBAL(i), bal);
|
||||
FM10K_WRITE_REG(hw, FM10K_RDBAH(i), bah);
|
||||
/* Restore ITR scale in software-defined mechanism in TDLEN
|
||||
* for next VF initialization. See definition of
|
||||
* FM10K_TDLEN_ITR_SCALE_SHIFT for more details on the use of
|
||||
* TDLEN here.
|
||||
*/
|
||||
FM10K_WRITE_REG(hw, FM10K_TDLEN(i), tdlen);
|
||||
}
|
||||
|
||||
@ -157,6 +162,10 @@ STATIC s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
|
||||
/* fetch default VLAN and ITR scale */
|
||||
hw->mac.default_vid = (FM10K_READ_REG(hw, FM10K_TXQCTL(0)) &
|
||||
FM10K_TXQCTL_VID_MASK) >> FM10K_TXQCTL_VID_SHIFT;
|
||||
/* Read the ITR scale from TDLEN. See the definition of
|
||||
* FM10K_TDLEN_ITR_SCALE_SHIFT for more information about how TDLEN is
|
||||
* used here.
|
||||
*/
|
||||
hw->mac.itr_scale = (FM10K_READ_REG(hw, FM10K_TDLEN(0)) &
|
||||
FM10K_TDLEN_ITR_SCALE_MASK) >>
|
||||
FM10K_TDLEN_ITR_SCALE_SHIFT;
|
||||
|
Loading…
Reference in New Issue
Block a user