-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement l2fwd-like app #736
base: master
Are you sure you want to change the base?
Conversation
Neat :). I appreciate that you have made a simple solution for choosing between different I/O sources (tap, virtio, 10G) in Aside: I would really like to have a variant of our standard CI benchmark that uses this |
local input, output = assert(self.input.input), assert(self.output.output) | ||
|
||
while not link.empty(input) do | ||
link.transmit(output, link.receive(input)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DPDK L2FWD app actually does some processingon each packet. See here: http://dpdk.org/browse/dpdk/tree/examples/l2fwd/main.c#n239
The main idea is that if I send traffic with a destination MAC A and I don't change it in the L2FWD, then all possible switches between the sender and the L2FWD will get messed. Like if we use a VMDq port then the integrated switch will learn the MAC A on a ceratin port and won't forward the returned packet to the external port.
So what DPDK does is to replace each packet's destination MAC address with 02:00:00:00:00:xx
, where xx
is the number for the port it came from (DPDK actually assigns numbers to each port it recognizes). And then also changes the source with the MAC of the port it send it through. So it is more or less a real forwarding.
But SnabbSwitch is in an even better position since it actually has a real switching app - the learning bridge. I guess it is the most suitable in this situation.
@dpino Without having looked too closely, I am absolutely in love with the the idea that we could use this as an alternative to DPDK's |
config.app(c, "nic1", driver1, {pciaddr = pciaddr1}) | ||
config.app(c, "nic2", driver2, {pciaddr = pciaddr2}) | ||
|
||
config.link(c, "nic1.tx -> nic2.rx") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get also config.link(c, "nic2.tx -> nic1.rx")
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nnikolaev-virtualopensystems Am I right in assuming that would make l2fwd a two-way street?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, this makes it full featured 2-way "forwarder".
@Eugenia Sorry, I was a bit away lately. I will tackle these issues in the coming days and verify it works in the context of |
@dpino Hey, no rush at all. I am super supportive of taking it easy. |
* L2Fwd app is not necessary. * Drop support of tap interfaces (packetblaster can only blast packets to a PCI device).
I think this is working now. Here is how it works: Let's assume the following scheme: Host1 Host 2 L2Fwd creates a full-duplex softwire in Host2 between 01:00.0 and 01:00.1. Packetblaster blasts packets into Host 1 01:00.0 which eventually reach Host 2 01:00.0, because both cards are wired together. The packets are forwarded to Host 2 01:00.1 and transmitted. Finally the packets arrive to Host1 01:00.1 To make packets come back the other way, it's necessary to create a packet bouncer in Host 1 01:00.1. I added a new packetblaster mode called 'bounce' which takes only two PCI params, the NIC where to blast packets to and the NIC of the bouncer, which sends back any traffic it receives. With regard to mimic the MAC addresses scheme DPDK's l2fwd app uses, I didn't follow it as packets get through anyway. I think what's interesting of this app is to have a tool which can be a counterpart of packetblaster and can help verify NIC links are working. Example of use: Host 1
Host 2
I also tested the l2fwd app running within a guest using the virtionet driver. It works fine too. |
Apparently, I don't see any reason why CI failed cc @eugeneia |
- Remove reset() method in LoadGen. - Remove unnecessary prefix 'pci'.
Non-blocking questions:
|
function LoadGen:new (conf) | ||
local o = { pciaddr= conf.pciaddr, | ||
dev = intel10g.new_sf({pciaddr=conf.pciaddr}), | ||
report_rx = conf.report_rx, } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What exactly do the changes to LoadGen
do? Does the LoadGen
documentation need an update to reflect conf.report_rx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I modified LoadGen so it reports on received packets as well as transmitted packets. As traffic gets bounced to its originator and the NIC is locked by the program running the packetblaster, this was the only possible way I thought of of checking traffic gets actually bounced back.
I missed updating LoadGen docs, if the change finally makes it I will update the docs.
@eugeneia My understanding after reading http://dpdk.org/doc/guides/sample_app_ug/l2_forward_real_virtual.html is:
Host A actually needs two packet generators, an app that creates synthetic packets as the packetblaster does and something that will bounce traffic. Checking whether packets are being received in the packetblaster originator app tells traffic has gone all the way through the links. With regard to the packetblaster-bounce/l2fwd tandem, I agree with your comment. The point is that as the traffic generators run in a host independent of the host that has created the port forwarder, l2fwd/bounce cannot be on the same app. OTOH, packetblaster-bounce (NIC1 <-> NIC2) can be used to measure throughput of NIC2, received packets and egress link load towards NIC1. Currently it doesn't print those reports but that would be easy to fix. |
I would like other opinions on this as well. I have a very different picture of what |
@Eugenia Totally understand, I also want to hear other opinions. With regard to MAC addresses and swapping them, I forgot to mention that I obvious that part because it's not necessary. NICs when instantiated as SingleFunction, which is the case of packetblaster, work in promiscuous mode. |
As explained before once you have a HW switch between the l2fwd and the packet blaster then you need MAC swapping. I understand that this is not your use case, but that is what a forwarder should do - otherwise it is just a bridge, or softwire or something else but not L2FWD IMHO. |
@dpino Would the model I described cover your use case as well? |
@Eugenia I'm not a user of DPDK's l2fwd app so it's hard for me to tell how much of this app can replace it. If the use case you described is enough for ditching DPDK's l2fwd in favour of this app I can implement it that way. I see your description more like the bouncer mode I added to packetblaster, but I can put that functionality in its own app. It will be handy too for me to test a VirtioNet link. I think I will create a brand new PR. |
@dpino We use
Then we could benchmark/test any duplex “softwire” with |
@eugeneia I'm retaking this task. Your suggestion sounded good to me, however there's something I don't understand yet and it's how DPDK's l2fwd is currently being used. AFAIU, DPDK is only used in the packetblaster benchmark test. The test uses For testing purposes, I replaced qemu-dpdk.img in the packetblaster benchmark for config.link(c, NIC..".tx -> "..VM_rx)
config.link(c, VM_tx.." -> "..NIC..".rx") The packets are received on the NIC running packetblaster as both cards are wired together. Is this the reason why the packets in a VM are sent back to the host and traffic can be benchmarked? As for the qemu-dpdk.img scenario I understand the benchmark goes faster as DPDK skips the VM kernel, what I don't see is how DPDK or DPDK's l2fwd is run or who starts it :/ I grepped for "l2fwd" in the code base and I didn't find any results. OTOH, I see the source code of DPDK is in the /root folder, although I'm not sure if it's built as the |
I can't really tell you what the cryptic l2fwd invocation means though.^^ |
@eugeneia Thanks, I was missing that part :) |
It would be really great to have this app :) Right now we are landing changes to the virtio-net interface without the benefit of CI or benchmarking, at least in core; sub optimal! |
Basic implementation of l2fwd app (like DPDK's). This is how I understand it should work:
Given the following conf:
A packetblaster sends packets into 01:00.0.
l2fwd forwards packets received on 02:00.0 to 01:00.1.
Alternatively, a separate program could measure packets received on 02:00.1.