11 Jul, 2016

8 commits

  • When the target needs more time to process the received PDU, it sends
    Response Timeout Extension (RTOX) PDU.

    When the initiator receives a RTOX PDU, it must reply with a RTOX PDU
    and extends the current rwt value with the formula:
    rwt_int = rwt * rtox

    This patch takes care of the rtox value passed by the target in the RTOX
    PDU and extends the timeout for the next response accordingly.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • With this patch, ACK PDU sk_buffs are now freed and code has been
    refactored for better errors handling.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • 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: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     

06 Jul, 2016

7 commits

  • With this patch, the Digital Protocol layer abort the last issued
    command when the dep link goes down. That way it does not have to wait
    for the driver to reply with a timeout error before sending a new
    command (i.e. a start poll command if constant polling is on).

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • There is a flag in the command structure indicating that this command is
    pending. It was checked before sending the command to not send the same
    command twice but it was actually never set. This is now fixed.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • With this patch, when freeing the command queue in the module unregister
    function, the callbacks of the commands still queued are called with a
    ENODEV error. This gives a chance to the command issuer to free any
    memory it could have allocate.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • The Digital Protocol stack used to send a NACK frame whatever the error
    type it receives in digital_in_recv_dep_res(). It actually should only
    send a NACK frame on CRC or parity check errors or on any transmission
    error if a NACK frame was previously sent. Existing drivers used to send
    EIO error for this kind of issues so this patch limits sending of NACK
    frames on EIO errors. All other errors will be reported to the upper
    layers.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • When configured as a target listening for a SENSF_REQ poll command, a
    nfcid2 array was allocated for no reason leading to a memory leak. The
    nfcid2 is sent by the target in the SENSF_RES reply.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • Once copied into the sk_buff data area using llcp_add_tlv(), the
    allocated TLVs must be freed.

    With this patch nfc_llcp_send_connect() and nfc_llcp_send_cc() don't
    return immediately on success and now free the allocated TLVs.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • In functions using llcp_add_tlv(), a skb pointer could be set to NULL
    and then reuse afterward.

    With this patch, the skb pointer returned by llcp_add_tlv() is ignored
    since it can only be the passed skb pointer or NULL when the passed TLV
    is NULL. There is also no need to check for the TLV pointer as this is
    done by llcp_add_tlv().

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     

04 Jul, 2016

3 commits

  • LLCP skb tx and rx functions now use print_hex_dump_debug() making
    these verbose traces controllable using dynamic debug.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • This replaces the polling work struct with a delayed work struct and add
    a 10 ms delay between 2 poll cycles. This avoids to flood the device
    with 'switch off'/'switch on' commands.

    Signed-off-by: Thierry Escande
    Signed-off-by: Samuel Ortiz

    Thierry Escande
     
  • It used to be EXPORTed, but then EXPORT usage was cleaned up
    (in 2012), without noticing that the function has no users at all
    (and curiously, never had any users).

    Delete it.

    While at it, remove non-static "inline" hints on nearby functions:
    these hints don't work across compilation units anyway,
    and these functions are not used in their .c file, thus they are
    never inlined. IOW: "inline" here does not help in any way.

    Signed-off-by: Denys Vlasenko
    CC: Samuel Ortiz
    CC: Christophe Ricard
    CC: linux-wireless@vger.kernel.org
    CC: linux-kernel@vger.kernel.org
    Signed-off-by: Samuel Ortiz

    Denys Vlasenko
     

04 May, 2016

4 commits


20 Mar, 2016

1 commit

  • Pull networking updates from David Miller:
    "Highlights:

    1) Support more Realtek wireless chips, from Jes Sorenson.

    2) New BPF types for per-cpu hash and arrap maps, from Alexei
    Starovoitov.

    3) Make several TCP sysctls per-namespace, from Nikolay Borisov.

    4) Allow the use of SO_REUSEPORT in order to do per-thread processing
    of incoming TCP/UDP connections. The muxing can be done using a
    BPF program which hashes the incoming packet. From Craig Gallek.

    5) Add a multiplexer for TCP streams, to provide a messaged based
    interface. BPF programs can be used to determine the message
    boundaries. From Tom Herbert.

    6) Add 802.1AE MACSEC support, from Sabrina Dubroca.

    7) Avoid factorial complexity when taking down an inetdev interface
    with lots of configured addresses. We were doing things like
    traversing the entire address less for each address removed, and
    flushing the entire netfilter conntrack table for every address as
    well.

    8) Add and use SKB bulk free infrastructure, from Jesper Brouer.

    9) Allow offloading u32 classifiers to hardware, and implement for
    ixgbe, from John Fastabend.

    10) Allow configuring IRQ coalescing parameters on a per-queue basis,
    from Kan Liang.

    11) Extend ethtool so that larger link mode masks can be supported.
    From David Decotigny.

    12) Introduce devlink, which can be used to configure port link types
    (ethernet vs Infiniband, etc.), port splitting, and switch device
    level attributes as a whole. From Jiri Pirko.

    13) Hardware offload support for flower classifiers, from Amir Vadai.

    14) Add "Local Checksum Offload". Basically, for a tunneled packet
    the checksum of the outer header is 'constant' (because with the
    checksum field filled into the inner protocol header, the payload
    of the outer frame checksums to 'zero'), and we can take advantage
    of that in various ways. From Edward Cree"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1548 commits)
    bonding: fix bond_get_stats()
    net: bcmgenet: fix dma api length mismatch
    net/mlx4_core: Fix backward compatibility on VFs
    phy: mdio-thunder: Fix some Kconfig typos
    lan78xx: add ndo_get_stats64
    lan78xx: handle statistics counter rollover
    RDS: TCP: Remove unused constant
    RDS: TCP: Add sysctl tunables for sndbuf/rcvbuf on rds-tcp socket
    net: smc911x: convert pxa dma to dmaengine
    team: remove duplicate set of flag IFF_MULTICAST
    bonding: remove duplicate set of flag IFF_MULTICAST
    net: fix a comment typo
    ethernet: micrel: fix some error codes
    ip_tunnels, bpf: define IP_TUNNEL_OPTS_MAX and use it
    bpf, dst: add and use dst_tclassid helper
    bpf: make skb->tc_classid also readable
    net: mvneta: bm: clarify dependencies
    cls_bpf: reset class and reuse major in da
    ldmvsw: Checkpatch sunvnet.c and sunvnet_common.c
    ldmvsw: Add ldmvsw.c driver code
    ...

    Linus Torvalds
     

25 Feb, 2016

2 commits

  • llcp_sock_getname() checks llcp_sock->dev to make sure
    llcp_sock is already connected or bound, however, we could
    be in the middle of llcp_sock_bind() where llcp_sock->dev
    is bound and llcp_sock->service_name_len is set,
    but llcp_sock->service_name is not, in this case we would
    lead to copy some bytes from a NULL pointer.

    Just lock the sock since this is not a hot path anyway.

    Reported-by: Dmitry Vyukov
    Signed-off-by: Cong Wang
    Signed-off-by: Samuel Ortiz

    Cong Wang
     
  • These two functions are called in sendmsg path, and the
    'len' is passed from user-space, so we should not allow
    malicious users to OOM kernel on purpose.

    Reported-by: Dmitry Vyukov
    Acked-by: Eric Dumazet
    Reviewed-by: Julian Calaby
    Signed-off-by: Cong Wang
    Signed-off-by: Samuel Ortiz

    Cong Wang
     

28 Jan, 2016

1 commit


05 Jan, 2016

1 commit

  • Samuel Ortiz says:

    ====================
    NFC 4.5 pull request

    This is the first NFC pull request for 4.5 and it brings:

    - A new driver for the STMicroelectronics ST95HF NFC chipset.
    The ST95HF is an NFC digital transceiver with an embedded analog
    front-end and as such relies on the Linux NFC digital
    implementation. This is the 3rd user of the NFC digital stack.

    - ACPI support for the ST st-nci and st21nfca drivers.

    - A small improvement for the nfcsim driver, as we can now tune
    the Rx delay through sysfs.

    - A bunch of minor cleanups and small fixes from Christophe Ricard,
    for a few drivers and the NFC core code.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

30 Dec, 2015

4 commits


02 Dec, 2015

1 commit

  • This patch is a cleanup to make following patch easier to
    review.

    Goal is to move SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA
    from (struct socket)->flags to a (struct socket_wq)->flags
    to benefit from RCU protection in sock_wake_async()

    To ease backports, we rename both constants.

    Two new helpers, sk_set_bit(int nr, struct sock *sk)
    and sk_clear_bit(int net, struct sock *sk) are added so that
    following patch can change their implementation.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

28 Oct, 2015

1 commit

  • This fixes a build error that seems to be toochain
    dependent (Not seen with gcc v5.1):

    In file included from net/nfc/nci/rsp.c:36:0:
    net/nfc/nci/rsp.c: In function ‘nci_rsp_packet’:
    include/net/nfc/nci_core.h:355:12: error: inlining failed in call to
    always_inline ‘nci_prop_rsp_packet’: function body not available
    inline int nci_prop_rsp_packet(struct nci_dev *ndev, __u16 opcode,

    Signed-off-by: Robert Dolca
    Signed-off-by: Samuel Ortiz

    Robert Dolca
     

27 Oct, 2015

6 commits

  • In some cases low level drivers might want to update the
    SPI transfer clock (e.g. during firmware download).

    This patch adds this support. Without any modification the
    driver will use the default SPI clock (from pdata or device tree).

    Signed-off-by: Vincent Cuissard
    Signed-off-by: Samuel Ortiz

    Vincent Cuissard
     
  • SPI driver should be a module.

    Signed-off-by: Vincent Cuissard
    Signed-off-by: Samuel Ortiz

    Vincent Cuissard
     
  • Export nci_send_frame and nci_send_cmd symbols to allow drivers
    to use it. This is needed for example if NCI is used during
    firmware download phase.

    Signed-off-by: Vincent Cuissard
    Signed-off-by: Samuel Ortiz

    Vincent Cuissard
     
  • Add support for proprietary commands useful mainly
    for factory testings.

    Here is a list:

    - FACTORY_MODE: Allow to set the driver into a mode where no
    secure element are activated. It does not consider any
    NFC_ATTR_VENDOR_DATA.
    - HCI_CLEAR_ALL_PIPES: Allow to execute a HCI clear all pipes
    command. It does not consider any NFC_ATTR_VENDOR_DATA.
    - HCI_DM_PUT_DATA: Allow to configure specific CLF registry as
    for example RF trimmings or low level drivers configurations
    (I2C, SPI, SWP).
    - HCI_DM_UPDATE_AID: Allow to configure an AID routing into the
    CLF routing table following RF technology, CLF mode or protocol.
    - HCI_DM_GET_INFO: Allow to retrieve CLF information.
    - HCI_DM_GET_DATA: Allow to retrieve CLF configurable data such as
    low level drivers configurations or RF trimmings.
    - HCI_DM_LOAD: Allow to load a firmware into the CLF. A complete
    packet can be more than 8KB.
    - HCI_DM_RESET: Allow to run a CLF reset in order to "commit" CLF
    configuration changes without CLF power off.
    - HCI_GET_PARAM: Allow to retrieve an HCI CLF parameter (for example
    the white list).
    - HCI_DM_FIELD_GENERATOR: Allow to generate different kind of RF
    technology. When using this command to anti-collision is done.
    - HCI_LOOPBACK: Allow to echo a command and test the Dh to CLF
    connectivity.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • Add some few code style fixes.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     
  • In order to manage in a better way the nci poll mode state machine,
    add mode parameter to deactivate_target functions.
    This way we can manage different target state.
    mode parameter make sense only in nci core.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard
     

26 Oct, 2015

1 commit

  • Some gates might need to have their pipes explicitly created.
    Add a call to nci_hci_create_pipe in nci_hci_connect_gate for
    every gate that is different than NCI_HCI_LINK_MGMT_GATE or
    NCI_HCI_ADMIN_GATE.

    In case of an error when opening a pipe, like in hci layer,
    delete the pipe if it was created.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz

    Christophe Ricard