cfm: Support high priority CCM broadcasts.
authorEthan Jackson <ethan@nicira.com>
Thu, 2 Feb 2012 23:48:13 +0000 (15:48 -0800)
committerEthan Jackson <ethan@nicira.com>
Fri, 3 Feb 2012 03:45:40 +0000 (19:45 -0800)
Bug #9015.
Signed-off-by: Ethan Jackson <ethan@nicira.com>
NEWS
lib/cfm.c
lib/cfm.h
vswitchd/bridge.c
vswitchd/vswitch.xml

diff --git a/NEWS b/NEWS
index 8b39b82ed738f54d0946785c650fd84f3c2ff72b..193cf1c3ae4621cefc6521b2464c9d808ccf3406 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ post-v1.5.0
     - ovsdb-client:
         - The new option --timestamp causes the "monitor" command to print
           a timestamp with every update.
+    - CFM module CCM broadcasts can now be tagged with an 802.1p priority.
 
 
 v1.5.0 - xx xxx xxxx
index d62d4e209c55eafff45a6bd8baf496fa6739d3ba..537eeaa11ed1c066f09eb3ef1e294cb7d07d1fd3 100644 (file)
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -97,6 +97,7 @@ struct cfm {
     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 ccm_pcp;       /* Priority of CCM PDUs. */
     uint8_t maid[CCM_MAID_LEN]; /* The MAID of this CFM. */
 
     struct timer tx_timer;    /* Send CCM when expired. */
@@ -361,8 +362,9 @@ cfm_compose_ccm(struct cfm *cfm, struct ofpbuf *packet,
     timer_set_duration(&cfm->tx_timer, cfm->ccm_interval_ms);
     eth_compose(packet, cfm_ccm_addr(cfm), eth_src, ETH_TYPE_CFM, sizeof *ccm);
 
-    if (cfm->ccm_vlan) {
-        eth_push_vlan(packet, htons(cfm->ccm_vlan));
+    if (cfm->ccm_vlan || cfm->ccm_pcp) {
+        uint16_t tci = cfm->ccm_vlan | (cfm->ccm_pcp << VLAN_PCP_SHIFT);
+        eth_push_vlan(packet, htons(tci));
     }
 
     ccm = packet->l3;
@@ -420,6 +422,7 @@ cfm_configure(struct cfm *cfm, const struct cfm_settings *s)
     interval_ms = ccm_interval_to_ms(interval);
 
     cfm->ccm_vlan = s->ccm_vlan & VLAN_VID_MASK;
+    cfm->ccm_pcp = s->ccm_pcp & (VLAN_PCP_MASK >> VLAN_PCP_SHIFT);
     if (cfm->extended && interval_ms != s->interval) {
         interval = 0;
         interval_ms = MIN(s->interval, UINT16_MAX);
index 334b80c0ef20fe2e868ae1d7ae34d7179b67e757..5106a51b90b435bcedf23dad891ef5350ba45f32 100644 (file)
--- a/lib/cfm.h
+++ b/lib/cfm.h
@@ -30,6 +30,7 @@ struct cfm_settings {
     bool extended;              /* Run in extended mode. */
     bool opup;                  /* Operational State. */
     uint16_t ccm_vlan;          /* CCM Vlan tag. Zero if none. */
+    uint8_t ccm_pcp;            /* CCM Priority. Zero if none. */
 };
 
 void cfm_init(void);
index 3c1aecfae194c816e12f7412978142102636ca24..c175c58f2b73ce30f343918314bdc86b29ee8bd5 100644 (file)
@@ -3218,6 +3218,8 @@ iface_configure_cfm(struct iface *iface)
                                                  "0"));
     s.ccm_vlan = atoi(get_interface_other_config(iface->cfg, "cfm_ccm_vlan",
                                                  "0"));
+    s.ccm_pcp = atoi(get_interface_other_config(iface->cfg, "cfm_ccm_pcp",
+                                                "0"));
     if (s.interval <= 0) {
         s.interval = 1000;
     }
index 4132525551ccbde23ec211248b71105428227aac..beaf8f282fd918c0020843766401dedc82c769c3 100644 (file)
         with the given value.
       </column>
 
+      <column name="other_config" key="cfm_ccm_pcp"
+        type='{"type": "integer", "minInteger": 1, "maxInteger": 7}'>
+        When set, the CFM module will apply a VLAN tag to all CCMs it generates
+        with the given PCP value.  The VLAN ID of the tag is governed by the
+        value of <ref column="other_config" key="cfm_ccm_vlan"/>. If
+        <ref column="other_config" key="cfm_ccm_vlan"/> is unset, a VLAN ID of
+        zero is used.
+      </column>
+
     </group>
 
     <group title="Bonding Configuration">