22 #include <linux/kernel.h>
23 #include <linux/module.h>
25 #include <linux/netdevice.h>
27 #include <linux/if_arp.h>
141 static int fake_assoc_req(
struct net_device *dev,
144 struct wpan_phy *phy = fake_to_phy(dev);
171 static int fake_assoc_resp(
struct net_device *dev,
189 static int fake_disassoc_req(
struct net_device *dev,
216 u8 bcn_ord,
u8 sf_ord,
u8 pan_coord,
u8 blx,
219 struct wpan_phy *phy = fake_to_phy(dev);
256 .assoc_req = fake_assoc_req,
257 .assoc_resp = fake_assoc_resp,
258 .disassoc_req = fake_disassoc_req,
259 .start_req = fake_start_req,
260 .scan_req = fake_scan_req,
262 .get_phy = fake_get_phy,
264 .get_pan_id = fake_get_pan_id,
265 .get_short_addr = fake_get_short_addr,
266 .get_dsn = fake_get_dsn,
267 .get_bsn = fake_get_bsn,
270 static int ieee802154_fake_open(
struct net_device *dev)
272 netif_start_queue(dev);
276 static int ieee802154_fake_close(
struct net_device *dev)
278 netif_stop_queue(dev);
285 dev->
stats.tx_packets++;
295 static int ieee802154_fake_ioctl(
struct net_device *dev,
struct ifreq *ifr,
300 u16 pan_id, short_addr;
305 pan_id = fake_get_pan_id(dev);
306 short_addr = fake_get_short_addr(dev);
313 sa->
addr.pan_id = pan_id;
314 sa->
addr.short_addr = short_addr;
320 static int ieee802154_fake_mac_addr(
struct net_device *dev,
void *
p)
326 .ndo_open = ieee802154_fake_open,
327 .ndo_stop = ieee802154_fake_close,
328 .ndo_start_xmit = ieee802154_fake_xmit,
329 .ndo_do_ioctl = ieee802154_fake_ioctl,
330 .ndo_set_mac_address = ieee802154_fake_mac_addr,
333 static void ieee802154_fake_destruct(
struct net_device *dev)
335 struct wpan_phy *phy = fake_to_phy(dev);
342 static void ieee802154_fake_setup(
struct net_device *dev)
391 priv = netdev_priv(dev);
394 wpan_phy_set_dev(phy, &pdev->
dev);
397 platform_set_drvdata(pdev, dev);
407 dev_info(&pdev->
dev,
"Added ieee802154 HardMAC hardware\n");
417 struct net_device *dev = platform_get_drvdata(pdev);
425 .probe = ieee802154fake_probe,
428 .name =
"ieee802154hardmac",
433 static __init int fake_init(
void)
435 ieee802154fake_dev = platform_device_register_simple(
436 "ieee802154hardmac", -1,
NULL, 0);
440 static __exit void fake_exit(
void)