vom: Fix the itf stats replay 79/11579/2
authorMohsin Kazmi <sykazmi@cisco.com>
Thu, 5 Apr 2018 12:43:43 +0000 (14:43 +0200)
committerDamjan Marion <dmarion.lists@gmail.com>
Thu, 12 Apr 2018 11:08:07 +0000 (11:08 +0000)
Change-Id: Iedc6bbaa1c0a1c3c6e1b8ed6d67db28046a551f4
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
src/vpp-api/vom/interface.cpp
src/vpp-api/vom/interface_cmds.cpp
src/vpp-api/vom/interface_cmds.hpp

index 435002a..262d9ea 100644 (file)
@@ -169,6 +169,10 @@ interface::sweep()
   }
 
   if (m_stats) {
+    if (stats_type_t::DETAILED == m_stats_type) {
+      HW::enqueue(new interface_cmds::collect_detail_stats_change_cmd(
+        m_stats_type, handle_i(), false));
+    }
     HW::enqueue(new interface_cmds::stats_disable_cmd(m_hdl.data()));
     m_stats.reset();
   }
@@ -198,6 +202,18 @@ interface::replay()
     HW::enqueue(new interface_cmds::state_change_cmd(m_state, m_hdl));
   }
 
+  if (m_stats) {
+    if (stats_type_t::DETAILED == m_stats_type) {
+      m_stats_type.set(rc_t::NOOP);
+      HW::enqueue(new interface_cmds::collect_detail_stats_change_cmd(
+        m_stats_type, handle_i(), true));
+    }
+    stat_listener& listener = m_stats->listener();
+    listener.status().set(rc_t::NOOP);
+    m_stats.reset(new interface_cmds::stats_enable_cmd(listener, handle_i()));
+    HW::enqueue(m_stats);
+  }
+
   if (m_table_id && (m_table_id.data() != route::DEFAULT_TABLE)) {
     HW::enqueue(
       new interface_cmds::set_table_cmd(m_table_id, l3_proto_t::IPV4, m_hdl));
index b1decd2..49a24c1 100644 (file)
@@ -582,6 +582,18 @@ stats_enable_cmd::retire(connection& con)
   wait();
 }
 
+interface::stat_listener&
+stats_enable_cmd::listener() const
+{
+  return m_listener;
+}
+
+void
+stats_enable_cmd::set(const rc_t& rc)
+{
+  m_listener.status().set(rc);
+}
+
 void
 stats_enable_cmd::notify()
 {
index 41ec5ca..7a0040d 100644 (file)
@@ -483,6 +483,16 @@ public:
    */
   std::string to_string() const;
 
+  /**
+   * (re)set status
+   */
+  void set(const rc_t& rc);
+
+  /**
+   * get listener
+   */
+  interface::stat_listener& listener() const;
+
   /**
    * Comparison operator - only used for UT
    */
@@ -502,7 +512,7 @@ private:
   /**
    * The interface on which we are enabling states
    */
-  handle_t m_swifindex;
+  const handle_t& m_swifindex;
 };
 
 /**