[ovs-dev] [patch_ports (rebased) 3/4] ofproto-dpif: Implement patch ports in userspace.

Ben Pfaff blp at nicira.com
Fri Jan 25 06:40:12 UTC 2013


On Fri, Jan 25, 2013 at 03:24:32PM +0900, YAMAMOTO Takashi wrote:
> > diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> > index 5c5d261..7732f49 100644
> > --- a/ofproto/ofproto-dpif.c
> > +++ b/ofproto/ofproto-dpif.c
> 
> > @@ -5224,6 +5292,29 @@ send_packet(const struct ofport_dpif *ofport, struct ofpbuf *packet)
> >      int error;
> >  
> >      flow_extract(packet, 0, 0, NULL, OFPP_LOCAL, &flow);
> > +    if (netdev_vport_is_patch(ofport->up.netdev)) {
> > +        struct ofproto_dpif *peer_ofproto;
> > +        struct dpif_flow_stats stats;
> > +        struct ofport_dpif *peer;
> > +        struct rule_dpif *rule;
> > +
> > +        peer = ofport_get_peer(ofport);
> > +        if (!peer) {
> > +            return ENODEV;
> > +        }
> > +
> > +        dpif_flow_stats_extract(&flow, packet, time_msec(), &stats);
> > +        netdev_vport_patch_inc_tx(ofport->up.netdev, &stats);
> > +        netdev_vport_patch_inc_rx(peer->up.netdev, &stats);
> > +
> > +        flow.in_port = peer->up.ofp_port;
> > +        peer_ofproto = ofproto_dpif_cast(peer->up.ofproto);
> > +        rule = rule_dpif_lookup(peer_ofproto, &flow);
> > +        rule_dpif_execute(rule, &flow, packet);
> > +
> > +        return 0;
> > +    }
> > +
> 
> this and similar changes in this file break !LINUX_DATAPATH builds,
> where netdev-vport won't be built.

Thanks for reporting that.

There's nothing Linux-specific about the patch port implementation any
longer, so I guess we should build at least the patch port part of
netdev-vport everywhere.



More information about the dev mailing list