提交 944742a3 编写于 作者: A Alexander Aring 提交者: Marcel Holtmann

mac802154: use new nl802154 iftype types

This patch replace the depracted IEEE802154_DEV to the new introduced
NL802154_IFTYPE_NODE types. There is a backwards compatibility to have
the identical types for both enum definitions. Also remove some inlcude
issue with "linux/nl802154.h", because the export nl_policy inside this
header it was always necessary to have an include of "net/rtnetlink.h"
before. The reason for this is more complicated. Nevertheless we removed
this now, because "linux/nl802154.h" is the depracted netlink interface.
Signed-off-by: NAlexander Aring <alex.aring@gmail.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 cd11d935
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <net/cfg802154.h> #include <net/cfg802154.h>
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/nl802154.h>
#include <net/ieee802154_netdev.h> #include <net/ieee802154_netdev.h>
#include "llsec.h" #include "llsec.h"
...@@ -175,7 +176,7 @@ void ieee802154_iface_exit(void); ...@@ -175,7 +176,7 @@ void ieee802154_iface_exit(void);
void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata); void ieee802154_if_remove(struct ieee802154_sub_if_data *sdata);
struct net_device * struct net_device *
ieee802154_if_add(struct ieee802154_local *local, const char *name, ieee802154_if_add(struct ieee802154_local *local, const char *name,
struct wpan_dev **new_wpan_dev, int type); struct wpan_dev **new_wpan_dev, enum nl802154_iftype type);
void ieee802154_remove_interfaces(struct ieee802154_local *local); void ieee802154_remove_interfaces(struct ieee802154_local *local);
#endif /* __IEEE802154_I_H */ #endif /* __IEEE802154_I_H */
...@@ -22,8 +22,7 @@ ...@@ -22,8 +22,7 @@
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/ieee802154.h> #include <linux/ieee802154.h>
#include <net/rtnetlink.h> #include <net/nl802154.h>
#include <linux/nl802154.h>
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/ieee802154_netdev.h> #include <net/ieee802154_netdev.h>
#include <net/cfg802154.h> #include <net/cfg802154.h>
...@@ -144,7 +143,7 @@ static int mac802154_slave_open(struct net_device *dev) ...@@ -144,7 +143,7 @@ static int mac802154_slave_open(struct net_device *dev)
ASSERT_RTNL(); ASSERT_RTNL();
if (sdata->vif.type == IEEE802154_DEV_WPAN) { if (sdata->vif.type == NL802154_IFTYPE_NODE) {
mutex_lock(&sdata->local->iflist_mtx); mutex_lock(&sdata->local->iflist_mtx);
list_for_each_entry(subif, &sdata->local->interfaces, list) { list_for_each_entry(subif, &sdata->local->interfaces, list) {
if (subif != sdata && if (subif != sdata &&
...@@ -407,7 +406,8 @@ static void ieee802154_if_setup(struct net_device *dev) ...@@ -407,7 +406,8 @@ static void ieee802154_if_setup(struct net_device *dev)
} }
static int static int
ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type) ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata,
enum nl802154_iftype type)
{ {
struct wpan_dev *wpan_dev = &sdata->wpan_dev; struct wpan_dev *wpan_dev = &sdata->wpan_dev;
...@@ -429,7 +429,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type) ...@@ -429,7 +429,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
wpan_dev->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST); wpan_dev->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST);
switch (type) { switch (type) {
case IEEE802154_DEV_WPAN: case NL802154_IFTYPE_NODE:
ieee802154_be64_to_le64(&wpan_dev->extended_addr, ieee802154_be64_to_le64(&wpan_dev->extended_addr,
sdata->dev->dev_addr); sdata->dev->dev_addr);
...@@ -444,7 +444,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type) ...@@ -444,7 +444,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
mac802154_llsec_init(&sdata->sec); mac802154_llsec_init(&sdata->sec);
break; break;
case IEEE802154_DEV_MONITOR: case NL802154_IFTYPE_MONITOR:
sdata->dev->destructor = free_netdev; sdata->dev->destructor = free_netdev;
sdata->dev->netdev_ops = &mac802154_monitor_ops; sdata->dev->netdev_ops = &mac802154_monitor_ops;
wpan_dev->promiscuous_mode = true; wpan_dev->promiscuous_mode = true;
...@@ -458,7 +458,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type) ...@@ -458,7 +458,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
struct net_device * struct net_device *
ieee802154_if_add(struct ieee802154_local *local, const char *name, ieee802154_if_add(struct ieee802154_local *local, const char *name,
struct wpan_dev **new_wpan_dev, int type) struct wpan_dev **new_wpan_dev, enum nl802154_iftype type)
{ {
struct net_device *ndev = NULL; struct net_device *ndev = NULL;
struct ieee802154_sub_if_data *sdata = NULL; struct ieee802154_sub_if_data *sdata = NULL;
...@@ -478,10 +478,10 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name, ...@@ -478,10 +478,10 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name,
goto err; goto err;
switch (type) { switch (type) {
case IEEE802154_DEV_WPAN: case NL802154_IFTYPE_NODE:
ndev->type = ARPHRD_IEEE802154; ndev->type = ARPHRD_IEEE802154;
break; break;
case IEEE802154_DEV_MONITOR: case NL802154_IFTYPE_MONITOR:
ndev->type = ARPHRD_IEEE802154_MONITOR; ndev->type = ARPHRD_IEEE802154_MONITOR;
break; break;
default: default:
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <net/netlink.h> #include <net/netlink.h>
#include <linux/nl802154.h> #include <net/nl802154.h>
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/ieee802154_netdev.h> #include <net/ieee802154_netdev.h>
#include <net/route.h> #include <net/route.h>
...@@ -161,7 +161,7 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) ...@@ -161,7 +161,7 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
rtnl_lock(); rtnl_lock();
dev = ieee802154_if_add(local, "wpan%d", NULL, IEEE802154_DEV_WPAN); dev = ieee802154_if_add(local, "wpan%d", NULL, NL802154_IFTYPE_NODE);
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
rtnl_unlock(); rtnl_unlock();
rc = PTR_ERR(dev); rc = PTR_ERR(dev);
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
#include <net/mac802154.h> #include <net/mac802154.h>
#include <net/ieee802154_netdev.h> #include <net/ieee802154_netdev.h>
#include <net/rtnetlink.h> #include <net/nl802154.h>
#include <linux/nl802154.h>
#include "ieee802154_i.h" #include "ieee802154_i.h"
...@@ -209,7 +208,7 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local, ...@@ -209,7 +208,7 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local,
} }
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->vif.type != IEEE802154_DEV_WPAN || if (sdata->vif.type != NL802154_IFTYPE_NODE ||
!netif_running(sdata->dev)) !netif_running(sdata->dev))
continue; continue;
...@@ -234,7 +233,7 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb) ...@@ -234,7 +233,7 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
skb->protocol = htons(ETH_P_IEEE802154); skb->protocol = htons(ETH_P_IEEE802154);
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->vif.type != IEEE802154_DEV_MONITOR) if (sdata->vif.type != NL802154_IFTYPE_MONITOR)
continue; continue;
if (!ieee802154_sdata_running(sdata)) if (!ieee802154_sdata_running(sdata))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册