From e71498b9d7b503d5f17288f7967da1340bf2bbf7 Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Tue, 20 Sep 2016 17:35:50 -0700 Subject: [PATCH] wifi: (fixes #2306): Raise DCF IsBusy () condition for CCA busy This patch is reworked from a patch contributed by Ali Rostami . This patch has been developed jointly at WINLAB, Rutgers University and West Virginia University as part of the V2V safety communications scalability activity of the Interoperability Issues of Vehicle-to-Vehicle Based Safety Systems (V2V-Interoperability) Project headed by the Crash Avoidance Metrics Partnership (CAMP) Vehicle Safety Communications 3 (VSC3) Consortium, in partnership with the United States Department of Transportation (USDOT). --- src/wifi/model/dcf-manager.cc | 6 ++++++ src/wifi/model/dcf-manager.h | 2 +- src/wifi/test/dcf-manager-test.cc | 7 ++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wifi/model/dcf-manager.cc b/src/wifi/model/dcf-manager.cc index 20899063e..96a4659b9 100644 --- a/src/wifi/model/dcf-manager.cc +++ b/src/wifi/model/dcf-manager.cc @@ -493,6 +493,12 @@ DcfManager::IsBusy (void) const { return true; } + // CCA busy + Time lastCCABusyEnd = m_lastBusyStart + m_lastBusyDuration; + if (lastCCABusyEnd > Simulator::Now ()) + { + return true; + } return false; } diff --git a/src/wifi/model/dcf-manager.h b/src/wifi/model/dcf-manager.h index 22641df4b..900f7108f 100644 --- a/src/wifi/model/dcf-manager.h +++ b/src/wifi/model/dcf-manager.h @@ -529,7 +529,7 @@ private: void DoGrantAccess (void); /** * Check if the device is busy sending or receiving, - * or NAV busy. + * or NAV or CCA busy. * * \return true if the device is busy, * false otherwise diff --git a/src/wifi/test/dcf-manager-test.cc b/src/wifi/test/dcf-manager-test.cc index ed6c625b6..043ecec56 100644 --- a/src/wifi/test/dcf-manager-test.cc +++ b/src/wifi/test/dcf-manager-test.cc @@ -623,8 +623,8 @@ DcfManagerTest::DoRun (void) AddAccessRequest (21, 1, 24, 0); EndTest (); - // 20 40 50 53 54 55 - // | switching | busy | sifs | aifsn | tx | + // 20 40 50 53 54 55 56 57 + // | switching | busy | sifs | aifsn | bslot0 | bslot 1 | tx | // | | // 30 busy. 45 access request. // @@ -632,7 +632,8 @@ DcfManagerTest::DoRun (void) AddDcfState (1); AddSwitchingEvt (20,20); AddCcaBusyEvt (30,20); - AddAccessRequest (45, 1, 54, 0); + ExpectCollision (45, 2, 0); //backoff: 2 slots + AddAccessRequest (45, 1, 56, 0); EndTest (); // 20 30 50 53 54 55