bxe: more cleanup. Signed-off-by: Ron Minnich <rminnich@google.com>
diff --git a/kern/drivers/net/bxe/bxe.c b/kern/drivers/net/bxe/bxe.c index 2499a29..8e0e234 100644 --- a/kern/drivers/net/bxe/bxe.c +++ b/kern/drivers/net/bxe/bxe.c
@@ -12481,7 +12481,9 @@ return (rc); } -/* must be called under IF_ADDR_LOCK */ +/* must be called with sc locked. We don't need finer grained locking, + * I think, because adding addresses is not that frequent. + */ static int bxe_init_mcast_macs_list(struct bxe_adapter *sc, struct ecore_mcast_ramrod_params *p) @@ -12602,21 +12604,13 @@ unsigned long ramrod_flags = 0; int rc; -#if __FreeBSD_version < 800000 - IF_ADDR_LOCK(ifp); -#else - if_addr_rlock(ifp); -#endif - + they used to lock the ifp. We could do that. + just lock the sc here. I see no reason to get finer grained for this one. /* first schedule a cleanup up of old configuration */ rc = bxe_del_all_macs(sc, mac_obj, ECORE_UC_LIST_MAC, FALSE); if (rc < 0) { +unlock ehre. BLOGE(sc, "Failed to schedule delete of all ETH MACs (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif return (rc); } @@ -12635,22 +12629,14 @@ rc = 0; } else if (rc < 0) { BLOGE(sc, "Failed to schedule ADD operations (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif +unlock ehre. return (rc); } ifa = TAILQ_NEXT(ifa, ifa_link); } -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif +unlock here. /* Execute the pending commands */ __set_bit(RAMROD_CONT, &ramrod_flags); @@ -12676,7 +12662,6 @@ } BLOGD(sc, DBG_SP, "if_flags(ifp)=0x%x\n", if_getflags(sc->ifp)); -#warning "FIX ALL FLAGS" #if 0 if (if_getflags(ifp) & IFF_PROMISC) { rx_mode = BXE_RX_MODE_PROMISC;
diff --git a/kern/drivers/net/bxe/bxe.h b/kern/drivers/net/bxe/bxe.h index d1df558..cb2b241 100644 --- a/kern/drivers/net/bxe/bxe.h +++ b/kern/drivers/net/bxe/bxe.h
@@ -41,6 +41,7 @@ #include <string.h> #include <bitmap.h> #include <taskqueue.h> +#include <mii.h> /* MACROS for conversion to AKAROS. Might we want this stuff someday? */ @@ -1361,9 +1362,7 @@ unsigned int statistics[Nstatistics]; //struct net_device_stats net_stats; -#warning "no ifmedia. " - // struct ifmedia ifmedia; /* network interface media structure */ - int media; + struct mii_if_info media; /* network interface media structure */ int state; /* device state */ #define BXE_STATE_CLOSED 0x0000 @@ -1515,10 +1514,9 @@ #define BXE_STATS_UNLOCK(sc) qunlock(&sc->stats_mtx) #define BXE_STATS_LOCK_ASSERT(sc) mtx_assert(&sc->stats_mtx, MA_OWNED) -#warning "find outwhat IF_ADDR_LOCK is" #define BXE_MCAST_LOCK(sc) \ do { \ - /*IF_ADDR_LOCK(sc->ifp);*/ \ + qlock(&sc->ifp->qlock); \ } while (0) #define BXE_MCAST_LOCK_ASSERT(sc) mtx_assert(&sc->mcast_mtx, MA_OWNED) @@ -2277,13 +2275,13 @@ #define bxe_panic(sc, msg) \ do { \ - panic msg; \ + panic(msg); \ } while (0) #else #define bxe_panic(sc, msg) \ - /*device_printf((sc)->dev,*/printk( "%s (%s,%d)\n", __FUNCTION__, __FILE__, __LINE__); + panic( "%s (%s,%d)\n", __FUNCTION__, __FILE__, __LINE__); #endif