tcp: pass tcpcb in the tfb_tcp_ctloutput() method instead of inpcb

Just matches rest of the KPI.

Reviewed by:		rrs
Differential Revision:	https://reviews.freebsd.org/D39435
This commit is contained in:
Gleb Smirnoff 2023-04-07 12:18:10 -07:00
parent 35bc0bcc51
commit 66fbc19fbd
4 changed files with 30 additions and 35 deletions

View File

@ -511,8 +511,7 @@ static void
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)
@ -14134,17 +14133,17 @@ struct tcp_function_block __tcp_bbr = {
* 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) {
@ -14190,7 +14189,7 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt)
case TCP_BBR_RETRAN_WTSO:
break;
default:
return (tcp_default_ctloutput(inp, sopt));
return (tcp_default_ctloutput(tp, sopt));
break;
}
INP_WUNLOCK(inp);
@ -14202,7 +14201,6 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt)
INP_WUNLOCK(inp);
return (ECONNRESET);
}
tp = intotcpcb(inp);
if (tp->t_fb != &__tcp_bbr) {
INP_WUNLOCK(inp);
return (ENOPROTOOPT);
@ -14519,7 +14517,7 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt)
}
break;
default:
return (tcp_default_ctloutput(inp, sopt));
return (tcp_default_ctloutput(tp, sopt));
break;
}
tcp_log_socket_option(tp, sopt->sopt_name, optval, error);
@ -14531,13 +14529,12 @@ bbr_set_sockopt(struct inpcb *inp, struct sockopt *sopt)
* 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);
@ -14676,7 +14673,7 @@ bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt)
optval |= BBR_INCL_ENET_OH;
break;
default:
return (tcp_default_ctloutput(inp, sopt));
return (tcp_default_ctloutput(tp, sopt));
break;
}
INP_WUNLOCK(inp);
@ -14688,12 +14685,12 @@ bbr_get_sockopt(struct inpcb *inp, struct sockopt *sopt)
* 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);
}

View File

@ -448,7 +448,7 @@ rack_cong_signal(struct tcpcb *tp,
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 @@ rack_find_high_nonack(struct tcp_rack *rack,
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 @@ rack_proc_sack_blk(struct tcpcb *tp, struct tcp_rack *rack,
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);
@ -23364,21 +23364,20 @@ static struct tcp_function_block __tcp_rack = {
* 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);
@ -23514,7 +23513,7 @@ rack_set_sockopt(struct inpcb *inp, struct sockopt *sopt)
break;
default:
/* Filter off all unknown options to the base stack */
return (tcp_default_ctloutput(inp, sopt));
return (tcp_default_ctloutput(tp, sopt));
break;
}
@ -23623,9 +23622,9 @@ rack_fill_info(struct tcpcb *tp, struct tcp_info *ti)
}
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;
@ -23637,7 +23636,6 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt)
* impact to this routine.
*/
error = 0;
tp = intotcpcb(inp);
rack = (struct tcp_rack *)tp->t_fb_ptr;
if (rack == NULL) {
INP_WUNLOCK(inp);
@ -23903,7 +23901,7 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt)
optval = rack->r_ctl.timer_slop;
break;
default:
return (tcp_default_ctloutput(inp, sopt));
return (tcp_default_ctloutput(tp, sopt));
break;
}
INP_WUNLOCK(inp);
@ -23917,12 +23915,12 @@ rack_get_sockopt(struct inpcb *inp, struct sockopt *sopt)
}
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);
}

View File

@ -1770,7 +1770,7 @@ tcp_ctloutput_set(struct inpcb *inp, struct sockopt *sopt)
}
/* 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
@ -1820,7 +1820,7 @@ tcp_ctloutput_get(struct inpcb *inp, struct sockopt *sopt)
}
/* 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
@ -2000,9 +2000,9 @@ tcp_set_cc_mod(struct inpcb *inp, struct sockopt *sopt)
}
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;

View File

@ -599,7 +599,7 @@ struct tcp_function_block {
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);
@ -1390,7 +1390,7 @@ int find_tcp_function_alias(struct tcp_function_block *blk, struct tcp_function_
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);
void tcp_log_socket_option(struct tcpcb *tp, uint32_t option_num,
uint32_t option_val, int err);