一 linux上
6lowpan与ieee802154(zigbee)的实现比较:
应用层 |
https://github.com/JulienMasson/6LoWPAN/blob/master/webserver/webserver.c |
|
||||||||||||
网络层 |
Ipv6协议族: 路由可以基于ipv6+RPL协议; |
ieee802154协议族: 传输控制也没有问题,但是路由协议又该如何解决呢? |
||||||||||||
mac子层:实现各自的网络设备驱动+MLME驱动 |
6lowpan子层: kernel3.10 Kernel4.0 @/linux-4.0/net/ieee802154/6lowpan/core.c static const struct net_device_ops lowpan_netdev_ops = { .ndo_init = lowpan_dev_init, .ndo_start_xmit = lowpan_xmit, .ndo_set_mac_address = lowpan_set_address, }; static struct ieee802154_mlme_ops lowpan_mlme = { .get_pan_id = lowpan_get_pan_id, .get_phy = lowpan_get_phy, .get_short_addr = lowpan_get_short_addr, .get_dsn = lowpan_get_dsn, }; static struct header_ops lowpan_header_ops = { .create = lowpan_header_create, }; 注册网络设备方式: static struct rtnl_link_ops lowpan_link_ops __read_mostly = { .kind = "lowpan", .priv_size = sizeof(struct lowpan_dev_info), .setup = lowpan_setup, .newlink = lowpan_newlink, .dellink = lowpan_dellink, .validate = lowpan_validate, }; static inline int __init lowpan_netlink_init(void) { return rtnl_link_register(&lowpan_link_ops); } |
mac802154层:wpan.c static struct header_ops mac802154_header_ops = { .create = mac802154_header_create, .parse = mac802154_header_parse, }; static const struct net_device_ops mac802154_wpan_ops = { .ndo_open = mac802154_slave_open, .ndo_stop = mac802154_slave_close, .ndo_start_xmit = mac802154_wpan_xmit, .ndo_do_ioctl = mac802154_wpan_ioctl, .ndo_set_mac_address = mac802154_wpan_mac_addr, }; struct ieee802154_mlme_ops mac802154_mlme_wpan = { .get_phy = mac802154_get_phy, .start_req = mac802154_mlme_start_req, .get_pan_id = mac802154_dev_get_pan_id, .get_short_addr = mac802154_dev_get_short_addr, .get_dsn = mac802154_dev_get_dsn, }; 注册网络设备方式: mac802154_add_iface(struct wpan_phy *phy, const char *name, int type) { 。。。。。 err = |
||||||||||||
如何与mac和物理层通信 |
通过虚拟化网络技术,类似:VLAN |
ieee802154直接访问 |
1)6lopwan是一个mac子层协议,其下一级mac可以是ieee802.15.4也可以是IEEE
802.15.1(蓝牙)=/net/bluetooth/6lowpan.c(/net/bluetooth);
2),6lowpan网络设备如何与802154
的mac和物理层进行数据传输?仅仅通过rtnetlink就可以了?
6lowpan网络设备是在linux
平台是一个虚拟的网络设备。
---是的,通过rtnetlink构造一个
网络虚拟设备,同VLAN
:lowpan。但是在lowpan_newlink()里面:
/* find and hold real wpan device */
real_dev = dev_get_by_index(src_net,nla_get_u32(tb[IFLA_LINK]));//根据nla_get_u32(tb[IFLA_LINK]绑定真正的网络设备==》mac802154。
6lowpan网络设备与ieee802.15.4
设备的逻辑关系,如下:
3):效率问题?
”ieee802154(或者zigbee应用)“
与
”
6lowpan应用“---理论上同样的mac和物理层。但是数据封装不一样了。我觉得”“ieee802154或者zigbee应用的路径“
比
”6lowpan路径“
更加的高效。