#include <linux/atomic.h>
#include <linux/highmem.h>
#include <linux/if_vlan.h>
#include <linux/jhash.h>
#include <linux/module.h>
#include <linux/etherdevice.h>
#include <linux/rtnetlink.h>
#include <linux/sizes.h>
#include <linux/thunderbolt.h>
#include <linux/uuid.h>
#include <linux/workqueue.h>
#include <net/ip6_checksum.h>
#include "trace.h"
#define TBNET_LOGIN_DELAY …
#define TBNET_LOGIN_TIMEOUT …
#define TBNET_LOGOUT_TIMEOUT …
#define TBNET_RING_SIZE …
#define TBNET_LOGIN_RETRIES …
#define TBNET_LOGOUT_RETRIES …
#define TBNET_E2E …
#define TBNET_MATCH_FRAGS_ID …
#define TBNET_64K_FRAMES …
#define TBNET_MAX_MTU …
#define TBNET_FRAME_SIZE …
#define TBNET_MAX_PAYLOAD_SIZE …
#define TBNET_RX_MAX_SIZE …
#define TBNET_RX_PAGE_ORDER …
#define TBNET_RX_PAGE_SIZE …
#define TBNET_L0_PORT_NUM(route) …
struct thunderbolt_ip_frame_header { … };
enum thunderbolt_ip_frame_pdf { … };
enum thunderbolt_ip_type { … };
struct thunderbolt_ip_header { … };
#define TBIP_HDR_LENGTH_MASK …
#define TBIP_HDR_SN_MASK …
#define TBIP_HDR_SN_SHIFT …
struct thunderbolt_ip_login { … };
#define TBIP_LOGIN_PROTO_VERSION …
struct thunderbolt_ip_login_response { … };
struct thunderbolt_ip_logout { … };
struct thunderbolt_ip_status { … };
struct tbnet_stats { … };
struct tbnet_frame { … };
struct tbnet_ring { … };
struct tbnet { … };
static const uuid_t tbnet_dir_uuid = …;
static const uuid_t tbnet_svc_uuid = …;
static struct tb_property_dir *tbnet_dir;
static bool tbnet_e2e = …;
module_param_named(e2e, tbnet_e2e, bool, 0444);
MODULE_PARM_DESC(…) …;
static void tbnet_fill_header(struct thunderbolt_ip_header *hdr, u64 route,
u8 sequence, const uuid_t *initiator_uuid, const uuid_t *target_uuid,
enum thunderbolt_ip_type type, size_t size, u32 command_id)
{ … }
static int tbnet_login_response(struct tbnet *net, u64 route, u8 sequence,
u32 command_id)
{ … }
static int tbnet_login_request(struct tbnet *net, u8 sequence)
{ … }
static int tbnet_logout_response(struct tbnet *net, u64 route, u8 sequence,
u32 command_id)
{ … }
static int tbnet_logout_request(struct tbnet *net)
{ … }
static void start_login(struct tbnet *net)
{ … }
static void stop_login(struct tbnet *net)
{ … }
static inline unsigned int tbnet_frame_size(const struct tbnet_frame *tf)
{ … }
static void tbnet_free_buffers(struct tbnet_ring *ring)
{ … }
static void tbnet_tear_down(struct tbnet *net, bool send_logout)
{ … }
static int tbnet_handle_packet(const void *buf, size_t size, void *data)
{ … }
static unsigned int tbnet_available_buffers(const struct tbnet_ring *ring)
{ … }
static int tbnet_alloc_rx_buffers(struct tbnet *net, unsigned int nbuffers)
{ … }
static struct tbnet_frame *tbnet_get_tx_buffer(struct tbnet *net)
{ … }
static void tbnet_tx_callback(struct tb_ring *ring, struct ring_frame *frame,
bool canceled)
{ … }
static int tbnet_alloc_tx_buffers(struct tbnet *net)
{ … }
static void tbnet_connected_work(struct work_struct *work)
{ … }
static void tbnet_login_work(struct work_struct *work)
{ … }
static void tbnet_disconnect_work(struct work_struct *work)
{ … }
static bool tbnet_check_frame(struct tbnet *net, const struct tbnet_frame *tf,
const struct thunderbolt_ip_frame_header *hdr)
{ … }
static int tbnet_poll(struct napi_struct *napi, int budget)
{ … }
static void tbnet_start_poll(void *data)
{ … }
static int tbnet_open(struct net_device *dev)
{ … }
static int tbnet_stop(struct net_device *dev)
{ … }
static bool tbnet_xmit_csum_and_map(struct tbnet *net, struct sk_buff *skb,
struct tbnet_frame **frames, u32 frame_count)
{ … }
static void *tbnet_kmap_frag(struct sk_buff *skb, unsigned int frag_num,
unsigned int *len)
{ … }
static netdev_tx_t tbnet_start_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static void tbnet_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *stats)
{ … }
static const struct net_device_ops tbnet_netdev_ops = …;
static void tbnet_generate_mac(struct net_device *dev)
{ … }
static int tbnet_probe(struct tb_service *svc, const struct tb_service_id *id)
{ … }
static void tbnet_remove(struct tb_service *svc)
{ … }
static void tbnet_shutdown(struct tb_service *svc)
{ … }
static int tbnet_suspend(struct device *dev)
{ … }
static int tbnet_resume(struct device *dev)
{ … }
static DEFINE_SIMPLE_DEV_PM_OPS(tbnet_pm_ops, tbnet_suspend, tbnet_resume);
static const struct tb_service_id tbnet_ids[] = …;
MODULE_DEVICE_TABLE(tbsvc, tbnet_ids);
static struct tb_service_driver tbnet_driver = …;
static int __init tbnet_init(void)
{ … }
module_init(…) …;
static void __exit tbnet_exit(void)
{ … }
module_exit(tbnet_exit);
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;