git: 189c3729d84f - main - IfAPI: More accessors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 14 Feb 2023 15:36:19 UTC
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=189c3729d84f620a6be10f62daef32ae9a47eff3 commit 189c3729d84f620a6be10f62daef32ae9a47eff3 Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2023-02-10 15:53:19 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> CommitDate: 2023-02-14 15:21:19 +0000 IfAPI: More accessors Summary: Add the following accessors needed by infiniband drivers: * if_getaddrlen() * if_setbroadcastaddr() * if_resolvemulti() With these accessors, and additional changes on the drivers' side, an amd64 kernel can be compiled with `struct ifnet` completely hidden. Reviewed by: melifaro Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38488 --- sys/net/if.c | 21 +++++++++++++++++++++ sys/net/if_var.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 43d1e2b95a63..d17738fda0b7 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4681,6 +4681,15 @@ if_transmit(if_t ifp, struct mbuf *m) return (0); } +int +if_resolvemulti(if_t ifp, struct sockaddr **srcs, struct sockaddr *dst) +{ + if (ifp->if_resolvemulti == NULL) + return (EOPNOTSUPP); + + return (ifp->if_resolvemulti(ifp, srcs, dst)); +} + struct mbuf * if_dequeue(if_t ifp) { @@ -4928,6 +4937,12 @@ if_getbroadcastaddr(if_t ifp) return (ifp->if_broadcastaddr); } +void +if_setbroadcastaddr(if_t ifp, const uint8_t *addr) +{ + ifp->if_broadcastaddr = addr; +} + int if_getnumadomain(if_t ifp) { @@ -4964,6 +4979,12 @@ if_getfib(if_t ifp) return (ifp->if_fib); } +uint8_t +if_getaddrlen(if_t ifp) +{ + return (ifp->if_addrlen); +} + struct bpf_if * if_getbpf(if_t ifp) { diff --git a/sys/net/if_var.h b/sys/net/if_var.h index f33b4fc590c7..f6bb77908d40 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -604,8 +604,10 @@ int if_setflags(if_t ifp, int flags); void if_setllsoftc(if_t ifp, void *softc); void *if_getllsoftc(if_t ifp); u_int if_getfib(if_t ifp); +uint8_t if_getaddrlen(if_t ifp); int if_gethwaddr(const if_t ifp, struct ifreq *); const uint8_t *if_getbroadcastaddr(const if_t ifp); +void if_setbroadcastaddr(if_t ifp, const uint8_t *); int if_setmtu(if_t ifp, int mtu); int if_getmtu(const if_t ifp); int if_getmtu_family(const if_t ifp, int family); @@ -640,6 +642,7 @@ void if_etherbpfmtap(if_t ifp, struct mbuf *m); void if_vlancap(if_t ifp); int if_transmit(if_t ifp, struct mbuf *m); int if_init(if_t ifp, void *ctx); +int if_resolvemulti(if_t ifp, struct sockaddr **, struct sockaddr *); uint64_t if_getcounter(if_t ifp, ift_counter counter); struct label *if_getmaclabel(if_t ifp); void if_setmaclabel(if_t ifp, struct label *label);