Thread (15 messages) 15 messages, 3 authors, 2011-12-05

[net-next 3/6] igb: Update DMA Coalescing threshold calculation.

flat view
STALE5431d SUPERSEDED: 1 (0M)

From: Jeff Kirsher <hidden>
Date: 2011-12-03 11:44:35
Subsystem: intel ethernet drivers, networking drivers, the rest · Maintainers: Tony Nguyen, Przemek Kitszel, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Revision v1 of 220 in this series; 1 review trailer.

Revisions (220)
  1. v1
  2. v1
  3. v1
  4. v2 [diff vs current]
  5. v1
  6. v1
  7. v1
  8. v2 [diff vs current]
  9. v1
  10. v1
  11. v1
  12. v1
  13. v1
  14. v1
  15. v1
  16. v1
  17. v1
  18. v1
  19. v2 [diff vs current]
  20. v1
  21. v3 [diff vs current]
  22. v1
  23. v1
  24. v1
  25. v2 [diff vs current]
  26. v2 [diff vs current]
  27. v1
  28. v2 [diff vs current]
  29. v1
  30. v2 [diff vs current]
  31. v3 [diff vs current]
  32. v1
  33. v1
  34. v1 current
  35. v2 [diff vs current]
  36. v1
  37. v1
  38. v1
  39. v2 [diff vs current]
  40. v1
  41. v1
  42. v1
  43. v1
  44. v1
  45. v2 [diff vs current]
  46. v1
  47. v2 [diff vs current]
  48. v1
  49. v1
  50. v1
  51. v1
  52. v1
  53. v1
  54. v1
  55. v1
  56. v1
  57. v1
  58. v1
  59. v1
  60. v1
  61. v1
  62. v1
  63. v1
  64. v1
  65. v1
  66. v2 [diff vs current]
  67. v1
  68. v2 [diff vs current]
  69. v1
  70. v2 [diff vs current]
  71. v1
  72. v1
  73. v1
  74. v2 [diff vs current]
  75. v1
  76. v1
  77. v1
  78. v1
  79. v1
  80. v1
  81. v1
  82. v1
  83. v1
  84. v1
  85. v1
  86. v1
  87. v1
  88. v1
  89. v1
  90. v1
  91. v1
  92. v1
  93. v1
  94. v1
  95. v1
  96. v2 [diff vs current]
  97. v1
  98. v1
  99. v1
  100. v1
  101. v1
  102. v1
  103. v1
  104. v1
  105. v1
  106. v2 [diff vs current]
  107. v1
  108. v1
  109. v1
  110. v1
  111. v1
  112. v2 [diff vs current]
  113. v1
  114. v1
  115. v1
  116. v1
  117. v2 [diff vs current]
  118. v1
  119. v2 [diff vs current]
  120. v1
  121. v1
  122. v1
  123. v1
  124. v1
  125. v1
  126. v1
  127. v1
  128. v1
  129. v1
  130. v1
  131. v1
  132. v2 [diff vs current]
  133. v1
  134. v1
  135. v2 [diff vs current]
  136. v1
  137. v1
  138. v1
  139. v1
  140. v1
  141. v1
  142. v2 [diff vs current]
  143. v1
  144. v2 [diff vs current]
  145. v2 [diff vs current]
  146. v1
  147. v2 [diff vs current]
  148. v3 [diff vs current]
  149. v1
  150. v4 [diff vs current]
  151. v1
  152. v5 [diff vs current]
  153. v6 [diff vs current]
  154. v7 [diff vs current]
  155. v1
  156. v1
  157. v2 [diff vs current]
  158. v1
  159. v1
  160. v1
  161. v2 [diff vs current]
  162. v1
  163. v1
  164. v1
  165. v1
  166. v1
  167. v2 [diff vs current]
  168. v1
  169. v1
  170. v1
  171. v1
  172. v2 [diff vs current]
  173. v1
  174. v1
  175. v1
  176. v2 [diff vs current]
  177. v3 [diff vs current]
  178. v4 [diff vs current]
  179. v1
  180. v1
  181. v2 [diff vs current]
  182. v5 [diff vs current]
  183. v1
  184. v1
  185. v1
  186. v2 [diff vs current]
  187. v1
  188. v1
  189. v2 [diff vs current]
  190. v3 [diff vs current]
  191. v1
  192. v2 [diff vs current]
  193. v1
  194. v1
  195. v2 [diff vs current]
  196. v1
  197. v2 [diff vs current]
  198. v1
  199. v2 [diff vs current]
  200. v3 [diff vs current]
  201. v1
  202. v1
  203. v1
  204. v2 [diff vs current]
  205. v1
  206. v1
  207. v1
  208. v1
  209. v1
  210. v1
  211. v2 [diff vs current]
  212. v1
  213. v1
  214. v1
  215. v1
  216. v2 [diff vs current]
  217. v1
  218. v1
  219. v1
  220. v2 [diff vs current]
From: Matthew Vick <redacted>

This patch updates the DMA Coalescing feature parameters to account for
larger MTUs. Previously, sufficient space may not have been allocated in
the receive buffer, causing packet drop.

Signed-off-by: Matthew Vick <redacted>
Tested-by: Aaron Brown <redacted>
Signed-off-by: Jeff Kirsher <redacted>
---
 drivers/net/ethernet/intel/igb/igb_main.c |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index b66b8aa..143cfeb 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7061,15 +7061,28 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
 			wr32(E1000_DMCTXTH, 0);
 
 			/*
-			 * DMA Coalescing high water mark needs to be higher
-			 * than the RX threshold. set hwm to PBA -  2 * max
-			 * frame size
+			 * DMA Coalescing high water mark needs to be greater
+			 * than the Rx threshold. Set hwm to PBA - max frame
+			 * size in 16B units, capping it at PBA - 6KB.
 			 */
-			hwm = pba - (2 * adapter->max_frame_size);
+			hwm = 64 * pba - adapter->max_frame_size / 16;
+			if (hwm < 64 * (pba - 6))
+				hwm = 64 * (pba - 6);
+			reg = rd32(E1000_FCRTC);
+			reg &= ~E1000_FCRTC_RTH_COAL_MASK;
+			reg |= ((hwm << E1000_FCRTC_RTH_COAL_SHIFT)
+				& E1000_FCRTC_RTH_COAL_MASK);
+			wr32(E1000_FCRTC, reg);
+
+			/*
+			 * Set the DMA Coalescing Rx threshold to PBA - 2 * max
+			 * frame size, capping it at PBA - 10KB.
+			 */
+			dmac_thr = pba - adapter->max_frame_size / 512;
+			if (dmac_thr < pba - 10)
+				dmac_thr = pba - 10;
 			reg = rd32(E1000_DMACR);
 			reg &= ~E1000_DMACR_DMACTHR_MASK;
-			dmac_thr = pba - 4;
-
 			reg |= ((dmac_thr << E1000_DMACR_DMACTHR_SHIFT)
 				& E1000_DMACR_DMACTHR_MASK);
 
@@ -7085,7 +7098,6 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba)
 			 * coalescing(smart fifb)-UTRESH=0
 			 */
 			wr32(E1000_DMCRTRH, 0);
-			wr32(E1000_FCRTC, hwm);
 
 			reg = (IGB_DMCTLX_DCFLUSH_DIS | 0x4);
 
-- 
1.7.6.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help