From 31cfaf191b0861d54ce8e212c77b458fd8fc018e Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Wed, 25 Jan 2023 14:45:53 -0500 Subject: [PATCH] IfAPI: Add l2com accessor for firewire. Summary: Firewire is the only device driver that accesses the l2com member, all other accesses are handled within the netstack itself. Sponsored by: Juniper Networks, Inc. Reviewed by: glebius, melifaro Differential Revision: https://reviews.freebsd.org/D38203 --- sys/net/firewire.h | 2 +- sys/net/if.c | 6 ++++++ sys/net/if_var.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/net/firewire.h b/sys/net/firewire.h index dd7d23e49e7..527113aec72 100644 --- a/sys/net/firewire.h +++ b/sys/net/firewire.h @@ -131,7 +131,7 @@ struct fw_com { uint16_t fc_node; /* our nodeid */ struct fw_reass_list fc_frags; /* partial datagrams */ }; -#define IFP2FWC(ifp) ((struct fw_com *)(ifp)->if_l2com) +#define IFP2FWC(ifp) ((struct fw_com *)if_getl2com(ifp)) extern void firewire_input(struct ifnet *ifp, struct mbuf *m, uint16_t src); extern void firewire_ifattach(struct ifnet *, struct fw_hwaddr *); diff --git a/sys/net/if.c b/sys/net/if.c index ac8b6963172..2ab12d1ac31 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4941,6 +4941,12 @@ if_getpcp(if_t ifp) return (ifp->if_pcp); } +void * +if_getl2com(if_t ifp) +{ + return (ifp->if_l2com); +} + #ifdef DDB static void if_show_ifnet(struct ifnet *ifp) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index be7a5f059a7..dbf8796865f 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -644,6 +644,7 @@ struct label *if_getmaclabel(if_t ifp); void if_setmaclabel(if_t ifp, struct label *label); struct bpf_if *if_getbpf(if_t ifp); uint8_t if_getpcp(if_t ifp); +void *if_getl2com(if_t ifp); struct ifvlantrunk *if_getvlantrunk(if_t ifp); void *if_getafdata(if_t ifp, int);