[P4-dev] What happens during table miss?

Antoine Kaufmann antoinek at cs.washington.edu
Mon Jul 20 20:10:01 EDT 2015


Unfortunately I don't know the switch implemented in p4factory in
detail. Depending on what you want to do, you could use p4c-behavioral
directly (that contains the part that generates C code from a P4 program
to execute the packet processing pipeline. The generated C code then has
functions you can call to hand it packets, and callbacks you need to set
for sending out packets. There are also functions to manage the table
entries. This gets fairly close to what you would have running on a
switch CPU for managing a switch chip.

If you are interested I have some code laying around for some simple
P4 examples that takes the p4c-behavioral output, attaches it to
ethernet devices using PCAP and adds some table entries on
initialization and in response to packets that the packet processing
pipeline forwards to "the CPU".

Hope this helps.

Cheers
Antoine

On Thu, Jul 16 19:02, Archie wrote:
> Thanks for the reply. I have one more question. In openflow, the packet
> specific rule, i.e. rules with values are installed in switches by the
> controller. From the example given here
> <https://github.com/p4lang/p4factory> under "Integration with Mininet" ,
> the way actual entries are added to the table is using commands like the
> following
> 
> python ../../cli/pd_cli.py -p simple_router -i p4_pd_rpc.simple_router -s
> $PWD/of-tests/pd_thrift:$PWD/../../submodules/oft-infra -m "add_entry
> send_frame 1 rewrite_mac 00:aa:bb:00:00:00" -c localhost:22222
> Is this the only way to put table entries? Or are there other ways to fill
> the table
> 
> Thanks again,
> Archie
> 
> On Wed, Jul 15, 2015 at 7:32 PM, Antoine Kaufmann <
> antoinek at cs.washington.edu> wrote:
> 
> >  [image: Boxbe] <https://www.boxbe.com/overview> Antoine Kaufmann (
> > antoinek at cs.washington.edu) added themselves to your Guest List
> > <https://www.boxbe.com/approved-list?tc_serial=21984698592&tc_rand=1956447171&utm_source=stf&utm_medium=email&utm_campaign=ANNO_TEST&utm_content=001&token=KoehR8YgfXD5NEHKSTVhZMnTzJkqy3Gol98B8KMsw2qEpQeNZ%2FQH6mkRnl1NQiay&key=jmIWxZTGsw6jU6dmbN%2BkMpxbWEffPerO%2BGhR5aTN9Qo%3D>
> > | Remove them
> > <https://www.boxbe.com/anno?action=remove&tc_serial=21984698592&tc_rand=1956447171&utm_source=stf&utm_medium=email&utm_campaign=ANNO_TEST&utm_content=001&token=KoehR8YgfXD5NEHKSTVhZMnTzJkqy3Gol98B8KMsw2qEpQeNZ%2FQH6mkRnl1NQiay&key=jmIWxZTGsw6jU6dmbN%2BkMpxbWEffPerO%2BGhR5aTN9Qo%3D>
> > | Block them
> > <https://www.boxbe.com/anno?action=add&disp=b&tc_serial=21984698592&tc_rand=1956447171&utm_source=stf&utm_medium=email&utm_campaign=ANNO_TEST&utm_content=001&token=KoehR8YgfXD5NEHKSTVhZMnTzJkqy3Gol98B8KMsw2qEpQeNZ%2FQH6mkRnl1NQiay&key=jmIWxZTGsw6jU6dmbN%2BkMpxbWEffPerO%2BGhR5aTN9Qo%3D>
> >
> > Hi Archie,
> >
> > what happens with a P4 switch on a table miss is entirely controlled by
> > the P4 program (plus runtime configuration). If the table has a default
> > action that was added at runtime from the CPU, then that action will be
> > executed. Regardless of whether there is a default action, you the
> > control program can also branch on whether the lookup hit and missed.
> >
> > If you want the open flow behavior, you can implement this in P4, by
> > either encapsulating and forwarding the packet to a remote controller,
> > or locally forwarding it to the CPU.
> >
> > I hope that helps!
> >
> > Cheers,
> > Antoine
> >
> > On Wed, Jul 15 18:41, Archie wrote:
> > > Hi,
> > >      I know in openflow, when a switch can't find a rule-match for a
> > > packet, it forwards the packet to the controller. Does the same thing
> > > happen in P4? Or is a table-miss handled in some other way in P4?
> > >
> > >
> > > Thanks,
> > > Archie
> >
> > --
> > Antoine Kaufmann
> > <antoinek at cs.washington.edu>
> >
> >

-- 
Antoine Kaufmann
<antoinek at cs.washington.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20150720/75dda3e2/attachment.asc>


More information about the P4-dev mailing list