@@ -235,6 +235,7 @@ fast_edit_packet_dl(struct pcap_pkthdr *pkthdr, u_char **pktdata,
235
235
* dst_ptr = htonl (dst_ip );
236
236
}
237
237
238
+ #if defined HAVE_QUICK_TX || defined HAVE_NETMAP
238
239
static inline void wake_send_queues (sendpacket_t * sp , tcpreplay_opt_t * options )
239
240
{
240
241
#ifdef HAVE_QUICK_TX
@@ -247,6 +248,7 @@ static inline void wake_send_queues(sendpacket_t *sp, tcpreplay_opt_t *options)
247
248
ioctl (sp -> handle .fd , NIOCTXSYNC , NULL ); /* flush TX buffer */
248
249
#endif
249
250
}
251
+ #endif /* HAVE_QUICK_TX || HAVE_NETMAP */
250
252
251
253
static inline void
252
254
fast_edit_packet (struct pcap_pkthdr * pkthdr , u_char * * pktdata ,
@@ -488,7 +490,7 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx)
488
490
COUNTER iteration = ctx -> iteration ;
489
491
bool unique_ip = options -> unique_ip ;
490
492
bool preload = options -> file_cache [idx ].cached ;
491
- bool top_speed = options -> speed .mode == speed_topspeed ;
493
+ bool top_speed = ( options -> speed .mode == speed_topspeed ) ;
492
494
bool now_is_now = false;
493
495
494
496
start_us = TIMEVAL_TO_MICROSEC (& ctx -> stats .start_time );
@@ -580,7 +582,7 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx)
580
582
* This also sets skip_length which will avoid timestamping for
581
583
* a given number of packets.
582
584
*/
583
- calc_sleep_time (ctx , ( struct timeval * ) & pkthdr .ts , & ctx -> stats .last_time , pktlen , sp , packetnum ,
585
+ calc_sleep_time (ctx , & pkthdr .ts , & ctx -> stats .last_time , pktlen , sp , packetnum ,
584
586
& ctx -> stats .end_time , & start_us , & skip_length );
585
587
586
588
/*
@@ -634,14 +636,12 @@ send_packets(tcpreplay_t *ctx, pcap_t *pcap, int idx)
634
636
}
635
637
}
636
638
637
- if (sp == ctx -> intf1 && ctx -> first_time_intf1 ) {
639
+ #if defined HAVE_QUICK_TX || defined HAVE_NETMAP
640
+ if (sp -> first_packet ) {
638
641
wake_send_queues (sp , options );
639
- ctx -> first_time_intf1 = 0 ;
640
- } else if (sp == ctx -> intf2 && ctx -> first_time_intf2 ) {
641
- wake_send_queues (sp , options );
642
- ctx -> first_time_intf2 = 0 ;
642
+ sp -> first_packet = false;
643
643
}
644
-
644
+ #endif
645
645
/* stop sending based on the duration limit... */
646
646
if ((end_us > 0 && TIMEVAL_TO_MICROSEC (& now ) > end_us ) ||
647
647
/* ... or stop sending based on the limit -L? */
@@ -699,8 +699,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *
699
699
COUNTER start_us ;
700
700
COUNTER end_us ;
701
701
COUNTER skip_length = 0 ;
702
- bool top_speed = options -> speed .mode == speed_topspeed ||
703
- (options -> speed .mode == speed_mbpsrate && !options -> speed .speed );
702
+ bool top_speed = (options -> speed .mode == speed_topspeed );
704
703
bool now_is_now = false;
705
704
706
705
start_us = TIMEVAL_TO_MICROSEC (& ctx -> stats .start_time );
@@ -824,7 +823,7 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *
824
823
* This also sets skip_length which will avoid timestamping for
825
824
* a given number of packets.
826
825
*/
827
- calc_sleep_time (ctx , ( struct timeval * ) & pkthdr_ptr -> ts , & ctx -> stats .last_time , pktlen , sp , packetnum ,
826
+ calc_sleep_time (ctx , & pkthdr_ptr -> ts , & ctx -> stats .last_time , pktlen , sp , packetnum ,
828
827
& ctx -> stats .end_time , & start_us , & skip_length );
829
828
830
829
/*
@@ -875,13 +874,12 @@ send_dual_packets(tcpreplay_t *ctx, pcap_t *pcap1, int cache_file_idx1, pcap_t *
875
874
}
876
875
}
877
876
878
- if (sp == ctx -> intf1 && ctx -> first_time_intf1 ) {
877
+ #if defined HAVE_QUICK_TX || defined HAVE_NETMAP
878
+ if (sp -> first_packet ) {
879
879
wake_send_queues (sp , options );
880
- ctx -> first_time_intf1 = 0 ;
881
- } else if (sp == ctx -> intf2 && ctx -> first_time_intf2 ) {
882
- wake_send_queues (sp , options );
883
- ctx -> first_time_intf2 = 0 ;
880
+ sp -> first_packet = false;
884
881
}
882
+ #endif
885
883
886
884
/* get the next packet for this file handle depending on which we last used */
887
885
if (sp == ctx -> intf2 ) {
@@ -1077,7 +1075,8 @@ static void calc_sleep_time(tcpreplay_t *ctx, struct timeval *pkt_time,
1077
1075
*/
1078
1076
if (options -> speed .mode == speed_packetrate && options -> speed .pps_multi ) {
1079
1077
ctx -> skip_packets = options -> speed .pps_multi - 1 ;
1080
- if (ctx -> first_time_intf1 ) {
1078
+ if (ctx -> first_time ) {
1079
+ ctx -> first_time = false;
1081
1080
return ;
1082
1081
}
1083
1082
}
0 commit comments