[ipxe-devel] [PATCH intelxvf v2 2/2] [intelxvf] disable the tx and rx rings on destroy

Vishvananda Ishaya Abrams vish.ishaya at oracle.com
Thu Dec 22 01:10:31 UTC 2016


The intel niantic nic is not happy if we leave a ring enabled but set
its length to zero, so properly disable the ring when we exit.
---
 src/drivers/net/intel.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/drivers/net/intel.c b/src/drivers/net/intel.c
index 626a0c3..fb99ba6 100644
--- a/src/drivers/net/intel.c
+++ b/src/drivers/net/intel.c
@@ -489,6 +489,9 @@ void intel_clear_descriptor ( struct intel_nic *intel, unsigned int reg ) {
 	while ( (readl ( intel->regs + reg + INTEL_xDCTL ) & INTEL_xDCTL_ENABLE) != 0 )
 		DBGC ( intel, "WAITING FOR RXD RESET\n" );
 
+	/* Datasheet says to sleep for at least 100 us, so 10 ms should be enough */
+	mdelay ( 10 );
+
 	/* Clear ring length */
 	writel ( 0, ( intel->regs + reg + INTEL_xDLEN ) );
 
@@ -508,13 +511,8 @@ void intel_clear_descriptor ( struct intel_nic *intel, unsigned int reg ) {
  * @v ring		Descriptor ring
  */
 void intel_destroy_ring ( struct intel_nic *intel, struct intel_ring *ring ) {
-
-	/* Clear ring length */
-	writel ( 0, ( intel->regs + ring->reg + INTEL_xDLEN ) );
-
-	/* Clear ring address */
-	writel ( 0, ( intel->regs + ring->reg + INTEL_xDBAL ) );
-	writel ( 0, ( intel->regs + ring->reg + INTEL_xDBAH ) );
+	/* Clear descriptor */
+	intel_clear_descriptor ( intel, ring->reg );
 
 	/* Free descriptor ring */
 	free_dma ( ring->desc, ring->len );
-- 
2.5.0




More information about the ipxe-devel mailing list