- Timestamp:
- 01/05/17 13:32:38 (4 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 2d4e055
- Parents:
- cff1819 (diff), 47c4490 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux_ring.c
r5e3f16c r47c4490 447 447 #ifdef HAVE_NETPACKET_PACKET_H 448 448 #define LIBTRACE_MIN(a,b) ((a)<(b) ? (a) : (b)) 449 /* We use TP_STATUS_LIBTRACE to ensure we don't loop back on ourself 450 * and read the same packet twice if an old packet has not yet been freed */ 451 #define TP_STATUS_LIBTRACE 0xFFFFFFFF 452 449 453 inline static int linuxring_read_stream(libtrace_t *libtrace, 450 454 libtrace_packet_t *packet, … … 470 474 * ready for consumption. 471 475 */ 472 while (!(header->tp_status & TP_STATUS_USER)) { 476 while (!(header->tp_status & TP_STATUS_USER) || 477 header->tp_status == TP_STATUS_LIBTRACE) { 478 if ((ret=is_halted(libtrace)) != -1) 479 return ret; 473 480 pollset[0].fd = stream->fd; 474 481 pollset[0].events = POLLIN; … … 509 516 } 510 517 } else { 511 /* Poll timed out - check if we should exit */ 512 if ((ret=is_halted(libtrace)) != -1) 513 return ret; 518 /* Poll timed out - check if we should exit on next loop */ 514 519 continue; 515 520 } … … 518 523 packet->buffer = header; 519 524 packet->trace = libtrace; 525 header->tp_status = TP_STATUS_LIBTRACE; 520 526 521 527 /* If a snaplen was configured, automatically truncate the packet to … … 574 580 /* Fetch the current frame */ 575 581 header = GET_CURRENT_BUFFER(FORMAT_DATA_FIRST); 576 if (header->tp_status & TP_STATUS_USER) { 582 if (header->tp_status & TP_STATUS_USER && 583 header->tp_status != TP_STATUS_LIBTRACE) { 577 584 /* We have a frame waiting */ 578 585 event.size = trace_read_packet(libtrace, packet); -
lib/trace.c
r5e3f16c radb2c4c 550 550 551 551 /* Finish the last packet we read - for backwards compatibility */ 552 if ( libtrace->last_packet)552 if (!libtrace_parallel && libtrace->last_packet) 553 553 trace_fin_packet(libtrace->last_packet); 554 554 assert(libtrace->last_packet == NULL); … … 697 697 698 698 /* Finish any the last packet we read - for backwards compatibility */ 699 if ( libtrace->last_packet) {699 if (!libtrace_parallel && libtrace->last_packet) { 700 700 trace_fin_packet(libtrace->last_packet); 701 701 } … … 837 837 packet->trace->format->fin_packet(packet); 838 838 } 839 if (packet->trace && packet->trace->last_packet == packet) 839 if (!libtrace_parallel && packet->trace && 840 packet->trace->last_packet == packet) { 840 841 packet->trace->last_packet = NULL; 842 } 841 843 842 844 if (packet->buf_control == TRACE_CTRL_PACKET && packet->buffer) { … … 868 870 869 871 if (packet->trace) { 870 pthread_mutex_lock(&packet->trace->libtrace_lock); 871 if (packet->trace->last_packet == packet) 872 packet->trace->last_packet = NULL; 873 pthread_mutex_unlock(&packet->trace->libtrace_lock); 872 if (!libtrace_parallel && packet->trace->last_packet == packet) 873 packet->trace->last_packet = NULL; 874 874 } 875 875 … … 960 960 ++libtrace->accepted_packets; 961 961 ++libtrace->sequence_number; 962 if ( packet->trace == libtrace)962 if (!libtrace_parallel && packet->trace == libtrace) 963 963 libtrace->last_packet = packet; 964 964 … … 1003 1003 1004 1004 packet->trace = trace; 1005 pthread_mutex_lock(&trace->libtrace_lock); 1006 trace->last_packet = packet; 1007 pthread_mutex_unlock(&trace->libtrace_lock); 1005 if (!libtrace_parallel) 1006 trace->last_packet = packet; 1008 1007 /* Clear packet cache */ 1009 1008 trace_clear_cache(packet); -
lib/trace_parallel.c
r5e3f16c r47c4490 1733 1733 if (libtrace->perpkt_thread_count > 1) 1734 1734 libtrace->pread = trace_pread_packet_first_in_first_served; 1735 /* Don't wait for a burst of packets if the format is 1736 * live as this could block ring based formats and 1737 * introduces delay. */ 1738 if (libtrace->format->info.live) { 1739 libtrace->config.burst_size = 1; 1740 } 1735 1741 else 1736 1742 /* Use standard read_packet */
Note: See TracChangeset
for help on using the changeset viewer.