Enforce the actual required rmem and wmem limits we care about

When receiving large messages, the kernel actually starts performing
very poorly with a large rmem.  The only reason to configure a large
rmem is so we avoid fragmentation, which isn't actually possible.  Our
stack supports handling fragmentation already, so there is little harm.
There are ways to make it too small, but you can always configure a
network stack to have really bad performance and AOS shouldn't be in the
buisness of enforcing settings that aren't correctness issues.

wmem needs to be large enough to send the max message size.  So let's
enforce that to avoid the send failure that otherwise occurs.

Change-Id: I49d53285057167e36f1c5b78a4582e30e1d8eb97
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/network/sctp_lib.cc b/aos/network/sctp_lib.cc
index 4651d82..b9840c6 100644
--- a/aos/network/sctp_lib.cc
+++ b/aos/network/sctp_lib.cc
@@ -444,22 +444,19 @@
 }
 
 void SctpReadWrite::DoSetMaxSize() {
-  // Have the kernel give us a factor of 10 more.  This lets us have more than
-  // one full sized packet in flight.
-  size_t max_size = max_size_ * 10;
+  size_t max_size = max_size_;
 
-  CHECK_GE(ReadRMemMax(), max_size)
-      << "rmem_max is too low. To increase rmem_max temporarily, do sysctl "
-         "-w net.core.rmem_max="
-      << max_size;
+  // This sets the max packet size that we can send.
   CHECK_GE(ReadWMemMax(), max_size)
       << "wmem_max is too low. To increase wmem_max temporarily, do sysctl "
          "-w net.core.wmem_max="
       << max_size;
-  PCHECK(setsockopt(fd(), SOL_SOCKET, SO_RCVBUF, &max_size, sizeof(max_size)) ==
-         0);
   PCHECK(setsockopt(fd(), SOL_SOCKET, SO_SNDBUF, &max_size, sizeof(max_size)) ==
          0);
+
+  // The SO_RCVBUF option (also controlled by net.core.rmem_default) needs to be
+  // decently large but the actual size can be measured by tuning.  The defaults
+  // should be fine.  If it isn't big enough, transmission will fail.
 }
 
 bool SctpReadWrite::ProcessNotification(const Message *message) {