git: 66ce3c8460bb - stable/13 - ifnet: Remove if_getamcount()

From: Zhenlei Huang <zlei_at_FreeBSD.org>
Date: Thu, 10 Oct 2024 10:03:26 UTC
The branch stable/13 has been updated by zlei:

URL: https://cgit.FreeBSD.org/src/commit/?id=66ce3c8460bb9d4b98dd6230b9a685aaa6bc8d06

commit 66ce3c8460bb9d4b98dd6230b9a685aaa6bc8d06
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-09-04 13:07:11 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2024-10-10 10:00:48 +0000

    ifnet: Remove if_getamcount()
    
    All uses of this function were incorrect.  if_amcount is a reference
    count which tracks the number of times the network stack internally set
    IFF_ALLMULTI.  (if_pcount is the corresponding counter for IFF_PROMISC.)
    
    Remove if_getamcount() and fix up callers to get the number of assigned
    multicast addresses instead, since that's what they actually want.
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    zlei, glebius
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D46523
    
    (cherry picked from commit 408c909dc64f77d2696d6fec77a2e0b00255cf96)
    (cherry picked from commit b513c311d0db5c301c939b1cf44b2826e09011d3)
---
 sys/dev/bxe/bxe.c            | 2 +-
 sys/dev/liquidio/lio_ioctl.c | 2 +-
 sys/net/if.c                 | 6 ------
 sys/net/if_var.h             | 1 -
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/sys/dev/bxe/bxe.c b/sys/dev/bxe/bxe.c
index daed2ea9e5e4..78e2423dc4a7 100644
--- a/sys/dev/bxe/bxe.c
+++ b/sys/dev/bxe/bxe.c
@@ -12197,7 +12197,7 @@ bxe_set_rx_mode(struct bxe_softc *sc)
     if (if_getflags(ifp) & IFF_PROMISC) {
         rx_mode = BXE_RX_MODE_PROMISC;
     } else if ((if_getflags(ifp) & IFF_ALLMULTI) ||
-               ((if_getamcount(ifp) > BXE_MAX_MULTICAST) &&
+               (if_llmaddr_count(ifp) > BXE_MAX_MULTICAST &&
                 CHIP_IS_E1(sc))) {
         rx_mode = BXE_RX_MODE_ALLMULTI;
     } else {
diff --git a/sys/dev/liquidio/lio_ioctl.c b/sys/dev/liquidio/lio_ioctl.c
index 80ee9ed2dcfa..449bc0219798 100644
--- a/sys/dev/liquidio/lio_ioctl.c
+++ b/sys/dev/liquidio/lio_ioctl.c
@@ -481,7 +481,7 @@ lio_get_new_flags(struct ifnet *ifp)
 		 * Accept all multicast addresses if there are more than we
 		 * can handle
 		 */
-		if (if_getamcount(ifp) > LIO_MAX_MULTICAST_ADDR)
+		if (if_llmaddr_count(ifp) > LIO_MAX_MULTICAST_ADDR)
 			f |= LIO_IFFLAG_ALLMULTI;
 	}
 	if (if_getflags(ifp) & IFF_BROADCAST)
diff --git a/sys/net/if.c b/sys/net/if.c
index d2b47a749873..8a870bb4e1bc 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -4387,12 +4387,6 @@ if_getifaddr(if_t ifp)
 	return ((struct ifnet *)ifp)->if_addr;
 }
 
-int
-if_getamcount(if_t ifp)
-{
-	return ((struct ifnet *)ifp)->if_amcount;
-}
-
 int
 if_setsendqready(if_t ifp)
 {
diff --git a/sys/net/if_var.h b/sys/net/if_var.h
index 9785dac2c265..24fe259d0046 100644
--- a/sys/net/if_var.h
+++ b/sys/net/if_var.h
@@ -761,7 +761,6 @@ u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *);
 u_int if_lladdr_count(if_t);
 u_int if_llmaddr_count(if_t);
 
-int if_getamcount(if_t ifp);
 struct ifaddr * if_getifaddr(if_t ifp);
 
 /* Functions */