[PATCH rtems 05/18] mv643xx_eth_bsdnet.c: use default descriptor ring size if ifconfig says 0

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


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

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

diff --git a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
index 1d920df342..25631d76c3 100644
--- a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
+++ b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
@@ -113,45 +113,6 @@
 /* Enable debugging messages and some support routines  (dump rings etc.)                    */      
 #undef  MVETH_DEBUG
 
-/* Ring sizes */
-
-#ifdef MVETH_TESTING
-
-/* hard and small defaults */
-#undef  MV643XX_RX_RING_SIZE
-#define MV643XX_RX_RING_SIZE	2
-#undef  MV643XX_TX_RING_SIZE
-#define MV643XX_TX_RING_SIZE	4
-
-#else /* MVETH_TESTING */
-
-/* Define default ring sizes, allow override from bsp.h, Makefile,... and from ifcfg->rbuf_count/xbuf_count */
-
-#ifndef MV643XX_RX_RING_SIZE
-#define MV643XX_RX_RING_SIZE	40	/* attached buffers are always 2k clusters, i.e., this
-									 * driver - with a configured ring size of 40 - constantly
-									 * locks 80k of cluster memory - your app config better
-									 * provides enough space!
-									 */
-#endif
-
-#ifndef MV643XX_TX_RING_SIZE
-/* NOTE: tx ring size MUST be > max. # of fragments / mbufs in a chain;
- *       in 'TESTING' mode, special code is compiled in to repackage
- *		 chains that are longer than the ring size. Normally, this is
- *		 disabled for sake of speed.
- *		 I observed chains of >17 entries regularly!
- *
- *       Also, TX_NUM_TAG_SLOTS (1) must be left empty as a marker, hence
- *       the ring size must be > max. #frags + 1.
- */
-#define MV643XX_TX_RING_SIZE	200	/* these are smaller fragments and not occupied when
-									 * the driver is idle.
-									 */
-#endif
-
-#endif /* MVETH_TESTING */
-
 /* How many instances to we support (bsp.h could override) */
 #ifndef MV643XXETH_NUM_DRIVER_SLOTS
 #define MV643XXETH_NUM_DRIVER_SLOTS	2
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 e8819be6bf..b3ec1542ff 100644
--- a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c
+++ b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth_bsdnet.c
@@ -1271,6 +1271,14 @@ struct	ifnet		*ifp;
 			mveth_tid = rtems_bsdnet_newproc("MVEd", 4096, mveth_daemon, 0);
 		}
 
+		if ( 0 == ifcfg->rbuf_count ) {
+			ifcfg->rbuf_count = MV643XX_RX_RING_SIZE;
+		}
+
+		if ( 0 == ifcfg->xbuf_count ) {
+			ifcfg->xbuf_count = MV643XX_TX_RING_SIZE;
+		}
+
 		if ( !BSP_mve_setup( unit,
 						     mveth_tid,
 						     release_tx_mbuf, ifp,
-- 
2.26.2



More information about the devel mailing list