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

Function hpts_random_cpu

freebsd/netinet/tcp_hpts.c:1141–1162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1139}
1140
1141static uint16_t
1142hpts_random_cpu(struct inpcb *inp){
1143 /*
1144 * No flow type set distribute the load randomly.
1145 */
1146 uint16_t cpuid;
1147 uint32_t ran;
1148
1149 /*
1150 * If one has been set use it i.e. we want both in and out on the
1151 * same hpts.
1152 */
1153 if (inp->inp_input_cpu_set) {
1154 return (inp->inp_input_cpu);
1155 } else if (inp->inp_hpts_cpu_set) {
1156 return (inp->inp_hpts_cpu);
1157 }
1158 /* Nothing set use a random number */
1159 ran = arc4random();
1160 cpuid = (ran & 0xffff) % mp_ncpus;
1161 return (cpuid);
1162}
1163
1164static uint16_t
1165hpts_cpuid(struct inpcb *inp)

Callers 1

hpts_cpuidFunction · 0.85

Calls 1

arc4randomFunction · 0.50

Tested by

no test coverage detected