dsp: base: Omit checksum for Multipart receive ACKNOWLEDGE_COMPLETION
This fix is based on DSP0240 v1.2.0 section 9.6.6, Table 17
DataIntegrityChecksum property description.
DataIntegrityChecksum property should be there unless the
response TransferFlag property is ACKNOWLEDGE_COMPLETION
This patch fixes the issue where DataIntegrityChecksum is only
included if the TransferFlag is PLDM_END or PLDM_START_AND_END
Change-Id: I6d715d21d9d9d55bbda6139108be9cfb288ad209
Fixes: 21a639d6e67d ("dsp: base: Add encode resp for MultipartReceive command")
Signed-off-by: Kasun Athukorala <kasunath@google.com>
diff --git a/src/dsp/base.c b/src/dsp/base.c
index cd4878c..a85beac 100644
--- a/src/dsp/base.c
+++ b/src/dsp/base.c
@@ -684,7 +684,11 @@
PLDM_MSGBUF_RW_DEFINE_P(buf);
int rc;
- if (!msg || !resp || !payload_length || !resp->data.ptr) {
+ if (!msg || !resp || !payload_length) {
+ return -EINVAL;
+ }
+
+ if ((resp->data.length > 0) && !resp->data.ptr) {
return -EINVAL;
}
@@ -729,8 +733,10 @@
return pldm_msgbuf_discard(buf, rc);
}
- if (resp->transfer_flag == PLDM_END ||
- resp->transfer_flag == PLDM_START_AND_END) {
+ // Checksum is present for all data parts except when response transfer flag is
+ // ACKNOWLEDGE_COMPLETION
+ if (resp->transfer_flag !=
+ PLDM_BASE_MULTIPART_RECEIVE_TRANSFER_FLAG_ACK_COMPLETION) {
pldm_msgbuf_insert(buf, checksum);
}