[P4-dev] bmv2 with physical interfaces.

Vladimir Gurevich vladimir.gurevich at barefootnetworks.com
Tue Jul 4 19:02:20 EDT 2017

Hello Andreas,

The basic, most fundamental fact is that by default BMv2 uses libpcap to
send/receive packets and that library accesses the interfaces using the raw
(PF_PACKET) sockets. So, it has full control over the whole contents of a
packet (except Ethernet CRC) and, indeed, sends the whole packet (starting
with the destination MAC address) directly to the driver.

Having said that, there are a lot of components even in a simple test and
if you haven't set you environment properly, Linux might try to "outsmart"
you. Since you haven't provided any additional information, I can give you
only some very general advice:

   1. Start by making sure that all acceleration/offload is disabled on all
   the interfaces you are connecting BMv2 to. I sent an email about it a day
   2. Enable logging on BMv2 (it is enabled by default) and also start it
   with "--log-console --dump-packet-data 64" (or some other number) so that
   you could see at least the first 64 bytes of ingress and egress packets in
   BMv2 logs. This alone should allow you to see where the problem might be
   3. Make sure you understand the P4 program that you are using and the
   control plane. Obviously, a simple program that you control yourself can't
   substitute the ethernet address of your system, but if you are running a
   complex mininet configuration with switch.p4/switchAPI/switchSAI/switchLINK
   on top, then it's a totally different story.
   4. Make sure you also understand how you capture the packets to make
   sure your capturing setup and capturing tool actually use raw sockets too
   (Wireshark/tcpdump) normally do

I think this should allow you to debug the issue. Most probably you'll
figure it all out between steps 2 and 3.

Happy Hacking,

On Tue, Jul 4, 2017 at 11:57 AM, Andreas Pantelopoulos <
padelopoulos at gmail.com> wrote:

> Hello to all,
> I have seen in a previous email of the mailing list that bmv2 supports
> physical interfaces. I tried it and this is indeed true.
> However, when I forward a packet through a physical interface, that is a
> switch port, the source MAC address in the Ethernet header is changed to
> that of the interface. I think this is normal Linux behavior.
> Has anyone found a workaround this? If the host is to behave like a
> switch, then this address need to be the same as in the original packet.
> Thanks,
> Andreas Pantelopoulos
> _______________________________________________
> P4-dev mailing list
> P4-dev at lists.p4.org
> http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org

*Vladimir Gurevich*

*Barefoot Networks*
*Technical Lead, Customer Engineering*
Email: vag at barefootnetworks.com
Phone: (408) 833-4505
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20170704/84b20a21/attachment-0002.html>

More information about the P4-dev mailing list