[ovs-dev] [bug4769 4/4] datapath: Get packet metadata from userspace in odp_packet_cmd_execute().

Ben Pfaff blp at nicira.com
Fri May 27 23:41:15 UTC 2011


On Wed, Mar 30, 2011 at 07:10:04PM -0700, Jesse Gross wrote:
> On Wed, Mar 2, 2011 at 2:31 PM, Ben Pfaff <blp at nicira.com> wrote:
> > diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
> > index 486ba48..daa260d 100644
> > --- a/lib/dpif-netdev.c
> > +++ b/lib/dpif-netdev.c
> > @@ -944,6 +944,7 @@ dpif_netdev_flow_dump_done(const struct dpif *dpif OVS_UNUSED, void *state_)
> >
> > ?static int
> > ?dpif_netdev_execute(struct dpif *dpif,
> > + ? ? ? ? ? ? ? ? ? ?const struct nlattr *k OVS_UNUSED, size_t k_len OVS_UNUSED,
> 
> We could use the key here, rather than having to parse the packet
> again.  There's no danger of flow definitions getting out of sync
> here.  It doesn't make much of a difference in practice but it seems a
> little cleaner.
> 
> > diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> > index aac9edd..6ba0030 100644
> > --- a/ofproto/ofproto.c
> > +++ b/ofproto/ofproto.c
> > @@ -1464,17 +1464,22 @@ ofproto_send_packet(struct ofproto *p, const struct flow *flow,
> > ? ? ? ? ? ? ? ? ? ? const union ofp_action *actions, size_t n_actions,
> > ? ? ? ? ? ? ? ? ? ? const struct ofpbuf *packet)
> > ?{
> > + ? ?struct ofpbuf key, *odp_actions;
> > + ? ?struct odputil_keybuf keybuf;
> > ? ? struct action_xlate_ctx ctx;
> > - ? ?struct ofpbuf *odp_actions;
> >
> > ? ? action_xlate_ctx_init(&ctx, p, flow, packet);
> > ? ? /* Always xlate packets originated in this function. */
> > ? ? ctx.check_special = false;
> > ? ? odp_actions = xlate_actions(&ctx, actions, n_actions);
> >
> > + ? ?ofpbuf_use_stack(&key, &keybuf, sizeof keybuf);
> > + ? ?odp_flow_key_from_flow(&key, flow);
> 
> It looks like this function and some other ones in ofproto will need
> to be updated but I trust you can do that without me looking at it
> again.
> 
> I was concerned about the implications of this on user/kernel flow
> mismatch and in some ways both tighter and looser coupling of the flow
> structure seemed preferable.  However, in the end both had serious
> problems, so I guess this is the best compromise.
> 
> Acked-by: Jesse Gross <jesse at nicira.com>

I rebased this against current "master" and re-sent it.



More information about the dev mailing list