[PATCH rtems 04/18] removed direct access to ring-size / ring-available from BSD driver

Vijay Kumar Banerjee vijay at rtems.org
Tue Mar 30 01:27:36 UTC 2021


From: till straumann <till.straumann at alumni.tu-berlin.de>

Update #4344
---
 bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c      |  6 +++---
 .../beatnik/net/if_mve/mv643xx_eth_bsdnet.c        | 14 +++++++++-----
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
index 9d23d22898..1d920df342 100644
--- a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
+++ b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
@@ -108,10 +108,10 @@
 /* Compile-time debugging features */
 
 /* Enable paranoia assertions and checks; reduce # of descriptors to minimum for stressing   */
-#define MVETH_TESTING
+#undef  MVETH_TESTING
 
 /* Enable debugging messages and some support routines  (dump rings etc.)                    */      
-#define MVETH_DEBUG
+#undef  MVETH_DEBUG
 
 /* Ring sizes */
 
@@ -1726,7 +1726,7 @@ register MvEthTxDesc	d;
 	mp->d_tx_t = d;
 	mp->avail += rval;
 
-	return rval;
+	return mp->avail;
 }
 
 int
diff --git a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c
index 3f85e2c78a..e8819be6bf 100644
--- a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c
+++ b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c
@@ -135,6 +135,7 @@
 /* Enable Hardware Snooping; if this is disabled (undefined),
  * cache coherency is maintained by software.
  */
+#undef  ENABLE_HW_SNOOPING
 
 /* Compile-time debugging features */
 
@@ -543,6 +544,8 @@ typedef uint32_t Dma_addr_t;
 /* stuff needed for bsdnet support */
 struct mveth_bsdsupp {
 	int				oif_flags;					/* old / cached if_flags */
+	int             tx_ring_size;
+	int             rx_ring_size;
 };
 
 struct mveth_softc {
@@ -665,6 +668,9 @@ struct mveth_private *mp;
 		}
 	}
 
+	theMvEths[unit-1].bsd.tx_ring_size = tx_ring_size;
+	theMvEths[unit-1].bsd.rx_ring_size = rx_ring_size;
+
 	/* mark as used */
 	ifp->if_init = (void*)(-1);
 
@@ -1172,6 +1178,7 @@ static void mveth_daemon(void *arg)
 struct mveth_softc	*sc;
 struct ifnet		*ifp;
 rtems_event_set		evs;
+int                 avail;
 	for (;;) {
 		rtems_bsdnet_event_receive( 7, RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &evs );
 		evs &= 7;
@@ -1211,13 +1218,10 @@ rtems_event_set		evs;
 					}
 				}
 				/* free tx chain */
-				if ( (MV643XX_ETH_EXT_IRQ_TX_DONE & x) && BSP_mve_swipe_tx(sc->pvt) ) {
+				if ( (MV643XX_ETH_EXT_IRQ_TX_DONE & x) && (avail = BSP_mve_swipe_tx(sc->pvt)) > 0 ) {
 					ifp->if_flags &= ~IFF_OACTIVE;
-#warning FIXME
-#ifdef BSDBSD
-					if ( TX_AVAILABLE_RING_SIZE(sc->pvt) == sc->pvt->avail )
+					if ( sc->bsd.tx_ring_size == avail )
 						ifp->if_timer = 0;
-#endif
 					mveth_start(ifp);
 				}
 				if ( (MV643XX_ETH_IRQ_RX_DONE & x) )
-- 
2.26.2



More information about the devel mailing list