diff --git a/common/JfjochTCP.h b/common/JfjochTCP.h index 3ee50967..268adc66 100644 --- a/common/JfjochTCP.h +++ b/common/JfjochTCP.h @@ -47,6 +47,6 @@ struct alignas(64) TcpFrameHeader { uint32_t ack_processed_images = 0; uint16_t ack_code = 0; uint16_t ack_for = 0; - - uint64_t reserved[2] = {0, 0}; + uint64_t ack_fifo_occupancy = 0; + uint64_t reserved = 0; }; \ No newline at end of file diff --git a/docs/IMAGE_STREAM.md b/docs/IMAGE_STREAM.md index ac7c1161..fc2b369f 100644 --- a/docs/IMAGE_STREAM.md +++ b/docs/IMAGE_STREAM.md @@ -125,20 +125,21 @@ On Linux, large payload transmission (`DATA` and `CALIBRATION` frames) can use k #### TCP frame header (`TcpFrameHeader`) -| Field | Type | Description | -|---|---|---| -| `magic` | `uint32_t` | Protocol magic (`0x4A464A54`, `"JFJT"`) | -| `version` | `uint16_t` | Protocol version (`2`) | -| `type` | `uint16_t` | Frame type (see table above) | -| `image_number` | `uint64_t` | Image index for `DATA` frames | -| `payload_size` | `uint64_t` | Number of payload bytes after header | -| `socket_number` | `uint32_t` | Connection index in split-stream mode | -| `flags` | `uint32_t` | ACK flags (`OK`, `FATAL`, `HAS_ERROR_TEXT`) | -| `run_number` | `uint64_t` | Run identifier | -| `ack_processed_images` | `uint32_t` | In `ACK`: number of images processed by receiver | -| `ack_code` | `uint16_t` | In `ACK`: error/status code | -| `ack_for` | `uint16_t` | In `ACK`: frame type being acknowledged | -| `reserved` | `uint64_t[2]` | Reserved, set to `0` | +| Field | Type | Description | +|------------------------|---|----------------------------------------------------------| +| `magic` | `uint32_t` | Protocol magic (`0x4A464A54`, `"JFJT"`) | +| `version` | `uint16_t` | Protocol version (`2`) | +| `type` | `uint16_t` | Frame type (see table above) | +| `image_number` | `uint64_t` | Image index for `DATA` frames | +| `payload_size` | `uint64_t` | Number of payload bytes after header | +| `socket_number` | `uint32_t` | Connection index in split-stream mode | +| `flags` | `uint32_t` | ACK flags (`OK`, `FATAL`, `HAS_ERROR_TEXT`) | +| `run_number` | `uint64_t` | Run identifier | +| `ack_processed_images` | `uint32_t` | In `ACK`: number of images processed by receiver | +| `ack_code` | `uint16_t` | In `ACK`: error/status code | +| `ack_for` | `uint16_t` | In `ACK`: frame type being acknowledged | +| `ack_fifo_occupancy` | `uint16_t` | In `ACK`: occupancy of input FIFO in the `jfjoch_writer` | +| `reserved` | `uint64_t` | Reserved, set to `0` | The header is 64-byte aligned (`alignas(64)`). diff --git a/image_puller/TCPImagePuller.cpp b/image_puller/TCPImagePuller.cpp index ecaa2162..0077b051 100644 --- a/image_puller/TCPImagePuller.cpp +++ b/image_puller/TCPImagePuller.cpp @@ -108,6 +108,7 @@ bool TCPImagePuller::SendAck(const PullerAckMessage &ack) { h.ack_processed_images = ack.processed_images; h.ack_code = static_cast(ack.error_code); h.payload_size = ack.error_text.size(); + h.ack_fifo_occupancy = cbor_fifo.GetCurrentUtilization(); if (!SendAll(&h, sizeof(h))) return false;