[ovs-dev] [PATCH] cfm: Update netdev when changed.

Justin Pettit jpettit at nicira.com
Mon Jun 3 21:34:36 UTC 2013


Looks good.

--Justin


On Jun 3, 2013, at 1:51 PM, Ethan Jackson <ethan at nicira.com> wrote:

> If ofproto decided to change the netdev of a particular ofport,
> cfm_demand mode would improperly continue using the old netdev to
> collect stats.
> 
> Bug #17583.
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
> ---
> lib/cfm.c              |   10 ++++++++++
> lib/cfm.h              |    1 +
> ofproto/ofproto-dpif.c |    4 ++++
> 3 files changed, 15 insertions(+)
> 
> diff --git a/lib/cfm.c b/lib/cfm.c
> index d16e2dd..4d4ebcb 100644
> --- a/lib/cfm.c
> +++ b/lib/cfm.c
> @@ -567,6 +567,16 @@ cfm_configure(struct cfm *cfm, const struct cfm_settings *s)
>     return true;
> }
> 
> +/* Must be called when the netdev owned by 'cfm' should change. */
> +void
> +cfm_set_netdev(struct cfm *cfm, const struct netdev *netdev)
> +{
> +    if (cfm->netdev != netdev) {
> +        netdev_close(cfm->netdev);
> +        cfm->netdev = netdev_ref(netdev);
> +    }
> +}
> +
> /* Returns true if 'cfm' should process packets from 'flow'. */
> bool
> cfm_should_process_flow(const struct cfm *cfm, const struct flow *flow)
> diff --git a/lib/cfm.h b/lib/cfm.h
> index eec9704..057da04 100644
> --- a/lib/cfm.h
> +++ b/lib/cfm.h
> @@ -71,6 +71,7 @@ bool cfm_should_send_ccm(struct cfm *);
> void cfm_compose_ccm(struct cfm *, struct ofpbuf *packet, uint8_t eth_src[6]);
> void cfm_wait(struct cfm *);
> bool cfm_configure(struct cfm *, const struct cfm_settings *);
> +void cfm_set_netdev(struct cfm *, const struct netdev *);
> bool cfm_should_process_flow(const struct cfm *cfm, const struct flow *);
> void cfm_process_heartbeat(struct cfm *, const struct ofpbuf *packet);
> int cfm_get_fault(const struct cfm *);
> diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
> index 7c3abec..13e2aad 100644
> --- a/ofproto/ofproto-dpif.c
> +++ b/ofproto/ofproto-dpif.c
> @@ -1904,6 +1904,10 @@ port_modified(struct ofport *port_)
>     if (port->bundle && port->bundle->bond) {
>         bond_slave_set_netdev(port->bundle->bond, port, port->up.netdev);
>     }
> +
> +    if (port->cfm) {
> +        cfm_set_netdev(port->cfm, port->up.netdev);
> +    }
> }
> 
> static void
> -- 
> 1.7.9.5
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev




More information about the dev mailing list