10 Dec, 2015

3 commits

  • commit e65917b6d54f8b47d8293ea96adfa604fd46cf0d upstream.

    When receiving data in nci_hci_msg_rx_work, extract pipe
    value using NCI_HCP_MSG_GET_PIPE macro.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz
    Signed-off-by: Greg Kroah-Hartman

    Christophe Ricard
     
  • commit d8cd37ed2fc871c66b4c79c59f651dc2cdf7091c upstream.

    When sending HCI data over NCI, HCI return code is part
    of the NCI data. In order to get correctly the HCI return
    code, we assume the NCI communication is successful and
    extract the return code for the nci_hci functions return code.

    This is done because nci_to_errno does not match hci return
    code value.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz
    Signed-off-by: Greg Kroah-Hartman

    Christophe Ricard
     
  • commit 500c4ef02277eaadbfe20537f963b6221f6ac007 upstream.

    When sending HCI data over NCI, cmd information should be
    present only on the first packet.
    Each packet shall be specifically allocated and sent to the
    NCI layer.

    Signed-off-by: Christophe Ricard
    Signed-off-by: Samuel Ortiz
    Signed-off-by: Greg Kroah-Hartman

    Christophe Ricard
     

30 Sep, 2015

1 commit


14 Apr, 2015

1 commit


26 Mar, 2015

1 commit

  • A simple forward for firmware download (i.e. sending a new firmware
    to the NFC adapter) from the NFC subsystem to the drivers.

    This feature is required to update the firmware of NXP-NCI NFC
    controllers but can be used by any NCI driver.

    This feature has been present in the HCI subsystem since 9a695d.

    Signed-off-by: Clément Perrochaud
    Signed-off-by: Samuel Ortiz

    Clément Perrochaud
     

03 Mar, 2015

1 commit

  • After TIPC doesn't depend on iocb argument in its internal
    implementations of sendmsg() and recvmsg() hooks defined in proto
    structure, no any user is using iocb argument in them at all now.
    Then we can drop the redundant iocb argument completely from kinds of
    implementations of both sendmsg() and recvmsg() in the entire
    networking stack.

    Cc: Christoph Hellwig
    Suggested-by: Al Viro
    Signed-off-by: Ying Xue
    Signed-off-by: David S. Miller

    Ying Xue
     

04 Feb, 2015

5 commits


03 Feb, 2015

8 commits

  • When receiving an interface activation notification, if
    the RF interface is NCI_RF_INTERFACE_NFCEE_DIRECT, we
    need to ignore the following parameters and change the NCI
    state machine to NCI_LISTEN_ACTIVE. According to the NCI
    specification, the parameters should be 0 and shall be
    ignored.

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

    Christophe Ricard
     
  • The NFCC sends an NCI_OP_RF_NFCEE_ACTION_NTF notification
    to the host (DH) to let it know that for example an RF
    transaction with a payment reader is done.
    For now the notification handler is empty.

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

    Christophe Ricard
     
  • NFC_EVT_TRANSACTION is sent through netlink in order for a
    specific application running on a secure element to notify
    userspace of an event. Typically the secure element application
    counterpart on the host could interpret that event and act
    upon it.

    Forwarded information contains:
    - SE host generating the event
    - Application IDentifier doing the operation
    - Applications parameters

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

    Christophe Ricard
     
  • According to the NCI specification, one can use HCI over NCI
    to talk with specific NFCEE. The HCI network is viewed as one
    logical NFCEE.
    This is needed to support secure element running HCI only
    firmwares embedded on an NCI capable chipset, like e.g. the
    st21nfcb.
    There is some duplication between this piece of code and the
    HCI core code, but the latter would need to be abstracted even
    more to be able to use NCI as a logical transport for HCP packets.

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

    Christophe Ricard
     
  • In order to communicate with an NFCEE, we need to open a logical
    connection to it, by sending the NCI_OP_CORE_CONN_CREATE_CMD
    command to the NFCC. It's left up to the drivers to decide when
    to close an already opened logical connection.

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

    Christophe Ricard
     
  • NFCEEs can be enabled or disabled by sending the
    NCI_OP_NFCEE_MODE_SET_CMD command to the NFCC. This patch
    provides an API for drivers to enable and disable e.g. their
    NCI discoveredd secure elements.

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

    Christophe Ricard
     
  • NFCEEs (NFC Execution Environment) have to be explicitly
    discovered by sending the NCI_OP_NFCEE_DISCOVER_CMD
    command. The NFCC will respond to this command by telling
    us how many NFCEEs are connected to it. Then the NFCC sends
    a notification command for each and every NFCEE connected.
    Here we implement support for sending
    NCI_OP_NFCEE_DISCOVER_CMD command, receiving the response
    and the potential notifications.

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

    Christophe Ricard
     
  • The current NCI core only support the RF static connection.
    For other NFC features such as Secure Element communication, we
    may need to create logical connections to the NFCEE (Execution
    Environment.

    In order to track each logical connection ID dynamically, we add a
    linked list of connection info pointers to the nci_dev structure.

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

    Christophe Ricard
     

28 Jan, 2015

6 commits


27 Jan, 2015

2 commits


18 Jan, 2015

1 commit

  • Contrary to common expectations for an "int" return, these functions
    return only a positive value -- if used correctly they cannot even
    return 0 because the message header will necessarily be in the skb.

    This makes the very common pattern of

    if (genlmsg_end(...) < 0) { ... }

    be a whole bunch of dead code. Many places also simply do

    return nlmsg_end(...);

    and the caller is expected to deal with it.

    This also commonly (at least for me) causes errors, because it is very
    common to write

    if (my_function(...))
    /* error condition */

    and if my_function() does "return nlmsg_end()" this is of course wrong.

    Additionally, there's not a single place in the kernel that actually
    needs the message length returned, and if anyone needs it later then
    it'll be very easy to just use skb->len there.

    Remove this, and make the functions void. This removes a bunch of dead
    code as described above. The patch adds lines because I did

    - return nlmsg_end(...);
    + nlmsg_end(...);
    + return 0;

    I could have preserved all the function's return values by returning
    skb->len, but instead I've audited all the places calling the affected
    functions and found that none cared. A few places actually compared
    the return value with < 0 with no change in behaviour, so I opted for the more
    efficient version.

    One instance of the error I've made numerous times now is also present
    in net/phonet/pn_netlink.c in the route_dumpit() function - it didn't
    check for
    Signed-off-by: David S. Miller

    Johannes Berg
     

10 Dec, 2014

1 commit

  • …inville/wireless-next

    John W. Linville says:

    ====================
    pull request: wireless-next 2014-12-08

    Please pull this last batch of pending wireless updates for the 3.19 tree...

    For the wireless bits, Johannes says:

    "This time I have Felix's no-status rate control work, which will allow
    drivers to work better with rate control even if they don't have perfect
    status reporting. In addition to this, a small hwsim fix from Patrik,
    one of the regulatory patches from Arik, and a number of cleanups and
    fixes I did myself.

    Of note is a patch where I disable CFG80211_WEXT so that compatibility
    is no longer selectable - this is intended as a wake-up call for anyone
    who's still using it, and is still easily worked around (it's a one-line
    patch) before we fully remove the code as well in the future."

    For the Bluetooth bits, Johan says:

    "Here's one more bluetooth-next pull request for 3.19:

    - Minor cleanups for ieee802154 & mac802154
    - Fix for the kernel warning with !TASK_RUNNING reported by Kirill A.
    Shutemov
    - Support for another ath3k device
    - Fix for tracking link key based security level
    - Device tree bindings for btmrvl + a state update fix
    - Fix for wrong ACL flags on LE links"

    And...

    "In addition to the previous one this contains two more cleanups to
    mac802154 as well as support for some new HCI features from the
    Bluetooth 4.2 specification.

    From the original request:

    'Here's what should be the last bluetooth-next pull request for 3.19.
    It's rather large but the majority of it is the Low Energy Secure
    Connections feature that's part of the Bluetooth 4.2 specification. The
    specification went public only this week so we couldn't publish the
    corresponding code before that. The code itself can nevertheless be
    considered fairly mature as it's been in development for over 6 months
    and gone through several interoperability test events.

    Besides LE SC the pull request contains an important fix for command
    complete events for mgmt sockets which also fixes some leaks of hci_conn
    objects when powering off or unplugging Bluetooth adapters.

    A smaller feature that's part of the pull request is service discovery
    support. This is like normal device discovery except that devices not
    matching specific UUIDs or strong enough RSSI are filtered out.

    Other changes that the pull request contains are firmware dump support
    to the btmrvl driver, firmware download support for Broadcom BCM20702A0
    variants, as well as some coding style cleanups in 6lowpan &
    ieee802154/mac802154 code.'"

    For the NFC bits, Samuel says:

    "With this one we get:

    - NFC digital improvements for DEP support: Chaining, NACK and ATN
    support added.

    - NCI improvements: Support for p2p target, SE IO operand addition,
    SE operands extensions to support proprietary implementations, and
    a few fixes.

    - NFC HCI improvements: OPEN_PIPE and NOTIFY_ALL_CLEARED support,
    and SE IO operand addition.

    - A bunch of minor improvements and fixes for STMicro st21nfcb and
    st21nfca"

    For the iwlwifi bits, Emmanuel says:

    "Major works are CSA and TDLS. On top of that I have a new
    firmware API for scan and a few rate control improvements.
    Johannes find a few tricks to improve our CPU utilization
    and adds support for a new spin of 7265 called 7265D.
    Along with this a few random things that don't stand out."

    And...

    "I deprecate here -8.ucode since -9 has been published long ago.
    Along with that I have a new activity, we have now better
    a infrastructure for firmware debugging. This will allow to
    have configurable probes insides the firmware.
    Luca continues his work on NetDetect, this feature is now
    complete. All the rest is minor fixes here and there."

    For the Atheros bits, Kalle says:

    "Only ath10k changes this time and no major changes. Most visible are:

    o new debugfs interface for runtime firmware debugging (Yanbo)

    o fix shared WEP (Sujith)

    o don't rebuild whenever kernel version changes (Johannes)

    o lots of refactoring to make it easier to add new hw support (Michal)

    There's also smaller fixes and improvements with no point of listing
    here."

    In addition, there are a few last minute updates to ath5k,
    ath9k, brcmfmac, brcmsmac, mwifiex, rt2x00, rtlwifi, and wil6210.
    Also included is a pull of the wireless tree to pick-up the fixes
    originally included in "pull request: wireless 2014-12-03"...

    Please let me know if there are problems!
    ====================

    Signed-off-by: David S. Miller <davem@davemloft.net>

    David S. Miller
     

03 Dec, 2014

9 commits

  • The maximum size of ATR_REQ and ATR_RES is 64 bytes.
    The maximum number of General Bytes is calculated by
    the maximum number of data bytes in the ATR_REQ/ATR_RES,
    substracted by the number of mandatory data bytes.

    ATR_REQ: 16 mandatory data bytes, giving a maximum of
    48 General Bytes.
    ATR_RES: 17 mandatory data bytes, giving a maximum of
    47 General Bytes.

    Regression introduced in commit a99903ec.

    Signed-off-by: Julien Lefrique
    Signed-off-by: Samuel Ortiz

    Julien Lefrique
     
  • Fixing: net/nfc/nci/ntf.c:106:31: warning: cast to restricted __le16
    message when building with make C=1 CF=-D__CHECK_ENDIAN__

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

    Christophe Ricard
     
  • Fix warnings:
    net/nfc/llcp_commands.c:421:14: warning: incorrect type in assignment (different base types)
    net/nfc/llcp_commands.c:421:14: expected unsigned short [unsigned] [usertype] miux
    net/nfc/llcp_commands.c:421:14: got restricted __be16
    net/nfc/llcp_commands.c:477:14: warning: incorrect type in assignment (different base types)
    net/nfc/llcp_commands.c:477:14: expected unsigned short [unsigned] [usertype] miux
    net/nfc/llcp_commands.c:477:14: got restricted __be16

    Procedure to reproduce:
    make ARCH=x86_64 allmodconfig
    make C=1 CF=-D__CHECK_ENDIAN__

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

    Christophe Ricard
     
  • Some pipe are only created by other host (different than the
    Terminal Host).
    The pipe values will for example be notified by
    NFC_HCI_ADM_NOTIFY_PIPE_CREATED.

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

    Christophe Ricard
     
  • se_io allows to send apdu over the CLF to the embedded
    Secure Element.

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

    Christophe Ricard
     
  • Some tag might get deactivated after some read or write tentative.
    This may happen for example with Mifare Ultralight C tag when trying
    to read the last 4 blocks (starting block 0x2c) configured as write
    only.
    NFC_CMD_ACTIVATE_TARGET will try to reselect the tag in order to
    detect if it got remove from the field or if it is still present.

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

    Christophe Ricard
     
  • nci_rf_deactivate_req only support NCI_DEACTIVATE_TYPE_IDLE_MODE.
    In some situation, it might be necessary to be able to support other
    NCI_DEACTIVATE_TYPE such as NCI_DEACTIVATE_TYPE_SLEEP_MODE in order for
    example to reactivate the selected target.

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

    Christophe Ricard
     
  • A notification for rf deaction can be IDLE_MODE, SLEEP_MODE,
    SLEEP_AF_MODE and DISCOVERY. According to each type and the NCI
    state machine is different (see figure 10 RF Communication State
    Machine in NCI specification)

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

    Christophe Ricard
     
  • The nci status byte was ignored. In case of tag reading for example,
    if the tag is removed from the antenna there is no way for the upper
    layers (aka: stack) to get inform about such event.

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

    Christophe Ricard
     

02 Dec, 2014

1 commit