On Fri, May 09, 2014 at 11:12:44PM +0200, Christian Stigen Larsen wrote:
> I'm trying to add a new OpenFlow action to Open vSwitch.
> 
> So far, I'm able to install it using ovs-ofctl. It's clearly in the
> flow-table and my entry function is called from do_xlate_actions in
> ofproto-dpif-xlate.c.
> 
> However, I'm confused if this is the correct place for actually *executing*
> the action.  I can see that this code is called twice, and even though the
> stuff under ctx->xin looks good (I can see the correct Ethernet type,
> addresses, etc.), ctx->xin->packet is set to NULL on both calls.
> 
> What I'm trying to do is to build a really simple non-IP protocol.  I match
> on a specific Ethernet type, and I want to extract some data from the packet
> (just two numbers).
> 
> I've been searching for similar work on the net, but as I haven't struck
> gold yet I thought I'd just ask instead.
> 
> Is do_xlate_actions ("translate actions"?) the wrong place for this kind of
> stuff?  How can I get a pointer to the raw packet data?

Usually, ofproto-dpif-xlate should not actually implement the OpenFlow
actions.  Rather, it should output a set of datapath (kernel) actions
that implement the OpenFlow actions.  Otherwise, every packet in the
flow has to go from the kernel to userspace, which is slow.

If you do want to actually implement your actions during translation,
then you can do it, but you have to mark the flow as "slow".  There are
a few uses of this mechanism already, so look around for examples.
_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to