Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for enqueue/dequeue errors #1120

Merged
merged 4 commits into from
Jan 12, 2024
Merged

Commits on Jan 12, 2024

  1. local: mmap: Decouple mask of enqueued/dequeued blocks

    We need one mask to know whether a block has been enqueued (bit set) or
    dequeued (bit clear) from the kernel interface, and one flag to know
    whether the libiio application already tried to enqueue or dequeue the
    block.
    
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    pcercuei committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    7592b76 View commit details
    Browse the repository at this point in the history
  2. iiod-client: Send block dequeue request when previous one failed

    The IIOD_OP_TRANSFER_BLOCK command would atomically enqueue then dequeue
    the given block. The problem with that, was that on error it was not
    possible to know which of the two operations was the cause of the error.
    
    Change this by encoding the return value in a way that we can deduce
    which of the two operations failed.
    
    Then, if the enqueue failed, the block will be marked as not enqueued,
    and can be enqueued again. If the dequeue failed, the block is still
    marked as enqueued, and the next dequeue attempt will see the use of the
    IIOD_OP_RETRY_DEQUEUE_BLOCK command, which will only dequeue the block.
    
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    pcercuei committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    e44eb56 View commit details
    Browse the repository at this point in the history
  3. iiod: responder: Differentiate enqueue/dequeue errors in return code

    When handling the IIOD_OP_TRANSFER_BLOCK, we need a way to tell the
    client which one of the two operations (enqueue or dequeue) failed.
    
    Do that by shifting left the error code by 16 bits if the enqueue
    failed, and by not shifting the value if the dequeue failed.
    
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    pcercuei committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    17140e7 View commit details
    Browse the repository at this point in the history
  4. iiod: Add support for IIOD_OP_RETRY_DEQUEUE_BLOCK command

    During a previous IIOD_OP_TRANSFER_BLOCK command, if the enqueue
    succeeded but dequeue failed, the client cannot send the same command
    again, as it would try to enqueue again. Instead, it will send a
    IIOD_RETRY_DEQUEUE_BLOCK, which will only attempt to dequeue the block.
    
    Signed-off-by: Paul Cercueil <paul@crapouillou.net>
    pcercuei committed Jan 12, 2024
    Configuration menu
    Copy the full SHA
    b6576dc View commit details
    Browse the repository at this point in the history