Changeset ee58d0d for lib/protocols_l3.c


Ignore:
Timestamp:
08/12/11 14:22:16 (10 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
c29a0e0
Parents:
44028d4
Message:
  • Improved performance by caching more stuff, especially L2 headers and various "remaining" values - not much point caching something if you need to re-read the entire packet to calculate "remaining" still :)
  • Also improved performance of trace_get_layer2 by avoiding an effective double call of trace_get_packet_buffer
  • Fixed bug with payload length calculation if the packet has extra padding beyond what the IP len states
  • Improved (hopefully) performance when reading ERF traces by avoiding updating the drops counter if the loss counter was zero (should save an ntohs at least)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/protocols_l3.c

    rd247823 ree58d0d  
    126126                        return NULL;
    127127                }
     128                /* If the packet features extra "padding", we probably
     129                 * don't want that counting as possible payload, e.g. for
     130                 * payload length calculations */
     131                if (*remaining > ntohs(ipptr->ip_len))
     132                        *remaining = ntohs(ipptr->ip_len);
     133
    128134                *remaining-=(ipptr->ip_hl * 4);
    129135        }
     
    223229        if (packet->l3_header)
    224230        {
     231                /*
    225232                link = trace_get_packet_buffer(packet,&linktype,remaining);
    226233
    227234                if (!link)
    228235                        return NULL;
     236                */
    229237
    230238                *ethertype = packet->l3_ethertype;
    231                 *remaining -= (packet->l3_header - link);
     239                /* *remaining -= (packet->l3_header - link); */
     240                *remaining = packet->l3_remaining;
    232241
    233242                return packet->l3_header;
     
    276285        ((libtrace_packet_t*)packet)->l3_ethertype = *ethertype;
    277286        ((libtrace_packet_t*)packet)->l3_header = iphdr;
     287        ((libtrace_packet_t*)packet)->l3_remaining = *remaining;
    278288
    279289        return iphdr;
Note: See TracChangeset for help on using the changeset viewer.