linux/net/atm/mpc.c

// SPDX-License-Identifier: GPL-2.0-only
#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/slab.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/bitops.h>
#include <linux/capability.h>
#include <linux/seq_file.h>

/* We are an ethernet device */
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <net/sock.h>
#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/uaccess.h>
#include <asm/byteorder.h>
#include <net/checksum.h>   /* for ip_fast_csum() */
#include <net/arp.h>
#include <net/dst.h>
#include <linux/proc_fs.h>

/* And atm device */
#include <linux/atmdev.h>
#include <linux/atmlec.h>
#include <linux/atmmpc.h>
/* Modular too */
#include <linux/module.h>

#include "lec.h"
#include "mpc.h"
#include "resources.h"

/*
 * mpc.c: Implementation of MPOA client kernel part
 */

#if 0
#define dprintk
#define dprintk_cont
#else
#define dprintk(format, args...)
#define dprintk_cont(format, args...)
#endif

#if 0
#define ddprintk
#define ddprintk_cont
#else
#define ddprintk(format, args...)
#define ddprintk_cont(format, args...)
#endif

/* mpc_daemon -> kernel */
static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc);
static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc);
static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc);
static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc);
static void mps_death(struct k_message *msg, struct mpoa_client *mpc);
static void clean_up(struct k_message *msg, struct mpoa_client *mpc,
		     int action);
static void MPOA_cache_impos_rcvd(struct k_message *msg,
				  struct mpoa_client *mpc);
static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg,
				   struct mpoa_client *mpc);
static void set_mps_mac_addr_rcvd(struct k_message *mesg,
				  struct mpoa_client *mpc);

static const uint8_t *copy_macs(struct mpoa_client *mpc,
				const uint8_t *router_mac,
				const uint8_t *tlvs, uint8_t mps_macs,
				uint8_t device_type);
static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry);

static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc);
static void mpoad_close(struct atm_vcc *vcc);
static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb);

static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb);
static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
				   struct net_device *dev);
static int mpoa_event_listener(struct notifier_block *mpoa_notifier,
			       unsigned long event, void *dev);
static void mpc_timer_refresh(void);
static void mpc_cache_check(struct timer_list *unused);

static struct llc_snap_hdr llc_snap_mpoa_ctrl =;
static struct llc_snap_hdr llc_snap_mpoa_data =;
static struct llc_snap_hdr llc_snap_mpoa_data_tagged =;

static struct notifier_block mpoa_notifier =;

struct mpoa_client *mpcs =; /* FIXME */
static struct atm_mpoa_qos *qos_head =;
static DEFINE_TIMER(mpc_timer, mpc_cache_check);


static struct mpoa_client *find_mpc_by_itfnum(int itf)
{}

static struct mpoa_client *find_mpc_by_vcc(struct atm_vcc *vcc)
{}

static struct mpoa_client *find_mpc_by_lec(struct net_device *dev)
{}

/*
 * Functions for managing QoS list
 */

/*
 * Overwrites the old entry or makes a new one.
 */
struct atm_mpoa_qos *atm_mpoa_add_qos(__be32 dst_ip, struct atm_qos *qos)
{}

struct atm_mpoa_qos *atm_mpoa_search_qos(__be32 dst_ip)
{}

/*
 * Returns 0 for failure
 */
int atm_mpoa_delete_qos(struct atm_mpoa_qos *entry)
{}

/* this is buggered - we need locking for qos_head */
void atm_mpoa_disp_qos(struct seq_file *m)
{}

static struct net_device *find_lec_by_itfnum(int itf)
{}

static struct mpoa_client *alloc_mpc(void)
{}

/*
 *
 * start_mpc() puts the MPC on line. All the packets destined
 * to the lec underneath us are now being monitored and
 * shortcuts will be established.
 *
 */
static void start_mpc(struct mpoa_client *mpc, struct net_device *dev)
{}

static void stop_mpc(struct mpoa_client *mpc)
{}

static const char *mpoa_device_type_string(char type) __attribute__ ((unused));

static const char *mpoa_device_type_string(char type)
{}

/*
 * lec device calls this via its netdev_priv(dev)->lane2_ops
 * ->associate_indicator() when it sees a TLV in LE_ARP packet.
 * We fill in the pointer above when we see a LANE2 lec initializing
 * See LANE2 spec 3.1.5
 *
 * Quite a big and ugly function but when you look at it
 * all it does is to try to locate and parse MPOA Device
 * Type TLV.
 * We give our lec a pointer to this function and when the
 * lec sees a TLV it uses the pointer to call this function.
 *
 */
static void lane2_assoc_ind(struct net_device *dev, const u8 *mac_addr,
			    const u8 *tlvs, u32 sizeoftlvs)
{}

/*
 * Store at least advertizing router's MAC address
 * plus the possible MAC address(es) to mpc->mps_macs.
 * For a freshly allocated MPOA client mpc->mps_macs == 0.
 */
static const uint8_t *copy_macs(struct mpoa_client *mpc,
				const uint8_t *router_mac,
				const uint8_t *tlvs, uint8_t mps_macs,
				uint8_t device_type)
{}

static int send_via_shortcut(struct sk_buff *skb, struct mpoa_client *mpc)
{}

/*
 * Probably needs some error checks and locking, not sure...
 */
static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
					 struct net_device *dev)
{}

static int atm_mpoa_vcc_attach(struct atm_vcc *vcc, void __user *arg)
{}

/*
 *
 */
static void mpc_vcc_close(struct atm_vcc *vcc, struct net_device *dev)
{}

static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
{}

static const struct atmdev_ops mpc_ops =;

static struct atm_dev mpc_dev =;

static int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg)
{}

static void send_set_mps_ctrl_addr(const char *addr, struct mpoa_client *mpc)
{}

static void mpoad_close(struct atm_vcc *vcc)
{}

/*
 *
 */
static int msg_from_mpoad(struct atm_vcc *vcc, struct sk_buff *skb)
{}

/* Remember that this function may not do things that sleep */
int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
{}

static int mpoa_event_listener(struct notifier_block *mpoa_notifier,
			       unsigned long event, void *ptr)
{}

/*
 * Functions which are called after a message is received from mpcd.
 * Msg is reused on purpose.
 */


static void MPOA_trigger_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{}

/*
 * Things get complicated because we have to check if there's an egress
 * shortcut with suitable traffic parameters we could use.
 */
static void check_qos_and_open_shortcut(struct k_message *msg,
					struct mpoa_client *client,
					in_cache_entry *entry)
{}

static void MPOA_res_reply_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{}

static void ingress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{}

static void egress_purge_rcvd(struct k_message *msg, struct mpoa_client *mpc)
{}

static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
{}

/*
 * Our MPS died. Tell our daemon to send NHRP data plane purge to each
 * of the egress shortcuts we have.
 */
static void mps_death(struct k_message *msg, struct mpoa_client *mpc)
{}

static void MPOA_cache_impos_rcvd(struct k_message *msg,
				  struct mpoa_client *mpc)
{}

static void set_mpc_ctrl_addr_rcvd(struct k_message *mesg,
				   struct mpoa_client *mpc)
{}

static void set_mps_mac_addr_rcvd(struct k_message *msg,
				  struct mpoa_client *client)
{}

/*
 * purge egress cache and tell daemon to 'action' (DIE, RELOAD)
 */
static void clean_up(struct k_message *msg, struct mpoa_client *mpc, int action)
{}

static unsigned long checking_time;

static void mpc_timer_refresh(void)
{}

static void mpc_cache_check(struct timer_list *unused)
{}

static int atm_mpoa_ioctl(struct socket *sock, unsigned int cmd,
			  unsigned long arg)
{}

static struct atm_ioctl atm_ioctl_ops =;

static __init int atm_mpoa_init(void)
{}

static void __exit atm_mpoa_cleanup(void)
{}

module_init();
module_exit(atm_mpoa_cleanup);

MODULE_DESCRIPTION();
MODULE_LICENSE();