Changeset 9cc1266 for lib/linktypes.c


Ignore:
Timestamp:
02/22/11 10:01:08 (11 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:
e4e94c38
Parents:
ae76c14
Message:
  • Fixed poor performance of the event API by greatly reducing the amount of packets created, copied and freed
  • We now cache the transport header and payload length for each packet
  • We now deal with Linux SLL Ethernet captures taken using tcpdump with -i any correctly.
  • Changed parameters for internal function trace_get_payload_from_sll - it now sets both the arphrd type and the next protocol
  • Moved ARPHRD definitions into a separate header file, as they come in handy anywhere we deal with SLL headers
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/linktypes.c

    r1326d5f r9cc1266  
    4141#include <string.h>
    4242
    43 #ifndef WIN32
    44 #include <net/if_arp.h>
    45 #endif
    46 
    47 #ifndef ARPHRD_ETHER
    48 #define ARPHRD_ETHER    1               /* Ethernet 10/100Mbps.  */
    49 #endif
    50 
    51 #ifndef ARPHRD_EETHER
    52 #define ARPHRD_EETHER    2               /* Experimental Ethernet 10/100Mbps.  */
    53 #endif
    54 
    55 #ifndef ARPHRD_PPP
    56 #define ARPHRD_PPP      512
    57 #endif
    58 
    59 #ifndef ARPHRD_IEEE80211
    60 #define ARPHRD_IEEE80211        801
    61 #endif
    62 
    63 #ifndef ARPHRD_NONE
    64 #define ARPHRD_NONE     0xFFFE
    65 #endif
     43#include "arphrd.h"
    6644
    6745
     
    209187                case ARPHRD_80211_RADIOTAP: return TRACE_TYPE_80211_RADIO;
    210188                case ARPHRD_PPP: return TRACE_TYPE_NONE;
     189                case ARPHRD_LOOPBACK: return TRACE_TYPE_NONE;
    211190                case ARPHRD_NONE: return TRACE_TYPE_NONE;
    212191        }
     
    351330
    352331                        /* Invalidate caches */
    353                         packet->l3_header = NULL;
    354                         packet->capture_length = -1;
    355 
     332                        trace_clear_cache(packet);
    356333                        return true;
    357334
     
    377354
    378355                        /* Invalidate caches */
    379                         packet->l3_header = NULL;
    380                         packet->capture_length = -1;
     356                        trace_clear_cache(packet);
    381357                        break;
    382358                default:
     
    385361
    386362        /* Invalidate caches */
    387         packet->l3_header = NULL;
    388         packet->capture_length = -1;
     363        trace_clear_cache(packet);
    389364        return true;
    390365}
Note: See TracChangeset for help on using the changeset viewer.