#include <linux/debugfs.h>
#include <linux/err.h>
#include <linux/etherdevice.h>
#include <linux/inet.h>
#include <linux/kernel.h>
#include <linux/random.h>
#include <linux/slab.h>
#include <net/devlink.h>
#include <net/ip.h>
#include <net/psample.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/udp.h>
#include "netdevsim.h"
#define NSIM_PSAMPLE_REPORT_INTERVAL_MS …
#define NSIM_PSAMPLE_INVALID_TC …
#define NSIM_PSAMPLE_L4_DATA_LEN …
struct nsim_dev_psample { … };
static struct sk_buff *nsim_dev_psample_skb_build(void)
{ … }
static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample,
struct psample_metadata *md,
unsigned int len)
{ … }
static void nsim_dev_psample_report_work(struct work_struct *work)
{ … }
static int nsim_dev_psample_enable(struct nsim_dev *nsim_dev)
{ … }
static int nsim_dev_psample_disable(struct nsim_dev *nsim_dev)
{ … }
static ssize_t nsim_dev_psample_enable_write(struct file *file,
const char __user *data,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations nsim_psample_enable_fops = …;
int nsim_dev_psample_init(struct nsim_dev *nsim_dev)
{ … }
void nsim_dev_psample_exit(struct nsim_dev *nsim_dev)
{ … }