Lines Matching refs:ifp
103 void (*ng_ether_input_p)(struct ifnet *ifp, struct mbuf **mp);
104 void (*ng_ether_input_orphan_p)(struct ifnet *ifp, struct mbuf *m);
105 int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp);
106 void (*ng_ether_attach_p)(struct ifnet *ifp);
107 void (*ng_ether_detach_p)(struct ifnet *ifp);
148 ether_requestencap(struct ifnet *ifp, struct if_encap_req *req)
189 lladdr = ifp->if_broadcastaddr;
197 memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN);
204 ether_resolve_addr(struct ifnet *ifp, struct mbuf *m,
222 error = arpresolve(ifp, 0, m, dst, phdr, &lleflags,
226 memcpy(eh->ether_dhost, ifp->if_broadcastaddr,
235 memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN);
243 error = nd6_resolve(ifp, LLE_SF(af, 0), m, dst, phdr,
251 memcpy(eh->ether_shost, IF_LLADDR(ifp), ETHER_ADDR_LEN);
256 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
284 ether_output(struct ifnet *ifp, struct mbuf *m,
333 error = mac_ifnet_check_transmit(ifp, m);
339 if (ifp->if_flags & IFF_MONITOR)
341 if (!((ifp->if_flags & IFF_UP) &&
342 (ifp->if_drv_flags & IFF_DRV_RUNNING)))
349 error = ether_resolve_addr(ifp, m, dst, ro, phdr, &pflags,
359 return (if_simloop(ifp, m, RO_GET_FAMILY(ro, dst), 0));
388 if ((m->m_flags & M_BCAST) && loop_copy && (ifp->if_flags & IFF_SIMPLEX) &&
406 (void)if_simloop(ifp, n, RO_GET_FAMILY(ro, dst), hlen);
408 if_inc_counter(ifp, IFCOUNTER_IQDROPS, 1);
414 if (ifp->if_bridge) {
415 BRIDGE_OUTPUT(ifp, m, error);
420 if (ifp->if_carp &&
421 (error = (*carp_output_p)(ifp, m, dst)))
426 if (ifp->if_l2com != NULL) {
429 if ((error = (*ng_ether_output_p)(ifp, &m)) != 0) {
439 return ether_output_frame(ifp, m);
443 ether_set_pcp(struct mbuf **mp, struct ifnet *ifp, uint8_t pcp)
458 if (ether_8021q_frame(mp, ifp, ifp, &qtag))
460 if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
471 ether_output_frame(struct ifnet *ifp, struct mbuf *m)
473 if (ether_do_pcp(ifp, m) && !ether_set_pcp(&m, ifp, ifp->if_pcp))
477 switch (pfil_mbuf_out(V_link_pfil_head, &m, ifp, NULL)) {
488 if ((ND_IFINFO(ifp)->flags & ND6_IFF_IPV6_ONLY_MASK) != 0) {
513 return ((ifp->if_transmit)(ifp, m));
521 ether_input_internal(struct ifnet *ifp, struct mbuf *m)
526 if ((ifp->if_flags & IFF_UP) == 0) {
531 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
532 if_printf(ifp, "discard frame at !IFF_DRV_RUNNING\n");
539 if_printf(ifp, "discard frame w/o leading ethernet "
542 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
554 if ((ND_IFINFO(ifp)->flags & ND6_IFF_IPV6_ONLY_MASK) != 0) {
568 CURVNET_SET_QUIET(ifp->if_vnet);
575 if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
583 mac_ifnet_create_mbuf(ifp, m);
589 ETHER_BPF_MTAP(ifp, m);
591 if (!(ifp->if_capenable & IFCAP_HWSTATS))
592 if_inc_counter(ifp, IFCOUNTER_IBYTES, m->m_pkthdr.len);
595 if (ifp->if_flags & IFF_MONITOR) {
602 if (ifp->if_type == IFT_IEEE8023ADLAG) {
605 m = (*lagg_input_ethernet_p)(ifp, m);
607 ifp = m->m_pkthdr.rcvif;
626 if_printf(ifp, "cannot pullup VLAN header\n");
628 if_inc_counter(ifp, IFCOUNTER_IERRORS, 1);
643 M_SETFIB(m, ifp->if_fib);
646 if (ifp->if_l2com != NULL) {
650 (*ng_ether_input_p)(ifp, &m);
661 * The BRIDGE_INPUT() macro will update ifp if the bridge changed it
665 * bridge via netmap, so "ifp" is the bridge itself and the packet
668 if (ifp->if_bridge != NULL || (m->m_flags & M_BRIDGE_INJECT) != 0) {
670 BRIDGE_INPUT(ifp, m);
687 * ether_dhost which may be active on this ifp.
689 if (ifp->if_carp && (*carp_forus_p)(ifp, eh->ether_dhost)) {
702 bcmp(IF_LLADDR(ifp), eh->ether_dhost, ETHER_ADDR_LEN) != 0)
706 ether_demux(ifp, m);
800 ether_input(struct ifnet *ifp, struct mbuf *m)
806 needs_epoch = (ifp->if_flags & IFF_NEEDSEPOCH);
819 if_printf(ifp, "called %s w/o net epoch! "
833 CURVNET_SET_QUIET(ifp->if_vnet);
845 KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch m %p "
846 "rcvif %p ifp %p", __func__, m, m->m_pkthdr.rcvif, ifp));
859 ether_demux(struct ifnet *ifp, struct mbuf *m)
866 KASSERT(ifp != NULL, ("%s: NULL interface pointer", __func__));
870 i = pfil_mbuf_in(V_link_pfil_head, &m, ifp, NULL);
884 if (ifp->if_vlantrunk == NULL) {
885 if_inc_counter(ifp, IFCOUNTER_NOPROTO, 1);
893 (*vlan_input_p)(ifp, m);
901 if ((ifp->if_flags & IFF_PPROMISC) == 0 && (m->m_flags & M_PROMISC)) {
922 if (ifp->if_flags & IFF_NOARP) {
951 if (ifp->if_l2com != NULL) {
954 (*ng_ether_input_orphan_p)(ifp, m);
980 ether_ifattach(struct ifnet *ifp, const u_int8_t *lla)
986 ifp->if_addrlen = ETHER_ADDR_LEN;
987 ifp->if_hdrlen = ETHER_HDR_LEN;
988 ifp->if_mtu = ETHERMTU;
989 if_attach(ifp);
990 ifp->if_output = ether_output;
991 ifp->if_input = ether_input;
992 ifp->if_resolvemulti = ether_resolvemulti;
993 ifp->if_requestencap = ether_requestencap;
995 ifp->if_reassign = ether_reassign;
997 if (ifp->if_baudrate == 0)
998 ifp->if_baudrate = IF_Mbps(10); /* just a default */
999 ifp->if_broadcastaddr = etherbroadcastaddr;
1001 ifa = ifp->if_addr;
1005 sdl->sdl_alen = ifp->if_addrlen;
1006 bcopy(lla, LLADDR(sdl), ifp->if_addrlen);
1008 if (ifp->if_hw_addr != NULL)
1009 bcopy(lla, ifp->if_hw_addr, ifp->if_addrlen);
1011 bpfattach(ifp, DLT_EN10MB, ETHER_HDR_LEN);
1013 (*ng_ether_attach_p)(ifp);
1016 for (i = 0; i < ifp->if_addrlen; i++)
1019 if (i != ifp->if_addrlen)
1020 if_printf(ifp, "Ethernet address: %6D\n", lla, ":");
1025 EVENTHANDLER_INVOKE(ether_ifattach_event, ifp);
1027 devctl_notify("ETHERNET", ifp->if_xname, "IFATTACH", NULL);
1034 ether_ifdetach(struct ifnet *ifp)
1038 sdl = (struct sockaddr_dl *)(ifp->if_addr->ifa_addr);
1041 if (ifp->if_l2com != NULL) {
1044 (*ng_ether_detach_p)(ifp);
1047 bpfdetach(ifp);
1048 if_detach(ifp);
1053 ether_reassign(struct ifnet *ifp, struct vnet *new_vnet, char *unused __unused)
1056 if (ifp->if_l2com != NULL) {
1059 (*ng_ether_detach_p)(ifp);
1064 (*ng_ether_attach_p)(ifp);
1149 ether_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
1157 ifp->if_flags |= IFF_UP;
1162 ifp->if_init(ifp->if_softc); /* before arpwhohas */
1163 arp_ifinit(ifp, ifa);
1167 ifp->if_init(ifp->if_softc);
1173 bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
1184 ifp->if_mtu = ifr->ifr_mtu;
1196 ifp->if_pcp = ifr->ifr_lan_pcp;
1198 EVENTHANDLER_INVOKE(ifnet_event, ifp, IFNET_EVENT_PCP);
1203 ifr->ifr_lan_pcp = ifp->if_pcp;
1214 ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
1243 sdl = link_init_sdl(ifp, *llsa, IFT_ETHER);
1259 ifp->if_flags |= IFF_ALLMULTI;
1265 sdl = link_init_sdl(ifp, *llsa, IFT_ETHER);
1355 ether_bpf_mtap_if(struct ifnet *ifp, struct mbuf *m)
1357 if (bpf_peers_present(ifp->if_bpf)) {
1360 ether_vlan_mtap(ifp->if_bpf, m, NULL, 0);
1362 bpf_mtap(ifp->if_bpf, m);
1390 ether_do_pcp(struct ifnet *ifp, struct mbuf *m)
1392 if (ifp->if_type == IFT_L2VLAN)
1394 if (ifp->if_pcp != IFNET_PCP_NONE || (m->m_flags & M_VLANTAG) != 0)
1529 ether_gen_addr(struct ifnet *ifp, struct ether_addr *hwaddr)
1531 ether_gen_addr_byname(if_name(ifp), hwaddr);