Skip to content

Commit

Permalink
* [All] plugins now skips the parsing Tx parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangzp committed Feb 1, 2022
1 parent e27c7f8 commit 70a39b5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 132 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog of PicoScenes Plugin Development Kit (PDK)

## Feb. 2, 2022
* [All] plugins now skips the parsing Tx parameters

## Dec. 25, 2021
* [EchoProbe] minor udpate

Expand Down
17 changes: 6 additions & 11 deletions plugin-echoprobe/EchoProbeInitiator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,12 @@ std::shared_ptr<PicoScenesFrameBuilder> EchoProbeInitiator::buildBasicFrame(uint
if (frameType == EchoProbeRequestFrameType)
fp->addExtraInfo();
}
fp->setFrameFormat(PacketFormatEnum(*parameters.format));
fp->setMCS(parameters.mcs.value_or(0));
fp->setNumSTS(parameters.numSTS.value_or(1));
fp->setChannelBandwidth(ChannelBandwidthEnum(parameters.cbw.value_or(20)));
fp->setGuardInterval(GuardIntervalEnum(parameters.guardInterval.value_or(800)));
fp->setNumberOfExtraSounding(parameters.numESS.value_or(0));
fp->setChannelCoding((ChannelCodingEnum) parameters.coding.value_or((uint32_t) ChannelCodingEnum::BCC));
fp->setTxHEExtendedRange(parameters.txHEExtendedRange.value_or(false));
fp->setHEHighDoppler(parameters.heHighDoppler.value_or(false));
fp->setHEMidamblePeriodicity(parameters.heMidamblePeriodicity.value_or(10));
fp->getFrame()->txParameters.idleTime = parameters.ifs.value_or(20e-6);
/**
* @brief PicoScenes Platform CLI parser has *absorbed* the common Tx parameters.
* The platform parser will parse the Tx parameters options and store the results in AbstractNIC.
* Plugin developers now can access the parameters via a new method nic->getUserSpecifiedTxParameters().
*/
fp->setTxParameters(nic->getUserSpecifiedTxParameters());

fp->setDestinationAddress(parameters.inj_target_mac_address->data());
if (isIntelMVMTypeNIC(nic->getDeviceType())) {
Expand Down
10 changes: 0 additions & 10 deletions plugin-echoprobe/EchoProbeParameters.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,11 @@

EchoProbeParameters::EchoProbeParameters() {
inj_target_mac_address = PicoScenesFrameBuilder::magicIntel123456;
format = PacketFormatEnum::PacketFormat_HT;
mcs = 0;
numSTS = 1;
guardInterval = 800;
cbw = 20;
coding = uint32_t(ChannelCodingEnum::BCC);
txHEExtendedRange = false;
heHighDoppler = false;
heMidamblePeriodicity = 10;
injectorContent = EchoProbeInjectionContent::Full;
tx_delay_us = 5e5;
timeout_ms = 10;
tx_max_retry = 100;
delay_after_cf_change_ms = 5;
numOfPacketsPerDotDisplay = 10;
replyStrategy = EchoProbeReplyStrategy::ReplyWithFullPayload;
ifs = 10e-6;
}
11 changes: 0 additions & 11 deletions plugin-echoprobe/EchoProbeParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ class EchoProbeParameters {
std::optional<uint32_t> delayed_start_seconds;

std::optional<std::string> outputFileName;
std::optional<PacketFormatEnum> format;
std::optional<uint32_t> cbw;
std::optional<uint32_t> mcs;
std::optional<uint32_t> numSTS;
std::optional<uint32_t> numESS;
std::optional<uint32_t> guardInterval;
std::optional<uint32_t> coding;
std::optional<bool> txHEExtendedRange;
std::optional<bool> heHighDoppler;
std::optional<double> heMidamblePeriodicity;
std::optional<double> ifs;
EchoProbeInjectionContent injectorContent;

std::optional<double> cf_begin;
Expand Down
98 changes: 1 addition & 97 deletions plugin-echoprobe/EchoProbePlugin.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,7 @@ void EchoProbePlugin::initialization() {
("repeat", po::value<std::string>(), "The injection number per cf/bw combination, 100 as default")
("delay", po::value<std::string>(), "The delay between successive injections(unit in us, 5e5 as default)")
("delayed-start", po::value<uint32_t>(), "A one-time delay before injection(unit in us, 0 as default)")

("format", po::value<std::string>(), "802.11 frame format [nonHT, HT, VHT, HESU]")
("cbw", po::value<uint32_t>(), "Channel Bandwidth (CBW) for injection(unit in MHz) [20, 40, 80, 160], 20 as default")
("mcs", po::value<uint32_t>(), "MCS value [0-11], the MCS index for one single spatial stream")
("sts", po::value<uint32_t>(), "Number of spatial time stream (STS) [0-4], 0 as default")
("ess", po::value<uint32_t>(), "Number of Extension Spatial Stream for TX [ 0 as default, 1, 2, 3]")
("gi", po::value<uint32_t>(), "Guarding Interval [400, 800, 1600, 3200], 800 as default")
("coding", po::value<std::string>(), "Code scheme [LDPC, BCC], BCC as default")
("extended-range", "Enable 11ax extended range")
("high-doppler", po::value<double>()->implicit_value(10), "Enabling 802.11ax High Doppler mode with the Midamble Periodicity of 10 or 20, 10 as default")
("injector-content", po::value<std::string>(), "Content type for injector mode [full, header, ndp]")
("ifs", po::value<std::string>(), "Inter-Frame Spacing in seconds, 20e-6 as default");
("injector-content", po::value<std::string>(), "Content type for injector mode [full, header, ndp]");

echoOptions = std::make_shared<po::options_description>("Echo Responder Options");
echoOptions->add_options()
Expand Down Expand Up @@ -174,86 +163,6 @@ void EchoProbePlugin::parseAndExecuteCommands(const std::string &commandString)
parameters.delayed_start_seconds = vm["delayed-start"].as<uint32_t>();
}

if (vm.count("format")) {
auto format = vm["format"].as<std::string>();
if (boost::iequals(format, "nonHT")) {
parameters.format = PacketFormatEnum::PacketFormat_NonHT;
} else if (boost::iequals(format, "HT")) {
parameters.format = PacketFormatEnum::PacketFormat_HT;
} else if (boost::iequals(format, "VHT")) {
parameters.format = PacketFormatEnum::PacketFormat_VHT;
} else if (boost::iequals(format, "HESU")) {
parameters.format = PacketFormatEnum::PacketFormat_HESU;
} else if (boost::iequals(format, "HEMU")) {
parameters.format = PacketFormatEnum::PacketFormat_HEMU;
} else
throw std::invalid_argument(fmt::format("[EchoProbe]: invalid packet format value: {}.\n", format));
}

if (vm.count("cbw")) {
auto bwValue = vm["cbw"].as<uint32_t>();
parameters.cbw = bwValue;
}

if (vm.count("gi")) {
auto sgiValue = vm["gi"].as<uint32_t>();
parameters.guardInterval = sgiValue;
}

if (vm.count("mcs")) {
auto mcs = vm["mcs"].as<uint32_t>();
if ((*parameters.format == PacketFormatEnum::PacketFormat_HEMU || *parameters.format == PacketFormatEnum::PacketFormat_HESU) && mcs < 12)
parameters.mcs = mcs;
else if (*parameters.format == PacketFormatEnum::PacketFormat_VHT && mcs < 10)
parameters.mcs = mcs;
else if (*parameters.format == PacketFormatEnum::PacketFormat_HT && mcs < 8)
parameters.mcs = mcs;
else if (*parameters.format == PacketFormatEnum::PacketFormat_NonHT && mcs < 8)
parameters.mcs = mcs;
else
throw std::invalid_argument(fmt::format("[EchoProbe]: invalid MCS value: {}.\n", mcs));
}

if (vm.count("sts")) {
auto sts = vm["sts"].as<uint32_t>();
if ((*parameters.format == PacketFormatEnum::PacketFormat_HEMU || *parameters.format == PacketFormatEnum::PacketFormat_HESU) && sts <= 8)
parameters.numSTS = sts;
else if (*parameters.format == PacketFormatEnum::PacketFormat_VHT && sts <= 8)
parameters.numSTS = sts;
else if (*parameters.format == PacketFormatEnum::PacketFormat_HT && sts <= 4)
parameters.numSTS = sts;
else if (*parameters.format == PacketFormatEnum::PacketFormat_NonHT && sts <= 1)
parameters.numSTS = sts;
else
throw std::invalid_argument(fmt::format("[EchoProbe Plugin]: invalid STS value: {}.\n", sts));
}

if (vm.count("ess")) {
auto ness = vm["ess"].as<uint32_t>();
if (ness < 4)
parameters.numESS = ness;
else
throw std::invalid_argument(fmt::format("[EchoProbe Plugin]: invalid number of extension spatial stream (NESS) value: {}.\n", ness));
}

if (vm.count("coding")) {
auto codingStr = vm["coding"].as<std::string>();
if (boost::iequals(codingStr, "LDPC"))
parameters.coding = (uint32_t) ChannelCodingEnum::LDPC;
else if (boost::iequals(codingStr, "BCC"))
parameters.coding = (uint32_t) ChannelCodingEnum::BCC;
}

if (vm.count("extended-range")) {
parameters.txHEExtendedRange = true;
}

if (vm.count("high-doppler")) {
auto heMidamblePeriodicity = vm["high-doppler"].as<double>();
parameters.heHighDoppler = true;
parameters.heMidamblePeriodicity = heMidamblePeriodicity;
}

if (vm.count("injector-content")) {
auto codingStr = vm["injector-content"].as<std::string>();
if (boost::iequals(codingStr, "ndp"))
Expand All @@ -264,11 +173,6 @@ void EchoProbePlugin::parseAndExecuteCommands(const std::string &commandString)
parameters.injectorContent = EchoProbeInjectionContent::Full;
}

if (vm.count("ifs")) {
auto ifs_value = boost::lexical_cast<double>(vm["ifs"].as<std::string>());
parameters.ifs = ifs_value;
}

if (vm.count("ack-type")) {
auto ackType = vm["ack-type"].as<std::string>();
if (boost::iequals(ackType, "full"))
Expand Down
4 changes: 1 addition & 3 deletions plugin-echoprobe/EchoProbeResponder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ std::vector<PicoScenesFrameBuilder> EchoProbeResponder::makeRepliesForEchoProbeR


frameBuilder.setPicoScenesFrameType(EchoProbeReplyFrameType);
frameBuilder.setMCS(epReq.ackMCS == -1 ? (parameters.mcs ? *parameters.mcs : 0) : epReq.ackMCS);
frameBuilder.setNumSTS(epReq.ackNumSTS == -1 ? (parameters.numSTS ? *parameters.numSTS : 1) : epReq.ackNumSTS);
frameBuilder.setGuardInterval((GuardIntervalEnum) (epReq.ackGI == -1 ? (parameters.guardInterval ? *parameters.guardInterval : 800) : epReq.ackGI));
frameBuilder.setTxParameters(nic->getUserSpecifiedTxParameters());
frameBuilder.setDestinationAddress(rxframe.standardHeader.addr3.data());
if (nic->getDeviceType() == PicoScenesDeviceType::QCA9300) {
auto macNIC = std::dynamic_pointer_cast<MAC80211CSIExtractableNIC>(nic);
Expand Down

0 comments on commit 70a39b5

Please sign in to comment.