MX Foundation 4
Error Detection

Raw mode

In raw mode, all received frames are available to the calling application. Detected errors will be reported in the MXF_A664_DATAREC.control field. Detected errors are physical errors. Protocol error check (MAC/IP/UDP) is not performed.

COM/SAP Port

In this mode, by default, errors are silently discarded and statistics counters can be used to monitor the count of different errors.

The KMXF_A664_RAW_RX_ERROR_ONLY attribute can also be used so that erroneous frames are enqueued in the physical port for analysis. In that case, acquisition must be started on both COM/SAP port and physical port. Detected errors will be reported in the MXF_A664_DATAREC.control and MXF_A664_DATAREC.service.rxAcq.rxError fields of records received with the physical port buffer handle. Discarded frame duplicate is not considered as an error, so will not be enqueued in the raw port.

Another technique is to register an asynchronous event handler callback that will be called when an error is detected.

Async Event Error Callback

The error detection mechanism allows any receive protocol stack error and events to be reported to a calling application.
With COM/SAP port, a receive error can be detected on any layer of the stack depending of the frame type received;
COM/SAP Layer, VL Layer, IP/UDP Layer, EDE Boeing Layer, Physical Ports Layer.

The errors are reported to an application by setting a callback function handler used to identify the source of the trap, analyze the status of the error, and process it (recovery) if necessary.
Detecting errors on a channel is made in two steps;

  • The function mxfAsyncEventHandlerInit() must be called to define an asynchronous error handler for processing the error.
  • The function mxfAsyncEventConditionsSet() must specify the condID MXF_ASYNCEVENT_COND_RX_ERROR.
    Typically, when an error is detected on a COM/SAP port, the data is discarded because it cannot be forwarded to the upper layer.

In this case any pending read completes normally (rc=0, records read=0). The handler can receive one or more events with a list of structures containing, for each error, the information about the COM/SAP port and the associated VL and Physical Port handle.
The error status specifies the error or event type that occurred.
The example below shows the basic setup for receiving errors with the handler.

Example

ar664_error_injection_detection.c

...
// Define RX Error(s) 0 conditions to trap; register the handler.
if (!rc)
{
rc = mxfAsyncEventHandlerInit(server, &asyncEventHandler, NULL, &asyncEvent);
}
if (!rc)
{
memset(&asyncEventInfoRx, 0, sizeof(asyncEventInfoRx));
asyncEventInfoRx.condID = MXF_ASYNCEVENT_COND_RX_ERROR;
asyncEventInfoRx.condition.rxErr.channel = portRx;
rc = mxfAsyncEventConditionsSet(asyncEvent, VMXF_ENABLE, 1, &asyncEventInfoRx);
}
...
uint32 asyncEventHandler(HMXF_ASYNCEVENT asyncEvent, void *param)
{
HMXF_PORT port;
HMXF_VL vl;
MXF_ASYNCEVENT_PENDING_INFO pendingList[256];
uint64 status, phyPort;
uint64 index, pendingCnt;
char buffer[64];
uint32 rc = MAXT_SUCCESS;
rc = mxfAsyncEventPendingGet(asyncEvent, sizeof(pendingList) / sizeof(pendingList[0]), &pendingCnt, pendingList);
for (index = 0; index<pendingCnt && !rc; index++)
{
switch (pendingList[index].condID)
{
case MXF_ASYNCEVENT_COND_RX_ERROR:
{
status = pendingList[index].condition.rxErr.status;
printf("RX ERR -> status (0x%llx)\n", status);
port = pendingList[index].condition.rxErr.channel;
phyPort = pendingList[index].condition.rxErr.msg.a664.phyPort;
vl = pendingList[index].condition.rxErr.msg.a664.vl;
printf(" PORT Handle=0x%llx, VL Handle=0x%llx, Interface#=%llx\n\n", port, vl, phyPort);
break;
}
default:
printf("Unexpected Event Condition received\n");
break;
}
}
fflush(stdout);
return rc;
}



Statistics

Statistics can be used to get a quick overview of the bus operation. Detected errors are reported for the various layers of statistics. Also, errors for completely invalid packet that can't be given to the application will be logged.

The following statistics are available:

STRUCTURE Description
MXF_A664_STAT_PORT_TX COM/SAP Tx Port Statistics
MXF_A664_STAT_PORT_RX COM/SAP Rx Port Statistics
MXF_A664_STAT_VL_TX Virtual Link Tx Statistics
MXF_A664_STAT_VL_RX Virtual Link Rx Statistics
MXF_A664_STAT_VL_RX_EDE_REDUNDANCY EDE RM statistics for an AFDX port
MXF_A664_STAT_VL_RX_MAC_REDUNDANCY MAC RM statistics for an AFDX port
MXF_A664_STAT_IP IP statistics for a physical port
MXF_A664_STAT_UDP UDP statistics for a physical port
MXF_A664_STAT_MAC_RX MAC statistics for a physical port

Refer to the mxfChannelStatisticGet() function for more details;

Updated 10/23/2023