ieee802154: UAPI changes
Subsystems (2)
Alexander Aring
maintainercover ieee802154: UAPI changes
Hi,
this patch series contains various UAPI changes. It's a RFC for now, to be sure nobody will scream when I send real patches for this.
In my opnion patch "ieee802154: 6lowpan: fix ARPHRD to ARPHRD_6LOWPAN" is the is the most important part of this series. I know this issue a long time and some already used application really checks on this, but we need to change that.
Patch "ieee802154: change wpan-phy name to phy" will change that you will not type "wpan-phy0" anymore on iwpan phy settings. After this patch it's "phy0" only. This makes the handling similar like iw.
Patch "ieee802154: remove deprecated sysfs entries" will breaks some scripts if somebody really use these sysfs entries.
So I would like her others opinions according to these changes.
- Alex
Alexander Aring (4):
ieee802154: set wpan netdev devtype
ieee802154: 6lowpan: fix ARPHRD to ARPHRD_6LOWPAN
ieee802154: change wpan-phy name to phy
ieee802154: remove deprecated sysfs entries
net/ieee802154/6lowpan/core.c | 2 +- net/ieee802154/core.c | 13 ++++++++++-- net/ieee802154/sysfs.c | 49 ------------------------------------------- 3 files changed, 12 insertions(+), 52 deletions(-)
Signature · 1 line
2.2.2
Alexander Aring
maintainerRFC 1/4 ieee802154: set wpan netdev devtype
This patch adds the setting for the netdev devtype. Like wireless which sets this value to "wlan", this patch will set this value to "wpan".
--- net/ieee802154/core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/ieee802154/core.c +7 -1
@@ -199,6 +199,10 @@ void cfg802154_dev_free(struct cfg802154_registered_device *rdev)kfree (rdev); } +static const struct device_type wpan_phy_type = { + .name ="wpan" , +}; +static void cfg802154_update_iface_num (struct cfg802154_registered_device *rdev,int iftype,int num)
@@ -223,7 +227,9 @@ static int cfg802154_netdev_notifier_call(struct notifier_block *nb,/* TODO WARN_ON unspec type */ switch (state) { -/* TODO NETDEV_DEVTYPE */ +case NETDEV_POST_INIT : +SET_NETDEV_DEVTYPE (dev, &wpan_phy_type); +break ;case NETDEV_REGISTER : wpan_dev->identifier = ++rdev->wpan_dev_id;list_add_rcu (&wpan_dev->list, &rdev->wpan_dev_list);
Signature · 1 line
2.2.2
Alexander Aring
maintainerRFC 2/4 ieee802154: 6lowpan: fix ARPHRD to ARPHRD_6LOWPAN
In reply to Alexander AringCurrently there exists two interface types with ARPHRD_IEEE802154. These are the 802.15.4 interfaces and 802.15.4 6LoWPAN interfaces. This is more a bug because some userspace applications checks on this value like wireshark. This occurs that wireshark will always try to parse a lowpan interface as 802.15.4 frames. With ARPHRD_6LOWPAN wireshark will parse it as IPv6 frames which is correct.
Much applications checks on this value to readout the EUI64 mac address which should be the same for ARPHRD_6LOWPAN. BTLE 6LoWPAN and ieee802154 6LoWPAN will share now the same ARPHRD.
--- net/ieee802154/6lowpan/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ieee802154/6lowpan/core.c +1 -1
@@ -113,7 +113,7 @@ static void lowpan_setup(struct net_device *dev) { dev->addr_len =IEEE802154_ADDR_LEN ;memset (dev->broadcast,0xff ,IEEE802154_ADDR_LEN ); - dev->type =ARPHRD_IEEE802154 ; + dev->type =ARPHRD_6LOWPAN ;/* Frame Control + Sequence Number + Address fields + Security Header */ dev->hard_header_len =2 +1 +20 +14 ; dev->needed_tailroom =2 ;/* FCS */
Signature · 1 line
2.2.2
Alexander Aring
maintainerRe: [RFC bluetooth-next 2/4] ieee802154: 6lowpan: fix ARPHRD to ARPHRD_6LOWPAN
Hi,
Quoted 32 lines · Alexander Aring
Currently there exists two interface types with
ARPHRD_IEEE802154. These are the 802.15.4 interfaces and 802.15.4 6LoWPAN interfaces. This is more a bug because some userspace applications checks on this value like wireshark. This occurs that wireshark will always try to parse a lowpan interface as 802.15.4 frames. WithARPHRD_6LOWPANwireshark will parse it as IPv6 frames which is correct.Much applications checks on this value to readout the EUI64 mac address which should be the same for
ARPHRD_6LOWPAN. BTLE 6LoWPAN and ieee802154 6LoWPAN will share now the same ARPHRD.Signed-off-by Alexander Aring <[email protected]>--- net/ieee802154/6lowpan/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ieee802154/6lowpan/core.c +1
-1@@ -113,7 +113,7 @@ static void lowpan_setup(struct net_device *dev) { dev->addr_len =IEEE802154_ADDR_LEN ;memset (dev->broadcast,0xff ,IEEE802154_ADDR_LEN ); - dev->type =ARPHRD_IEEE802154 ; + dev->type =ARPHRD_6LOWPAN ;/* Frame Control + Sequence Number + Address fields + Security Header */ dev->hard_header_len =2 +1 +20 +14 ; dev->needed_tailroom =2 ;/* FCS */ Signature · 1 line
2.2.2
A little list of applications which need to update afterwards this patch:
- radvd [0]
- unstrung [1]
I know this will break the above software, but we need really to do this step. Any complaints here according to this patch?
- Alex
[0] https://github.com/reubenhwk/radvd/blob/master/device-linux.c#L82
[1] https://github.com/mcr/unstrung/blob/5e7c4060730ab4f81ddcd75657d87ec78da91bd6/lib/libndmgmt/netlink.cpp#L358
Alexander Aring
maintainerRFC 3/4 ieee802154: change wpan-phy name to phy
In reply to Alexander AringCurrently the wpan_phy under /sys/class/ieee802154/ is named as "wpan-phy#", this patch will change the name to phy. This will introduce the same naming convention like wireless.
Note: wpan-tools users will not type "wpan-phy#" anymore, just a simple
"phy#" is enough.
--- net/ieee802154/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ieee802154/core.c +4 -1
@@ -25,6 +25,9 @@#include "sysfs.h" #include "core.h" +/* name for sysfs, %d is appended */ +#define PHY_NAME "phy" +/* RCU-protected (and RTNL for writers) */ LIST_HEAD (cfg802154_rdev_list);int cfg802154_rdev_list_generation;
@@ -122,7 +125,7 @@ wpan_phy_new(const struct cfg802154_ops *ops, size_t priv_size)INIT_LIST_HEAD (&rdev->wpan_dev_list);device_initialize (&rdev->wpan_phy.dev); -dev_set_name (&rdev->wpan_phy.dev,"wpan-phy%d" , rdev->wpan_phy_idx); +dev_set_name (&rdev->wpan_phy.dev,PHY_NAME "%d" , rdev->wpan_phy_idx); rdev->wpan_phy.dev.class = &wpan_phy_class; rdev->wpan_phy.dev.platform_data = rdev;
Signature · 1 line
2.2.2
Alexander Aring
maintainerRFC 4/4 ieee802154: remove deprecated sysfs entries
In reply to Alexander AringIt's only necessary to offer the name and index, others value are available over netlink.
--- net/ieee802154/sysfs.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-)
net/ieee802154/sysfs.c +0 -49
@@ -48,49 +48,6 @@ static ssize_t name_show(struct device *dev, }static DEVICE_ATTR_RO (name); -#define MASTER_SHOW_COMPLEX(name, format_string, args...) \ -static ssize_t name ## _show(struct device *dev, \ - struct device_attribute *attr, char *buf) \ -{ \ - struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); \ - int ret; \ - \ - mutex_lock(&phy->pib_lock); \ - ret = snprintf(buf, PAGE_SIZE, format_string "\n", args); \ - mutex_unlock(&phy->pib_lock); \ - return ret; \ -} \ -static DEVICE_ATTR_RO(name) - -#define MASTER_SHOW (field, format_string) \ - MASTER_SHOW_COMPLEX(field, format_string, phy->field) - -MASTER_SHOW (current_channel,"%d" ); -MASTER_SHOW (current_page,"%d" ); -MASTER_SHOW (transmit_power,"%d +- 1 dB" ); -MASTER_SHOW_COMPLEX (cca_mode,"%d" , phy->cca.mode); - -static ssize_t channels_supported_show (struct device *dev, -struct device_attribute *attr, -char *buf) -{ - struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev); -int ret; -int i, len =0 ; - -mutex_lock (&phy->pib_lock); -for (i =0 ; i <32 ; i++) { - ret =snprintf (buf + len,PAGE_SIZE - len, -"%#09x\n" , phy->channels_supported[i]); -if (ret <0 ) -break ; - len += ret; - } -mutex_unlock (&phy->pib_lock); -return len; -} -static DEVICE_ATTR_RO (channels_supported); -static void wpan_phy_release (struct device *dev) {struct cfg802154_registered_device *rdev =dev_to_rdev (dev);
@@ -101,12 +58,6 @@ static void wpan_phy_release(struct device *dev)static struct attribute *pmib_attrs[] = { &dev_attr_index.attr, &dev_attr_name.attr, -/* below will be removed soon */ - &dev_attr_current_channel.attr, - &dev_attr_current_page.attr, - &dev_attr_channels_supported.attr, - &dev_attr_transmit_power.attr, - &dev_attr_cca_mode.attr,NULL , };ATTRIBUTE_GROUPS (pmib);
Signature · 1 line
2.2.2