git: fa25dbfd98ff - main - ifnet API: Change if_init() to take context argument
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 20:48:21 UTC
The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=fa25dbfd98ff58556d707a94a8355626b681c65f commit fa25dbfd98ff58556d707a94a8355626b681c65f Author: Justin Hibbits <jhibbits@FreeBSD.org> AuthorDate: 2023-01-12 18:33:30 +0000 Commit: Justin Hibbits <jhibbits@FreeBSD.org> CommitDate: 2023-01-24 19:36:30 +0000 ifnet API: Change if_init() to take context argument Some drivers, like iflib drivers, take a 'context' argument instead of a ifnet argument, as a single interface may have multiple contexts. Follow this scheme by passing the context argument down. Most drivers will likely pass 'ifp' as the context. Reviewed by: glebius Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D38102 --- sys/net/if.c | 4 ++-- sys/net/if_var.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index c7b7d1f6d9d4..c7a6cf18d4b7 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4622,9 +4622,9 @@ if_vlantrunkinuse(if_t ifp) } int -if_init(if_t ifp) +if_init(if_t ifp, void *ctx) { - (*((struct ifnet *)ifp)->if_init)((struct ifnet *)ifp); + (*((struct ifnet *)ifp)->if_init)(ctx); return (0); } diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 2712ac74a09d..afb58578e96b 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -784,7 +784,7 @@ void if_bpfmtap(if_t ifp, struct mbuf *m); 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); +int if_init(if_t ifp, void *ctx); /* * Traversing through interface address lists.