Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Don't call tcp_input_checksum again, it was alre...



details:   https://anonhg.NetBSD.org/src/rev/8b82360db62e
branches:  trunk
changeset: 831329:8b82360db62e
user:      maxv <maxv%NetBSD.org@localhost>
date:      Thu Mar 22 20:48:38 2018 +0000

description:
Don't call tcp_input_checksum again, it was already called earlier, no
need to checksum twice.

Then call tcp_fields_to_host a bit earlier, so that we don't need to call
it in each branch.

diffstat:

 sys/netinet/tcp_input.c |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (56 lines):

diff -r a28b09372d13 -r 8b82360db62e sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Thu Mar 22 17:27:34 2018 +0000
+++ b/sys/netinet/tcp_input.c   Thu Mar 22 20:48:38 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.383 2018/03/01 06:08:43 maxv Exp $     */
+/*     $NetBSD: tcp_input.c,v 1.384 2018/03/22 20:48:38 maxv Exp $     */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.383 2018/03/01 06:08:43 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.384 2018/03/22 20:48:38 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1505,6 +1505,8 @@
 #endif
        }
 
+       tcp_fields_to_host(th);
+
        /*
         * If the state is CLOSED (i.e., TCB does not exist) then
         * all data in the incoming segment is discarded.
@@ -1529,27 +1531,19 @@
 #endif
        else if (vestige.valid) {
                /* We do not support the resurrection of vtw tcpcps. */
-               if (tcp_input_checksum(af, m, th, toff, off, tlen))
-                       goto badcsum;
-
-               tcp_fields_to_host(th);
                tcp_vtw_input(th, &vestige, m, tlen);
                m = NULL;
                goto drop;
        }
 
-       if (tp == NULL) {
-               tcp_fields_to_host(th);
+       if (tp == NULL)
                goto dropwithreset_ratelim;
-       }
        if (tp->t_state == TCPS_CLOSED)
                goto drop;
 
        KASSERT(so->so_lock == softnet_lock);
        KASSERT(solocked(so));
 
-       tcp_fields_to_host(th);
-
        /* Unscale the window into a 32-bit value. */
        if ((tiflags & TH_SYN) == 0)
                tiwin = th->th_win << tp->snd_scale;



Home | Main Index | Thread Index | Old Index