Thread (30 messages) 30 messages, 2 authors, 2015-10-07

[PATCH 09/28] fm10k: ensure itr_scale is set even if we don't know speed

flat view
STALE4033d

From: Wang Xiao W <hidden>
Date: 2015-09-10 04:39:06
Subsystem: networking drivers, the rest · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

To prevent divide-by-zero issues, ensure that we always have an ITR
scale. Default to Gen3 scaling if we don't know the speed. Also ensure
the VF checks the register value and ensures we use Gen3 if we are
provided a zero value.

Signed-off-by: Wang Xiao W <redacted>
---
 drivers/net/fm10k/base/fm10k_pf.c | 2 ++
 drivers/net/fm10k/base/fm10k_vf.c | 4 ++++
 2 files changed, 6 insertions(+)
diff --git a/drivers/net/fm10k/base/fm10k_pf.c b/drivers/net/fm10k/base/fm10k_pf.c
index 5b66960..6bc6907 100644
--- a/drivers/net/fm10k/base/fm10k_pf.c
+++ b/drivers/net/fm10k/base/fm10k_pf.c
@@ -187,6 +187,8 @@ STATIC s32 fm10k_init_hw_pf(struct fm10k_hw *hw)
 		break;
 	default:
 		dma_ctrl = 0;
+		/* just in case, assume Gen3 ITR scale */
+		hw->mac.itr_scale = FM10K_TDLEN_ITR_SCALE_GEN3;
 		break;
 	}
 
diff --git a/drivers/net/fm10k/base/fm10k_vf.c b/drivers/net/fm10k/base/fm10k_vf.c
index 7981417..ba7c7c1 100644
--- a/drivers/net/fm10k/base/fm10k_vf.c
+++ b/drivers/net/fm10k/base/fm10k_vf.c
@@ -154,6 +154,10 @@ 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;
 }
 
-- 
1.9.3
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help