[PATCH rtems 06/18] mv643xx_eth.h: iterator callback takes no const arg

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


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

Update #4344
---
 bsps/powerpc/beatnik/include/bsp/mv643xx_eth.h | 2 +-
 bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c  | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/bsps/powerpc/beatnik/include/bsp/mv643xx_eth.h b/bsps/powerpc/beatnik/include/bsp/mv643xx_eth.h
index f963b91d3d..6a7dbacf69 100644
--- a/bsps/powerpc/beatnik/include/bsp/mv643xx_eth.h
+++ b/bsps/powerpc/beatnik/include/bsp/mv643xx_eth.h
@@ -70,7 +70,7 @@ typedef struct MveEthBufIter {
 	                        reasons)                             */
 } MveEthBufIter;
 
-typedef MveEthBufIter *(*MveEthBufIterNext)(const MveEthBufIter*);
+typedef MveEthBufIter *(*MveEthBufIterNext)(MveEthBufIter*);
 
 int
 BSP_mve_send_buf_chain(struct mveth_private *mp, MveEthBufIterNext next, MveEthBufIter *it);
diff --git a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
index 25631d76c3..b475711fef 100644
--- a/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
+++ b/bsps/powerpc/beatnik/net/if_mve/mv643xx_eth.c
@@ -1830,6 +1830,7 @@ register MvEthTxDesc	l,d,h;
 int						needed;
 void                    *frst_buf;
 int                     frst_len;
+void                    *uarg;
 
 	rval = 0;
 
@@ -1855,13 +1856,17 @@ int                     frst_len;
 #endif
 
 	/* find the 'first' user buffer */
-	if ( (frst_buf = head_p) ) {
+	if ( (frst_buf = head_p) && (h_len > 0) ) {
 		frst_len = h_len;
 	} else {
 		frst_buf = data_p;
 		frst_len = d_len;
 	}
 
+	uarg = (head_p && ! h_len) ? head_p : frst_buf;
+
+	/* Legacy: if h_len == 0 but head_p is not then use that for the user arg */
+
 	/* Don't use the first descriptor yet because BSP_mve_swipe_tx()
 	 * needs mp->d_tx_h->buf_ptr == NULL as a marker. Hence, we
 	 * start with the second (optional) slot and fill the first
@@ -1898,7 +1903,7 @@ int                     frst_len;
 	l->cmd_sts |= TDESC_LAST | TDESC_INT_ENA;
 
 	/* first buffer of 'chain' goes into last desc */
-	l->u_buf    = frst_buf;
+	l->u_buf    = uarg;
 
 	FLUSH_DESC(l);
 
-- 
2.26.2



More information about the devel mailing list