[P4-dev] Binding interfaces to bmv2

David Hancock dhancock at cs.utah.edu
Sat Sep 15 20:03:25 EDT 2018


Phenomenal, thanks!

--David


On 09/15/2018 07:10 PM, Vladimir Gurevich wrote:
> Hello David,
>
> Since it looks like the basic interface setup, there are some other 
> rules that you need to follow in order to be able to use an arbitrary 
> interface successfully:
>
>  1. The interface should not have any IP addresses configured on it.
>     This prevents the interface from "being taken care of" by the
>     corresponding IP stacks (IPv4 or IPv6) and thus not only prevents
>     routing, but also prevents Linux stack from responding to ARP
>     packets and sending unsolicited ICMPv4 Router Advertisement
>     packets to name a few
>  2. All HW acceleration should be disable on the interface, otherwise,
>     the packets received by the model will not generally be the same
>     as sent from the outside and vice versa. Failure to disable HW
>     acceleration leads to very subtle errors, like inability to
>     forward TCP traffic at high rates (vs. very low rates), etc.
>
> To help you and others, I am attaching a basic script, iface_setup.sh 
> that should take care of all these requirements.
>
> Basic usage:
>
>     sudo ./iface_setup.sh eth0 [eth1 .... ]
>
>
> You can use this script with any interfaces that already exist on your 
> system (including veths, physical ethernet ports, dummy interfaces, 
> etc.). Note: you might need to adjust MTU value on line since not all 
> physical interfaces support 10K value, specified in the script.
>
> Happy hacking,
> Vladimir
>
> *Vladimir Gurevich*
> *
> *
> *Barefoot Networks*
> *Technical Lead, Customer Engineering*
> Email: vag at barefootnetworks.com <mailto:vag at barefootnetworks.com>
> Phone: (408) 833-4505
>
>
>
> On Sat, Sep 15, 2018 at 11:41 AM David Hancock <dhancock at cs.utah.edu 
> <mailto:dhancock at cs.utah.edu>> wrote:
>
>     Thanks both.  Packets now flow/don't flow as expected:
>
>     - I disabled Linux forwarding
>
>     - I ran simple_switch as root (previously, I did not run as root)
>
>     - I matched the port numbers between 1) the ports identified by
>     '-i' option when starting simple_switch and 2) ports used in bmv2
>     runtime table commands (in my mininet setup, these had always been
>     off by one).
>
>     I suspect the mininet issue may be unique to my own anomalous
>     setup, but perhaps disabling forwarding and running as root
>     warrant a mention on the behavioral-model README.  In any case,
>     I'm good for now, and appreciate your help.
>
>     --David
>
>
>     On 09/15/2018 11:47 AM, Antonin Bas wrote:
>>     Also make sure that Linux forwarding is disabled
>>     (net.ipv4.ip_forward), otherwise traffic will be forwarded by
>>     Linux anyway.
>>
>>     On Sat, Sep 15, 2018 at 7:43 AM, Vladimir Gurevich via P4-dev
>>     <p4-dev at lists.p4.org <mailto:p4-dev at lists.p4.org>> wrote:
>>
>>         Hello David,
>>
>>         BMv2 implements P4 spec "to the t", meaning that it
>>         initializes all metadata to 0 and that includes
>>         standard_metadata.egress_spec. Therefore, a program that does
>>         "nothing" in reality will unconditionally send all the
>>         packets to port 0.
>>
>>         Happy hacking,
>>         Vladimir
>>
>>         *Vladimir Gurevich*
>>         *
>>         *
>>         *Barefoot Networks*
>>         *Technical Lead, Customer Engineering*
>>         Email: vag at barefootnetworks.com <mailto:vag at barefootnetworks.com>
>>         Phone: (408) 833-4505
>>
>>
>>
>>         On Fri, Sep 14, 2018 at 6:04 PM David Hancock
>>         <dhancock at cs.utah.edu <mailto:dhancock at cs.utah.edu>> wrote:
>>
>>             Hello,
>>
>>             I'm trying to use bmv2 in a physical cluster (previously
>>             I've always used mininet).  I'm trying to bind the
>>             interfaces of a node to bmv2 and run a do-nothing P4
>>             program on bmv2.  I expect that packets should not flow
>>             through this node once I have done this.  But packets
>>             still flow, suggesting that bmv2 is not handling the
>>             packets.  I have confirmed with traceroute that the
>>             packets are traversing the interfaces that should be
>>             bound to bmv2.
>>
>>             I start simple_switch as follows:
>>
>>                 ./simple_switch -i 0@<iface 1> -i 1@<iface 2> -i
>>                 2@<iface 3> <path to .json>
>>
>>             The result:
>>
>>                 Thrift port was not specified, will use 9090
>>                 Calling target program-options parser
>>                 Adding interface <iface 1> as port 0
>>                 Adding interface <iface 2> as port 1
>>                 Adding interface <iface 3> as port 2
>>                 Thrift server was started
>>
>>             I can connect to the CLI.
>>
>>             Am I missing something obvious?
>>
>>             Thanks,
>>
>>             David
>>
>>             _______________________________________________
>>             P4-dev mailing list
>>             P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>>             http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>>
>>         _______________________________________________
>>         P4-dev mailing list
>>         P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>>         http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>
>>
>>
>>
>>     -- 
>>     Antonin
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20180915/919e7744/attachment.html>


More information about the P4-dev mailing list