Skip to content

Commit

Permalink
Merge "Keep sending ARP probes at regular interval." into R3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jan 16, 2017
2 parents 8f178e2 + 3899139 commit 33a418f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
34 changes: 15 additions & 19 deletions src/vnsw/agent/services/arp_proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ bool ArpPathPreferenceState::SendArpRequest(WaitForTrafficIntfMap
}

bool inserted = arp_transmitted_map.insert(it->first).second;
if (it->second >= kMaxRetry) {
// In gateway mode with remote VMIs, send regular ARP requests
if (vm_intf->vmi_type() != VmInterface::REMOTE_VM)
continue;
}

MacAddress smac = vm_intf->GetVifMac(vrf_state_->agent);
it->second++;
if (inserted == false) {
Expand All @@ -168,6 +162,14 @@ bool ArpPathPreferenceState::SendArpRequest(WaitForTrafficIntfMap
MacAddress(), vm_ip_.to_v4().to_ulong(),
it->first, vrf_id_);
vrf_state_->arp_proto->IncrementStatsVmArpReq();

// reduce the frequency of ARP requests after some tries
if (it->second >= kMaxRetry) {
// change frequency only if not in gateway mode with remote VMIs
if (vm_intf->vmi_type() != VmInterface::REMOTE_VM)
arp_req_timer_->Reschedule(kTimeout * 5);
}

ret = true;
}
return ret;
Expand Down Expand Up @@ -227,19 +229,13 @@ void ArpPathPreferenceState::SendArpRequestForAllIntf(const
gw_ip_ = path->subnet_service_ip();
}
uint32_t intf_id = intf->id();
const VmInterface *vm_intf = static_cast<const VmInterface *>(intf);
bool wait_for_traffic = path->path_preference().wait_for_traffic();
//Build new list of interfaces in active state
if (wait_for_traffic == true ||
vm_intf->vmi_type() == VmInterface::REMOTE_VM) {
WaitForTrafficIntfMap::const_iterator wait_for_traffic_it =
wait_for_traffic_map.find(intf_id);
if (wait_for_traffic_it == wait_for_traffic_map.end()) {
new_wait_for_traffic_map.insert(std::make_pair(intf_id, 0));
} else {
new_wait_for_traffic_map.insert(std::make_pair(intf_id,
wait_for_traffic_it->second));
}
WaitForTrafficIntfMap::const_iterator wait_for_traffic_it =
wait_for_traffic_map.find(intf_id);
if (wait_for_traffic_it == wait_for_traffic_map.end()) {
new_wait_for_traffic_map.insert(std::make_pair(intf_id, 0));
} else {
new_wait_for_traffic_map.insert(std::make_pair(intf_id,
wait_for_traffic_it->second));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/services/test/arp_path_preference_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST_F(ArpPathPreferenceTest, Test3) {
MacAddress::ZeroMac());
client->WaitForIdle();

EXPECT_FALSE(CheckIpMap(vrf_id, intf_id, ip));
EXPECT_TRUE(CheckIpMap(vrf_id, intf_id, ip));
EXPECT_TRUE(CheckEvpnMap(vrf_id, intf_id, ip));
EXPECT_TRUE(GetEvpnMapRetryCount(vrf_id, intf_id, ip) >= 1);
}
Expand Down

0 comments on commit 33a418f

Please sign in to comment.