lot of debugging and trying out
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-10-13 11:42:13 +02:00
parent 9f600a24ff
commit 5bcd171108
Signed by: muellerr
GPG Key ID: A649FB78196E3849
4 changed files with 20 additions and 8 deletions

View File

@ -48,7 +48,7 @@ static constexpr uint32_t LEGACY_SA_DEPL_CHANNEL_ALTERNATION_INTERVAL_SECS = 5;
// Maximum allowed burn time allowed by the software. // Maximum allowed burn time allowed by the software.
static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 180; static constexpr uint32_t SA_DEPL_MAX_BURN_TIME = 180;
static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 300; static constexpr size_t CFDP_MAX_FILE_SEGMENT_LEN = 990;
static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50; static constexpr uint32_t CCSDS_HANDLER_QUEUE_SIZE = 50;
static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4; static constexpr uint8_t NUMBER_OF_VIRTUAL_CHANNELS = 4;
@ -61,9 +61,10 @@ static constexpr uint32_t HK_STORE_QUEUE_SIZE = 300;
static constexpr uint32_t CFDP_STORE_QUEUE_SIZE = 300; static constexpr uint32_t CFDP_STORE_QUEUE_SIZE = 300;
static constexpr uint32_t LIVE_CHANNEL_NORMAL_QUEUE_SIZE = 250; static constexpr uint32_t LIVE_CHANNEL_NORMAL_QUEUE_SIZE = 250;
static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 250; static constexpr uint32_t LIVE_CHANNEL_CFDP_QUEUE_SIZE = 400;
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 50; static constexpr uint32_t CFDP_THROTTLE_PERIOD_MS = 200;
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_SRC_HANDLER = 20;
static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_DEST_HANDLER = 300; static constexpr uint32_t CFDP_MAX_FSM_CALL_COUNT_DEST_HANDLER = 300;
static constexpr uint32_t CFDP_SHORT_DELAY_MS = 50; static constexpr uint32_t CFDP_SHORT_DELAY_MS = 50;
static constexpr uint32_t CFDP_REGULAR_DELAY_MS = 200; static constexpr uint32_t CFDP_REGULAR_DELAY_MS = 200;

View File

@ -72,9 +72,7 @@ ReturnValue_t CfdpHandler::initialize() {
} }
fsmCount = 0; fsmCount = 0;
if (throttleSignal) { throttlePeriodOngoing = throttleSignal;
throttlePeriodOngoing = true;
}
// CFDP can be throttled by the slowest live TM handler to handle back pressure in a sensible // CFDP can be throttled by the slowest live TM handler to handle back pressure in a sensible
// way without requiring huge amounts of memory for large files. // way without requiring huge amounts of memory for large files.

View File

@ -52,13 +52,16 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
} }
} }
} }
} else {
consecutiveNoBlockWriteCounter = 0;
} }
if (channel.isBusy() and !throttlePeriodOngoing) { if (channel.isBusy() and !throttlePeriodOngoing) {
// Throttle CFDP packet creator. It is by far the most relevant data creator, so throttling // Throttle CFDP packet creator. It is by far the most relevant data creator, so throttling
// it is the easiest way to handle back pressure for now in a sensible way. // it is the easiest way to handle back pressure for now in a sensible way.
throttleCfdp(); throttleCfdp();
} else if(!channel.isBusy() and throttlePeriodOngoing) { } else if(!channel.isBusy() and throttlePeriodOngoing) {
if(minimumPeriodThrottleCd.hasTimedOut()) { if(minimumPeriodThrottleCd.hasTimedOut() and consecutiveNoBlockWriteCounter >= 10) {
sif::debug << "releasing cfdp" << std::endl;
releaseCfdp(); releaseCfdp();
} }
} }
@ -162,10 +165,14 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
return result; return result;
} }
if(ptmeLocked) {
consecutiveNoBlockWriteCounter= 0;
}
if (!ptmeLocked) { if (!ptmeLocked) {
size_t partiallyWrittenSize = 0; size_t partiallyWrittenSize = 0;
result = channel.write(data, size, partiallyWrittenSize); result = channel.write(data, size, partiallyWrittenSize);
if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) { if (result == DirectTmSinkIF::PARTIALLY_WRITTEN) {
consecutiveNoBlockWriteCounter = 0;
// Already throttle CFDP. // Already throttle CFDP.
throttleCfdp(); throttleCfdp();
result = channel.handleLastWriteSynchronously(data, size, partiallyWrittenSize, 200); result = channel.handleLastWriteSynchronously(data, size, partiallyWrittenSize, 200);
@ -175,6 +182,9 @@ ReturnValue_t LiveTmTask::handleGenericTmQueue(MessageQueueIF& queue) {
<< "LiveTmTask: Synchronous write of last segment failed with code 0x" << "LiveTmTask: Synchronous write of last segment failed with code 0x"
<< std::setw(4) << std::hex << result << std::dec << std::endl; << std::setw(4) << std::hex << result << std::dec << std::endl;
} }
minimumPeriodThrottleCd.resetTimer();
} else {
consecutiveNoBlockWriteCounter++;
} }
} }
// Try delete in any case, ignore failures (which should not happen), it is more important to // Try delete in any case, ignore failures (which should not happen), it is more important to

View File

@ -10,6 +10,8 @@
#include <mission/com/VirtualChannelWithQueue.h> #include <mission/com/VirtualChannelWithQueue.h>
#include <mission/tmtc/CfdpTmFunnel.h> #include <mission/tmtc/CfdpTmFunnel.h>
#include <mission/tmtc/PusTmFunnel.h> #include <mission/tmtc/PusTmFunnel.h>
#include <cstdint>
#include "eive/definitions.h"
class LiveTmTask : public SystemObject, class LiveTmTask : public SystemObject,
public HasModesIF, public HasModesIF,
@ -35,13 +37,14 @@ class LiveTmTask : public SystemObject,
ModeHelper modeHelper; ModeHelper modeHelper;
Mode_t mode = HasModesIF::MODE_OFF; Mode_t mode = HasModesIF::MODE_OFF;
Countdown tmFunnelCd = Countdown(100); Countdown tmFunnelCd = Countdown(100);
uint32_t consecutiveNoBlockWriteCounter = 0;
PusTmFunnel& pusFunnel; PusTmFunnel& pusFunnel;
CfdpTmFunnel& cfdpFunnel; CfdpTmFunnel& cfdpFunnel;
VirtualChannel& channel; VirtualChannel& channel;
const std::atomic_bool& ptmeLocked; const std::atomic_bool& ptmeLocked;
// This countdown ensures that the CFDP is always throttled with a minimum period. Only after // This countdown ensures that the CFDP is always throttled with a minimum period. Only after
// this period, the CFDP can be released if the channel is not busy. // this period, the CFDP can be released if the channel is not busy.
Countdown minimumPeriodThrottleCd = Countdown(40); Countdown minimumPeriodThrottleCd = Countdown(config::CFDP_THROTTLE_PERIOD_MS);
bool throttlePeriodOngoing = false; bool throttlePeriodOngoing = false;
void readCommandQueue(void); void readCommandQueue(void);