mirror of
https://github.com/opnsense/src.git
synced 2026-06-10 17:22:46 -04:00
tcp: reduce argument list to functions that pass a segment
The socket argument is superfluous, as a tcpcb always has one and only one socket. Reviewed by: rrs Differential Revision: https://reviews.freebsd.org/D39434
This commit is contained in:
parent
de4368dd84
commit
35bc0bcc51
8 changed files with 45 additions and 50 deletions
|
|
@ -1332,7 +1332,7 @@ again:
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -1142,8 +1142,8 @@ tfo_socket_result:
|
|||
* 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 @@ tfo_socket_result:
|
|||
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 @@ tcp_handle_wakeup(struct tcpcb *tp)
|
|||
}
|
||||
|
||||
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 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -1443,7 +1443,7 @@ tcp_lro_flush_tcphpts(struct lro_ctrl *lc, struct lro_entry *le)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -11261,11 +11261,12 @@ bbr_check_bbr_for_state(struct tcp_bbr *bbr, uint32_t cts, int32_t line, uint32_
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -11428,7 +11429,7 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
|||
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);
|
||||
}
|
||||
|
|
@ -11590,15 +11591,15 @@ done_with_input:
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
@ -11609,8 +11610,8 @@ bbr_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
|||
/* 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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -453,9 +453,8 @@ 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);
|
||||
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,
|
||||
|
|
@ -16436,11 +16435,12 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb
|
|||
|
||||
|
||||
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
|
||||
|
|
@ -16823,7 +16823,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
|||
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();
|
||||
|
|
@ -17006,15 +17006,15 @@ do_output_now:
|
|||
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;
|
||||
}
|
||||
|
|
@ -17025,8 +17025,8 @@ rack_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
|
|||
/* 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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -323,8 +323,8 @@ ctf_get_enet_type(struct ifnet *ifp, struct mbuf *m)
|
|||
* 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 @@ skip_vnet:
|
|||
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 @@ skipped_pkt:
|
|||
}
|
||||
|
||||
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 @@ ctf_do_queued_segments(struct socket *so, struct tcpcb *tp, int have_pkt)
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -594,14 +594,11 @@ struct tcptemp {
|
|||
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 **);
|
||||
|
|
@ -1378,8 +1375,8 @@ int tcp_input(struct mbuf **, int *, int);
|
|||
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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue