linux/drivers/net/hamradio/mkiss.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *
 * Copyright (C) Hans Alblas PE1AYX <[email protected]>
 * Copyright (C) 2004, 05 Ralf Baechle DL5RB <[email protected]>
 * Copyright (C) 2004, 05 Thomas Osterried DL9SAU <[email protected]>
 */
#include <linux/module.h>
#include <linux/bitops.h>
#include <linux/uaccess.h>
#include <linux/crc16.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/errno.h>
#include <linux/netdevice.h>
#include <linux/major.h>
#include <linux/init.h>
#include <linux/rtnetlink.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/jiffies.h>
#include <linux/refcount.h>

#include <net/ax25.h>

#define AX_MTU

/* some arch define END as assembly function ending, just undef it */
#undef	END
/* SLIP/KISS protocol characters. */
#define END
#define ESC
#define ESC_END
#define ESC_ESC

struct mkiss {};

/*---------------------------------------------------------------------------*/

static const unsigned short crc_flex_table[] =;

static unsigned short calc_crc_flex(unsigned char *cp, int size)
{}

static int check_crc_flex(unsigned char *cp, int size)
{}

static int check_crc_16(unsigned char *cp, int size)
{}

/*
 * Standard encapsulation
 */

static int kiss_esc(unsigned char *s, unsigned char *d, int len)
{}

/*
 * MW:
 * OK its ugly, but tell me a better solution without copying the
 * packet to a temporary buffer :-)
 */
static int kiss_esc_crc(unsigned char *s, unsigned char *d, unsigned short crc,
	int len)
{}

/* Send one completely decapsulated AX.25 packet to the AX.25 layer. */
static void ax_bump(struct mkiss *ax)
{}

static void kiss_unesc(struct mkiss *ax, unsigned char s)
{}

static int ax_set_mac_address(struct net_device *dev, void *addr)
{}

/*---------------------------------------------------------------------------*/

static void ax_changedmtu(struct mkiss *ax)
{}

/* Encapsulate one AX.25 packet and stuff into a TTY queue. */
static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
{}

/* Encapsulate an AX.25 packet and kick it into a TTY queue. */
static netdev_tx_t ax_xmit(struct sk_buff *skb, struct net_device *dev)
{}

static int ax_open_dev(struct net_device *dev)
{}

/* Open the low-level part of the AX25 channel. Easy! */
static int ax_open(struct net_device *dev)
{}


/* Close the low-level part of the AX25 channel. Easy! */
static int ax_close(struct net_device *dev)
{}

static const struct net_device_ops ax_netdev_ops =;

static void ax_setup(struct net_device *dev)
{}

/*
 * We have a potential race on dereferencing tty->disc_data, because the tty
 * layer provides no locking at all - thus one cpu could be running
 * sixpack_receive_buf while another calls sixpack_close, which zeroes
 * tty->disc_data and frees the memory that sixpack_receive_buf is using.  The
 * best way to fix this is to use a rwlock in the tty struct, but for now we
 * use a single global rwlock for all ttys in ppp line discipline.
 */
static DEFINE_RWLOCK(disc_data_lock);

static struct mkiss *mkiss_get(struct tty_struct *tty)
{}

static void mkiss_put(struct mkiss *ax)
{}

static int crc_force =;	/* Can be overridden with insmod */

static int mkiss_open(struct tty_struct *tty)
{}

static void mkiss_close(struct tty_struct *tty)
{}

/* Perform I/O control on an active ax25 channel. */
static int mkiss_ioctl(struct tty_struct *tty, unsigned int cmd,
		unsigned long arg)
{}

/*
 * Handle the 'receiver data ready' interrupt.
 * This function is called by the 'tty_io' module in the kernel when
 * a block of data has been received, which can now be decapsulated
 * and sent on to the AX.25 layer for further processing.
 */
static void mkiss_receive_buf(struct tty_struct *tty, const u8 *cp,
			      const u8 *fp, size_t count)
{}

/*
 * Called by the driver when there's room for more data.  If we have
 * more packets to send, we send them here.
 */
static void mkiss_write_wakeup(struct tty_struct *tty)
{}

static struct tty_ldisc_ops ax_ldisc =;

static const char banner[] __initconst =;
static const char msg_regfail[] __initconst =;

static int __init mkiss_init_driver(void)
{}

static void __exit mkiss_exit_driver(void)
{}

MODULE_AUTHOR();
MODULE_DESCRIPTION();
module_param(crc_force, int, 0);
MODULE_PARM_DESC();
MODULE_LICENSE();
MODULE_ALIAS_LDISC();

module_init();
module_exit(mkiss_exit_driver);