diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-01-27 05:58:50 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-01-27 05:58:50 +0000 |
commit | e1882428dcbbafd2814d7e17b977a8f686784b39 (patch) | |
tree | b076dbac01bb03af302c00a003fa6edd11925007 /sys/net/if_var.h | |
parent | 91f44749c6feb50f39af8805dd803e860f0418f1 (diff) | |
download | src-e1882428dcbbafd2814d7e17b977a8f686784b39.tar.gz src-e1882428dcbbafd2814d7e17b977a8f686784b39.zip |
ifnet/mbuf: provide KPI to serialize/restore m->m_pkthdr.rcvif
Supplement ifindex table with generation count and use it to
serialize & restore an ifnet pointer.
Reviewed by: kp
Differential revision: https://reviews.freebsd.org/D33266
Fun note: git show e6abef09187a
Diffstat (limited to 'sys/net/if_var.h')
-rw-r--r-- | sys/net/if_var.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/net/if_var.h b/sys/net/if_var.h index dedc73718125..21b3687f62c1 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -334,7 +334,7 @@ struct ifnet { const char *if_dname; /* driver name */ int if_dunit; /* unit or IF_DUNIT_NONE */ u_short if_index; /* numeric abbreviation for this if */ - short if_index_reserved; /* spare space to grow if_index */ + u_short if_idxgen; /* ... and its generation count */ char if_xname[IFNAMSIZ]; /* external name (name + unit) */ char *if_description; /* interface description */ @@ -645,6 +645,13 @@ struct ifnet *ifnet_byindex(u_int); struct ifnet *ifnet_byindex_ref(u_int); /* + * ifnet_byindexgen() looks up ifnet by index and generation count, + * attempting to restore a weak pointer that had been stored across + * the epoch. + */ +struct ifnet *ifnet_byindexgen(uint16_t idx, uint16_t gen); + +/* * Given the index, ifaddr_byindex() returns the one and only * link-level ifaddr for the interface. You are not supposed to use * it to traverse the list of addresses associated to the interface. |