neigh_entry* neigh_table_mgr::create_new_entry(neigh_key neigh_key, const observer* new_observer) { observer * tmp = const_cast<observer *>(new_observer); const neigh_observer * dst = dynamic_cast<const neigh_observer *>(tmp) ; BULLSEYE_EXCLUDE_BLOCK_START if (dst == NULL) { //TODO: Need to add handling of this case neigh_mgr_logpanic("dynamic_casr failed, new_observer type is not neigh_observer"); } BULLSEYE_EXCLUDE_BLOCK_END transport_type_t transport = dst->get_obs_transport_type(); if (transport == VMA_TRANSPORT_IB) { if(IS_BROADCAST_N(neigh_key.get_in_addr())){ neigh_mgr_logdbg("Creating new neigh_ib_broadcast"); return (new neigh_ib_broadcast(neigh_key)); } neigh_mgr_logdbg("Creating new neigh_ib"); return (new neigh_ib(neigh_key)); } else if (transport == VMA_TRANSPORT_ETH) { neigh_mgr_logdbg("Creating new neigh_eth"); return (new neigh_eth(neigh_key)); } else { neigh_mgr_logdbg("Cannot create new entry, transport type is UNKNOWN"); return NULL; } }
void route_table_mgr::update_entry(INOUT route_entry* p_ent, bool b_register_to_net_dev /*= false*/) { rt_mgr_logdbg("entry [%p]", p_ent); auto_unlocker lock(m_lock); if (p_ent && !p_ent->is_valid()) { //if entry is found in the collection and is not valid rt_mgr_logdbg("route_entry is not valid-> update value"); rule_entry* p_rr_entry = p_ent->get_rule_entry(); std::deque<rule_val*>* p_rr_val; if (p_rr_entry && p_rr_entry->get_val(p_rr_val)) { route_val* p_val = NULL; in_addr_t peer_ip = p_ent->get_key().get_dst_ip(); unsigned char table_id; for (std::deque<rule_val*>::iterator p_rule_val = p_rr_val->begin(); p_rule_val != p_rr_val->end(); p_rule_val++) { table_id = (*p_rule_val)->get_table_id(); if (find_route_val(peer_ip, table_id, p_val)) { p_ent->set_val(p_val); if (b_register_to_net_dev) { //in_addr_t src_addr = p_val->get_src_addr(); //net_device_val* p_ndv = g_p_net_device_table_mgr->get_net_device_val(src_addr); // Check if broadcast IP which is NOT supported if (IS_BROADCAST_N(peer_ip)) { rt_mgr_logdbg("Disabling Offload for route_entry '%s' - this is BC address", p_ent->to_str().c_str()); // Need to route traffic to/from OS // Prevent registering of net_device to route entry } // Check if: Local loopback over Ethernet case which was not supported before OFED 2.1 /*else if (p_ndv && (p_ndv->get_transport_type() == VMA_TRANSPORT_ETH) && (peer_ip == src_addr)) { rt_mgr_logdbg("Disabling Offload for route_entry '%s' - this is an Ethernet unicast loopback route", p_ent->to_str().c_str()); // Need to route traffic to/from OS // Prevent registering of net_device to route entry }*/ else { // register to net device for bonding events p_ent->register_to_net_device(); } } // All good, validate the new route entry p_ent->set_entry_valid(); break; } else { rt_mgr_logdbg("could not find route val for route_entry '%s in table %u'", p_ent->to_str().c_str(), table_id); } } } else { rt_mgr_logdbg("rule entry is not valid"); } } }
neigh_entry* neigh_table_mgr::create_new_entry(neigh_key neigh_key, const observer* new_observer) { observer * tmp = const_cast<observer *>(new_observer); const neigh_observer * dst = dynamic_cast<const neigh_observer *>(tmp) ; BULLSEYE_EXCLUDE_BLOCK_START if (dst == NULL) { //TODO: Need to add handling of this case neigh_mgr_logpanic("dynamic_casr failed, new_observer type is not neigh_observer"); } BULLSEYE_EXCLUDE_BLOCK_END transport_type_t transport = dst->get_obs_transport_type(); //Register to netlink event handler only if this is the first entry if (get_cache_tbl_size() == 0) { g_p_netlink_handler->register_event(nlgrpNEIGH, this); neigh_mgr_logdbg("Registered to g_p_netlink_handler"); } if (transport == VMA_TRANSPORT_IB) { if(IS_BROADCAST_N(neigh_key.get_in_addr())){ neigh_mgr_logdbg("Creating new neigh_ib_broadcast"); return (new neigh_ib_broadcast(neigh_key)); } neigh_mgr_logdbg("Creating new neigh_ib"); return (new neigh_ib(neigh_key)); } else if (transport == VMA_TRANSPORT_ETH) { neigh_mgr_logdbg("Creating new neigh_eth"); return (new neigh_eth(neigh_key)); } else { neigh_mgr_logdbg("Cannot create new entry, transport type is UNKNOWN"); return NULL; } }
void route_table_mgr::update_entry(INOUT route_entry* p_rte, bool b_register_to_net_dev /*= false*/) { rt_mgr_logdbg("entry [%p]", p_rte); auto_unlocker lock(m_lock); if (p_rte && !p_rte->is_valid()) { //if entry is found in the collection and is not valid rt_mgr_logdbg("route_entry is not valid-> update value"); route_val* p_rtv = NULL; in_addr_t peer_ip = p_rte->get_key().get_in_addr(); if (find_route_val(peer_ip, p_rtv)) { p_rte->set_val(p_rtv); if (b_register_to_net_dev) { in_addr_t src_addr = p_rtv->get_src_addr(); net_device_val* p_ndv = g_p_net_device_table_mgr->get_net_device_val(src_addr); // Check if broadcast IP which is NOT supported if (IS_BROADCAST_N(peer_ip)) { rt_mgr_logdbg("Disabling Offload for route_entry '%s' - this is BC address", p_rte->to_str().c_str()); // Need to route traffic to/from OS // Prevent registering of net_device to route entry } // Check if: Local loopback over Ethernet case which is NOT supported yet else if (p_ndv && (p_ndv->get_transport_type() == VMA_TRANSPORT_ETH) && (peer_ip == src_addr)) { rt_mgr_logdbg("Disabling Offload for route_entry '%s' - this is an Ethernet unicast loopback route", p_rte->to_str().c_str()); // Need to route traffic to/from OS // Prevent registering of net_device to route entry } else { // register to net device for bonding events p_rte->register_to_net_device(); } } // All good, validate the new route entry p_rte->set_entry_valid(); } } }