Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 32bad7e3 authored by alex.bluesman.smirnov@gmail.com's avatar alex.bluesman.smirnov@gmail.com Committed by David S. Miller
Browse files

mac802154: add wpan device-class support



Every real 802.15.4 transceiver, which works with software MAC layer,
can be classified as a wpan device in this stack. So the wpan device
implementation provides missing link in datapath between the device
drivers and the Linux network queue.

According to the IEEE 802.15.4 standard each packet can be one of the
following types:
 - beacon
 - MAC layer command
 - ACK
 - data

This patch adds support for the data packet-type only, but this is
enough to perform data transmission and receiving over radio.

Signed-off-by: default avatarAlexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5ac24979
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -130,18 +130,8 @@ enum {
enum {
	__IEEE802154_DEV_INVALID = -1,

	 /* TODO:
	 * Nowadays three device types supported by this stack at linux-zigbee
	 * project: WPAN = 0, MONITOR = 1 and SMAC = 2.
	 *
	 * Since this stack implementation exists many years, it's definitely
	 * bad idea to change the assigned values due to they are already used
	 * by third-party userspace software like: iz-tools, wireshark...
	 *
	 * Currently only monitor device is added and initialized by '1' for
	 * compatibility.
	 */
	IEEE802154_DEV_MONITOR = 1,
	IEEE802154_DEV_WPAN,
	IEEE802154_DEV_MONITOR,

	__IEEE802154_DEV_MAX,
};
+8 −0
Original line number Diff line number Diff line
@@ -21,6 +21,14 @@

#include <net/af_ieee802154.h>

/* General MAC frame format:
 *  2 bytes: Frame Control
 *  1 byte:  Sequence Number
 * 20 bytes: Addressing fields
 * 14 bytes: Auxiliary Security Header
 */
#define MAC802154_FRAME_HARD_HEADER_LEN		(2 + 1 + 20 + 14)

/* The following flags are used to indicate changed address settings from
 * the stack to the hardware.
 */
+1 −1
Original line number Diff line number Diff line
obj-$(CONFIG_MAC802154)	+= mac802154.o
mac802154-objs		:= ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o
mac802154-objs		:= ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o monitor.o wpan.o
+4 −0
Original line number Diff line number Diff line
@@ -140,6 +140,10 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)
		dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
				   name, mac802154_monitor_setup);
		break;
	case IEEE802154_DEV_WPAN:
		dev = alloc_netdev(sizeof(struct mac802154_sub_if_data),
				   name, mac802154_wpan_setup);
		break;
	default:
		dev = NULL;
		err = -EINVAL;
+4 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ struct mac802154_sub_if_data {
#define MAC802154_CHAN_NONE		(~(u8)0) /* No channel is assigned */

extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;

int mac802154_slave_open(struct net_device *dev);
int mac802154_slave_close(struct net_device *dev);
@@ -100,6 +101,9 @@ int mac802154_slave_close(struct net_device *dev);
void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb);
void mac802154_monitor_setup(struct net_device *dev);

void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb);
void mac802154_wpan_setup(struct net_device *dev);

netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,
			 u8 page, u8 chan);

Loading