MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rt_find_real_interface

Function rt_find_real_interface

freebsd/netinet/tcp_ratelimit.c:994–1023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994static struct ifnet *
995rt_find_real_interface(struct ifnet *ifp, struct inpcb *inp, int *error)
996{
997 struct ifnet *tifp;
998 struct m_snd_tag *tag;
999 union if_snd_tag_alloc_params params = {
1000 .rate_limit.hdr.type = IF_SND_TAG_TYPE_RATE_LIMIT,
1001 .rate_limit.hdr.flowid = 1,
1002 .rate_limit.hdr.numa_domain = inp->inp_numa_domain,
1003 .rate_limit.max_rate = COMMON_RATE,
1004 .rate_limit.flags = M_NOWAIT,
1005 };
1006 int err;
1007#ifdef RSS
1008 params.rate_limit.hdr.flowtype = ((inp->inp_vflag & INP_IPV6) ?
1009 M_HASHTYPE_RSS_TCP_IPV6 : M_HASHTYPE_RSS_TCP_IPV4);
1010#else
1011 params.rate_limit.hdr.flowtype = M_HASHTYPE_OPAQUE_HASH;
1012#endif
1013 err = m_snd_tag_alloc(ifp, &params, &tag);
1014 if (err) {
1015 /* Failed to setup a tag? */
1016 if (error)
1017 *error = err;
1018 return (NULL);
1019 }
1020 tifp = tag->ifp;
1021 m_snd_tag_rele(tag);
1022 return (tifp);
1023}
1024
1025static const struct tcp_hwrate_limit_table *
1026rt_setup_rate(struct inpcb *inp, struct ifnet *ifp, uint64_t bytes_per_sec,

Callers 2

rt_setup_rateFunction · 0.85
tcp_chg_pacing_rateFunction · 0.85

Calls 2

m_snd_tag_allocFunction · 0.85
m_snd_tag_releFunction · 0.50

Tested by

no test coverage detected