caif: remove CAIF NETWORK LAYER
Subsystems (6)
Jakub Kicinski
maintainerPATCH 1/1 caif: remove CAIF NETWORK LAYER
Remove CAIF (Communication CPU to Application CPU Interface), the ST-Ericsson modem protocol. The subsystem has been orphaned since 2013. The last meaningful changes from the maintainers were in March 2013:
a8c7687bf216 ("caif_virtio: Check that vringh_config is not null") b2273be8d2df ("caif_virtio: Use vringh_notify_enable correctly") 0d2e1a2926b1 ("caif_virtio: Introduce caif over virtio")
Not-so-coincidentally, according to "the Internet" ST-Ericsson officially shut down its modem joint venture in Aug 2013.
If anyone is using this code please yell!
In the 13 years since, the code has accumulated 200 non-merge commits, of which 71 were cross-tree API changes, 21 carried Fixes: tags, and the remaining ~110 were cleanups, doc conversions, treewide refactors, and one partial removal (caif_hsi, ca75bcf0a83b).
We are still getting fixes to this code, in the last 10 days there were 3 reports on security@ about CAIF that I have been CCed on.
UAPI constants (AF_CAIF, ARPHRD_CAIF, N_CAIF, VIRTIO_ID_CAIF) and the SELinux classmap entry are intentionally kept for ABI stability.
---
I think we should accumulate such patches over the coming days on a separate branch. CAIF is a no-brainer IMO but other removals may be more controversial.
--- MAINTAINERS | 9 - Documentation/networking/caif/caif.rst | 138 -- Documentation/networking/caif/index.rst | 12 - Documentation/networking/caif/linux_caif.rst | 195 --- Documentation/networking/index.rst | 1 - .../translations/zh_CN/networking/index.rst | 1 - drivers/net/Kconfig | 2 - drivers/net/caif/Kconfig | 33 - net/Kconfig | 1 - net/caif/Kconfig | 54 - drivers/net/Makefile | 1 - drivers/net/caif/Makefile | 8 - net/Makefile | 1 - net/caif/Makefile | 16 - include/linux/virtio_caif.h | 24 - include/net/caif/caif_dev.h | 128 -- include/net/caif/caif_device.h | 55 - include/net/caif/caif_layer.h | 277 ---- include/net/caif/cfcnfg.h | 90 -- include/net/caif/cfctrl.h | 130 -- include/net/caif/cffrml.h | 21 - include/net/caif/cfmuxl.h | 20 - include/net/caif/cfpkt.h | 232 ---- include/net/caif/cfserl.h | 13 - include/net/caif/cfsrvl.h | 61 - include/uapi/linux/caif/caif_socket.h | 195 --- include/uapi/linux/caif/if_caif.h | 35 - drivers/net/caif/caif_serial.c | 443 ------- drivers/net/caif/caif_virtio.c | 791 ------------ net/caif/caif_dev.c | 586 --------- net/caif/caif_socket.c | 1114 ----------------- net/caif/caif_usb.c | 216 ---- net/caif/cfcnfg.c | 612 --------- net/caif/cfctrl.c | 631 ---------- net/caif/cfdbgl.c | 55 - net/caif/cfdgml.c | 113 -- net/caif/cffrml.c | 204 --- net/caif/cfmuxl.c | 267 ---- net/caif/cfpkt_skbuff.c | 373 ------ net/caif/cfrfml.c | 299 ----- net/caif/cfserl.c | 192 --- net/caif/cfsrvl.c | 224 ---- net/caif/cfutill.c | 104 -- net/caif/cfveil.c | 101 -- net/caif/cfvidl.c | 65 - net/caif/chnl_net.c | 531 -------- arch/arm/configs/u8500_defconfig | 1 - 47 files changed, 8675 deletions(-) delete mode 100644 Documentation/networking/caif/caif.rst delete mode 100644 Documentation/networking/caif/index.rst delete mode 100644 Documentation/networking/caif/linux_caif.rst delete mode 100644 drivers/net/caif/Kconfig delete mode 100644 net/caif/Kconfig delete mode 100644 drivers/net/caif/Makefile delete mode 100644 net/caif/Makefile delete mode 100644 include/linux/virtio_caif.h delete mode 100644 include/net/caif/caif_dev.h delete mode 100644 include/net/caif/caif_device.h delete mode 100644 include/net/caif/caif_layer.h delete mode 100644 include/net/caif/cfcnfg.h delete mode 100644 include/net/caif/cfctrl.h delete mode 100644 include/net/caif/cffrml.h delete mode 100644 include/net/caif/cfmuxl.h delete mode 100644 include/net/caif/cfpkt.h delete mode 100644 include/net/caif/cfserl.h delete mode 100644 include/net/caif/cfsrvl.h delete mode 100644 include/uapi/linux/caif/caif_socket.h delete mode 100644 include/uapi/linux/caif/if_caif.h delete mode 100644 drivers/net/caif/caif_serial.c delete mode 100644 drivers/net/caif/caif_virtio.c delete mode 100644 net/caif/caif_dev.c delete mode 100644 net/caif/caif_socket.c delete mode 100644 net/caif/caif_usb.c delete mode 100644 net/caif/cfcnfg.c delete mode 100644 net/caif/cfctrl.c delete mode 100644 net/caif/cfdbgl.c delete mode 100644 net/caif/cfdgml.c delete mode 100644 net/caif/cffrml.c delete mode 100644 net/caif/cfmuxl.c delete mode 100644 net/caif/cfpkt_skbuff.c delete mode 100644 net/caif/cfrfml.c delete mode 100644 net/caif/cfserl.c delete mode 100644 net/caif/cfsrvl.c delete mode 100644 net/caif/cfutill.c delete mode 100644 net/caif/cfveil.c delete mode 100644 net/caif/cfvidl.c delete mode 100644 net/caif/chnl_net.c
MAINTAINERS +0 -9
@@ -5674,15 +5674,6 @@ T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/cafe_ccic* F: drivers/media/platform/marvell/ -CAIF NETWORK LAYER -L: [email protected] -S: Orphan -F: Documentation/networking/caif/ -F: drivers/net/caif/ -F: include/net/caif/ -F: include/uapi/linux/caif/ -F: net/caif/ - CAKE QDISC M: Toke Høiland-Jørgensen <[email protected]> L: [email protected] (moderated for non-subscribers)
Documentation/networking/caif/caif.rst deleted +0 -138
138 lines not on this page · raw message
Documentation/networking/caif/index.rst deleted +0 -12
@@ -1,12 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -CAIF -==== - -Contents: - -.. toctree:: - :maxdepth: 2 - - linux_caif - caif
Documentation/networking/caif/linux_caif.rst deleted +0 -195
195 lines not on this page · raw message
Documentation/networking/index.rst +0 -1
@@ -17,7 +17,6 @@ Refer to :ref:`netdev-FAQ` for a guide on netdev development process specifics. diagnostic/index dsa/index devlink/index - caif/index ethtool-netlink ieee802154 iso15765-2
Documentation/translations/zh_CN/networking/index.rst +0 -1
@@ -42,7 +42,6 @@ 目录: * diagnostic/index * dsa/index * devlink/index -* caif/index * ethtool-netlink * ieee802154 * iso15765-2
drivers/net/Kconfig +0 -2
@@ -503,8 +503,6 @@ source "drivers/net/arcnet/Kconfig" source "drivers/atm/Kconfig" -source "drivers/net/caif/Kconfig" - source "drivers/net/dsa/Kconfig" source "drivers/net/ethernet/Kconfig"
drivers/net/caif/Kconfig deleted +0 -33
@@ -1,33 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# CAIF physical drivers -# - -menuconfig CAIF_DRIVERS - bool "CAIF transport drivers" - depends on CAIF - help - Enable this to see CAIF physical drivers. - -if CAIF_DRIVERS - -config CAIF_TTY - tristate "CAIF TTY transport driver" - depends on CAIF && TTY - default n - help - The CAIF TTY transport driver is a Line Discipline (ldisc) - identified as N_CAIF. When this ldisc is opened from user space - it will redirect the TTY's traffic into the CAIF stack. - -config CAIF_VIRTIO - tristate "CAIF virtio transport driver" - depends on CAIF && HAS_DMA - select VHOST_RING - select VIRTIO - select GENERIC_ALLOCATOR - default n - help - The CAIF driver for CAIF over Virtio. - -endif # CAIF_DRIVERS
net/Kconfig +0 -1
@@ -439,7 +439,6 @@ endif # WIRELESS source "net/rfkill/Kconfig" source "net/9p/Kconfig" -source "net/caif/Kconfig" source "net/ceph/Kconfig" source "net/nfc/Kconfig" source "net/psample/Kconfig"
net/caif/Kconfig deleted +0 -54
54 lines not on this page · raw message
drivers/net/Makefile +0 -1
@@ -48,7 +48,6 @@ obj-$(CONFIG_MHI_NET) += mhi_net.o # Networking Drivers # obj-$(CONFIG_ARCNET) += arcnet/ -obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_CAN) += can/ ifdef CONFIG_NET_DSA obj-y += dsa/
drivers/net/caif/Makefile deleted +0 -8
@@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG - -# Serial interface -obj-$(CONFIG_CAIF_TTY) += caif_serial.o - -# Virtio interface -obj-$(CONFIG_CAIF_VIRTIO) += caif_virtio.o
net/Makefile +0 -1
@@ -53,7 +53,6 @@ obj-$(CONFIG_IUCV) += iucv/ obj-$(CONFIG_SMC) += smc/ obj-$(CONFIG_RFKILL) += rfkill/ obj-$(CONFIG_NET_9P) += 9p/ -obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_DCB) += dcb/ obj-$(CONFIG_6LOWPAN) += 6lowpan/ obj-$(CONFIG_IEEE802154) += ieee802154/
net/caif/Makefile deleted +0 -16
@@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG - -caif-y := caif_dev.o \ - cfcnfg.o cfmuxl.o cfctrl.o \ - cffrml.o cfveil.o cfdbgl.o\ - cfserl.o cfdgml.o \ - cfrfml.o cfvidl.o cfutill.o \ - cfsrvl.o cfpkt_skbuff.o - -obj-$(CONFIG_CAIF) += caif.o -obj-$(CONFIG_CAIF_NETDEV) += chnl_net.o -obj-$(CONFIG_CAIF) += caif_socket.o -obj-$(CONFIG_CAIF_USB) += caif_usb.o - -export-y := caif.o
include/linux/virtio_caif.h deleted +0 -24
@@ -1,24 +0,0 @@ -/* -* Copyright (C) ST-Ericsson AB 2012 -* Author: Sjur Brændeland <[email protected]> -* -* This header is BSD licensed so -* anyone can use the definitions to implement compatible remote processors -*/ - -#ifndef VIRTIO_CAIF_H -#define VIRTIO_CAIF_H - -#include <linux/types.h> -struct virtio_caif_transf_config { -__virtio16 headroom; -__virtio16 tailroom; -__virtio32 mtu; -u8 reserved[4 ]; -}; - -struct virtio_caif_config { -struct virtio_caif_transf_config uplink, downlink; -u8 reserved[8 ]; -}; -#endif
include/net/caif/caif_dev.h deleted +0 -128
128 lines not on this page · raw message
include/net/caif/caif_device.h deleted +0 -55
55 lines not on this page · raw message
include/net/caif/caif_layer.h deleted +0 -277
277 lines not on this page · raw message
include/net/caif/cfcnfg.h deleted +0 -90
90 lines not on this page · raw message
include/net/caif/cfctrl.h deleted +0 -130
130 lines not on this page · raw message
include/net/caif/cffrml.h deleted +0 -21
@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFFRML_H_ -#define CFFRML_H_ -#include <net/caif/caif_layer.h> -#include <linux/netdevice.h> - -struct cffrml ; -struct cflayer *cffrml_create (u16 phyid,bool use_fcs); -void cffrml_free (struct cflayer *layr); -void cffrml_set_uplayer (struct cflayer *this,struct cflayer *up); -void cffrml_set_dnlayer (struct cflayer *this,struct cflayer *dn); -void cffrml_put (struct cflayer *layr); -void cffrml_hold (struct cflayer *layr); -int cffrml_refcnt_read (struct cflayer *layr); - -#endif /* CFFRML_H_ */
include/net/caif/cfmuxl.h deleted +0 -20
@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFMUXL_H_ -#define CFMUXL_H_ -#include <net/caif/caif_layer.h> - -struct cfsrvl ; -struct cffrml ; - -struct cflayer *cfmuxl_create (void ); -int cfmuxl_set_uplayer (struct cflayer *layr,struct cflayer *up,u8 linkid); -struct cflayer *cfmuxl_remove_dnlayer (struct cflayer *layr,u8 phyid); -int cfmuxl_set_dnlayer (struct cflayer *layr,struct cflayer *up,u8 phyid); -struct cflayer *cfmuxl_remove_uplayer (struct cflayer *layr,u8 linkid); - -#endif /* CFMUXL_H_ */
include/net/caif/cfpkt.h deleted +0 -232
232 lines not on this page · raw message
include/net/caif/cfserl.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFSERL_H_ -#define CFSERL_H_ -#include <net/caif/caif_layer.h> - -struct cflayer *cfserl_create (int instance,bool use_stx); -void cfserl_release (struct cflayer *layer); -#endif
include/net/caif/cfsrvl.h deleted +0 -61
61 lines not on this page · raw message
include/uapi/linux/caif/caif_socket.h deleted +0 -195
195 lines not on this page · raw message
include/uapi/linux/caif/if_caif.h deleted +0 -35
@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -* License terms: GNU General Public License (GPL) version 2 -*/ - -#ifndef IF_CAIF_H_ -#define IF_CAIF_H_ -#include <linux/sockios.h> -#include <linux/types.h> -#include <linux/socket.h> - -/** -* enum ifla_caif - CAIF NetlinkRT parameters. -* @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. -* The type of attribute is NLA_U32. -* @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. -* The type of attribute is NLA_U32. -* @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback -* The type of attribute is NLA_U8. -* -* When using RT Netlink to create, destroy or configure a CAIF IP interface, -* enum ifla_caif is used to specify the configuration attributes. -*/ -enum ifla_caif { - __IFLA_CAIF_UNSPEC, -IFLA_CAIF_IPV4_CONNID , -IFLA_CAIF_IPV6_CONNID , -IFLA_CAIF_LOOPBACK , - __IFLA_CAIF_MAX -}; -#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) - -#endif /*IF_CAIF_H_*/
drivers/net/caif/caif_serial.c deleted +0 -443
443 lines not on this page · raw message
drivers/net/caif/caif_virtio.c deleted +0 -791
762 lines not on this page · raw message
net/caif/caif_dev.c deleted +0 -586
586 lines not on this page · raw message
net/caif/caif_socket.c deleted +0 -1114
1,114 lines not on this page · raw message
net/caif/caif_usb.c deleted +0 -216
216 lines not on this page · raw message
net/caif/cfcnfg.c deleted +0 -612
612 lines not on this page · raw message
net/caif/cfctrl.c deleted +0 -631
631 lines not on this page · raw message
net/caif/cfdbgl.c deleted +0 -55
55 lines not on this page · raw message
net/caif/cfdgml.c deleted +0 -113
113 lines not on this page · raw message
net/caif/cffrml.c deleted +0 -204
204 lines not on this page · raw message
net/caif/cfmuxl.c deleted +0 -267
267 lines not on this page · raw message
net/caif/cfpkt_skbuff.c deleted +0 -373
373 lines not on this page · raw message
net/caif/cfrfml.c deleted +0 -299
299 lines not on this page · raw message
net/caif/cfserl.c deleted +0 -192
192 lines not on this page · raw message
net/caif/cfsrvl.c deleted +0 -224
224 lines not on this page · raw message
net/caif/cfutill.c deleted +0 -104
104 lines not on this page · raw message
net/caif/cfveil.c deleted +0 -101
101 lines not on this page · raw message
net/caif/cfvidl.c deleted +0 -65
65 lines not on this page · raw message
net/caif/chnl_net.c deleted +0 -531
531 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.53.0
Part of the diff is not shown here. View the raw message.
Quoted 17 lines · Jakub Kicinski
Remove CAIF (Communication CPU to Application CPU Interface), the ST-Ericsson modem protocol. The subsystem has been orphaned since 2013. The last meaningful changes from the maintainers were in March 2013:
a8c7687bf216("caif_virtio: Check thatvringh_configis not null")b2273be8d2df("caif_virtio: Usevringh_notify_enablecorrectly")0d2e1a2926b1("caif_virtio: Introduce caif over virtio")Not-so-coincidentally, according to "the Internet" ST-Ericsson officially shut down its modem joint venture in Aug 2013.
If anyone is using this code please yell!
In the 13 years since, the code has accumulated 200 non-merge commits, of which 71 were cross-tree API changes, 21 carried Fixes: tags, and the remaining ~110 were cleanups, doc conversions, treewide refactors, and one partial removal (
caif_hsi,ca75bcf0a83b).
Quoted 7 lines
We are still getting fixes to this code, in the last 10 days there were 3 reports on security@ about CAIF that I have been CCed on.
UAPI constants (
AF_CAIF,ARPHRD_CAIF,N_CAIF,VIRTIO_ID_CAIF) and the SELinux classmap entry are intentionally kept for ABI stability.Signed-off-by Jakub Kicinski <[email protected]>
The device was never specced out.
Quoted 9,111 lines
---
I think we should accumulate such patches over the coming days on a separate branch. CAIF is a no-brainer IMO but other removals may be more controversial.--- MAINTAINERS | 9 - Documentation/networking/caif/caif.rst | 138 -- Documentation/networking/caif/index.rst | 12 - Documentation/networking/caif/linux_caif.rst | 195 --- Documentation/networking/index.rst | 1 - .../translations/zh_CN/networking/index.rst | 1 - drivers/net/Kconfig | 2 - drivers/net/caif/Kconfig | 33 - net/Kconfig | 1 - net/caif/Kconfig | 54 - drivers/net/Makefile | 1 - drivers/net/caif/Makefile | 8 - net/Makefile | 1 - net/caif/Makefile | 16 - include/linux/virtio_caif.h | 24 - include/net/caif/caif_dev.h | 128 -- include/net/caif/caif_device.h | 55 - include/net/caif/caif_layer.h | 277 ---- include/net/caif/cfcnfg.h | 90 -- include/net/caif/cfctrl.h | 130 -- include/net/caif/cffrml.h | 21 - include/net/caif/cfmuxl.h | 20 - include/net/caif/cfpkt.h | 232 ---- include/net/caif/cfserl.h | 13 - include/net/caif/cfsrvl.h | 61 - include/uapi/linux/caif/caif_socket.h | 195 --- include/uapi/linux/caif/if_caif.h | 35 - drivers/net/caif/caif_serial.c | 443 ------- drivers/net/caif/caif_virtio.c | 791 ------------ net/caif/caif_dev.c | 586 --------- net/caif/caif_socket.c | 1114 ----------------- net/caif/caif_usb.c | 216 ---- net/caif/cfcnfg.c | 612 --------- net/caif/cfctrl.c | 631 ---------- net/caif/cfdbgl.c | 55 - net/caif/cfdgml.c | 113 -- net/caif/cffrml.c | 204 --- net/caif/cfmuxl.c | 267 ---- net/caif/cfpkt_skbuff.c | 373 ------ net/caif/cfrfml.c | 299 ----- net/caif/cfserl.c | 192 --- net/caif/cfsrvl.c | 224 ---- net/caif/cfutill.c | 104 -- net/caif/cfveil.c | 101 -- net/caif/cfvidl.c | 65 - net/caif/chnl_net.c | 531 -------- arch/arm/configs/u8500_defconfig | 1 - 47 files changed, 8675 deletions(-) delete mode 100644 Documentation/networking/caif/caif.rst delete mode 100644 Documentation/networking/caif/index.rst delete mode 100644 Documentation/networking/caif/linux_caif.rst delete mode 100644 drivers/net/caif/Kconfig delete mode 100644 net/caif/Kconfig delete mode 100644 drivers/net/caif/Makefile delete mode 100644 net/caif/Makefile delete mode 100644 include/linux/virtio_caif.h delete mode 100644 include/net/caif/caif_dev.h delete mode 100644 include/net/caif/caif_device.h delete mode 100644 include/net/caif/caif_layer.h delete mode 100644 include/net/caif/cfcnfg.h delete mode 100644 include/net/caif/cfctrl.h delete mode 100644 include/net/caif/cffrml.h delete mode 100644 include/net/caif/cfmuxl.h delete mode 100644 include/net/caif/cfpkt.h delete mode 100644 include/net/caif/cfserl.h delete mode 100644 include/net/caif/cfsrvl.h delete mode 100644 include/uapi/linux/caif/caif_socket.h delete mode 100644 include/uapi/linux/caif/if_caif.h delete mode 100644 drivers/net/caif/caif_serial.c delete mode 100644 drivers/net/caif/caif_virtio.c delete mode 100644 net/caif/caif_dev.c delete mode 100644 net/caif/caif_socket.c delete mode 100644 net/caif/caif_usb.c delete mode 100644 net/caif/cfcnfg.c delete mode 100644 net/caif/cfctrl.c delete mode 100644 net/caif/cfdbgl.c delete mode 100644 net/caif/cfdgml.c delete mode 100644 net/caif/cffrml.c delete mode 100644 net/caif/cfmuxl.c delete mode 100644 net/caif/cfpkt_skbuff.c delete mode 100644 net/caif/cfrfml.c delete mode 100644 net/caif/cfserl.c delete mode 100644 net/caif/cfsrvl.c delete mode 100644 net/caif/cfutill.c delete mode 100644 net/caif/cfveil.c delete mode 100644 net/caif/cfvidl.c delete mode 100644 net/caif/chnl_net.cMAINTAINERS +0
-9@@ -5674,15 +5674,6 @@ T: git git://linuxtv.org/media.git F: Documentation/admin-guide/media/cafe_ccic* F: drivers/media/platform/marvell/ -CAIF NETWORK LAYER -L: [email protected] -S: Orphan -F: Documentation/networking/caif/ -F: drivers/net/caif/ -F: include/net/caif/ -F: include/uapi/linux/caif/ -F: net/caif/ - CAKE QDISC M: Toke Høiland-Jørgensen <[email protected]> L: [email protected] (moderated for non-subscribers)Documentation/networking/caif/caif.rst deleted +0
-138@@ -1,138 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 -.. include:: <isonum.txt> - - -================ -Using Linux CAIF -================ - - -:Copyright: |copy| ST-Ericsson AB 2010 - -:Author: Sjur Brendeland/ [email protected] - -Start -===== - -If you have compiled CAIF for modules do:: - - $modprobe crc_ccitt - $modprobe caif - $modprobe caif_socket - $modprobe chnl_net - - -Preparing the setup with a STE modem -==================================== - -If you are working on integration of CAIF you should make sure -that the kernel is built with module support. - -There are some things that need to be tweaked to get the host TTY correctly -set up to talk to the modem. -Since the CAIF stack is running in the kernel and we want to use the existing -TTY, we are installing our physical serial driver as a line discipline above -the TTY device. - -To achieve this we need to install the N_CAIF ldisc from user space. -The benefit is that we can hook up to any TTY. - -The use of Start-of-frame-extension (STX) must also be set as -module parameter "ser_use_stx". - -Normally Frame Checksum is always used on UART, but this is also provided as a -module parameter "ser_use_fcs". - -:: - - $ modprobe caif_serial ser_ttyname=/dev/ttyS0 ser_use_stx=yes - $ ifconfig caif_ttyS0 up - -PLEASE NOTE: - There is a limitation in Android shell. - It only accepts one argument to insmod/modprobe! - -Trouble shooting -================ - -There are debugfs parameters provided for serial communication. -/sys/kernel/debug/caif_serial/<tty-name>/ - -* ser_state: Prints the bit-mask status where - - - 0x02 means SENDING, this is a transient state. - - 0x10 means FLOW_OFF_SENT, i.e. the previous frame has not been sent - and is blocking further send operation. Flow OFF has been propagated - to all CAIF Channels using this TTY. - -* tty_status: Prints the bit-mask tty status information - - - 0x01 - tty->warned is on. - - 0x04 - tty->packed is on. - - 0x08 - tty->flow.tco_stopped is on. - - 0x10 - tty->hw_stopped is on. - - 0x20 - tty->flow.stopped is on. - -* last_tx_msg: Binary blob Prints the last transmitted frame. - - This can be printed with:: - - $od --format=x1 /sys/kernel/debug/caif_serial/<tty>/last_rx_msg. - - The first two tx messages sent look like this. Note: The initial - byte 02 is start of frame extension (STX) used for re-syncing - upon errors. - - - Enumeration:: - - 0000000 02 05 00 00 03 01 d2 02 - | | | | | | - STX(1) | | | | - Length(2)| | | - Control Channel(1) - Command:Enumeration(1) - Link-ID(1) - Checksum(2) - - - Channel Setup:: - - 0000000 02 07 00 00 00 21 a1 00 48 df - | | | | | | | | - STX(1) | | | | | | - Length(2)| | | | | - Control Channel(1) - Command:Channel Setup(1) - Channel Type(1) - Priority and Link-ID(1) - Endpoint(1) - Checksum(2) - -* last_rx_msg: Prints the last transmitted frame. - - The RX messages for LinkSetup look almost identical but they have the - bit 0x20 set in the command bit, and Channel Setup has added one byte - before Checksum containing Channel ID. - - NOTE: - Several CAIF Messages might be concatenated. The maximum debug - buffer size is 128 bytes. - -Error Scenarios -=============== - -- last_tx_msg contains channel setup message and last_rx_msg is empty -> - The host seems to be able to send over the UART, at least the CAIF ldisc get - notified that sending is completed. - -- last_tx_msg contains enumeration message and last_rx_msg is empty -> - The host is not able to send the message from UART, the tty has not been - able to complete the transmit operation. - -- if /sys/kernel/debug/caif_serial/<tty>/tty_status is non-zero there - might be problems transmitting over UART. - - E.g. host and modem wiring is not correct you will typically see - tty_status = 0x10 (hw_stopped) and ser_state = 0x10 (FLOW_OFF_SENT). - - You will probably see the enumeration message in last_tx_message - and empty last_rx_message.Documentation/networking/caif/index.rst deleted +0
-12@@ -1,12 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -CAIF -==== - -Contents: - -.. toctree:: - :maxdepth: 2 - - linux_caif - caifDocumentation/networking/caif/linux_caif.rst deleted +0
-195@@ -1,195 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 -.. include:: <isonum.txt> - -========== -Linux CAIF -========== - -Copyright |copy| ST-Ericsson AB 2010 - -:Author: Sjur Brendeland/ [email protected] -:License terms: GNU General Public License (GPL) version 2 - - -Introduction -============ - -CAIF is a MUX protocol used by ST-Ericsson cellular modems for -communication between Modem and host. The host processes can open virtual AT -channels, initiate GPRS Data connections, Video channels and Utility Channels. -The Utility Channels are general purpose pipes between modem and host. - -ST-Ericsson modems support a number of transports between modem -and host. Currently, UART and Loopback are available for Linux. - - -Architecture -============ - -The implementation of CAIF is divided into: - -* CAIF Socket Layer and GPRS IP Interface. -* CAIF Core Protocol Implementation -* CAIF Link Layer, implemented as NET devices. - -:: - - RTNL - ! - ! +------+ +------+ - ! +------+! +------+! - ! ! IP !! !Socket!! - +-------> !interf!+ ! API !+ <- CAIF Client APIs - ! +------+ +------! - ! ! ! - ! +-----------+ - ! ! - ! +------+ <- CAIF Core Protocol - ! ! CAIF ! - ! ! Core ! - ! +------+ - ! +----------!---------+ - ! ! ! ! - ! +------+ +-----+ +------+ - +--> ! HSI ! ! TTY ! ! USB ! <- Link Layer (Net Devices) - +------+ +-----+ +------+ - - - -Implementation -============== - - -CAIF Core Protocol Layer ------------------------- - -CAIF Core layer implements the CAIF protocol as defined by ST-Ericsson. -It implements the CAIF protocol stack in a layered approach, where -each layer described in the specification is implemented as a separate layer. -The architecture is inspired by the design patterns "Protocol Layer" and -"Protocol Packet". - -CAIF structure -^^^^^^^^^^^^^^ - -The Core CAIF implementation contains: - - - Simple implementation of CAIF. - - Layered architecture (a la Streams), each layer in the CAIF - specification is implemented in a separate c-file. - - Clients must call configuration function to add PHY layer. - - Clients must implement CAIF layer to consume/produce - CAIF payload with receive and transmit functions. - - Clients must call configuration function to add and connect the - Client layer. - - When receiving / transmitting CAIF Packets (cfpkt), ownership is passed - to the called function (except for framing layers' receive function) - -Layered Architecture -==================== - -The CAIF protocol can be divided into two parts: Support functions and Protocol -Implementation. The support functions include: - - - CFPKT CAIF Packet. Implementation of CAIF Protocol Packet. The - CAIF Packet has functions for creating, destroying and adding content - and for adding/extracting header and trailers to protocol packets. - -The CAIF Protocol implementation contains: - - - CFCNFG CAIF Configuration layer. Configures the CAIF Protocol - Stack and provides a Client interface for adding Link-Layer and - Driver interfaces on top of the CAIF Stack. - - - CFCTRL CAIF Control layer. Encodes and Decodes control messages - such as enumeration and channel setup. Also matches request and - response messages. - - - CFSERVL General CAIF Service Layer functionality; handles flow - control and remote shutdown requests. - - - CFVEI CAIF VEI layer. Handles CAIF AT Channels on VEI (Virtual - External Interface). This layer encodes/decodes VEI frames. - - - CFDGML CAIF Datagram layer. Handles CAIF Datagram layer (IP - traffic), encodes/decodes Datagram frames. - - - CFMUX CAIF Mux layer. Handles multiplexing between multiple - physical bearers and multiple channels such as VEI, Datagram, etc. - The MUX keeps track of the existing CAIF Channels and - Physical Instances and selects the appropriate instance based - on Channel-Id and Physical-ID. - - - CFFRML CAIF Framing layer. Handles Framing i.e. Frame length - and frame checksum. - - - CFSERL CAIF Serial layer. Handles concatenation/split of frames - into CAIF Frames with correct length. - -:: - - +---------+ - | Config | - | CFCNFG | - +---------+ - ! - +---------+ +---------+ +---------+ - | AT | | Control | | Datagram| - | CFVEIL | | CFCTRL | | CFDGML | - +---------+ +---------+ +---------+ - \_____________!______________/ - ! - +---------+ - | MUX | - | | - +---------+ - _____!_____ - / \ - +---------+ +---------+ - | CFFRML | | CFFRML | - | Framing | | Framing | - +---------+ +---------+ - ! ! - +---------+ +---------+ - | | | Serial | - | | | CFSERL | - +---------+ +---------+ - - -In this layered approach the following "rules" apply. - - - All layers embed the same structure "struct cflayer" - - A layer does not depend on any other layer's private data. - - Layers are stacked by setting the pointers:: - - layer->up , layer->dn - - - In order to send data upwards, each layer should do:: - - layer->up->receive(layer->up, packet); - - - In order to send data downwards, each layer should do:: - - layer->dn->transmit(layer->dn, packet); - - -CAIF Socket and IP interface -============================ - -The IP interface and CAIF socket API are implemented on top of the -CAIF Core protocol. The IP Interface and CAIF socket have an instance of -'struct cflayer', just like the CAIF Core protocol stack. -Net device and Socket implement the 'receive()' function defined by -'struct cflayer', just like the rest of the CAIF stack. In this way, transmit and -receive of packets is handled as by the rest of the layers: the 'dn->transmit()' -function is called in order to transmit data. - -Configuration of Link Layer ---------------------------- -The Link Layer is implemented as Linux network devices (struct net_device). -Payload handling and registration is done using standard Linux mechanisms. - -The CAIF Protocol relies on a loss-less link layer without implementing -retransmission. This implies that packet drops must not happen. -Therefore a flow-control mechanism is implemented where the physical -interface can initiate flow stop for all CAIF Channels.Documentation/networking/index.rst +0
-1@@ -17,7 +17,6 @@ Refer to :ref:`netdev-FAQ` for a guide on netdev development process specifics. diagnostic/index dsa/index devlink/index - caif/index ethtool-netlink ieee802154 iso15765-2Documentation/translations/zh_CN/networking/index.rst +0
-1@@ -42,7 +42,6 @@ 目录: * diagnostic/index * dsa/index * devlink/index -* caif/index * ethtool-netlink * ieee802154 * iso15765-2drivers/net/Kconfig +0
-2@@ -503,8 +503,6 @@ source "drivers/net/arcnet/Kconfig" source "drivers/atm/Kconfig" -source "drivers/net/caif/Kconfig" - source "drivers/net/dsa/Kconfig" source "drivers/net/ethernet/Kconfig"drivers/net/caif/Kconfig deleted +0
-33@@ -1,33 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# CAIF physical drivers -# - -menuconfig CAIF_DRIVERS - bool "CAIF transport drivers" - depends on CAIF - help - Enable this to see CAIF physical drivers. - -if CAIF_DRIVERS - -config CAIF_TTY - tristate "CAIF TTY transport driver" - depends on CAIF && TTY - default n - help - The CAIF TTY transport driver is a Line Discipline (ldisc) - identified as N_CAIF. When this ldisc is opened from user space - it will redirect the TTY's traffic into the CAIF stack. - -config CAIF_VIRTIO - tristate "CAIF virtio transport driver" - depends on CAIF && HAS_DMA - select VHOST_RING - select VIRTIO - select GENERIC_ALLOCATOR - default n - help - The CAIF driver for CAIF over Virtio. - -endif # CAIF_DRIVERSnet/Kconfig +0
-1@@ -439,7 +439,6 @@ endif # WIRELESS source "net/rfkill/Kconfig" source "net/9p/Kconfig" -source "net/caif/Kconfig" source "net/ceph/Kconfig" source "net/nfc/Kconfig" source "net/psample/Kconfig"net/caif/Kconfig deleted +0
-54@@ -1,54 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# CAIF net configurations -# - -menuconfig CAIF - tristate "CAIF support" - select CRC_CCITT - default n - help - The "Communication CPU to Application CPU Interface" (CAIF) is a packet - based connection-oriented MUX protocol developed by ST-Ericsson for use - with its modems. It is accessed from user space as sockets (PF_CAIF). - - Say Y (or M) here if you build for a phone product (e.g. Android or - MeeGo) that uses CAIF as transport. If unsure say N. - - If you select to build it as module then CAIF_NETDEV also needs to be - built as a module. You will also need to say Y (or M) to any CAIF - physical devices that your platform requires. - - See Documentation/networking/caif for a further explanation on how to - use and configure CAIF. - -config CAIF_DEBUG - bool "Enable Debug" - depends on CAIF - default n - help - Enable the inclusion of debug code in the CAIF stack. - Be aware that doing this will impact performance. - If unsure say N. - -config CAIF_NETDEV - tristate "CAIF GPRS Network device" - depends on CAIF - default CAIF - help - Say Y if you will be using a CAIF based GPRS network device. - This can be either built-in or a loadable module. - If you select to build it as a built-in then the main CAIF device must - also be a built-in. - If unsure say Y. - -config CAIF_USB - tristate "CAIF USB support" - depends on CAIF - default n - help - Say Y if you are using CAIF over USB CDC NCM. - This can be either built-in or a loadable module. - If you select to build it as a built-in then the main CAIF device must - also be a built-in. - If unsure say N.drivers/net/Makefile +0
-1@@ -48,7 +48,6 @@ obj-$(CONFIG_MHI_NET) += mhi_net.o # Networking Drivers # obj-$(CONFIG_ARCNET) += arcnet/ -obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_CAN) += can/ ifdef CONFIG_NET_DSA obj-y += dsa/drivers/net/caif/Makefile deleted +0
-8@@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG - -# Serial interface -obj-$(CONFIG_CAIF_TTY) += caif_serial.o - -# Virtio interface -obj-$(CONFIG_CAIF_VIRTIO) += caif_virtio.onet/Makefile +0
-1@@ -53,7 +53,6 @@ obj-$(CONFIG_IUCV) += iucv/ obj-$(CONFIG_SMC) += smc/ obj-$(CONFIG_RFKILL) += rfkill/ obj-$(CONFIG_NET_9P) += 9p/ -obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_DCB) += dcb/ obj-$(CONFIG_6LOWPAN) += 6lowpan/ obj-$(CONFIG_IEEE802154) += ieee802154/net/caif/Makefile deleted +0
-16@@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -ccflags-$(CONFIG_CAIF_DEBUG) := -DDEBUG - -caif-y := caif_dev.o \ - cfcnfg.o cfmuxl.o cfctrl.o \ - cffrml.o cfveil.o cfdbgl.o\ - cfserl.o cfdgml.o \ - cfrfml.o cfvidl.o cfutill.o \ - cfsrvl.o cfpkt_skbuff.o - -obj-$(CONFIG_CAIF) += caif.o -obj-$(CONFIG_CAIF_NETDEV) += chnl_net.o -obj-$(CONFIG_CAIF) += caif_socket.o -obj-$(CONFIG_CAIF_USB) += caif_usb.o - -export-y := caif.oinclude/linux/virtio_caif.h deleted +0
-24@@ -1,24 +0,0 @@ -/* -* Copyright (C) ST-Ericsson AB 2012 -* Author: Sjur Brændeland <[email protected]> -* -* This header is BSD licensed so -* anyone can use the definitions to implement compatible remote processors -*/ - -#ifndef VIRTIO_CAIF_H -#define VIRTIO_CAIF_H - -#include <linux/types.h> -struct virtio_caif_transf_config { -__virtio16 headroom; -__virtio16 tailroom; -__virtio32 mtu; -u8 reserved[4 ]; -}; - -struct virtio_caif_config { -struct virtio_caif_transf_config uplink, downlink; -u8 reserved[8 ]; -}; -#endif include/net/caif/caif_dev.h deleted +0
-128@@ -1,128 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CAIF_DEV_H_ -#define CAIF_DEV_H_ - -#include <net/caif/caif_layer.h> -#include <net/caif/cfcnfg.h> -#include <net/caif/caif_device.h> -#include <linux/caif/caif_socket.h> -#include <linux/if.h> -#include <linux/net.h> - -/** -* struct caif_param - CAIF parameters. -* @size: Length of data -* @data: Binary Data Blob -*/ -struct caif_param { -u16 size; -u8 data[256 ]; -}; - -/** -* struct caif_connect_request - Request data for CAIF channel setup. -* @protocol: Type of CAIF protocol to use (at, datagram etc) -* @sockaddr: Socket address to connect. -* @priority: Priority of the connection. -* @link_selector: Link selector (high bandwidth or low latency) -* @ifindex: kernel index of the interface. -* @param: Connect Request parameters (CAIF_SO_REQ_PARAM). -* -* This struct is used when connecting a CAIF channel. -* It contains all CAIF channel configuration options. -*/ -struct caif_connect_request { -enum caif_protocol_type protocol; -struct sockaddr_caif sockaddr; -enum caif_channel_priority priority; -enum caif_link_selector link_selector; -int ifindex; -struct caif_param param; -}; - -/** -* caif_connect_client - Connect a client to CAIF Core Stack. -* @config: Channel setup parameters, specifying what address -* to connect on the Modem. -* @client_layer: User implementation of client layer. This layer -* MUST have receive and control callback functions -* implemented. -* @ifindex: Link layer interface index used for this connection. -* @headroom: Head room needed by CAIF protocol. -* @tailroom: Tail room needed by CAIF protocol. -* -* This function connects a CAIF channel. The Client must implement -* the struct cflayer. This layer represents the Client layer and holds -* receive functions and control callback functions. Control callback -* function will receive information about connect/disconnect responses, -* flow control etc (see enum caif_control). -* E.g. CAIF Socket will call this function for each socket it connects -* and have one client_layer instance for each socket. -*/ -int caif_connect_client (struct net *net, -struct caif_connect_request *conn_req, -struct cflayer *client_layer,int *ifindex, -int *headroom,int *tailroom); - -/** -* caif_disconnect_client - Disconnects a client from the CAIF stack. -* -* @client_layer: Client layer to be disconnected. -*/ -int caif_disconnect_client (struct net *net,struct cflayer *client_layer); - - -/** -* caif_client_register_refcnt - register ref-count functions provided by client. -* -* @adapt_layer: Client layer using CAIF Stack. -* @hold: Function provided by client layer increasing ref-count -* @put: Function provided by client layer decreasing ref-count -* -* Client of the CAIF Stack must register functions for reference counting. -* These functions are called by the CAIF Stack for every upstream packet, -* and must therefore be implemented efficiently. -* -* Client should call caif_free_client when reference count degrease to zero. -*/ - -void caif_client_register_refcnt (struct cflayer *adapt_layer, -void (*hold)(struct cflayer *lyr), -void (*put)(struct cflayer *lyr)); -/** -* caif_free_client - Free memory used to manage the client in the CAIF Stack. -* -* @client_layer: Client layer to be removed. -* -* This function must be called from client layer in order to free memory. -* Caller must guarantee that no packets are in flight upstream when calling -* this function. -*/ -void caif_free_client (struct cflayer *adap_layer); - -/** -* struct caif_enroll_dev - Enroll a net-device as a CAIF Link layer -* @dev: Network device to enroll. -* @caifdev: Configuration information from CAIF Link Layer -* @link_support: Link layer support layer -* @head_room: Head room needed by link support layer -* @layer: Lowest layer in CAIF stack -* @rcv_fun: Receive function for CAIF stack. -* -* This function enroll a CAIF link layer into CAIF Stack and -* expects the interface to be able to handle CAIF payload. -* The link_support layer is used to add any Link Layer specific -* framing. -*/ -int caif_enroll_dev (struct net_device *dev,struct caif_dev_common *caifdev, -struct cflayer *link_support,int head_room, -struct cflayer **layer,int (**rcv_func)( -struct sk_buff *,struct net_device *, -struct packet_type *,struct net_device *)); - -#endif /* CAIF_DEV_H_ */ include/net/caif/caif_device.h deleted +0
-55@@ -1,55 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CAIF_DEVICE_H_ -#define CAIF_DEVICE_H_ -#include <linux/kernel.h> -#include <linux/net.h> -#include <linux/netdevice.h> -#include <linux/caif/caif_socket.h> -#include <net/caif/caif_device.h> - -/** -* struct caif_dev_common - data shared between CAIF drivers and stack. -* @flowctrl: Flow Control callback function. This function is -* supplied by CAIF Core Stack and is used by CAIF -* Link Layer to send flow-stop to CAIF Core. -* The flow information will be distributed to all -* clients of CAIF. -* -* @link_select: Profile of device, either high-bandwidth or -* low-latency. This member is set by CAIF Link -* Layer Device in order to indicate if this device -* is a high bandwidth or low latency device. -* -* @use_frag: CAIF Frames may be fragmented. -* Is set by CAIF Link Layer in order to indicate if the -* interface receives fragmented frames that must be -* assembled by CAIF Core Layer. -* -* @use_fcs: Indicate if Frame CheckSum (fcs) is used. -* Is set if the physical interface is -* using Frame Checksum on the CAIF Frames. -* -* @use_stx: Indicate STart of frame eXtension (stx) in use. -* Is set if the CAIF Link Layer expects -* CAIF Frames to start with the STX byte. -* -* This structure is shared between the CAIF drivers and the CAIF stack. -* It is used by the device to register its behavior. -* CAIF Core layer must set the member flowctrl in order to supply -* CAIF Link Layer with the flow control function. -* -*/ -struct caif_dev_common { -void (*flowctrl)(struct net_device *net,int on); -enum caif_link_selector link_select; -int use_frag; -int use_fcs; -int use_stx; -}; - -#endif /* CAIF_DEVICE_H_ */ include/net/caif/caif_layer.h deleted +0
-277@@ -1,277 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CAIF_LAYER_H_ -#define CAIF_LAYER_H_ - -#include <linux/list.h> - -struct cflayer ; -struct cfpkt ; -struct caif_payload_info ; - -#define CAIF_LAYER_NAME_SZ 16 - -/** -* caif_assert() - Assert function for CAIF. -* @assert: expression to evaluate. -* -* This function will print a error message and a do WARN_ON if the -* assertion fails. Normally this will do a stack up at the current location. -*/ -#define caif_assert (assert) \ -do { \ - if (!(assert)) { \ - pr_err("caif:Assert detected:'%s'\n", #assert); \ - WARN_ON(!(assert)); \ - } \ -} while (0) - -/** -* enum caif_ctrlcmd - CAIF Stack Control Signaling sent in layer.ctrlcmd(). -* -* @CAIF_CTRLCMD_FLOW_OFF_IND: Flow Control is OFF, transmit function -* should stop sending data -* -* @CAIF_CTRLCMD_FLOW_ON_IND: Flow Control is ON, transmit function -* can start sending data -* -* @CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND: Remote end modem has decided to close -* down channel -* -* @CAIF_CTRLCMD_INIT_RSP: Called initially when the layer below -* has finished initialization -* -* @CAIF_CTRLCMD_DEINIT_RSP: Called when de-initialization is -* complete -* -* @CAIF_CTRLCMD_INIT_FAIL_RSP: Called if initialization fails -* -* @_CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND: CAIF Link layer temporarily cannot -* send more packets. -* @_CAIF_CTRLCMD_PHYIF_FLOW_ON_IND: Called if CAIF Link layer is able -* to send packets again. -* @_CAIF_CTRLCMD_PHYIF_DOWN_IND: Called if CAIF Link layer is going -* down. -* -* These commands are sent upwards in the CAIF stack to the CAIF Client. -* They are used for signaling originating from the modem or CAIF Link Layer. -* These are either responses (*_RSP) or events (*_IND). -*/ -enum caif_ctrlcmd { -CAIF_CTRLCMD_FLOW_OFF_IND , -CAIF_CTRLCMD_FLOW_ON_IND , -CAIF_CTRLCMD_REMOTE_SHUTDOWN_IND , -CAIF_CTRLCMD_INIT_RSP , -CAIF_CTRLCMD_DEINIT_RSP , -CAIF_CTRLCMD_INIT_FAIL_RSP , - _CAIF_CTRLCMD_PHYIF_FLOW_OFF_IND, - _CAIF_CTRLCMD_PHYIF_FLOW_ON_IND, - _CAIF_CTRLCMD_PHYIF_DOWN_IND, -}; - -/** -* enum caif_modemcmd - Modem Control Signaling, sent from CAIF Client -* to the CAIF Link Layer or modem. -* -* @CAIF_MODEMCMD_FLOW_ON_REQ: Flow Control is ON, transmit function -* can start sending data. -* -* @CAIF_MODEMCMD_FLOW_OFF_REQ: Flow Control is OFF, transmit function -* should stop sending data. -* -* @_CAIF_MODEMCMD_PHYIF_USEFULL: Notify physical layer that it is in use -* -* @_CAIF_MODEMCMD_PHYIF_USELESS: Notify physical layer that it is -* no longer in use. -* -* These are requests sent 'downwards' in the stack. -* Flow ON, OFF can be indicated to the modem. -*/ -enum caif_modemcmd { -CAIF_MODEMCMD_FLOW_ON_REQ =0 , -CAIF_MODEMCMD_FLOW_OFF_REQ =1 , - _CAIF_MODEMCMD_PHYIF_USEFULL =3 , - _CAIF_MODEMCMD_PHYIF_USELESS =4 -}; - -/** -* enum caif_direction - CAIF Packet Direction. -* Indicate if a packet is to be sent out or to be received in. -* @CAIF_DIR_IN: Incoming packet received. -* @CAIF_DIR_OUT: Outgoing packet to be transmitted. -*/ -enum caif_direction { -CAIF_DIR_IN =0 , -CAIF_DIR_OUT =1 -}; - -/** -* struct cflayer - CAIF Stack layer. -* Defines the framework for the CAIF Core Stack. -* @up: Pointer up to the layer above. -* @dn: Pointer down to the layer below. -* @node: List node used when layer participate in a list. -* @receive: Packet receive function. -* @transmit: Packet transmit function. -* @ctrlcmd: Used for control signalling upwards in the stack. -* @modemcmd: Used for control signaling downwards in the stack. -* @id: The identity of this layer -* @name: Name of the layer. -* -* This structure defines the layered structure in CAIF. -* -* It defines CAIF layering structure, used by all CAIF Layers and the -* layers interfacing CAIF. -* -* In order to integrate with CAIF an adaptation layer on top of the CAIF stack -* and PHY layer below the CAIF stack -* must be implemented. These layer must follow the design principles below. -* -* Principles for layering of protocol layers: -* - All layers must use this structure. If embedding it, then place this -* structure first in the layer specific structure. -* -* - Each layer should not depend on any others layer's private data. -* -* - In order to send data upwards do -* layer->up->receive(layer->up, packet); -* -* - In order to send data downwards do -* layer->dn->transmit(layer->dn, info, packet); -*/ -struct cflayer { -struct cflayer *up; -struct cflayer *dn; -struct list_head node; - -/* -* receive() - Receive Function (non-blocking). -* Contract: Each layer must implement a receive function passing the -* CAIF packets upwards in the stack. -* Packet handling rules: -* - The CAIF packet (cfpkt) ownership is passed to the -* called receive function. This means that the -* packet cannot be accessed after passing it to the -* above layer using up->receive(). -* -* - If parsing of the packet fails, the packet must be -* destroyed and negative error code returned -* from the function. -* EXCEPTION: If the framing layer (cffrml) returns -* -EILSEQ, the packet is not freed. -* -* - If parsing succeeds (and above layers return OK) then -* the function must return a value >= 0. -* -* Returns result < 0 indicates an error, 0 or positive value -* indicates success. -* -* @layr: Pointer to the current layer the receive function is -* implemented for (this pointer). -* @cfpkt: Pointer to CaifPacket to be handled. -*/ -int (*receive)(struct cflayer *layr,struct cfpkt *cfpkt); - -/* -* transmit() - Transmit Function (non-blocking). -* Contract: Each layer must implement a transmit function passing the -* CAIF packet downwards in the stack. -* Packet handling rules: -* - The CAIF packet (cfpkt) ownership is passed to the -* transmit function. This means that the packet -* cannot be accessed after passing it to the below -* layer using dn->transmit(). -* -* - Upon error the packet ownership is still passed on, -* so the packet shall be freed where error is detected. -* Callers of the transmit function shall not free packets, -* but errors shall be returned. -* -* - Return value less than zero means error, zero or -* greater than zero means OK. -* -* Returns result < 0 indicates an error, 0 or positive value -* indicates success. -* -* @layr: Pointer to the current layer the receive function -* isimplemented for (this pointer). -* @cfpkt: Pointer to CaifPacket to be handled. -*/ -int (*transmit) (struct cflayer *layr,struct cfpkt *cfpkt); - -/* -* cttrlcmd() - Control Function upwards in CAIF Stack (non-blocking). -* Used for signaling responses (CAIF_CTRLCMD_*_RSP) -* and asynchronous events from the modem (CAIF_CTRLCMD_*_IND) -* -* @layr: Pointer to the current layer the receive function -* is implemented for (this pointer). -* @ctrl: Control Command. -*/ -void (*ctrlcmd) (struct cflayer *layr,enum caif_ctrlcmd ctrl, -int phyid); - -/* -* modemctrl() - Control Function used for controlling the modem. -* Used to signal down-wards in the CAIF stack. -* Returns 0 on success, < 0 upon failure. -* -* @layr: Pointer to the current layer the receive function -* is implemented for (this pointer). -* @ctrl: Control Command. -*/ -int (*modemcmd) (struct cflayer *layr,enum caif_modemcmd ctrl); - -unsigned int id; -char name[CAIF_LAYER_NAME_SZ ]; -}; - -/** -* layer_set_up() - Set the up pointer for a specified layer. -* @layr: Layer where up pointer shall be set. -* @above: Layer above. -*/ -#define layer_set_up (layr, above) ((layr)->up = (struct cflayer *)(above)) - -/** -* layer_set_dn() - Set the down pointer for a specified layer. -* @layr: Layer where down pointer shall be set. -* @below: Layer below. -*/ -#define layer_set_dn (layr, below) ((layr)->dn = (struct cflayer *)(below)) - -/** -* struct dev_info - Physical Device info information about physical layer. -* @dev: Pointer to native physical device. -* @id: Physical ID of the physical connection used by the -* logical CAIF connection. Used by service layers to -* identify their physical id to Caif MUX (CFMUXL)so -* that the MUX can add the correct physical ID to the -* packet. -*/ -struct dev_info { -void *dev; -unsigned int id; -}; - -/** -* struct caif_payload_info - Payload information embedded in packet (sk_buff). -* -* @dev_info: Information about the receiving device. -* -* @hdr_len: Header length, used to align pay load on 32bit boundary. -* -* @channel_id: Channel ID of the logical CAIF connection. -* Used by mux to insert channel id into the caif packet. -*/ -struct caif_payload_info { -struct dev_info *dev_info; -unsigned short hdr_len; -unsigned short channel_id; -}; - -#endif /* CAIF_LAYER_H_ */ include/net/caif/cfcnfg.h deleted +0
-90@@ -1,90 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFCNFG_H_ -#define CFCNFG_H_ -#include <linux/spinlock.h> -#include <linux/netdevice.h> -#include <net/caif/caif_layer.h> -#include <net/caif/cfctrl.h> - -struct cfcnfg ; - -/** -* enum cfcnfg_phy_preference - Physical preference HW Abstraction -* -* @CFPHYPREF_UNSPECIFIED: Default physical interface -* -* @CFPHYPREF_LOW_LAT: Default physical interface for low-latency -* traffic -* @CFPHYPREF_HIGH_BW: Default physical interface for high-bandwidth -* traffic -* @CFPHYPREF_LOOP: TEST only Loopback interface simulating modem -* responses. -* -*/ -enum cfcnfg_phy_preference { -CFPHYPREF_UNSPECIFIED , -CFPHYPREF_LOW_LAT , -CFPHYPREF_HIGH_BW , -CFPHYPREF_LOOP -}; - -/** -* cfcnfg_create() - Get the CAIF configuration object given network. -* @net: Network for the CAIF configuration object. -*/ -struct cfcnfg *get_cfcnfg (struct net *net); - -/** -* cfcnfg_create() - Create the CAIF configuration object. -*/ -struct cfcnfg *cfcnfg_create (void ); - -/** -* cfcnfg_remove() - Remove the CFCNFG object -* @cfg: config object -*/ -void cfcnfg_remove (struct cfcnfg *cfg); - -/** -* cfcnfg_add_phy_layer() - Adds a physical layer to the CAIF stack. -* @cnfg: Pointer to a CAIF configuration object, created by -* cfcnfg_create(). -* @dev: Pointer to link layer device -* @phy_layer: Specify the physical layer. The transmit function -* MUST be set in the structure. -* @pref: The phy (link layer) preference. -* @link_support: Protocol implementation for link layer specific protocol. -* @fcs: Specify if checksum is used in CAIF Framing Layer. -* @head_room: Head space needed by link specific protocol. -*/ -int -cfcnfg_add_phy_layer (struct cfcnfg *cnfg, -struct net_device *dev,struct cflayer *phy_layer, -enum cfcnfg_phy_preference pref, -struct cflayer *link_support, -bool fcs,int head_room); - -/** -* cfcnfg_del_phy_layer - Deletes an phy layer from the CAIF stack. -* -* @cnfg: Pointer to a CAIF configuration object, created by -* cfcnfg_create(). -* @phy_layer: Adaptation layer to be removed. -*/ -int cfcnfg_del_phy_layer (struct cfcnfg *cnfg,struct cflayer *phy_layer); - -/** -* cfcnfg_set_phy_state() - Set the state of the physical interface device. -* @cnfg: Configuration object -* @phy_layer: Physical Layer representation -* @up: State of device -*/ -int cfcnfg_set_phy_state (struct cfcnfg *cnfg,struct cflayer *phy_layer, -bool up); - -#endif /* CFCNFG_H_ */ include/net/caif/cfctrl.h deleted +0
-130@@ -1,130 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFCTRL_H_ -#define CFCTRL_H_ -#include <net/caif/caif_layer.h> -#include <net/caif/cfsrvl.h> - -/* CAIF Control packet commands */ -enum cfctrl_cmd { -CFCTRL_CMD_LINK_SETUP =0 , -CFCTRL_CMD_LINK_DESTROY =1 , -CFCTRL_CMD_LINK_ERR =2 , -CFCTRL_CMD_ENUM =3 , -CFCTRL_CMD_SLEEP =4 , -CFCTRL_CMD_WAKE =5 , -CFCTRL_CMD_LINK_RECONF =6 , -CFCTRL_CMD_START_REASON =7 , -CFCTRL_CMD_RADIO_SET =8 , -CFCTRL_CMD_MODEM_SET =9 , -CFCTRL_CMD_MASK =0xf -}; - -/* Channel types */ -enum cfctrl_srv { -CFCTRL_SRV_DECM =0 , -CFCTRL_SRV_VEI =1 , -CFCTRL_SRV_VIDEO =2 , -CFCTRL_SRV_DBG =3 , -CFCTRL_SRV_DATAGRAM =4 , -CFCTRL_SRV_RFM =5 , -CFCTRL_SRV_UTIL =6 , -CFCTRL_SRV_MASK =0xf -}; - -#define CFCTRL_RSP_BIT 0x20 -#define CFCTRL_ERR_BIT 0x10 - -struct cfctrl_rsp { -void (*linksetup_rsp)(struct cflayer *layer,u8 linkid, -enum cfctrl_srv serv,u8 phyid, -struct cflayer *adapt_layer); -void (*linkdestroy_rsp)(struct cflayer *layer,u8 linkid); -void (*linkerror_ind)(void ); -void (*enum_rsp)(void ); -void (*sleep_rsp)(void ); -void (*wake_rsp)(void ); -void (*restart_rsp)(void ); -void (*radioset_rsp)(void ); -void (*reject_rsp)(struct cflayer *layer,u8 linkid, -struct cflayer *client_layer); -}; - -/* Link Setup Parameters for CAIF-Links. */ -struct cfctrl_link_param { -enum cfctrl_srv linktype;/* (T3,T0) Type of Channel */ -u8 priority;/* (P4,P0) Priority of the channel */ -u8 phyid;/* (U2-U0) Physical interface to connect */ -u8 endpoint;/* (E1,E0) Endpoint for data channels */ -u8 chtype;/* (H1,H0) Channel-Type, applies to -* VEI, DEBUG */ -union { -struct { -u8 connid;/* (D7,D0) Video LinkId */ - } video; - -struct { -u32 connid;/* (N31,Ngit0) Connection ID used -* for Datagram */ - } datagram; - -struct { -u32 connid;/* Connection ID used for RFM */ -char volume[20 ];/* Volume to mount for RFM */ - } rfm;/* Configuration for RFM */ - -struct { -u16 fifosize_kb;/* Psock FIFO size in KB */ -u16 fifosize_bufs;/* Psock # signal buffers */ -char name[16 ];/* Name of the PSOCK service */ -u8 params[255 ];/* Link setup Parameters> */ -u16 paramlen;/* Length of Link Setup -* Parameters */ - } utility;/* Configuration for Utility Links (Psock) */ - } u; -}; - -/* This structure is used internally in CFCTRL */ -struct cfctrl_request_info { -int sequence_no; -enum cfctrl_cmd cmd; -u8 channel_id; -struct cfctrl_link_param param; -struct cflayer *client_layer; -struct list_head list; -}; - -struct cfctrl { -struct cfsrvl serv; -struct cfctrl_rsp res; -atomic_t req_seq_no; -atomic_t rsp_seq_no; -struct list_head list; -/* Protects from simultaneous access to first_req list */ -spinlock_t info_list_lock; -#ifndef CAIF_NO_LOOP -u8 loop_linkid; -int loop_linkused[256 ]; -/* Protects simultaneous access to loop_linkid and loop_linkused */ -spinlock_t loop_linkid_lock; -#endif - -}; - -void cfctrl_enum_req (struct cflayer *cfctrl,u8 physlinkid); -int cfctrl_linkup_request (struct cflayer *cfctrl, -struct cfctrl_link_param *param, -struct cflayer *user_layer); -int cfctrl_linkdown_req (struct cflayer *cfctrl,u8 linkid, -struct cflayer *client); - -struct cflayer *cfctrl_create (void ); -struct cfctrl_rsp *cfctrl_get_respfuncs (struct cflayer *layer); -int cfctrl_cancel_req (struct cflayer *layr,struct cflayer *adap_layer); -void cfctrl_remove (struct cflayer *layr); - -#endif /* CFCTRL_H_ */ include/net/caif/cffrml.h deleted +0
-21@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFFRML_H_ -#define CFFRML_H_ -#include <net/caif/caif_layer.h> -#include <linux/netdevice.h> - -struct cffrml ; -struct cflayer *cffrml_create (u16 phyid,bool use_fcs); -void cffrml_free (struct cflayer *layr); -void cffrml_set_uplayer (struct cflayer *this,struct cflayer *up); -void cffrml_set_dnlayer (struct cflayer *this,struct cflayer *dn); -void cffrml_put (struct cflayer *layr); -void cffrml_hold (struct cflayer *layr); -int cffrml_refcnt_read (struct cflayer *layr); - -#endif /* CFFRML_H_ */ include/net/caif/cfmuxl.h deleted +0
-20@@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFMUXL_H_ -#define CFMUXL_H_ -#include <net/caif/caif_layer.h> - -struct cfsrvl ; -struct cffrml ; - -struct cflayer *cfmuxl_create (void ); -int cfmuxl_set_uplayer (struct cflayer *layr,struct cflayer *up,u8 linkid); -struct cflayer *cfmuxl_remove_dnlayer (struct cflayer *layr,u8 phyid); -int cfmuxl_set_dnlayer (struct cflayer *layr,struct cflayer *up,u8 phyid); -struct cflayer *cfmuxl_remove_uplayer (struct cflayer *layr,u8 linkid); - -#endif /* CFMUXL_H_ */ include/net/caif/cfpkt.h deleted +0
-232@@ -1,232 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFPKT_H_ -#define CFPKT_H_ -#include <net/caif/caif_layer.h> -#include <linux/types.h> -struct cfpkt ; - -/* Create a CAIF packet. -* len: Length of packet to be created -* @return New packet. -*/ -struct cfpkt *cfpkt_create (u16 len); - -/* -* Destroy a CAIF Packet. -* pkt Packet to be destroyed. -*/ -void cfpkt_destroy (struct cfpkt *pkt); - -/* -* Extract header from packet. -* -* pkt Packet to extract header data from. -* data Pointer to copy the header data into. -* len Length of head data to copy. -* @return zero on success and error code upon failure -*/ -int cfpkt_extr_head (struct cfpkt *pkt,void *data,u16 len); - -static inline u8 cfpkt_extr_head_u8 (struct cfpkt *pkt) -{ -u8 tmp; - -cfpkt_extr_head (pkt, &tmp,1 ); - -return tmp; -} - -static inline u16 cfpkt_extr_head_u16 (struct cfpkt *pkt) -{ -__le16 tmp; - -cfpkt_extr_head (pkt, &tmp,2 ); - -return le16_to_cpu (tmp); -} - -static inline u32 cfpkt_extr_head_u32 (struct cfpkt *pkt) -{ -__le32 tmp; - -cfpkt_extr_head (pkt, &tmp,4 ); - -return le32_to_cpu (tmp); -} - -/* -* Peek header from packet. -* Reads data from packet without changing packet. -* -* pkt Packet to extract header data from. -* data Pointer to copy the header data into. -* len Length of head data to copy. -* @return zero on success and error code upon failure -*/ -int cfpkt_peek_head (struct cfpkt *pkt,void *data,u16 len); - -/* -* Extract header from trailer (end of packet). -* -* pkt Packet to extract header data from. -* data Pointer to copy the trailer data into. -* len Length of header data to copy. -* @return zero on success and error code upon failure -*/ -int cfpkt_extr_trail (struct cfpkt *pkt,void *data,u16 len); - -/* -* Add header to packet. -* -* -* pkt Packet to add header data to. -* data Pointer to data to copy into the header. -* len Length of header data to copy. -* @return zero on success and error code upon failure -*/ -int cfpkt_add_head (struct cfpkt *pkt,const void *data,u16 len); - -/* -* Add trailer to packet. -* -* -* pkt Packet to add trailer data to. -* data Pointer to data to copy into the trailer. -* len Length of trailer data to copy. -* @return zero on success and error code upon failure -*/ -int cfpkt_add_trail (struct cfpkt *pkt,const void *data,u16 len); - -/* -* Pad trailer on packet. -* Moves data pointer in packet, no content copied. -* -* pkt Packet in which to pad trailer. -* len Length of padding to add. -* @return zero on success and error code upon failure -*/ -int cfpkt_pad_trail (struct cfpkt *pkt,u16 len); - -/* -* Add a single byte to packet body (tail). -* -* pkt Packet in which to add byte. -* data Byte to add. -* @return zero on success and error code upon failure -*/ -int cfpkt_addbdy (struct cfpkt *pkt,const u8 data); - -/* -* Add a data to packet body (tail). -* -* pkt Packet in which to add data. -* data Pointer to data to copy into the packet body. -* len Length of data to add. -* @return zero on success and error code upon failure -*/ -int cfpkt_add_body (struct cfpkt *pkt,const void *data,u16 len); - -/* -* Checks whether there are more data to process in packet. -* pkt Packet to check. -* @return true if more data are available in packet false otherwise -*/ -bool cfpkt_more (struct cfpkt *pkt); - -/* -* Checks whether the packet is erroneous, -* i.e. if it has been attempted to extract more data than available in packet -* or writing more data than has been allocated in cfpkt_create(). -* pkt Packet to check. -* @return true on error false otherwise -*/ -bool cfpkt_erroneous (struct cfpkt *pkt); - -/* -* Get the packet length. -* pkt Packet to get length from. -* @return Number of bytes in packet. -*/ -u16 cfpkt_getlen (struct cfpkt *pkt); - -/* -* Set the packet length, by adjusting the trailer pointer according to length. -* pkt Packet to set length. -* len Packet length. -* @return Number of bytes in packet. -*/ -int cfpkt_setlen (struct cfpkt *pkt,u16 len); - -/* -* cfpkt_append - Appends a packet's data to another packet. -* dstpkt: Packet to append data into, WILL BE FREED BY THIS FUNCTION -* addpkt: Packet to be appended and automatically released, -* WILL BE FREED BY THIS FUNCTION. -* expectlen: Packet's expected total length. This should be considered -* as a hint. -* NB: Input packets will be destroyed after appending and cannot be used -* after calling this function. -* @return The new appended packet. -*/ -struct cfpkt *cfpkt_append (struct cfpkt *dstpkt,struct cfpkt *addpkt, -u16 expectlen); - -/* -* cfpkt_split - Split a packet into two packets at the specified split point. -* pkt: Packet to be split (will contain the first part of the data on exit) -* pos: Position to split packet in two parts. -* @return The new packet, containing the second part of the data. -*/ -struct cfpkt *cfpkt_split (struct cfpkt *pkt,u16 pos); - -/* -* Iteration function, iterates the packet buffers from start to end. -* -* Checksum iteration function used to iterate buffers -* (we may have packets consisting of a chain of buffers) -* pkt: Packet to calculate checksum for -* iter_func: Function pointer to iteration function -* chks: Checksum calculated so far. -* buf: Pointer to the buffer to checksum -* len: Length of buf. -* data: Initial checksum value. -* @return Checksum of buffer. -*/ - -int cfpkt_iterate (struct cfpkt *pkt, -u16 (*iter_func)(u16 chks,void *buf,u16 len), -u16 data); - -/* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet. -* dir - Direction indicating whether this packet is to be sent or received. -* nativepkt - The native packet to be transformed to a CAIF packet -* @return The mapped CAIF Packet CFPKT. -*/ -struct cfpkt *cfpkt_fromnative (enum caif_direction dir,void *nativepkt); - -/* Map from a CAIF packet to a "native" packet (e.g. Linux Socket Buffer). -* pkt - The CAIF packet to be transformed into a "native" packet. -* @return The native packet transformed from a CAIF packet. -*/ -void *cfpkt_tonative (struct cfpkt *pkt); - -/* -* Returns packet information for a packet. -* pkt Packet to get info from; -* @return Packet information -*/ -struct caif_payload_info *cfpkt_info (struct cfpkt *pkt); - -/** cfpkt_set_prio - set priority for a CAIF packet. -* -* @pkt: The CAIF packet to be adjusted. -* @prio: one of TC_PRIO_ constants. -*/ -void cfpkt_set_prio (struct cfpkt *pkt,int prio); - -#endif /* CFPKT_H_ */ include/net/caif/cfserl.h deleted +0
-13@@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFSERL_H_ -#define CFSERL_H_ -#include <net/caif/caif_layer.h> - -struct cflayer *cfserl_create (int instance,bool use_stx); -void cfserl_release (struct cflayer *layer); -#endif include/net/caif/cfsrvl.h deleted +0
-61@@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#ifndef CFSRVL_H_ -#define CFSRVL_H_ -#include <linux/list.h> -#include <linux/stddef.h> -#include <linux/types.h> -#include <linux/kref.h> -#include <linux/rculist.h> - -struct cfsrvl { -struct cflayer layer; -bool open; -bool phy_flow_on; -bool modem_flow_on; -bool supports_flowctrl; -void (*release)(struct cflayer *layer); -struct dev_info dev_info; -void (*hold)(struct cflayer *lyr); -void (*put)(struct cflayer *lyr); -struct rcu_head rcu; -}; - -struct cflayer *cfvei_create (u8 linkid,struct dev_info *dev_info); -struct cflayer *cfdgml_create (u8 linkid,struct dev_info *dev_info); -struct cflayer *cfutill_create (u8 linkid,struct dev_info *dev_info); -struct cflayer *cfvidl_create (u8 linkid,struct dev_info *dev_info); -struct cflayer *cfrfml_create (u8 linkid,struct dev_info *dev_info, -int mtu_size); -struct cflayer *cfdbgl_create (u8 linkid,struct dev_info *dev_info); - -bool cfsrvl_phyid_match (struct cflayer *layer,int phyid); - -void cfsrvl_init (struct cfsrvl *service, -u8 channel_id, -struct dev_info *dev_info, -bool supports_flowctrl); -bool cfsrvl_ready (struct cfsrvl *service,int *err); - -static inline void cfsrvl_get (struct cflayer *layr) -{ - struct cfsrvl *s = container_of(layr, struct cfsrvl, layer); -if (layr ==NULL || layr->up ==NULL || s->hold ==NULL ) -return ; - - s->hold (layr->up); -} - -static inline void cfsrvl_put (struct cflayer *layr) -{ - struct cfsrvl *s = container_of(layr, struct cfsrvl, layer); -if (layr ==NULL || layr->up ==NULL || s->hold ==NULL ) -return ; - - s->put (layr->up); -} -#endif /* CFSRVL_H_ */ include/uapi/linux/caif/caif_socket.h deleted +0
-195@@ -1,195 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* linux/caif_socket.h -* CAIF Definitions for CAIF socket and network layer -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -* License terms: GNU General Public License (GPL) version 2 -*/ - -#ifndef _LINUX_CAIF_SOCKET_H -#define _LINUX_CAIF_SOCKET_H - -#include <linux/types.h> -#include <linux/socket.h> - -/** -* enum caif_link_selector - Physical Link Selection. -* @CAIF_LINK_HIGH_BANDW: Physical interface for high-bandwidth -* traffic. -* @CAIF_LINK_LOW_LATENCY: Physical interface for low-latency -* traffic. -* -* CAIF Link Layers can register their link properties. -* This enum is used for choosing between CAIF Link Layers when -* setting up CAIF Channels when multiple CAIF Link Layers exists. -*/ -enum caif_link_selector { -CAIF_LINK_HIGH_BANDW , -CAIF_LINK_LOW_LATENCY -}; - -/** -* enum caif_channel_priority - CAIF channel priorities. -* -* @CAIF_PRIO_MIN: Min priority for a channel. -* @CAIF_PRIO_LOW: Low-priority channel. -* @CAIF_PRIO_NORMAL: Normal/default priority level. -* @CAIF_PRIO_HIGH: High priority level -* @CAIF_PRIO_MAX: Max priority for channel -* -* Priority can be set on CAIF Channels in order to -* prioritize between traffic on different CAIF Channels. -* These priority levels are recommended, but the priority value -* is not restricted to the values defined in this enum, any value -* between CAIF_PRIO_MIN and CAIF_PRIO_MAX could be used. -*/ -enum caif_channel_priority { -CAIF_PRIO_MIN =0x01 , -CAIF_PRIO_LOW =0x04 , -CAIF_PRIO_NORMAL =0x0f , -CAIF_PRIO_HIGH =0x14 , -CAIF_PRIO_MAX =0x1F -}; - -/** -* enum caif_protocol_type - CAIF Channel type. -* @CAIFPROTO_AT: Classic AT channel. -* @CAIFPROTO_DATAGRAM: Datagram channel. -* @CAIFPROTO_DATAGRAM_LOOP: Datagram loopback channel, used for testing. -* @CAIFPROTO_UTIL: Utility (Psock) channel. -* @CAIFPROTO_RFM: Remote File Manager -* @CAIFPROTO_DEBUG: Debug link -* -* This enum defines the CAIF Channel type to be used. This defines -* the service to connect to on the modem. -*/ -enum caif_protocol_type { -CAIFPROTO_AT , -CAIFPROTO_DATAGRAM , -CAIFPROTO_DATAGRAM_LOOP , -CAIFPROTO_UTIL , -CAIFPROTO_RFM , -CAIFPROTO_DEBUG , - _CAIFPROTO_MAX -}; -#define CAIFPROTO_MAX _CAIFPROTO_MAX - -/** -* enum caif_at_type - AT Service Endpoint -* @CAIF_ATTYPE_PLAIN: Connects to a plain vanilla AT channel. -*/ -enum caif_at_type { -CAIF_ATTYPE_PLAIN =2 -}; -/** -* enum caif_debug_type - Content selection for debug connection -* @CAIF_DEBUG_TRACE_INTERACTIVE: Connection will contain -* both trace and interactive debug. -* @CAIF_DEBUG_TRACE: Connection contains trace only. -* @CAIF_DEBUG_INTERACTIVE: Connection to interactive debug. -*/ -enum caif_debug_type { -CAIF_DEBUG_TRACE_INTERACTIVE =0 , -CAIF_DEBUG_TRACE , -CAIF_DEBUG_INTERACTIVE , -}; - -/** -* enum caif_debug_service - Debug Service Endpoint -* @CAIF_RADIO_DEBUG_SERVICE: Debug service on the Radio sub-system -* @CAIF_APP_DEBUG_SERVICE: Debug for the applications sub-system -*/ -enum caif_debug_service { -CAIF_RADIO_DEBUG_SERVICE =1 , -CAIF_APP_DEBUG_SERVICE -}; - -/** -* struct sockaddr_caif - the sockaddr structure for CAIF sockets. -* @family: Address family number, must be AF_CAIF. -* @u: Union of address data 'switched' by family. -* : -* @u.at: Applies when family = CAIFPROTO_AT. -* -* @u.at.type: Type of AT link to set up (enum caif_at_type). -* -* @u.util: Applies when family = CAIFPROTO_UTIL -* -* @u.util.service: Utility service name. -* -* @u.dgm: Applies when family = CAIFPROTO_DATAGRAM -* -* @u.dgm.connection_id: Datagram connection id. -* -* @u.dgm.nsapi: NSAPI of the PDP-Context. -* -* @u.rfm: Applies when family = CAIFPROTO_RFM -* -* @u.rfm.connection_id: Connection ID for RFM. -* -* @u.rfm.volume: Volume to mount. -* -* @u.dbg: Applies when family = CAIFPROTO_DEBUG. -* -* @u.dbg.type: Type of debug connection to set up -* (caif_debug_type). -* -* @u.dbg.service: Service sub-system to connect (caif_debug_service -* Description: -* This structure holds the connect parameters used for setting up a -* CAIF Channel. It defines the service to connect to on the modem. -*/ -struct sockaddr_caif { -__kernel_sa_family_t family; -union { -struct { -__u8 type;/* type: enum caif_at_type */ - } at;/* CAIFPROTO_AT */ -struct { -char service[16 ]; - } util;/* CAIFPROTO_UTIL */ -union { -__u32 connection_id; -__u8 nsapi; - } dgm;/* CAIFPROTO_DATAGRAM(_LOOP)*/ -struct { -__u32 connection_id; -char volume[16 ]; - } rfm;/* CAIFPROTO_RFM */ -struct { -__u8 type;/* type:enum caif_debug_type */ -__u8 service;/* service:caif_debug_service */ - } dbg;/* CAIFPROTO_DEBUG */ - } u; -}; - -/** -* enum caif_socket_opts - CAIF option values for getsockopt and setsockopt. -* -* @CAIFSO_LINK_SELECT: Selector used if multiple CAIF Link layers are -* available. Either a high bandwidth -* link can be selected (CAIF_LINK_HIGH_BANDW) or -* a low latency link (CAIF_LINK_LOW_LATENCY). -* This option is of type __u32. -* Alternatively SO_BINDTODEVICE can be used. -* -* @CAIFSO_REQ_PARAM: Used to set the request parameters for a -* utility channel. (maximum 256 bytes). This -* option must be set before connecting. -* -* @CAIFSO_RSP_PARAM: Gets the response parameters for a utility -* channel. (maximum 256 bytes). This option -* is valid after a successful connect. -* -* -* This enum defines the CAIF Socket options to be used on a socket -* of type PF_CAIF. -* -*/ -enum caif_socket_opts { -CAIFSO_LINK_SELECT =127 , -CAIFSO_REQ_PARAM =128 , -CAIFSO_RSP_PARAM =129 , -}; - -#endif /* _LINUX_CAIF_SOCKET_H */ include/uapi/linux/caif/if_caif.h deleted +0
-35@@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -* License terms: GNU General Public License (GPL) version 2 -*/ - -#ifndef IF_CAIF_H_ -#define IF_CAIF_H_ -#include <linux/sockios.h> -#include <linux/types.h> -#include <linux/socket.h> - -/** -* enum ifla_caif - CAIF NetlinkRT parameters. -* @IFLA_CAIF_IPV4_CONNID: Connection ID for IPv4 PDP Context. -* The type of attribute is NLA_U32. -* @IFLA_CAIF_IPV6_CONNID: Connection ID for IPv6 PDP Context. -* The type of attribute is NLA_U32. -* @IFLA_CAIF_LOOPBACK: If different from zero, device is doing loopback -* The type of attribute is NLA_U8. -* -* When using RT Netlink to create, destroy or configure a CAIF IP interface, -* enum ifla_caif is used to specify the configuration attributes. -*/ -enum ifla_caif { - __IFLA_CAIF_UNSPEC, -IFLA_CAIF_IPV4_CONNID , -IFLA_CAIF_IPV6_CONNID , -IFLA_CAIF_LOOPBACK , - __IFLA_CAIF_MAX -}; -#define IFLA_CAIF_MAX (__IFLA_CAIF_MAX-1) - -#endif /*IF_CAIF_H_*/ drivers/net/caif/caif_serial.c deleted +0
-443@@ -1,443 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* Copyright (C) ST-Ericsson AB 2010 -* Author: Sjur Brendeland -*/ - -#include <linux/hardirq.h> -#include <linux/init.h> -#include <linux/module.h> -#include <linux/device.h> -#include <linux/types.h> -#include <linux/skbuff.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <linux/tty.h> -#include <linux/file.h> -#include <linux/if_arp.h> -#include <net/caif/caif_device.h> -#include <net/caif/cfcnfg.h> -#include <linux/err.h> -#include <linux/debugfs.h> - -MODULE_LICENSE ("GPL" ); -MODULE_AUTHOR ("Sjur Brendeland" ); -MODULE_DESCRIPTION ("CAIF serial device TTY line discipline" ); -MODULE_LICENSE ("GPL" ); -MODULE_ALIAS_LDISC (N_CAIF ); - -#define SEND_QUEUE_LOW 10 -#define SEND_QUEUE_HIGH 100 -#define CAIF_SENDING 1/* Bit 1 = 0x02*/ -#define CAIF_FLOW_OFF_SENT 4/* Bit 4 = 0x10 */ -#define MAX_WRITE_CHUNK 4096 -#define ON 1 -#define OFF 0 -#define CAIF_MAX_MTU 4096 - -static DEFINE_SPINLOCK (ser_lock); -static LIST_HEAD (ser_list); -static LIST_HEAD (ser_release_list); - -static bool ser_loop; -module_param (ser_loop, bool,0444 ); -MODULE_PARM_DESC (ser_loop,"Run in simulated loopback mode." ); - -static bool ser_use_stx = true; -module_param (ser_use_stx, bool,0444 ); -MODULE_PARM_DESC (ser_use_stx,"STX enabled or not." ); - -static bool ser_use_fcs = true; - -module_param (ser_use_fcs, bool,0444 ); -MODULE_PARM_DESC (ser_use_fcs,"FCS enabled or not." ); - -static int ser_write_chunk =MAX_WRITE_CHUNK ; -module_param (ser_write_chunk, int,0444 ); - -MODULE_PARM_DESC (ser_write_chunk,"Maximum size of data written to UART." ); - -static struct dentry *debugfsdir; - -static int caif_net_open (struct net_device *dev); -static int caif_net_close (struct net_device *dev); - -struct ser_device { -struct caif_dev_common common; -struct list_head node; -struct net_device *dev; -struct sk_buff_head head; -struct tty_struct *tty; -bool tx_started; -unsigned long state; -#ifdef CONFIG_DEBUG_FS -struct dentry *debugfs_tty_dir; -struct debugfs_blob_wrapper tx_blob; -struct debugfs_blob_wrapper rx_blob; -u8 rx_data[128 ]; -u8 tx_data[128 ]; -u8 tty_status; - -#endif -}; - -static void caifdev_setup (struct net_device *dev); -static void ldisc_tx_wakeup (struct tty_struct *tty); -#ifdef CONFIG_DEBUG_FS -static inline void update_tty_status (struct ser_device *ser) -{ - ser->tty_status = - ser->tty->flow.stopped <<5 | - ser->tty->flow.tco_stopped <<3 | - ser->tty->ctrl.packet <<2 ; -} -static inline void debugfs_init (struct ser_device *ser,struct tty_struct *tty) -{ - ser->debugfs_tty_dir =debugfs_create_dir (tty->name, debugfsdir); - -debugfs_create_blob ("last_tx_msg" ,0400 , ser->debugfs_tty_dir, - &ser->tx_blob); - -debugfs_create_blob ("last_rx_msg" ,0400 , ser->debugfs_tty_dir, - &ser->rx_blob); - -debugfs_create_xul ("ser_state" ,0400 , ser->debugfs_tty_dir, - &ser->state); - -debugfs_create_x8 ("tty_status" ,0400 , ser->debugfs_tty_dir, - &ser->tty_status); - - ser->tx_blob.data = ser->tx_data; - ser->tx_blob.size =0 ; - ser->rx_blob.data = ser->rx_data; - ser->rx_blob.size =0 ; -} - -static inline void debugfs_deinit (struct ser_device *ser) -{ -debugfs_remove_recursive (ser->debugfs_tty_dir); -} - -static inline void debugfs_rx (struct ser_device *ser,const u8 *data,int size) -{ -if (size >sizeof (ser->rx_data)) - size =sizeof (ser->rx_data); -memcpy (ser->rx_data, data, size); - ser->rx_blob.data = ser->rx_data; - ser->rx_blob.size = size; -} -#else -static inline void debugfs_init (struct ser_device *ser,struct tty_struct *tty) -{ -} - -static inline void debugfs_deinit (struct ser_device *ser) -{ -} - -static inline void update_tty_status (struct ser_device *ser) -{ -} - -static inline void debugfs_rx (struct ser_device *ser,const u8 *data,int size) -{ -} -#endif - -static void ldisc_receive (struct tty_struct *tty,const u8 *data, -const u8 *flags,size_t count) -{ -struct sk_buff *skb =NULL ; -struct ser_device *ser; -int ret; - - ser = tty->disc_data; - -/* -* NOTE: flags may contain information about break or overrun. -* This is not yet handled. -*/ - - -/* -* Workaround for garbage at start of transmission, -* only enable if STX handling is not enabled. -*/ -if (!ser->common.use_stx && !ser->tx_started) { -dev_info (&ser->dev->dev, -"Bytes received before initial transmission -" -"bytes discarded.\n" ); -return ; - } - -BUG_ON (ser->dev ==NULL ); - -/* Get a suitable caif packet and copy in data. */ - skb =netdev_alloc_skb (ser->dev, count+1 ); -if (skb ==NULL ) -return ; -skb_put_data (skb, data, count); - - skb->protocol =htons (ETH_P_CAIF ); -skb_reset_mac_header (skb); -debugfs_rx (ser, data, count); -/* Push received packet up the stack. */ - ret =netif_rx (skb); -if (!ret) { - ser->dev->stats.rx_packets++; - ser->dev->stats.rx_bytes += count; - }else - ++ser->dev->stats.rx_dropped; -update_tty_status (ser); -} - -static int handle_tx (struct ser_device *ser) -{ -struct tty_struct *tty; -struct sk_buff *skb; -int tty_wr, len, room; - - tty = ser->tty; - ser->tx_started = true; - -/* Enter critical section */ -if (test_and_set_bit (CAIF_SENDING , &ser->state)) -return 0 ; - -/* skb_peek is safe because handle_tx is called after skb_queue_tail */ -while ((skb =skb_peek (&ser->head)) !=NULL ) { - -/* Make sure you don't write too much */ - len = skb->len; - room =tty_write_room (tty); -if (!room) -break ; -if (room > ser_write_chunk) - room = ser_write_chunk; -if (len > room) - len = room; - -/* Write to tty or loopback */ -if (!ser_loop) { - tty_wr = tty->ops->write (tty, skb->data, len); -update_tty_status (ser); - }else { - tty_wr = len; -ldisc_receive (tty, skb->data,NULL , len); - } - ser->dev->stats.tx_packets++; - ser->dev->stats.tx_bytes += tty_wr; - -/* Error on TTY ?! */ -if (tty_wr <0 ) - goto error; -/* Reduce buffer written, and discard if empty */ -skb_pull (skb, tty_wr); -if (skb->len ==0 ) { -struct sk_buff *tmp =skb_dequeue (&ser->head); -WARN_ON (tmp != skb); -dev_consume_skb_any (skb); - } - } -/* Send flow off if queue is empty */ -if (ser->head.qlen <=SEND_QUEUE_LOW && -test_and_clear_bit (CAIF_FLOW_OFF_SENT , &ser->state) && - ser->common.flowctrl !=NULL ) - ser->common.flowctrl (ser->dev,ON ); -clear_bit (CAIF_SENDING , &ser->state); -return 0 ; -error: -clear_bit (CAIF_SENDING , &ser->state); -return tty_wr; -} - -static netdev_tx_t caif_xmit (struct sk_buff *skb,struct net_device *dev) -{ -struct ser_device *ser; - - ser =netdev_priv (dev); - -/* Send flow off once, on high water mark */ -if (ser->head.qlen >SEND_QUEUE_HIGH && - !test_and_set_bit (CAIF_FLOW_OFF_SENT , &ser->state) && - ser->common.flowctrl !=NULL ) - - ser->common.flowctrl (ser->dev,OFF ); - -skb_queue_tail (&ser->head, skb); -return handle_tx (ser); -} - - -static void ldisc_tx_wakeup (struct tty_struct *tty) -{ -struct ser_device *ser; - - ser = tty->disc_data; -BUG_ON (ser ==NULL ); -WARN_ON (ser->tty != tty); -handle_tx (ser); -} - - -static void ser_release (struct work_struct *work) -{ -struct list_head list; -struct ser_device *ser, *tmp; -struct tty_struct *tty; - -spin_lock (&ser_lock); -list_replace_init (&ser_release_list, &list); -spin_unlock (&ser_lock); - -if (!list_empty (&list)) { -rtnl_lock (); -list_for_each_entry_safe (ser, tmp, &list, node) { - tty = ser->tty; -dev_close (ser->dev); -unregister_netdevice (ser->dev); -debugfs_deinit (ser); -tty_kref_put (tty->link); -tty_kref_put (tty); - } -rtnl_unlock (); - } -} - -static DECLARE_WORK(ser_release_work, ser_release); - -static int ldisc_open (struct tty_struct *tty) -{ -struct ser_device *ser; -struct net_device *dev; -char name[64 ]; -int result; - -/* No write no play */ -if (tty->ops->write ==NULL ) -return -EOPNOTSUPP ; -if (!capable (CAP_SYS_ADMIN ) && !capable (CAP_SYS_TTY_CONFIG )) -return -EPERM ; - -/* release devices to avoid name collision */ -ser_release (NULL ); - - result =snprintf (name,sizeof (name),"cf%s" , tty->name); -if (result >=IFNAMSIZ ) -return -EINVAL ; - dev =alloc_netdev (sizeof (*ser), name,NET_NAME_UNKNOWN , - caifdev_setup); -if (!dev) -return -ENOMEM ; - - ser =netdev_priv (dev); - ser->tty =tty_kref_get (tty); -tty_kref_get (tty->link); - ser->dev = dev; -debugfs_init (ser, tty); - tty->receive_room =4096 ; - tty->disc_data = ser; -set_bit (TTY_DO_WRITE_WAKEUP , &tty->flags); -rtnl_lock (); - result =register_netdevice (dev); -if (result) { -tty_kref_put (tty->link); -tty_kref_put (tty); -rtnl_unlock (); -free_netdev (dev); -return -ENODEV ; - } - -spin_lock (&ser_lock); -list_add (&ser->node, &ser_list); -spin_unlock (&ser_lock); -rtnl_unlock (); -netif_stop_queue (dev); -update_tty_status (ser); -return 0 ; -} - -static void ldisc_close (struct tty_struct *tty) -{ -struct ser_device *ser = tty->disc_data; - -spin_lock (&ser_lock); -list_move (&ser->node, &ser_release_list); -spin_unlock (&ser_lock); -schedule_work (&ser_release_work); -} - -/* The line discipline structure. */ -static struct tty_ldisc_ops caif_ldisc = { - .owner =THIS_MODULE , - .num =N_CAIF , - .name ="n_caif" , - .open = ldisc_open, - .close = ldisc_close, - .receive_buf = ldisc_receive, - .write_wakeup = ldisc_tx_wakeup -}; - -static const struct net_device_ops netdev_ops = { - .ndo_open = caif_net_open, - .ndo_stop = caif_net_close, - .ndo_start_xmit = caif_xmit -}; - -static void caifdev_setup (struct net_device *dev) -{ -struct ser_device *serdev =netdev_priv (dev); - - dev->features =0 ; - dev->netdev_ops = &netdev_ops; - dev->type =ARPHRD_CAIF ; - dev->flags =IFF_POINTOPOINT |IFF_NOARP ; - dev->mtu =CAIF_MAX_MTU ; - dev->priv_flags |=IFF_NO_QUEUE ; - dev->needs_free_netdev = true; -skb_queue_head_init (&serdev->head); - serdev->common.link_select =CAIF_LINK_LOW_LATENCY ; - serdev->common.use_frag = true; - serdev->common.use_stx = ser_use_stx; - serdev->common.use_fcs = ser_use_fcs; - serdev->dev = dev; -} - - -static int caif_net_open (struct net_device *dev) -{ -netif_wake_queue (dev); -return 0 ; -} - -static int caif_net_close (struct net_device *dev) -{ -netif_stop_queue (dev); -return 0 ; -} - -static int __init caif_ser_init (void ) -{ -int ret; - - ret =tty_register_ldisc (&caif_ldisc); -if (ret <0 ) -pr_err ("cannot register CAIF ldisc=%d err=%d\n" ,N_CAIF , ret); - - debugfsdir =debugfs_create_dir ("caif_serial" ,NULL ); -return ret; -} - -static void __exit caif_ser_exit(void) -{ -spin_lock (&ser_lock); -list_splice (&ser_list, &ser_release_list); -spin_unlock (&ser_lock); -ser_release (NULL ); -cancel_work_sync (&ser_release_work); -tty_unregister_ldisc (&caif_ldisc); -debugfs_remove_recursive (debugfsdir); -} - -module_init (caif_ser_init); -module_exit (caif_ser_exit);drivers/net/caif/caif_virtio.c deleted +0
-791@@ -1,791 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* -* Copyright (C) ST-Ericsson AB 2013 -* Authors: Vicram Arv -* Dmitry Tarnyagin <[email protected]> -* Sjur Brendeland -*/ -#include <linux/module.h> -#include <linux/if_arp.h> -#include <linux/virtio.h> -#include <linux/vringh.h> -#include <linux/debugfs.h> -#include <linux/spinlock.h> -#include <linux/genalloc.h> -#include <linux/interrupt.h> -#include <linux/netdevice.h> -#include <linux/rtnetlink.h> -#include <linux/virtio_ids.h> -#include <linux/virtio_caif.h> -#include <linux/virtio_ring.h> -#include <linux/dma-mapping.h> -#include <net/caif/caif_dev.h> -#include <linux/virtio_config.h> - -MODULE_LICENSE ("GPL v2" ); -MODULE_AUTHOR ("Vicram Arv" ); -MODULE_AUTHOR ("Sjur Brendeland" ); -MODULE_DESCRIPTION ("Virtio CAIF Driver" ); - -/* NAPI schedule quota */ -#define CFV_DEFAULT_QUOTA 32 - -/* Defaults used if virtio config space is unavailable */ -#define CFV_DEF_MTU_SIZE 4096 -#define CFV_DEF_HEADROOM 32 -#define CFV_DEF_TAILROOM 32 - -/* Required IP header alignment */ -#define IP_HDR_ALIGN 4 - -/* struct cfv_napi_contxt - NAPI context info -* @riov: IOV holding data read from the ring. Note that riov may -* still hold data when cfv_rx_poll() returns. -* @head: Last descriptor ID we received from vringh_getdesc_kern. -* We use this to put descriptor back on the used ring. USHRT_MAX is -* used to indicate invalid head-id. -*/ -struct cfv_napi_context { -struct vringh_kiov riov; -unsigned short head; -}; - -/* struct cfv_stats - statistics for debugfs -* @rx_napi_complete: Number of NAPI completions (RX) -* @rx_napi_resched: Number of calls where the full quota was used (RX) -* @rx_nomem: Number of SKB alloc failures (RX) -* @rx_kicks: Number of RX kicks -* @tx_full_ring: Number times TX ring was full -* @tx_no_mem: Number of times TX went out of memory -* @tx_flow_on: Number of flow on (TX) -* @tx_kicks: Number of TX kicks -*/ -struct cfv_stats { -u32 rx_napi_complete; -u32 rx_napi_resched; -u32 rx_nomem; -u32 rx_kicks; -u32 tx_full_ring; -u32 tx_no_mem; -u32 tx_flow_on; -u32 tx_kicks; -}; - -/* struct cfv_info - Caif Virtio control structure -* @cfdev: caif common header -* @vdev: Associated virtio device -* @vr_rx: rx/downlink host vring -* @vq_tx: tx/uplink virtqueue -* @ndev: CAIF link layer device -* @watermark_tx: indicates number of free descriptors we need -* to reopen the tx-queues after overload. -* @tx_lock: protects vq_tx from concurrent use -* @tx_release_tasklet: Tasklet for freeing consumed TX buffers -* @napi: Napi context used in cfv_rx_poll() -* @ctx: Context data used in cfv_rx_poll() -* @tx_hr: transmit headroom -* @rx_hr: receive headroom -* @tx_tr: transmit tail room -* @rx_tr: receive tail room -* @mtu: transmit max size -* @mru: receive max size -* @allocsz: size of dma memory reserved for TX buffers -* @alloc_addr: virtual address to dma memory for TX buffers -* @alloc_dma: dma address to dma memory for TX buffers -* @genpool: Gen Pool used for allocating TX buffers -* @reserved_mem: Pointer to memory reserve allocated from genpool -* @reserved_size: Size of memory reserve allocated from genpool -* @stats: Statistics exposed in sysfs -* @debugfs: Debugfs dentry for statistic counters -*/ -struct cfv_info { -struct caif_dev_common cfdev; -struct virtio_device *vdev; -struct vringh *vr_rx; -struct virtqueue *vq_tx; -struct net_device *ndev; -unsigned int watermark_tx; -/* Protect access to vq_tx */ -spinlock_t tx_lock; -struct tasklet_struct tx_release_tasklet; -struct napi_struct napi; -struct cfv_napi_context ctx; -u16 tx_hr; -u16 rx_hr; -u16 tx_tr; -u16 rx_tr; -u32 mtu; -u32 mru; -size_t allocsz; -void *alloc_addr; -dma_addr_t alloc_dma; -struct gen_pool *genpool; -unsigned long reserved_mem; -size_t reserved_size; -struct cfv_stats stats; -struct dentry *debugfs; -}; - -/* struct buf_info - maintains transmit buffer data handle -* @size: size of transmit buffer -* @dma_handle: handle to allocated dma device memory area -* @vaddr: virtual address mapping to allocated memory area -*/ -struct buf_info { -size_t size; -u8 *vaddr; -}; - -/* Called from virtio device, in IRQ context */ -static void cfv_release_cb (struct virtqueue *vq_tx) -{ -struct cfv_info *cfv = vq_tx->vdev->priv; - - ++cfv->stats.tx_kicks; -tasklet_schedule (&cfv->tx_release_tasklet); -} - -static void free_buf_info (struct cfv_info *cfv,struct buf_info *buf_info) -{ -if (!buf_info) -return ; -gen_pool_free (cfv->genpool, (unsigned long ) buf_info->vaddr, - buf_info->size); -kfree (buf_info); -} - -/* This is invoked whenever the remote processor completed processing -* a TX msg we just sent, and the buffer is put back to the used ring. -*/ -static void cfv_release_used_buf (struct virtqueue *vq_tx) -{ -struct cfv_info *cfv = vq_tx->vdev->priv; -unsigned long flags; - -BUG_ON (vq_tx != cfv->vq_tx); - -for (;;) { -unsigned int len; -struct buf_info *buf_info; - -/* Get used buffer from used ring to recycle used descriptors */ -spin_lock_irqsave (&cfv->tx_lock, flags); - buf_info =virtqueue_get_buf (vq_tx, &len); -spin_unlock_irqrestore (&cfv->tx_lock, flags); - -/* Stop looping if there are no more buffers to free */ -if (!buf_info) -break ; - -free_buf_info (cfv, buf_info); - -/* watermark_tx indicates if we previously stopped the tx -* queues. If we have enough free stots in the virtio ring, -* re-establish memory reserved and open up tx queues. -*/ -if (cfv->vq_tx->num_free <= cfv->watermark_tx) -continue ; - -/* Re-establish memory reserve */ -if (cfv->reserved_mem ==0 && cfv->genpool) - cfv->reserved_mem = -gen_pool_alloc (cfv->genpool, - cfv->reserved_size); - -/* Open up the tx queues */ -if (cfv->reserved_mem) { - cfv->watermark_tx = -virtqueue_get_vring_size (cfv->vq_tx); -netif_tx_wake_all_queues (cfv->ndev); -/* Buffers are recycled in cfv_netdev_tx, so -* disable notifications when queues are opened. -*/ -virtqueue_disable_cb (cfv->vq_tx); - ++cfv->stats.tx_flow_on; - }else { -/* if no memory reserve, wait for more free slots */ -WARN_ON (cfv->watermark_tx > -virtqueue_get_vring_size (cfv->vq_tx)); - cfv->watermark_tx += -virtqueue_get_vring_size (cfv->vq_tx) /4 ; - } - } -} - -/* Allocate a SKB and copy packet data to it */ -static struct sk_buff *cfv_alloc_and_copy_skb (int *err, -struct cfv_info *cfv, -u8 *frm,u32 frm_len) -{ -struct sk_buff *skb; -u32 cfpkt_len, pad_len; - - *err =0 ; -/* Verify that packet size with down-link header and mtu size */ -if (frm_len > cfv->mru || frm_len <= cfv->rx_hr + cfv->rx_tr) { -netdev_err (cfv->ndev, -"Invalid frmlen:%u mtu:%u hr:%d tr:%d\n" , - frm_len, cfv->mru, cfv->rx_hr, - cfv->rx_tr); - *err = -EPROTO ; -return NULL ; - } - - cfpkt_len = frm_len - (cfv->rx_hr + cfv->rx_tr); - pad_len = (unsigned long )(frm + cfv->rx_hr) & (IP_HDR_ALIGN -1 ); - - skb =netdev_alloc_skb (cfv->ndev, frm_len + pad_len); -if (!skb) { - *err = -ENOMEM ; -return NULL ; - } - -skb_reserve (skb, cfv->rx_hr + pad_len); - -skb_put_data (skb, frm + cfv->rx_hr, cfpkt_len); -return skb; -} - -/* Get packets from the host vring */ -static int cfv_rx_poll (struct napi_struct *napi,int quota) -{ - struct cfv_info *cfv = container_of(napi, struct cfv_info, napi); -int rxcnt =0 ; -int err =0 ; -void *buf; -struct sk_buff *skb; -struct vringh_kiov *riov = &cfv->ctx.riov; -unsigned int skb_len; - -do { - skb =NULL ; - -/* Put the previous iovec back on the used ring and -* fetch a new iovec if we have processed all elements. -*/ -if (riov->i == riov->used) { -if (cfv->ctx.head !=USHRT_MAX ) { -vringh_complete_kern (cfv->vr_rx, - cfv->ctx.head, -0 ); - cfv->ctx.head =USHRT_MAX ; - } - - err =vringh_getdesc_kern ( - cfv->vr_rx, - riov, -NULL , - &cfv->ctx.head, -GFP_ATOMIC ); - -if (err <=0 ) - goto exit; - } - - buf =phys_to_virt ((unsigned long ) riov->iov[riov->i].iov_base); -/* TODO: Add check on valid buffer address */ - - skb =cfv_alloc_and_copy_skb (&err, cfv, buf, - riov->iov[riov->i].iov_len); -if (unlikely (err)) - goto exit; - -/* Push received packet up the stack. */ - skb_len = skb->len; - skb->protocol =htons (ETH_P_CAIF ); -skb_reset_mac_header (skb); - skb->dev = cfv->ndev; - err =netif_receive_skb (skb); -if (unlikely (err)) { - ++cfv->ndev->stats.rx_dropped; - }else { - ++cfv->ndev->stats.rx_packets; - cfv->ndev->stats.rx_bytes += skb_len; - } - - ++riov->i; - ++rxcnt; - }while (rxcnt < quota); - - ++cfv->stats.rx_napi_resched; - goto out; - -exit: -switch (err) { -case 0 : - ++cfv->stats.rx_napi_complete; - -/* Really out of packets? (stolen from virtio_net)*/ -napi_complete (napi); -if (unlikely (!vringh_notify_enable_kern (cfv->vr_rx)) && -napi_schedule_prep (napi)) { -vringh_notify_disable_kern (cfv->vr_rx); -__napi_schedule (napi); - } -break ; - -case -ENOMEM : - ++cfv->stats.rx_nomem; -dev_kfree_skb (skb); -/* Stop NAPI poll on OOM, we hope to be polled later */ -napi_complete (napi); -vringh_notify_enable_kern (cfv->vr_rx); -break ; - -default : -/* We're doomed, any modem fault is fatal */ -netdev_warn (cfv->ndev,"Bad ring, disable device\n" ); - cfv->ndev->stats.rx_dropped = riov->used - riov->i; -napi_complete (napi); -vringh_notify_disable_kern (cfv->vr_rx); -netif_carrier_off (cfv->ndev); -break ; - } -out: -if (rxcnt &&vringh_need_notify_kern (cfv->vr_rx) >0 ) -vringh_notify (cfv->vr_rx); -return rxcnt; -} - -static void cfv_recv (struct virtio_device *vdev,struct vringh *vr_rx) -{ -struct cfv_info *cfv = vdev->priv; - - ++cfv->stats.rx_kicks; -vringh_notify_disable_kern (cfv->vr_rx); -napi_schedule (&cfv->napi); -} - -static void cfv_destroy_genpool (struct cfv_info *cfv) -{ -if (cfv->alloc_addr) -dma_free_coherent (cfv->vdev->dev.parent->parent, - cfv->allocsz, cfv->alloc_addr, - cfv->alloc_dma); - -if (!cfv->genpool) -return ; -gen_pool_free (cfv->genpool, cfv->reserved_mem, - cfv->reserved_size); -gen_pool_destroy (cfv->genpool); - cfv->genpool =NULL ; -} - -static int cfv_create_genpool (struct cfv_info *cfv) -{ -int err; - -/* dma_alloc can only allocate whole pages, and we need a more -* fine graned allocation so we use genpool. We ask for space needed -* by IP and a full ring. If the dma allcoation fails we retry with a -* smaller allocation size. -*/ - err = -ENOMEM ; - cfv->allocsz = (virtqueue_get_vring_size (cfv->vq_tx) * - (ETH_DATA_LEN + cfv->tx_hr + cfv->tx_tr) *11 )/10 ; -if (cfv->allocsz <= (num_possible_cpus () +1 ) * cfv->ndev->mtu) -return -EINVAL ; - -for (;;) { -if (cfv->allocsz <=num_possible_cpus () * cfv->ndev->mtu) { -netdev_info (cfv->ndev,"Not enough device memory\n" ); -return -ENOMEM ; - } - - cfv->alloc_addr =dma_alloc_coherent ( - cfv->vdev->dev.parent->parent, - cfv->allocsz, &cfv->alloc_dma, -GFP_ATOMIC ); -if (cfv->alloc_addr) -break ; - - cfv->allocsz = (cfv->allocsz *3 ) >>2 ; - } - -netdev_dbg (cfv->ndev,"Allocated %zd bytes from dma-memory\n" , - cfv->allocsz); - -/* Allocate on 128 bytes boundaries (1 << 7)*/ - cfv->genpool =gen_pool_create (7 ,-1 ); -if (!cfv->genpool) - goto err; - - err =gen_pool_add_virt (cfv->genpool, (unsigned long )cfv->alloc_addr, - (phys_addr_t )virt_to_phys (cfv->alloc_addr), - cfv->allocsz,-1 ); -if (err) - goto err; - -/* Reserve some memory for low memory situations. If we hit the roof -* in the memory pool, we stop TX flow and release the reserve. -*/ - cfv->reserved_size =num_possible_cpus () * cfv->ndev->mtu; - cfv->reserved_mem =gen_pool_alloc (cfv->genpool, - cfv->reserved_size); -if (!cfv->reserved_mem) { - err = -ENOMEM ; - goto err; - } - - cfv->watermark_tx =virtqueue_get_vring_size (cfv->vq_tx); -return 0 ; -err: -cfv_destroy_genpool (cfv); -return err; -} - -/* Enable the CAIF interface and allocate the memory-pool */ -static int cfv_netdev_open (struct net_device *netdev) -{ -struct cfv_info *cfv =netdev_priv (netdev); - -if (cfv_create_genpool (cfv)) -return -ENOMEM ; - -netif_carrier_on (netdev); -napi_enable (&cfv->napi); - -/* Schedule NAPI to read any pending packets */ -napi_schedule (&cfv->napi); -return 0 ; -} - -/* Disable the CAIF interface and free the memory-pool */ -static int cfv_netdev_close (struct net_device *netdev) -{ -struct cfv_info *cfv =netdev_priv (netdev); -unsigned long flags; -struct buf_info *buf_info; - -/* Disable interrupts, queues and NAPI polling */ -netif_carrier_off (netdev); -virtqueue_disable_cb (cfv->vq_tx); -vringh_notify_disable_kern (cfv->vr_rx); -napi_disable (&cfv->napi); - -/* Release any TX buffers on both used and available rings */ -cfv_release_used_buf (cfv->vq_tx); -spin_lock_irqsave (&cfv->tx_lock, flags); -while ((buf_info =virtqueue_detach_unused_buf (cfv->vq_tx))) -free_buf_info (cfv, buf_info); -spin_unlock_irqrestore (&cfv->tx_lock, flags); - -/* Release all dma allocated memory and destroy the pool */ -cfv_destroy_genpool (cfv); -return 0 ; -} - -/* Allocate a buffer in dma-memory and copy skb to it */ -static struct buf_info *cfv_alloc_and_copy_to_shm (struct cfv_info *cfv, -struct sk_buff *skb, -struct scatterlist *sg) -{ -struct caif_payload_info *info = (void *)&skb->cb; -struct buf_info *buf_info =NULL ; -u8 pad_len, hdr_ofs; - -if (!cfv->genpool) - goto err; - -if (unlikely (cfv->tx_hr + skb->len + cfv->tx_tr > cfv->mtu)) { -netdev_warn (cfv->ndev,"Invalid packet len (%d > %d)\n" , - cfv->tx_hr + skb->len + cfv->tx_tr, cfv->mtu); - goto err; - } - - buf_info = kmalloc_obj(struct buf_info, GFP_ATOMIC); -if (unlikely (!buf_info)) - goto err; - -/* Make the IP header aligned in the buffer */ - hdr_ofs = cfv->tx_hr + info->hdr_len; - pad_len = hdr_ofs & (IP_HDR_ALIGN -1 ); - buf_info->size = cfv->tx_hr + skb->len + cfv->tx_tr + pad_len; - -/* allocate dma memory buffer */ - buf_info->vaddr = (void *)gen_pool_alloc (cfv->genpool, buf_info->size); -if (unlikely (!buf_info->vaddr)) - goto err; - -/* copy skbuf contents to send buffer */ -skb_copy_bits (skb,0 , buf_info->vaddr + cfv->tx_hr + pad_len, skb->len); -sg_init_one (sg, buf_info->vaddr + pad_len, - skb->len + cfv->tx_hr + cfv->rx_hr); - -return buf_info; -err: -kfree (buf_info); -return NULL ; -} - -/* Put the CAIF packet on the virtio ring and kick the receiver */ -static netdev_tx_t cfv_netdev_tx (struct sk_buff *skb,struct net_device *netdev) -{ -struct cfv_info *cfv =netdev_priv (netdev); -struct buf_info *buf_info; -struct scatterlist sg; -unsigned long flags; -bool flow_off = false; -int ret; - -/* garbage collect released buffers */ -cfv_release_used_buf (cfv->vq_tx); -spin_lock_irqsave (&cfv->tx_lock, flags); - -/* Flow-off check takes into account number of cpus to make sure -* virtqueue will not be overfilled in any possible smp conditions. -* -* Flow-on is triggered when sufficient buffers are freed -*/ -if (unlikely (cfv->vq_tx->num_free <=num_present_cpus ())) { - flow_off = true; - cfv->stats.tx_full_ring++; - } - -/* If we run out of memory, we release the memory reserve and retry -* allocation. -*/ - buf_info =cfv_alloc_and_copy_to_shm (cfv, skb, &sg); -if (unlikely (!buf_info)) { - cfv->stats.tx_no_mem++; - flow_off = true; - -if (cfv->reserved_mem && cfv->genpool) { -gen_pool_free (cfv->genpool, cfv->reserved_mem, - cfv->reserved_size); - cfv->reserved_mem =0 ; - buf_info =cfv_alloc_and_copy_to_shm (cfv, skb, &sg); - } - } - -if (unlikely (flow_off)) { -/* Turn flow on when a 1/4 of the descriptors are released */ - cfv->watermark_tx =virtqueue_get_vring_size (cfv->vq_tx) /4 ; -/* Enable notifications of recycled TX buffers */ -virtqueue_enable_cb (cfv->vq_tx); -netif_tx_stop_all_queues (netdev); - } - -if (unlikely (!buf_info)) { -/* If the memory reserve does it's job, this shouldn't happen */ -netdev_warn (cfv->ndev,"Out of gen_pool memory\n" ); - goto err; - } - - ret =virtqueue_add_outbuf (cfv->vq_tx, &sg,1 , buf_info,GFP_ATOMIC ); -if (unlikely ((ret <0 ))) { -/* If flow control works, this shouldn't happen */ -netdev_warn (cfv->ndev,"Failed adding buffer to TX vring:%d\n" , - ret); - goto err; - } - -/* update netdev statistics */ - cfv->ndev->stats.tx_packets++; - cfv->ndev->stats.tx_bytes += skb->len; -spin_unlock_irqrestore (&cfv->tx_lock, flags); - -/* tell the remote processor it has a pending message to read */ -virtqueue_kick (cfv->vq_tx); - -dev_kfree_skb (skb); -return NETDEV_TX_OK ; -err: -spin_unlock_irqrestore (&cfv->tx_lock, flags); - cfv->ndev->stats.tx_dropped++; -free_buf_info (cfv, buf_info); -dev_kfree_skb (skb); -return NETDEV_TX_OK ; -} - -static void cfv_tx_release_tasklet (struct tasklet_struct *t) -{ -struct cfv_info *cfv =from_tasklet (cfv, t, tx_release_tasklet); -cfv_release_used_buf (cfv->vq_tx); -} - -static const struct net_device_ops cfv_netdev_ops = { - .ndo_open = cfv_netdev_open, - .ndo_stop = cfv_netdev_close, - .ndo_start_xmit = cfv_netdev_tx, -}; - -static void cfv_netdev_setup (struct net_device *netdev) -{ - netdev->netdev_ops = &cfv_netdev_ops; - netdev->type =ARPHRD_CAIF ; - netdev->tx_queue_len =100 ; - netdev->flags =IFF_POINTOPOINT |IFF_NOARP ; - netdev->mtu =CFV_DEF_MTU_SIZE ; - netdev->needs_free_netdev = true; -} - -/* Create debugfs counters for the device */ -static inline void debugfs_init (struct cfv_info *cfv) -{ - cfv->debugfs =debugfs_create_dir (netdev_name (cfv->ndev),NULL ); - -debugfs_create_u32 ("rx-napi-complete" ,0400 , cfv->debugfs, - &cfv->stats.rx_napi_complete); -debugfs_create_u32 ("rx-napi-resched" ,0400 , cfv->debugfs, - &cfv->stats.rx_napi_resched); -debugfs_create_u32 ("rx-nomem" ,0400 , cfv->debugfs, - &cfv->stats.rx_nomem); -debugfs_create_u32 ("rx-kicks" ,0400 , cfv->debugfs, - &cfv->stats.rx_kicks); -debugfs_create_u32 ("tx-full-ring" ,0400 , cfv->debugfs, - &cfv->stats.tx_full_ring); -debugfs_create_u32 ("tx-no-mem" ,0400 , cfv->debugfs, - &cfv->stats.tx_no_mem); -debugfs_create_u32 ("tx-kicks" ,0400 , cfv->debugfs, - &cfv->stats.tx_kicks); -debugfs_create_u32 ("tx-flow-on" ,0400 , cfv->debugfs, - &cfv->stats.tx_flow_on); -} - -/* Setup CAIF for the a virtio device */ -static int cfv_probe (struct virtio_device *vdev) -{ -vrh_callback_t *vrh_cbs = cfv_recv; -const char *cfv_netdev_name ="cfvrt" ; -struct net_device *netdev; -struct cfv_info *cfv; -int err; - - netdev =alloc_netdev (sizeof (struct cfv_info ), cfv_netdev_name, -NET_NAME_UNKNOWN , cfv_netdev_setup); -if (!netdev) -return -ENOMEM ; - - cfv =netdev_priv (netdev); - cfv->vdev = vdev; - cfv->ndev = netdev; - -spin_lock_init (&cfv->tx_lock); - -/* Get the RX virtio ring. This is a "host side vring". */ - err = -ENODEV ; -if (!vdev->vringh_config || !vdev->vringh_config->find_vrhs) - goto err; - - err = vdev->vringh_config->find_vrhs (vdev,1 , &cfv->vr_rx, &vrh_cbs); -if (err) - goto err; - -/* Get the TX virtio ring. This is a "guest side vring". */ - cfv->vq_tx =virtio_find_single_vq (vdev, cfv_release_cb,"output" ); -if (IS_ERR (cfv->vq_tx)) { - err =PTR_ERR (cfv->vq_tx); - goto err; - } - -/* Get the CAIF configuration from virtio config space, if available */ -if (vdev->config->get) { - virtio_cread(vdev, struct virtio_caif_transf_config, headroom, - &cfv->tx_hr); - virtio_cread(vdev, struct virtio_caif_transf_config, headroom, - &cfv->rx_hr); - virtio_cread(vdev, struct virtio_caif_transf_config, tailroom, - &cfv->tx_tr); - virtio_cread(vdev, struct virtio_caif_transf_config, tailroom, - &cfv->rx_tr); - virtio_cread(vdev, struct virtio_caif_transf_config, mtu, - &cfv->mtu); - virtio_cread(vdev, struct virtio_caif_transf_config, mtu, - &cfv->mru); - }else { - cfv->tx_hr =CFV_DEF_HEADROOM ; - cfv->rx_hr =CFV_DEF_HEADROOM ; - cfv->tx_tr =CFV_DEF_TAILROOM ; - cfv->rx_tr =CFV_DEF_TAILROOM ; - cfv->mtu =CFV_DEF_MTU_SIZE ; - cfv->mru =CFV_DEF_MTU_SIZE ; - } - - netdev->needed_headroom = cfv->tx_hr; - netdev->needed_tailroom = cfv->tx_tr; - -/* Disable buffer release interrupts unless we have stopped TX queues */ -virtqueue_disable_cb (cfv->vq_tx); - - netdev->mtu = cfv->mtu - cfv->tx_tr; - vdev->priv = cfv; - -/* Initialize NAPI poll context data */ -vringh_kiov_init (&cfv->ctx.riov,NULL ,0 ); - cfv->ctx.head =USHRT_MAX ; -netif_napi_add_weight (netdev, &cfv->napi, cfv_rx_poll, -CFV_DEFAULT_QUOTA ); - -tasklet_setup (&cfv->tx_release_tasklet, cfv_tx_release_tasklet); - -/* Carrier is off until netdevice is opened */ -netif_carrier_off (netdev); - -/* serialize netdev register + virtio_device_ready() with ndo_open() */ -rtnl_lock (); - -/* register Netdev */ - err =register_netdevice (netdev); -if (err) { -rtnl_unlock (); -dev_err (&vdev->dev,"Unable to register netdev (%d)\n" , err); - goto err; - } - -virtio_device_ready (vdev); - -rtnl_unlock (); - -debugfs_init (cfv); - -return 0 ; -err: -netdev_warn (cfv->ndev,"CAIF Virtio probe failed:%d\n" , err); - -if (cfv->vr_rx) - vdev->vringh_config->del_vrhs (cfv->vdev); -if (cfv->vq_tx) - vdev->config->del_vqs (cfv->vdev); -free_netdev (netdev); -return err; -} - -static void cfv_remove (struct virtio_device *vdev) -{ -struct cfv_info *cfv = vdev->priv; - -rtnl_lock (); -dev_close (cfv->ndev); -rtnl_unlock (); - -tasklet_kill (&cfv->tx_release_tasklet);Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.53.0
Part of the diff is not shown here. View the raw message.
Quoted 20 lines · Jakub Kicinski
Remove CAIF (Communication CPU to Application CPU Interface), the ST-Ericsson modem protocol. The subsystem has been orphaned since 2013. The last meaningful changes from the maintainers were in March 2013:
a8c7687bf216("caif_virtio: Check thatvringh_configis not null")b2273be8d2df("caif_virtio: Usevringh_notify_enablecorrectly")0d2e1a2926b1("caif_virtio: Introduce caif over virtio")Not-so-coincidentally, according to "the Internet" ST-Ericsson officially shut down its modem joint venture in Aug 2013.
If anyone is using this code please yell!
In the 13 years since, the code has accumulated 200 non-merge commits, of which 71 were cross-tree API changes, 21 carried Fixes: tags, and the remaining ~110 were cleanups, doc conversions, treewide refactors, and one partial removal (
caif_hsi,ca75bcf0a83b).We are still getting fixes to this code, in the last 10 days there were 3 reports on security@ about CAIF that I have been CCed on.
Quoted 7 lines
UAPI constants (
AF_CAIF,ARPHRD_CAIF,N_CAIF,VIRTIO_ID_CAIF) and the SELinux classmap entry are intentionally kept for ABI stability.Signed-off-by Jakub Kicinski <[email protected]>---
I think we should accumulate such patches over the coming days on a separate branch. CAIF is a no-brainer IMO but other removals may be more controversial.
Quoted 9 lines · Jakub Kicinski
Remove CAIF (Communication CPU to Application CPU Interface), the ST-Ericsson modem protocol. The subsystem has been orphaned since 2013. The last meaningful changes from the maintainers were in March 2013:
a8c7687bf216("caif_virtio: Check thatvringh_configis not null")b2273be8d2df("caif_virtio: Usevringh_notify_enablecorrectly")0d2e1a2926b1("caif_virtio: Introduce caif over virtio")Not-so-coincidentally, according to "the Internet" ST-Ericsson officially shut down its modem joint venture in Aug 2013.
This specific code was used out-of-tree for modems M5730, M5740 etc used for minor Android phone brands such as Sharp, Motorola, Philips.
However it is also used in the Samsung Galaxy S 4G, so let's page [email protected] so the possible audience knows. PostmarketOS is not actively supporting it.
I remember that I advised Sjur to use virtio for this project and it lives on through the generic contributions to virtio that resulted.
Yours,
Linus Walleij
Quoted 20 lines · Jakub Kicinski
Remove CAIF (Communication CPU to Application CPU Interface), the ST-Ericsson modem protocol. The subsystem has been orphaned since 2013. The last meaningful changes from the maintainers were in March 2013:
a8c7687bf216("caif_virtio: Check thatvringh_configis not null")b2273be8d2df("caif_virtio: Usevringh_notify_enablecorrectly")0d2e1a2926b1("caif_virtio: Introduce caif over virtio")Not-so-coincidentally, according to "the Internet" ST-Ericsson officially shut down its modem joint venture in Aug 2013.
If anyone is using this code please yell!
In the 13 years since, the code has accumulated 200 non-merge commits, of which 71 were cross-tree API changes, 21 carried Fixes: tags, and the remaining ~110 were cleanups, doc conversions, treewide refactors, and one partial removal (
caif_hsi,ca75bcf0a83b).We are still getting fixes to this code, in the last 10 days there were 3 reports on security@ about CAIF that I have been CCed on.
Quoted 7 lines
UAPI constants (
AF_CAIF,ARPHRD_CAIF,N_CAIF,VIRTIO_ID_CAIF) and the SELinux classmap entry are intentionally kept for ABI stability.Signed-off-by Jakub Kicinski <[email protected]>---
I think we should accumulate such patches over the coming days on a separate branch. CAIF is a no-brainer IMO but other removals may be more controversial.