* [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup
@ 2014-10-28 17:21 Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
` (17 more replies)
0 siblings, 18 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch series contains cleanups for iface handling driver-ops and
sysfs handling. Also removing dead code of current behaviour of local->running
and use it as local->started behaviour like mac8011.
Alexander Aring (17):
mac802154: monitor: merge into iface implementation
mac802154: main: move open and close into iface
mac802154: declare struct ieee802154_ops as const
mac802154: ops: declare channel and page as u8
mac802154: introduce driver-ops header
mac802154: use driver-ops function wrappers
mac802154: remove might_sleep from driver layer
mac802154: remove driver ops in wpan-phy
mac802154: rework sdata state change to running
mac802154: rename running to started
mac802154: move local started handling
mac802154: add synchronization handling
mac802154: iface: remove assign to zero
mac802154: remove channel attributes from sdata
mac802154: move mac_params functions into mac_cmd
mac802154: cleanup open count handling
ieee802154: introduce sysfs file
drivers/net/ieee802154/at86rf230.c | 13 +--
drivers/net/ieee802154/cc2520.c | 5 +-
drivers/net/ieee802154/fakelb.c | 8 +-
drivers/net/ieee802154/mrf24j40.c | 5 +-
include/net/cfg802154.h | 8 --
include/net/mac802154.h | 7 +-
net/ieee802154/Makefile | 2 +-
net/ieee802154/core.c | 73 +------------
net/ieee802154/nl-mac.c | 19 +---
net/ieee802154/sysfs.c | 94 ++++++++++++++++
net/ieee802154/sysfs.h | 9 ++
net/mac802154/Makefile | 2 +-
net/mac802154/driver-ops.h | 213 +++++++++++++++++++++++++++++++++++++
net/mac802154/ieee802154_i.h | 34 +++---
net/mac802154/iface.c | 119 +++++++++++++++++----
net/mac802154/mac_cmd.c | 22 ++++
net/mac802154/main.c | 166 +----------------------------
net/mac802154/mib.c | 56 ++--------
net/mac802154/monitor.c | 59 ----------
net/mac802154/tx.c | 5 +-
20 files changed, 488 insertions(+), 431 deletions(-)
create mode 100644 net/ieee802154/sysfs.c
create mode 100644 net/ieee802154/sysfs.h
create mode 100644 net/mac802154/driver-ops.h
delete mode 100644 net/mac802154/monitor.c
--
2.1.2
^ permalink raw reply [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-29 3:39 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 02/17] mac802154: main: move open and close into iface Alexander Aring
` (16 subsequent siblings)
17 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch removes the monitor implementation file and put all monitor
stuff into iface file. It's now small enough to put all necessary
handling into iface.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/Makefile | 2 +-
net/mac802154/iface.c | 30 +++++++++++++++++++++++++
net/mac802154/monitor.c | 59 -------------------------------------------------
3 files changed, 31 insertions(+), 60 deletions(-)
delete mode 100644 net/mac802154/monitor.c
diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile
index e68deba..2e497d0 100644
--- a/net/mac802154/Makefile
+++ b/net/mac802154/Makefile
@@ -1,5 +1,5 @@
obj-$(CONFIG_MAC802154) += mac802154.o
mac802154-objs := main.o rx.o tx.o mac_cmd.o mib.o \
- monitor.o iface.o llsec.o util.o
+ iface.o llsec.o util.o
ccflags-y += -D__CHECK_ENDIAN__
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 7e4bffc..dafb2c3 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -320,6 +320,12 @@ static const struct net_device_ops mac802154_wpan_ops = {
.ndo_set_mac_address = mac802154_wpan_mac_addr,
};
+static const struct net_device_ops mac802154_monitor_ops = {
+ .ndo_open = mac802154_slave_open,
+ .ndo_stop = mac802154_slave_close,
+ .ndo_start_xmit = ieee802154_monitor_start_xmit,
+};
+
static void mac802154_wpan_free(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
@@ -373,3 +379,27 @@ void mac802154_wpan_setup(struct net_device *dev)
mac802154_llsec_init(&sdata->sec);
}
+
+void mac802154_monitor_setup(struct net_device *dev)
+{
+ struct ieee802154_sub_if_data *sdata;
+
+ dev->addr_len = 0;
+ dev->hard_header_len = 0;
+ dev->needed_tailroom = 2; /* room for FCS */
+ dev->mtu = IEEE802154_MTU;
+ dev->tx_queue_len = 10;
+ dev->type = ARPHRD_IEEE802154_MONITOR;
+ dev->flags = IFF_NOARP | IFF_BROADCAST;
+ dev->watchdog_timeo = 0;
+
+ dev->destructor = free_netdev;
+ dev->netdev_ops = &mac802154_monitor_ops;
+ dev->ml_priv = &mac802154_mlme_reduced;
+
+ sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+ sdata->type = IEEE802154_DEV_MONITOR;
+
+ sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
+ sdata->page = 0;
+}
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
deleted file mode 100644
index dfdedc2..0000000
--- a/net/mac802154/monitor.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2007, 2008, 2009 Siemens AG
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Written by:
- * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
- * Sergey Lapin <slapin@ossfans.org>
- * Maxim Gorbachyov <maxim.gorbachev@siemens.com>
- * Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
- */
-
-#include <linux/netdevice.h>
-#include <linux/if_arp.h>
-#include <linux/ieee802154.h>
-
-#include <net/mac802154.h>
-#include <net/netlink.h>
-#include <net/cfg802154.h>
-#include <linux/nl802154.h>
-
-#include "ieee802154_i.h"
-
-static const struct net_device_ops mac802154_monitor_ops = {
- .ndo_open = mac802154_slave_open,
- .ndo_stop = mac802154_slave_close,
- .ndo_start_xmit = ieee802154_monitor_start_xmit,
-};
-
-void mac802154_monitor_setup(struct net_device *dev)
-{
- struct ieee802154_sub_if_data *sdata;
-
- dev->addr_len = 0;
- dev->hard_header_len = 0;
- dev->needed_tailroom = 2; /* room for FCS */
- dev->mtu = IEEE802154_MTU;
- dev->tx_queue_len = 10;
- dev->type = ARPHRD_IEEE802154_MONITOR;
- dev->flags = IFF_NOARP | IFF_BROADCAST;
- dev->watchdog_timeo = 0;
-
- dev->destructor = free_netdev;
- dev->netdev_ops = &mac802154_monitor_ops;
- dev->ml_priv = &mac802154_mlme_reduced;
-
- sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- sdata->type = IEEE802154_DEV_MONITOR;
-
- sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
- sdata->page = 0;
-}
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 02/17] mac802154: main: move open and close into iface
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const Alexander Aring
` (15 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
These functions can be static inside the iface file, because it's not
used anywhere else. This patch moves these functions into iface file.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 3 ---
net/mac802154/iface.c | 59 ++++++++++++++++++++++++++++++++++++++++++++
net/mac802154/main.c | 59 --------------------------------------------
3 files changed, 59 insertions(+), 62 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index ac907d9..4408c46 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -123,9 +123,6 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
-int mac802154_slave_open(struct net_device *dev);
-int mac802154_slave_close(struct net_device *dev);
-
void mac802154_monitor_setup(struct net_device *dev);
netdev_tx_t
ieee802154_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index dafb2c3..0b21413 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -142,6 +142,46 @@ void mac802154_get_mac_params(struct net_device *dev,
mutex_unlock(&sdata->local->iflist_mtx);
}
+static int mac802154_slave_open(struct net_device *dev)
+{
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+ struct ieee802154_sub_if_data *subif;
+ struct ieee802154_local *local = sdata->local;
+ int res = 0;
+
+ ASSERT_RTNL();
+
+ if (sdata->type == IEEE802154_DEV_WPAN) {
+ mutex_lock(&sdata->local->iflist_mtx);
+ list_for_each_entry(subif, &sdata->local->interfaces, list) {
+ if (subif != sdata && subif->type == sdata->type &&
+ subif->running) {
+ mutex_unlock(&sdata->local->iflist_mtx);
+ return -EBUSY;
+ }
+ }
+ mutex_unlock(&sdata->local->iflist_mtx);
+ }
+
+ mutex_lock(&sdata->local->iflist_mtx);
+ sdata->running = true;
+ mutex_unlock(&sdata->local->iflist_mtx);
+
+ if (local->open_count++ == 0) {
+ res = local->ops->start(&local->hw);
+ WARN_ON(res);
+ if (res)
+ goto err;
+ }
+
+ netif_start_queue(dev);
+ return 0;
+err:
+ sdata->local->open_count--;
+
+ return res;
+}
+
static int mac802154_wpan_open(struct net_device *dev)
{
int rc;
@@ -201,6 +241,25 @@ out:
return rc;
}
+static int mac802154_slave_close(struct net_device *dev)
+{
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+ struct ieee802154_local *local = sdata->local;
+
+ ASSERT_RTNL();
+
+ netif_stop_queue(dev);
+
+ mutex_lock(&sdata->local->iflist_mtx);
+ sdata->running = false;
+ mutex_unlock(&sdata->local->iflist_mtx);
+
+ if (!--local->open_count)
+ local->ops->stop(&local->hw);
+
+ return 0;
+}
+
static int mac802154_set_header_security(struct ieee802154_sub_if_data *sdata,
struct ieee802154_hdr *hdr,
const struct ieee802154_mac_cb *cb)
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index ff0de0f..2c6d772 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -29,65 +29,6 @@
#include "ieee802154_i.h"
-int mac802154_slave_open(struct net_device *dev)
-{
- struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- struct ieee802154_sub_if_data *subif;
- struct ieee802154_local *local = sdata->local;
- int res = 0;
-
- ASSERT_RTNL();
-
- if (sdata->type == IEEE802154_DEV_WPAN) {
- mutex_lock(&sdata->local->iflist_mtx);
- list_for_each_entry(subif, &sdata->local->interfaces, list) {
- if (subif != sdata && subif->type == sdata->type &&
- subif->running) {
- mutex_unlock(&sdata->local->iflist_mtx);
- return -EBUSY;
- }
- }
- mutex_unlock(&sdata->local->iflist_mtx);
- }
-
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = true;
- mutex_unlock(&sdata->local->iflist_mtx);
-
- if (local->open_count++ == 0) {
- res = local->ops->start(&local->hw);
- WARN_ON(res);
- if (res)
- goto err;
- }
-
- netif_start_queue(dev);
- return 0;
-err:
- sdata->local->open_count--;
-
- return res;
-}
-
-int mac802154_slave_close(struct net_device *dev)
-{
- struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- struct ieee802154_local *local = sdata->local;
-
- ASSERT_RTNL();
-
- netif_stop_queue(dev);
-
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = false;
- mutex_unlock(&sdata->local->iflist_mtx);
-
- if (!--local->open_count)
- local->ops->stop(&local->hw);
-
- return 0;
-}
-
static int
mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
{
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 02/17] mac802154: main: move open and close into iface Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-29 3:31 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8 Alexander Aring
` (14 subsequent siblings)
17 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring, Alan Ott
The ieee802154_ops structure should be never changed during runtime.
This patch declare this structure as const to avoid a runtime change.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
---
drivers/net/ieee802154/at86rf230.c | 2 +-
drivers/net/ieee802154/cc2520.c | 2 +-
drivers/net/ieee802154/fakelb.c | 2 +-
drivers/net/ieee802154/mrf24j40.c | 2 +-
include/net/mac802154.h | 2 +-
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/main.c | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index a155838..662efd3 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1214,7 +1214,7 @@ at86rf230_set_frame_retries(struct ieee802154_hw *hw, s8 retries)
return rc;
}
-static struct ieee802154_ops at86rf230_ops = {
+static const struct ieee802154_ops at86rf230_ops = {
.owner = THIS_MODULE,
.xmit_async = at86rf230_xmit,
.ed = at86rf230_ed,
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index a31b5b6..b479c9d 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -631,7 +631,7 @@ cc2520_filter(struct ieee802154_hw *hw,
return 0;
}
-static struct ieee802154_ops cc2520_ops = {
+static const struct ieee802154_ops cc2520_ops = {
.owner = THIS_MODULE,
.start = cc2520_start,
.stop = cc2520_stop,
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index db0703f..2a97cbb 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -129,7 +129,7 @@ fakelb_hw_stop(struct ieee802154_hw *hw) {
spin_unlock(&priv->lock);
}
-static struct ieee802154_ops fakelb_ops = {
+static const struct ieee802154_ops fakelb_ops = {
.owner = THIS_MODULE,
.xmit_sync = fakelb_hw_xmit,
.ed = fakelb_hw_ed,
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 7abb237..f19cf58 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -579,7 +579,7 @@ out:
return ret;
}
-static struct ieee802154_ops mrf24j40_ops = {
+static const struct ieee802154_ops mrf24j40_ops = {
.owner = THIS_MODULE,
.xmit_sync = mrf24j40_tx,
.ed = mrf24j40_ed,
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 4c4642e..0ea44cd 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -197,7 +197,7 @@ struct ieee802154_ops {
/* Basic interface to register ieee802154 hwice */
struct ieee802154_hw *
-ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops);
+ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops);
void ieee802154_free_hw(struct ieee802154_hw *hw);
int ieee802154_register_hw(struct ieee802154_hw *hw);
void ieee802154_unregister_hw(struct ieee802154_hw *hw);
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 4408c46..a379b97 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -28,7 +28,7 @@
/* mac802154 device private data */
struct ieee802154_local {
struct ieee802154_hw hw;
- struct ieee802154_ops *ops;
+ const struct ieee802154_ops *ops;
/* ieee802154 phy */
struct wpan_phy *phy;
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 2c6d772..632707b 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -187,7 +187,7 @@ static void ieee802154_tasklet_handler(unsigned long data)
}
struct ieee802154_hw *
-ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)
+ieee802154_alloc_hw(size_t priv_data_len, const struct ieee802154_ops *ops)
{
struct wpan_phy *phy;
struct ieee802154_local *local;
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (2 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-29 3:32 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 05/17] mac802154: introduce driver-ops header Alexander Aring
` (13 subsequent siblings)
17 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring, Alan Ott
The range of channel and page fits into an unsigned byte range. This
patch changes the set_channel parameter definitions for channel and
page to u8.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Cc: Alan Ott <alan@signal11.us>
---
drivers/net/ieee802154/at86rf230.c | 8 ++++----
drivers/net/ieee802154/cc2520.c | 2 +-
drivers/net/ieee802154/fakelb.c | 2 +-
drivers/net/ieee802154/mrf24j40.c | 3 +--
include/net/mac802154.h | 5 ++---
5 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 662efd3..5068c1b 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -54,7 +54,7 @@ struct at86rf2xx_chip_data {
u16 t_tx_timeout;
int rssi_base_val;
- int (*set_channel)(struct at86rf230_local *, int, int);
+ int (*set_channel)(struct at86rf230_local *, u8, u8);
int (*get_desense_steps)(struct at86rf230_local *, s32);
};
@@ -1012,13 +1012,13 @@ at86rf230_stop(struct ieee802154_hw *hw)
}
static int
-at86rf23x_set_channel(struct at86rf230_local *lp, int page, int channel)
+at86rf23x_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
{
return at86rf230_write_subreg(lp, SR_CHANNEL, channel);
}
static int
-at86rf212_set_channel(struct at86rf230_local *lp, int page, int channel)
+at86rf212_set_channel(struct at86rf230_local *lp, u8 page, u8 channel)
{
int rc;
@@ -1043,7 +1043,7 @@ at86rf212_set_channel(struct at86rf230_local *lp, int page, int channel)
}
static int
-at86rf230_channel(struct ieee802154_hw *hw, int page, int channel)
+at86rf230_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
struct at86rf230_local *lp = hw->priv;
int rc;
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index b479c9d..78ea2ca 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -569,7 +569,7 @@ cc2520_ed(struct ieee802154_hw *hw, u8 *level)
}
static int
-cc2520_set_channel(struct ieee802154_hw *hw, int page, int channel)
+cc2520_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
struct cc2520_private *priv = hw->priv;
int ret;
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index 2a97cbb..4092e70 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -55,7 +55,7 @@ fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
}
static int
-fakelb_hw_channel(struct ieee802154_hw *hw, int page, int channel)
+fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
pr_debug("set channel to %d\n", channel);
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index f19cf58..52b3d31 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -423,8 +423,7 @@ static void mrf24j40_stop(struct ieee802154_hw *hw)
write_short_reg(devrec, REG_INTCON, val);
}
-static int mrf24j40_set_channel(struct ieee802154_hw *hw,
- int page, int channel)
+static int mrf24j40_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
struct mrf24j40 *devrec = hw->priv;
u8 val;
diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index 0ea44cd..85a4efc 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -178,9 +178,8 @@ struct ieee802154_ops {
int (*xmit_async)(struct ieee802154_hw *hw,
struct sk_buff *skb);
int (*ed)(struct ieee802154_hw *hw, u8 *level);
- int (*set_channel)(struct ieee802154_hw *hw,
- int page,
- int channel);
+ int (*set_channel)(struct ieee802154_hw *hw, u8 page,
+ u8 channel);
int (*set_hw_addr_filt)(struct ieee802154_hw *hw,
struct ieee802154_hw_addr_filt *filt,
unsigned long changed);
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 05/17] mac802154: introduce driver-ops header
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (3 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8 Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 06/17] mac802154: use driver-ops function wrappers Alexander Aring
` (12 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch introduce a driver-ops header file with function wrappers to
call the driver ops. These wrappers checking on right context
information and warn if optional driver ops are called when these aren't
implemented. This behaviour is like mac80211 driver-ops header file,
just without function tracing calls.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/driver-ops.h | 202 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 202 insertions(+)
create mode 100644 net/mac802154/driver-ops.h
diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h
new file mode 100644
index 0000000..bf7980b
--- /dev/null
+++ b/net/mac802154/driver-ops.h
@@ -0,0 +1,202 @@
+#ifndef __MAC802154_DRVIER_OPS
+#define __MAC802154_DRIVER_OPS
+
+#include <linux/types.h>
+#include <linux/rtnetlink.h>
+
+#include <net/mac802154.h>
+
+#include "ieee802154_i.h"
+
+static inline int
+drv_xmit_async(struct ieee802154_local *local, struct sk_buff *skb)
+{
+ return local->ops->xmit_async(&local->hw, skb);
+}
+
+static inline int
+drv_xmit_sync(struct ieee802154_local *local, struct sk_buff *skb)
+{
+ /* don't allow other operations while sync xmit */
+ ASSERT_RTNL();
+
+ might_sleep();
+
+ return local->ops->xmit_sync(&local->hw, skb);
+}
+
+static inline int drv_start(struct ieee802154_local *local)
+{
+ might_sleep();
+
+ return local->ops->start(&local->hw);
+}
+
+static inline void drv_stop(struct ieee802154_local *local)
+{
+ might_sleep();
+
+ local->ops->stop(&local->hw);
+}
+
+static inline int drv_set_channel(struct ieee802154_local *local,
+ const u8 page, const u8 channel)
+{
+ might_sleep();
+
+ return local->ops->set_channel(&local->hw, page, channel);
+}
+
+static inline int drv_set_tx_power(struct ieee802154_local *local,
+ const s8 dbm)
+{
+ might_sleep();
+
+ if (!local->ops->set_txpower) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_txpower(&local->hw, dbm);
+}
+
+static inline int drv_set_cca_mode(struct ieee802154_local *local,
+ const u8 cca_mode)
+{
+ might_sleep();
+
+ if (!local->ops->set_cca_mode) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_cca_mode(&local->hw, cca_mode);
+}
+
+static inline int drv_set_lbt_mode(struct ieee802154_local *local,
+ const bool mode)
+{
+ might_sleep();
+
+ if (!local->ops->set_lbt) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_lbt(&local->hw, mode);
+}
+
+static inline int drv_set_cca_ed_level(struct ieee802154_local *local,
+ const s32 ed_level)
+{
+ might_sleep();
+
+ if (!local->ops->set_cca_ed_level) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_cca_ed_level(&local->hw, ed_level);
+}
+
+static inline int drv_set_pan_id(struct ieee802154_local *local,
+ const __le16 pan_id)
+{
+ struct ieee802154_hw_addr_filt filt;
+
+ might_sleep();
+
+ if (!local->ops->set_hw_addr_filt) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ filt.pan_id = pan_id;
+
+ return local->ops->set_hw_addr_filt(&local->hw, &filt,
+ IEEE802154_AFILT_PANID_CHANGED);
+}
+
+static inline int drv_set_extended_addr(struct ieee802154_local *local,
+ const __le64 extended_addr)
+{
+ struct ieee802154_hw_addr_filt filt;
+
+ might_sleep();
+
+ if (!local->ops->set_hw_addr_filt) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ filt.ieee_addr = extended_addr;
+
+ return local->ops->set_hw_addr_filt(&local->hw, &filt,
+ IEEE802154_AFILT_IEEEADDR_CHANGED);
+}
+
+static inline int drv_set_short_addr(struct ieee802154_local *local,
+ const __le16 short_addr)
+{
+ struct ieee802154_hw_addr_filt filt;
+
+ might_sleep();
+
+ if (!local->ops->set_hw_addr_filt) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ filt.short_addr = short_addr;
+
+ return local->ops->set_hw_addr_filt(&local->hw, &filt,
+ IEEE802154_AFILT_SADDR_CHANGED);
+}
+
+static inline int drv_set_pan_coord(struct ieee802154_local *local,
+ const bool is_coord)
+{
+ struct ieee802154_hw_addr_filt filt;
+
+ might_sleep();
+
+ if (!local->ops->set_hw_addr_filt) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ filt.pan_coord = is_coord;
+
+ return local->ops->set_hw_addr_filt(&local->hw, &filt,
+ IEEE802154_AFILT_PANC_CHANGED);
+}
+
+static inline int drv_set_csma_params(struct ieee802154_local *local,
+ u8 min_be, u8 max_be,
+ u8 max_csma_backoffs)
+{
+ might_sleep();
+
+ if (!local->ops->set_csma_params) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_csma_params(&local->hw, min_be, max_be,
+ max_csma_backoffs);
+}
+
+static inline int drv_set_max_frame_retries(struct ieee802154_local *local,
+ s8 max_frame_retries)
+{
+ might_sleep();
+
+ if (!local->ops->set_frame_retries) {
+ WARN_ON(1);
+ return -EOPNOTSUPP;
+ }
+
+ return local->ops->set_frame_retries(&local->hw, max_frame_retries);
+}
+
+#endif /* __MAC802154_DRVIER_OPS */
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 06/17] mac802154: use driver-ops function wrappers
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (4 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 05/17] mac802154: introduce driver-ops header Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer Alexander Aring
` (11 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch replaces all directly called driver ops by previous
introduced driver-ops function wrappers.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/iface.c | 25 ++++++++++++++-----------
net/mac802154/main.c | 13 +++++++------
net/mac802154/mib.c | 3 ++-
net/mac802154/tx.c | 5 +++--
4 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 0b21413..025cd5a 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -30,6 +30,7 @@
#include <net/cfg802154.h>
#include "ieee802154_i.h"
+#include "driver-ops.h"
static int mac802154_wpan_update_llsec(struct net_device *dev)
{
@@ -168,7 +169,7 @@ static int mac802154_slave_open(struct net_device *dev)
mutex_unlock(&sdata->local->iflist_mtx);
if (local->open_count++ == 0) {
- res = local->ops->start(&local->hw);
+ res = drv_start(local);
WARN_ON(res);
if (res)
goto err;
@@ -186,6 +187,7 @@ static int mac802154_wpan_open(struct net_device *dev)
{
int rc;
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+ struct ieee802154_local *local = sdata->local;
struct wpan_phy *phy = sdata->local->phy;
rc = mac802154_slave_open(dev);
@@ -195,40 +197,41 @@ static int mac802154_wpan_open(struct net_device *dev)
mutex_lock(&phy->pib_lock);
if (phy->set_txpower) {
- rc = phy->set_txpower(phy, sdata->mac_params.transmit_power);
+ rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
if (rc < 0)
goto out;
}
if (phy->set_lbt) {
- rc = phy->set_lbt(phy, sdata->mac_params.lbt);
+ rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
if (rc < 0)
goto out;
}
if (phy->set_cca_mode) {
- rc = phy->set_cca_mode(phy, sdata->mac_params.cca_mode);
+ rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
if (rc < 0)
goto out;
}
if (phy->set_cca_ed_level) {
- rc = phy->set_cca_ed_level(phy, sdata->mac_params.cca_ed_level);
+ rc = drv_set_cca_ed_level(local,
+ sdata->mac_params.cca_ed_level);
if (rc < 0)
goto out;
}
if (phy->set_csma_params) {
- rc = phy->set_csma_params(phy, sdata->mac_params.min_be,
- sdata->mac_params.max_be,
- sdata->mac_params.csma_retries);
+ rc = drv_set_csma_params(local, sdata->mac_params.min_be,
+ sdata->mac_params.max_be,
+ sdata->mac_params.csma_retries);
if (rc < 0)
goto out;
}
if (phy->set_frame_retries) {
- rc = phy->set_frame_retries(phy,
- sdata->mac_params.frame_retries);
+ rc = drv_set_max_frame_retries(local,
+ sdata->mac_params.frame_retries);
if (rc < 0)
goto out;
}
@@ -255,7 +258,7 @@ static int mac802154_slave_close(struct net_device *dev)
mutex_unlock(&sdata->local->iflist_mtx);
if (!--local->open_count)
- local->ops->stop(&local->hw);
+ drv_stop(local);
return 0;
}
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 632707b..24ecc09 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -28,6 +28,7 @@
#include <net/cfg802154.h>
#include "ieee802154_i.h"
+#include "driver-ops.h"
static int
mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
@@ -124,28 +125,28 @@ static int mac802154_set_txpower(struct wpan_phy *phy, int db)
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_txpower(&local->hw, db);
+ return drv_set_tx_power(local, db);
}
static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_lbt(&local->hw, on);
+ return drv_set_lbt_mode(local, on);
}
static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_cca_mode(&local->hw, mode);
+ return drv_set_cca_mode(local, mode);
}
static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_cca_ed_level(&local->hw, level);
+ return drv_set_cca_ed_level(local, level);
}
static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
@@ -153,14 +154,14 @@ static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_csma_params(&local->hw, min_be, max_be, retries);
+ return drv_set_csma_params(local, min_be, max_be, retries);
}
static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
{
struct ieee802154_local *local = wpan_phy_priv(phy);
- return local->ops->set_frame_retries(&local->hw, retries);
+ return drv_set_max_frame_retries(local, retries);
}
static void ieee802154_tasklet_handler(unsigned long data)
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 16baff1..3fbc217 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -24,6 +24,7 @@
#include <net/cfg802154.h>
#include "ieee802154_i.h"
+#include "driver-ops.h"
struct phy_chan_notify_work {
struct work_struct work;
@@ -170,7 +171,7 @@ static void phy_chan_notify(struct work_struct *work)
int res;
mutex_lock(&sdata->local->phy->pib_lock);
- res = local->ops->set_channel(&local->hw, sdata->page, sdata->chan);
+ res = drv_set_channel(local, sdata->page, sdata->chan);
if (res) {
pr_debug("set_channel failed\n");
} else {
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index e857673..77973a8 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -28,6 +28,7 @@
#include <net/cfg802154.h>
#include "ieee802154_i.h"
+#include "driver-ops.h"
/* IEEE 802.15.4 transceivers can sleep during the xmit session, so process
* packets through the workqueue.
@@ -55,7 +56,7 @@ static void ieee802154_xmit_worker(struct work_struct *work)
if (!netif_running(dev))
goto err_tx;
- res = local->ops->xmit_sync(&local->hw, skb);
+ res = drv_xmit_sync(local, skb);
if (res)
goto err_tx;
@@ -96,7 +97,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
/* async is priority, otherwise sync is fallback */
if (local->ops->xmit_async) {
- ret = local->ops->xmit_async(&local->hw, skb);
+ ret = drv_xmit_async(local, skb);
if (ret) {
ieee802154_wake_queue(&local->hw);
goto err_tx;
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (5 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 06/17] mac802154: use driver-ops function wrappers Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-29 3:33 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 08/17] mac802154: remove driver ops in wpan-phy Alexander Aring
` (10 subsequent siblings)
17 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch removes all might_sleep calls from driver layer. This
handling is already done by mac802154 layer.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
drivers/net/ieee802154/at86rf230.c | 3 ---
drivers/net/ieee802154/cc2520.c | 1 -
drivers/net/ieee802154/fakelb.c | 4 ----
3 files changed, 8 deletions(-)
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 5068c1b..b83ad0b 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -993,7 +993,6 @@ at86rf230_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
static int
at86rf230_ed(struct ieee802154_hw *hw, u8 *level)
{
- might_sleep();
BUG_ON(!level);
*level = 0xbe;
return 0;
@@ -1048,8 +1047,6 @@ at86rf230_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
struct at86rf230_local *lp = hw->priv;
int rc;
- might_sleep();
-
if (page < 0 || page > 31 ||
!(lp->hw->phy->channels_supported[page] & BIT(channel))) {
WARN_ON(1);
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index 78ea2ca..c56d10c 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -574,7 +574,6 @@ cc2520_set_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
struct cc2520_private *priv = hw->priv;
int ret;
- might_sleep();
dev_dbg(&priv->spi->dev, "trying to set channel\n");
BUG_ON(page != 0);
diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c
index 4092e70..6e62286 100644
--- a/drivers/net/ieee802154/fakelb.c
+++ b/drivers/net/ieee802154/fakelb.c
@@ -47,7 +47,6 @@ struct fakelb_priv {
static int
fakelb_hw_ed(struct ieee802154_hw *hw, u8 *level)
{
- might_sleep();
BUG_ON(!level);
*level = 0xbe;
@@ -59,7 +58,6 @@ fakelb_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
{
pr_debug("set channel to %d\n", channel);
- might_sleep();
hw->phy->current_page = page;
hw->phy->current_channel = channel;
@@ -85,8 +83,6 @@ fakelb_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
struct fakelb_dev_priv *priv = hw->priv;
struct fakelb_priv *fake = priv->fake;
- might_sleep();
-
read_lock_bh(&fake->lock);
if (priv->list.next == priv->list.prev) {
/* we are the only one device */
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 08/17] mac802154: remove driver ops in wpan-phy
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (6 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 09/17] mac802154: rework sdata state change to running Alexander Aring
` (9 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch removes the driver ops callbacks inside of wpan_phy struct.
It was used to check if a phy supports this driver ops call. We do this
now via hardware flags.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
include/net/cfg802154.h | 8 -----
net/ieee802154/nl-mac.c | 19 ++---------
net/mac802154/iface.c | 12 +++----
net/mac802154/main.c | 85 -------------------------------------------------
4 files changed, 8 insertions(+), 116 deletions(-)
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
index 5c67467..440b9be 100644
--- a/include/net/cfg802154.h
+++ b/include/net/cfg802154.h
@@ -57,14 +57,6 @@ struct wpan_phy {
const char *name, int type);
void (*del_iface)(struct wpan_phy *phy, struct net_device *dev);
- int (*set_txpower)(struct wpan_phy *phy, int db);
- int (*set_lbt)(struct wpan_phy *phy, bool on);
- int (*set_cca_mode)(struct wpan_phy *phy, u8 cca_mode);
- int (*set_cca_ed_level)(struct wpan_phy *phy, int level);
- int (*set_csma_params)(struct wpan_phy *phy, u8 min_be, u8 max_be,
- u8 retries);
- int (*set_frame_retries)(struct wpan_phy *phy, s8 retries);
-
char priv[0] __aligned(NETDEV_ALIGN);
};
diff --git a/net/ieee802154/nl-mac.c b/net/ieee802154/nl-mac.c
index fb6866d..abd0f31 100644
--- a/net/ieee802154/nl-mac.c
+++ b/net/ieee802154/nl-mac.c
@@ -664,20 +664,6 @@ int ieee802154_set_macparams(struct sk_buff *skb, struct genl_info *info)
phy = ops->get_phy(dev);
- if ((!phy->set_lbt && info->attrs[IEEE802154_ATTR_LBT_ENABLED]) ||
- (!phy->set_cca_mode && info->attrs[IEEE802154_ATTR_CCA_MODE]) ||
- (!phy->set_cca_ed_level &&
- info->attrs[IEEE802154_ATTR_CCA_ED_LEVEL]) ||
- (!phy->set_csma_params &&
- (info->attrs[IEEE802154_ATTR_CSMA_RETRIES] ||
- info->attrs[IEEE802154_ATTR_CSMA_MIN_BE] ||
- info->attrs[IEEE802154_ATTR_CSMA_MAX_BE])) ||
- (!phy->set_frame_retries &&
- info->attrs[IEEE802154_ATTR_FRAME_RETRIES])) {
- rc = -EOPNOTSUPP;
- goto out_phy;
- }
-
ops->get_mac_params(dev, ¶ms);
if (info->attrs[IEEE802154_ATTR_TXPOWER])
@@ -708,10 +694,9 @@ int ieee802154_set_macparams(struct sk_buff *skb, struct genl_info *info)
wpan_phy_put(phy);
dev_put(dev);
- return rc;
-out_phy:
- wpan_phy_put(phy);
+ return 0;
+
out:
dev_put(dev);
return rc;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 025cd5a..300877a 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -196,32 +196,32 @@ static int mac802154_wpan_open(struct net_device *dev)
mutex_lock(&phy->pib_lock);
- if (phy->set_txpower) {
+ if (local->hw.flags & IEEE802154_HW_TXPOWER) {
rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
if (rc < 0)
goto out;
}
- if (phy->set_lbt) {
+ if (local->hw.flags & IEEE802154_HW_LBT) {
rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
if (rc < 0)
goto out;
}
- if (phy->set_cca_mode) {
+ if (local->hw.flags & IEEE802154_HW_CCA_MODE) {
rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
if (rc < 0)
goto out;
}
- if (phy->set_cca_ed_level) {
+ if (local->hw.flags & IEEE802154_HW_CCA_ED_LEVEL) {
rc = drv_set_cca_ed_level(local,
sdata->mac_params.cca_ed_level);
if (rc < 0)
goto out;
}
- if (phy->set_csma_params) {
+ if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) {
rc = drv_set_csma_params(local, sdata->mac_params.min_be,
sdata->mac_params.max_be,
sdata->mac_params.csma_retries);
@@ -229,7 +229,7 @@ static int mac802154_wpan_open(struct net_device *dev)
goto out;
}
- if (phy->set_frame_retries) {
+ if (local->hw.flags & IEEE802154_HW_FRAME_RETRIES) {
rc = drv_set_max_frame_retries(local,
sdata->mac_params.frame_retries);
if (rc < 0)
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 24ecc09..9fa9514 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -121,49 +121,6 @@ err:
return ERR_PTR(err);
}
-static int mac802154_set_txpower(struct wpan_phy *phy, int db)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_tx_power(local, db);
-}
-
-static int mac802154_set_lbt(struct wpan_phy *phy, bool on)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_lbt_mode(local, on);
-}
-
-static int mac802154_set_cca_mode(struct wpan_phy *phy, u8 mode)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_cca_mode(local, mode);
-}
-
-static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_cca_ed_level(local, level);
-}
-
-static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be,
- u8 max_be, u8 retries)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_csma_params(local, min_be, max_be, retries);
-}
-
-static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)
-{
- struct ieee802154_local *local = wpan_phy_priv(phy);
-
- return drv_set_max_frame_retries(local, retries);
-}
-
static void ieee802154_tasklet_handler(unsigned long data)
{
struct ieee802154_local *local = (struct ieee802154_local *)data;
@@ -262,48 +219,6 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
struct ieee802154_local *local = hw_to_local(hw);
int rc = -ENOSYS;
- if (hw->flags & IEEE802154_HW_TXPOWER) {
- if (!local->ops->set_txpower)
- goto out;
-
- local->phy->set_txpower = mac802154_set_txpower;
- }
-
- if (hw->flags & IEEE802154_HW_LBT) {
- if (!local->ops->set_lbt)
- goto out;
-
- local->phy->set_lbt = mac802154_set_lbt;
- }
-
- if (hw->flags & IEEE802154_HW_CCA_MODE) {
- if (!local->ops->set_cca_mode)
- goto out;
-
- local->phy->set_cca_mode = mac802154_set_cca_mode;
- }
-
- if (hw->flags & IEEE802154_HW_CCA_ED_LEVEL) {
- if (!local->ops->set_cca_ed_level)
- goto out;
-
- local->phy->set_cca_ed_level = mac802154_set_cca_ed_level;
- }
-
- if (hw->flags & IEEE802154_HW_CSMA_PARAMS) {
- if (!local->ops->set_csma_params)
- goto out;
-
- local->phy->set_csma_params = mac802154_set_csma_params;
- }
-
- if (hw->flags & IEEE802154_HW_FRAME_RETRIES) {
- if (!local->ops->set_frame_retries)
- goto out;
-
- local->phy->set_frame_retries = mac802154_set_frame_retries;
- }
-
local->workqueue =
create_singlethread_workqueue(wpan_phy_name(local->phy));
if (!local->workqueue) {
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 09/17] mac802154: rework sdata state change to running
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (7 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 08/17] mac802154: remove driver ops in wpan-phy Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 10/17] mac802154: rename running to started Alexander Aring
` (8 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch reworks the handling for setting the state like mac80211. We
use bit's instead a bool variable. The mutex is not needed because it use
test and set bits which are atomic operations.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 12 +++++++++++-
net/mac802154/iface.c | 12 +++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index a379b97..e34fe51 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -67,6 +67,10 @@ enum {
IEEE802154_RX_MSG = 1,
};
+enum ieee802154_sdata_state_bits {
+ SDATA_STATE_RUNNING,
+};
+
/* Slave interface definition.
*
* Slaves represent typical network interfaces available from userspace.
@@ -80,7 +84,7 @@ struct ieee802154_sub_if_data {
struct net_device *dev;
int type;
- bool running;
+ unsigned long state;
spinlock_t mib_lock;
@@ -120,6 +124,12 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev)
return netdev_priv(dev);
}
+static inline bool
+ieee802154_sdata_running(struct ieee802154_sub_if_data *sdata)
+{
+ return test_bit(SDATA_STATE_RUNNING, &sdata->state);
+}
+
extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;
extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 300877a..e10fd78 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -156,7 +156,7 @@ static int mac802154_slave_open(struct net_device *dev)
mutex_lock(&sdata->local->iflist_mtx);
list_for_each_entry(subif, &sdata->local->interfaces, list) {
if (subif != sdata && subif->type == sdata->type &&
- subif->running) {
+ ieee802154_sdata_running(subif)) {
mutex_unlock(&sdata->local->iflist_mtx);
return -EBUSY;
}
@@ -164,9 +164,7 @@ static int mac802154_slave_open(struct net_device *dev)
mutex_unlock(&sdata->local->iflist_mtx);
}
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = true;
- mutex_unlock(&sdata->local->iflist_mtx);
+ set_bit(SDATA_STATE_RUNNING, &sdata->state);
if (local->open_count++ == 0) {
res = drv_start(local);
@@ -178,6 +176,8 @@ static int mac802154_slave_open(struct net_device *dev)
netif_start_queue(dev);
return 0;
err:
+ /* might already be clear but that doesn't matter */
+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);
sdata->local->open_count--;
return res;
@@ -253,9 +253,7 @@ static int mac802154_slave_close(struct net_device *dev)
netif_stop_queue(dev);
- mutex_lock(&sdata->local->iflist_mtx);
- sdata->running = false;
- mutex_unlock(&sdata->local->iflist_mtx);
+ clear_bit(SDATA_STATE_RUNNING, &sdata->state);
if (!--local->open_count)
drv_stop(local);
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 10/17] mac802154: rename running to started
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (8 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 09/17] mac802154: rework sdata state change to running Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 11/17] mac802154: move local started handling Alexander Aring
` (7 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This variable should be handled like ieee80211_local struct of mac80211.
We rename this variable to started now to have the same name convention.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 2 +-
net/mac802154/main.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index e34fe51..f52afd4 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -54,7 +54,7 @@ struct ieee802154_local {
* This flag should be modified under slaves_mtx and RTNL, so you can
* read them using any of protection methods.
*/
- bool running;
+ bool started;
struct tasklet_struct tasklet;
struct sk_buff_head skb_queue;
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 9fa9514..7458f71 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -47,7 +47,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
SET_NETDEV_DEV(dev, &local->phy->dev);
mutex_lock(&local->iflist_mtx);
- if (!local->running) {
+ if (!local->started) {
mutex_unlock(&local->iflist_mtx);
return -ENODEV;
}
@@ -238,7 +238,7 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
rtnl_lock();
mutex_lock(&local->iflist_mtx);
- local->running = MAC802154_DEVICE_RUN;
+ local->started = MAC802154_DEVICE_RUN;
mutex_unlock(&local->iflist_mtx);
rtnl_unlock();
@@ -264,7 +264,7 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
rtnl_lock();
mutex_lock(&local->iflist_mtx);
- local->running = MAC802154_DEVICE_STOPPED;
+ local->started = MAC802154_DEVICE_STOPPED;
mutex_unlock(&local->iflist_mtx);
list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 11/17] mac802154: move local started handling
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (9 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 10/17] mac802154: rename running to started Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 12/17] mac802154: add synchronization handling Alexander Aring
` (6 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch removes the current handling of started boolean. This is
actually dead code, because mac802154_netdev_register can't never be
called before ieee802154_register_hw. This means that local->started is
always be true when mac802154_netdev_register is called. Instead we
using this now like mac80211 to indicate that an instance of sdata is
running.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/driver-ops.h | 4 ++++
net/mac802154/ieee802154_i.h | 7 -------
net/mac802154/main.c | 19 -------------------
3 files changed, 4 insertions(+), 26 deletions(-)
diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h
index bf7980b..bb3ee03 100644
--- a/net/mac802154/driver-ops.h
+++ b/net/mac802154/driver-ops.h
@@ -29,6 +29,8 @@ static inline int drv_start(struct ieee802154_local *local)
{
might_sleep();
+ local->started = true;
+
return local->ops->start(&local->hw);
}
@@ -37,6 +39,8 @@ static inline void drv_stop(struct ieee802154_local *local)
might_sleep();
local->ops->stop(&local->hw);
+
+ local->started = false;
}
static inline int drv_set_channel(struct ieee802154_local *local,
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index f52afd4..bf0b5f6 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -50,19 +50,12 @@ struct ieee802154_local {
*/
struct workqueue_struct *workqueue;
- /* SoftMAC device is registered and running. One can add subinterfaces.
- * This flag should be modified under slaves_mtx and RTNL, so you can
- * read them using any of protection methods.
- */
bool started;
struct tasklet_struct tasklet;
struct sk_buff_head skb_queue;
};
-#define MAC802154_DEVICE_STOPPED 0x00
-#define MAC802154_DEVICE_RUN 0x01
-
enum {
IEEE802154_RX_MSG = 1,
};
diff --git a/net/mac802154/main.c b/net/mac802154/main.c
index 7458f71..21dcc56 100644
--- a/net/mac802154/main.c
+++ b/net/mac802154/main.c
@@ -46,13 +46,6 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)
SET_NETDEV_DEV(dev, &local->phy->dev);
- mutex_lock(&local->iflist_mtx);
- if (!local->started) {
- mutex_unlock(&local->iflist_mtx);
- return -ENODEV;
- }
- mutex_unlock(&local->iflist_mtx);
-
err = register_netdev(dev);
if (err < 0)
return err;
@@ -235,14 +228,6 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
if (rc < 0)
goto out_wq;
- rtnl_lock();
-
- mutex_lock(&local->iflist_mtx);
- local->started = MAC802154_DEVICE_RUN;
- mutex_unlock(&local->iflist_mtx);
-
- rtnl_unlock();
-
return 0;
out_wq:
@@ -263,10 +248,6 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)
rtnl_lock();
- mutex_lock(&local->iflist_mtx);
- local->started = MAC802154_DEVICE_STOPPED;
- mutex_unlock(&local->iflist_mtx);
-
list_for_each_entry_safe(sdata, next, &local->interfaces, list) {
mutex_lock(&sdata->local->iflist_mtx);
list_del(&sdata->list);
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 12/17] mac802154: add synchronization handling
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (10 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 11/17] mac802154: move local started handling Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 13/17] mac802154: iface: remove assign to zero Alexander Aring
` (5 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch adds synchronization handling in start and stop driver ops
calls. This patch is mostly grab from mac80211 which was introduced by
commit ea77f12f2cc0f31168f2e0259e65a22202ac4dc2 ("mac80211: remove
tasklet enable/disable"). This is to be sure that we don't run into same
issues.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/driver-ops.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/mac802154/driver-ops.h b/net/mac802154/driver-ops.h
index bb3ee03..4b820cf 100644
--- a/net/mac802154/driver-ops.h
+++ b/net/mac802154/driver-ops.h
@@ -30,6 +30,7 @@ static inline int drv_start(struct ieee802154_local *local)
might_sleep();
local->started = true;
+ smp_mb();
return local->ops->start(&local->hw);
}
@@ -40,6 +41,12 @@ static inline void drv_stop(struct ieee802154_local *local)
local->ops->stop(&local->hw);
+ /* sync away all work on the tasklet before clearing started */
+ tasklet_disable(&local->tasklet);
+ tasklet_enable(&local->tasklet);
+
+ barrier();
+
local->started = false;
}
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 13/17] mac802154: iface: remove assign to zero
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (11 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 12/17] mac802154: add synchronization handling Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata Alexander Aring
` (4 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
These variables should already be zero, so we remove the extra assign to
zero.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/iface.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index e10fd78..2423aa7 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -409,7 +409,6 @@ void mac802154_wpan_setup(struct net_device *dev)
dev->tx_queue_len = 300;
dev->type = ARPHRD_IEEE802154;
dev->flags = IFF_NOARP | IFF_BROADCAST;
- dev->watchdog_timeo = 0;
dev->destructor = mac802154_wpan_free;
dev->netdev_ops = &mac802154_wpan_ops;
@@ -419,7 +418,6 @@ void mac802154_wpan_setup(struct net_device *dev)
sdata->type = IEEE802154_DEV_WPAN;
sdata->chan = MAC802154_CHAN_NONE;
- sdata->page = 0;
spin_lock_init(&sdata->mib_lock);
mutex_init(&sdata->sec_mtx);
@@ -444,14 +442,11 @@ void mac802154_monitor_setup(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata;
- dev->addr_len = 0;
- dev->hard_header_len = 0;
dev->needed_tailroom = 2; /* room for FCS */
dev->mtu = IEEE802154_MTU;
dev->tx_queue_len = 10;
dev->type = ARPHRD_IEEE802154_MONITOR;
dev->flags = IFF_NOARP | IFF_BROADCAST;
- dev->watchdog_timeo = 0;
dev->destructor = free_netdev;
dev->netdev_ops = &mac802154_monitor_ops;
@@ -461,5 +456,4 @@ void mac802154_monitor_setup(struct net_device *dev)
sdata->type = IEEE802154_DEV_MONITOR;
sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
- sdata->page = 0;
}
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (12 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 13/17] mac802154: iface: remove assign to zero Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-29 3:52 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 15/17] mac802154: move mac_params functions into mac_cmd Alexander Aring
` (3 subsequent siblings)
17 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
These channel attributes was part of "channel context switch while xmit"
which was removed by commit dc67c6b30f36d57b70b70547a30e7a8432540c6f
("mac802154: tx: remove xmit channel context switch"). This patch
removes these unnecessary variables and use the current_page and
current_channel by wpan_phy struct now.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 3 ---
net/mac802154/iface.c | 4 ----
net/mac802154/mib.c | 55 ++++++++------------------------------------
3 files changed, 9 insertions(+), 53 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index bf0b5f6..46c9fe7 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -85,9 +85,6 @@ struct ieee802154_sub_if_data {
__le16 short_addr;
__le64 extended_addr;
- u8 chan;
- u8 page;
-
struct ieee802154_mac_params mac_params;
/* MAC BSN field */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 2423aa7..1c0274e 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -417,8 +417,6 @@ void mac802154_wpan_setup(struct net_device *dev)
sdata = IEEE802154_DEV_TO_SUB_IF(dev);
sdata->type = IEEE802154_DEV_WPAN;
- sdata->chan = MAC802154_CHAN_NONE;
-
spin_lock_init(&sdata->mib_lock);
mutex_init(&sdata->sec_mtx);
@@ -454,6 +452,4 @@ void mac802154_monitor_setup(struct net_device *dev)
sdata = IEEE802154_DEV_TO_SUB_IF(dev);
sdata->type = IEEE802154_DEV_MONITOR;
-
- sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
}
diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
index 3fbc217..0184fce 100644
--- a/net/mac802154/mib.c
+++ b/net/mac802154/mib.c
@@ -26,11 +26,6 @@
#include "ieee802154_i.h"
#include "driver-ops.h"
-struct phy_chan_notify_work {
- struct work_struct work;
- struct net_device *dev;
-};
-
struct hw_addr_filt_notify_work {
struct work_struct work;
struct net_device *dev;
@@ -161,54 +156,22 @@ u8 mac802154_dev_get_dsn(const struct net_device *dev)
return sdata->dsn++;
}
-static void phy_chan_notify(struct work_struct *work)
-{
- struct phy_chan_notify_work *nw = container_of(work,
- struct phy_chan_notify_work, work);
- struct net_device *dev = nw->dev;
- struct ieee802154_local *local = mac802154_slave_get_priv(dev);
- struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- int res;
-
- mutex_lock(&sdata->local->phy->pib_lock);
- res = drv_set_channel(local, sdata->page, sdata->chan);
- if (res) {
- pr_debug("set_channel failed\n");
- } else {
- sdata->local->phy->current_channel = sdata->chan;
- sdata->local->phy->current_page = sdata->page;
- }
- mutex_unlock(&sdata->local->phy->pib_lock);
-
- kfree(nw);
-}
-
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
{
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- struct phy_chan_notify_work *work;
+ struct ieee802154_local *local = sdata->local;
+ int res;
BUG_ON(dev->type != ARPHRD_IEEE802154);
- spin_lock_bh(&sdata->mib_lock);
- sdata->page = page;
- sdata->chan = chan;
- spin_unlock_bh(&sdata->mib_lock);
-
- mutex_lock(&sdata->local->phy->pib_lock);
- if (sdata->local->phy->current_channel != sdata->chan ||
- sdata->local->phy->current_page != sdata->page) {
- mutex_unlock(&sdata->local->phy->pib_lock);
-
- work = kzalloc(sizeof(*work), GFP_ATOMIC);
- if (!work)
- return;
-
- INIT_WORK(&work->work, phy_chan_notify);
- work->dev = dev;
- queue_work(sdata->local->workqueue, &work->work);
+ res = drv_set_channel(local, page, chan);
+ if (res) {
+ pr_debug("set_channel failed\n");
} else {
- mutex_unlock(&sdata->local->phy->pib_lock);
+ mutex_lock(&local->phy->pib_lock);
+ local->phy->current_channel = chan;
+ local->phy->current_page = page;
+ mutex_unlock(&local->phy->pib_lock);
}
}
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 15/17] mac802154: move mac_params functions into mac_cmd
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (13 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 16/17] mac802154: cleanup open count handling Alexander Aring
` (2 subsequent siblings)
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
These functions can be static in mac_cmd file.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/ieee802154_i.h | 5 -----
net/mac802154/mac_cmd.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 46c9fe7..7cebc98 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -140,11 +140,6 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val);
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan);
u8 mac802154_dev_get_dsn(const struct net_device *dev);
-int mac802154_set_mac_params(struct net_device *dev,
- const struct ieee802154_mac_params *params);
-void mac802154_get_mac_params(struct net_device *dev,
- struct ieee802154_mac_params *params);
-
int mac802154_get_params(struct net_device *dev,
struct ieee802154_llsec_params *params);
int mac802154_set_params(struct net_device *dev,
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index ed767f5..fc261ab 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -82,6 +82,28 @@ static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)
return to_phy(get_device(&sdata->local->phy->dev));
}
+static int mac802154_set_mac_params(struct net_device *dev,
+ const struct ieee802154_mac_params *params)
+{
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+
+ mutex_lock(&sdata->local->iflist_mtx);
+ sdata->mac_params = *params;
+ mutex_unlock(&sdata->local->iflist_mtx);
+
+ return 0;
+}
+
+static void mac802154_get_mac_params(struct net_device *dev,
+ struct ieee802154_mac_params *params)
+{
+ struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+
+ mutex_lock(&sdata->local->iflist_mtx);
+ *params = sdata->mac_params;
+ mutex_unlock(&sdata->local->iflist_mtx);
+}
+
static struct ieee802154_llsec_ops mac802154_llsec_ops = {
.get_params = mac802154_get_params,
.set_params = mac802154_set_params,
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 16/17] mac802154: cleanup open count handling
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (14 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 15/17] mac802154: move mac_params functions into mac_cmd Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 17/17] ieee802154: introduce sysfs file Alexander Aring
2014-10-28 22:24 ` [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Marcel Holtmann
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch cleanups the open_count variable increment in open and close
calls of netdev.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/mac802154/iface.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 1c0274e..c0bf5f9 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -166,19 +166,19 @@ static int mac802154_slave_open(struct net_device *dev)
set_bit(SDATA_STATE_RUNNING, &sdata->state);
- if (local->open_count++ == 0) {
+ if (!local->open_count) {
res = drv_start(local);
WARN_ON(res);
if (res)
goto err;
}
+ local->open_count++;
netif_start_queue(dev);
return 0;
err:
/* might already be clear but that doesn't matter */
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
- sdata->local->open_count--;
return res;
}
@@ -252,10 +252,11 @@ static int mac802154_slave_close(struct net_device *dev)
ASSERT_RTNL();
netif_stop_queue(dev);
+ local->open_count--;
clear_bit(SDATA_STATE_RUNNING, &sdata->state);
- if (!--local->open_count)
+ if (!local->open_count)
drv_stop(local);
return 0;
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* [PATCH bluetooth-next 17/17] ieee802154: introduce sysfs file
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (15 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 16/17] mac802154: cleanup open count handling Alexander Aring
@ 2014-10-28 17:21 ` Alexander Aring
2014-10-28 22:24 ` [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Marcel Holtmann
17 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-28 17:21 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch moves the sysfs handling in a own file. This is like wireless
sysfs file handling.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/ieee802154/Makefile | 2 +-
net/ieee802154/core.c | 73 +++-----------------------------------
net/ieee802154/sysfs.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++
net/ieee802154/sysfs.h | 9 +++++
4 files changed, 108 insertions(+), 70 deletions(-)
create mode 100644 net/ieee802154/sysfs.c
create mode 100644 net/ieee802154/sysfs.h
diff --git a/net/ieee802154/Makefile b/net/ieee802154/Makefile
index e58c4cb..38354d4 100644
--- a/net/ieee802154/Makefile
+++ b/net/ieee802154/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_IEEE802154_6LOWPAN) += ieee802154_6lowpan.o
ieee802154_6lowpan-y := 6lowpan_rtnl.o reassembly.o
ieee802154-y := netlink.o nl-mac.o nl-phy.o nl_policy.o core.o \
- header_ops.o
+ header_ops.o sysfs.o
af_802154-y := af_ieee802154.o raw.o dgram.o
ccflags-y += -D__CHECK_ENDIAN__
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index 760b7d7..620abc2 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -20,72 +20,7 @@
#include <net/cfg802154.h>
#include "ieee802154.h"
-
-#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(cca_mode, "%d");
-
-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 struct attribute *pmib_attrs[] = {
- &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);
-
-static void wpan_phy_release(struct device *d)
-{
- struct wpan_phy *phy = container_of(d, struct wpan_phy, dev);
-
- kfree(phy);
-}
-
-static struct class wpan_phy_class = {
- .name = "ieee802154",
- .dev_release = wpan_phy_release,
- .dev_groups = pmib_groups,
-};
+#include "sysfs.h"
static DEFINE_MUTEX(wpan_phy_mutex);
static int wpan_phy_idx;
@@ -197,7 +132,7 @@ static int __init wpan_phy_class_init(void)
{
int rc;
- rc = class_register(&wpan_phy_class);
+ rc = wpan_phy_sysfs_init();
if (rc)
goto err;
@@ -207,7 +142,7 @@ static int __init wpan_phy_class_init(void)
return 0;
err_nl:
- class_unregister(&wpan_phy_class);
+ wpan_phy_sysfs_exit();
err:
return rc;
}
@@ -216,7 +151,7 @@ subsys_initcall(wpan_phy_class_init);
static void __exit wpan_phy_class_exit(void)
{
ieee802154_nl_exit();
- class_unregister(&wpan_phy_class);
+ wpan_phy_sysfs_exit();
}
module_exit(wpan_phy_class_exit);
diff --git a/net/ieee802154/sysfs.c b/net/ieee802154/sysfs.c
new file mode 100644
index 0000000..eb9ca6f9
--- /dev/null
+++ b/net/ieee802154/sysfs.c
@@ -0,0 +1,94 @@
+/* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Authors:
+ * Alexander Aring <aar@pengutronix.de>
+ *
+ * Based on: net/wireless/sysfs.c
+ */
+
+#include <linux/device.h>
+
+#include <net/cfg802154.h>
+
+#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(cca_mode, "%d");
+
+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 *d)
+{
+ struct wpan_phy *phy = container_of(d, struct wpan_phy, dev);
+
+ kfree(phy);
+}
+
+static struct attribute *pmib_attrs[] = {
+ &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);
+
+struct class wpan_phy_class = {
+ .name = "ieee802154",
+ .dev_release = wpan_phy_release,
+ .dev_groups = pmib_groups,
+};
+
+int wpan_phy_sysfs_init(void)
+{
+ return class_register(&wpan_phy_class);
+}
+
+void wpan_phy_sysfs_exit(void)
+{
+ class_unregister(&wpan_phy_class);
+}
diff --git a/net/ieee802154/sysfs.h b/net/ieee802154/sysfs.h
new file mode 100644
index 0000000..aa42e39
--- /dev/null
+++ b/net/ieee802154/sysfs.h
@@ -0,0 +1,9 @@
+#ifndef __IEEE802154_SYSFS_H
+#define __IEEE802154_SYSFS_H
+
+int wpan_phy_sysfs_init(void);
+void wpan_phy_sysfs_exit(void);
+
+extern struct class wpan_phy_class;
+
+#endif /* __IEEE802154_SYSFS_H */
--
2.1.2
^ permalink raw reply related [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
` (16 preceding siblings ...)
2014-10-28 17:21 ` [PATCH bluetooth-next 17/17] ieee802154: introduce sysfs file Alexander Aring
@ 2014-10-28 22:24 ` Marcel Holtmann
17 siblings, 0 replies; 35+ messages in thread
From: Marcel Holtmann @ 2014-10-28 22:24 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
Hi Alex,
> This patch series contains cleanups for iface handling driver-ops and
> sysfs handling. Also removing dead code of current behaviour of local->running
> and use it as local->started behaviour like mac8011.
>
> Alexander Aring (17):
> mac802154: monitor: merge into iface implementation
> mac802154: main: move open and close into iface
> mac802154: declare struct ieee802154_ops as const
> mac802154: ops: declare channel and page as u8
> mac802154: introduce driver-ops header
> mac802154: use driver-ops function wrappers
> mac802154: remove might_sleep from driver layer
> mac802154: remove driver ops in wpan-phy
> mac802154: rework sdata state change to running
> mac802154: rename running to started
> mac802154: move local started handling
> mac802154: add synchronization handling
> mac802154: iface: remove assign to zero
> mac802154: remove channel attributes from sdata
> mac802154: move mac_params functions into mac_cmd
> mac802154: cleanup open count handling
> ieee802154: introduce sysfs file
>
> drivers/net/ieee802154/at86rf230.c | 13 +--
> drivers/net/ieee802154/cc2520.c | 5 +-
> drivers/net/ieee802154/fakelb.c | 8 +-
> drivers/net/ieee802154/mrf24j40.c | 5 +-
> include/net/cfg802154.h | 8 --
> include/net/mac802154.h | 7 +-
> net/ieee802154/Makefile | 2 +-
> net/ieee802154/core.c | 73 +------------
> net/ieee802154/nl-mac.c | 19 +---
> net/ieee802154/sysfs.c | 94 ++++++++++++++++
> net/ieee802154/sysfs.h | 9 ++
> net/mac802154/Makefile | 2 +-
> net/mac802154/driver-ops.h | 213 +++++++++++++++++++++++++++++++++++++
> net/mac802154/ieee802154_i.h | 34 +++---
> net/mac802154/iface.c | 119 +++++++++++++++++----
> net/mac802154/mac_cmd.c | 22 ++++
> net/mac802154/main.c | 166 +----------------------------
> net/mac802154/mib.c | 56 ++--------
> net/mac802154/monitor.c | 59 ----------
> net/mac802154/tx.c | 5 +-
> 20 files changed, 488 insertions(+), 431 deletions(-)
> create mode 100644 net/ieee802154/sysfs.c
> create mode 100644 net/ieee802154/sysfs.h
> create mode 100644 net/mac802154/driver-ops.h
> delete mode 100644 net/mac802154/monitor.c
all 17 patches have been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const
2014-10-28 17:21 ` [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const Alexander Aring
@ 2014-10-29 3:31 ` Varka Bhadram
0 siblings, 0 replies; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:31 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel, Alan Ott
On 10/28/2014 10:51 PM, Alexander Aring wrote:
> The ieee802154_ops structure should be never changed during runtime.
> This patch declare this structure as const to avoid a runtime change.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> Cc: Alan Ott <alan@signal11.us>
> ---
> drivers/net/ieee802154/at86rf230.c | 2 +-
> drivers/net/ieee802154/cc2520.c | 2 +-
> drivers/net/ieee802154/fakelb.c | 2 +-
> drivers/net/ieee802154/mrf24j40.c | 2 +-
> include/net/mac802154.h | 2 +-
> net/mac802154/ieee802154_i.h | 2 +-
> net/mac802154/main.c | 2 +-
> 7 files changed, 7 insertions(+), 7 deletions(-)
For CC2520 driver
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8
2014-10-28 17:21 ` [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8 Alexander Aring
@ 2014-10-29 3:32 ` Varka Bhadram
0 siblings, 0 replies; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:32 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel, Alan Ott
On 10/28/2014 10:51 PM, Alexander Aring wrote:
> The range of channel and page fits into an unsigned byte range. This
> patch changes the set_channel parameter definitions for channel and
> page to u8.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> Cc: Alan Ott <alan@signal11.us>
> ---
> drivers/net/ieee802154/at86rf230.c | 8 ++++----
> drivers/net/ieee802154/cc2520.c | 2 +-
> drivers/net/ieee802154/fakelb.c | 2 +-
> drivers/net/ieee802154/mrf24j40.c | 3 +--
> include/net/mac802154.h | 5 ++---
> 5 files changed, 9 insertions(+), 11 deletions(-)
>
For cc2520 driver change
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-28 17:21 ` [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer Alexander Aring
@ 2014-10-29 3:33 ` Varka Bhadram
2014-10-29 5:53 ` Alexander Aring
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:33 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 10/28/2014 10:51 PM, Alexander Aring wrote:
> This patch removes all might_sleep calls from driver layer. This
> handling is already done by mac802154 layer.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> drivers/net/ieee802154/at86rf230.c | 3 ---
> drivers/net/ieee802154/cc2520.c | 1 -
> drivers/net/ieee802154/fakelb.c | 4 ----
> 3 files changed, 8 deletions(-)
>
For CC2520 driver
Acked-by: Varka Bhadram <varkabhadram@gmail.com>
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
@ 2014-10-29 3:39 ` Varka Bhadram
2014-10-29 3:49 ` Varka Bhadram
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:39 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 10/28/2014 10:51 PM, Alexander Aring wrote:
> This patch removes the monitor implementation file and put all monitor
> stuff into iface file. It's now small enough to put all necessary
> handling into iface.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/mac802154/Makefile | 2 +-
> net/mac802154/iface.c | 30 +++++++++++++++++++++++++
> net/mac802154/monitor.c | 59 -------------------------------------------------
> 3 files changed, 31 insertions(+), 60 deletions(-)
> delete mode 100644 net/mac802154/monitor.c
>
Hi Alex,
Doing nice work,changing the code view same as mac80211.
But What ever you do in previous patches you are undoing, like moving some of the
code to iface file from their to main file like that... Please correct me if I am wrong.
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation
2014-10-29 3:39 ` Varka Bhadram
@ 2014-10-29 3:49 ` Varka Bhadram
2014-10-29 5:39 ` Alexander Aring
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:49 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 10/29/2014 09:09 AM, Varka Bhadram wrote:
> On 10/28/2014 10:51 PM, Alexander Aring wrote:
>> This patch removes the monitor implementation file and put all monitor
>> stuff into iface file. It's now small enough to put all necessary
>> handling into iface.
>>
>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>> ---
>> net/mac802154/Makefile | 2 +-
>> net/mac802154/iface.c | 30 +++++++++++++++++++++++++
>> net/mac802154/monitor.c | 59
>> -------------------------------------------------
>> 3 files changed, 31 insertions(+), 60 deletions(-)
>> delete mode 100644 net/mac802154/monitor.c
>>
> Hi Alex,
>
> Doing nice work,changing the code view same as mac80211.
>
> But What ever you do in previous patches you are undoing, like moving
> some of the
> code to iface file from their to main file like that... Please correct
> me if I am wrong.
>
>
Good to have the cover-letter for all these changes...
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata
2014-10-28 17:21 ` [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata Alexander Aring
@ 2014-10-29 3:52 ` Varka Bhadram
2014-10-29 5:22 ` Alexander Aring
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 3:52 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 10/28/2014 10:51 PM, Alexander Aring wrote:
> These channel attributes was part of "channel context switch while xmit"
> which was removed by commit dc67c6b30f36d57b70b70547a30e7a8432540c6f
> ("mac802154: tx: remove xmit channel context switch"). This patch
> removes these unnecessary variables and use the current_page and
> current_channel by wpan_phy struct now.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/mac802154/ieee802154_i.h | 3 ---
> net/mac802154/iface.c | 4 ----
> net/mac802154/mib.c | 55 ++++++++------------------------------------
> 3 files changed, 9 insertions(+), 53 deletions(-)
>
> diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
> index bf0b5f6..46c9fe7 100644
> --- a/net/mac802154/ieee802154_i.h
> +++ b/net/mac802154/ieee802154_i.h
> @@ -85,9 +85,6 @@ struct ieee802154_sub_if_data {
> __le16 short_addr;
> __le64 extended_addr;
>
> - u8 chan;
> - u8 page;
> -
> struct ieee802154_mac_params mac_params;
>
> /* MAC BSN field */
> diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
> index 2423aa7..1c0274e 100644
> --- a/net/mac802154/iface.c
> +++ b/net/mac802154/iface.c
> @@ -417,8 +417,6 @@ void mac802154_wpan_setup(struct net_device *dev)
> sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> sdata->type = IEEE802154_DEV_WPAN;
>
> - sdata->chan = MAC802154_CHAN_NONE;
> -
> spin_lock_init(&sdata->mib_lock);
> mutex_init(&sdata->sec_mtx);
>
> @@ -454,6 +452,4 @@ void mac802154_monitor_setup(struct net_device *dev)
>
> sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> sdata->type = IEEE802154_DEV_MONITOR;
> -
> - sdata->chan = MAC802154_CHAN_NONE; /* not initialized */
> }
> diff --git a/net/mac802154/mib.c b/net/mac802154/mib.c
> index 3fbc217..0184fce 100644
> --- a/net/mac802154/mib.c
> +++ b/net/mac802154/mib.c
> @@ -26,11 +26,6 @@
> #include "ieee802154_i.h"
> #include "driver-ops.h"
>
> -struct phy_chan_notify_work {
> - struct work_struct work;
> - struct net_device *dev;
> -};
> -
> struct hw_addr_filt_notify_work {
> struct work_struct work;
> struct net_device *dev;
> @@ -161,54 +156,22 @@ u8 mac802154_dev_get_dsn(const struct net_device *dev)
> return sdata->dsn++;
> }
>
> -static void phy_chan_notify(struct work_struct *work)
> -{
> - struct phy_chan_notify_work *nw = container_of(work,
> - struct phy_chan_notify_work, work);
> - struct net_device *dev = nw->dev;
> - struct ieee802154_local *local = mac802154_slave_get_priv(dev);
> - struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> - int res;
> -
> - mutex_lock(&sdata->local->phy->pib_lock);
> - res = drv_set_channel(local, sdata->page, sdata->chan);
> - if (res) {
> - pr_debug("set_channel failed\n");
> - } else {
> - sdata->local->phy->current_channel = sdata->chan;
> - sdata->local->phy->current_page = sdata->page;
> - }
> - mutex_unlock(&sdata->local->phy->pib_lock);
> -
> - kfree(nw);
> -}
> -
> void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
> {
> struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
> - struct phy_chan_notify_work *work;
> + struct ieee802154_local *local = sdata->local;
> + int res;
>
> BUG_ON(dev->type != ARPHRD_IEEE802154);
>
> - spin_lock_bh(&sdata->mib_lock);
> - sdata->page = page;
> - sdata->chan = chan;
> - spin_unlock_bh(&sdata->mib_lock);
> -
> - mutex_lock(&sdata->local->phy->pib_lock);
> - if (sdata->local->phy->current_channel != sdata->chan ||
> - sdata->local->phy->current_page != sdata->page) {
> - mutex_unlock(&sdata->local->phy->pib_lock);
> -
> - work = kzalloc(sizeof(*work), GFP_ATOMIC);
> - if (!work)
> - return;
> -
> - INIT_WORK(&work->work, phy_chan_notify);
> - work->dev = dev;
> - queue_work(sdata->local->workqueue, &work->work);
> + res = drv_set_channel(local, page, chan);
> + if (res) {
> + pr_debug("set_channel failed\n");
Why don't we use netdev_dbg() here...?
> } else {
> - mutex_unlock(&sdata->local->phy->pib_lock);
> + mutex_lock(&local->phy->pib_lock);
> + local->phy->current_channel = chan;
> + local->phy->current_page = page;
> + mutex_unlock(&local->phy->pib_lock);
> }
> }
>
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata
2014-10-29 3:52 ` Varka Bhadram
@ 2014-10-29 5:22 ` Alexander Aring
2014-10-29 5:35 ` Varka Bhadram
0 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 5:22 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
Hi Varka,
On Wed, Oct 29, 2014 at 09:22:17AM +0530, Varka Bhadram wrote:
> On 10/28/2014 10:51 PM, Alexander Aring wrote:
...
> >- sdata->local->phy->current_page != sdata->page) {
> >- mutex_unlock(&sdata->local->phy->pib_lock);
> >-
> >- work = kzalloc(sizeof(*work), GFP_ATOMIC);
> >- if (!work)
> >- return;
> >-
> >- INIT_WORK(&work->work, phy_chan_notify);
> >- work->dev = dev;
> >- queue_work(sdata->local->workqueue, &work->work);
> >+ res = drv_set_channel(local, page, chan);
> >+ if (res) {
> >+ pr_debug("set_channel failed\n");
>
> Why don't we use netdev_dbg() here...?
>
> > } else {
because there comming more patches and I am not at the finally cleanup.
This code will be part of the deprecated netlink interface. I don't want
to fix anything here. It should only work for the things which we
support in the official userspace software and that is. Channel setting,
interface add/del and setting address filter.
I don't want to send a patch series which contains more than 20 patches.
This patch I could also add an another patch for removing the worker
here and I really don't have an idea why we have a worker here. This
channel setting patch is more a rework. In further all phy settings are
directly calls to the driver. MAC settings are stored at each interface
and setted by a open/close or rather ifup and ifdown.
There will come a new netlink interface which use the framework like
wireless. The old one will also be functional but we will remove it some
or later.
> >- mutex_unlock(&sdata->local->phy->pib_lock);
> >+ mutex_lock(&local->phy->pib_lock);
> >+ local->phy->current_channel = chan;
> >+ local->phy->current_page = page;
> >+ mutex_unlock(&local->phy->pib_lock);
> > }
> > }
>
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata
2014-10-29 5:22 ` Alexander Aring
@ 2014-10-29 5:35 ` Varka Bhadram
2014-10-29 6:07 ` Alexander Aring
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 5:35 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
On 10/29/2014 10:52 AM, Alexander Aring wrote:
>>> - sdata->local->phy->current_page != sdata->page) {
>>> - mutex_unlock(&sdata->local->phy->pib_lock);
>>> -
>>> - work = kzalloc(sizeof(*work), GFP_ATOMIC);
>>> - if (!work)
>>> - return;
>>> -
>>> - INIT_WORK(&work->work, phy_chan_notify);
>>> - work->dev = dev;
>>> - queue_work(sdata->local->workqueue, &work->work);
>>> + res = drv_set_channel(local, page, chan);
>>> + if (res) {
>>> + pr_debug("set_channel failed\n");
>> Why don't we use netdev_dbg() here...?
>>
>>> } else {
> because there comming more patches and I am not at the finally cleanup.
> This code will be part of the deprecated netlink interface. I don't want
> to fix anything here. It should only work for the things which we
> support in the official userspace software and that is. Channel setting,
> interface add/del and setting address filter.
>
> I don't want to send a patch series which contains more than 20 patches.
>
> This patch I could also add an another patch for removing the worker
> here and I really don't have an idea why we have a worker here. This
> channel setting patch is more a rework. In further all phy settings are
> directly calls to the driver. MAC settings are stored at each interface
> and setted by a open/close or rather ifup and ifdown.
I think when we do ifup the open function will be called..?
> There will come a new netlink interface which use the framework like
> wireless. The old one will also be functional but we will remove it some
> or later.
What is the New netlink interface..?
I would like to know.
--
Thanks and Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation
2014-10-29 3:49 ` Varka Bhadram
@ 2014-10-29 5:39 ` Alexander Aring
0 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 5:39 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
Hi Varka,
On Wed, Oct 29, 2014 at 09:19:33AM +0530, Varka Bhadram wrote:
> On 10/29/2014 09:09 AM, Varka Bhadram wrote:
> >On 10/28/2014 10:51 PM, Alexander Aring wrote:
> >>This patch removes the monitor implementation file and put all monitor
> >>stuff into iface file. It's now small enough to put all necessary
> >>handling into iface.
> >>
> >>Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> >>---
> >> net/mac802154/Makefile | 2 +-
> >> net/mac802154/iface.c | 30 +++++++++++++++++++++++++
> >> net/mac802154/monitor.c | 59
> >>-------------------------------------------------
> >> 3 files changed, 31 insertions(+), 60 deletions(-)
> >> delete mode 100644 net/mac802154/monitor.c
> >>
> >Hi Alex,
> >
> >Doing nice work,changing the code view same as mac80211.
> >
> >But What ever you do in previous patches you are undoing, like moving some
> >of the
> >code to iface file from their to main file like that... Please correct me
> >if I am wrong.
> >
> >
> Good to have the cover-letter for all these changes...
>
I tried to grab me one file and then doing all stuff which is in my
rework branch. First tx file then rx file, now with iface sending trivial
patches has ended here.
You are right cover-letters looks much ugly and patches contains too much changes
sometimes.
I want that all these changes are contain in the upcomming kernel release.
I will try to improve my cover-letter in the next series. For me wrtiting a
commit msg is more difficult than writing code and there will comming
much patches which will do many change.
The current code base for this branch is very bad and when we don't
doing anything here in this structual architecture then this branch will
die. For me it was already died when I cames mainline.
I can't simple send a patch which removes all 802.15.4 code and adding a
new implementation. We need to do this in small steps.
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 3:33 ` Varka Bhadram
@ 2014-10-29 5:53 ` Alexander Aring
2014-10-29 5:57 ` Varka Bhadram
0 siblings, 1 reply; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 5:53 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
Hi Varka,
On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
> On 10/28/2014 10:51 PM, Alexander Aring wrote:
> >This patch removes all might_sleep calls from driver layer. This
> >handling is already done by mac802154 layer.
> >
> >Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> >---
> > drivers/net/ieee802154/at86rf230.c | 3 ---
> > drivers/net/ieee802154/cc2520.c | 1 -
> > drivers/net/ieee802154/fakelb.c | 4 ----
> > 3 files changed, 8 deletions(-)
> >
> For CC2520 driver
>
I would Cc you here if you stand in the MAINTAINERS file for cc2520
driver. I asked you some months ago if you like to be there. I didn't
saw any patches for that. I thought it's out of interest by you that you
want to be maintainer for this driver. When these changes are very trivial
like this one, it's okay for you when Marcel simple apply these patches
without any ack? I already told him that we don't need to wait of Alan's
ack for the mrf24j40 driver.
Nevertheless if you want to add really a Acked here and we need to wait
then please insert you in the MAINTAINERS file. When I run
get_maintainers it's currently me who is maintainer for the cc2520 driver.
If you want to take care of this driver, please see my improvements and
fixes for the at86rf230. I am sure you could also take some code for the
cc2520 from it. Also I would be very happy for async xmit handling or
regmap support. Most of the cc2520 code is lowlevel spi api calls.
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 5:53 ` Alexander Aring
@ 2014-10-29 5:57 ` Varka Bhadram
2014-10-29 6:13 ` Alexander Aring
0 siblings, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 5:57 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
On 10/29/2014 11:23 AM, Alexander Aring wrote:
> Hi Varka,
>
> On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
>> On 10/28/2014 10:51 PM, Alexander Aring wrote:
>>> This patch removes all might_sleep calls from driver layer. This
>>> handling is already done by mac802154 layer.
>>>
>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>> ---
>>> drivers/net/ieee802154/at86rf230.c | 3 ---
>>> drivers/net/ieee802154/cc2520.c | 1 -
>>> drivers/net/ieee802154/fakelb.c | 4 ----
>>> 3 files changed, 8 deletions(-)
>>>
>> For CC2520 driver
>>
> I would Cc you here if you stand in the MAINTAINERS file for cc2520
> driver. I asked you some months ago if you like to be there. I didn't
> saw any patches for that. I thought it's out of interest by you that you
> want to be maintainer for this driver. When these changes are very trivial
> like this one, it's okay for you when Marcel simple apply these patches
> without any ack? I already told him that we don't need to wait of Alan's
> ack for the mrf24j40 driver.
>
> Nevertheless if you want to add really a Acked here and we need to wait
> then please insert you in the MAINTAINERS file. When I run
> get_maintainers it's currently me who is maintainer for the cc2520 driver.
>
> If you want to take care of this driver, please see my improvements and
> fixes for the at86rf230. I am sure you could also take some code for the
> cc2520 from it. Also I would be very happy for async xmit handling or
> regmap support. Most of the cc2520 code is lowlevel spi api calls.
>
> - Alex
I think i clarified you that i want to be the CC2520 driver maintainer.
I asked you to submit the patche for MAINTAINER file, you told that its
not required.
If i run get_maintainer on the cc2520 driver , my name is there for the commit_signer
I will improve this driver regmap suuport.
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata
2014-10-29 5:35 ` Varka Bhadram
@ 2014-10-29 6:07 ` Alexander Aring
0 siblings, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 6:07 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
On Wed, Oct 29, 2014 at 11:05:20AM +0530, Varka Bhadram wrote:
> On 10/29/2014 10:52 AM, Alexander Aring wrote:
> >>>- sdata->local->phy->current_page != sdata->page) {
> >>>- mutex_unlock(&sdata->local->phy->pib_lock);
> >>>-
> >>>- work = kzalloc(sizeof(*work), GFP_ATOMIC);
> >>>- if (!work)
> >>>- return;
> >>>-
> >>>- INIT_WORK(&work->work, phy_chan_notify);
> >>>- work->dev = dev;
> >>>- queue_work(sdata->local->workqueue, &work->work);
> >>>+ res = drv_set_channel(local, page, chan);
> >>>+ if (res) {
> >>>+ pr_debug("set_channel failed\n");
> >>Why don't we use netdev_dbg() here...?
> >>
> >>> } else {
> >because there comming more patches and I am not at the finally cleanup.
> >This code will be part of the deprecated netlink interface. I don't want
> >to fix anything here. It should only work for the things which we
> >support in the official userspace software and that is. Channel setting,
> >interface add/del and setting address filter.
> >
> >I don't want to send a patch series which contains more than 20 patches.
> >
> >This patch I could also add an another patch for removing the worker
> >here and I really don't have an idea why we have a worker here. This
> >channel setting patch is more a rework. In further all phy settings are
> >directly calls to the driver. MAC settings are stored at each interface
> >and setted by a open/close or rather ifup and ifdown.
>
> I think when we do ifup the open function will be called..?
>
Yes, we have these multiple interfaces and these "can" have different
MAC settings. When I say MAC here then it's something which needs an
algorithmn. PHY settings doesn't need to run a algorithmn, like channel
page settings.
Later if we do a ifup we should set all MAC settings which is handled by
PHY. It's handled by phy because it's very time critical like ARET or
CSMA. Also address filtering is a MAC settings which is handled by phy.
In the next patches we also remove the pib/mib lock and make locking via
netif_running. That means we can't set MAC which are handled by PHY while
netif is running. This is usual principle in netdev, like you can't
change ethernet address while netif is running. Now when netif is
running then the rx/tx paths are called and these variables becomes read
only. We simple don't need any locking mechanism in hotpaths then.
If somebody want to change addresses short/extended/pan_id, ARET, CSMA.
He need to do a ifdown first and then the user can change it.
On ifup all interfaces should be have the same MAC settings which are
handled by PHY. I need to see if we really need the multiple interface
thing or just implement a netlink call to change the interface type.
Only one use case for me is that we can have more than one monitor
interface at the same time.
> >There will come a new netlink interface which use the framework like
> >wireless. The old one will also be functional but we will remove it some
> >or later.
>
> What is the New netlink interface..?
>
> I would like to know.
The current netlink interface is the most weird code in the current
implementation and the official userspace software doesn't support all
netlink commands. I tried to implement it but I gave up. The new one
should be look like:
https://github.com/linux-wpan/linux-wpan-next/blob/wpan_rework_rfc/net/ieee802154/nl802154.c
mostly grab the framework from wireless.
Userspace tools are:
https://github.com/linux-wpan/wpan-tools
mostly grab the framework from iw wireless tools.
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 5:57 ` Varka Bhadram
@ 2014-10-29 6:13 ` Alexander Aring
2014-10-29 7:23 ` Alexander Aring
2014-10-29 8:10 ` Varka Bhadram
0 siblings, 2 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 6:13 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
Hi Varka,
On Wed, Oct 29, 2014 at 11:27:53AM +0530, Varka Bhadram wrote:
> On 10/29/2014 11:23 AM, Alexander Aring wrote:
> >Hi Varka,
> >
> >On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
> >>On 10/28/2014 10:51 PM, Alexander Aring wrote:
> >>>This patch removes all might_sleep calls from driver layer. This
> >>>handling is already done by mac802154 layer.
> >>>
> >>>Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> >>>---
> >>> drivers/net/ieee802154/at86rf230.c | 3 ---
> >>> drivers/net/ieee802154/cc2520.c | 1 -
> >>> drivers/net/ieee802154/fakelb.c | 4 ----
> >>> 3 files changed, 8 deletions(-)
> >>>
> >>For CC2520 driver
> >>
> >I would Cc you here if you stand in the MAINTAINERS file for cc2520
> >driver. I asked you some months ago if you like to be there. I didn't
> >saw any patches for that. I thought it's out of interest by you that you
> >want to be maintainer for this driver. When these changes are very trivial
> >like this one, it's okay for you when Marcel simple apply these patches
> >without any ack? I already told him that we don't need to wait of Alan's
> >ack for the mrf24j40 driver.
> >
> >Nevertheless if you want to add really a Acked here and we need to wait
> >then please insert you in the MAINTAINERS file. When I run
> >get_maintainers it's currently me who is maintainer for the cc2520 driver.
> >
> >If you want to take care of this driver, please see my improvements and
> >fixes for the at86rf230. I am sure you could also take some code for the
> >cc2520 from it. Also I would be very happy for async xmit handling or
> >regmap support. Most of the cc2520 code is lowlevel spi api calls.
> >
> >- Alex
>
> I think i clarified you that i want to be the CC2520 driver maintainer.
>
> I asked you to submit the patche for MAINTAINER file, you told that its
> not required.
>
I looked up the conversion:
You:
"You mean to say that i need to add an entry in MAINTAINER file or ..?"
Me:
"not need, only if you like. I have no idea about the cc2520 driver."
need != required. For me this sentence is more... you really don't need
that do be maintainer of this if you don't like that. But if you like to
be maintainer, then send a patch.
> If i run get_maintainer on the cc2520 driver , my name is there for the commit_signer
>
This is because get_maintainers lookups the last commits.
I run "./scripts/get_maintainer.pl -f drivers/net/ieee802154/cc2520.c"
on my own.
Output is:
Alexander Aring <alex.aring@gmail.com> (maintainer:IEEE 802.15.4 SUB...)
Grant Likely <grant.likely@linaro.org> (maintainer:OPEN FIRMWARE AND...)
Rob Herring <robh+dt@kernel.org> (maintainer:OPEN FIRMWARE AND...)
linux-wpan@vger.kernel.org (open list:IEEE 802.15.4 SUB...)
netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
linux-kernel@vger.kernel.org (open list)
devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND...)
there is no Varka here.
> I will improve this driver regmap suuport.
>
ok.
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 6:13 ` Alexander Aring
@ 2014-10-29 7:23 ` Alexander Aring
2014-10-29 8:10 ` Varka Bhadram
1 sibling, 0 replies; 35+ messages in thread
From: Alexander Aring @ 2014-10-29 7:23 UTC (permalink / raw)
To: Varka Bhadram; +Cc: linux-wpan, kernel
Hi Varka,
it's too early in the morning, apologize my english here.
On Wed, Oct 29, 2014 at 07:13:06AM +0100, Alexander Aring wrote:
> Hi Varka,
>
> On Wed, Oct 29, 2014 at 11:27:53AM +0530, Varka Bhadram wrote:
> > On 10/29/2014 11:23 AM, Alexander Aring wrote:
> > >Hi Varka,
> > >
> > >On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
> > >>On 10/28/2014 10:51 PM, Alexander Aring wrote:
> > >>>This patch removes all might_sleep calls from driver layer. This
> > >>>handling is already done by mac802154 layer.
> > >>>
> > >>>Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > >>>---
> > >>> drivers/net/ieee802154/at86rf230.c | 3 ---
> > >>> drivers/net/ieee802154/cc2520.c | 1 -
> > >>> drivers/net/ieee802154/fakelb.c | 4 ----
> > >>> 3 files changed, 8 deletions(-)
> > >>>
> > >>For CC2520 driver
> > >>
> > >I would Cc you here if you stand in the MAINTAINERS file for cc2520
> > >driver. I asked you some months ago if you like to be there. I didn't
> > >saw any patches for that. I thought it's out of interest by you that you
> > >want to be maintainer for this driver. When these changes are very trivial
> > >like this one, it's okay for you when Marcel simple apply these patches
> > >without any ack? I already told him that we don't need to wait of Alan's
> > >ack for the mrf24j40 driver.
> > >
> > >Nevertheless if you want to add really a Acked here and we need to wait
> > >then please insert you in the MAINTAINERS file. When I run
> > >get_maintainers it's currently me who is maintainer for the cc2520 driver.
> > >
> > >If you want to take care of this driver, please see my improvements and
> > >fixes for the at86rf230. I am sure you could also take some code for the
> > >cc2520 from it. Also I would be very happy for async xmit handling or
> > >regmap support. Most of the cc2520 code is lowlevel spi api calls.
> > >
> > >- Alex
> >
> > I think i clarified you that i want to be the CC2520 driver maintainer.
> >
> > I asked you to submit the patche for MAINTAINER file, you told that its
> > not required.
> >
>
> I looked up the conversion:
>
s/conversion/conversation/
> You:
>
> "You mean to say that i need to add an entry in MAINTAINER file or ..?"
>
> Me:
>
> "not need, only if you like. I have no idea about the cc2520 driver."
>
> need != required. For me this sentence is more... you really don't need
> that do be maintainer of this if you don't like that. But if you like to
s/do/to
well, I think I cherry-pick some commits now to generate the next
series.
- Alex
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 6:13 ` Alexander Aring
2014-10-29 7:23 ` Alexander Aring
@ 2014-10-29 8:10 ` Varka Bhadram
2014-10-29 8:12 ` Varka Bhadram
1 sibling, 1 reply; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 8:10 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
On 10/29/2014 11:43 AM, Alexander Aring wrote:
> Hi Varka,
>
> On Wed, Oct 29, 2014 at 11:27:53AM +0530, Varka Bhadram wrote:
>> On 10/29/2014 11:23 AM, Alexander Aring wrote:
>>> Hi Varka,
>>>
>>> On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
>>>> On 10/28/2014 10:51 PM, Alexander Aring wrote:
>>>>> This patch removes all might_sleep calls from driver layer. This
>>>>> handling is already done by mac802154 layer.
>>>>>
>>>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>>>> ---
>>>>> drivers/net/ieee802154/at86rf230.c | 3 ---
>>>>> drivers/net/ieee802154/cc2520.c | 1 -
>>>>> drivers/net/ieee802154/fakelb.c | 4 ----
>>>>> 3 files changed, 8 deletions(-)
>>>>>
>>>> For CC2520 driver
>>>>
>>> I would Cc you here if you stand in the MAINTAINERS file for cc2520
>>> driver. I asked you some months ago if you like to be there. I didn't
>>> saw any patches for that. I thought it's out of interest by you that you
>>> want to be maintainer for this driver. When these changes are very trivial
>>> like this one, it's okay for you when Marcel simple apply these patches
>>> without any ack? I already told him that we don't need to wait of Alan's
>>> ack for the mrf24j40 driver.
>>>
>>> Nevertheless if you want to add really a Acked here and we need to wait
>>> then please insert you in the MAINTAINERS file. When I run
>>> get_maintainers it's currently me who is maintainer for the cc2520 driver.
>>>
>>> If you want to take care of this driver, please see my improvements and
>>> fixes for the at86rf230. I am sure you could also take some code for the
>>> cc2520 from it. Also I would be very happy for async xmit handling or
>>> regmap support. Most of the cc2520 code is lowlevel spi api calls.
>>>
>>> - Alex
>> I think i clarified you that i want to be the CC2520 driver maintainer.
>>
>> I asked you to submit the patche for MAINTAINER file, you told that its
>> not required.
>>
> I looked up the conversion:
>
> You:
>
> "You mean to say that i need to add an entry in MAINTAINER file or ..?"
>
> Me:
>
> "not need, only if you like. I have no idea about the cc2520 driver."
>
> need != required. For me this sentence is more... you really don't need
> that do be maintainer of this if you don't like that. But if you like to
> be maintainer, then send a patch.
I will send a patch for the MAINTAINER.
>> If i run get_maintainer on the cc2520 driver , my name is there for the commit_signer
>>
> This is because get_maintainers lookups the last commits.
>
> I run "./scripts/get_maintainer.pl -f drivers/net/ieee802154/cc2520.c"
> on my own.
>
> Output is:
>
> Alexander Aring <alex.aring@gmail.com> (maintainer:IEEE 802.15.4 SUB...)
> Grant Likely <grant.likely@linaro.org> (maintainer:OPEN FIRMWARE AND...)
> Rob Herring <robh+dt@kernel.org> (maintainer:OPEN FIRMWARE AND...)
> linux-wpan@vger.kernel.org (open list:IEEE 802.15.4 SUB...)
> netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
> linux-kernel@vger.kernel.org (open list)
> devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND...)
>
>
> there is no Varka here.
Ok.. I will update.
>> I will improve this driver regmap suuport.
>>
> ok.
>
> - Alex
Thanks...
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
* Re: [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer
2014-10-29 8:10 ` Varka Bhadram
@ 2014-10-29 8:12 ` Varka Bhadram
0 siblings, 0 replies; 35+ messages in thread
From: Varka Bhadram @ 2014-10-29 8:12 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
On 10/29/2014 01:40 PM, Varka Bhadram wrote:
> On 10/29/2014 11:43 AM, Alexander Aring wrote:
>> Hi Varka,
>>
>> On Wed, Oct 29, 2014 at 11:27:53AM +0530, Varka Bhadram wrote:
>>> On 10/29/2014 11:23 AM, Alexander Aring wrote:
>>>> Hi Varka,
>>>>
>>>> On Wed, Oct 29, 2014 at 09:03:49AM +0530, Varka Bhadram wrote:
>>>>> On 10/28/2014 10:51 PM, Alexander Aring wrote:
>>>>>> This patch removes all might_sleep calls from driver layer. This
>>>>>> handling is already done by mac802154 layer.
>>>>>>
>>>>>> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
>>>>>> ---
>>>>>> drivers/net/ieee802154/at86rf230.c | 3 ---
>>>>>> drivers/net/ieee802154/cc2520.c | 1 -
>>>>>> drivers/net/ieee802154/fakelb.c | 4 ----
>>>>>> 3 files changed, 8 deletions(-)
>>>>>>
>>>>> For CC2520 driver
>>>>>
>>>> I would Cc you here if you stand in the MAINTAINERS file for cc2520
>>>> driver. I asked you some months ago if you like to be there. I didn't
>>>> saw any patches for that. I thought it's out of interest by you
>>>> that you
>>>> want to be maintainer for this driver. When these changes are very
>>>> trivial
>>>> like this one, it's okay for you when Marcel simple apply these
>>>> patches
>>>> without any ack? I already told him that we don't need to wait of
>>>> Alan's
>>>> ack for the mrf24j40 driver.
>>>>
>>>> Nevertheless if you want to add really a Acked here and we need to
>>>> wait
>>>> then please insert you in the MAINTAINERS file. When I run
>>>> get_maintainers it's currently me who is maintainer for the cc2520
>>>> driver.
>>>>
>>>> If you want to take care of this driver, please see my improvements
>>>> and
>>>> fixes for the at86rf230. I am sure you could also take some code
>>>> for the
>>>> cc2520 from it. Also I would be very happy for async xmit handling or
>>>> regmap support. Most of the cc2520 code is lowlevel spi api calls.
>>>>
>>>> - Alex
>>> I think i clarified you that i want to be the CC2520 driver maintainer.
>>>
>>> I asked you to submit the patche for MAINTAINER file, you told that its
>>> not required.
>>>
>> I looked up the conversion:
>>
>> You:
>>
>> "You mean to say that i need to add an entry in MAINTAINER file or ..?"
>>
>> Me:
>>
>> "not need, only if you like. I have no idea about the cc2520 driver."
>>
>> need != required. For me this sentence is more... you really don't need
>> that do be maintainer of this if you don't like that. But if you like to
>> be maintainer, then send a patch.
>
> I will send a patch for the MAINTAINER.
>
>>> If i run get_maintainer on the cc2520 driver , my name is there for
>>> the commit_signer
>>>
>> This is because get_maintainers lookups the last commits.
>>
>> I run "./scripts/get_maintainer.pl -f drivers/net/ieee802154/cc2520.c"
>> on my own.
>>
>> Output is:
>>
>> Alexander Aring <alex.aring@gmail.com> (maintainer:IEEE 802.15.4 SUB...)
>> Grant Likely <grant.likely@linaro.org> (maintainer:OPEN FIRMWARE AND...)
>> Rob Herring <robh+dt@kernel.org> (maintainer:OPEN FIRMWARE AND...)
>> linux-wpan@vger.kernel.org (open list:IEEE 802.15.4 SUB...)
>> netdev@vger.kernel.org (open list:NETWORKING DRIVERS)
>> linux-kernel@vger.kernel.org (open list)
>> devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND...)
>>
>>
>> there is no Varka here.
>
> Ok.. I will update.
>
>>> I will improve this driver regmap suuport.
>>>
>> ok.
>>
>> - Alex
>
> Thanks...
>
Put cc to me incase of cc2520 driver changes.
Wait for my Ack on those changes.
--
Regards,
Varka Bhadram.
^ permalink raw reply [flat|nested] 35+ messages in thread
end of thread, other threads:[~2014-10-29 8:15 UTC | newest]
Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-28 17:21 [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 01/17] mac802154: monitor: merge into iface implementation Alexander Aring
2014-10-29 3:39 ` Varka Bhadram
2014-10-29 3:49 ` Varka Bhadram
2014-10-29 5:39 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 02/17] mac802154: main: move open and close into iface Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 03/17] mac802154: declare struct ieee802154_ops as const Alexander Aring
2014-10-29 3:31 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 04/17] mac802154: ops: declare channel and page as u8 Alexander Aring
2014-10-29 3:32 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 05/17] mac802154: introduce driver-ops header Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 06/17] mac802154: use driver-ops function wrappers Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 07/17] mac802154: remove might_sleep from driver layer Alexander Aring
2014-10-29 3:33 ` Varka Bhadram
2014-10-29 5:53 ` Alexander Aring
2014-10-29 5:57 ` Varka Bhadram
2014-10-29 6:13 ` Alexander Aring
2014-10-29 7:23 ` Alexander Aring
2014-10-29 8:10 ` Varka Bhadram
2014-10-29 8:12 ` Varka Bhadram
2014-10-28 17:21 ` [PATCH bluetooth-next 08/17] mac802154: remove driver ops in wpan-phy Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 09/17] mac802154: rework sdata state change to running Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 10/17] mac802154: rename running to started Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 11/17] mac802154: move local started handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 12/17] mac802154: add synchronization handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 13/17] mac802154: iface: remove assign to zero Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 14/17] mac802154: remove channel attributes from sdata Alexander Aring
2014-10-29 3:52 ` Varka Bhadram
2014-10-29 5:22 ` Alexander Aring
2014-10-29 5:35 ` Varka Bhadram
2014-10-29 6:07 ` Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 15/17] mac802154: move mac_params functions into mac_cmd Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 16/17] mac802154: cleanup open count handling Alexander Aring
2014-10-28 17:21 ` [PATCH bluetooth-next 17/17] ieee802154: introduce sysfs file Alexander Aring
2014-10-28 22:24 ` [PATCH bluetooth-next 00/17] mac802154: iface and driver-ops cleanup Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.