#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include "linux/ntb.h"
#include "linux/ntb_transport.h"
#define NTB_TRANSPORT_VERSION …
#define NTB_TRANSPORT_VER …
#define NTB_TRANSPORT_NAME …
#define NTB_TRANSPORT_DESC …
#define NTB_TRANSPORT_MIN_SPADS …
MODULE_DESCRIPTION(…);
MODULE_VERSION(…);
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
static unsigned long max_mw_size;
module_param(max_mw_size, ulong, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int transport_mtu = …;
module_param(transport_mtu, uint, 0644);
MODULE_PARM_DESC(…) …;
static unsigned char max_num_clients;
module_param(max_num_clients, byte, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int copy_bytes = …;
module_param(copy_bytes, uint, 0644);
MODULE_PARM_DESC(…) …;
static bool use_dma;
module_param(use_dma, bool, 0644);
MODULE_PARM_DESC(…) …;
static bool use_msi;
#ifdef CONFIG_NTB_MSI
module_param(use_msi, bool, 0644);
MODULE_PARM_DESC(…) …;
#endif
static struct dentry *nt_debugfs_dir;
#define PIDX …
struct ntb_queue_entry { … };
struct ntb_rx_info { … };
struct ntb_transport_qp { … };
struct ntb_transport_mw { … };
struct ntb_transport_client_dev { … };
struct ntb_transport_ctx { … };
enum { … };
struct ntb_payload_header { … };
enum { … };
#define dev_client_dev(__dev) …
#define drv_client(__drv) …
#define QP_TO_MW(nt, qp) …
#define NTB_QP_DEF_NUM_ENTRIES …
#define NTB_LINK_DOWN_TIMEOUT …
static void ntb_transport_rxc_db(unsigned long data);
static const struct ntb_ctx_ops ntb_transport_ops;
static struct ntb_client ntb_transport_client;
static int ntb_async_tx_submit(struct ntb_transport_qp *qp,
struct ntb_queue_entry *entry);
static void ntb_memcpy_tx(struct ntb_queue_entry *entry, void __iomem *offset);
static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset);
static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset);
static int ntb_transport_bus_match(struct device *dev,
const struct device_driver *drv)
{ … }
static int ntb_transport_bus_probe(struct device *dev)
{ … }
static void ntb_transport_bus_remove(struct device *dev)
{ … }
static struct bus_type ntb_transport_bus = …;
static LIST_HEAD(ntb_transport_list);
static int ntb_bus_init(struct ntb_transport_ctx *nt)
{ … }
static void ntb_bus_remove(struct ntb_transport_ctx *nt)
{ … }
static void ntb_transport_client_release(struct device *dev)
{ … }
void ntb_transport_unregister_client_dev(char *device_name)
{ … }
EXPORT_SYMBOL_GPL(…);
int ntb_transport_register_client_dev(char *device_name)
{ … }
EXPORT_SYMBOL_GPL(…);
int ntb_transport_register_client(struct ntb_transport_client *drv)
{ … }
EXPORT_SYMBOL_GPL(…);
void ntb_transport_unregister_client(struct ntb_transport_client *drv)
{ … }
EXPORT_SYMBOL_GPL(…);
static ssize_t debugfs_read(struct file *filp, char __user *ubuf, size_t count,
loff_t *offp)
{ … }
static const struct file_operations ntb_qp_debugfs_stats = …;
static void ntb_list_add(spinlock_t *lock, struct list_head *entry,
struct list_head *list)
{ … }
static struct ntb_queue_entry *ntb_list_rm(spinlock_t *lock,
struct list_head *list)
{ … }
static struct ntb_queue_entry *ntb_list_mv(spinlock_t *lock,
struct list_head *list,
struct list_head *to_list)
{ … }
static int ntb_transport_setup_qp_mw(struct ntb_transport_ctx *nt,
unsigned int qp_num)
{ … }
static irqreturn_t ntb_transport_isr(int irq, void *dev)
{ … }
static void ntb_transport_setup_qp_peer_msi(struct ntb_transport_ctx *nt,
unsigned int qp_num)
{ … }
static void ntb_transport_setup_qp_msi(struct ntb_transport_ctx *nt,
unsigned int qp_num)
{ … }
static void ntb_transport_msi_peer_desc_changed(struct ntb_transport_ctx *nt)
{ … }
static void ntb_transport_msi_desc_changed(void *data)
{ … }
static void ntb_free_mw(struct ntb_transport_ctx *nt, int num_mw)
{ … }
static int ntb_alloc_mw_buffer(struct ntb_transport_mw *mw,
struct device *dma_dev, size_t align)
{ … }
static int ntb_set_mw(struct ntb_transport_ctx *nt, int num_mw,
resource_size_t size)
{ … }
static void ntb_qp_link_context_reset(struct ntb_transport_qp *qp)
{ … }
static void ntb_qp_link_down_reset(struct ntb_transport_qp *qp)
{ … }
static void ntb_qp_link_cleanup(struct ntb_transport_qp *qp)
{ … }
static void ntb_qp_link_cleanup_work(struct work_struct *work)
{ … }
static void ntb_qp_link_down(struct ntb_transport_qp *qp)
{ … }
static void ntb_transport_link_cleanup(struct ntb_transport_ctx *nt)
{ … }
static void ntb_transport_link_cleanup_work(struct work_struct *work)
{ … }
static void ntb_transport_event_callback(void *data)
{ … }
static void ntb_transport_link_work(struct work_struct *work)
{ … }
static void ntb_qp_link_work(struct work_struct *work)
{ … }
static int ntb_transport_init_queue(struct ntb_transport_ctx *nt,
unsigned int qp_num)
{ … }
static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev)
{ … }
static void ntb_transport_free(struct ntb_client *self, struct ntb_dev *ndev)
{ … }
static void ntb_complete_rxc(struct ntb_transport_qp *qp)
{ … }
static void ntb_rx_copy_callback(void *data,
const struct dmaengine_result *res)
{ … }
static void ntb_memcpy_rx(struct ntb_queue_entry *entry, void *offset)
{ … }
static int ntb_async_rx_submit(struct ntb_queue_entry *entry, void *offset)
{ … }
static void ntb_async_rx(struct ntb_queue_entry *entry, void *offset)
{ … }
static int ntb_process_rxc(struct ntb_transport_qp *qp)
{ … }
static void ntb_transport_rxc_db(unsigned long data)
{ … }
static void ntb_tx_copy_callback(void *data,
const struct dmaengine_result *res)
{ … }
static void ntb_memcpy_tx(struct ntb_queue_entry *entry, void __iomem *offset)
{ … }
static int ntb_async_tx_submit(struct ntb_transport_qp *qp,
struct ntb_queue_entry *entry)
{ … }
static void ntb_async_tx(struct ntb_transport_qp *qp,
struct ntb_queue_entry *entry)
{ … }
static int ntb_process_tx(struct ntb_transport_qp *qp,
struct ntb_queue_entry *entry)
{ … }
static void ntb_send_link_down(struct ntb_transport_qp *qp)
{ … }
static bool ntb_dma_filter_fn(struct dma_chan *chan, void *node)
{ … }
struct ntb_transport_qp *
ntb_transport_create_queue(void *data, struct device *client_dev,
const struct ntb_queue_handlers *handlers)
{ … }
EXPORT_SYMBOL_GPL(…);
void ntb_transport_free_queue(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
void *ntb_transport_rx_remove(struct ntb_transport_qp *qp, unsigned int *len)
{ … }
EXPORT_SYMBOL_GPL(…);
int ntb_transport_rx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
unsigned int len)
{ … }
EXPORT_SYMBOL_GPL(…);
int ntb_transport_tx_enqueue(struct ntb_transport_qp *qp, void *cb, void *data,
unsigned int len)
{ … }
EXPORT_SYMBOL_GPL(…);
void ntb_transport_link_up(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
void ntb_transport_link_down(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
bool ntb_transport_link_query(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned char ntb_transport_qp_num(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int ntb_transport_max_size(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
unsigned int ntb_transport_tx_free_entry(struct ntb_transport_qp *qp)
{ … }
EXPORT_SYMBOL_GPL(…);
static void ntb_transport_doorbell_callback(void *data, int vector)
{ … }
static const struct ntb_ctx_ops ntb_transport_ops = …;
static struct ntb_client ntb_transport_client = …;
static int __init ntb_transport_init(void)
{ … }
module_init(…) …;
static void __exit ntb_transport_exit(void)
{ … }
module_exit(ntb_transport_exit);