* [Intel-wired-lan] [PATCH v1 1/1] e1000e: Fix the max snoop/no-snoop latency for 10M
@ 2021-07-04 7:11 Sasha Neftin
2021-08-08 8:35 ` Fuxbrumer, Dvora
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Neftin @ 2021-07-04 7:11 UTC (permalink / raw)
To: intel-wired-lan
We should decode the latency and the max_latency before directly compare.
The latency should be presented as lat_enc = scale x value:
lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00)
>> 10)))
Suggested-by: Yee Li <seven.yi.lee@gmail.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
---
drivers/net/ethernet/intel/e1000e/ich8lan.c | 14 +++++++++++++-
drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
index 0f6a0b1b433a..8c5dc72c3bd6 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
@@ -1009,6 +1009,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
{
u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) |
link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND;
+ u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */
+ u16 lat_enc_d = 0; /* latency decoded */
u16 lat_enc = 0; /* latency encoded */
if (link) {
@@ -1062,7 +1064,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link)
E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop);
max_ltr_enc = max_t(u16, max_snoop, max_nosnoop);
- if (lat_enc > max_ltr_enc)
+ lat_enc_d = (lat_enc & E1000_LTRV_VALUE_MASK) *
+ (1U << (E1000_LTRV_SCALE_FACTOR *
+ ((lat_enc & E1000_LTRV_SCALE_MASK)
+ >> E1000_LTRV_SCALE_SHIFT)));
+
+ max_ltr_enc_d = (max_ltr_enc & E1000_LTRV_VALUE_MASK) *
+ (1U << (E1000_LTRV_SCALE_FACTOR *
+ ((max_ltr_enc & E1000_LTRV_SCALE_MASK)
+ >> E1000_LTRV_SCALE_SHIFT)));
+
+ if (lat_enc_d > max_ltr_enc_d)
lat_enc = max_ltr_enc;
}
diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h
index 9b145f6248a8..d6a092e5ee74 100644
--- a/drivers/net/ethernet/intel/e1000e/ich8lan.h
+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h
@@ -277,8 +277,11 @@
/* Latency Tolerance Reporting */
#define E1000_LTRV 0x000F8
+#define E1000_LTRV_VALUE_MASK 0x000003FF
#define E1000_LTRV_SCALE_MAX 5
#define E1000_LTRV_SCALE_FACTOR 5
+#define E1000_LTRV_SCALE_SHIFT 10
+#define E1000_LTRV_SCALE_MASK 0x00001C00
#define E1000_LTRV_REQ_SHIFT 15
#define E1000_LTRV_NOSNOOP_SHIFT 16
#define E1000_LTRV_SEND (1 << 30)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Intel-wired-lan] [PATCH v1 1/1] e1000e: Fix the max snoop/no-snoop latency for 10M
2021-07-04 7:11 [Intel-wired-lan] [PATCH v1 1/1] e1000e: Fix the max snoop/no-snoop latency for 10M Sasha Neftin
@ 2021-08-08 8:35 ` Fuxbrumer, Dvora
0 siblings, 0 replies; 2+ messages in thread
From: Fuxbrumer, Dvora @ 2021-08-08 8:35 UTC (permalink / raw)
To: intel-wired-lan
On 7/4/2021 10:11, Sasha Neftin wrote:
> We should decode the latency and the max_latency before directly compare.
> The latency should be presented as lat_enc = scale x value:
> lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00)
>>> 10)))
>
> Suggested-by: Yee Li <seven.yi.lee@gmail.com>
> Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
> ---
> drivers/net/ethernet/intel/e1000e/ich8lan.c | 14 +++++++++++++-
> drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-08 8:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 7:11 [Intel-wired-lan] [PATCH v1 1/1] e1000e: Fix the max snoop/no-snoop latency for 10M Sasha Neftin
2021-08-08 8:35 ` Fuxbrumer, Dvora
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.