TCP: Send FIFO max size (though not exposed at the moment)

This commit is contained in:
2026-03-05 20:26:46 +01:00
parent 1758417702
commit a53635b1ac
3 changed files with 17 additions and 16 deletions

View File

@@ -48,5 +48,5 @@ struct alignas(64) TcpFrameHeader {
uint16_t ack_code = 0;
uint16_t ack_for = 0;
uint64_t ack_fifo_occupancy = 0;
uint64_t reserved = 0;
uint64_t ack_fifo_max_occupancy = 0;
};

View File

@@ -125,21 +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 |
| `ack_fifo_occupancy` | `uint16_t` | In `ACK`: occupancy of input FIFO in the `jfjoch_writer` |
| `reserved` | `uint64_t` | 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` |
| `ack_fifo_max_occupancy` | `uint64_t` | In `ACK`: max occupancy of input FIFO |
The header is 64-byte aligned (`alignas(64)`).

View File

@@ -109,6 +109,7 @@ bool TCPImagePuller::SendAck(const PullerAckMessage &ack) {
h.ack_code = static_cast<uint32_t>(ack.error_code);
h.payload_size = ack.error_text.size();
h.ack_fifo_occupancy = cbor_fifo.GetCurrentUtilization();
h.ack_fifo_max_occupancy = cbor_fifo.Size();
if (!SendAll(&h, sizeof(h)))
return false;