Changeset d48008d for lib/trace.c


Ignore:
Timestamp:
05/16/10 21:34:48 (11 years ago)
Author:
Perry Lorier <perry@…>
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:
c3f597e
Parents:
9da93dc
Message:

Add JITting of BPF bytecode using LLVM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    rf6e8d46 rd48008d  
    11031103        filter->filter.bf_len = bf_len;
    11041104        filter->filterstring = NULL;
     1105        filter->jitfilter = NULL;
    11051106        /* "flag" indicates that the filter member is valid */
    11061107        filter->flag = 1;
     
    11191120                                malloc(sizeof(libtrace_filter_t));
    11201121        filter->filterstring = strdup(filterstring);
     1122        filter->jitfilter = NULL;
    11211123        filter->flag = 0;
    11221124        return filter;
     
    11331135        if (filter->flag)
    11341136                pcap_freecode(&filter->filter);
     1137#ifdef HAVE_LLVM
     1138        if (filter->jitfilter)
     1139                destroy_program(filter->jitfilter);
     1140#endif
    11351141        free(filter);
    11361142#else
     
    12571263        }
    12581264
     1265        /* If we're jitting, we may need to JIT the BPF code now too */
     1266#if HAVE_LLVM
     1267        if (!filter->jitfilter) {
     1268                filter->jitfilter = compile_program(filter->filter.bf_insns, filter->filter.bf_len);
     1269        }
     1270#endif
     1271
    12591272        assert(filter->flag);
     1273        /* Now execute the filter */
     1274#if HAVE_LLVM
     1275        ret=filter->jitfilter->bpf_run((unsigned char *)linkptr, clen);
     1276#else
    12601277        ret=bpf_filter(filter->filter.bf_insns,(u_char*)linkptr,(unsigned int)clen,(unsigned int)clen);
     1278#endif
    12611279
    12621280        /* If we copied the packet earlier, make sure that we free it */
Note: See TracChangeset for help on using the changeset viewer.