| 1139 | } |
| 1140 | |
| 1141 | static uint16_t |
| 1142 | hpts_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 | |
| 1164 | static uint16_t |
| 1165 | hpts_cpuid(struct inpcb *inp) |
no test coverage detected