- Timestamp:
- 10/02/15 16:07:24 (5 years ago)
- 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:
- 6cf2770
- Parents:
- 7fe6dfa
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dag25.c
r5478d3d r32a3ec5 54 54 #include <pthread.h> 55 55 56 57 #ifdef HAVE_DAG_CONFIG_API_H 58 #include <dag_config_api.h> 59 #endif 56 60 57 61 #ifdef WIN32 … … 549 553 } 550 554 555 #ifdef HAVE_DAG_CONFIG_API_H 556 static int dag_csapi_set_snaplen(libtrace_t *libtrace, int slen) { 557 dag_card_ref_t card_ref = NULL; 558 dag_component_t root = NULL; 559 attr_uuid_t uuid = 0; 560 561 if (slen < 0) 562 slen = 0; 563 564 card_ref = dag_config_init(FORMAT_DATA->device->dev_name); 565 root = dag_config_get_root_component(card_ref); 566 567 uuid = dag_component_get_config_attribute_uuid(root, kBooleanAttributeVarlen); 568 dag_config_set_boolean_attribute(card_ref, uuid, true); 569 570 uuid = dag_component_get_config_attribute_uuid(root, kUint32AttributeSnaplength); 571 dag_config_set_uint32_attribute(card_ref, uuid, (uint32_t)slen); 572 573 return 0; 574 575 576 } 577 #endif /* HAVE_DAG_CONFIG_API_H */ 578 551 579 /* Configures a DAG input trace */ 552 580 static int dag_config_input(libtrace_t *libtrace, trace_option_t option, 553 581 void *data) 554 582 { 555 char conf_str[4096];556 583 switch(option) { 557 584 case TRACE_OPTION_META_FREQ: … … 561 588 return 0; 562 589 case TRACE_OPTION_SNAPLEN: 590 #ifdef HAVE_DAG_CONFIG_API_H 591 return dag_csapi_set_snaplen(libtrace, *(int *)data); 592 #else 563 593 /* Tell the card our new snap length */ 594 { 595 char conf_str[4096]; 564 596 snprintf(conf_str, 4096, "varlen slen=%i", *(int *)data); 565 597 if (dag_configure(FORMAT_DATA->device->fd, … … 570 602 return -1; 571 603 } 604 } 605 #endif /* HAVE_DAG_CONFIG_API_H */ 606 572 607 return 0; 573 608 case TRACE_OPTION_PROMISC: … … 693 728 max_streams = dag_rx_get_stream_count(FORMAT_DATA->device->fd); 694 729 if (libtrace->perpkt_thread_count > max_streams) { 695 trace_set_err(libtrace, TRACE_ERR_BAD_FORMAT,730 fprintf(stderr, 696 731 "WARNING: DAG has only %u streams available, " 697 732 "capping total number of threads at this value.", … … 714 749 /* Ensure we haven't specified too many streams */ 715 750 if (stream_count >= libtrace->perpkt_thread_count) { 716 trace_set_err(libtrace, TRACE_ERR_BAD_FORMAT,751 fprintf(stderr, 717 752 "WARNING: Format uri specifies too many " 718 753 "streams. Maximum is %u, so only using " 719 754 "the first %u from the uri.", 720 max_streams); 755 libtrace->perpkt_thread_count, 756 libtrace->perpkt_thread_count); 721 757 break; 722 758 } … … 738 774 } 739 775 776 if (stream_count < libtrace->perpkt_thread_count) { 777 libtrace->perpkt_thread_count = stream_count; 778 } 779 740 780 FORMAT_DATA->stream_attached = 1; 741 781 … … 1492 1532 1493 1533 if (reader && t->type == THREAD_PERPKT) { 1494 fprintf(stderr, "t%u: registered reader thread", t->perpkt_num);1495 1534 node = libtrace_list_get_index(FORMAT_DATA->per_stream, 1496 1535 t->perpkt_num); 1497 1536 if (node == NULL) { 1498 trace_set_err(libtrace, TRACE_ERR_INIT_FAILED,1499 "Too few streams supplied for the"1500 " number of threads lanuched");1501 1537 return -1; 1502 1538 } … … 1507 1543 1508 1544 /* Attach and start the DAG stream */ 1509 printf("t%u: starting and attaching stream #%u\n",1510 t->perpkt_num, stream_data->dagstream);1511 1545 if (dag_start_input_stream(libtrace, stream_data) < 0) 1512 1546 return -1; 1513 1547 } 1514 1515 fprintf(stderr, "t%u: registered thread\n", t->perpkt_num);1516 1548 1517 1549 return 0; -
lib/trace_parallel.c
r10553bf r32a3ec5 625 625 626 626 if (trace->format->pregister_thread) { 627 trace->format->pregister_thread(trace, t, trace_is_parallel(trace)); 627 if (trace->format->pregister_thread(trace, t, 628 trace_is_parallel(trace)) < 0) { 629 thread_change_state(trace, t, THREAD_FINISHED, false); 630 pthread_exit(NULL); 631 } 628 632 } 629 633
Note: See TracChangeset
for help on using the changeset viewer.