• Thierry Escande's avatar
    NFC: digital: Fix target DEP_REQ I-PDU handling after ATN PDU · f23a9868
    Thierry Escande authored
    When the initiator sends a DEP_REQ I-PDU, the target device may not
    reply in a timely manner. In this case the initiator device must send an
    attention PDU (ATN) and if the recipient replies with an ATN PDU in
    return, then the last I-PDU must be sent again by the initiator.
    
    This patch fixes how the target handles I-PDU received after an ATN PDU
    has been received.
    
    There are 2 possible cases:
    - The target has received the initial DEP_REQ and sends back the DEP_RES
      but the initiator did not receive it. In this case, after the
      initiator has sent an ATN PDU and the target replied it (with an ATN
      as well), the initiator sends the saved skb of the initial DEP_REQ
      again and the target replies with the saved skb of the initial
      DEP_RES.
    - Or the target did not even received the initial DEP_REQ. In this case,
      after the ATN PDUs exchange, the initiator sends the saved skb and the
      target simply passes it up, just as usual.
    
    This behavior is controlled using the atn_count and the PNI field of the
    digital device structure.
    Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
    Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
    f23a9868
digital_dep.c 32.7 KB