lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #46290] Optimize passing contiguous buffers to tcp_wri


From: Ambroz Bizjak
Subject: [lwip-devel] [bug #46290] Optimize passing contiguous buffers to tcp_write
Date: Sun, 25 Oct 2015 08:36:20 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36

URL:
  <http://savannah.nongnu.org/bugs/?46290>

                 Summary: Optimize passing contiguous buffers to tcp_write
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: abizjak
            Submitted on: Sun 25 Oct 2015 08:36:19 AM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: Faulty Behaviour
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 
            lwIP version: git head

    _______________________________________________________

Details:

When the application is using tcp_write() without TCP_WRITE_FLAG_MORE to send
data out of a single (ring) buffer, tcp_write() will end up allocating a
PBUF_ROM pbuf for each call. This can lead to lots of these pbufs being
allocated when the application writes data in little chunks, and possibly we
run out of pbufs in the PBUF pool (MEMP_NUM_PBUF). There is no reasonable
limit on the number of pbufs that are needed in the worst case. This is an
important issue because one "bad" connection can starve other connections.

I've implemented a little bit of smartness in tcp_write() which I think fixes
this issue.

* TCP_EXTEND_ROM_PBUFS: If enabled, a buffer passed to tcp_write() that
* is a continuation of the previous passed buffer will be combined into the
* existing pbuf when possible, instead of allocating a new pbuf and adding
* it to the chain.
* This only works when tcp_write() is called without TCP_WRITE_FLAG_COPY.
* It greatly reduces the worst case number of needed pbufs for TCP
* transmission when the application sends data from a single buffer
* (to a little more than TCP_SND_QUEUELEN per connection).



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Sun 25 Oct 2015 08:36:19 AM GMT  Name: lwip-extend-rom-pbuf.patch  Size:
6kB   By: abizjak

<http://savannah.nongnu.org/bugs/download.php?file_id=35284>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?46290>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]