- Timestamp:
- 11/25/16 10:13:11 (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:
- caf7841
- Parents:
- 571e2f9
- git-author:
- Richard Sanger <rsanger@…> (11/25/16 00:22:43)
- git-committer:
- Richard Sanger <rsanger@…> (11/25/16 10:13:11)
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_dpdk.c
ree6e802 rb148e3b 23 23 * 24 24 * 25 * /25 * 26 26 * Kit capture format. 27 27 * … … 69 69 * code (that we still attempt to support). 70 70 * 71 * DPDK v1.7.1is recommended.72 * However 1. 5 to 1.8 arelikely supported.71 * DPDK 16.04 or newer is recommended. 72 * However 1.6 and newer are still likely supported. 73 73 */ 74 74 #include <rte_eal.h> … … 145 145 #else 146 146 # define DPDK_USE_NULL_QUEUE_CONFIG 0 147 #endif 148 149 /* 2.0.0-rc1 150 * Unifies RSS hash between cards 151 */ 152 #if RTE_VERSION >= RTE_VERSION_NUM(2, 0, 0, 1) 153 # define RX_RSS_FLAGS (ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP | \ 154 ETH_RSS_SCTP) 155 #else 156 # define RX_RSS_FLAGS (ETH_RSS_IPV4_UDP | ETH_RSS_IPV6 | ETH_RSS_IPV4 | \ 157 ETH_RSS_IPV4_TCP | ETH_RSS_IPV6_TCP |\ 158 ETH_RSS_IPV6_UDP) 159 #endif 160 161 /* v16.07-rc1 - deprecated 162 * rte_mempool_avail_count to replace rte_mempool_count 163 * rte_mempool_in_use_count to replace rte_mempool_free_count 164 */ 165 #if RTE_VERSION < RTE_VERSION_NUM(16, 7, 0, 1) 166 #define rte_mempool_avail_count rte_mempool_count 167 #define rte_mempool_in_use_count rte_mempool_free_count 147 168 #endif 148 169 … … 170 191 #endif 171 192 193 /* 16.04-rc3 ETH_LINK_SPEED_X are replaced with ETH_SPEED_NUM_X. 194 * ETH_LINK_SPEED_ are reused as flags, ugly. 195 * We use the new way in this code. 196 */ 197 #ifndef ETH_SPEED_NUM_1G 198 #define ETH_SPEED_NUM_1G ETH_LINK_SPEED_1000 199 #define ETH_SPEED_NUM_10G ETH_LINK_SPEED_10G 200 #define ETH_SPEED_NUM_20G ETH_LINK_SPEED_20G 201 #define ETH_SPEED_NUM_40G ETH_LINK_SPEED_40G 202 #endif 172 203 173 204 /* The default size of memory buffers to use - This is the max size of standard … … 175 206 #define RX_MBUF_SIZE 1514 176 207 177 /* The minimum number of memory buffers per queue tx or rx. Search for 178 * _MIN_RING_DESC in DPDK. The largest minimum is 64 for 10GBit cards. 179 */ 180 #define MIN_NB_BUF 64 208 /* The minimum number of memory buffers per queue tx or rx. Based on 209 * the requirement of the memory pool with 128 per thread buffers, needing 210 * at least 128*1.5 = 192 buffers. Our code allocates 128*2 to be safe. 211 */ 212 #define MIN_NB_BUF 128 181 213 182 214 /* Number of receive memory buffers to use … … 185 217 * This can be increased in the driver and here. 186 218 * Should be at least MIN_NB_BUF. 187 */ 188 #define NB_RX_MBUF 4096 219 * We choose 2K rather than 4K because it enables the usage of sse vector 220 * drivers which are significantly faster than using the larger buffer. 221 */ 222 #define NB_RX_MBUF (4096/2) 189 223 190 224 /* Number of send memory buffers to use. … … 229 263 * 230 264 * Make sure you understand what these are doing before enabling them. 231 * They might make traces incompat able with other builds etc.265 * They might make traces incompatible with other builds etc. 232 266 * 233 267 * These are also included to show how to do somethings which aren't … … 236 270 237 271 /* Print verbose messages to stderr */ 238 #define DEBUG 0272 #define DEBUG 1 239 273 240 274 /* Use clock_gettime() for nanosecond resolution rather than gettimeofday() 241 275 * only turn on if you know clock_gettime is a vsyscall on your system 242 * o verwise could be a large overhead. Again gettimeofday() should be276 * otherwise could be a large overhead. Again gettimeofday() should be 243 277 * vsyscall also if it's not you should seriously consider updating your 244 278 * kernel. … … 297 331 int lcore; 298 332 #if HAS_HW_TIMESTAMPS_82580 299 /* Timestamping only relev ent to RX */333 /* Timestamping only relevant to RX */ 300 334 uint64_t ts_first_sys; /* Sytem timestamp of the first packet in nanoseconds */ 301 335 uint32_t wrap_count; /* Number of times the NIC clock has wrapped around completely */ … … 959 993 .rss_conf = { 960 994 // .rss_key = &rss_key, // We set this per format 961 .rss_hf = ETH_RSS_IPV4_UDP | ETH_RSS_IPV6 | ETH_RSS_IPV4 | ETH_RSS_IPV4_TCP | ETH_RSS_IPV6_TCP | ETH_RSS_IPV6_UDP,995 .rss_hf = RX_RSS_FLAGS, 962 996 }, 963 997 }, … … 1087 1121 int i; 1088 1122 struct rte_config *cfg = rte_eal_get_configuration(); 1123 (void) socket; 1089 1124 1090 1125 pthread_mutex_lock(&dpdk_lock); … … 1246 1281 fprintf(stderr, "DPDK memory pool not empty %d of %d, please " 1247 1282 "free all packets before finishing a trace\n", 1248 rte_mempool_ count(mempool), mempool->size);1283 rte_mempool_avail_count(mempool), mempool->size); 1249 1284 } 1250 1285 … … 1842 1877 retry_calc_wiretime: 1843 1878 switch (format_data->link_speed) { 1844 case ETH_ LINK_SPEED_40G:1845 wire_time /= ETH_ LINK_SPEED_40G;1879 case ETH_SPEED_NUM_40G: 1880 wire_time /= ETH_SPEED_NUM_40G; 1846 1881 break; 1847 case ETH_ LINK_SPEED_20G:1848 wire_time /= ETH_ LINK_SPEED_20G;1882 case ETH_SPEED_NUM_20G: 1883 wire_time /= ETH_SPEED_NUM_20G; 1849 1884 break; 1850 case ETH_ LINK_SPEED_10G:1851 wire_time /= ETH_ LINK_SPEED_10G;1885 case ETH_SPEED_NUM_10G: 1886 wire_time /= ETH_SPEED_NUM_10G; 1852 1887 break; 1853 case ETH_ LINK_SPEED_1000:1854 wire_time /= ETH_ LINK_SPEED_1000;1888 case ETH_SPEED_NUM_1G: 1889 wire_time /= ETH_SPEED_NUM_1G; 1855 1890 break; 1856 1891 case 0: … … 2194 2229 stats->captured = dev_stats.ipackets; 2195 2230 2196 /* Not that we support adding filters but if we did this2197 * would work */2198 stats->filtered += dev_stats.fdirmiss;2199 2200 2231 stats->dropped_valid = true; 2201 2232 stats->dropped = dev_stats.imissed; 2202 2233 2234 #if RTE_VERSION >= RTE_VERSION_NUM(16, 4, 0, 2) 2235 /* DPDK commit 86057c fixes ensures missed does not get counted as 2236 * errors */ 2237 stats->errors_valid = true; 2238 stats->errors = dev_stats.ierrors; 2239 #else 2203 2240 /* DPDK errors includes drops */ 2204 2241 stats->errors_valid = true; 2205 2242 stats->errors = dev_stats.ierrors - dev_stats.imissed; 2206 2243 #endif 2207 2244 stats->received_valid = true; 2208 2245 stats->received = dev_stats.ipackets + dev_stats.imissed; -
lib/libtrace.h.in
r0cdd231 rb148e3b 260 260 /** If the packet has allocated its own memory the buffer_control should be 261 261 * set to TRACE_CTRL_PACKET, so that the memory will be freed when the packet 262 * is destroyed. If the packet has been zero copied out of memory owned by262 * is destroyed. If the packet has been zero-copied out of memory owned by 263 263 * something else, e.g. a DAG card, it should be TRACE_CTRL_EXTERNAL. 264 264 * … … 282 282 /** Enumeration of error codes */ 283 283 enum { 284 /** No Error has occur ed.... yet. */284 /** No Error has occurred.... yet. */ 285 285 TRACE_ERR_NOERROR = 0, 286 286 /** The URI passed to trace_create() is unsupported, or badly formed */ … … 336 336 #endif 337 337 TRACE_DLT_PPP_SERIAL = 50, 338 TRACE_DLT_LINKTYPE_RAW = 101, /**< See TRACE_DLT_RAW for expla inations of pain. */338 TRACE_DLT_LINKTYPE_RAW = 101, /**< See TRACE_DLT_RAW for explanations of pain. */ 339 339 TRACE_DLT_C_HDLC = 104, 340 340 TRACE_DLT_IEEE802_11 = 105, … … 548 548 uint64_t hash; /**< A hash of the packet as supplied by the user */ 549 549 int error; /**< The error status of pread_packet */ 550 uint64_t internalid; /** Internal i ndentifier for the pkt */550 uint64_t internalid; /** Internal identifier for the pkt */ 551 551 void *srcbucket; 552 552 } libtrace_packet_t; … … 576 576 TRACE_RADIOTAP_LOCK_QUALITY = 7, /**< Barker Code lock quality (uint16) */ 577 577 TRACE_RADIOTAP_TX_ATTENUATION = 8, /**< TX attenuation as unitless distance from max power (uint16) */ 578 TRACE_RADIOTAP_DB_TX_ATTENUATION = 9, /**< TX attenu tation as dB from max power (uint16) */578 TRACE_RADIOTAP_DB_TX_ATTENUATION = 9, /**< TX attenuation as dB from max power (uint16) */ 579 579 TRACE_RADIOTAP_DBM_TX_POWER = 10, /**< TX Power in dBm (int8) */ 580 580 TRACE_RADIOTAP_ANTENNA = 11, /**< Antenna frame was rx'd or tx'd on (uint8) */ … … 1182 1182 * @param [out] format A pointer that will be updated to point to an allocated 1183 1183 * string holding the format component of the URI 1184 * @return NULL if an error occur ed, otherwise return a pointer to the uridata1184 * @return NULL if an error occurred, otherwise return a pointer to the uridata 1185 1185 * component 1186 1186 * … … 1207 1207 * - rt:hostname:port 1208 1208 * 1209 * If an error occur ed when attempting to open the trace file, a1209 * If an error occurred when attempting to open the trace file, a 1210 1210 * trace is still returned so trace_is_err() should be called to find out 1211 * if an error occur ed. The trace is created in the configuration state, you1211 * if an error occurred. The trace is created in the configuration state, you 1212 1212 * must call trace_start before attempting to read packets from the trace. 1213 1213 */ … … 1238 1238 * - pcap:/path/to/pcap/file 1239 1239 * 1240 * If an error occur ed when attempting to open the output trace, a trace is1240 * If an error occurred when attempting to open the output trace, a trace is 1241 1241 * still returned but trace_errno will be set. Use trace_is_err_out() and 1242 1242 * trace_perror_output() to get more information. … … 1377 1377 } trace_option_output_t; 1378 1378 1379 /* To add a new stat field update this list, and the relev ent places in1379 /* To add a new stat field update this list, and the relevant places in 1380 1380 * libtrace_stat_t structure. 1381 1381 */ … … 1430 1430 uint64_t filtered; 1431 1431 1432 /** The total number of good packets which have been rece vied. Including1432 /** The total number of good packets which have been received. Including 1433 1433 * those which are dropped and filtered. This does not include errors. 1434 1434 * … … 1610 1610 * Returns statistic counters for a trace, for a parallel trace this is a 1611 1611 * combined total. 1612 * Where possible these are retri ved atomically, however this behaviour depends1612 * Where possible these are retrieved atomically, however this behaviour depends 1613 1613 * on the underlying trace format. 1614 1614 * … … 1631 1631 /** 1632 1632 * Returns statistic counters for a single thread of a trace. 1633 * Where possible these are retri ved atomically, however this behaviour depends1633 * Where possible these are retrieved atomically, however this behaviour depends 1634 1634 * on the underlying trace format. 1635 1635 * 1636 1636 * @param trace The input trace to examine. 1637 * @param t An optional thread to received stats for or NULL to retri ve stats1637 * @param t An optional thread to received stats for or NULL to retrieve stats 1638 1638 * for the current thread 1639 1639 * @param stats Filled upon return with statistics about the trace, check the … … 1734 1734 * function should be avoided where possible. 1735 1735 * 1736 * @par The reason you would want to use this function is that a zero copied1736 * @par The reason you would want to use this function is that a zero-copied 1737 1737 * packet from a device will be stored using memory owned by the device which 1738 1738 * may be a limited resource. Copying the packet will ensure that the packet … … 2693 2693 * 2694 2694 * @note This function only works for OSPF version 2 packets. 2695 * @note trace_get_next_ospf_lsa_v2() should be sub equently used to process the LSAs2695 * @note trace_get_next_ospf_lsa_v2() should be subsequently used to process the LSAs 2696 2696 */ 2697 2697 DLLEXPORT SIMPLE_FUNCTION … … 2716 2716 * 2717 2717 * @note This function only works for OSPF version 2 packets. 2718 * @note trace_get_next_ospf_lsa_header_v2() should be sub equently used to process the LSA headers2718 * @note trace_get_next_ospf_lsa_header_v2() should be subsequently used to process the LSA headers 2719 2719 */ 2720 2720 DLLEXPORT SIMPLE_FUNCTION … … 2739 2739 * 2740 2740 * @note This function only works for OSPF version 2 packets. 2741 * @note trace_get_next_ospf_link_v2() should be sub equently used to process2741 * @note trace_get_next_ospf_link_v2() should be subsequently used to process 2742 2742 * the links 2743 2743 */ -
lib/trace_parallel.c
ree6e802 rb148e3b 1471 1471 libtrace->config.reporter_thold = 100; 1472 1472 if (libtrace->config.burst_size <= 0) 1473 libtrace->config.burst_size = 10;1473 libtrace->config.burst_size = 32; 1474 1474 if (libtrace->config.thread_cache_size <= 0) 1475 libtrace->config.thread_cache_size = 20;1475 libtrace->config.thread_cache_size = 64; 1476 1476 if (libtrace->config.cache_size <= 0) 1477 1477 libtrace->config.cache_size = (libtrace->config.hasher_queue_size + 1) * libtrace->perpkt_thread_count;
Note: See TracChangeset
for help on using the changeset viewer.