1. 11 Jul, 2016 2 commits
    • Thierry Escande's avatar
      NFC: digital: Add support for NFC DEP Response Waiting Time · 1a09c56f
      Thierry Escande authored
      When sending an ATR_REQ, the initiator must wait for the ATR_RES at
      least 'RWT(nfcdep,activation) + dRWT(nfcdep)' and no more than
      'RWT(nfcdep,activation) + dRWT(nfcdep) + dT(nfcdep,initiator)'. This
      gives a timeout value between 1237 ms and 1337 ms. This patch defines
      DIGITAL_ATR_RES_RWT to 1337 used for the timeout value of ATR_REQ
      command.
      
      For other DEP PDUs, the initiator must wait between 'RWT + dRWT(nfcdep)'
      and 'RWT + dRWT(nfcdep) + dT(nfcdep,initiator)' where RWT is given by
      the following formula: '(256 * 16 / f(c)) * 2^wt' where wt is the value
      of the TO field in the ATR_RES response and is in the range between 0
      and 14. This patch declares a mapping table for wt values and gives RWT
      max values between 100 ms and 5049 ms.
      
      This patch also defines DIGITAL_ATR_RES_TO_WT, the maximum wt value in
      target mode, to 8.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      1a09c56f
    • Thierry Escande's avatar
      NFC: digital: Free supervisor PDUs · e200f008
      Thierry Escande authored
      This patch frees the RTOX resp sk_buff in initiator mode. It also makes
      use of the free_resp exit point for ATN supervisor PDUs in both
      initiator and target mode.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      e200f008
  2. 10 Jul, 2016 5 commits
    • Thierry Escande's avatar
      NFC: digital: Rework ACK PDU handling in initiator mode · e073eb67
      Thierry Escande authored
      With this patch, ACK PDU sk_buffs are now freed and code has been
      refactored for better errors handling.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      e073eb67
    • Thierry Escande's avatar
      NFC: digital: Fix ACK & NACK PDUs handling in target mode · 482333b2
      Thierry Escande authored
      When the target receives a NACK PDU, it re-sends the last sent PDU.
      
      ACK PDUs are received by the target as a reply from the initiator to
      chained I-PDUs. There are 3 cases to handle:
      - If the target has previously received 1 or more ATN PDUs and the PNI
        in the ACK PDU is equal to the target PNI - 1, then it means that the
        initiator did not received the last issued PDU from the target. In
        this case it re-sends this PDU.
      - If the target has received 1 or more ATN PDUs but the ACK PNI is not
        the target PNI - 1, then this means that this ACK is the reply of the
        previous chained I-PDU sent by the target. The target did not received
        it on the first attempt and it is being re-sent by the initiator. The
        process continues as usual.
      - No ATN PDU received before this ACK PDU. This is the reply of a
        chained I-PDU. The target keeps on processing its chained I-PDU.
      
      The code has been refactored to avoid too many indentation levels.
      
      Also, ACK and NACK PDUs were not freed. This is now fixed.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      482333b2
    • 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
    • Thierry Escande's avatar
      NFC: digital: Remove useless call to skb_reserve() · e8e7f421
      Thierry Escande authored
      When allocating chained I-PDUs, there is no need to call skb_reserve()
      since it's already done by digital_alloc_skb() and contains enough room
      for the driver head and tail data.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      e8e7f421
    • Thierry Escande's avatar
      NFC: digital: Fix handling of saved PDU sk_buff pointers · 1d984c2e
      Thierry Escande authored
      This patch fixes the way an I-PDU is saved in case it needs to be sent
      again. It is now copied using pskb_copy() and not simply referenced
      using skb_get() since it could be modified by the driver.
      
      digital_in_send_saved_skb() and digital_tg_send_saved_skb() still get a
      reference on the saved skb which is re-sent but release it if the send
      operation fails. That way the caller doesn't have to take care about skb
      ref in case of error.
      
      RTOX supervisor PDU must not be saved as this can override a previously
      saved I-PDU that should be re-sent later on.
      Signed-off-by: default avatarThierry Escande <thierry.escande@collabora.com>
      Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
      1d984c2e
  3. 06 Jul, 2016 12 commits
  4. 04 Jul, 2016 9 commits
  5. 02 Jul, 2016 12 commits