Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_hpts.c
Show First 20 Lines • Show All 536 Lines • ▼ Show 20 Lines | tcp_hpts_release(struct tcpcb *tp) | ||||
bool released __diagused; | bool released __diagused; | ||||
tp->t_in_hpts = IHPTS_NONE; | tp->t_in_hpts = IHPTS_NONE; | ||||
released = in_pcbrele_wlocked(tptoinpcb(tp)); | released = in_pcbrele_wlocked(tptoinpcb(tp)); | ||||
MPASS(released == false); | MPASS(released == false); | ||||
} | } | ||||
/* | /* | ||||
* Initialize newborn tcpcb to get ready for use with HPTS. | * Initialize tcpcb to get ready for use with HPTS. We will know which CPU | ||||
* is preferred on the first incoming packet. Before that avoid crowding | |||||
* a single CPU with newborn connections and use a random one. | |||||
* This initialization is normally called on a newborn tcpcb, but potentially | |||||
* can be called once again if stack is switched. In that case we inherit CPU | |||||
* that the previous stack has set, be it random or not. In extreme cases, | |||||
* e.g. syzkaller fuzzing, a tcpcb can already be in HPTS in IHPTS_MOVING state | |||||
* and has never received a first packet. | |||||
*/ | */ | ||||
void | void | ||||
tcp_hpts_init(struct tcpcb *tp) | tcp_hpts_init(struct tcpcb *tp) | ||||
{ | { | ||||
if (__predict_true(tp->t_hpts_cpu == HPTS_CPU_NONE)) { | |||||
tp->t_hpts_cpu = hpts_random_cpu(); | tp->t_hpts_cpu = hpts_random_cpu(); | ||||
tp->t_lro_cpu = HPTS_CPU_NONE; | |||||
MPASS(!(tp->t_flags2 & TF2_HPTS_CPU_SET)); | MPASS(!(tp->t_flags2 & TF2_HPTS_CPU_SET)); | ||||
} | |||||
} | } | ||||
/* | /* | ||||
* Called normally with the INP_LOCKED but it | * Called normally with the INP_LOCKED but it | ||||
* does not matter, the hpts lock is the key | * does not matter, the hpts lock is the key | ||||
* but the lock order allows us to hold the | * but the lock order allows us to hold the | ||||
* INP lock and then get the hpts lock. | * INP lock and then get the hpts lock. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1,446 Lines • Show Last 20 Lines |