lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #7135] Significant etharp optimization for TX speed


From: Bill Auerbach
Subject: [lwip-devel] [patch #7135] Significant etharp optimization for TX speed improvement
Date: Fri, 26 Mar 2010 16:59:33 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6 (.NET CLR 3.5.30729)

URL:
  <http://savannah.nongnu.org/patch/?7135>

                 Summary: Significant etharp optimization for TX speed
improvement
                 Project: lwIP - A Lightweight TCP/IP stack
            Submitted by: billauerbach
            Submitted on: Fri 26 Mar 2010 12:59:33 PM EDT
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None

    _______________________________________________________

Details:

This is a significant optimization as it avoids ARP lookups on every packet
sent through a netif to the same IP address:

In netif.h add members to struct netif:

  /* IP address of last sent packet */
  struct ip_addr last_ip_addr;
  /* MAC address of last sent packet */
  struct eth_addr *last_hw_addr;

In Etharp.c in etharp_query add the 2 lines in the if:

    if (arp_table[i].state == ETHARP_STATE_STABLE) {
      /* we have a valid IP->Ethernet address mapping */
      /* send the packet */
      netif->last_ip_addr = *ipaddr;
      netif->last_hw_addr = &arp_table[i].ethaddr;
      result = etharp_send_ip(netif, q, srcaddr, &(arp_table[i].ethaddr));
    /* pending entry? (either just created or already pending */
    } else if (arp_table[i].state == ETHARP_STATE_PENDING) {

And in etharp_output add:

    /* if the IP address is the last used, use it's MAC address directly */
    if (ip_addr_cmp (ipaddr, &netif->last_ip_addr))
      return etharp_send_ip(netif, q, (struct eth_addr*)(netif->hwaddr),
netif->last_hw_addr);
    /* queue on destination Ethernet address belonging to ipaddr */
    return etharp_query(netif, ipaddr, q);

This avoids the etharp_query on successive sends to the same Ip address on an
interface.  The was the #1 improvement of my changes made to speed up lwIP TX.




    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?7135>

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





reply via email to

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