]> git.ipfire.org Git - people/ms/mstpd.git/commitdiff
Rapid ageing on per-port basis, as required by standard
authordv1tas <dv1tas@fbe50366-0c72-4402-a84b-5d246361dba7>
Tue, 3 Jul 2012 10:05:24 +0000 (10:05 +0000)
committerdv1tas <dv1tas@fbe50366-0c72-4402-a84b-5d246361dba7>
Tue, 3 Jul 2012 10:05:24 +0000 (10:05 +0000)
git-svn-id: svn://svn.code.sf.net/p/mstpd/code/trunk@32 fbe50366-0c72-4402-a84b-5d246361dba7

bridge_track.c
driver.h
driver_deps.c
mstp.c
mstp.h

index f5d3b3ac809411ceb2e3ce652eda8c78c74c5840..33eb6f0115e78513c77bcbbfd6a8f17c20824a10 100644 (file)
@@ -517,17 +517,19 @@ void MSTP_OUT_flush_all_fids(per_tree_port_t * ptp)
     driver_flush_all_fids(ptp);
 }
 
-/* 802.1Q-2005 wants per-port ageing time.
- * We do not support it, so set ageing time for the whole bridge.
- */
-void MSTP_OUT_set_ageing_time(bridge_t * br, unsigned int ageingTime)
+void MSTP_OUT_set_ageing_time(port_t *prt, unsigned int ageingTime)
 {
     unsigned int actual_ageing_time;
+    bridge_t *br = prt->bridge;
 
-    actual_ageing_time = driver_set_ageing_time(br, ageingTime);
-    INFO_BRNAME(br, "Setting new ageing time to %u", actual_ageing_time);
+    actual_ageing_time = driver_set_ageing_time(prt, ageingTime);
+    INFO_PRTNAME(br, prt, "Setting new ageing time to %u", actual_ageing_time);
 
-    /* Translate new ageing time to the kernel bridge code */
+    /*
+     * Translate new ageing time to the kernel bridge code.
+     * Kernel bridging code does not support per-port ageing time,
+     * so set ageing time for the whole bridge.
+     */
     if(0 > br_set_ageing_time(br->sysdeps.name, actual_ageing_time))
         ERROR_BRNAME(br, "Couldn't set new ageing time in kernel bridge");
 }
index 97012927811abaf6bd4f92c3fa34f36c83d93140..29fa6c7b7a3a582c4ab4f2c89b6c17a08bc10eba 100644 (file)
--- a/driver.h
+++ b/driver.h
@@ -14,7 +14,7 @@
 
 int driver_set_new_state(per_tree_port_t *ptp, int new_state);
 void driver_flush_all_fids(per_tree_port_t *ptp);
-unsigned int driver_set_ageing_time(bridge_t *br, unsigned int ageingTime);
+unsigned int driver_set_ageing_time(port_t *prt, unsigned int ageingTime);
 bool driver_create_msti(bridge_t *br, __u16 mstid);
 bool driver_delete_msti(bridge_t *br, __u16 mstid);
 
index 298a15e8192037a4db10039ca745b7c2b1a84f80..51d8895a9a3d5e686dcbdf3474f43a45fadfb762 100644 (file)
@@ -49,11 +49,11 @@ void driver_flush_all_fids(per_tree_port_t *ptp)
 }
 
 /*
- * Set new ageing time (in seconds) for the bridge.
+ * Set new ageing time (in seconds) for the port.
  * Return new actual ageing time from driver (the ageing timer granularity
  *  in the hardware can be more than 1 sec)
  */
-unsigned int driver_set_ageing_time(bridge_t *br, unsigned int ageingTime)
+unsigned int driver_set_ageing_time(port_t *prt, unsigned int ageingTime)
 {
     /* TODO: do set new ageing time */
     return ageingTime;
diff --git a/mstp.c b/mstp.c
index 556923c8b347dda816d38e5555b592cdd2f115aa..bbb912e02f87c80457d18bd5bcf92553bbecc35b 100644 (file)
--- a/mstp.c
+++ b/mstp.c
@@ -197,7 +197,6 @@ bool MSTP_IN_bridge_create(bridge_t *br, __u8 *macaddr)
     assign(br->Transmit_Hold_Count, 6u); /* 17.14 of 802.1D */
     assign(br->Migrate_Time, 3u); /* 17.14 of 802.1D */
     assign(br->Ageing_Time, 300u);/* 8.8.3 Table 8-3 */
-    assign(br->rapidAgeingWhile, 0u);
 
     br->uptime = 0;
 
@@ -236,6 +235,7 @@ bool MSTP_IN_port_create_and_add_tail(port_t *prt, __u16 portno)
     assign(prt->ExternalPortPathCost, MAX_PATH_COST); /* 13.37.1 */
     prt->AdminEdgePort = false; /* 13.25 */
     prt->AutoEdge = true;       /* 13.25 */
+    assign(prt->rapidAgeingWhile, 0u);
 
     /* The following are initialized in BEGIN state:
      * - mdelayWhile. mcheck, sendRSTP: in Port Protocol Migration SM
@@ -433,12 +433,14 @@ void MSTP_IN_one_second(bridge_t *br)
             ++(tree->time_since_topology_change);
 
     FOREACH_PORT_IN_BRIDGE(prt, br)
-        PTSM_tick(prt);
-    /* support for rapid ageing */
-    if(br->rapidAgeingWhile)
     {
-        if((--(br->rapidAgeingWhile)) == 0)
-            MSTP_OUT_set_ageing_time(br, br->Ageing_Time);
+        PTSM_tick(prt);
+        /* support for rapid ageing */
+        if(prt->rapidAgeingWhile)
+        {
+            if((--(prt->rapidAgeingWhile)) == 0)
+                MSTP_OUT_set_ageing_time(prt, br->Ageing_Time);
+        }
     }
 
     br_state_machines_run(br);
@@ -1859,8 +1861,8 @@ static void set_fdbFlush(per_tree_port_t *ptp)
         per_tree_port_t *cist = GET_CIST_PTP_FROM_PORT(prt);
         unsigned int FwdDelay = cist->designatedTimes.Forward_Delay;
         /* Initiate rapid ageing */
-        MSTP_OUT_set_ageing_time(br, FwdDelay);
-        assign(br->rapidAgeingWhile, FwdDelay);
+        MSTP_OUT_set_ageing_time(prt, FwdDelay);
+        assign(prt->rapidAgeingWhile, FwdDelay);
         ptp->fdbFlush = false;
     }
 }
diff --git a/mstp.h b/mstp.h
index 54d3f2cc37f7a4514c21495887afcc3267afb736..a0859ba7e8d01537945258e8f648e2fe5d0f1550 100644 (file)
--- a/mstp.h
+++ b/mstp.h
@@ -393,7 +393,6 @@ typedef struct
     unsigned int Transmit_Hold_Count; /* 13.22.g */
     unsigned int Migrate_Time;        /* 13.22.h */
     unsigned int Ageing_Time;  /* 8.8.3 */
-    unsigned int rapidAgeingWhile;
 
     __u16 vid2fid[MAX_VID + 1];
     __be16 fid2mstid[MAX_FID + 1];
@@ -469,6 +468,8 @@ typedef struct
     bool AdminEdgePort; /* 13.22.k */
     bool AutoEdge; /* 13.22.m */
 
+    unsigned int rapidAgeingWhile;
+
     /* State machines */
     PRSM_states_t PRSM_state;
     PPMSM_states_t PPMSM_state;
@@ -563,7 +564,7 @@ void MSTP_IN_set_mst_config_id(bridge_t *br, __u16 revision, __u8 *name);
 /* External actions (outputs) */
 void MSTP_OUT_set_state(per_tree_port_t *ptp, int new_state);
 void MSTP_OUT_flush_all_fids(per_tree_port_t *ptp);
-void MSTP_OUT_set_ageing_time(bridge_t *br, unsigned int ageingTime);
+void MSTP_OUT_set_ageing_time(port_t *prt, unsigned int ageingTime);
 void MSTP_OUT_tx_bpdu(port_t *prt, bpdu_t *bpdu, int size);
 
 /* Structures for communicating with user */