Skip to content

Commit

Permalink
wifi: pass WifiTxVector and vector<bool> by const reference
Browse files Browse the repository at this point in the history
  • Loading branch information
tolikzinovyev committed Oct 15, 2024
1 parent 49deb67 commit 3c7d1b3
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 115 deletions.
16 changes: 8 additions & 8 deletions src/wifi/examples/wifi-phy-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ class PsrExperiment
*/
void Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);
Ptr<WifiPhy> m_tx; ///< transmit
Input m_input; ///< input
Output m_output; ///< output
Expand All @@ -84,8 +84,8 @@ PsrExperiment::Send()
void
PsrExperiment::Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu)
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu)
{
m_output.received++;
}
Expand Down Expand Up @@ -194,8 +194,8 @@ class CollisionExperiment
*/
void Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);
Ptr<WifiPhy> m_txA; ///< transmit A
Ptr<WifiPhy> m_txB; ///< transmit B
uint32_t m_flowIdA; ///< flow ID A
Expand Down Expand Up @@ -231,8 +231,8 @@ CollisionExperiment::SendB() const
void
CollisionExperiment::Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu)
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu)
{
FlowIdTag tag;
if ((*psdu->begin())->GetPacket()->FindFirstMatchingByteTag(tag))
Expand Down
8 changes: 4 additions & 4 deletions src/wifi/model/frame-exchange-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ FrameExchangeManager::ResetPhy()
m_phy->SetReceiveOkCallback(MakeNullCallback<void,
Ptr<const WifiPsdu>,
RxSignalInfo,
WifiTxVector,
std::vector<bool>>());
const WifiTxVector&,
const std::vector<bool>&>());
m_phy->SetReceiveErrorCallback(MakeNullCallback<void, Ptr<const WifiPsdu>>());
}
m_phy = nullptr;
Expand Down Expand Up @@ -1150,8 +1150,8 @@ FrameExchangeManager::PsduRxError(Ptr<const WifiPsdu> psdu)
void
FrameExchangeManager::Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> perMpduStatus)
const WifiTxVector& txVector,
const std::vector<bool>& perMpduStatus)
{
NS_LOG_FUNCTION(
this << psdu << rxSignalInfo << txVector << perMpduStatus.size()
Expand Down
4 changes: 2 additions & 2 deletions src/wifi/model/frame-exchange-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class FrameExchangeManager : public Object
*/
void Receive(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> perMpduStatus);
const WifiTxVector& txVector,
const std::vector<bool>& perMpduStatus);

/**
* Information about the MPDU being received. The TXVECTOR is populated upon
Expand Down
6 changes: 5 additions & 1 deletion src/wifi/model/wifi-phy-state-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ struct RxSignalInfo;
* arg3: TXVECTOR of PSDU
* arg4: vector of per-MPDU status of reception.
*/
typedef Callback<void, Ptr<const WifiPsdu>, RxSignalInfo, WifiTxVector, std::vector<bool>>
typedef Callback<void,
Ptr<const WifiPsdu>,
RxSignalInfo,
const WifiTxVector&,
const std::vector<bool>&>
RxOkCallback;
/**
* Callback if PSDU unsuccessfuly received
Expand Down
24 changes: 12 additions & 12 deletions src/wifi/test/spectrum-wifi-phy-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ class SpectrumWifiPhyBasicTest : public TestCase
*/
void SpectrumWifiPhyRxSuccess(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);
/**
* Spectrum wifi receive failure function
* \param psdu the PSDU
Expand Down Expand Up @@ -225,8 +225,8 @@ SpectrumWifiPhyBasicTest::SendSignal(Watt_u txPower)
void
SpectrumWifiPhyBasicTest::SpectrumWifiPhyRxSuccess(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu)
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu)
{
NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
m_count++;
Expand Down Expand Up @@ -1283,8 +1283,8 @@ class SpectrumWifiPhy80Plus80Test : public TestCase
*/
void RxSuccessSta(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* Receive failure function for STA
Expand Down Expand Up @@ -1375,8 +1375,8 @@ SpectrumWifiPhy80Plus80Test::StopInterference()
void
SpectrumWifiPhy80Plus80Test::RxSuccessSta(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
m_countRxSuccessSta++;
Expand Down Expand Up @@ -1667,8 +1667,8 @@ class SpectrumWifiPhyMultipleInterfacesTest : public TestCase
void RxSuccess(std::size_t index,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* Receive failure function
Expand Down Expand Up @@ -1851,8 +1851,8 @@ void
SpectrumWifiPhyMultipleInterfacesTest::RxSuccess(std::size_t index,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << index << *psdu << rxSignalInfo << txVector);
m_countRxSuccess.at(index)++;
Expand Down
16 changes: 8 additions & 8 deletions src/wifi/test/wifi-non-ht-dup-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ class TestNonHtDuplicatePhyReception : public TestCase
void RxSuccess(std::size_t index,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* Receive failure function
Expand Down Expand Up @@ -374,8 +374,8 @@ void
TestNonHtDuplicatePhyReception::RxSuccess(std::size_t index,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << index << *psdu << rxSignalInfo << txVector);
const auto expectedWidth =
Expand Down Expand Up @@ -664,8 +664,8 @@ class TestMultipleCtsResponsesFromMuRts : public TestCase
void RxCtsSuccess(std::size_t phyIndex,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* CTS RX failure function
Expand Down Expand Up @@ -775,8 +775,8 @@ void
TestMultipleCtsResponsesFromMuRts::RxCtsSuccess(std::size_t phyIndex,
Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << phyIndex << *psdu << rxSignalInfo << txVector);
std::vector<CtsTxInfos> successfulCtsInfos{};
Expand Down
32 changes: 16 additions & 16 deletions src/wifi/test/wifi-phy-mu-mimo-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ class TestDlMuMimoPhyTransmission : public TestCase
*/
void RxSuccessSta1(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);
/**
* Receive success function for STA 2
* \param psdu the PSDU
Expand All @@ -361,8 +361,8 @@ class TestDlMuMimoPhyTransmission : public TestCase
*/
void RxSuccessSta2(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);
/**
* Receive success function for STA 3
* \param psdu the PSDU
Expand All @@ -372,8 +372,8 @@ class TestDlMuMimoPhyTransmission : public TestCase
*/
void RxSuccessSta3(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* Receive failure function for STA 1
Expand Down Expand Up @@ -569,8 +569,8 @@ TestDlMuMimoPhyTransmission::SendMuPpdu(const std::vector<StaInfo>& staInfos)
void
TestDlMuMimoPhyTransmission::RxSuccessSta1(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
m_countRxSuccessSta1++;
Expand All @@ -580,8 +580,8 @@ TestDlMuMimoPhyTransmission::RxSuccessSta1(Ptr<const WifiPsdu> psdu,
void
TestDlMuMimoPhyTransmission::RxSuccessSta2(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
m_countRxSuccessSta2++;
Expand All @@ -591,8 +591,8 @@ TestDlMuMimoPhyTransmission::RxSuccessSta2(Ptr<const WifiPsdu> psdu,
void
TestDlMuMimoPhyTransmission::RxSuccessSta3(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << *psdu << rxSignalInfo << txVector);
m_countRxSuccessSta3++;
Expand Down Expand Up @@ -1216,8 +1216,8 @@ class TestUlMuMimoPhyTransmission : public TestCase
*/
void RxSuccess(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> statusPerMpdu);
const WifiTxVector& txVector,
const std::vector<bool>& statusPerMpdu);

/**
* Receive failure function
Expand Down Expand Up @@ -1407,8 +1407,8 @@ TestUlMuMimoPhyTransmission::SendHeTbPpdu(uint16_t txStaId,
void
TestUlMuMimoPhyTransmission::RxSuccess(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
WifiTxVector txVector,
std::vector<bool> /*statusPerMpdu*/)
const WifiTxVector& txVector,
const std::vector<bool>& /*statusPerMpdu*/)
{
NS_LOG_FUNCTION(this << *psdu << psdu->GetAddr2() << RatioToDb(rxSignalInfo.snr) << txVector);
NS_TEST_ASSERT_MSG_EQ((RatioToDb(rxSignalInfo.snr) > dB_u{0.0}), true, "Incorrect SNR value");
Expand Down
Loading

0 comments on commit 3c7d1b3

Please sign in to comment.