linux/drivers/firewire/net.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * IPv4 over IEEE 1394, per RFC 2734
 * IPv6 over IEEE 1394, per RFC 3146
 *
 * Copyright (C) 2009 Jay Fenlason <[email protected]>
 *
 * based on eth1394 by Ben Collins et al
 */

#include <linux/bug.h>
#include <linux/compiler.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/ethtool.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/highmem.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/jiffies.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/mutex.h>
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <linux/slab.h>
#include <linux/spinlock.h>

#include <asm/unaligned.h>
#include <net/arp.h>
#include <net/firewire.h>

/* rx limits */
#define FWNET_MAX_FRAGMENTS
#define FWNET_ISO_PAGE_COUNT

/* tx limits */
#define FWNET_MAX_QUEUED_DATAGRAMS
#define FWNET_MIN_QUEUED_DATAGRAMS
#define FWNET_TX_QUEUE_LEN

#define IEEE1394_BROADCAST_CHANNEL
#define IEEE1394_ALL_NODES
#define IEEE1394_MAX_PAYLOAD_S100
#define FWNET_NO_FIFO_ADDR

#define IANA_SPECIFIER_ID
#define RFC2734_SW_VERSION
#define RFC3146_SW_VERSION

#define IEEE1394_GASP_HDR_SIZE

#define RFC2374_UNFRAG_HDR_SIZE
#define RFC2374_FRAG_HDR_SIZE
#define RFC2374_FRAG_OVERHEAD

#define RFC2374_HDR_UNFRAG
#define RFC2374_HDR_FIRSTFRAG
#define RFC2374_HDR_LASTFRAG
#define RFC2374_HDR_INTFRAG

static bool fwnet_hwaddr_is_multicast(u8 *ha)
{}

/* IPv4 and IPv6 encapsulation header */
struct rfc2734_header {};

#define fwnet_get_hdr_lf(h)
#define fwnet_get_hdr_ether_type(h)
#define fwnet_get_hdr_dg_size(h)
#define fwnet_get_hdr_fg_off(h)
#define fwnet_get_hdr_dgl(h)

#define fwnet_set_hdr_lf(lf)
#define fwnet_set_hdr_ether_type(et)
#define fwnet_set_hdr_dg_size(dgs)
#define fwnet_set_hdr_fg_off(fgo)

#define fwnet_set_hdr_dgl(dgl)

static inline void fwnet_make_uf_hdr(struct rfc2734_header *hdr,
		unsigned ether_type)
{}

static inline void fwnet_make_ff_hdr(struct rfc2734_header *hdr,
		unsigned ether_type, unsigned dg_size, unsigned dgl)
{}

static inline void fwnet_make_sf_hdr(struct rfc2734_header *hdr,
		unsigned lf, unsigned dg_size, unsigned fg_off, unsigned dgl)
{}

/* This list keeps track of what parts of the datagram have been filled in */
struct fwnet_fragment_info {};

struct fwnet_partial_datagram {};

static DEFINE_MUTEX(fwnet_device_mutex);
static LIST_HEAD(fwnet_device_list);

struct fwnet_device {};

struct fwnet_peer {};

/* This is our task struct. It's used for the packet complete callback.  */
struct fwnet_packet_task {};

/*
 * saddr == NULL means use device source address.
 * daddr == NULL means leave destination address (eg unresolved arp).
 */
static int fwnet_header_create(struct sk_buff *skb, struct net_device *net,
			unsigned short type, const void *daddr,
			const void *saddr, unsigned len)
{}

static int fwnet_header_cache(const struct neighbour *neigh,
			      struct hh_cache *hh, __be16 type)
{}

/* Called by Address Resolution module to notify changes in address. */
static void fwnet_header_cache_update(struct hh_cache *hh,
		const struct net_device *net, const unsigned char *haddr)
{}

static int fwnet_header_parse(const struct sk_buff *skb, unsigned char *haddr)
{}

static const struct header_ops fwnet_header_ops =;

/* FIXME: is this correct for all cases? */
static bool fwnet_frag_overlap(struct fwnet_partial_datagram *pd,
			       unsigned offset, unsigned len)
{}

/* Assumes that new fragment does not overlap any existing fragments */
static struct fwnet_fragment_info *fwnet_frag_new(
	struct fwnet_partial_datagram *pd, unsigned offset, unsigned len)
{}

static struct fwnet_partial_datagram *fwnet_pd_new(struct net_device *net,
		struct fwnet_peer *peer, u16 datagram_label, unsigned dg_size,
		void *frag_buf, unsigned frag_off, unsigned frag_len)
{}

static struct fwnet_partial_datagram *fwnet_pd_find(struct fwnet_peer *peer,
						    u16 datagram_label)
{}


static void fwnet_pd_delete(struct fwnet_partial_datagram *old)
{}

static bool fwnet_pd_update(struct fwnet_peer *peer,
		struct fwnet_partial_datagram *pd, void *frag_buf,
		unsigned frag_off, unsigned frag_len)
{}

static bool fwnet_pd_is_complete(struct fwnet_partial_datagram *pd)
{}

/* caller must hold dev->lock */
static struct fwnet_peer *fwnet_peer_find_by_guid(struct fwnet_device *dev,
						  u64 guid)
{}

/* caller must hold dev->lock */
static struct fwnet_peer *fwnet_peer_find_by_node_id(struct fwnet_device *dev,
						int node_id, int generation)
{}

/* See IEEE 1394-2008 table 6-4, table 8-8, table 16-18. */
static unsigned fwnet_max_payload(unsigned max_rec, unsigned speed)
{}


static int fwnet_finish_incoming_packet(struct net_device *net,
					struct sk_buff *skb, u16 source_node_id,
					bool is_broadcast, u16 ether_type)
{}

static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len,
				 int source_node_id, int generation,
				 bool is_broadcast)
{}

static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r,
		int tcode, int destination, int source, int generation,
		unsigned long long offset, void *payload, size_t length,
		void *callback_data)
{}

static int gasp_source_id(__be32 *p)
{}

static u32 gasp_specifier_id(__be32 *p)
{}

static u32 gasp_version(__be32 *p)
{}

static void fwnet_receive_broadcast(struct fw_iso_context *context,
		u32 cycle, size_t header_length, void *header, void *data)
{}

static struct kmem_cache *fwnet_packet_task_cache;

static void fwnet_free_ptask(struct fwnet_packet_task *ptask)
{}

/* Caller must hold dev->lock. */
static void dec_queued_datagrams(struct fwnet_device *dev)
{}

static int fwnet_send_packet(struct fwnet_packet_task *ptask);

static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask)
{}

static void fwnet_transmit_packet_failed(struct fwnet_packet_task *ptask)
{}

static void fwnet_write_complete(struct fw_card *card, int rcode,
				 void *payload, size_t length, void *data)
{}

static int fwnet_send_packet(struct fwnet_packet_task *ptask)
{}

static void fwnet_fifo_stop(struct fwnet_device *dev)
{}

static int fwnet_fifo_start(struct fwnet_device *dev)
{}

static void __fwnet_broadcast_stop(struct fwnet_device *dev)
{}

static void fwnet_broadcast_stop(struct fwnet_device *dev)
{}

static int fwnet_broadcast_start(struct fwnet_device *dev)
{}

static void set_carrier_state(struct fwnet_device *dev)
{}

/* ifup */
static int fwnet_open(struct net_device *net)
{}

/* ifdown */
static int fwnet_stop(struct net_device *net)
{}

static netdev_tx_t fwnet_tx(struct sk_buff *skb, struct net_device *net)
{}

static const struct ethtool_ops fwnet_ethtool_ops =;

static const struct net_device_ops fwnet_netdev_ops =;

static void fwnet_init_dev(struct net_device *net)
{}

/* caller must hold fwnet_device_mutex */
static struct fwnet_device *fwnet_dev_find(struct fw_card *card)
{}

static int fwnet_add_peer(struct fwnet_device *dev,
			  struct fw_unit *unit, struct fw_device *device)
{}

static int fwnet_probe(struct fw_unit *unit,
		       const struct ieee1394_device_id *id)
{}

/*
 * FIXME abort partially sent fragmented datagrams,
 * discard partially received fragmented datagrams
 */
static void fwnet_update(struct fw_unit *unit)
{}

static void fwnet_remove_peer(struct fwnet_peer *peer, struct fwnet_device *dev)
{}

static void fwnet_remove(struct fw_unit *unit)
{}

static const struct ieee1394_device_id fwnet_id_table[] =;

static struct fw_driver fwnet_driver =;

static const u32 rfc2374_unit_directory_data[] =;

static struct fw_descriptor rfc2374_unit_directory =;

#if IS_ENABLED(CONFIG_IPV6)
static const u32 rfc3146_unit_directory_data[] =;

static struct fw_descriptor rfc3146_unit_directory =;
#endif

static int __init fwnet_init(void)
{}
module_init();

static void __exit fwnet_cleanup(void)
{}
module_exit(fwnet_cleanup);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_DEVICE_TABLE(ieee1394, fwnet_id_table);