File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,11 +49,10 @@ uint16_t Port::index() const {
4949}
5050
5151uint16_t Port::get_index () const {
52- std::lock_guard<std::mutex> guard (port_mutex_);
53- return __get_index ();
52+ return port_index_;
5453}
5554
56- uint16_t Port::__get_index () const {
55+ uint16_t Port::calculate_index () const {
5756 // check if there is ingress-enabled transparent cube
5857 for (auto it = cubes_.rbegin (); it != cubes_.rend (); ++it) {
5958 auto index = (*it)->get_index (ProgramType::INGRESS);
@@ -230,9 +229,11 @@ void Port::update_indexes() {
230229 }
231230 }
232231
232+ port_index_ = calculate_index ();
233+
233234 // CASE4: peer -> cube[N-1]
234235 if (peer_port_) {
235- peer_port_->set_next_index (__get_index () );
236+ peer_port_->set_next_index (port_index_ );
236237 }
237238
238239 // egress chain: port -> cubes[0] -> ... -> cube[N -1] -> peer
Original file line number Diff line number Diff line change @@ -100,7 +100,8 @@ class Port : public polycube::service::PortIface, public PeerIface {
100100 std::shared_ptr<spdlog::logger> logger;
101101
102102 private:
103- uint16_t __get_index () const ;
103+ uint16_t port_index_; // ebpf id used by other modules to call this port
104+ uint16_t calculate_index () const ;
104105};
105106
106107} // namespace polycubed
You can’t perform that action at this time.
0 commit comments