[haiku-commits] haiku: hrev54249 - src/add-ons/kernel/network/protocols/tcp build/config_headers src/tests/system/network/tcp_shell

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 22 May 2020 22:33:01 -0400 (EDT)

hrev54249 adds 1 changeset to branch 'master'
old head: 82817fee459c0cf981eaf283324616b26f3ae9a2
new head: 44a4bc5fd6d2bf7a0cfbaf303f6ec4b3f46f7142
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=44a4bc5fd6d2+%5E82817fee459c

----------------------------------------------------------------------------

44a4bc5fd6d2: tcp: Remove sanity checks from BufferQueue in release builds
  
  Each TCPEndpoint has two BufferQueue members, one for the send queue
  and one for the receive queue.
  
  If DEBUG_BUFFER_QUEUE is enabled, then most methods of BufferQueue
  call BufferQueue::Verify(), sometimes twice. This member function
  performs some sanity checking which requires iterating through every
  net_buffer in the queue.
  
  Disabling this in a debug build improved throughput by a factor of 5x
  over the loopback interface on my laptop. Using iperf the measured
  throughput went from 900Mbps to around 4.8Gbps.
  
  This patch turns this sanity checking off for release builds.
  
  * Rename DEBUG_BUFFER_QUEUE to DEBUG_TCP_BUFFER_QUEUE
  * Change the default in BufferQueue.h to disabled
  * Set DEBUG_TCP_BUFFER_QUEUE to KDEBUG_LEVEL_2 in
    kernel_debug_config.h
  
  Change-Id: I262dac5d7e2889d2942bbdcf6b667cc0cbafa4c8
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2780
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                                  [ Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev54249
Commit:      44a4bc5fd6d2bf7a0cfbaf303f6ec4b3f46f7142
URL:         https://git.haiku-os.org/haiku/commit/?id=44a4bc5fd6d2
Author:      Kyle Ambroff-Kao <kyle@xxxxxxxxxxxxxx>
Date:        Sat May 23 02:09:09 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sat May 23 02:32:58 2020 UTC

----------------------------------------------------------------------------

5 files changed, 13 insertions(+), 11 deletions(-)
build/config_headers/kernel_debug_config.h               | 6 ++++++
src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp | 6 +++---
src/add-ons/kernel/network/protocols/tcp/BufferQueue.h   | 6 +-----
src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp | 4 ++--
src/tests/system/network/tcp_shell/BufferQueueTest.cpp   | 2 +-

----------------------------------------------------------------------------

diff --git a/build/config_headers/kernel_debug_config.h 
b/build/config_headers/kernel_debug_config.h
index 1dcc08f2c5..2a0b4d653f 100644
--- a/build/config_headers/kernel_debug_config.h
+++ b/build/config_headers/kernel_debug_config.h
@@ -140,4 +140,10 @@
 #define SYSTEM_PROFILE_INTERVAL                        10000
 
 
+// Network
+
+// Enables additional assertions in the tcp add-on.
+#define DEBUG_TCP_BUFFER_QUEUE                 KDEBUG_LEVEL_2
+
+
 #endif // KERNEL_DEBUG_CONFIG_H
diff --git a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp 
b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp
index de83ba3b31..4d5ada0a27 100644
--- a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp
+++ b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.cpp
@@ -19,7 +19,7 @@
 #      define TRACE(x)
 #endif
 
-#if DEBUG_BUFFER_QUEUE
+#if DEBUG_TCP_BUFFER_QUEUE
 #      define VERIFY() Verify();
 #else
 #      define VERIFY() ;
@@ -436,7 +436,7 @@ BufferQueue::SetPushPointer()
                fPushPointer = fList.Tail()->sequence + fList.Tail()->size;
 }
 
-#if DEBUG_BUFFER_QUEUE
+#if DEBUG_TCP_BUFFER_QUEUE
 
 /*!    Perform a sanity check of the whole queue.
 */
@@ -486,4 +486,4 @@ BufferQueue::Dump() const
        }
 }
 
-#endif // DEBUG_BUFFER_QUEUE
+#endif // DEBUG_TCP_BUFFER_QUEUE
diff --git a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h 
b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h
index 73986a880c..f428ae921b 100644
--- a/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h
+++ b/src/add-ons/kernel/network/protocols/tcp/BufferQueue.h
@@ -13,10 +13,6 @@
 
 #include <util/DoublyLinkedList.h>
 
-#ifndef DEBUG_BUFFER_QUEUE
-#      define DEBUG_BUFFER_QUEUE 1
-#endif
-
 
 typedef DoublyLinkedList<struct net_buffer,
        DoublyLinkedListCLink<struct net_buffer> > SegmentList;
@@ -55,7 +51,7 @@ public:
                        tcp_sequence            NextSequence() const
                                                                        { 
return fFirstSequence + fContiguousBytes; }
 
-#if DEBUG_BUFFER_QUEUE
+#if DEBUG_TCP_BUFFER_QUEUE
                        void                            Verify() const;
                        void                            Dump() const;
 #endif
diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp 
b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
index 9640f8b065..0c4d9cae6a 100644
--- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
+++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
@@ -2533,7 +2533,7 @@ TCPEndpoint::Dump() const
        kprintf("    max segment size: %" B_PRIu32 "\n", fSendMaxSegmentSize);
        kprintf("    queue: %" B_PRIuSIZE " / %" B_PRIuSIZE "\n", 
fSendQueue.Used(),
                fSendQueue.Size());
-#if DEBUG_BUFFER_QUEUE
+#if DEBUG_TCP_BUFFER_QUEUE
        fSendQueue.Dump();
 #endif
        kprintf("    last acknowledge sent: %" B_PRIu32 "\n",
@@ -2549,7 +2549,7 @@ TCPEndpoint::Dump() const
        kprintf("    max segment size: %" B_PRIu32 "\n", 
fReceiveMaxSegmentSize);
        kprintf("    queue: %" B_PRIuSIZE " / %" B_PRIuSIZE "\n",
                fReceiveQueue.Available(), fReceiveQueue.Size());
-#if DEBUG_BUFFER_QUEUE
+#if DEBUG_TCP_BUFFER_QUEUE
        fReceiveQueue.Dump();
 #endif
        kprintf("    initial sequence: %" B_PRIu32 "\n",
diff --git a/src/tests/system/network/tcp_shell/BufferQueueTest.cpp 
b/src/tests/system/network/tcp_shell/BufferQueueTest.cpp
index ef8cbe01b4..ed54d35aa0 100644
--- a/src/tests/system/network/tcp_shell/BufferQueueTest.cpp
+++ b/src/tests/system/network/tcp_shell/BufferQueueTest.cpp
@@ -3,7 +3,7 @@
  * Distributed under the terms of the MIT License.
  */
 
-#define DEBUG_BUFFER_QUEUE 1
+#define DEBUG_TCP_BUFFER_QUEUE 1
 
 #include "BufferQueue.h"
 


Other related posts:

  • » [haiku-commits] haiku: hrev54249 - src/add-ons/kernel/network/protocols/tcp build/config_headers src/tests/system/network/tcp_shell - waddlesplash