Changeset e4f27d1
- Timestamp:
- 02/19/15 13:05:59 (6 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:
- 694823f
- Parents:
- 5ab626a
- Location:
- lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/format_linux_common.c
r5ab626a re4f27d1 221 221 close(stream->fd); 222 222 stream->fd = -1; 223 /* TODO maybe store size against stream XXX */224 223 if (stream->rx_ring != MAP_FAILED) 225 224 munmap(stream->rx_ring, 226 FORMAT_DATA->req.tp_block_size *227 FORMAT_DATA->req.tp_block_nr);225 stream->req.tp_block_size * 226 stream->req.tp_block_nr); 228 227 stream->rx_ring = MAP_FAILED; 229 228 FORMAT_DATA->dev_stats.if_name[0] = 0; … … 422 421 MSG_DONTWAIT) != -1) { count++; } 423 422 free(buf); 424 fprintf(stderr, "set offset %d", count);425 423 426 424 /* Mark that the stats are valid and apply an offset */ … … 493 491 libtrace_thread_t *t, 494 492 bool reading) { 495 fprintf(stderr, "registering thread %d!!\n", t->perpkt_num);496 493 if (reading) { 497 494 /* XXX TODO remove this oneday make sure hasher thread still works */ -
lib/format_linux_common.h
r5ab626a re4f27d1 216 216 /* Flag indicating whether the statistics are current or not */ 217 217 int stats_valid; 218 /* The current ring buffer layout */219 struct tpacket_req req;220 218 /* Used to determine buffer size for the ring buffer */ 221 219 uint32_t max_order; … … 257 255 /* Offset within the mapped buffer */ 258 256 int rxring_offset; 257 /* The ring buffer layout */ 258 struct tpacket_req req; 259 259 } ALIGN_STRUCT(CACHE_LINE_SIZE); 260 260 261 #define ZERO_LINUX_STREAM {-1, MAP_FAILED, 0 }261 #define ZERO_LINUX_STREAM {-1, MAP_FAILED, 0, {0}} 262 262 263 263 -
lib/format_linux_int.c
r5ab626a re4f27d1 132 132 133 133 } 134 135 134 136 135 #define LIBTRACE_MIN(a,b) ((a)<(b) ? (a) : (b)) … … 457 456 return trace_get_capture_length(packet); 458 457 } 459 460 461 462 463 458 464 459 #ifdef HAVE_NETPACKET_PACKET_H -
lib/format_linux_ring.c
r5ab626a re4f27d1 65 65 #ifdef HAVE_NETPACKET_PACKET_H 66 66 /* Get current frame in the ring buffer*/ 67 #define GET_CURRENT_BUFFER( libtrace,stream) \67 #define GET_CURRENT_BUFFER(stream) \ 68 68 ((void *)stream->rx_ring + \ 69 69 (stream->rxring_offset * \ 70 FORMAT_DATA->req.tp_frame_size))70 stream->req.tp_frame_size)) 71 71 #endif 72 72 … … 120 120 /* Calculate block size */ 121 121 req->tp_block_size = pagesize << max_order; 122 /* If max order is too high this might become 0 */ 123 if (req->tp_block_size == 0) { 124 calculate_buffers(req, fd, uri, max_order-1); 125 return; 126 } 122 127 do { 123 128 req->tp_block_size >>= 1; … … 178 183 */ 179 184 while(1) { 180 fprintf(stderr, "max_order=%d\n", *max_order);181 185 if (*max_order <= 0) { 182 186 strncpy(error, … … 202 206 } else break; 203 207 } 204 fprintf(stderr, "max_order=%d\n", *max_order);205 208 206 209 /* Map the ring buffer into userspace */ … … 260 263 if(socket_to_packetmmap(libtrace->uridata, PACKET_RX_RING, 261 264 stream->fd, 262 & FORMAT_DATA->req,265 &stream->req, 263 266 &stream->rx_ring, 264 267 &FORMAT_DATA->max_order, … … 468 471 469 472 /* Fetch the current frame */ 470 header = GET_CURRENT_BUFFER( libtrace,stream);473 header = GET_CURRENT_BUFFER(stream); 471 474 assert((((unsigned long) header) & (pagesize - 1)) == 0); 472 475 … … 534 537 /* Move to next buffer */ 535 538 stream->rxring_offset++; 536 stream->rxring_offset %= FORMAT_DATA->req.tp_frame_nr;539 stream->rxring_offset %= stream->req.tp_frame_nr; 537 540 538 541 /* We just need to get prepare_packet to set all our packet pointers … … 575 578 576 579 /* Fetch the current frame */ 577 header = GET_CURRENT_BUFFER( libtrace,FORMAT_DATA_FIRST);580 header = GET_CURRENT_BUFFER(FORMAT_DATA_FIRST); 578 581 if (header->tp_status & TP_STATUS_USER) { 579 582 /* We have a frame waiting */
Note: See TracChangeset
for help on using the changeset viewer.