[ovs-dev] [PATCH] cfm: Support tagged CCM PDUs.

Ben Pfaff blp at nicira.com
Thu Nov 3 16:02:20 UTC 2011


On Tue, Nov 01, 2011 at 12:20:11PM -0700, Ethan Jackson wrote:
> diff --git a/lib/cfm.c b/lib/cfm.c
> index 0d79bee..8ba399c 100644
> --- a/lib/cfm.c
> +++ b/lib/cfm.c
> @@ -93,6 +93,7 @@ struct cfm {
>      uint32_t seq;          /* The sequence number of our last CCM. */
>      uint8_t ccm_interval;  /* The CCM transmission interval. */
>      int ccm_interval_ms;   /* 'ccm_interval' in milliseconds. */
> +    uint16_t ccm_vlan;     /* Vlan tag of CCM PDUs. */
>      uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
>  
>      struct timer tx_timer;    /* Send CCM when expired. */
> @@ -345,8 +346,14 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
>      struct ccm *ccm;
>  
>      timer_set_duration(&cfm->tx_timer, cfm->ccm_interval_ms);
> -    ccm = eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM,
> -                      sizeof *ccm);
> +    packet->l3 = eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM,
> +                             sizeof *ccm);

I think that it would make sense for eth_compose() to set ->l2 and
->l3, and then we wouldn't have to do it here (which looked a little
funny to me at first glance).

> +    if (cfm->ccm_vlan) {
> +        eth_push_vlan(packet, htons(cfm->ccm_vlan));
> +    }
> +
> +    ccm = packet->l3;
>      ccm->mdlevel_version = 0;
>      ccm->opcode = CCM_OPCODE;
>      ccm->tlv_offset = 70;

Otherwise this looks fine, thanks.



More information about the dev mailing list