Lines Matching defs:ifp
147 void if_rtproto_del(struct ifnet *ifp, int protocol);
263 if_attach_ifa(struct ifnet *ifp, struct ifaddr *ifa)
265 if_attach_ifa_common(ifp, ifa, 0);
269 if_attach_link_ifa(struct ifnet *ifp, struct ifaddr *ifa)
271 if_attach_ifa_common(ifp, ifa, 1);
275 if_attach_ifa_common(struct ifnet *ifp, struct ifaddr *ifa, int link)
277 ifnet_lock_assert(ifp, IFNET_LCK_ASSERT_EXCLUSIVE);
280 if (ifa->ifa_ifp != ifp) {
281 panic("%s: Mismatch ifa_ifp=%p != ifp=%p", __func__,
282 ifa->ifa_ifp, ifp);
298 TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link);
300 TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link);
307 if_detach_ifa(struct ifnet *ifp, struct ifaddr *ifa)
309 if_detach_ifa_common(ifp, ifa, 0);
313 if_detach_link_ifa(struct ifnet *ifp, struct ifaddr *ifa)
315 if_detach_ifa_common(ifp, ifa, 1);
319 if_detach_ifa_common(struct ifnet *ifp, struct ifaddr *ifa, int link)
321 ifnet_lock_assert(ifp, IFNET_LCK_ASSERT_EXCLUSIVE);
327 } else if (link && ifa != TAILQ_FIRST(&ifp->if_addrhead)) {
337 } else if (ifa->ifa_ifp != ifp) {
338 panic("%s: Mismatch ifa_ifp=%p, ifp=%p", __func__,
339 ifa->ifa_ifp, ifp);
343 TAILQ_FOREACH(ifa2, &ifp->if_addrhead, ifa_link) {
353 TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link);
376 * ifindex2ifnet[] is indexed by ifp->if_index. That requires us to
517 struct ifnet *ifp;
528 ifp = ifunit(name);
529 if (ifp == NULL)
535 (*ifc->ifc_destroy)(ifp);
753 ifa_ifpgetprimary(struct ifnet *ifp, int family)
757 ifnet_lock_shared(ifp);
758 TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
767 ifnet_lock_done(ifp);
779 struct ifnet *ifp;
788 for (ifp = ifnet_head.tqh_first; ifp && !result;
789 ifp = ifp->if_link.tqe_next) {
790 ifnet_lock_shared(ifp);
791 for (ifa = ifp->if_addrhead.tqh_first; ifa;
804 if ((ifp->if_flags & IFF_BROADCAST) &&
816 ifnet_lock_done(ifp);
829 struct ifnet *ifp;
834 for (ifp = ifnet_head.tqh_first; ifp && !result;
835 ifp = ifp->if_link.tqe_next) {
836 if ((ifp->if_flags & IFF_POINTOPOINT)) {
837 ifnet_lock_shared(ifp);
838 for (ifa = ifp->if_addrhead.tqh_first; ifa;
855 ifnet_lock_done(ifp);
869 struct ifnet *ifp;
880 ifp = ifindex2ifnet[ifscope];
881 if (ifp != NULL) {
889 ifnet_lock_shared(ifp);
890 for (ifa = ifp->if_addrhead.tqh_first; ifa != NULL;
903 if ((ifp->if_flags & IFF_BROADCAST) &&
915 ifnet_lock_done(ifp);
941 struct ifnet *ifp;
978 for (ifp = ifnet_head.tqh_first; ifp; ifp = ifp->if_link.tqe_next) {
979 ifnet_lock_shared(ifp);
980 for (ifa = ifp->if_addrhead.tqh_first; ifa;
1000 ifp->if_flags & IFF_POINTOPOINT) {
1024 ifp->if_index != ifscope) {
1069 ifnet_lock_done(ifp);
1089 ifaof_ifpforaddr(const struct sockaddr *addr, struct ifnet *ifp)
1101 ifnet_lock_shared(ifp);
1102 for (ifa = ifp->if_addrhead.tqh_first; ifa;
1123 if (ifp->if_flags & IFF_POINTOPOINT) {
1166 ifnet_lock_done(ifp);
1188 struct ifnet *ifp;
1195 ((ifp = ifa->ifa_ifp) == 0) || ((dst = rt_key(rt)) == 0))
1201 ifa = ifaof_ifpforaddr(dst, ifp);
1226 struct ifnet *ifp,
1232 struct ifclassq *ifq = &ifp->if_snd;
1235 while ((ifp->if_eflags & IFEF_UPDOWNCHANGE) != 0) {
1238 ifnet_lock_done(ifp);
1239 msleep(&ifp->if_eflags, NULL, 0, "if_updown", &tv);
1240 ifnet_lock_exclusive(ifp);
1244 if ((!up && (ifp->if_flags & IFF_UP) == 0) ||
1245 (up && (ifp->if_flags & IFF_UP) == IFF_UP)) {
1250 ifp->if_eflags |= IFEF_UPDOWNCHANGE;
1254 ifp->if_flags |= IFF_UP;
1257 ifp->if_flags &= ~IFF_UP;
1260 ifnet_touch_lastchange(ifp);
1263 ifnet_lock_done(ifp);
1264 if (ifnet_get_address_list(ifp, &ifa) == 0) {
1270 rt_ifmsg(ifp);
1273 if_qflush(ifp, 0);
1281 ifnet_lock_exclusive(ifp);
1282 ifp->if_eflags &= ~IFEF_UPDOWNCHANGE;
1283 wakeup(&ifp->if_eflags);
1292 struct ifnet *ifp)
1294 ifnet_lock_exclusive(ifp);
1295 if_updown(ifp, 0);
1296 ifnet_lock_done(ifp);
1305 struct ifnet *ifp)
1307 ifnet_lock_exclusive(ifp);
1308 if_updown(ifp, 1);
1309 ifnet_lock_done(ifp);
1316 if_qflush(struct ifnet *ifp, int ifq_locked)
1318 struct ifclassq *ifq = &ifp->if_snd;
1339 if_qflush_sc(struct ifnet *ifp, mbuf_svc_class_t sc, u_int32_t flow,
1342 struct ifclassq *ifq = &ifp->if_snd;
1381 struct ifnet *ifp;
1411 TAILQ_FOREACH(ifp, &ifnet_head, if_link) {
1412 if (strncmp(ifp->if_name, namebuf, len))
1414 if (unit == ifp->if_unit)
1418 return (ifp);
1456 struct ifnet *ifp = NULL;
1463 * ioctls which don't require ifp, or ifreq ioctls
1562 * ioctls which require ifp. Note that we acquire dlil_ifnet_lock
1570 ifp = ifunit(ifname);
1578 ifp = ifunit(ifname);
1585 ifp = ifunit(ifname);
1594 ifp = ifunit(ifname);
1607 ifp = ifunit(ifs->ifs_name);
1614 ifp = ifunit(ifname);
1621 ifp = ifunit(ifname);
1629 ifp = ifunit(ifname);
1637 ifp = ifunit(ifname);
1644 ifp = ifunit(ifname);
1652 ifp = ifunit(ifname);
1663 ifp = ifunit(ifname);
1669 if (ifp == NULL) {
1685 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1690 ifnet_touch_lastchange(ifp);
1697 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1706 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
1717 ifnet_lock_exclusive(ifp);
1720 ifdr_len > ifp->if_desc.ifd_maxlen) {
1722 ifnet_lock_done(ifp);
1726 bzero(ifp->if_desc.ifd_desc, ifp->if_desc.ifd_maxlen);
1727 if ((ifp->if_desc.ifd_len = ifdr_len) > 0) {
1728 bcopy(ifdr->ifdr_desc, ifp->if_desc.ifd_desc,
1729 MIN(ifdr_len, ifp->if_desc.ifd_maxlen));
1731 ifnet_lock_done(ifp);
1739 ifnet_lock_shared(ifp);
1740 ifdr_len = MIN(ifp->if_desc.ifd_len, sizeof (ifdr->ifdr_desc));
1744 bcopy(ifp->if_desc.ifd_desc, ifdr->ifdr_desc, ifdr_len);
1746 ifnet_lock_done(ifp);
1753 struct ifclassq *ifq = &ifp->if_snd;
1777 struct ifclassq *ifq = &ifp->if_snd;
1805 if (ifp->if_output_sched_model ==
1809 bcopy(&ifp->if_output_bw, &iflpr->iflpr_output_bw,
1811 bcopy(&ifp->if_input_bw, &iflpr->iflpr_input_bw,
1822 error = ifclassq_getqstats(&ifp->if_snd, ifqr_slot,
1842 error = ifnet_set_throttle(ifp, ifthr_level);
1853 if ((error = ifnet_get_throttle(ifp, &ifthr_level)) == 0) {
1868 data, ifp, p));
1872 error = ifnet_ioctl(ifp,
1888 struct ifnet *ifp;
1914 ifp = ifunit(ifr->ifr_name);
1915 if (ifp == NULL)
1920 ifnet_lock_shared(ifp);
1921 ifr->ifr_flags = ifp->if_flags;
1922 ifnet_lock_done(ifp);
1926 ifnet_lock_shared(ifp);
1927 ifr->ifr_eflags = ifp->if_eflags;
1928 ifnet_lock_done(ifp);
1932 ifnet_lock_shared(ifp);
1933 ifr->ifr_reqcap = ifp->if_capabilities;
1934 ifr->ifr_curcap = ifp->if_capenable;
1935 ifnet_lock_done(ifp);
1940 error = mac_ifnet_label_get(kauth_cred_get(), ifr, ifp);
1944 ifnet_lock_shared(ifp);
1945 ifr->ifr_metric = ifp->if_metric;
1946 ifnet_lock_done(ifp);
1950 ifnet_lock_shared(ifp);
1951 ifr->ifr_mtu = ifp->if_mtu;
1952 ifnet_lock_done(ifp);
1956 ifnet_lock_shared(ifp);
1957 ifr->ifr_phys = ifp->if_physical;
1958 ifnet_lock_done(ifp);
1962 ifnet_lock_shared(ifp);
1963 ifr->ifr_wake_flags = ifnet_get_wake_flags(ifp);
1964 ifnet_lock_done(ifp);
1968 ifnet_lock_shared(ifp);
1969 ifr->ifr_route_refcnt = ifp->if_route_refcnt;
1970 ifnet_lock_done(ifp);
1974 ifnet_lock_shared(ifp);
1975 ifr->ifr_link_quality_metric = ifp->if_lqm;
1976 ifnet_lock_done(ifp);
1984 (void) ifnet_set_flags(ifp, ifr->ifr_flags,
1991 (void) ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2003 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
2004 ev_data.if_family = ifp->if_family;
2005 ev_data.if_unit = (u_int32_t) ifp->if_unit;
2011 ifnet_touch_lastchange(ifp);
2019 if ((ifr->ifr_reqcap & ~ifp->if_capabilities)) {
2023 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2026 ifnet_touch_lastchange(ifp);
2031 error = mac_ifnet_label_set(kauth_cred_get(), ifr, ifp);
2039 ifp->if_metric = ifr->ifr_metric;
2046 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
2047 ev_data.if_family = ifp->if_family;
2048 ev_data.if_unit = (u_int32_t) ifp->if_unit;
2055 ifnet_touch_lastchange(ifp);
2063 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2073 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
2074 ev_data.if_family = ifp->if_family;
2075 ev_data.if_unit = (u_int32_t) ifp->if_unit;
2081 ifnet_touch_lastchange(ifp);
2085 u_int32_t oldmtu = ifp->if_mtu;
2086 struct ifclassq *ifq = &ifp->if_snd;
2092 if (ifp->if_ioctl == NULL) {
2100 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2110 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
2111 ev_data.if_family = ifp->if_family;
2112 ev_data.if_unit = (u_int32_t) ifp->if_unit;
2118 ifnet_touch_lastchange(ifp);
2119 rt_ifmsg(ifp);
2126 if (ifp->if_mtu != oldmtu) {
2127 if_rtmtu_update(ifp);
2129 nd6_setmtu(ifp);
2146 if ((ifp->if_flags & IFF_MULTICAST) == 0) {
2170 error = if_addmulti_anon(ifp, &ifr->ifr_addr, NULL);
2173 error = if_delmulti_anon(ifp, &ifr->ifr_addr);
2182 strlcpy(&ev_data.if_name[0], ifp->if_name, IFNAMSIZ);
2184 ev_data.if_family = ifp->if_family;
2185 ev_data.if_unit = (u_int32_t) ifp->if_unit;
2191 ifnet_touch_lastchange(ifp);
2205 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2210 ifnet_touch_lastchange(ifp);
2219 error = ifnet_ioctl(ifp, so->so_proto->pr_domain->dom_family,
2225 error = ifnet_getset_opportunistic(ifp, cmd, ifr, p);
2263 (caddr_t)ifr, ifp, p));
2282 error = ifnet_ioctl(ifp,
2308 * Set/clear promiscuous mode on interface ifp based on the truth value
2315 ifnet_t ifp,
2322 ifnet_lock_exclusive(ifp);
2323 oldflags = ifp->if_flags;
2324 ifp->if_pcount += pswitch ? 1 : -1;
2326 if (ifp->if_pcount > 0)
2327 ifp->if_flags |= IFF_PROMISC;
2329 ifp->if_flags &= ~IFF_PROMISC;
2331 newflags = ifp->if_flags;
2332 ifnet_lock_done(ifp);
2335 error = ifnet_ioctl(ifp, 0, SIOCSIFFLAGS, NULL);
2337 rt_ifmsg(ifp);
2339 ifnet_lock_exclusive(ifp);
2341 ifp->if_pcount -= pswitch ? 1 : -1;
2342 if (ifp->if_pcount > 0)
2343 ifp->if_flags |= IFF_PROMISC;
2345 ifp->if_flags &= ~IFF_PROMISC;
2346 ifnet_lock_done(ifp);
2352 ifp->if_name, ifp->if_unit,
2369 struct ifnet *ifp = NULL;
2383 for (ifp = ifnet_head.tqh_first; space > sizeof(ifr) &&
2384 ifp; ifp = ifp->if_link.tqe_next) {
2389 "%s%d", ifp->if_name, ifp->if_unit);
2397 ifnet_lock_shared(ifp);
2400 ifa = ifp->if_addrhead.tqh_first;
2449 ifnet_lock_done(ifp);
2471 if_allmulti(struct ifnet *ifp, int onswitch)
2476 ifnet_lock_exclusive(ifp);
2479 if (ifp->if_amcount++ == 0) {
2480 ifp->if_flags |= IFF_ALLMULTI;
2484 if (ifp->if_amcount > 1) {
2485 ifp->if_amcount--;
2487 ifp->if_amcount = 0;
2488 ifp->if_flags &= ~IFF_ALLMULTI;
2492 ifnet_lock_done(ifp);
2495 error = ifnet_ioctl(ifp, 0, SIOCSIFFLAGS, NULL);
2498 rt_ifmsg(ifp);
2649 if_attach_ifma(struct ifnet *ifp, struct ifmultiaddr *ifma, int anon)
2651 ifnet_lock_assert(ifp, IFNET_LCK_ASSERT_EXCLUSIVE);
2654 if (ifma->ifma_ifp != ifp) {
2655 panic("%s: Mismatch ifma_ifp=%p != ifp=%p", __func__,
2656 ifma->ifma_ifp, ifp);
2681 LIST_INSERT_HEAD(&ifp->if_multiaddrs, ifma, ifma_link);
2685 if_detach_ifma(struct ifnet *ifp, struct ifmultiaddr *ifma, int anon)
2687 ifnet_lock_assert(ifp, IFNET_LCK_ASSERT_EXCLUSIVE);
2699 } else if (ifma->ifma_ifp != ifp) {
2700 panic("%s: Mismatch ifma_ifp=%p, ifp=%p", __func__,
2701 ifma->ifma_ifp, ifp);
2738 if (LIST_EMPTY(&ifp->if_multiaddrs))
2739 ifp->if_updatemcasts = 0;
2761 if_addmulti_doesexist(struct ifnet *ifp, const struct sockaddr *sa,
2766 for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma != NULL;
2870 if_addmulti(struct ifnet *ifp, const struct sockaddr *sa,
2873 return (if_addmulti_common(ifp, sa, retifma, 0));
2882 if_addmulti_anon(struct ifnet *ifp, const struct sockaddr *sa,
2885 return (if_addmulti_common(ifp, sa, retifma, 1));
2911 if_addmulti_common(struct ifnet *ifp, const struct sockaddr *sa,
2935 ifnet_lock_exclusive(ifp);
2936 if (!(ifp->if_flags & IFF_MULTICAST)) {
2938 ifnet_lock_done(ifp);
2943 error = if_addmulti_doesexist(ifp, sa, retifma, anon);
2944 ifnet_lock_done(ifp);
2953 error = dlil_resolve_multi(ifp, sa, (struct sockaddr *)&storage,
2989 ifnet_lock_exclusive(ifp);
2993 error = if_addmulti_doesexist(ifp, sa, retifma, anon);
2995 ifnet_lock_done(ifp);
3001 if (if_addmulti_doesexist(ifp, llsa, &ifma->ifma_ll, 0) == 0) {
3006 VERIFY(ifma->ifma_ll->ifma_ifp == ifp);
3010 llifma->ifma_ifp = ifp;
3012 if_attach_ifma(ifp, llifma, 0);
3024 ifma->ifma_ifp = ifp;
3026 if_attach_ifma(ifp, ifma, anon);
3035 ifnet_lock_done(ifp);
3046 (void) ifnet_ioctl(ifp, 0, SIOCADDMULTI, NULL);
3048 if (ifp->if_updatemcasts > 0)
3049 ifp->if_updatemcasts = 0;
3071 if_delmulti(struct ifnet *ifp, const struct sockaddr *sa)
3073 return (if_delmulti_common(NULL, ifp, sa, 0));
3092 if_delmulti_anon(struct ifnet *ifp, const struct sockaddr *sa)
3094 return (if_delmulti_common(NULL, ifp, sa, 1));
3103 if_delmulti_common(struct ifmultiaddr *ifma, struct ifnet *ifp,
3111 VERIFY(ifma != NULL || (ifp != NULL && sa != NULL));
3114 ifp = ifma->ifma_ifp;
3124 ifnet_lock_exclusive(ifp);
3126 for (ifma = LIST_FIRST(&ifp->if_multiaddrs); ifma != NULL;
3142 ifnet_lock_done(ifp);
3150 lastref = if_detach_ifma(ifp, ifma, anon);
3160 ll_lastref = if_detach_ifma(ifp, ll, 0);
3163 ifnet_lock_done(ifp);
3175 ifnet_ioctl(ifp, 0, SIOCDELMULTI, NULL);
3196 if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len)
3213 struct ifnet **ifp;
3217 if (ifnet_list_get_all(IFNET_FAMILY_ANY, &ifp, &count) == 0) {
3219 if_down(ifp[i]);
3220 dlil_proto_unplumb_all(ifp[i]);
3222 ifnet_list_free(ifp);
3247 struct ifnet *ifp = arg;
3257 if (rt->rt_ifp == ifp && (rt->rt_flags & RTF_UP)) {
3280 if_rtproto_del(struct ifnet *ifp, int protocol)
3287 ((rnh = rt_tables[protocol]) != NULL) && (ifp != NULL)) {
3289 (void) rnh->rnh_walktree(rnh, if_rtdel, ifp);
3298 struct ifnet *ifp = arg;
3301 if (rt->rt_ifp == ifp) {
3308 rt->rt_rmx.rmx_mtu = ifp->if_mtu;
3321 void if_rtmtu_update(struct ifnet *ifp)
3331 (void) rnh->rnh_walktree(rnh, if_rtmtu, ifp);
3340 if_data_internal_to_if_data(struct ifnet *ifp,
3343 #pragma unused(ifp)
3400 if_data_internal_to_if_data64(struct ifnet *ifp,
3404 #pragma unused(ifp)
3452 if_copy_traffic_class(struct ifnet *ifp,
3457 (u_int64_t *)(void *)(uintptr_t)&ifp->if_tc.fld); \
3486 if_copy_data_extended(struct ifnet *ifp, struct if_data_extended *if_de)
3490 (u_int64_t *)(void *)(uintptr_t)&ifp->if_data.fld); \
3500 if_copy_packet_stats(struct ifnet *ifp, struct if_packet_stats *if_ps)
3504 (u_int64_t *)(void *)(uintptr_t)&ifp->if_tcp_stat->fld); \
3509 (u_int64_t *)(void *)(uintptr_t)&ifp->if_udp_stat->fld); \
3541 if_copy_rxpoll_stats(struct ifnet *ifp, struct if_rxpoll_stats *if_rs)
3544 if (!(ifp->if_eflags & IFEF_RXPOLL) || !ifnet_is_attached(ifp, 1))
3548 VERIFY(ifp->if_inp != NULL);
3549 bcopy(&ifp->if_inp->pstats, if_rs, sizeof (*if_rs));
3552 ifnet_decr_iorefcnt(ifp);
3569 panic("ifa %p attached to ifp is being freed\n", ifa);