Changeset 5798dc6


Ignore:
Timestamp:
09/05/07 10:18:58 (14 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:
9c6005f
Parents:
52656ed
Message:
  • Changed DAG 2.5 code to force it to call dag_advance_stream if it has read 4MB without doing so. This is to ensure that the processed records get freed regularly.
  • Changed a couple of internal functions in format_dag24 to be static, which fixes some warnings
  • Changed the wording of the configure message that checks for DAG2.4 after failing to find DAG 2.5 or later to make it obvious that we aren't trying to do the same thing twice (and getting inconsistent results!)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    r52656ed r5798dc6  
    202202# Now check for 2.4 DAG drivers which don't install as cleanly!
    203203if test "$with_dag" != no -a "$libtrace_dag" = false; then
    204         AC_MSG_CHECKING(whether we have DAG 2.4 API)
     204        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
    205205
    206206        if test -r "$dag_root/lib"; then
  • lib/format_dag24.c

    r708f9ae r5798dc6  
    222222
    223223
    224 dag_record_t *dag_get_record(libtrace_t *libtrace) {
     224static dag_record_t *dag_get_record(libtrace_t *libtrace) {
    225225        dag_record_t *erfptr = NULL;
    226226        uint16_t size;
     
    237237}
    238238
    239 void dag_form_packet(dag_record_t *erfptr, libtrace_packet_t *packet) {
     239static void dag_form_packet(dag_record_t *erfptr, libtrace_packet_t *packet) {
    240240        packet->buffer = erfptr;
    241241        packet->header = erfptr;
  • lib/format_dag25.c

    r52656ed r5798dc6  
    7878        uint8_t *bottom;
    7979        uint8_t *top;
     80        uint32_t processed;
    8081};
    8182
     
    177178                bottom -= diff;
    178179        } while (diff != 0);
    179 
     180        FORMAT_DATA->top = NULL;
     181        FORMAT_DATA->bottom = NULL;
     182        FORMAT_DATA->processed = 0;
     183       
    180184        return 0;
    181185}
     
    239243static int dag_available(libtrace_t *libtrace) {
    240244        uint32_t diff = FORMAT_DATA->top - FORMAT_DATA->bottom;
    241         if (diff >= dag_record_size)
     245        /* If we've processed more than 4MB of data since we last called
     246         * dag_advance_stream, then we should call it again to allow the
     247         * space occupied by that 4MB to be released */
     248        if (diff >= dag_record_size && FORMAT_DATA->processed < 4 * 1024 * 1024)
    242249                return diff;
    243250        FORMAT_DATA->top = dag_advance_stream(FORMAT_DATA->fd,
     
    248255                return -1;
    249256        }
     257        FORMAT_DATA->processed = 0;
    250258        diff = FORMAT_DATA->top - FORMAT_DATA->bottom;
    251259        return diff;
     
    264272                return NULL;
    265273        FORMAT_DATA->bottom += size;
     274        FORMAT_DATA->processed += size;
    266275        return erfptr;
    267276}
Note: See TracChangeset for help on using the changeset viewer.