tbarbette / fastclick

FastClick - A faster version of the Click Modular Router featuring batching, advanced multi-processing and improved Netmap and DPDK support (ANCS'15). Check the metron branch for Metron specificities (NSDI'18). PacketMill modifications (ASPLOS'21) as well as MiddleClick(ToN, 2021) are merged in main.
Other
279 stars 81 forks source link

How to use replayUnqueue or MultiReplayUnqueue to limit the tx rate? #367

Closed Emikoer closed 2 years ago

Emikoer commented 2 years ago

I use the example under conf/pktgen/pktgen-l2.click to generate packets, but I don't know how to use replayUnqueue or MultiReplayUnqueue to limit the tx rate. FastUDPSouce(RATE 0,LIMIT $N, LENGTH $L, SRCETH $mymac,SRCIP $myip,SPORT 8000, DSTETH $dmac, DSTIP $dstip, DPORT 8000) -> MarkMACHeader -> EnsureDPDKBuffer -> replay :: MultiReplayUnqueue(STOP -1, ACTIVE false, QUICK_CLONE 1) -> ic0 :: AverageCounter() -> td :: ToDPDKDevice(0000:04:00.1, BLOCKING $blocking, VERBOSE $verbose)

tbarbette commented 2 years ago

ReplayUnqueue can only act on the original timing of the packets. It was built to use with a real packet trace, read using FromPcap.

The easiest solution is to create a trace that has the timing you want, and then you set TIMING 100 in the ReplayUnqueue. Timing is an acceleration percentage exprimed in percent.

FastUDPSouce does not create timestamps so it cannot be used with ReplayUnqueue.

If you're not looking for very high speeds, you might use RatedUnqueue() or BandwidthRatedUnqueue instead of ReplayUnqueue ?

Another alternative is to set a fake timestamp in FastUDPSouce :

Note: MultiReplay is to replay packets to multiple ports at the same time (like a TX side and an RX side towards a router, and replay two pcaps with the correct timings). In general it is accepted in system research to replay a mix at once.

tbarbette commented 2 years ago

Another way to go would be to modify ReplayUnqueue to use some kind of fake rate instead of the packet timestamp, around https://github.com/tbarbette/fastclick/blob/f99c521dd46341394a1343dccc043f3625360435/elements/analysis/replay.cc#L328

Emikoer commented 2 years ago

Thanks for your answer! I tried to use BandwidthRatedUnqueue and it succeed.