On Wed, Nov 23, 2022 at 11:04:55AM +0000, Klemens Nanni wrote: > > I don't mind them to be two commits but please share both of them at the > > same time. Because they should hit the tree at the same time. Changing > > header files like net/if_var.h comes at a cost so don't let people suffer > > twice for little reason. > > Will follow in next mail.
Remove unused struct ifnet's *if_afdata[] and struct domain's dom_if{at,de}tach() Both made obsolete through struct ifnet's previous *if_nd addition. IPv6 Neighbour Discovery handles per-interface data directly, nothing else uses this generic domain API anymore. Outside of _KERNEL, but nothing in base uses them, either. Feedback? Objection? OK? diff --git a/regress/sys/net/rtable/util.c b/regress/sys/net/rtable/util.c index f2c770f936f..abf9b318d7c 100644 --- a/regress/sys/net/rtable/util.c +++ b/regress/sys/net/rtable/util.c @@ -80,8 +80,6 @@ struct domain inetdomain = { .dom_protoswNPROTOSW = NULL, .dom_rtoffset = offsetof(struct sockaddr_in, sin_addr), .dom_maxplen = 32, - .dom_ifattach = NULL, - .dom_ifdetach = NULL, }; struct domain inet6domain = { @@ -94,8 +92,6 @@ struct domain inet6domain = { .dom_protoswNPROTOSW = NULL, .dom_rtoffset = offsetof(struct sockaddr_in6, sin6_addr), .dom_maxplen = 128, - .dom_ifattach = NULL, - .dom_ifdetach = NULL, }; struct domain *domains[] = { &inetdomain, &inet6domain, NULL }; diff --git a/sys/net/if.c b/sys/net/if.c index 869e848817c..3cb8bbf9176 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -133,7 +133,6 @@ #include <sys/device.h> void if_attachsetup(struct ifnet *); -void if_attachdomain(struct ifnet *); void if_attach_common(struct ifnet *); void if_remove(struct ifnet *); int if_createrdomain(int, struct ifnet *); @@ -460,7 +459,6 @@ if_attachsetup(struct ifnet *ifp) if_addgroup(ifp, IFG_ALL); - if_attachdomain(ifp); #ifdef INET6 nd6_ifattach(ifp); #endif @@ -537,25 +535,6 @@ if_free_sadl(struct ifnet *ifp) ifp->if_sadl = NULL; } -void -if_attachdomain(struct ifnet *ifp) -{ - const struct domain *dp; - int i, s; - - s = splnet(); - - /* address family dependent data region */ - bzero(ifp->if_afdata, sizeof(ifp->if_afdata)); - for (i = 0; (dp = domains[i]) != NULL; i++) { - if (dp->dom_ifattach) - ifp->if_afdata[dp->dom_family] = - (*dp->dom_ifattach)(ifp); - } - - splx(s); -} - void if_attachhead(struct ifnet *ifp) { @@ -1058,7 +1037,6 @@ if_detach(struct ifnet *ifp) { struct ifaddr *ifa; struct ifg_list *ifg; - const struct domain *dp; int i, s; /* Undo pseudo-driver changes. */ @@ -1126,11 +1104,6 @@ if_detach(struct ifnet *ifp) KASSERT(TAILQ_EMPTY(&ifp->if_linkstatehooks)); KASSERT(TAILQ_EMPTY(&ifp->if_detachhooks)); - for (i = 0; (dp = domains[i]) != NULL; i++) { - if (dp->dom_ifdetach && ifp->if_afdata[dp->dom_family]) - (*dp->dom_ifdetach)(ifp, - ifp->if_afdata[dp->dom_family]); - } #ifdef INET6 nd6_ifdetach(ifp); #endif diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 3bf07ed3071..686b2b5a1b1 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -186,7 +186,6 @@ struct ifnet { /* and the entries */ struct sockaddr_dl *if_sadl; /* [N] pointer to our sockaddr_dl */ - void *if_afdata[AF_MAX]; struct nd_ifinfo *if_nd; /* [I] IPv6 Neighour Discovery info */ }; #define if_mtu if_data.ifi_mtu diff --git a/sys/sys/domain.h b/sys/sys/domain.h index d8758fb8b9c..12a4746f1ee 100644 --- a/sys/sys/domain.h +++ b/sys/sys/domain.h @@ -60,9 +60,6 @@ struct domain { unsigned int dom_sasize; /* size of sockaddr structure */ unsigned int dom_rtoffset; /* offset of the key, in bytes */ unsigned int dom_maxplen; /* maximum prefix length, in bits */ - void *(*dom_ifattach)(struct ifnet *); - void (*dom_ifdetach)(struct ifnet *, void *); - /* af-dependent data on ifnet */ }; #ifdef _KERNEL