diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -511,8 +511,7 @@ bbr_log_pacing_delay_calc(struct tcp_bbr *bbr, uint16_t gain, uint32_t len, uint32_t cts, uint32_t usecs, uint64_t bw, uint32_t override, int mod); -static int -bbr_ctloutput(struct inpcb *inp, struct sockopt *sopt); +static int bbr_ctloutput(struct tcpcb *tp, struct sockopt *sopt); static inline uint8_t bbr_state_val(struct tcp_bbr *bbr) @@ -14156,17 +14155,17 @@ * option. */ static int -bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt) +bbr_set_sockopt(struct tcpcb *tp, struct sockopt *sopt) { struct epoch_tracker et; - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_bbr *bbr; int32_t error = 0, optval; switch (sopt->sopt_level) { case IPPROTO_IPV6: case IPPROTO_IP: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); } switch (sopt->sopt_name) { @@ -14215,7 +14214,7 @@ case TCP_BBR_RETRAN_WTSO: break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -14227,7 +14226,6 @@ INP_WUNLOCK(inp); return (ECONNRESET); } - tp = intotcpcb(inp); if (tp->t_fb != &__tcp_bbr) { INP_WUNLOCK(inp); return (ENOPROTOOPT); @@ -14551,7 +14549,7 @@ } break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } #ifdef NETFLIX_STATS @@ -14565,13 +14563,12 @@ * return 0 on success, error-num on failure */ static int -bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt) +bbr_get_sockopt(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_bbr *bbr; int32_t error, optval; - tp = intotcpcb(inp); bbr = (struct tcp_bbr *)tp->t_fb_ptr; if (bbr == NULL) { INP_WUNLOCK(inp); @@ -14710,7 +14707,7 @@ optval |= BBR_INCL_ENET_OH; break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -14722,12 +14719,12 @@ * return 0 on success, error-num on failure */ static int -bbr_ctloutput(struct inpcb *inp, struct sockopt *sopt) +bbr_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { if (sopt->sopt_dir == SOPT_SET) { - return (bbr_set_sockopt(inp, sopt)); + return (bbr_set_sockopt(tp, sopt)); } else if (sopt->sopt_dir == SOPT_GET) { - return (bbr_get_sockopt(inp, sopt)); + return (bbr_get_sockopt(tp, sopt)); } else { panic("%s: sopt_dir $%d", __func__, sopt->sopt_dir); } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -448,7 +448,7 @@ uint32_t type, uint32_t ack, int ); static void rack_counter_destroy(void); static int -rack_ctloutput(struct inpcb *inp, struct sockopt *sopt); +rack_ctloutput(struct tcpcb *tp, struct sockopt *sopt); static int32_t rack_ctor(void *mem, int32_t size, void *arg, int32_t how); static void rack_set_pace_segments(struct tcpcb *tp, struct tcp_rack *rack, uint32_t line, uint64_t *fill_override); @@ -473,7 +473,7 @@ static struct rack_sendmap *rack_find_lowest_rsm(struct tcp_rack *rack); static void rack_free(struct tcp_rack *rack, struct rack_sendmap *rsm); static void rack_fini(struct tcpcb *tp, int32_t tcb_is_purged); -static int rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt); +static int rack_get_sockopt(struct tcpcb *tp, struct sockopt *sopt); static void rack_do_goodput_measurement(struct tcpcb *tp, struct tcp_rack *rack, tcp_seq th_ack, int line, uint8_t quality); @@ -509,7 +509,7 @@ uint32_t cts, int *no_extra, int *moved_two, uint32_t segsiz); static void rack_post_recovery(struct tcpcb *tp, uint32_t th_seq); static void rack_remxt_tmr(struct tcpcb *tp); -static int rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt); +static int rack_set_sockopt(struct tcpcb *tp, struct sockopt *sopt); static void rack_set_state(struct tcpcb *tp, struct tcp_rack *rack); static int32_t rack_stopall(struct tcpcb *tp); static void rack_timer_cancel(struct tcpcb *tp, struct tcp_rack *rack, uint32_t cts, int line); @@ -23423,21 +23423,20 @@ * option. */ static int -rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt) +rack_set_sockopt(struct tcpcb *tp, struct sockopt *sopt) { + struct inpcb *inp = tptoinpcb(tp); #ifdef INET6 struct ip6_hdr *ip6; #endif #ifdef INET struct ip *ip; #endif - struct tcpcb *tp; struct tcp_rack *rack; struct tcp_hybrid_req hybrid; uint64_t loptval; int32_t error = 0, mask, optval, tclass; - tp = intotcpcb(inp); rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack == NULL) { INP_WUNLOCK(inp); @@ -23573,7 +23572,7 @@ break; default: /* Filter off all unknown options to the base stack */ - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } @@ -23682,9 +23681,9 @@ } static int -rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt) +rack_get_sockopt(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp; + struct inpcb *inp = tptoinpcb(tp); struct tcp_rack *rack; int32_t error, optval; uint64_t val, loptval; @@ -23696,7 +23695,6 @@ * impact to this routine. */ error = 0; - tp = intotcpcb(inp); rack = (struct tcp_rack *)tp->t_fb_ptr; if (rack == NULL) { INP_WUNLOCK(inp); @@ -23962,7 +23960,7 @@ optval = rack->r_ctl.timer_slop; break; default: - return (tcp_default_ctloutput(inp, sopt)); + return (tcp_default_ctloutput(tp, sopt)); break; } INP_WUNLOCK(inp); @@ -23976,12 +23974,12 @@ } static int -rack_ctloutput(struct inpcb *inp, struct sockopt *sopt) +rack_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { if (sopt->sopt_dir == SOPT_SET) { - return (rack_set_sockopt(inp, sopt)); + return (rack_set_sockopt(tp, sopt)); } else if (sopt->sopt_dir == SOPT_GET) { - return (rack_get_sockopt(inp, sopt)); + return (rack_get_sockopt(tp, sopt)); } else { panic("%s: sopt_dir $%d", __func__, sopt->sopt_dir); } diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1771,7 +1771,7 @@ } /* Pass in the INP locked, callee must unlock it. */ - return (tp->t_fb->tfb_tcp_ctloutput(inp, sopt)); + return (tp->t_fb->tfb_tcp_ctloutput(tp, sopt)); } static int @@ -1821,7 +1821,7 @@ } /* Pass in the INP locked, callee must unlock it. */ - return (tp->t_fb->tfb_tcp_ctloutput(inp, sopt)); + return (tp->t_fb->tfb_tcp_ctloutput(tp, sopt)); } int @@ -2001,9 +2001,9 @@ } int -tcp_default_ctloutput(struct inpcb *inp, struct sockopt *sopt) +tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt) { - struct tcpcb *tp = intotcpcb(inp); + struct inpcb *inp = tptoinpcb(tp); int error, opt, optval; u_int ui; struct tcp_info ti; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -600,7 +600,7 @@ int (*tfb_do_segment_nounlock)(struct tcpcb *, struct mbuf *, struct tcphdr *, int, int, uint8_t, int, struct timeval *); int (*tfb_do_queued_segments)(struct tcpcb *, int); - int (*tfb_tcp_ctloutput)(struct inpcb *inp, struct sockopt *sopt); + int (*tfb_tcp_ctloutput)(struct tcpcb *, struct sockopt *); /* Optional memory allocation/free routine */ int (*tfb_tcp_fb_init)(struct tcpcb *, void **); void (*tfb_tcp_fb_fini)(struct tcpcb *, int); @@ -1381,7 +1381,7 @@ void tcp_switch_back_to_default(struct tcpcb *tp); struct tcp_function_block * find_and_ref_tcp_fb(struct tcp_function_block *fs); -int tcp_default_ctloutput(struct inpcb *inp, struct sockopt *sopt); +int tcp_default_ctloutput(struct tcpcb *tp, struct sockopt *sopt); int tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt); extern counter_u64_t tcp_inp_lro_direct_queue;