Module Name:    src
Committed By:   thorpej
Date:           Sun Sep 18 11:38:48 UTC 2022

Modified Files:
        src/sys/arch/mips/cavium/dev: if_cnmac.c if_cnmacvar.h

Log Message:
Eliminate use of IFF_OACTIVE.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/mips/cavium/dev/if_cnmac.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/if_cnmacvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.27
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26	Thu May 27 03:23:29 2021
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Sun Sep 18 11:38:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.27 2022/09/18 11:38:48 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.27 2022/09/18 11:38:48 thorpej Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -546,7 +546,6 @@ cnmac_send_queue_flush_fetch(struct cnma
 static inline void
 cnmac_send_queue_flush(struct cnmac_softc *sc)
 {
-	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	const int64_t sent_count = sc->sc_hard_done_cnt;
 	int i;
 
@@ -563,7 +562,7 @@ cnmac_send_queue_flush(struct cnmac_soft
 
 		m_freem(m);
 
-		CLR(ifp->if_flags, IFF_OACTIVE);
+		sc->sc_txbusy = false;
 	}
 
 	octfau_op_inc_fetch_8(&sc->sc_fau_done, i);
@@ -996,7 +995,10 @@ cnmac_start(struct ifnet *ifp)
 	 */
 	cnmac_send_queue_flush_prefetch(sc);
 
-	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
+	if ((ifp->if_flags & IFF_RUNNING) == 0)
+		goto last;
+
+	if (sc->sc_txbusy)
 		goto last;
 
 	if (__predict_false(!octgmx_link_status(sc->sc_gmx_port)))
@@ -1015,7 +1017,7 @@ cnmac_start(struct ifnet *ifp)
 		 * buffers and bail out.
 		 */
 		if (cnmac_send_queue_is_full(sc)) {
-			SET(ifp->if_flags, IFF_OACTIVE);
+			sc->sc_txbusy = true;
 			if (wdc > 0)
 				octpko_op_doorbell_write(sc->sc_port,
 				    sc->sc_port, wdc);
@@ -1066,7 +1068,7 @@ cnmac_watchdog(struct ifnet *ifp)
 	cnmac_configure(sc);
 
 	SET(ifp->if_flags, IFF_RUNNING);
-	CLR(ifp->if_flags, IFF_OACTIVE);
+	sc->sc_txbusy = false;
 	ifp->if_timer = 0;
 
 	cnmac_start(ifp);
@@ -1100,7 +1102,7 @@ cnmac_init(struct ifnet *ifp)
 	callout_schedule(&sc->sc_tick_free_ch, hz);
 
 	SET(ifp->if_flags, IFF_RUNNING);
-	CLR(ifp->if_flags, IFF_OACTIVE);
+	sc->sc_txbusy = false;
 
 	return 0;
 }
@@ -1118,7 +1120,8 @@ cnmac_stop(struct ifnet *ifp, int disabl
 	octgmx_port_enable(sc->sc_gmx_port, 0);
 
 	/* Mark the interface as down and cancel the watchdog timer. */
-	CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
+	CLR(ifp->if_flags, IFF_RUNNING);
+	sc->sc_txbusy = false;
 	ifp->if_timer = 0;
 }
 

Index: src/sys/arch/mips/cavium/dev/if_cnmacvar.h
diff -u src/sys/arch/mips/cavium/dev/if_cnmacvar.h:1.4 src/sys/arch/mips/cavium/dev/if_cnmacvar.h:1.5
--- src/sys/arch/mips/cavium/dev/if_cnmacvar.h:1.4	Tue Jun 23 05:17:13 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmacvar.h	Sun Sep 18 11:38:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmacvar.h,v 1.4 2020/06/23 05:17:13 simonb Exp $	*/
+/*	$NetBSD: if_cnmacvar.h,v 1.5 2022/09/18 11:38:48 thorpej Exp $	*/
 
 #undef DEBUG
 #ifdef DEBUG
@@ -64,6 +64,7 @@ struct cnmac_softc {
 	SIMPLEQ_HEAD(, _send_queue_entry)
 				sc_sendq;
 	uint64_t		sc_ext_callback_cnt;
+	bool			sc_txbusy;
 
 	uint32_t		sc_port;
 	uint32_t		sc_port_type;

Reply via email to