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

Function hpts_cpuid

freebsd/netinet/tcp_hpts.c:1164–1211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162}
1163
1164static uint16_t
1165hpts_cpuid(struct inpcb *inp)
1166{
1167 u_int cpuid;
1168#if !defined(RSS) && defined(NUMA)
1169 struct hpts_domain_info *di;
1170#endif
1171
1172 /*
1173 * If one has been set use it i.e. we want both in and out on the
1174 * same hpts.
1175 */
1176 if (inp->inp_input_cpu_set) {
1177 return (inp->inp_input_cpu);
1178 } else if (inp->inp_hpts_cpu_set) {
1179 return (inp->inp_hpts_cpu);
1180 }
1181 /* If one is set the other must be the same */
1182#ifdef RSS
1183 cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype);
1184 if (cpuid == NETISR_CPUID_NONE)
1185 return (hpts_random_cpu(inp));
1186 else
1187 return (cpuid);
1188#else
1189 /*
1190 * We don't have a flowid -> cpuid mapping, so cheat and just map
1191 * unknown cpuids to curcpu. Not the best, but apparently better
1192 * than defaulting to swi 0.
1193 */
1194
1195 if (inp->inp_flowtype == M_HASHTYPE_NONE)
1196 return (hpts_random_cpu(inp));
1197 /*
1198 * Hash to a thread based on the flowid. If we are using numa,
1199 * then restrict the hash to the numa domain where the inp lives.
1200 */
1201#ifdef NUMA
1202 if (tcp_bind_threads == 2 && inp->inp_numa_domain != M_NODOM) {
1203 di = &hpts_domains[inp->inp_numa_domain];
1204 cpuid = di->cpu[inp->inp_flowid % di->count];
1205 } else
1206#endif
1207 cpuid = inp->inp_flowid % mp_ncpus;
1208
1209 return (cpuid);
1210#endif
1211}
1212
1213static void
1214tcp_drop_in_pkts(struct tcpcb *tp)

Callers 1

__tcp_set_hptsFunction · 0.85

Calls 2

rss_hash2cpuidFunction · 0.85
hpts_random_cpuFunction · 0.85

Tested by

no test coverage detected