Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/default_cf_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ typedef struct CF_HkSent
uint64 file_data_bytes; /**< \brief Sent File data bytes */
uint32 pdu; /**< \brief Sent PDUs counter */
uint32 nak_segment_requests; /**< \brief Sent NAK segment requests counter */
uint32 files_sent; /**< \brief Files successfully sent counter */
uint8 spare[4]; /**< \brief Alignment spare to avoid implicit padding */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit trailing padding because of 8-byte alignment enforced by the compiler/strictest member being uint64

} CF_HkSent_t;

/**
Expand All @@ -66,6 +68,8 @@ typedef struct CF_HkRecv
*/
uint16 dropped; /**< \brief Received PDUs dropped due to a transaction error */
uint32 nak_segment_requests; /**< \brief Received NAK segment requests counter */
uint32 files_recv; /**< \brief Files successfully received counter */
uint8 spare[4]; /**< \brief Alignment spare to avoid implicit padding */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

} CF_HkRecv_t;

/**
Expand Down
8 changes: 8 additions & 0 deletions cosmos/big_endian/CF/cf_tlm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ TELEMETRY CF HK_TLM_PKT BIG_ENDIAN "CFDP housekeeping Packet"
APPEND_ITEM SENT_FD0 64 UINT "File data bytes sent"
APPEND_ITEM SENT_PDU0 32 UINT "Count of PDUs sent"
APPEND_ITEM SENT_NAK_SR0 32 UINT "Count of sent segment requests"
APPEND_ITEM SENT_FILES0 32 UINT "Count of files successfully sent"
APPEND_ITEM SENT_SPARE0 32 UINT ""
APPEND_ITEM RECV_FD0 64 UINT "File data bytes received"
APPEND_ITEM RECV_PDU0 32 UINT "Count of PDUs received"
APPEND_ITEM RECV_PDU_ERROR0 32 UINT "Count of invalid PDUs received"
APPEND_ITEM RECV_PDU_SPURIOUS0 16 UINT "Count of spurious PDUs received"
APPEND_ITEM RECV_PDU_DROPPED0 16 UINT "Count of dropped PDUs received"
APPEND_ITEM RECV_NAK_SR0 32 UINT "Count of received segment requests"
APPEND_ITEM RECV_FILES0 32 UINT "Count of files successfully received"
APPEND_ITEM RECV_SPARE0 32 UINT ""
APPEND_ITEM FAULT_FILE_OPEN0 16 UINT "Count of file open errors"
APPEND_ITEM FAULT_FILE_READ0 16 UINT "Count of file read errors"
APPEND_ITEM FAULT_FILE_SEEK0 16 UINT "Count of file seek errors"
Expand Down Expand Up @@ -42,12 +46,16 @@ TELEMETRY CF HK_TLM_PKT BIG_ENDIAN "CFDP housekeeping Packet"
APPEND_ITEM SENT_FD1 64 UINT "File data bytes sent"
APPEND_ITEM SENT_PDU1 32 UINT "Count of PDUs sent"
APPEND_ITEM SENT_NAK_SR1 32 UINT "Count of sent segment requests"
APPEND_ITEM SENT_FILES1 32 UINT "Count of files successfully sent"
APPEND_ITEM SENT_SPARE1 32 UINT ""
APPEND_ITEM RECV_FD1 64 UINT "File data bytes received"
APPEND_ITEM RECV_PDU1 32 UINT "Count of PDUs received"
APPEND_ITEM RECV_PDU_ERROR1 32 UINT "Count of invalid PDUs received"
APPEND_ITEM RECV_PDU_SPURIOUS1 16 UINT "Count of spurious PDUs received"
APPEND_ITEM RECV_PDU_DROPPED1 16 UINT "Count of dropped PDUs received"
APPEND_ITEM RECV_NAK_SR1 32 UINT "Count of received segment requests"
APPEND_ITEM RECV_FILES1 32 UINT "Count of files successfully received"
APPEND_ITEM RECV_SPARE1 32 UINT ""
APPEND_ITEM FAULT_FILE_OPEN1 16 UINT "Count of file open errors"
APPEND_ITEM FAULT_FILE_READ1 16 UINT "Count of file read errors"
APPEND_ITEM FAULT_FILE_SEEK1 16 UINT "Count of file seek errors"
Expand Down
8 changes: 8 additions & 0 deletions cosmos/little_endian/CF/cf_tlm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ TELEMETRY CF HK_TLM_PKT LITTLE_ENDIAN "CFDP housekeeping Packet"
APPEND_ITEM SENT_FD0 64 UINT "File data bytes sent"
APPEND_ITEM SENT_PDU0 32 UINT "Count of PDUs sent"
APPEND_ITEM SENT_NAK_SR0 32 UINT "Count of sent segment requests"
APPEND_ITEM SENT_FILES0 32 UINT "Count of files successfully sent"
APPEND_ITEM SENT_SPARE0 32 UINT ""
APPEND_ITEM RECV_FD0 64 UINT "File data bytes received"
APPEND_ITEM RECV_PDU0 32 UINT "Count of PDUs received"
APPEND_ITEM RECV_PDU_ERROR0 32 UINT "Count of invalid PDUs received"
APPEND_ITEM RECV_PDU_SPURIOUS0 16 UINT "Count of spurious PDUs received"
APPEND_ITEM RECV_PDU_DROPPED0 16 UINT "Count of dropped PDUs received"
APPEND_ITEM RECV_NAK_SR0 32 UINT "Count of received segment requests"
APPEND_ITEM RECV_FILES0 32 UINT "Count of files successfully received"
APPEND_ITEM RECV_SPARE0 32 UINT ""
APPEND_ITEM FAULT_FILE_OPEN0 16 UINT "Count of file open errors"
APPEND_ITEM FAULT_FILE_READ0 16 UINT "Count of file read errors"
APPEND_ITEM FAULT_FILE_SEEK0 16 UINT "Count of file seek errors"
Expand Down Expand Up @@ -42,12 +46,16 @@ TELEMETRY CF HK_TLM_PKT LITTLE_ENDIAN "CFDP housekeeping Packet"
APPEND_ITEM SENT_FD1 64 UINT "File data bytes sent"
APPEND_ITEM SENT_PDU1 32 UINT "Count of PDUs sent"
APPEND_ITEM SENT_NAK_SR1 32 UINT "Count of sent segment requests"
APPEND_ITEM SENT_FILES1 32 UINT "Count of files successfully sent"
APPEND_ITEM SENT_SPARE1 32 UINT ""
APPEND_ITEM RECV_FD1 64 UINT "File data bytes received"
APPEND_ITEM RECV_PDU1 32 UINT "Count of PDUs received"
APPEND_ITEM RECV_PDU_ERROR1 32 UINT "Count of invalid PDUs received"
APPEND_ITEM RECV_PDU_SPURIOUS1 16 UINT "Count of spurious PDUs received"
APPEND_ITEM RECV_PDU_DROPPED1 16 UINT "Count of dropped PDUs received"
APPEND_ITEM RECV_NAK_SR1 32 UINT "Count of received segment requests"
APPEND_ITEM RECV_FILES1 32 UINT "Count of files successfully received"
APPEND_ITEM RECV_SPARE1 32 UINT ""
APPEND_ITEM FAULT_FILE_OPEN1 16 UINT "Count of file open errors"
APPEND_ITEM FAULT_FILE_READ1 16 UINT "Count of file read errors"
APPEND_ITEM FAULT_FILE_SEEK1 16 UINT "Count of file seek errors"
Expand Down
4 changes: 3 additions & 1 deletion docs/cf_FunctionalRequirements.csv
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ CF6000,CF6000,"The CF Housekeeping message shall include
11. Number of Inactivity Timer-Limit Faults
12. Number of CRC Mismatch Faults
13. Number of Filestore Rejection Faults (can be split by type)
14. Number of Filesize Mismatch Faults",Operator interface that provides detailed status on operational state
14. Number of Filesize Mismatch Faults
15. Number of Files successfully sent
16. Number of Files successfully received",Operator interface that provides detailed status on operational state
CF6001,CF6001,"The CF End of Transaction message shall include
1. Transaction identifier
2. Channel number
Expand Down
4 changes: 4 additions & 0 deletions eds/cf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
<Entry name="file_data_bytes" type="BASE_TYPES/uint64" shortDescription="Sent file data bytes" />
<Entry name="pdu" type="BASE_TYPES/uint32" shortDescription="Sent PDUs counter" />
<Entry name="nak_segment_requests" type="BASE_TYPES/uint32" shortDescription="Sent NAK segment requests counter" />
<Entry name="files_sent" type="BASE_TYPES/uint32" shortDescription="Files successfully sent counter" />
<PaddingEntry sizeInBits="32" shortDescription="Spare bytes for alignment"/>
</EntryList>
</ContainerDataType>

Expand All @@ -208,6 +210,8 @@
file directive FIN without matching active transaction counter" />
<Entry name="dropped" type="BASE_TYPES/uint16" shortDescription="Received PDUs dropped due to a transaction error" />
<Entry name="nak_segment_requests" type="BASE_TYPES/uint32" shortDescription="Received NAK segment requests counter" />
<Entry name="files_recv" type="BASE_TYPES/uint32" shortDescription="Files successfully received counter" />
<PaddingEntry sizeInBits="32" shortDescription="Spare bytes for alignment"/>
</EntryList>
</ContainerDataType>

Expand Down
5 changes: 5 additions & 0 deletions fsw/src/cf_cfdp_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,11 @@ void CF_CFDP_R_CheckState(CF_Transaction_t *txn)
txn->flags.rx.send_fin = true;
break;
case CF_RxSubState_COMPLETE:
/* only a transaction that reached this point without error received a complete file */
if (CF_CFDP_TxnIsOK(txn))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only care about successful completions so guard against a CRC mismatch, file-size error, or inactivity timeout which all land on this line (CF_RxSubState_COMPLETE)

{
++CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.files_recv;
}
/* This changes the txn state such that this function is no longer called. */
CF_CFDP_FinishTransaction(txn, true);
break;
Expand Down
5 changes: 5 additions & 0 deletions fsw/src/cf_cfdp_s.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,11 @@ void CF_CFDP_S_CheckState(CF_Transaction_t *txn)
txn->flags.tx.send_eof = true;
break;
case CF_TxSubState_COMPLETE:
/* only a transaction that reached this point without error sent a complete file */
if (CF_CFDP_TxnIsOK(txn))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only care about successful completions so guard against read failures, filestore rejections, and NAK/ACK-limit failures which all land on this line (CF_TxSubState_COMPLETE)

{
++CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.sent.files_sent;
}
/* This changes the txn state such that this function is no longer called. */
CF_CFDP_FinishTransaction(txn, true);
break;
Expand Down
6 changes: 6 additions & 0 deletions unit-test/cf_cfdp_r_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1214,10 +1214,13 @@ void Test_CF_CFDP_R_CheckState_FINACK(void)
txn->flags.com.ack_timer_armed = false;
txn->state_data.sub_state = CF_RxSubState_FINACK;
UT_SetDeferredRetcode(UT_KEY(CF_CFDP_CheckAckNakCount), 1, false);
UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_TxnIsOK), true);
UtAssert_VOIDCALL(CF_CFDP_R_CheckState(txn));
UtAssert_UINT8_EQ(txn->state_data.sub_state, CF_RxSubState_COMPLETE);
UtAssert_BOOL_FALSE(txn->flags.rx.send_fin);
UtAssert_STUB_COUNT(CF_CFDP_FinishTransaction, 1);
/* the fin-ack never arrived but the file itself was received without error */
UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.files_recv, 1);

/* FINACK state, R2, fin sent, not acked, inactivity reached */
UT_ResetState(0);
Expand All @@ -1227,10 +1230,13 @@ void Test_CF_CFDP_R_CheckState_FINACK(void)
txn->flags.rx.send_fin = false;
txn->flags.com.inactivity_fired = true;
txn->state_data.sub_state = CF_RxSubState_FINACK;
UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_TxnIsOK), false);
UtAssert_VOIDCALL(CF_CFDP_R_CheckState(txn));
UtAssert_UINT8_EQ(txn->state_data.sub_state, CF_RxSubState_COMPLETE);
UtAssert_BOOL_FALSE(txn->flags.rx.send_fin);
UtAssert_STUB_COUNT(CF_CFDP_FinishTransaction, 1);
/* inactivity is a failure, so the count must remain at the 1 from the prior case */
UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.recv.files_recv, 1);
}

void Test_CF_CFDP_R_CheckState_COMPLETE(void)
Expand Down
14 changes: 14 additions & 0 deletions unit-test/cf_cfdp_s_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1068,11 +1068,25 @@ void Test_CF_CFDP_S_CheckState_FILESTORE(void)
*/
CF_Transaction_t *txn;

/* nominal, transaction reached the end without error */
UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL);
UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_TxnIsOK), true);
txn->state_data.sub_state = CF_TxSubState_FILESTORE;
UtAssert_VOIDCALL(CF_CFDP_S_CheckState(txn));
UtAssert_UINT8_EQ(txn->state_data.sub_state, CF_TxSubState_COMPLETE);
UtAssert_STUB_COUNT(CF_CFDP_FinishTransaction, 1);
UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.sent.files_sent, 1);

/* transaction reached the end in an error state, so no file was successfully sent */
UT_ResetState(0);
UT_CFDP_S_SetupBasicTestState(UT_CF_Setup_NONE, NULL, NULL, NULL, &txn, NULL);
UT_SetDefaultReturnValue(UT_KEY(CF_CFDP_TxnIsOK), false);
txn->state_data.sub_state = CF_TxSubState_FILESTORE;
UtAssert_VOIDCALL(CF_CFDP_S_CheckState(txn));
UtAssert_UINT8_EQ(txn->state_data.sub_state, CF_TxSubState_COMPLETE);
UtAssert_STUB_COUNT(CF_CFDP_FinishTransaction, 1);
/* the error case must not count, so the total remains at the 1 from the prior case */
UtAssert_UINT32_EQ(CF_AppData.hk.Payload.channel_hk[txn->chan_num].counters.sent.files_sent, 1);
}

void Test_CF_CFDP_S_CheckState_COMPLETE(void)
Expand Down
18 changes: 12 additions & 6 deletions unit-test/cf_cmd_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void Test_CF_ResetCountersCmd_tests_WhenCommandByteIs_fault_ResetAllHkFaultCount
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.fault.inactivity_timer);
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.fault,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.fault),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.fault),
"fault channel %d was completely cleared to 0",
i);
}
Expand Down Expand Up @@ -295,6 +295,7 @@ void Test_CF_ResetCountersCmd_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountS
CF_AppData.hk.Payload.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.files_recv = Any_uint32_Except(0);
}

CF_AppData.hk.Payload.counters.cmd = initial_hk_cmd_counter;
Expand All @@ -314,9 +315,10 @@ void Test_CF_ResetCountersCmd_tests_WhenCommandByteIs_up_AndResetAllHkRecvCountS
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.recv.spurious);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.recv.pdu);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.recv.nak_segment_requests);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.recv.files_recv);
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.recv,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.recv),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.recv),
"recv channel %d was completely cleared to 0",
i);
}
Expand All @@ -341,6 +343,7 @@ void Test_CF_ResetCountersCmd_tests_SWhenCommandByteIs_down_AndResetAllHkSentCou
CF_AppData.hk.Payload.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.files_sent = Any_uint32_Except(0);
}

CF_AppData.hk.Payload.counters.cmd = initial_hk_cmd_counter;
Expand All @@ -357,9 +360,10 @@ void Test_CF_ResetCountersCmd_tests_SWhenCommandByteIs_down_AndResetAllHkSentCou
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.sent.file_data_bytes);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.sent.nak_segment_requests);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.sent.pdu);
UtAssert_ZERO(CF_AppData.hk.Payload.channel_hk[i].counters.sent.files_sent);
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.sent,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.sent),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.sent),
"sent channel %d was completely cleared to 0",
i);
}
Expand Down Expand Up @@ -404,13 +408,15 @@ void Test_CF_ResetCountersCmd_tests_WhenCommandByteIs_all_AndResetAllMemValuesSe
CF_AppData.hk.Payload.channel_hk[i].counters.recv.spurious = Any_uint16_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.dropped = Any_uint16_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.nak_segment_requests = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.recv.files_recv = Any_uint32_Except(0);
}

for (i = 0; i < CF_NUM_CHANNELS; ++i)
{
CF_AppData.hk.Payload.channel_hk[i].counters.sent.file_data_bytes = Any_uint64_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.nak_segment_requests = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.pdu = Any_uint32_Except(0);
CF_AppData.hk.Payload.channel_hk[i].counters.sent.files_sent = Any_uint32_Except(0);
}

/* Act */
Expand All @@ -426,23 +432,23 @@ void Test_CF_ResetCountersCmd_tests_WhenCommandByteIs_all_AndResetAllMemValuesSe
{
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.fault,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.fault),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.fault),
"fault channel %d was completely cleared to 0",
i);
}
for (i = 0; i < CF_NUM_CHANNELS; ++i)
{
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.recv,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.recv),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.recv),
"recv channel %d was completely cleared to 0",
i);
}
for (i = 0; i < CF_NUM_CHANNELS; ++i)
{
UtAssert_MemCmpValue(&CF_AppData.hk.Payload.channel_hk[i].counters.sent,
0,
sizeof(&CF_AppData.hk.Payload.channel_hk[i].counters.sent),
sizeof(CF_AppData.hk.Payload.channel_hk[i].counters.sent),
"sent channel %d was completely cleared to 0",
i);
}
Expand Down
Loading