Skip to contentSkip to conversation

nl802154: move PAD to right position

PATCH RESEND In review Alexander Aring 2 participants 6 messages Jun 18, 2016 – Jun 27, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/3 nl802154: move PAD to right position

The PAD define should be above the experimental support. We don't care about if we break userspace in experimental stuff but PAD is part of the existing UAPI.

---
 include/net/nl802154.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/net/nl802154.h +2 -2
index fcab4de..7aad2fd 100644
@@ -124,6 +124,8 @@ enum nl802154_attrs {
 
 	NL802154_ATTR_ACKREQ_DEFAULT,
 
+	NL802154_ATTR_PAD,
+
 	/* add attributes here, update the policy in nl802154.c */
 
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
@@ -138,8 +140,6 @@ enum nl802154_attrs {
 	NL802154_ATTR_SEC_KEY,
 #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
 
-	NL802154_ATTR_PAD,
-
 	__NL802154_ATTR_AFTER_LAST,
 	NL802154_ATTR_MAX = __NL802154_ATTR_AFTER_LAST - 1
 };
Signature · 1 line
2.8.3
#1 lore raw

PATCH RESEND 2/3 ieee802154: add netns support

This patch adds netns support for 802.15.4 subsystem. Most parts are copy&pasted from wireless subsystem, it has the identically userspace API.

---
 include/net/cfg802154.h   | 13 +++++++++
 include/net/nl802154.h    |  5 ++++
 net/ieee802154/core.c     | 70 ++++++++++++++++++++++++++++++++++++++++++++++-
 net/ieee802154/core.h     |  2 ++
 net/ieee802154/nl802154.c | 54 ++++++++++++++++++++++++++++++++----
 5 files changed, 138 insertions(+), 6 deletions(-)
include/net/cfg802154.h +13 -0
index 171cd76..795ca40 100644
@@ -219,9 +219,22 @@ struct wpan_phy {
 
 	struct device dev;
 
+	/* the network namespace this phy lives in currently */
+	possible_net_t _net;
+
 	char priv[0] __aligned(NETDEV_ALIGN);
 };
 
+static inline struct net *wpan_phy_net(struct wpan_phy *wpan_phy)
+{
+	return read_pnet(&wpan_phy->_net);
+}
+
+static inline void wpan_phy_net_set(struct wpan_phy *wpan_phy, struct net *net)
+{
+	write_pnet(&wpan_phy->_net, net);
+}
+
 struct ieee802154_addr {
 	u8 mode;
 	__le16 pan_id;
include/net/nl802154.h +5 -0
index 7aad2fd..ddcee12 100644
@@ -54,6 +54,8 @@ enum nl802154_commands {
 
 	NL802154_CMD_SET_ACKREQ_DEFAULT,
 
+	NL802154_CMD_SET_WPAN_PHY_NETNS,
+
 	/* add new commands above here */
 
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
@@ -126,6 +128,9 @@ enum nl802154_attrs {
 
 	NL802154_ATTR_PAD,
 
+	NL802154_ATTR_PID,
+	NL802154_ATTR_NETNS_FD,
+
 	/* add attributes here, update the policy in nl802154.c */
 
 #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
net/ieee802154/core.c +69 -1

107 lines not on this page · raw message

net/ieee802154/core.h +2 -0
index 231fade..81141f5 100644
@@ -38,6 +38,8 @@ wpan_phy_to_rdev(struct wpan_phy *wpan_phy)
 extern struct list_head cfg802154_rdev_list;
 extern int cfg802154_rdev_list_generation;
 
+int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
+			   struct net *net);
 /* free object */
 void cfg802154_dev_free(struct cfg802154_registered_device *rdev);
 struct cfg802154_registered_device *
net/ieee802154/nl802154.c +49 -5

102 lines not on this page · raw message

Signature · 1 line
2.8.3
#2 lore raw

Re: [PATCH RESEND bluetooth-next 2/3] ieee802154: add netns support

Hi Alex,

Quoted 7 lines

This patch adds netns support for 802.15.4 subsystem. Most parts are copy&pasted from wireless subsystem, it has the identically userspace API.

Quoted 7 lines

---

include/net/cfg802154.h   | 13 +++++++++
include/net/nl802154.h    |  5 ++++
net/ieee802154/core.c     | 70 ++++++++++++++++++++++++++++++++++++++++++++++-
net/ieee802154/core.h     |  2 ++
net/ieee802154/nl802154.c | 54 ++++++++++++++++++++++++++++++++----
5 files changed, 138 insertions(+), 6 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#3 lore raw

PATCH RESEND 3/3 ieee802154: allow netns create of lowpan interface

In reply to Alexander Aring

This patch reverts commit f9d1ce8f81eb ("ieee802154: fix netns settings"). The lowpan interface need to be created inside the net namespace where the wpan interface is available. The wpan namespace can be changed only by nl802154 before. Without this patch it's not possible to create a lowpan interface for a wpan interface which isn't inside init_net namespace.

---
 net/ieee802154/6lowpan/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/ieee802154/6lowpan/core.c +1 -2
index 8c004a0..ee74df6 100644
@@ -130,8 +130,7 @@ static int lowpan_newlink(struct net *src_net, struct net_device *ldev,
 
 	pr_debug("adding new link\n");
 
-	if (!tb[IFLA_LINK] ||
-	    !net_eq(dev_net(ldev), &init_net))
+	if (!tb[IFLA_LINK])
 		return -EINVAL;
 	/* find and hold wpan device */
 	wdev = dev_get_by_index(dev_net(ldev), nla_get_u32(tb[IFLA_LINK]));
Signature · 1 line
2.8.3
#4 lore raw

Re: [PATCH RESEND bluetooth-next 3/3] ieee802154: allow netns create of lowpan interface

Hi Alex,

Quoted 7 lines

This patch reverts commit f9d1ce8f81eb ("ieee802154: fix netns settings"). The lowpan interface need to be created inside the net namespace where the wpan interface is available. The wpan namespace can be changed only by nl802154 before. Without this patch it's not possible to create a lowpan interface for a wpan interface which isn't inside init_net namespace.

Quoted 6 lines

---
net/ieee802154/6lowpan/core.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

#5 lore raw
In reply to Alexander Aring

Hi Alex,

Quoted 11 lines

The PAD define should be above the experimental support. We don't care about if we break userspace in experimental stuff but PAD is part of the existing UAPI.

---
include/net/nl802154.h | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel