Commit Graph

35 Commits

Author SHA1 Message Date
Srivats P
c044880f1a Fix inaccurate low tx rates (~1000pps) in seq mode
Creation of explicit packet sets had both a packet set delay and a list loop
delay set leading to lower than configured rate at tx. Earlier implicit
packet set always had set delay as 0 and only list loop delay was used.

Fix is to always set list loop delay to 0 in sequential mode as packet set
will have the correct delay set due to explicit packet sets.
2023-06-22 10:47:13 +05:30
Srivats P
5ec7010c51 Fix contention for port streamStats across threads
Tx/Rx stream stats related threads no longer have a direct reference to the
port's stream stats - instead they have their own copy that they keep and
return (in a reset-on-read fashion) when asked for. Each copy also has it's
own lock to prevent contention for read/update/clear.

PcapPort now fetches Tx(Transmitter) and Rx(Poller) stats on demand and
updates the port's stream stats - under protection of a lock.
2023-06-17 11:31:48 +05:30
Srivats P
598e6bf243 Merge changes made in base code for turbo/latency 2023-06-15 12:32:20 +05:30
Srivats P
63ed64a9d2 Fix extra whitespace in latency feature added code 2023-05-26 11:31:52 +05:30
Srivats P
8ef9da062d Comment out L4Cksum code from pcap tx thread
We are not rewriting L4Cksum for ttag packets at the moment. See
comment in packetsequence.h

Commenting out this code doesn't seem to observably improve tx
performance though.

The latency code seems to reduce stream stats max tx performance
by around 3 to 5%. Recovering this may be done separately as part
of overall performance optimzation of Tx code.
2023-05-26 11:31:52 +05:30
Srivats P
bafdd948f8 Make win32 specific changes for per-stream latency
There are 2 changes -
1. Encode txPort in ttag packets and use it at TxTtagStats and
RxPcapStats to identify Tx and Rx packets respectively
2. Don't use pcap_sendqueue_transmit() if stream timing is in use -
since we can't modify TTAG packets inside that API
2023-05-26 11:31:52 +05:30
Srivats P
d375736a39 Don't use udiffTimeStamp() with struct timeval
It will fail to build for non-Linux platforms where TimeStamp is NOT timeval
2023-05-26 11:31:52 +05:30
Srivats P
976fc72de8 Retain seq as param for sendQueueTransmit for now
If and when we remove PacketSequence::ttagL4ChecksumOffset we will take a call
if we should revert back to passing seq->sendQueue instead of seq at that time
2023-05-26 11:31:52 +05:30
Srivats P
aebb609e37 Change algo to infer next Ttag pkt (interleaved mode)
The algo works for the following cases of interleaved streams -
 * pktListDuration < ttagTimeInterval
 * pktListDuration > ttagTimeInterval
 * some streams have Ttag, some don't
    - first stream has Ttag
    - first stream does NOT have Ttag
 * no streams have Ttag

Changes for sequential mode are pending
2023-05-26 11:31:52 +05:30
Srivats P
91a6efdeb7 Use qFrom/ToBigEndian instead of ntohs/htons
For consistency with rest of the code
2023-05-26 11:31:52 +05:30
Srivats P
bfdcee2baa Recompute L4 checksum on-the-fly for TTag packets 2023-05-26 11:31:52 +05:30
Srivats P
fd2fae711b Fix MacOS build break
For some reason udiffTimeStamp is not defined for MacOS. To be investigated
later.
2023-05-26 11:31:52 +05:30
Srivats P
2d998b3708 Add an incrementing tag id to T-Tag packets 2023-05-26 11:31:52 +05:30
Srivats P
f65aed7bb0 Add infra to update L4 checksum for T-Tag packets
Pending
 * Calculate L4 checksum offset instead of hardcoded value
 * Recalculate packet L4 checksum instead of using 0 value
2023-05-26 11:31:52 +05:30
Srivats P
fdf8c77350 Change T-Tag on the fly 2023-05-26 11:31:52 +05:30
Srivats P
429eff123d Don't create implicit packet sets for Tx
As part of Turbo changes, we made changes to create explicit packet
sets, but for the base code we continued creating implicit packet
sets for some cases. With this change we don't create any implicit
packet set.

This change needs to be tested thoroughly for multiple cases.
2023-05-26 11:31:52 +05:30
Srivats P
3c98900092 Reduce vertical whitespace in sendQueueTransmit() 2023-05-26 11:31:52 +05:30
Srivats P
46b148b62b Reformat TxThread/run {} to use less vertical space 2023-05-26 11:31:52 +05:30
Srivats P
f29d31d38a Update comments about implict packetset 2023-05-26 11:31:52 +05:30
Srivats P
c70811eaa4 Fix spurious stream stats drops
The problem happens for bidirectional flows. The sequence of events is
as follows when you start Tx on Ports p1, p2 with the current code -

1. Clear stream stats on p1
2. Start tx on p1
3. Clear stream stats on p2
4. Start tx on p2

By the time #3 is executed, it may have already rx packets from p1 which
are being incorrectly cleared, this will cause these number of packets
to show up as dropped instead - incorrectly.

The fix is to change the order like this -

1. Clear stream stats on p1
2. Clear stream stats on p2
3. Start tx on p1
4. Start tx on p2

Unidirectional flows will not see this problem - as long as startTx is
done only on the Tx port and not the Rx port.

This bug is a regression caused due to the code changes introduced for the
stream stats rates feature implemented in 1.2.0
2023-02-08 16:34:03 +05:30
Srivats P
701a058c7d Merge commit 'refs/subrepo/ostinato/fetch' into subrepo/ostinato
Update from master repo into turbo
2022-06-27 14:35:22 +05:30
Srivats P
843733567a Reoganize code using subrepo for Ostinato (part 2)
This commit includes all the new and modified files
2022-06-27 13:43:46 +05:30
Srivats P
fb879d2c72 Return txDuration as 0 for ports with no streams 2022-06-21 18:51:42 +05:30
Srivats P
329469dd6e Calculate port tx duration and send to controller
This commit only includes server side changes plus the .proto changes.

Client side UI changes are still pending.
2022-02-21 22:20:59 +05:30
Srivats P
f7ace4c5c2 Name threads for easier debugging 2020-05-15 18:55:03 +05:30
Srivats P
016694f1fe Use %ll instead of PRI since Windows dev env has been upgraded 2018-05-20 13:33:38 +05:30
Srivats P
35c56b9181 sign: Calculate stream stats only if configured
Stream Stats Rx and Tx both are calculated only if 'Track Stream Stats'
is configured on the port
2016-12-06 21:41:47 +05:30
Srivats P
de503d8d96 sign: Fix crash when doing TX on a streamless port
Ensure packetListSize_ is non zero to avoid division by zero. Also reset
packetListSize_ to 0 in the constructor - call clearPacketList() to do
this
2016-11-29 18:20:00 +05:30
Srivats P
b622cc8e72 sign: add #define and #include for PRIu64 2016-11-27 13:35:59 +05:30
Srivats P
4f8ee757b3 sign: print Tx stream stats related vars for debug 2016-11-27 12:35:33 +05:30
Srivats P
defdc218bd sign: fix the tx stream stats calculation and update associated test case 2016-11-15 22:23:55 +05:30
Srivats P
f8575ef101 sign: post tx stream stats collection; testing pending 2016-11-13 19:11:24 +05:30
Srivats P
afcb4126b5 sign: port stream tx stats are updated when TxThread finishes; actual Tx stream stats collection by TxThread is still pending 2016-11-11 21:22:07 +05:30
Srivats P
31c2cd2dcb sign: refactored tx stats into a new PcapTxStats class 2016-10-19 18:52:35 +05:30
Srivats P
12351d6304 sign: Refactored PortTransmitter into PcapTransmitter and PcapTxThread classes. Also broke out PacketSequence and Timestamp stuff into their own files. No change in functionality. 2016-09-13 19:05:24 +05:30