Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if_ethersubr.c
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
/* if_lagg(4) support */ | /* if_lagg(4) support */ | ||||
struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); | struct mbuf *(*lagg_input_ethernet_p)(struct ifnet *, struct mbuf *); | ||||
static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = | static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = | ||||
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; | ||||
static int ether_resolvemulti(struct ifnet *, struct sockaddr **, | static int ether_resolvemulti(struct ifnet *, struct sockaddr **, | ||||
struct sockaddr *); | struct sockaddr *); | ||||
#ifdef VIMAGE | |||||
static void ether_reassign(struct ifnet *, struct vnet *, char *); | |||||
#endif | |||||
donner: Why is the prototype removed? | |||||
kpAuthorUnsubmitted Done Inline ActionsIt moved to sys/net/ethernet.h so that the function can be used by if_bridge. In essence what we're doing is adding steps in front of the ether_reassign() code for if_bridge. kp: It moved to sys/net/ethernet.h so that the function can be used by if_bridge.
In essence what… | |||||
static int ether_requestencap(struct ifnet *, struct if_encap_req *); | static int ether_requestencap(struct ifnet *, struct if_encap_req *); | ||||
#define senderr(e) do { error = (e); goto bad;} while (0) | #define senderr(e) do { error = (e); goto bad;} while (0) | ||||
static void | static void | ||||
update_mbuf_csumflags(struct mbuf *src, struct mbuf *dst) | update_mbuf_csumflags(struct mbuf *src, struct mbuf *dst) | ||||
{ | { | ||||
int csum_flags = 0; | int csum_flags = 0; | ||||
▲ Show 20 Lines • Show All 841 Lines • ▼ Show 20 Lines | ether_ifattach(struct ifnet *ifp, const u_int8_t *lla) | ||||
ifp->if_addrlen = ETHER_ADDR_LEN; | ifp->if_addrlen = ETHER_ADDR_LEN; | ||||
ifp->if_hdrlen = ETHER_HDR_LEN; | ifp->if_hdrlen = ETHER_HDR_LEN; | ||||
ifp->if_mtu = ETHERMTU; | ifp->if_mtu = ETHERMTU; | ||||
if_attach(ifp); | if_attach(ifp); | ||||
ifp->if_output = ether_output; | ifp->if_output = ether_output; | ||||
ifp->if_input = ether_input; | ifp->if_input = ether_input; | ||||
ifp->if_resolvemulti = ether_resolvemulti; | ifp->if_resolvemulti = ether_resolvemulti; | ||||
ifp->if_requestencap = ether_requestencap; | ifp->if_requestencap = ether_requestencap; | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
ifp->if_reassign = ether_reassign; | ifp->if_reassign = ether_reassign; | ||||
#endif | #endif | ||||
donnerUnsubmitted Not Done Inline ActionsRemove this too? donner: Remove this too? | |||||
kpAuthorUnsubmitted Done Inline ActionsNo, because there are other callers (pretty much every ethernet NIC driver) to ether_ifattach() that we don't want to modify. kp: No, because there are other callers (pretty much every ethernet NIC driver) to ether_ifattach()… | |||||
if (ifp->if_baudrate == 0) | if (ifp->if_baudrate == 0) | ||||
ifp->if_baudrate = IF_Mbps(10); /* just a default */ | ifp->if_baudrate = IF_Mbps(10); /* just a default */ | ||||
ifp->if_broadcastaddr = etherbroadcastaddr; | ifp->if_broadcastaddr = etherbroadcastaddr; | ||||
ifa = ifp->if_addr; | ifa = ifp->if_addr; | ||||
KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); | KASSERT(ifa != NULL, ("%s: no lladdr!\n", __func__)); | ||||
sdl = (struct sockaddr_dl *)ifa->ifa_addr; | sdl = (struct sockaddr_dl *)ifa->ifa_addr; | ||||
sdl->sdl_type = IFT_ETHER; | sdl->sdl_type = IFT_ETHER; | ||||
Show All 38 Lines | KASSERT(ng_ether_detach_p != NULL, | ||||
("ng_ether_detach_p is NULL")); | ("ng_ether_detach_p is NULL")); | ||||
(*ng_ether_detach_p)(ifp); | (*ng_ether_detach_p)(ifp); | ||||
} | } | ||||
bpfdetach(ifp); | bpfdetach(ifp); | ||||
if_detach(ifp); | if_detach(ifp); | ||||
} | } | ||||
#ifdef VIMAGE | #ifdef VIMAGE | ||||
void | void | ||||
ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused) | ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused) | ||||
{ | { | ||||
if (ifp->if_l2com != NULL) { | if (ifp->if_l2com != NULL) { | ||||
KASSERT(ng_ether_detach_p != NULL, | KASSERT(ng_ether_detach_p != NULL, | ||||
("ng_ether_detach_p is NULL")); | ("ng_ether_detach_p is NULL")); | ||||
(*ng_ether_detach_p)(ifp); | (*ng_ether_detach_p)(ifp); | ||||
} | } | ||||
if (ng_ether_attach_p != NULL) { | if (ng_ether_attach_p != NULL) { | ||||
CURVNET_SET_QUIET(new_vnet); | CURVNET_SET_QUIET(new_vnet); | ||||
(*ng_ether_attach_p)(ifp); | (*ng_ether_attach_p)(ifp); | ||||
CURVNET_RESTORE(); | CURVNET_RESTORE(); | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
donnerUnsubmitted Not Done Inline Actionsdito donner: dito | |||||
SYSCTL_DECL(_net_link); | SYSCTL_DECL(_net_link); | ||||
SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | SYSCTL_NODE(_net_link, IFT_ETHER, ether, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | ||||
"Ethernet"); | "Ethernet"); | ||||
#if 0 | #if 0 | ||||
/* | /* | ||||
* This is for reference. We have a table-driven version | * This is for reference. We have a table-driven version | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |
Why is the prototype removed?