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

YAMAMOTO Takashi yamamoto at valinux.co.jp
Fri Jan 25 06:24:32 UTC 2013


hi,

> 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.

YAMAMOTO Takashi



More information about the dev mailing list