MX Foundation 4
Error Injection

Raw mode

Error injection with raw mode allows to modify default transmission behaviour and to alter transmission.

By default, only the MAC CRC, MAC NetID and IP checksum will be computed before transmission. To modify this, use respectively MXF_A664_CTRL_TX_RAW_MAC_CRC32_INCLUDED, MXF_A664_CTRL_TX_RAW_MAC_NETID_INCLUDED and MXF_A664_CTRL_TX_RAW_IP_CHECKSUM_INCLUDED bits in MXF_A664_DATAREC.control field.

Transmission can also be altered by using an error index set with mxfA664ErrorInjectionSet() in MXF_A664_DATAREC.service.txAperiodic.errorIndex.

Example

The code below demonstrates how to setup transmission to supply own MAC CRC.

...
// Build the Transmit Records.
for (recordIdx = 0, data = txRec; recordIdx < maxTxRecords && !rc; recordIdx++)
{
// Every two records inject one invalid record
data->control = MXF_A664_CTRL_TX_RAW_MAC_CRC32_INCLUDED;
data->dataSize = TEST_DATASIZE;
data->repeatCount = 1;
for (dataIdx = 0; dataIdx < TEST_DATASIZE; dataIdx++)
data->data[dataIdx] = (uint8) dataIdx;
rc = mxfA664NextDataRecordPtrGet(data, &data);
}
// Transmit the data
if (!rc)
{
rc = mxfA664TxAperiodicWrite(txBuffer, MXF_TXAPERIODIC_FLAG_DEFAULT, 0, maxTxRecords, txRec, &count);
printf("%llu frames transmitted\n\n", count);
}

COM/SAP mode

Error injection with COM/SAP mode allows to modify default transmission behaviour and to alter transmission.

Transmission can be altered by using an error index set with mxfA664ErrorInjectionSet() in MXF_A664_DATAREC.service.txAperiodic.errorIndex or MXF_A664_DATAREC.service.txPeriodicUpdateMsg.errorIndex.

Example

The code below demonstrates how to setup a basic error injection (MAC CRC error on port A).

...
// Set TX Error Injection to apply
if (!rc)
{
memset(&error, 0, sizeof(error));
error.port = MXF_A664_NETSELECT_A;
error.fragmentOffset = -1;
error.error[0].id = MXF_A664_ERRORID_VL_MAC_CRC32_ERROR;
rc = mxfA664ErrorInjectionSet(portTx, 0, &error);
}
...
// Build the Transmit Records.
for (recordIdx = 0, data = txRec; recordIdx < maxTxRecords && !rc; recordIdx++)
{
// Every two records inject one invalid record
data->control = recordIdx % 2 ? 0 : MXF_A664_TX_REC_CTRL_ERROR_INJ;
data->service.txAperiodic.errorIndex = 0;
data->dataSize = TEST_DATASIZE;
data->repeatCount = 1;
for (dataIdx = 0; dataIdx < TEST_DATASIZE; dataIdx++)
data->data[dataIdx] = (uint8) dataIdx;
rc = mxfA664NextDataRecordPtrGet(data, &data);
}
// Transmit the data
if (!rc)
{
rc = mxfA664TxAperiodicWrite(portTx, MXF_TXAPERIODIC_FLAG_DEFAULT, 0, maxTxRecords, txRec, &count);
printf("%llu frames transmitted\n\n", count);
}
Updated 10/23/2023