#include <linux/module.h>
#include <linux/timer.h>
#include <linux/platform_device.h>
#include <linux/rtnetlink.h>
#include <linux/netdevice.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <net/ieee802154_netdev.h>
#include <net/mac802154.h>
#include <net/cfg802154.h>
#include <net/genetlink.h>
#include "mac802154_hwsim.h"
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
static LIST_HEAD(hwsim_phys);
static DEFINE_MUTEX(hwsim_phys_lock);
static struct platform_device *mac802154hwsim_dev;
static struct genl_family hwsim_genl_family;
static int hwsim_radio_idx;
enum hwsim_multicast_groups { … };
static const struct genl_multicast_group hwsim_mcgrps[] = …;
struct hwsim_pib { … };
struct hwsim_edge_info { … };
struct hwsim_edge { … };
struct hwsim_phy { … };
static int hwsim_add_one(struct genl_info *info, struct device *dev,
bool init);
static void hwsim_del(struct hwsim_phy *phy);
static int hwsim_hw_ed(struct ieee802154_hw *hw, u8 *level)
{ … }
static int hwsim_update_pib(struct ieee802154_hw *hw, u8 page, u8 channel,
struct ieee802154_hw_addr_filt *filt,
enum ieee802154_filtering_level filt_level)
{ … }
static int hwsim_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{ … }
static int hwsim_hw_addr_filt(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt,
unsigned long changed)
{ … }
static void hwsim_hw_receive(struct ieee802154_hw *hw, struct sk_buff *skb,
u8 lqi)
{ … }
static int hwsim_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
{ … }
static int hwsim_hw_start(struct ieee802154_hw *hw)
{ … }
static void hwsim_hw_stop(struct ieee802154_hw *hw)
{ … }
static int
hwsim_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
{ … }
static const struct ieee802154_ops hwsim_ops = …;
static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
{ … }
static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
{ … }
static int append_radio_msg(struct sk_buff *skb, struct hwsim_phy *phy)
{ … }
static int hwsim_get_radio(struct sk_buff *skb, struct hwsim_phy *phy,
u32 portid, u32 seq,
struct netlink_callback *cb, int flags)
{ … }
static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
{ … }
static int hwsim_dump_radio_nl(struct sk_buff *skb,
struct netlink_callback *cb)
{ … }
static struct hwsim_phy *hwsim_get_radio_by_id(uint32_t idx)
{ … }
static const struct nla_policy hwsim_edge_policy[MAC802154_HWSIM_EDGE_ATTR_MAX + 1] = …;
static struct hwsim_edge *hwsim_alloc_edge(struct hwsim_phy *endpoint, u8 lqi)
{ … }
static void hwsim_free_edge(struct hwsim_edge *e)
{ … }
static int hwsim_new_edge_nl(struct sk_buff *msg, struct genl_info *info)
{ … }
static int hwsim_del_edge_nl(struct sk_buff *msg, struct genl_info *info)
{ … }
static int hwsim_set_edge_lqi(struct sk_buff *msg, struct genl_info *info)
{ … }
static const struct nla_policy hwsim_genl_policy[MAC802154_HWSIM_ATTR_MAX + 1] = …;
static const struct genl_small_ops hwsim_nl_ops[] = …;
static struct genl_family hwsim_genl_family __ro_after_init = …;
static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
struct genl_info *info)
{ … }
static void hwsim_mcast_new_radio(struct genl_info *info, struct hwsim_phy *phy)
{ … }
static void hwsim_edge_unsubscribe_me(struct hwsim_phy *phy)
{ … }
static int hwsim_subscribe_all_others(struct hwsim_phy *phy)
{ … }
static int hwsim_add_one(struct genl_info *info, struct device *dev,
bool init)
{ … }
static void hwsim_del(struct hwsim_phy *phy)
{ … }
static int hwsim_probe(struct platform_device *pdev)
{ … }
static void hwsim_remove(struct platform_device *pdev)
{ … }
static struct platform_driver mac802154hwsim_driver = …;
static __init int hwsim_init_module(void)
{ … }
static __exit void hwsim_remove_module(void)
{ … }
module_init(…) …;
module_exit(hwsim_remove_module);