make TSCC Aloha NRand_Wait and Backoff configurable; set TSCC Aloha NRand_Wait to a resaonable value so as to not DDoS the inbound TSCC slot; mark CSBKO_RAND as "handled";

2.0-maint
Bryan Biedenkapp 3 years ago
parent fd898994d4
commit 24b6cca301

@ -117,7 +117,15 @@ void Control::setOptions(yaml::Node& conf, uint32_t netId, uint8_t siteId, uint8
yaml::Node systemConf = conf["system"]; yaml::Node systemConf = conf["system"];
yaml::Node dmrProtocol = conf["protocols"]["dmr"]; yaml::Node dmrProtocol = conf["protocols"]["dmr"];
uint8_t nRandWait = (uint8_t)dmrProtocol["nRandWait"].as<uint32_t>(dmr::DEFAULT_NRAND_WAIT);
if (nRandWait > 15U)
nRandWait = 15U;
uint8_t backOff = (uint8_t)dmrProtocol["backOff"].as<uint32_t>(1U);
if (backOff > 15U)
backOff = 15U;
Slot::setSiteData(netId, siteId, channelId, channelNo); Slot::setSiteData(netId, siteId, channelId, channelNo);
Slot::setAlohaConfig(nRandWait, backOff);
yaml::Node control = dmrProtocol["control"]; yaml::Node control = dmrProtocol["control"];
bool enableTSCC = control["enable"].as<bool>(false); bool enableTSCC = control["enable"].as<bool>(false);
@ -153,6 +161,10 @@ void Control::setOptions(yaml::Node& conf, uint32_t netId, uint8_t siteId, uint8
if (printOptions) { if (printOptions) {
LogInfo(" TSCC Slot: %u", m_tsccSlotNo); LogInfo(" TSCC Slot: %u", m_tsccSlotNo);
if (enableTSCC) {
LogInfo(" TSCC Aloha Random Access Wait: %u", nRandWait);
LogInfo(" TSCC Aloha Backoff: %u", backOff);
}
LogInfo(" Silence Threshold: %u (%.1f%%)", silenceThreshold, float(silenceThreshold) / 1.41F); LogInfo(" Silence Threshold: %u (%.1f%%)", silenceThreshold, float(silenceThreshold) / 1.41F);
} }
} }

@ -133,6 +133,7 @@ namespace dmr
const uint16_t DMR_LOGICAL_CH_ABSOLUTE = 0xFFFU; const uint16_t DMR_LOGICAL_CH_ABSOLUTE = 0xFFFU;
const uint8_t DEFAULT_NRAND_WAIT = 8U;
const uint32_t DEFAULT_SILENCE_THRESHOLD = 21U; const uint32_t DEFAULT_SILENCE_THRESHOLD = 21U;
const uint32_t MAX_DMR_VOICE_ERRORS = 141U; const uint32_t MAX_DMR_VOICE_ERRORS = 141U;

@ -91,6 +91,9 @@ bool Slot::m_voice2 = true;
uint16_t Slot::m_tsccCnt = 0U; uint16_t Slot::m_tsccCnt = 0U;
uint8_t Slot::m_alohaNRandWait = DEFAULT_NRAND_WAIT;
uint8_t Slot::m_alohaBackOff = 1U;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Public Class Members // Public Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -623,6 +626,7 @@ void Slot::init(uint32_t colorCode, SiteData siteData, bool embeddedLCOnly, bool
/// <param name="siteId">DMR Site ID.</param> /// <param name="siteId">DMR Site ID.</param>
/// <param name="channelId">Channel ID.</param> /// <param name="channelId">Channel ID.</param>
/// <param name="channelNo">Channel Number.</param> /// <param name="channelNo">Channel Number.</param>
/// <param name="nRandWait"></param>
void Slot::setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo) void Slot::setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo)
{ {
m_siteData = SiteData(SITE_MODEL_SMALL, netId, siteId, 3U, true); m_siteData = SiteData(SITE_MODEL_SMALL, netId, siteId, 3U, true);
@ -638,6 +642,17 @@ void Slot::setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32
} }
} }
/// <summary>
/// Sets TSCC Aloha configuration.
/// </summary>
/// <param name="nRandWait"></param>
/// <param name="backOff"></param>
void Slot::setAlohaConfig(uint8_t nRandWait, uint8_t backOff)
{
m_alohaNRandWait = nRandWait;
m_alohaBackOff = backOff;
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Private Class Members // Private Class Members
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------

@ -109,6 +109,8 @@ namespace dmr
lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, uint32_t jitter); lookups::IdenTableLookup* idenTable, lookups::RSSIInterpolator* rssiMapper, uint32_t jitter);
/// <summary>Sets local configured site data.</summary> /// <summary>Sets local configured site data.</summary>
static void setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo); static void setSiteData(uint32_t netId, uint8_t siteId, uint8_t channelId, uint32_t channelNo);
/// <summary>Sets TSCC Aloha configuration.</summary>
static void setAlohaConfig(uint8_t nRandWait, uint8_t backOff);
private: private:
friend class Control; friend class Control;
@ -220,6 +222,9 @@ namespace dmr
static uint16_t m_tsccCnt; static uint16_t m_tsccCnt;
static uint8_t m_alohaNRandWait;
static uint8_t m_alohaBackOff;
/// <summary>Add data frame to the data ring buffer.</summary> /// <summary>Add data frame to the data ring buffer.</summary>
void addFrame(const uint8_t* data, bool net = false); void addFrame(const uint8_t* data, bool net = false);

@ -261,7 +261,7 @@ void CSBK::encode(uint8_t* data)
csbkValue = (csbkValue << 1) + ((m_siteData.netActive()) ? 1U : 0U); // Site Networked csbkValue = (csbkValue << 1) + ((m_siteData.netActive()) ? 1U : 0U); // Site Networked
csbkValue = (csbkValue << 5) + (m_alohaMask & 0x1FU); // MS Mask csbkValue = (csbkValue << 5) + (m_alohaMask & 0x1FU); // MS Mask
csbkValue = (csbkValue << 2) + 0U; // Service Function csbkValue = (csbkValue << 2) + 0U; // Service Function
csbkValue = (csbkValue << 4) + 0U; // csbkValue = (csbkValue << 4) + (m_nRandWait & 0x0FU); // Random Access Wait
csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
@ -463,6 +463,7 @@ CSBK::CSBK(SiteData siteData) :
m_priority(0U), m_priority(0U),
m_broadcast(false), m_broadcast(false),
m_backoffNo(1U), m_backoffNo(1U),
m_nRandWait(DEFAULT_NRAND_WAIT),
m_serviceData(0U), m_serviceData(0U),
m_serviceType(0U), m_serviceType(0U),
m_targetAddress(TGT_ADRS_TGID), m_targetAddress(TGT_ADRS_TGID),

@ -108,6 +108,8 @@ namespace dmr
/** Tier III */ /** Tier III */
/// <summary>Backoff Number.</summary> /// <summary>Backoff Number.</summary>
__PROPERTY(uint8_t, backoffNo, BackoffNo); __PROPERTY(uint8_t, backoffNo, BackoffNo);
/// <summary>Random Access Wait Delay.</summary>
__PROPERTY(uint8_t, nRandWait, NRandWait);
/// <summary>Service Data.</summary> /// <summary>Service Data.</summary>
__PROPERTY(uint8_t, serviceData, ServiceData); __PROPERTY(uint8_t, serviceData, ServiceData);

@ -146,6 +146,8 @@ bool ControlSignaling::process(uint8_t* data, uint32_t len)
::ActivityLog("DMR", true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId); ::ActivityLog("DMR", true, "Slot %u call alert request from %u to %u", m_slot->m_slotNo, srcId, dstId);
} else { } else {
handled = true;
if (m_verbose) { if (m_verbose) {
LogMessage(LOG_RF, "DMR Slot %u, DT_CSBK, CSBKO_RAND (Random Access), emerg = %u, prio = %u, serviceType = %02X, serviceData = %02X, srcId = %u, dstId = %u", LogMessage(LOG_RF, "DMR Slot %u, DT_CSBK, CSBKO_RAND (Random Access), emerg = %u, prio = %u, serviceType = %02X, serviceData = %02X, srcId = %u, dstId = %u",
m_slot->m_slotNo, csbk.getEmergency(), csbk.getPriority(), csbk.getServiceType(), csbk.getServiceData(), csbk.getSrcId(), csbk.getDstId()); m_slot->m_slotNo, csbk.getEmergency(), csbk.getPriority(), csbk.getServiceType(), csbk.getServiceData(), csbk.getSrcId(), csbk.getDstId());
@ -557,6 +559,9 @@ void ControlSignaling::writeRF_TSCC_Aloha()
csbk.setCSBKO(CSBKO_ALOHA); csbk.setCSBKO(CSBKO_ALOHA);
csbk.setFID(FID_ETSI); csbk.setFID(FID_ETSI);
csbk.setNRandWait(m_slot->m_alohaNRandWait);
csbk.setBackoffNo(m_slot->m_alohaBackOff);
// Regenerate the CSBK data // Regenerate the CSBK data
csbk.encode(data + 2U); csbk.encode(data + 2U);

Loading…
Cancel
Save

Powered by TurnKey Linux.