diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -1332,7 +1332,7 @@ did_prefetch = 1; } if ((inp->inp_flags2 & INP_SUPPORTS_MBUFQ) && tp->t_in_pkt) { - error = (*tp->t_fb->tfb_do_queued_segments)(inp->inp_socket, tp, 0); + error = (*tp->t_fb->tfb_do_queued_segments)(tp, 0); if (error) { /* The input killed the connection */ goto skip_pacing; diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1142,8 +1142,8 @@ * the mbuf chain and unlocks the inpcb. */ TCP_PROBE5(receive, NULL, tp, m, tp, th); - tp->t_fb->tfb_tcp_do_segment(m, th, so, tp, drop_hdrlen, tlen, - iptos); + tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, + tlen, iptos); return (IPPROTO_DONE); } /* @@ -1379,7 +1379,7 @@ if ((lookupflag & INPLOOKUP_RLOCKPCB) && INP_TRY_UPGRADE(inp) == 0) goto dropunlock; - tp->t_fb->tfb_tcp_do_segment(m, th, so, tp, drop_hdrlen, tlen, iptos); + tp->t_fb->tfb_tcp_do_segment(tp, m, th, drop_hdrlen, tlen, iptos); return (IPPROTO_DONE); dropwithreset: @@ -1493,8 +1493,8 @@ } void -tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos) +tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int drop_hdrlen, int tlen, uint8_t iptos) { uint16_t thflags; int acked, ourfinisacked, needoutput = 0, sack_changed; @@ -1503,6 +1503,7 @@ uint16_t nsegs; char *s; struct inpcb *inp = tptoinpcb(tp); + struct socket *so = tptosocket(tp); struct in_conninfo *inc = &inp->inp_inc; struct mbuf *mfree; struct tcpopt to; diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1443,7 +1443,7 @@ if (should_wake) { /* Wakeup */ counter_u64_add(tcp_inp_lro_wokeup_queue, 1); - if ((*tp->t_fb->tfb_do_queued_segments)(inp->inp_socket, tp, 0)) + if ((*tp->t_fb->tfb_do_queued_segments)(tp, 0)) inp = NULL; } if (inp != NULL) 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 @@ -11271,11 +11271,12 @@ } static int -bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos, - int32_t nxt_pkt, struct timeval *tv) +bbr_do_segment_nounlock(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int32_t drop_hdrlen, int32_t tlen, uint8_t iptos, int32_t nxt_pkt, + struct timeval *tv) { struct inpcb *inp = tptoinpcb(tp); + struct socket *so = tptosocket(tp); int32_t thflags, retval; uint32_t cts, lcts; uint32_t tiwin; @@ -11438,7 +11439,7 @@ if ((tp->t_flags & TF_SACK_PERMIT) == 0) { /* Bail */ tcp_switch_back_to_default(tp); - (*tp->t_fb->tfb_tcp_do_segment) (m, th, so, tp, drop_hdrlen, + (*tp->t_fb->tfb_tcp_do_segment)(tp, m, th, drop_hdrlen, tlen, iptos); return (1); } @@ -11600,15 +11601,15 @@ } static void -bbr_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos) +bbr_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int32_t drop_hdrlen, int32_t tlen, uint8_t iptos) { struct timeval tv; int retval; /* First lets see if we have old packets */ if (tp->t_in_pkt) { - if (ctf_do_queued_segments(so, tp, 1)) { + if (ctf_do_queued_segments(tp, 1)) { m_freem(m); return; } @@ -11619,8 +11620,8 @@ /* Should not be should we kassert instead? */ tcp_get_usecs(&tv); } - retval = bbr_do_segment_nounlock(m, th, so, tp, - drop_hdrlen, tlen, iptos, 0, &tv); + retval = bbr_do_segment_nounlock(tp, m, th, drop_hdrlen, tlen, iptos, + 0, &tv); if (retval == 0) { INP_WUNLOCK(tptoinpcb(tp)); } 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 @@ -453,9 +453,8 @@ static void rack_set_pace_segments(struct tcpcb *tp, struct tcp_rack *rack, uint32_t line, uint64_t *fill_override); static void -rack_do_segment(struct mbuf *m, struct tcphdr *th, - struct socket *so, struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, - uint8_t iptos); +rack_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int32_t drop_hdrlen, int32_t tlen, uint8_t iptos); static void rack_dtor(void *mem, int32_t size, void *arg); static void rack_log_alt_to_to_cancel(struct tcp_rack *rack, @@ -16484,11 +16483,12 @@ static int -rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos, - int32_t nxt_pkt, struct timeval *tv) +rack_do_segment_nounlock(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int32_t drop_hdrlen, int32_t tlen, uint8_t iptos, int32_t nxt_pkt, + struct timeval *tv) { struct inpcb *inp = tptoinpcb(tp); + struct socket *so = tptosocket(tp); #ifdef TCP_ACCOUNTING uint64_t ts_val; #endif @@ -16871,7 +16871,7 @@ if ((rack_sack_not_required == 0) && ((tp->t_flags & TF_SACK_PERMIT) == 0)) { tcp_switch_back_to_default(tp); - (*tp->t_fb->tfb_tcp_do_segment) (m, th, so, tp, drop_hdrlen, + (*tp->t_fb->tfb_tcp_do_segment)(tp, m, th, drop_hdrlen, tlen, iptos); #ifdef TCP_ACCOUNTING sched_unpin(); @@ -17054,15 +17054,15 @@ return (retval); } -void -rack_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, - struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos) +static void +rack_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, + int32_t drop_hdrlen, int32_t tlen, uint8_t iptos) { struct timeval tv; /* First lets see if we have old packets */ if (tp->t_in_pkt) { - if (ctf_do_queued_segments(so, tp, 1)) { + if (ctf_do_queued_segments(tp, 1)) { m_freem(m); return; } @@ -17073,8 +17073,8 @@ /* Should not be should we kassert instead? */ tcp_get_usecs(&tv); } - if (rack_do_segment_nounlock(m, th, so, tp, - drop_hdrlen, tlen, iptos, 0, &tv) == 0) { + if (rack_do_segment_nounlock(tp, m, th, drop_hdrlen, tlen, iptos, 0, + &tv) == 0) { INP_WUNLOCK(tptoinpcb(tp)); } } diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.h b/sys/netinet/tcp_stacks/rack_bbr_common.h --- a/sys/netinet/tcp_stacks/rack_bbr_common.h +++ b/sys/netinet/tcp_stacks/rack_bbr_common.h @@ -87,11 +87,7 @@ #ifdef _KERNEL /* We have only 7 bits in rack so assert its true */ CTASSERT((PACE_TMR_MASK & 0x80) == 0); -int -ctf_process_inbound_raw(struct tcpcb *tp, struct socket *so, - struct mbuf *m, int has_pkt); -int -ctf_do_queued_segments(struct socket *so, struct tcpcb *tp, int have_pkt); +int ctf_do_queued_segments(struct tcpcb *tp, int have_pkt); uint32_t ctf_outstanding(struct tcpcb *tp); uint32_t ctf_flight_size(struct tcpcb *tp, uint32_t rc_sacked); int diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c --- a/sys/netinet/tcp_stacks/rack_bbr_common.c +++ b/sys/netinet/tcp_stacks/rack_bbr_common.c @@ -323,8 +323,8 @@ * c) The push bit has been set by the peer */ -int -ctf_process_inbound_raw(struct tcpcb *tp, struct socket *so, struct mbuf *m, int has_pkt) +static int +ctf_process_inbound_raw(struct tcpcb *tp, struct mbuf *m, int has_pkt) { /* * We are passed a raw change of mbuf packets @@ -461,8 +461,8 @@ KMOD_TCPSTAT_INC(tcps_rcvtotal); else KMOD_TCPSTAT_ADD(tcps_rcvtotal, (m->m_len / sizeof(struct tcp_ackent))); - retval = (*tp->t_fb->tfb_do_segment_nounlock)(m, th, so, tp, drop_hdrlen, tlen, - iptos, nxt_pkt, &tv); + retval = (*tp->t_fb->tfb_do_segment_nounlock)(tp, m, th, + drop_hdrlen, tlen, iptos, nxt_pkt, &tv); if (retval) { /* We lost the lock and tcb probably */ m = m_save; @@ -488,7 +488,7 @@ } int -ctf_do_queued_segments(struct socket *so, struct tcpcb *tp, int have_pkt) +ctf_do_queued_segments(struct tcpcb *tp, int have_pkt) { struct mbuf *m; @@ -497,7 +497,7 @@ m = tp->t_in_pkt; tp->t_in_pkt = NULL; tp->t_tail_pkt = NULL; - if (ctf_process_inbound_raw(tp, so, m, have_pkt)) { + if (ctf_process_inbound_raw(tp, m, have_pkt)) { /* We lost the tcpcb (maybe a RST came in)? */ return(1); } 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 @@ -595,14 +595,11 @@ struct tcp_function_block { char tfb_tcp_block_name[TCP_FUNCTION_NAME_LEN_MAX]; int (*tfb_tcp_output)(struct tcpcb *); - void (*tfb_tcp_do_segment)(struct mbuf *, struct tcphdr *, - struct socket *, struct tcpcb *, - int, int, uint8_t); - int (*tfb_do_queued_segments)(struct socket *, struct tcpcb *, int); - int (*tfb_do_segment_nounlock)(struct mbuf *, struct tcphdr *, - struct socket *, struct tcpcb *, - int, int, uint8_t, - int, struct timeval *); + void (*tfb_tcp_do_segment)(struct tcpcb *, struct mbuf *, + struct tcphdr *, int, int, uint8_t); + 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); /* Optional memory allocation/free routine */ int (*tfb_tcp_fb_init)(struct tcpcb *, void **); @@ -1369,8 +1366,8 @@ int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int); int tcp_input_with_port(struct mbuf **, int *, int, uint16_t); -void tcp_do_segment(struct mbuf *, struct tcphdr *, - struct socket *, struct tcpcb *, int, int, uint8_t); +void tcp_do_segment(struct tcpcb *, struct mbuf *, struct tcphdr *, int, + int, uint8_t); int register_tcp_functions(struct tcp_function_block *blk, int wait); int register_tcp_functions_as_names(struct tcp_function_block *blk,