linux/drivers/net/wireless/marvell/libertas/mesh.c

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

#include <linux/delay.h>
#include <linux/etherdevice.h>
#include <linux/hardirq.h>
#include <linux/netdevice.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/kthread.h>
#include <linux/kfifo.h>
#include <net/cfg80211.h>

#include "mesh.h"
#include "decl.h"
#include "cmd.h"


static int lbs_add_mesh(struct lbs_private *priv);

/***************************************************************************
 * Mesh command handling
 */

static int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
		    struct cmd_ds_mesh_access *cmd)
{}

static int __lbs_mesh_config_send(struct lbs_private *priv,
				  struct cmd_ds_mesh_config *cmd,
				  uint16_t action, uint16_t type)
{}

static int lbs_mesh_config_send(struct lbs_private *priv,
			 struct cmd_ds_mesh_config *cmd,
			 uint16_t action, uint16_t type)
{}

/* This function is the CMD_MESH_CONFIG legacy function.  It only handles the
 * START and STOP actions.  The extended actions supported by CMD_MESH_CONFIG
 * are all handled by preparing a struct cmd_ds_mesh_config and passing it to
 * lbs_mesh_config_send.
 */
static int lbs_mesh_config(struct lbs_private *priv, uint16_t action,
		uint16_t chan)
{}

int lbs_mesh_set_channel(struct lbs_private *priv, u8 channel)
{}

static uint16_t lbs_mesh_get_channel(struct lbs_private *priv)
{}

/***************************************************************************
 * Mesh sysfs support
 */

/*
 * Attributes exported through sysfs
 */

/**
 * anycast_mask_show - Get function for sysfs attribute anycast_mask
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t anycast_mask_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

/**
 * anycast_mask_store - Set function for sysfs attribute anycast_mask
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t anycast_mask_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{}

/**
 * prb_rsp_limit_show - Get function for sysfs attribute prb_rsp_limit
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t prb_rsp_limit_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{}

/**
 * prb_rsp_limit_store - Set function for sysfs attribute prb_rsp_limit
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t prb_rsp_limit_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{}

/**
 * lbs_mesh_show - Get function for sysfs attribute mesh
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t lbs_mesh_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}

/**
 * lbs_mesh_store - Set function for sysfs attribute mesh
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t lbs_mesh_store(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{}

/*
 * lbs_mesh attribute to be exported per ethX interface
 * through sysfs (/sys/class/net/ethX/lbs_mesh)
 */
static DEVICE_ATTR_RW(lbs_mesh);

/*
 * anycast_mask attribute to be exported per mshX interface
 * through sysfs (/sys/class/net/mshX/anycast_mask)
 */
static DEVICE_ATTR_RW(anycast_mask);

/*
 * prb_rsp_limit attribute to be exported per mshX interface
 * through sysfs (/sys/class/net/mshX/prb_rsp_limit)
 */
static DEVICE_ATTR_RW(prb_rsp_limit);

static struct attribute *lbs_mesh_sysfs_entries[] =;

static const struct attribute_group lbs_mesh_attr_group =;


/***************************************************************************
 * Persistent configuration support
 */

static int mesh_get_default_parameters(struct device *dev,
				       struct mrvl_mesh_defaults *defs)
{}

/**
 * bootflag_show - Get function for sysfs attribute bootflag
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t bootflag_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}

/**
 * bootflag_store - Set function for sysfs attribute bootflag
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t bootflag_store(struct device *dev, struct device_attribute *attr,
			      const char *buf, size_t count)
{}

/**
 * boottime_show - Get function for sysfs attribute boottime
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t boottime_show(struct device *dev,
			     struct device_attribute *attr, char *buf)
{}

/**
 * boottime_store - Set function for sysfs attribute boottime
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t boottime_store(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{}

/**
 * channel_show - Get function for sysfs attribute channel
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t channel_show(struct device *dev,
			    struct device_attribute *attr, char *buf)
{}

/**
 * channel_store - Set function for sysfs attribute channel
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t channel_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{}

/**
 * mesh_id_show - Get function for sysfs attribute mesh_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t mesh_id_show(struct device *dev, struct device_attribute *attr,
			    char *buf)
{}

/**
 * mesh_id_store - Set function for sysfs attribute mesh_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t mesh_id_store(struct device *dev, struct device_attribute *attr,
			     const char *buf, size_t count)
{}

/**
 * protocol_id_show - Get function for sysfs attribute protocol_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t protocol_id_show(struct device *dev,
				struct device_attribute *attr,
				char *buf)
{}

/**
 * protocol_id_store - Set function for sysfs attribute protocol_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t protocol_id_store(struct device *dev,
				 struct device_attribute *attr,
				 const char *buf, size_t count)
{}

/**
 * metric_id_show - Get function for sysfs attribute metric_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t metric_id_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{}

/**
 * metric_id_store - Set function for sysfs attribute metric_id
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t metric_id_store(struct device *dev,
			       struct device_attribute *attr,
			       const char *buf, size_t count)
{}

/**
 * capability_show - Get function for sysfs attribute capability
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer where data will be returned
 */
static ssize_t capability_show(struct device *dev,
			       struct device_attribute *attr, char *buf)
{}

/**
 * capability_store - Set function for sysfs attribute capability
 * @dev: the &struct device
 * @attr: device attributes
 * @buf: buffer that contains new attribute value
 * @count: size of buffer
 */
static ssize_t capability_store(struct device *dev,
				struct device_attribute *attr,
				const char *buf, size_t count)
{}


static DEVICE_ATTR_RW(bootflag);
static DEVICE_ATTR_RW(boottime);
static DEVICE_ATTR_RW(channel);
static DEVICE_ATTR_RW(mesh_id);
static DEVICE_ATTR_RW(protocol_id);
static DEVICE_ATTR_RW(metric_id);
static DEVICE_ATTR_RW(capability);

static struct attribute *boot_opts_attrs[] =;

static const struct attribute_group boot_opts_group =;

static struct attribute *mesh_ie_attrs[] =;

static const struct attribute_group mesh_ie_group =;


/***************************************************************************
 * Initializing and starting, stopping mesh
 */

/*
 * Check mesh FW version and appropriately send the mesh start
 * command
 */
void lbs_init_mesh(struct lbs_private *priv)
{}

void lbs_start_mesh(struct lbs_private *priv)
{}

int lbs_deinit_mesh(struct lbs_private *priv)
{}


/**
 * lbs_mesh_stop - close the mshX interface
 *
 * @dev:	A pointer to &net_device structure
 * returns:	0
 */
static int lbs_mesh_stop(struct net_device *dev)
{}

/**
 * lbs_mesh_dev_open - open the mshX interface
 *
 * @dev:	A pointer to &net_device structure
 * returns:	0 or -EBUSY if monitor mode active
 */
static int lbs_mesh_dev_open(struct net_device *dev)
{}

static const struct net_device_ops mesh_netdev_ops =;

/**
 * lbs_add_mesh - add mshX interface
 *
 * @priv:	A pointer to the &struct lbs_private structure
 * returns:	0 if successful, -X otherwise
 */
static int lbs_add_mesh(struct lbs_private *priv)
{}

void lbs_remove_mesh(struct lbs_private *priv)
{}


/***************************************************************************
 * Sending and receiving
 */
struct net_device *lbs_mesh_set_dev(struct lbs_private *priv,
	struct net_device *dev, struct rxpd *rxpd)
{}


void lbs_mesh_set_txpd(struct lbs_private *priv,
	struct net_device *dev, struct txpd *txpd)
{}


/***************************************************************************
 * Ethtool related
 */

static const char mesh_stat_strings[MESH_STATS_NUM][ETH_GSTRING_LEN] =;

void lbs_mesh_ethtool_get_stats(struct net_device *dev,
	struct ethtool_stats *stats, uint64_t *data)
{}

int lbs_mesh_ethtool_get_sset_count(struct net_device *dev, int sset)
{}

void lbs_mesh_ethtool_get_strings(struct net_device *dev,
	uint32_t stringset, uint8_t *s)
{}