Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:17:03 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353868 - in head: . sys/net sys/sys
Message-ID:  <201910211817.x9LIH34m073408@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Oct 21 18:17:03 2019
New Revision: 353868
URL: https://svnweb.freebsd.org/changeset/base/353868

Log:
  Remove obsoleted KPIs that were used to access interface address lists.

Modified:
  head/UPDATING
  head/sys/net/if.c
  head/sys/net/if_var.h
  head/sys/sys/param.h

Modified: head/UPDATING
==============================================================================
--- head/UPDATING	Mon Oct 21 18:13:37 2019	(r353867)
+++ head/UPDATING	Mon Oct 21 18:17:03 2019	(r353868)
@@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
 	"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 20191021:
+	KPIs for network drivers to access interface addresses have changed.
+	Users need to recompile NIC driver modules together with kernel.
+
+20191021:
 	The net.link.tap.user_open sysctl no longer prevents user opening of
 	already created /dev/tapNN devices.  Access is still controlled by
 	node permissions, just like tun devices.  The net.link.tap.user_open

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Mon Oct 21 18:13:37 2019	(r353867)
+++ head/sys/net/if.c	Mon Oct 21 18:17:03 2019	(r353868)
@@ -1768,40 +1768,6 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd)
 }
 
 /*
- * Wrapper functions for struct ifnet address list locking macros.  These are
- * used by kernel modules to avoid encoding programming interface or binary
- * interface assumptions that may be violated when kernel-internal locking
- * approaches change.
- */
-void
-if_addr_rlock(struct ifnet *ifp)
-{
-
-	epoch_enter_preempt(net_epoch_preempt, curthread->td_et);
-}
-
-void
-if_addr_runlock(struct ifnet *ifp)
-{
-
-	epoch_exit_preempt(net_epoch_preempt, curthread->td_et);
-}
-
-void
-if_maddr_rlock(if_t ifp)
-{
-
-	epoch_enter_preempt(net_epoch_preempt, curthread->td_et);
-}
-
-void
-if_maddr_runlock(if_t ifp)
-{
-
-	epoch_exit_preempt(net_epoch_preempt, curthread->td_et);
-}
-
-/*
  * Initialization, destruction and refcounting functions for ifaddrs.
  */
 struct ifaddr *
@@ -4403,77 +4369,6 @@ if_input(if_t ifp, struct mbuf* sendmp)
 	(*((struct ifnet *)ifp)->if_input)((struct ifnet *)ifp, sendmp);
 	return (0);
 
-}
-
-/* XXX */
-#ifndef ETH_ADDR_LEN
-#define ETH_ADDR_LEN 6
-#endif
-
-int 
-if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max)
-{
-	struct ifmultiaddr *ifma;
-	uint8_t *lmta = (uint8_t *)mta;
-	int mcnt = 0;
-
-	CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-
-		if (mcnt == max)
-			break;
-
-		bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
-		    &lmta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN);
-		mcnt++;
-	}
-	*cnt = mcnt;
-
-	return (0);
-}
-
-int
-if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max)
-{
-	int error;
-
-	if_maddr_rlock(ifp);
-	error = if_setupmultiaddr(ifp, mta, cnt, max);
-	if_maddr_runlock(ifp);
-	return (error);
-}
-
-int
-if_multiaddr_count(if_t ifp, int max)
-{
-	struct ifmultiaddr *ifma;
-	int count;
-
-	count = 0;
-	if_maddr_rlock(ifp);
-	CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-		count++;
-		if (count == max)
-			break;
-	}
-	if_maddr_runlock(ifp);
-	return (count);
-}
-
-int
-if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg)
-{
-	struct ifmultiaddr *ifma;
-	int cnt = 0;
-
-	if_maddr_rlock(ifp);
-	CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
-		cnt += filter(arg, ifma, cnt);
-	if_maddr_runlock(ifp);
-	return (cnt);
 }
 
 struct mbuf *

Modified: head/sys/net/if_var.h
==============================================================================
--- head/sys/net/if_var.h	Mon Oct 21 18:13:37 2019	(r353867)
+++ head/sys/net/if_var.h	Mon Oct 21 18:17:03 2019	(r353868)
@@ -449,16 +449,6 @@ struct ifnet {
 #define	NET_EPOCH_WAIT()	epoch_wait_preempt(net_epoch_preempt)
 #define	NET_EPOCH_ASSERT()	MPASS(in_epoch(net_epoch_preempt))
 
-/*
- * Function variations on locking macros intended to be used by loadable
- * kernel modules in order to divorce them from the internals of address list
- * locking.
- */
-void	if_addr_rlock(struct ifnet *ifp);	/* if_addrhead */
-void	if_addr_runlock(struct ifnet *ifp);	/* if_addrhead */
-void	if_maddr_rlock(if_t ifp);	/* if_multiaddrs */
-void	if_maddr_runlock(if_t ifp);	/* if_multiaddrs */
-
 #ifdef _KERNEL
 /* interface link layer address change event */
 typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *);
@@ -773,12 +763,6 @@ u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *);
 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_multiaddr_count(if_t ifp, int max);
-
-/* Obsoleted multicast management functions. */
-int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max);
-int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max);
-int if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg);
 
 int if_getamcount(if_t ifp);
 struct ifaddr * if_getifaddr(if_t ifp);

Modified: head/sys/sys/param.h
==============================================================================
--- head/sys/sys/param.h	Mon Oct 21 18:13:37 2019	(r353867)
+++ head/sys/sys/param.h	Mon Oct 21 18:17:03 2019	(r353868)
@@ -60,7 +60,7 @@
  *		in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 1300053	/* Master, propagated to newvers */
+#define __FreeBSD_version 1300054	/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910211817.x9LIH34m073408>