Changeset c66a465 for lib/format_dag25.c


Ignore:
Timestamp:
11/20/14 16:28:54 (7 years ago)
Author:
Dan <dan@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
21f5f0f
Parents:
9149564
Message:

Added support for drop count in DAG format.

This does not support DSM, as there are some issues with the DAG card for that.
Someone decided that when ERF packets are DSM coloured that the drop counter should
disappear..!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dag25.c

    r9149564 rc66a465  
    125125        uint32_t processed; /* Amount of data processed from the bottom pointer */
    126126        uint64_t pkt_count; /* Number of packets seen by the thread */
     127        uint64_t drops;
    127128};
    128129
     
    817818
    818819        dag_record_t *erfptr;
     820        libtrace_thread_t *t;
    819821       
    820822        /* If the packet previously owned a buffer that is not the buffer
     
    852854        }
    853855
    854         /* TODO: This isn't thread safe */
    855 #if 0
    856856        /* Update the dropped packets counter */
    857 
    858857        /* No loss counter for DSM coloured records - have to use
    859858         * some other API */
     859        /* Adding multithread support for this isn't actually that useful for the
     860         * DAG7.5G2, as there's no way to use multiple receive streams without DSM */
    860861        if (erfptr->type == TYPE_DSM_COLOR_ETH) {
    861862                /* TODO */
    862863        } else {
    863864                /* Use the ERF loss counter */
    864                 DATA(libtrace)->drops += ntohs(erfptr->lctr);
    865         }
    866 #endif
     865                if (DATA(libtrace)->per_thread) {
     866                        t = get_thread_table(libtrace);
     867                        PERPKT_DATA(t)->drops += ntohs(erfptr->lctr);
     868                } else {
     869                        printf("DROP!\n");
     870                        DATA(libtrace)->drops += ntohs(erfptr->lctr);
     871                }
     872        }
     873
    867874
    868875        return 0;
     
    12191226/* Gets the number of dropped packets */
    12201227static uint64_t dag_get_dropped_packets(libtrace_t *trace) {
     1228        uint64_t sum = 0;
     1229        int i, tot;
     1230
    12211231        if (trace->format_data == NULL)
    12221232                return (uint64_t)-1;
    1223         return DATA(trace)->drops;
     1233
     1234        if (DATA(trace)->per_thread) {
     1235                tot = trace->perpkt_thread_count;
     1236
     1237                for (i = 0; i < tot; i++) {
     1238                        printf("t%d: drops %" PRIu64 "\n",
     1239                                   DATA(trace)->per_thread[i].drops);
     1240                        sum += DATA(trace)->per_thread[i].drops;
     1241                }
     1242        }
     1243
     1244        sum += DATA(trace)->drops;
     1245
     1246        return sum;
    12241247}
    12251248
     
    15221545                        PERPKT_DATA(t)->bottom = NULL;
    15231546                        PERPKT_DATA(t)->pkt_count = 0;
     1547                        PERPKT_DATA(t)->drops = 0;
    15241548                } else {
    15251549                        /* TODO: Figure out why we need this */
Note: See TracChangeset for help on using the changeset viewer.