mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
drivers/net/{e1000|igc}: fix reinit for RX/TX rings
Descriptor head is managed by HW and should not be modified by SW unless: 1. device is after a reset 2. device is before enabling TX or RX Also set correct tail for RX which should point at the end of ring (descriptor ring is zero-indexed). Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
committed by
Xiang Xiao
parent
bdde180d7a
commit
0f537dcb97
+13
-5
@@ -438,6 +438,9 @@ static void igc_dump_mem(FAR struct igc_driver_s *priv, FAR const char *msg)
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumption:
|
||||
* This function can be called only after card reset and when TX is disabled
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void igc_txclean(FAR struct igc_driver_s *priv)
|
||||
@@ -478,6 +481,9 @@ static void igc_txclean(FAR struct igc_driver_s *priv)
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumption:
|
||||
* This function can be called only after card reset and when RX is disabled
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
static void igc_rxclean(FAR struct igc_driver_s *priv)
|
||||
@@ -485,7 +491,7 @@ static void igc_rxclean(FAR struct igc_driver_s *priv)
|
||||
priv->rx_now = 0;
|
||||
|
||||
igc_putreg_mem(priv, IGC_RDH0, 0);
|
||||
igc_putreg_mem(priv, IGC_RDT0, 0);
|
||||
igc_putreg_mem(priv, IGC_RDT0, IGC_RX_DESC - 1);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -1061,6 +1067,12 @@ static void igc_disable(FAR struct igc_driver_s *priv)
|
||||
|
||||
igc_putreg_mem(priv, IGC_RCTL, 0);
|
||||
|
||||
/* We have to reset device, otherwise writing to RDH and THD corrupts
|
||||
* the device state.
|
||||
*/
|
||||
|
||||
igc_putreg_mem(priv, IGC_CTRL, IGC_CTRL_DEVRST);
|
||||
|
||||
/* Reset Tx tail */
|
||||
|
||||
igc_txclean(priv);
|
||||
@@ -1214,10 +1226,6 @@ static void igc_enable(FAR struct igc_driver_s *priv)
|
||||
|
||||
igc_rxclean(priv);
|
||||
|
||||
/* All RX descriptors available */
|
||||
|
||||
igc_putreg_mem(priv, IGC_RDT0, IGC_RX_DESC);
|
||||
|
||||
#ifdef CONFIG_DEBUG_NET_INFO
|
||||
/* Dump memory */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user