IfAPI: Add if_llsoftc member accessors for TOEDEV

Summary:
Keep TOEDEV() macro for backwards compatibility, and add a SETTOEDEV()
macro to complement with the new accessors.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	glebius
Differential Revision: https://reviews.freebsd.org/D38199
This commit is contained in:
Justin Hibbits 2023-01-23 10:11:02 -05:00
parent 3d0d5b21c9
commit c255d1a401
4 changed files with 18 additions and 3 deletions

View File

@ -1901,7 +1901,7 @@ t4_tom_activate(struct adapter *sc)
for_each_port(sc, i) {
for_each_vi(sc->port[i], v, vi) {
TOEDEV(vi->ifp) = &td->tod;
SETTOEDEV(vi->ifp, &td->tod);
}
}

View File

@ -4827,6 +4827,18 @@ if_gettype(if_t ifp)
return (ifp->if_type);
}
void *
if_getllsoftc(if_t ifp)
{
return (ifp->if_llsoftc);
}
void
if_setllsoftc(if_t ifp, void *llsoftc)
{
ifp->if_llsoftc = llsoftc;
};
#ifdef DDB
static void
if_show_ifnet(struct ifnet *ifp)

View File

@ -412,7 +412,8 @@ EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t);
#define IF_MINMTU 72
#define IF_MAXMTU 65535
#define TOEDEV(ifp) ((ifp)->if_llsoftc)
#define TOEDEV(ifp) if_getllsoftc(ifp)
#define SETTOEDEV(ifp, sc) if_setllsoftc((ifp), (sc))
/*
* The ifaddr structure contains information about one address
@ -597,6 +598,8 @@ int if_togglehwassist(if_t ifp, int toggle_bits);
int if_setsoftc(if_t ifp, void *softc);
void *if_getsoftc(if_t ifp);
int if_setflags(if_t ifp, int flags);
void if_setllsoftc(if_t ifp, void *softc);
void *if_getllsoftc(if_t ifp);
int if_gethwaddr(const if_t ifp, struct ifreq *);
int if_setmtu(if_t ifp, int mtu);
int if_getmtu(const if_t ifp);

View File

@ -1922,7 +1922,7 @@ vlan_capabilities(struct ifvlan *ifv)
if (p->if_capabilities & IFCAP_VLAN_TOE)
cap |= p->if_capabilities & IFCAP_TOE;
if (p->if_capenable & IFCAP_VLAN_TOE) {
TOEDEV(ifp) = TOEDEV(p);
SETTOEDEV(ifp, TOEDEV(p));
ena |= mena & IFCAP_TOE;
}