Commit 90c049b2 authored by alex.bluesman.smirnov@gmail.com's avatar alex.bluesman.smirnov@gmail.com Committed by David S. Miller

ieee802154: interface type to be added

This stack implementation distinguishes several types of slave
interfaces. Another parameter to 'add_iface_' function is added
to clarify the interface type is going to be registered.
Signed-off-by: default avatarAlexander Smirnov <alex.bluesman.smirnov@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef2486f5
...@@ -68,6 +68,7 @@ enum { ...@@ -68,6 +68,7 @@ enum {
IEEE802154_ATTR_CHANNEL_PAGE_LIST, IEEE802154_ATTR_CHANNEL_PAGE_LIST,
IEEE802154_ATTR_PHY_NAME, IEEE802154_ATTR_PHY_NAME,
IEEE802154_ATTR_DEV_TYPE,
__IEEE802154_ATTR_MAX, __IEEE802154_ATTR_MAX,
}; };
...@@ -126,4 +127,9 @@ enum { ...@@ -126,4 +127,9 @@ enum {
#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) #define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1)
enum {
__IEEE802154_DEV_INVALID = -1,
__IEEE802154_DEV_MAX,
};
#endif #endif
...@@ -43,7 +43,7 @@ struct wpan_phy { ...@@ -43,7 +43,7 @@ struct wpan_phy {
int idx; int idx;
struct net_device *(*add_iface)(struct wpan_phy *phy, struct net_device *(*add_iface)(struct wpan_phy *phy,
const char *name); const char *name, int type);
void (*del_iface)(struct wpan_phy *phy, struct net_device *dev); void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
char priv[0] __attribute__((__aligned__(NETDEV_ALIGN))); char priv[0] __attribute__((__aligned__(NETDEV_ALIGN)));
......
...@@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb, ...@@ -179,6 +179,7 @@ static int ieee802154_add_iface(struct sk_buff *skb,
const char *devname; const char *devname;
int rc = -ENOBUFS; int rc = -ENOBUFS;
struct net_device *dev; struct net_device *dev;
int type = __IEEE802154_DEV_INVALID;
pr_debug("%s\n", __func__); pr_debug("%s\n", __func__);
...@@ -221,7 +222,13 @@ static int ieee802154_add_iface(struct sk_buff *skb, ...@@ -221,7 +222,13 @@ static int ieee802154_add_iface(struct sk_buff *skb,
goto nla_put_failure; goto nla_put_failure;
} }
dev = phy->add_iface(phy, devname); if (info->attrs[IEEE802154_ATTR_DEV_TYPE]) {
type = nla_get_u8(info->attrs[IEEE802154_ATTR_DEV_TYPE]);
if (type >= __IEEE802154_DEV_MAX)
return -EINVAL;
}
dev = phy->add_iface(phy, devname, type);
if (IS_ERR(dev)) { if (IS_ERR(dev)) {
rc = PTR_ERR(dev); rc = PTR_ERR(dev);
goto nla_put_failure; goto nla_put_failure;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment