diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-27 17:03:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-28 16:42:56 -0700 |
commit | 1ca163afb6fd569b6efdc221954177cba5a02cbc (patch) | |
tree | bd6f1e56f3e4ef213acebe58a30ebee67c28a2de /net | |
parent | 9d8c7e5a87b175c3a956cd36989022be978ea1d4 (diff) | |
download | linux-1ca163afb6fd569b6efdc221954177cba5a02cbc.tar.gz linux-1ca163afb6fd569b6efdc221954177cba5a02cbc.tar.bz2 linux-1ca163afb6fd569b6efdc221954177cba5a02cbc.zip |
irda: move net/irda/ to drivers/staging/irda/net/
It's time to get rid of IRDA. It's long been broken, and no one seems
to use it anymore. So move it to staging and after a while, we can
delete it from there.
To start, move the network irda core from net/irda to
drivers/staging/irda/net/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
53 files changed, 0 insertions, 31655 deletions
diff --git a/net/Kconfig b/net/Kconfig index 17ca213e1f85..8614a9ccfbef 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -376,7 +376,6 @@ endmenu source "net/ax25/Kconfig" source "net/can/Kconfig" -source "net/irda/Kconfig" source "net/bluetooth/Kconfig" source "net/rxrpc/Kconfig" source "net/kcm/Kconfig" diff --git a/net/Makefile b/net/Makefile index bed80fa398b7..3d3feff3643b 100644 --- a/net/Makefile +++ b/net/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_NETROM) += netrom/ obj-$(CONFIG_ROSE) += rose/ obj-$(CONFIG_AX25) += ax25/ obj-$(CONFIG_CAN) += can/ -obj-$(CONFIG_IRDA) += irda/ obj-$(CONFIG_BT) += bluetooth/ obj-$(CONFIG_SUNRPC) += sunrpc/ obj-$(CONFIG_AF_RXRPC) += rxrpc/ diff --git a/net/irda/Kconfig b/net/irda/Kconfig deleted file mode 100644 index c8671a7ffb3c..000000000000 --- a/net/irda/Kconfig +++ /dev/null @@ -1,96 +0,0 @@ -# -# IrDA protocol configuration -# - -menuconfig IRDA - depends on NET && !S390 - tristate "IrDA (infrared) subsystem support" - select CRC_CCITT - ---help--- - Say Y here if you want to build support for the IrDA (TM) protocols. - The Infrared Data Associations (tm) specifies standards for wireless - infrared communication and is supported by most laptops and PDA's. - - To use Linux support for the IrDA (tm) protocols, you will also need - some user-space utilities like irattach. For more information, see - the file <file:Documentation/networking/irda.txt>. You also want to - read the IR-HOWTO, available at - <http://www.tldp.org/docs.html#howto>. - - If you want to exchange bits of data (vCal, vCard) with a PDA, you - will need to install some OBEX application, such as OpenObex : - <http://sourceforge.net/projects/openobex/> - - To compile this support as a module, choose M here: the module will - be called irda. - -comment "IrDA protocols" - depends on IRDA - -source "net/irda/irlan/Kconfig" - -source "net/irda/irnet/Kconfig" - -source "net/irda/ircomm/Kconfig" - -config IRDA_ULTRA - bool "Ultra (connectionless) protocol" - depends on IRDA - help - Say Y here to support the connectionless Ultra IRDA protocol. - Ultra allows to exchange data over IrDA with really simple devices - (watch, beacon) without the overhead of the IrDA protocol (no handshaking, - no management frames, simple fixed header). - Ultra is available as a special socket : socket(AF_IRDA, SOCK_DGRAM, 1); - -comment "IrDA options" - depends on IRDA - -config IRDA_CACHE_LAST_LSAP - bool "Cache last LSAP" - depends on IRDA - help - Say Y here if you want IrLMP to cache the last LSAP used. This - makes sense since most frames will be sent/received on the same - connection. Enabling this option will save a hash-lookup per frame. - - If unsure, say Y. - -config IRDA_FAST_RR - bool "Fast RRs (low latency)" - depends on IRDA - ---help--- - Say Y here is you want IrLAP to send fast RR (Receive Ready) frames - when acting as a primary station. - Disabling this option will make latency over IrDA very bad. Enabling - this option will make the IrDA stack send more packet than strictly - necessary, thus reduce your battery life (but not that much). - - Fast RR will make IrLAP send out a RR frame immediately when - receiving a frame if its own transmit queue is currently empty. This - will give a lot of speed improvement when receiving much data since - the secondary station will not have to wait the max. turn around - time (usually 500ms) before it is allowed to transmit the next time. - If the transmit queue of the secondary is also empty, the primary will - start backing-off before sending another RR frame, waiting longer - each time until the back-off reaches the max. turn around time. - This back-off increase in controlled via - /proc/sys/net/irda/fast_poll_increase - - If unsure, say Y. - -config IRDA_DEBUG - bool "Debug information" - depends on IRDA - help - Say Y here if you want the IrDA subsystem to write debug information - to your syslog. You can change the debug level in - /proc/sys/net/irda/debug . - When this option is enabled, the IrDA also perform many extra internal - verifications which will usually prevent the kernel to crash in case of - bugs. - - If unsure, say Y (since it makes it easier to find the bugs). - -source "drivers/net/irda/Kconfig" - diff --git a/net/irda/Makefile b/net/irda/Makefile deleted file mode 100644 index 187f6c563a4b..000000000000 --- a/net/irda/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# -# Makefile for the Linux IrDA protocol layer. -# - -obj-$(CONFIG_IRDA) += irda.o -obj-$(CONFIG_IRLAN) += irlan/ -obj-$(CONFIG_IRNET) += irnet/ -obj-$(CONFIG_IRCOMM) += ircomm/ - -irda-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \ - irlap.o irlap_event.o irlap_frame.o timer.o qos.o irqueue.o \ - irttp.o irda_device.o irias_object.o wrapper.o af_irda.o \ - discovery.o parameters.o irnetlink.o irmod.o -irda-$(CONFIG_PROC_FS) += irproc.o -irda-$(CONFIG_SYSCTL) += irsysctl.o diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c deleted file mode 100644 index 23fa7c8b09a5..000000000000 --- a/net/irda/af_irda.c +++ /dev/null @@ -1,2695 +0,0 @@ -/********************************************************************* - * - * Filename: af_irda.c - * Version: 0.9 - * Description: IrDA sockets implementation - * Status: Stable - * Author: Dag Brattli <dagb@cs.uit.no> - * Created at: Sun May 31 10:12:43 1998 - * Modified at: Sat Dec 25 21:10:23 1999 - * Modified by: Dag Brattli <dag@brattli.net> - * Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc. - * - * Copyright (c) 1999 Dag Brattli <dagb@cs.uit.no> - * Copyright (c) 1999-2003 Jean Tourrilhes <jt@hpl.hp.com> - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see <http://www.gnu.org/licenses/>. - * - * Linux-IrDA now supports four different types of IrDA sockets: - * - * o SOCK_STREAM: TinyTP connections with SAR disabled. The - * max SDU size is 0 for conn. of this type - * o SOCK_SEQPACKET: TinyTP connections with SAR enabled. TTP may - * fragment the messages, but will preserve - * the message boundaries - * o SOCK_DGRAM: IRDAPROTO_UNITDATA: TinyTP connections with Unitdata - * (unreliable) transfers - * IRDAPROTO_ULTRA: Connectionless and unreliable data - * - ********************************************************************/ - -#include <linux/capability.h> -#include <linux/module.h> -#include <linux/types.h> -#include <linux/socket.h> -#include <linux/sockios.h> -#include <linux/slab.h> -#include <linux/sched/signal.h> -#include <linux/init.h> -#include <linux/net.h> -#include <linux/irda.h> -#include <linux/poll.h> - -#include <asm/ioctls.h> /* TIOCOUTQ, TIOCINQ */ -#include <linux/uaccess.h> - -#include <net/sock.h> -#include <net/tcp_states.h> - -#include <net/irda/af_irda.h> - -static int irda_create(struct net *net, struct socket *sock, int protocol, int kern); - -static const struct proto_ops irda_stream_ops; -static const struct proto_ops irda_seqpacket_ops; -static const struct proto_ops irda_dgram_ops; - -#ifdef CONFIG_IRDA_ULTRA -static const struct proto_ops irda_ultra_ops; -#define ULTRA_MAX_DATA 382 -#endif /* CONFIG_IRDA_ULTRA */ - -#define IRDA_MAX_HEADER (TTP_MAX_HEADER) - -/* - * Function irda_data_indication (instance, sap, skb) - * - * Received some data from TinyTP. Just queue it on the receive queue - * - */ -static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb) -{ - struct irda_sock *self; - struct sock *sk; - int err; - - self = instance; - sk = instance; - - err = sock_queue_rcv_skb(sk, skb); - if (err) { - pr_debug("%s(), error: no more mem!\n", __func__); - self->rx_flow = FLOW_STOP; - - /* When we return error, TTP will need to requeue the skb */ - return err; - } - - return 0; -} - -/* - * Function irda_disconnect_indication (instance, sap, reason, skb) - * - * Connection has been closed. Check reason to find out why - * - */ -static void irda_disconnect_indication(void *instance, void *sap, - LM_REASON reason, struct sk_buff *skb) -{ - struct irda_sock *self; - struct sock *sk; - - self = instance; - - pr_debug("%s(%p)\n", __func__, self); - - /* Don't care about it, but let's not leak it */ - if(skb) - dev_kfree_skb(skb); - - sk = instance; - if (sk == NULL) { - pr_debug("%s(%p) : BUG : sk is NULL\n", - __func__, self); - return; - } - - /* Prevent race conditions with irda_release() and irda_shutdown() */ - bh_lock_sock(sk); - if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { - sk->sk_state = TCP_CLOSE; - sk->sk_shutdown |= SEND_SHUTDOWN; - - sk->sk_state_change(sk); - - /* Close our TSAP. - * If we leave it open, IrLMP put it back into the list of - * unconnected LSAPs. The problem is that any incoming request - * can then be matched to this socket (and it will be, because - * it is at the head of the list). This would prevent any - * listening socket waiting on the same TSAP to get those - * requests. Some apps forget to close sockets, or hang to it - * a bit too long, so we may stay in this dead state long - * enough to be noticed... - * Note : all socket function do check sk->sk_state, so we are - * safe... - * Jean II - */ - if (self->tsap) { - irttp_close_tsap(self->tsap); - self->tsap = NULL; - } - } - bh_unlock_sock(sk); - - /* Note : once we are there, there is not much you want to do - * with the socket anymore, apart from closing it. - * For example, bind() and connect() won't reset sk->sk_err, - * sk->sk_shutdown and sk->sk_flags to valid values... - * Jean II - */ -} - -/* - * Function irda_connect_confirm (instance, sap, qos, max_sdu_size, skb) - * - * Connections has been confirmed by the remote device - * - */ -static void irda_connect_confirm(void *instance, void *sap, - struct qos_info *qos, - __u32 max_sdu_size, __u8 max_header_size, - struct sk_buff *skb) -{ - struct irda_sock *self; - struct sock *sk; - - self = instance; - - pr_debug("%s(%p)\n", __func__, self); - - sk = instance; - if (sk == NULL) { - dev_kfree_skb(skb); - return; - } - - dev_kfree_skb(skb); - // Should be ??? skb_queue_tail(&sk->sk_receive_queue, skb); - - /* How much header space do we need to reserve */ - self->max_header_size = max_header_size; - - /* IrTTP max SDU size in transmit direction */ - self->max_sdu_size_tx = max_sdu_size; - - /* Find out what the largest chunk of data that we can transmit is */ - switch (sk->sk_type) { - case SOCK_STREAM: - if (max_sdu_size != 0) { - net_err_ratelimited("%s: max_sdu_size must be 0\n", - __func__); - return; - } - self->max_data_size = irttp_get_max_seg_size(self->tsap); - break; - case SOCK_SEQPACKET: - if (max_sdu_size == 0) { - net_err_ratelimited("%s: max_sdu_size cannot be 0\n", - __func__); - return; - } - self->max_data_size = max_sdu_size; - break; - default: - self->max_data_size = irttp_get_max_seg_size(self->tsap); - } - - pr_debug("%s(), max_data_size=%d\n", __func__, - self->max_data_size); - - memcpy(&self->qos_tx, qos, sizeof(struct qos_info)); - - /* We are now connected! */ - sk->sk_state = TCP_ESTABLISHED; - sk->sk_state_change(sk); -} - -/* - * Function irda_connect_indication(instance, sap, qos, max_sdu_size, userdata) - * - * Incoming connection - * - */ -static void irda_connect_indication(void *instance, void *sap, - struct qos_info *qos, __u32 max_sdu_size, - __u8 max_header_size, struct sk_buff *skb) -{ - struct irda_sock *self; - struct sock *sk; - - self = instance; - - pr_debug("%s(%p)\n", __func__, self); - - sk = instance; - if (sk == NULL) { - dev_kfree_skb(skb); - return; - } - - /* How much header space do we need to reserve */ - self->max_header_size = max_header_size; - - /* IrTTP max SDU size in transmit direction */ - self->max_sdu_size_tx = max_sdu_size; - - /* Find out what the largest chunk of data that we can transmit is */ - switch (sk->sk_type) { - case SOCK_STREAM: - if (max_sdu_size != 0) { - net_err_ratelimited("%s: max_sdu_size must be 0\n", - __func__); - kfree_skb(skb); - return; - } - self->max_data_size = irttp_get_max_seg_size(self->tsap); - break; - case SOCK_SEQPACKET: - if (max_sdu_size == 0) { - net_err_ratelimited("%s: max_sdu_size cannot be 0\n", - __func__); - kfree_skb(skb); - return; - } - self->max_data_size = max_sdu_size; - break; - default: - self->max_data_size = irttp_get_max_seg_size(self->tsap); - } - - pr_debug("%s(), max_data_size=%d\n", __func__, - self->max_data_size); - - memcpy(&self->qos_tx, qos, sizeof(struct qos_info)); - - skb_queue_tail(&sk->sk_receive_queue, skb); - sk->sk_state_change(sk); -} - -/* - * Function irda_connect_response (handle) - * - * Accept incoming connection - * - */ -static void irda_connect_response(struct irda_sock *self) -{ - struct sk_buff *skb; - - skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, GFP_KERNEL); - if (skb == NULL) { - pr_debug("%s() Unable to allocate sk_buff!\n", - __func__); - return; - } - - /* Reserve space for MUX_CONTROL and LAP header */ - skb_reserve(skb, IRDA_MAX_HEADER); - - irttp_connect_response(self->tsap, self->max_sdu_size_rx, skb); -} - -/* - * Function irda_flow_indication (instance, sap, flow) - * - * Used by TinyTP to tell us if it can accept more data or not - * - */ -static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) -{ - struct irda_sock *self; - struct sock *sk; - - self = instance; - sk = instance; - BUG_ON(sk == NULL); - - switch (flow) { - case FLOW_STOP: - pr_debug("%s(), IrTTP wants us to slow down\n", - __func__); - self->tx_flow = flow; - break; - case FLOW_START: - self->tx_flow = flow; - pr_debug("%s(), IrTTP wants us to start again\n", - __func__); - wake_up_interruptible(sk_sleep(sk)); - break; - default: - pr_debug("%s(), Unknown flow command!\n", __func__); - /* Unknown flow command, better stop */ - self->tx_flow = flow; - break; - } -} - -/* - * Function irda_getvalue_confirm (obj_id, value, priv) - * - * Got answer from remote LM-IAS, just pass object to requester... - * - * Note : duplicate from above, but we need our own version that - * doesn't touch the dtsap_sel and save the full value structure... - */ -static void irda_getvalue_confirm(int result, __u16 obj_id, - struct ias_value *value, void *priv) -{ - struct irda_sock *self; - - self = priv; - if (!self) { - net_warn_ratelimited("%s: lost myself!\n", __func__); - return; - } - - pr_debug("%s(%p)\n", __func__, self); - - /* We probably don't need to make any more queries */ - iriap_close(self->iriap); - self->iriap = NULL; - - /* Check if request succeeded */ - if (result != IAS_SUCCESS) { - pr_debug("%s(), IAS query failed! (%d)\n", __func__, - result); - - self->errno = result; /* We really need it later */ - - /* Wake up any processes waiting for result */ - wake_up_interruptible(&self->query_wait); - - return; - } - - /* Pass the object to the caller (so the caller must delete it) */ - self->ias_result = value; - self->errno = 0; - - /* Wake up any processes waiting for result */ - wake_up_interruptible(&self->query_wait); -} - -/* - * Function irda_selective_discovery_indication (discovery) - * - * Got a selective discovery indication from IrLMP. - * - * IrLMP is telling us that this node is new and matching our hint bit - * filter. Wake up any process waiting for answer... - */ -static void irda_selective_discovery_indication(discinfo_t *discovery, - DISCOVERY_MODE mode, - void *priv) -{ - struct irda_sock *self; - - self = priv; - if (!self) { - net_warn_ratelimited("%s: lost myself!\n", __func__); - return; - } - - /* Pass parameter to the caller */ - self->cachedaddr = discovery->daddr; - - /* Wake up process if its waiting for device to be discovered */ - wake_up_interruptible(&self->query_wait); -} - -/* - * Function irda_discovery_timeout (priv) - * - * Timeout in the selective discovery process - * - * We were waiting for a node to be discovered, but nothing has come up - * so far. Wake up the user and tell him that we failed... - */ -static void irda_discovery_timeout(u_long priv) -{ - struct irda_sock *self; - - self = (struct irda_sock *) priv; - BUG_ON(self == NULL); - - /* Nothing for the caller */ - self->cachelog = NULL; - self->cachedaddr = 0; - self->errno = -ETIME; - - /* Wake up process if its still waiting... */ - wake_up_interruptible(&self->query_wait); -} - -/* - * Function irda_open_tsap (self) - * - * Open local Transport Service Access Point (TSAP) - * - */ -static int irda_open_tsap(struct irda_sock *self, __u8 tsap_sel, char *name) -{ - notify_t notify; - - if (self->tsap) { - pr_debug("%s: busy!\n", __func__); - return -EBUSY; - } - - /* Initialize callbacks to be used by the IrDA stack */ - irda_notify_init(¬ify); - notify.connect_confirm = irda_connect_confirm; - notify.connect_indication = irda_connect_indication; - notify.disconnect_indication = irda_disconnect_indication; - notify.data_indication = irda_data_indication; - notify.udata_indication = irda_data_indication; - notify.flow_indication = irda_flow_indication; - notify.instance = self; - strncpy(notify.name, name, NOTIFY_MAX_NAME); - - self->tsap = irttp_open_tsap(tsap_sel, DEFAULT_INITIAL_CREDIT, - ¬ify); - if (self->tsap == NULL) { - pr_debug("%s(), Unable to allocate TSAP!\n", - __func__); - return -ENOMEM; - } - /* Remember which TSAP selector we actually got */ - self->stsap_sel = self->tsap->stsap_sel; - - return 0; -} - -/* - * Function irda_open_lsap (self) - * - * Open local Link Service Access Point (LSAP). Used for opening Ultra - * sockets - */ -#ifdef CONFIG_IRDA_ULTRA -static int irda_open_lsap(struct irda_sock *self, int pid) -{ - notify_t notify; - - if (self->lsap) { - net_warn_ratelimited("%s(), busy!\n", __func__); - return -EBUSY; - } - - /* Initialize callbacks to be used by the IrDA stack */ - irda_notify_init(¬ify); - notify.udata_indication = irda_data_indication; - notify.instance = self; - strncpy(notify.name, "Ultra", NOTIFY_MAX_NAME); - - self->lsap = irlmp_open_lsap(LSAP_CONNLESS, ¬ify, pid); - if (self->lsap == NULL) { - pr_debug("%s(), Unable to allocate LSAP!\n", __func__); - return -ENOMEM; - } - - return 0; -} -#endif /* CONFIG_IRDA_ULTRA */ - -/* - * Function irda_find_lsap_sel (self, name) - * - * Try to lookup LSAP selector in remote LM-IAS - * - * Basically, we start a IAP query, and then go to sleep. When the query - * return, irda_getvalue_confirm will wake us up, and we can examine the - * result of the query... - * Note that in some case, the query fail even before we go to sleep, - * creating some races... - */ -static int irda_find_lsap_sel(struct irda_sock *self, char *name) -{ - pr_debug("%s(%p, %s)\n", __func__, self, name); - - if (self->iriap) { - net_warn_ratelimited("%s(): busy with a previous query\n", - __func__); - return -EBUSY; - } - - self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, - irda_getvalue_confirm); - if(self->iriap == NULL) - return -ENOMEM; - - /* Treat unexpected wakeup as disconnect */ - self->errno = -EHOSTUNREACH; - |