Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Remove the ipre_mlast field and the TRAVERSE macro.



details:   https://anonhg.NetBSD.org/src/rev/fdea96919a74
branches:  trunk
changeset: 831636:fdea96919a74
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Apr 08 12:18:06 2018 +0000

description:
Remove the ipre_mlast field and the TRAVERSE macro.

The goal was to store in ipre_mlast the last mbuf of the chain, so that
m_cat could be called on it. But it's not needed, since m_cat already
does the equivalent of TRAVERSE itself.

If it were needed, there would be a bug, since we don't call TRAVERSE on
ipre_mlast when creating a new reassembly entry.

diffstat:

 sys/netinet/ip_var.h    |   5 ++---
 sys/netinet/tcp_input.c |  18 +++++-------------
 2 files changed, 7 insertions(+), 16 deletions(-)

diffs (93 lines):

diff -r 49e8277cf4ac -r fdea96919a74 sys/netinet/ip_var.h
--- a/sys/netinet/ip_var.h      Sun Apr 08 11:57:43 2018 +0000
+++ b/sys/netinet/ip_var.h      Sun Apr 08 12:18:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_var.h,v 1.124 2018/04/08 11:50:46 maxv Exp $        */
+/*     $NetBSD: ip_var.h,v 1.125 2018/04/08 12:18:06 maxv Exp $        */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -72,8 +72,7 @@
 TAILQ_HEAD(ipqehead, ipqent);
 struct ipqent {
        TAILQ_ENTRY(ipqent) ipqe_q;
-       struct mbuf     *ipqe_m;        /* point to first mbuf */
-       struct mbuf     *ipre_mlast;    /* point to last mbuf */
+       struct mbuf *ipqe_m;
        TAILQ_ENTRY(ipqent) ipqe_timeq;
        u_int32_t ipqe_seq;
        u_int32_t ipqe_len;
diff -r 49e8277cf4ac -r fdea96919a74 sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c   Sun Apr 08 11:57:43 2018 +0000
+++ b/sys/netinet/tcp_input.c   Sun Apr 08 12:18:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_input.c,v 1.404 2018/04/03 09:03:59 maxv Exp $     */
+/*     $NetBSD: tcp_input.c,v 1.405 2018/04/08 12:18:06 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.404 2018/04/03 09:03:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.405 2018/04/08 12:18:06 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -405,8 +405,6 @@
 static void tcp6_log_refused(const struct ip6_hdr *, const struct tcphdr *);
 #endif
 
-#define        TRAVERSE(x) while ((x)->m_next) (x) = (x)->m_next
-
 #if defined(MBUFTRACE)
 struct mowner tcp_reass_mowner = MOWNER_INIT("tcp", "reass");
 #endif /* defined(MBUFTRACE) */
@@ -501,8 +499,7 @@
                if (pkt_seq == p->ipqe_seq + p->ipqe_len) {
                        p->ipqe_len += pkt_len;
                        p->ipqe_flags |= pkt_flags;
-                       m_cat(p->ipre_mlast, m);
-                       TRAVERSE(p->ipre_mlast);
+                       m_cat(p->ipqe_m, m);
                        m = NULL;
                        tiqe = p;
                        TAILQ_REMOVE(&tp->timeq, p, ipqe_timeq);
@@ -533,8 +530,6 @@
                        q->ipqe_flags |= pkt_flags;
                        m_cat(m, q->ipqe_m);
                        q->ipqe_m = m;
-                       q->ipre_mlast = m; /* last mbuf may have changed */
-                       TRAVERSE(q->ipre_mlast);
                        tiqe = q;
                        TAILQ_REMOVE(&tp->timeq, q, ipqe_timeq);
                        TCP_REASS_COUNTER_INCR(&tcp_reass_prependfirst);
@@ -562,8 +557,7 @@
                        pkt_len += q->ipqe_len;
                        pkt_flags |= q->ipqe_flags;
                        pkt_seq = q->ipqe_seq;
-                       m_cat(q->ipre_mlast, m);
-                       TRAVERSE(q->ipre_mlast);
+                       m_cat(q->ipqe_m, m);
                        m = q->ipqe_m;
                        TCP_REASS_COUNTER_INCR(&tcp_reass_append);
                        goto free_ipqe;
@@ -629,8 +623,7 @@
                        int overlap = q->ipqe_seq + q->ipqe_len - pkt_seq;
                        m_adj(m, overlap);
                        rcvpartdupbyte += overlap;
-                       m_cat(q->ipre_mlast, m);
-                       TRAVERSE(q->ipre_mlast);
+                       m_cat(q->ipqe_m, m);
                        m = q->ipqe_m;
                        pkt_seq = q->ipqe_seq;
                        pkt_len += q->ipqe_len - overlap;
@@ -750,7 +743,6 @@
         * Insert the new fragment queue entry into both queues.
         */
        tiqe->ipqe_m = m;
-       tiqe->ipre_mlast = m;
        tiqe->ipqe_seq = pkt_seq;
        tiqe->ipqe_len = pkt_len;
        tiqe->ipqe_flags = pkt_flags;



Home | Main Index | Thread Index | Old Index