Skip to contentSkip to conversation

Add nci suit and virtual nci device driver

PATCH Applied Bongsu Jeon 2 participants 4 messages Jan 27, 2021 – Jan 30, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v4 cover Add nci suit and virtual nci device driver

From: Bongsu Jeon <[email protected]>

1/2 is the Virtual NCI device driver.
2/2 is the NCI selftest suite

v4:
1/2
- flip the condition for the ioctl.
- refactor some code.
- remove the unused function after refactoring.
v3:
1/2
- change the Kconfig help comment.
- remove the mutex init code.
- remove the unnecessary mutex(nci_send_mutex).
- remove the full_txbuff.
- add the code to release skb@error case.
- refactor some code.
v2:
1/2
- change the permission of the Virtual NCI device.
- add the ioctl to find the nci device index. 2/2
- add the NCI selftest suite.

Bongsu Jeon (2):
nfc: Add a virtual nci device driver
selftests: Add nci suite

 MAINTAINERS                           |   8 +
 drivers/nfc/Kconfig                   |  11 +
 drivers/nfc/Makefile                  |   1 +
 drivers/nfc/virtual_ncidev.c          | 215 +++++++++
 tools/testing/selftests/Makefile      |   1 +
 tools/testing/selftests/nci/Makefile  |   6 +
 tools/testing/selftests/nci/config    |   3 +
 tools/testing/selftests/nci/nci_dev.c | 599 ++++++++++++++++++++++++++
 8 files changed, 844 insertions(+)
 create mode 100644 drivers/nfc/virtual_ncidev.c
 create mode 100644 tools/testing/selftests/nci/Makefile
 create mode 100644 tools/testing/selftests/nci/config
 create mode 100644 tools/testing/selftests/nci/nci_dev.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/2 nfc: Add a virtual nci device driver

From: Bongsu Jeon <[email protected]>

NCI virtual device simulates a NCI device to the user. It can be used to validate the NCI module and applications. This driver supports communication between the virtual NCI device and NCI module.

---
 drivers/nfc/Kconfig          |  11 ++
 drivers/nfc/Makefile         |   1 +
 drivers/nfc/virtual_ncidev.c | 215 +++++++++++++++++++++++++++++++++++
 3 files changed, 227 insertions(+)
 create mode 100644 drivers/nfc/virtual_ncidev.c
drivers/nfc/Kconfig +11 -0
index 75c65d339018..288c6f1c6979 100644
@@ -49,6 +49,17 @@ config NFC_PORT100
 
 	  If unsure, say N.
 
+config NFC_VIRTUAL_NCI
+	tristate "NCI device simulator driver"
+	depends on NFC_NCI
+	help
+	  NCI virtual device simulates a NCI device to the user.
+	  It can be used to validate the NCI module and applications.
+	  This driver supports communication between the virtual NCI device and
+	  module.
+
+	  If unsure, say N.
+
 source "drivers/nfc/fdp/Kconfig"
 source "drivers/nfc/pn544/Kconfig"
 source "drivers/nfc/pn533/Kconfig"
drivers/nfc/Makefile +1 -0
index 5393ba59b17d..7b1bfde1d971 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_NFC_ST_NCI)	+= st-nci/
 obj-$(CONFIG_NFC_NXP_NCI)	+= nxp-nci/
 obj-$(CONFIG_NFC_S3FWRN5)	+= s3fwrn5/
 obj-$(CONFIG_NFC_ST95HF)	+= st95hf/
+obj-$(CONFIG_NFC_VIRTUAL_NCI)	+= virtual_ncidev.o
drivers/nfc/virtual_ncidev.c new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 2/2 selftests: Add nci suite

In reply to Bongsu Jeon

From: Bongsu Jeon <[email protected]>

This is the NCI test suite. It tests the NFC/NCI module using virtual NCI device. Test cases consist of making the virtual NCI device on/off and controlling the device's polling for NCI1.0 and NCI2.0 version.

---
 MAINTAINERS                           |   8 +
 tools/testing/selftests/Makefile      |   1 +
 tools/testing/selftests/nci/Makefile  |   6 +
 tools/testing/selftests/nci/config    |   3 +
 tools/testing/selftests/nci/nci_dev.c | 599 ++++++++++++++++++++++++++
 5 files changed, 617 insertions(+)
 create mode 100644 tools/testing/selftests/nci/Makefile
 create mode 100644 tools/testing/selftests/nci/config
 create mode 100644 tools/testing/selftests/nci/nci_dev.c
MAINTAINERS +8 -0
index 096b584e7fed..b62832e39e2a 100644
@@ -12531,6 +12531,14 @@ F:	include/net/nfc/
 F:	include/uapi/linux/nfc.h
 F:	net/nfc/
 
+NFC VIRTUAL NCI DEVICE DRIVER
+M:	Bongsu Jeon <[email protected]>
+L:	[email protected]
+L:	[email protected] (moderated for non-subscribers)
+S:	Supported
+F:	drivers/nfc/virtual_ncidev.c
+F:	tools/testing/selftests/nci/
+
 NFS, SUNRPC, AND LOCKD CLIENTS
 M:	Trond Myklebust <[email protected]>
 M:	Anna Schumaker <[email protected]>
tools/testing/selftests/Makefile +1 -0
index 8a917cb4426a..c42aacec5038 100644
@@ -34,6 +34,7 @@ TARGETS += memory-hotplug
 TARGETS += mincore
 TARGETS += mount
 TARGETS += mqueue
+TARGETS += nci
 TARGETS += net
 TARGETS += net/forwarding
 TARGETS += net/mptcp
tools/testing/selftests/nci/Makefile new file +6 -0
new file mode 100644
index 000000000000..47669a1d6a59
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+CFLAGS += -Wl,-no-as-needed -Wall
+LDFLAGS += -lpthread
+
+TEST_GEN_PROGS := nci_dev
+include ../lib.mk
tools/testing/selftests/nci/config new file +3 -0
new file mode 100644
index 000000000000..b084e78276be
@@ -0,0 +1,3 @@
+CONFIG_NFC=y
+CONFIG_NFC_NCI=y
+CONFIG_NFC_VIRTUAL_NCI=y
tools/testing/selftests/nci/nci_dev.c new file +599 -0

599 lines not on this page · raw message

Signature · 1 line
2.25.1
#3 lore raw
In reply to Bongsu Jeon
This series was applied to netdev/net-next.git (refs/heads/master):

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

Quoted 25 lines · On Wed, 27 Jan 2021 22:08:27 +0900 you wrote:

From: Bongsu Jeon <[email protected]>

1/2 is the Virtual NCI device driver.
2/2 is the NCI selftest suite

v4:
1/2
- flip the condition for the ioctl.
- refactor some code.
- remove the unused function after refactoring.
v3:
1/2
- change the Kconfig help comment.
- remove the mutex init code.
- remove the unnecessary mutex(nci_send_mutex).
- remove the full_txbuff.
- add the code to release skb at error case.
- refactor some code.
v2:
1/2
- change the permission of the Virtual NCI device.
- add the ioctl to find the nci device index. 2/2
- add the NCI selftest suite.

Quoted 1 line

[...]

Here is the summary with links:
- [net-next,v4,1/2] nfc: Add a virtual nci device driver

    https://git.kernel.org/netdev/net-next/c/e624e6c3e777
  - [net-next,v4,2/2] selftests: Add nci suite
    https://git.kernel.org/netdev/net-next/c/f595cf1242f3

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html