Lines Matching refs:proto

286 static unsigned int dlif_phash_size;	/* size of ifnet proto hash table */
287 static struct zone *dlif_phash_zone; /* zone for ifnet proto hash table */
622 struct if_proto *proto = NULL;
628 proto = SLIST_FIRST(&ifp->if_proto_hash[i]);
630 while (proto != NULL && proto->protocol_family != protocol_family)
631 proto = SLIST_NEXT(proto, next_hash);
633 if (proto != NULL)
634 if_proto_ref(proto);
636 return (proto);
640 if_proto_ref(struct if_proto *proto)
642 atomic_add_32(&proto->refcount, 1);
648 if_proto_free(struct if_proto *proto)
651 struct ifnet *ifp = proto->ifp;
652 u_int32_t proto_family = proto->protocol_family;
655 oldval = atomic_add_32_ov(&proto->refcount, -1);
660 VERIFY(proto->detached);
662 if (proto->proto_kpi == kProtoKPI_v1) {
663 if (proto->kpi.v1.detached)
664 proto->kpi.v1.detached(ifp, proto->protocol_family);
666 if (proto->proto_kpi == kProtoKPI_v2) {
667 if (proto->kpi.v2.detached)
668 proto->kpi.v2.detached(ifp, proto->protocol_family);
690 zfree(dlif_proto_zone, proto);
775 struct if_proto *proto;
776 SLIST_FOREACH(proto, &ifp->if_proto_hash[i], next_hash) {
2924 /* callee holds a proto refcnt upon success */
3027 struct if_proto *proto;
3029 SLIST_FOREACH(proto, &ifp->if_proto_hash[i],
3032 (proto->proto_kpi == kProtoKPI_v1 ?
3033 proto->kpi.v1.event :
3034 proto->kpi.v2.event);
3037 if_proto_ref(proto);
3040 eventp(ifp, proto->protocol_family,
3044 if_proto_free(proto);
3228 struct if_proto *proto = NULL;
3256 /* callee holds a proto refcnt upon success */
3257 proto = find_attached_proto(ifp, proto_family);
3258 if (proto == NULL) {
3275 proto_media_preout preoutp = (proto->proto_kpi == kProtoKPI_v1 ?
3276 proto->kpi.v1.pre_output : proto->kpi.v2.pre_output);
3477 if (proto != NULL)
3478 if_proto_free(proto);
3541 struct if_proto *proto;
3543 /* callee holds a proto refcnt upon success */
3545 proto = find_attached_proto(ifp, proto_fam);
3547 if (proto != NULL) {
3549 (proto->proto_kpi == kProtoKPI_v1 ?
3550 proto->kpi.v1.ioctl : proto->kpi.v2.ioctl);
3555 if_proto_free(proto);
3618 struct if_proto *proto;
3627 /* Call the protocol first; callee holds a proto refcnt upon success */
3629 proto = find_attached_proto(ifp, proto_addr->sa_family);
3631 if (proto != NULL) {
3632 resolvep = (proto->proto_kpi == kProtoKPI_v1 ?
3633 proto->kpi.v1.resolve_multi : proto->kpi.v2.resolve_multi);
3637 if_proto_free(proto);
3658 struct if_proto *proto;
3661 /* callee holds a proto refcnt upon success */
3663 proto = find_attached_proto(ifp, target_proto->sa_family);
3665 if (proto == NULL) {
3669 arpp = (proto->proto_kpi == kProtoKPI_v1 ?
3670 proto->kpi.v1.send_arp : proto->kpi.v2.send_arp);
3676 if_proto_free(proto);
3949 dlil_attach_protocol_internal(struct if_proto *proto,
3953 struct ifnet *ifp = proto->ifp;
3955 u_int32_t hash_value = proto_hash_value(proto->protocol_family);
3959 /* callee holds a proto refcnt upon success */
3961 _proto = find_attached_proto(ifp, proto->protocol_family);
3972 retval = ifp->if_add_proto(ifp, proto->protocol_family, demux_list,
3986 SLIST_INSERT_AFTER(prev_proto, proto, next_hash);
3989 proto, next_hash);
3991 /* hold a proto refcnt for attach */
3992 if_proto_ref(proto);
3998 ev_pr_data.proto_family = proto->protocol_family;
4123 struct if_proto *proto = NULL;
4132 /* callee holds a proto refcnt upon success */
4133 proto = find_attached_proto(ifp, proto_family);
4134 if (proto == NULL) {
4142 ifp->if_del_proto(ifp, proto->protocol_family);
4145 proto, if_proto, next_hash);
4147 if (proto->proto_kpi == kProtoKPI_v1) {
4148 proto->kpi.v1.input = ifproto_media_input_v1;
4149 proto->kpi.v1.pre_output= ifproto_media_preout;
4150 proto->kpi.v1.event = ifproto_media_event;
4151 proto->kpi.v1.ioctl = ifproto_media_ioctl;
4152 proto->kpi.v1.resolve_multi = ifproto_media_resolve_multi;
4153 proto->kpi.v1.send_arp = ifproto_media_send_arp;
4155 proto->kpi.v2.input = ifproto_media_input_v2;
4156 proto->kpi.v2.pre_output = ifproto_media_preout;
4157 proto->kpi.v2.event = ifproto_media_event;
4158 proto->kpi.v2.ioctl = ifproto_media_ioctl;
4159 proto->kpi.v2.resolve_multi = ifproto_media_resolve_multi;
4160 proto->kpi.v2.send_arp = ifproto_media_send_arp;
4162 proto->detached = 1;
4167 ifp->if_unit, (proto->proto_kpi == kProtoKPI_v1) ?
4171 /* release proto refcnt held during protocol attach */
4172 if_proto_free(proto);
4175 * Release proto refcnt held during lookup; the rest of
4176 * protocol detach steps will happen when the last proto
4179 if_proto_free(proto);
4981 struct if_proto *proto;
4983 proto = SLIST_FIRST(&ifp->if_proto_hash[i]);
4984 while (proto != NULL) {
4985 protocol_family_t family = proto->protocol_family;
4989 proto = SLIST_FIRST(&ifp->if_proto_hash[i]);