ieee802154: removals and renames
Subsystems (5)
Alexander Aring
maintainercover ieee802154: removals and renames
This patch series removes the not working/not finished hardMAC virtual driver "fakehard". Additional we remove the not used ieee802154_addr driver callback ops. The other patches are rename patches for avoiding mainly the "priv variable naming hell" inside the 802.15.4 subsystem. This series introduce 802.11 naming style for used structs and variable naming.
This serie based on "[PATCHv2 bluetooth-next 0/7] ieee802154: file movements" patch serie.
Alexander Aring (10):
ieee802154: remove fakehard driver
ieee802154: rename ieee802154_dev to ieee802154_hw
mac802154: rename mac802154_priv to ieee802154_local
mac802154: rename mac802154_sub_if_data
mac802154: rename hw subif_data variable to local
mac802154: rename sdata slaves and slaves_mtx
mac802154: introduce hw_to_local function
mac802154: introduce IEEE802154_DEV_TO_SUB_IF
mac802154: rename dev_workqueue to workqueue
mac802154: remove ieee802154_addr from driver_ops
drivers/net/ieee802154/Kconfig | 10 - drivers/net/ieee802154/Makefile | 1 - drivers/net/ieee802154/at86rf230.c | 90 ++++---- drivers/net/ieee802154/cc2520.c | 50 ++--- drivers/net/ieee802154/fakehard.c | 427 ------------------------------------- drivers/net/ieee802154/fakelb.c | 78 +++---- drivers/net/ieee802154/mrf24j40.c | 48 ++--- include/net/mac802154.h | 43 ++-- net/mac802154/ieee802154_i.h | 34 +-- net/mac802154/iface.c | 141 ++++++------ net/mac802154/mac_cmd.c | 4 +- net/mac802154/main.c | 265 +++++++++++------------ net/mac802154/mib.c | 206 +++++++++--------- net/mac802154/monitor.c | 26 +-- net/mac802154/rx.c | 22 +- net/mac802154/tx.c | 40 ++-- 16 files changed, 522 insertions(+), 963 deletions(-) delete mode 100644 drivers/net/ieee802154/fakehard.c
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 1/10 ieee802154: remove fakehard driver
This patch removes the not functional fakehard driver. We don't support HardMAC 802.15.4 drivers right now.
--- drivers/net/ieee802154/Kconfig | 10 - drivers/net/ieee802154/Makefile | 1 - drivers/net/ieee802154/fakehard.c | 427 -------------------------------------- 3 files changed, 438 deletions(-) delete mode 100644 drivers/net/ieee802154/fakehard.c
drivers/net/ieee802154/Kconfig +0 -10
@@ -10,16 +10,6 @@ menuconfig IEEE802154_DRIVERS If you say N, all options in this submenu will be skipped and disabled. -config IEEE802154_FAKEHARD - tristate "Fake LR-WPAN driver with several interconnected devices" - depends on IEEE802154_DRIVERS - ---help--- - Say Y here to enable the fake driver that serves as an example - of HardMAC device driver. - - This driver can also be built as a module. To do so say M here. - The module will be called 'fakehard'. - config IEEE802154_FAKELB depends on IEEE802154_DRIVERS && MAC802154 tristate "IEEE 802.15.4 loopback driver"
drivers/net/ieee802154/Makefile +0 -1
@@ -1,4 +1,3 @@ -obj-$(CONFIG_IEEE802154_FAKEHARD) += fakehard.o obj-$(CONFIG_IEEE802154_FAKELB) += fakelb.o obj-$(CONFIG_IEEE802154_AT86RF230) += at86rf230.o obj-$(CONFIG_IEEE802154_MRF24J40) += mrf24j40.o
drivers/net/ieee802154/fakehard.c deleted +0 -427
427 lines not on this page · raw message
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 2/10 ieee802154: rename ieee802154_dev to ieee802154_hw
In reply to Alexander AringThe identical struct of the wireless stack implementation is named ieee80211_hw. This is useful to name the variable hw instead of get confusing with netdev dev variable.
--- drivers/net/ieee802154/at86rf230.c | 90 +++++++++++++++++++------------------- drivers/net/ieee802154/cc2520.c | 50 ++++++++++----------- drivers/net/ieee802154/fakelb.c | 78 ++++++++++++++++----------------- drivers/net/ieee802154/mrf24j40.c | 48 ++++++++++---------- include/net/mac802154.h | 44 +++++++++---------- net/mac802154/ieee802154_i.h | 2 +- net/mac802154/main.c | 34 +++++++------- net/mac802154/rx.c | 12 ++--- 8 files changed, 179 insertions(+), 179 deletions(-)
drivers/net/ieee802154/at86rf230.c +45 -45
@@ -77,7 +77,7 @@ struct at86rf230_state_change {struct at86rf230_local {struct spi_device *spi; -struct ieee802154_dev *dev; +struct ieee802154_hw *hw;struct at86rf2xx_chip_data *data;struct regmap *regmap;
@@ -808,7 +808,7 @@ at86rf230_rx(struct at86rf230_local *lp,/* We do not put CRC into the frame */ skb_trim (skb, len -2 ); -ieee802154_rx_irqsafe (lp->dev, skb, lqi); +ieee802154_rx_irqsafe (lp->hw, skb, lqi); } static void
@@ -969,9 +969,9 @@ at86rf230_xmit_tx_on(void *context) }static int -at86rf230_xmit (struct ieee802154_dev *dev,struct sk_buff *skb) +at86rf230_xmit (struct ieee802154_hw *hw,struct sk_buff *skb) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;struct at86rf230_state_change *ctx = &lp->tx;void (*tx_complete)(void *context) = at86rf230_write_frame;
@@ -1012,7 +1012,7 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff *skb) }static int -at86rf230_ed (struct ieee802154_dev *dev,u8 *level) +at86rf230_ed (struct ieee802154_hw *hw,u8 *level) {might_sleep ();BUG_ON (!level);
@@ -1021,15 +1021,15 @@ at86rf230_ed(struct ieee802154_dev *dev, u8 *level) }static int -at86rf230_start (struct ieee802154_dev *dev) +at86rf230_start (struct ieee802154_hw *hw) { -return at86rf230_sync_state_change (dev->priv,STATE_RX_AACK_ON ); +return at86rf230_sync_state_change (hw->priv,STATE_RX_AACK_ON ); }static void -at86rf230_stop (struct ieee802154_dev *dev) +at86rf230_stop (struct ieee802154_hw *hw) { -at86rf230_sync_state_change (dev->priv,STATE_FORCE_TRX_OFF ); +at86rf230_sync_state_change (hw->priv,STATE_FORCE_TRX_OFF ); } static int
@@ -1064,15 +1064,15 @@ at86rf212_set_channel(struct at86rf230_local *lp, int page, int channel) }static int -at86rf230_channel (struct ieee802154_dev *dev,int page,int channel) +at86rf230_channel (struct ieee802154_hw *hw,int page,int channel) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;int rc;might_sleep ();if (page <0 || page >31 || - !(lp->dev->phy->channels_supported[page] &BIT (channel))) { + !(lp->hw->phy->channels_supported[page] &BIT (channel))) {WARN_ON (1 );return -EINVAL ; }
@@ -1084,18 +1084,18 @@ at86rf230_channel(struct ieee802154_dev *dev, int page, int channel)/* Wait for PLL */ usleep_range (lp->data->t_channel_switch, lp->data->t_channel_switch +10 ); - dev->phy->current_channel = channel; - dev->phy->current_page = page; + hw->phy->current_channel = channel; + hw->phy->current_page = page;return 0 ; }static int -at86rf230_set_hw_addr_filt (struct ieee802154_dev *dev, +at86rf230_set_hw_addr_filt (struct ieee802154_hw *hw,struct ieee802154_hw_addr_filt *filt,unsigned long changed) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;if (changed &IEEE802154_AFILT_SADDR_CHANGED ) {u16 addr =le16_to_cpu (filt->short_addr);
@@ -1138,9 +1138,9 @@ at86rf230_set_hw_addr_filt(struct ieee802154_dev *dev, }static int -at86rf230_set_txpower (struct ieee802154_dev *dev,int db) +at86rf230_set_txpower (struct ieee802154_hw *hw,int db) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;/* typical maximum output is 5dBm with RG_PHY_TX_PWR 0x60, lower five * bits decrease power in 1dB steps. 0x60 represents extra PA gain of
@@ -1157,17 +1157,17 @@ at86rf230_set_txpower(struct ieee802154_dev *dev, int db) }static int -at86rf230_set_lbt (struct ieee802154_dev *dev,bool on) +at86rf230_set_lbt (struct ieee802154_hw *hw,bool on) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;return at86rf230_write_subreg (lp,SR_CSMA_LBT_MODE , on); }static int -at86rf230_set_cca_mode (struct ieee802154_dev *dev,u8 mode) +at86rf230_set_cca_mode (struct ieee802154_hw *hw,u8 mode) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;return at86rf230_write_subreg (lp,SR_CCA_MODE , mode); }
@@ -1185,9 +1185,9 @@ at86rf23x_get_desens_steps(struct at86rf230_local *lp, s32 level) }static int -at86rf230_set_cca_ed_level (struct ieee802154_dev *dev,s32 level) +at86rf230_set_cca_ed_level (struct ieee802154_hw *hw,s32 level) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;if (level < lp->data->rssi_base_val || level >30 )return -EINVAL ;
@@ -1197,10 +1197,10 @@ at86rf230_set_cca_ed_level(struct ieee802154_dev *dev, s32 level) }static int -at86rf230_set_csma_params (struct ieee802154_dev *dev,u8 min_be,u8 max_be, +at86rf230_set_csma_params (struct ieee802154_hw *hw,u8 min_be,u8 max_be,u8 retries) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;int rc;if (min_be > max_be || max_be >8 || retries >5 )
@@ -1218,9 +1218,9 @@ at86rf230_set_csma_params(struct ieee802154_dev *dev, u8 min_be, u8 max_be, }static int -at86rf230_set_frame_retries (struct ieee802154_dev *dev,s8 retries) +at86rf230_set_frame_retries (struct ieee802154_hw *hw,s8 retries) { -struct at86rf230_local *lp = dev->priv; +struct at86rf230_local *lp = hw->priv;int rc =0 ;if (retries <-1 || retries >15 )
@@ -1409,8 +1409,8 @@ at86rf230_detect_device(struct at86rf230_local *lp)return -EINVAL ; } - lp->dev->extra_tx_headroom =0 ; - lp->dev->flags =IEEE802154_HW_OMIT_CKSUM |IEEE802154_HW_AACK | + lp->hw->extra_tx_headroom =0 ; + lp->hw->flags =IEEE802154_HW_OMIT_CKSUM |IEEE802154_HW_AACK |IEEE802154_HW_TXPOWER |IEEE802154_HW_CSMA ;switch (part) {
@@ -1421,15 +1421,15 @@ at86rf230_detect_device(struct at86rf230_local *lp)case 3 : chip ="at86rf231" ; lp->data = &at86rf231_data; - lp->dev->phy->channels_supported[0 ] =0x7FFF800 ; + lp->hw->phy->channels_supported[0 ] =0x7FFF800 ;break ;case 7 : chip ="at86rf212" ;if (version ==1 ) { lp->data = &at86rf212_data; - lp->dev->flags |=IEEE802154_HW_LBT ; - lp->dev->phy->channels_supported[0 ] =0x00007FF ; - lp->dev->phy->channels_supported[2 ] =0x00007FF ; + lp->hw->flags |=IEEE802154_HW_LBT ; + lp->hw->phy->channels_supported[0 ] =0x00007FF ; + lp->hw->phy->channels_supported[2 ] =0x00007FF ; }else { rc = -ENOTSUPP ; }
@@ -1437,7 +1437,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)case 11 : chip ="at86rf233" ; lp->data = &at86rf233_data; - lp->dev->phy->channels_supported[0 ] =0x7FFF800 ; + lp->hw->phy->channels_supported[0 ] =0x7FFF800 ;break ;default : chip ="unkown" ;
@@ -1478,7 +1478,7 @@ at86rf230_setup_spi_messages(struct at86rf230_local *lp)static int at86rf230_probe (struct spi_device *spi) {struct at86rf230_platform_data *pdata; -struct ieee802154_dev *dev; +struct ieee802154_hw *hw;struct at86rf230_local *lp;unsigned int status;int rc, irq_type;
@@ -1517,14 +1517,14 @@ static int at86rf230_probe(struct spi_device *spi)usleep_range (120 ,240 ); } - dev =ieee802154_alloc_device (sizeof (*lp), &at86rf230_ops); -if (!dev) + hw =ieee802154_alloc_hw (sizeof (*lp), &at86rf230_ops); +if (!hw)return -ENOMEM ; - lp = dev->priv; - lp->dev = dev; + lp = hw->priv; + lp->hw = hw; lp->spi = spi; - dev->parent = &spi->dev; + hw->parent = &spi->dev; lp->regmap =devm_regmap_init_spi (spi, &at86rf230_regmap_spi_config);if (IS_ERR (lp->regmap)) {
@@ -1564,14 +1564,14 @@ static int at86rf230_probe(struct spi_device *spi)if (rc) goto free_dev; - rc =ieee802154_register_device (lp->dev); + rc =ieee802154_register_hw (lp->hw);if (rc) goto free_dev;return rc; free_dev: -ieee802154_free_device (lp->dev); +ieee802154_free_hw (lp->hw);return rc; }
@@ -1582,8 +1582,8 @@ static int at86rf230_remove(struct spi_device *spi)/* mask all at86rf230 irq's */ at86rf230_write_subreg (lp,SR_IRQ_MASK ,0 ); -ieee802154_unregister_device (lp->dev); -ieee802154_free_device (lp->dev); +ieee802154_unregister_hw (lp->hw); +ieee802154_free_hw (lp->hw);dev_dbg (&spi->dev,"unregistered at86rf230\n" );return 0 ;
drivers/net/ieee802154/cc2520.c +25 -25
122 lines not on this page · raw message
drivers/net/ieee802154/fakelb.c +39 -39
174 lines not on this page · raw message
drivers/net/ieee802154/mrf24j40.c +24 -24
127 lines not on this page · raw message
include/net/mac802154.h +22 -22
66 lines not on this page · raw message
net/mac802154/ieee802154_i.h +1 -1
@@ -27,7 +27,7 @@/* mac802154 device private data */ struct mac802154_priv { -struct ieee802154_dev hw; +struct ieee802154_hw hw;struct ieee802154_ops *ops;/* ieee802154 phy */
net/mac802154/main.c +17 -17
@@ -235,8 +235,8 @@ static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)return priv->ops->set_frame_retries (&priv->hw, retries); } -struct ieee802154_dev * -ieee802154_alloc_device (size_t priv_data_len,struct ieee802154_ops *ops) +struct ieee802154_hw * +ieee802154_alloc_hw (size_t priv_data_len,struct ieee802154_ops *ops) {struct wpan_phy *phy;struct mac802154_priv *priv;
@@ -285,9 +285,9 @@ ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops)return &priv->hw; } -EXPORT_SYMBOL (ieee802154_alloc_device); +EXPORT_SYMBOL (ieee802154_alloc_hw); -void ieee802154_free_device (struct ieee802154_dev *hw) +void ieee802154_free_hw (struct ieee802154_hw *hw) {struct mac802154_priv *priv =mac802154_to_priv (hw);
@@ -297,49 +297,49 @@ void ieee802154_free_device(struct ieee802154_dev *hw)wpan_phy_free (priv->phy); } -EXPORT_SYMBOL (ieee802154_free_device); +EXPORT_SYMBOL (ieee802154_free_hw); -int ieee802154_register_device (struct ieee802154_dev *dev) +int ieee802154_register_hw (struct ieee802154_hw *hw) { -struct mac802154_priv *priv =mac802154_to_priv (dev); +struct mac802154_priv *priv =mac802154_to_priv (hw);int rc = -ENOSYS ; -if (dev->flags &IEEE802154_HW_TXPOWER ) { +if (hw->flags &IEEE802154_HW_TXPOWER ) {if (!priv->ops->set_txpower) goto out; priv->phy->set_txpower = mac802154_set_txpower; } -if (dev->flags &IEEE802154_HW_LBT ) { +if (hw->flags &IEEE802154_HW_LBT ) {if (!priv->ops->set_lbt) goto out; priv->phy->set_lbt = mac802154_set_lbt; } -if (dev->flags &IEEE802154_HW_CCA_MODE ) { +if (hw->flags &IEEE802154_HW_CCA_MODE ) {if (!priv->ops->set_cca_mode) goto out; priv->phy->set_cca_mode = mac802154_set_cca_mode; } -if (dev->flags &IEEE802154_HW_CCA_ED_LEVEL ) { +if (hw->flags &IEEE802154_HW_CCA_ED_LEVEL ) {if (!priv->ops->set_cca_ed_level) goto out; priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level; } -if (dev->flags &IEEE802154_HW_CSMA_PARAMS ) { +if (hw->flags &IEEE802154_HW_CSMA_PARAMS ) {if (!priv->ops->set_csma_params) goto out; priv->phy->set_csma_params = mac802154_set_csma_params; } -if (dev->flags &IEEE802154_HW_FRAME_RETRIES ) { +if (hw->flags &IEEE802154_HW_FRAME_RETRIES ) {if (!priv->ops->set_frame_retries) goto out;
@@ -377,11 +377,11 @@ out_wq: out:return rc; } -EXPORT_SYMBOL (ieee802154_register_device); +EXPORT_SYMBOL (ieee802154_register_hw); -void ieee802154_unregister_device (struct ieee802154_dev *dev) +void ieee802154_unregister_hw (struct ieee802154_hw *hw) { -struct mac802154_priv *priv =mac802154_to_priv (dev); +struct mac802154_priv *priv =mac802154_to_priv (hw);struct mac802154_sub_if_data *sdata, *next;flush_workqueue (priv->dev_workqueue);
@@ -405,7 +405,7 @@ void ieee802154_unregister_device(struct ieee802154_dev *dev)wpan_phy_unregister (priv->phy); } -EXPORT_SYMBOL (ieee802154_unregister_device); +EXPORT_SYMBOL (ieee802154_unregister_hw);MODULE_DESCRIPTION ("IEEE 802.15.4 implementation" );MODULE_LICENSE ("GPL v2" );
net/mac802154/rx.c +6 -6
@@ -42,12 +42,12 @@struct rx_work {struct sk_buff *skb;struct work_struct work; -struct ieee802154_dev *dev; +struct ieee802154_hw *hw;u8 lqi; };static void -mac802154_subif_rx (struct ieee802154_dev *hw,struct sk_buff *skb,u8 lqi) +mac802154_subif_rx (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) {struct mac802154_priv *priv =mac802154_to_priv (hw);
@@ -83,14 +83,14 @@ static void mac802154_rx_worker(struct work_struct *work) { struct rx_work *rw = container_of(work, struct rx_work, work); -mac802154_subif_rx (rw->dev, rw->skb, rw->lqi); +mac802154_subif_rx (rw->hw, rw->skb, rw->lqi);kfree (rw); }void -ieee802154_rx_irqsafe (struct ieee802154_dev *dev,struct sk_buff *skb,u8 lqi) +ieee802154_rx_irqsafe (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) { -struct mac802154_priv *priv =mac802154_to_priv (dev); +struct mac802154_priv *priv =mac802154_to_priv (hw);struct rx_work *work;if (!skb)
@@ -102,7 +102,7 @@ ieee802154_rx_irqsafe(struct ieee802154_dev *dev, struct sk_buff *skb, u8 lqi)INIT_WORK (&work->work, mac802154_rx_worker); work->skb = skb; - work->dev = dev; + work->hw = hw; work->lqi = lqi;queue_work (priv->dev_workqueue, &work->work);
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 3/10 mac802154: rename mac802154_priv to ieee802154_local
In reply to Alexander AringThis patch rename the mac802154_priv to ieee802154_local. The mac802154_priv structure is like ieee80211_local and so we name it ieee802154_local.
--- net/mac802154/ieee802154_i.h | 12 +-- net/mac802154/iface.c | 4 +- net/mac802154/main.c | 172 +++++++++++++++++++++---------------------- net/mac802154/mib.c | 21 +++--- net/mac802154/monitor.c | 4 +- net/mac802154/rx.c | 12 +-- net/mac802154/tx.c | 36 ++++----- 7 files changed, 130 insertions(+), 131 deletions(-)
net/mac802154/ieee802154_i.h +6 -6
@@ -26,7 +26,7 @@#include "llsec.h" /* mac802154 device private data */ -struct mac802154_priv { +struct ieee802154_local {struct ieee802154_hw hw;struct ieee802154_ops *ops;
@@ -69,7 +69,7 @@ struct mac802154_priv {struct mac802154_sub_if_data {struct list_head list;/* the ieee802154_priv->slaves list */ -struct mac802154_priv *hw; +struct ieee802154_local *hw;struct net_device *dev;int type;
@@ -99,7 +99,7 @@ struct mac802154_sub_if_data {struct mac802154_llsec sec; }; -#define mac802154_to_priv (_hw) container_of(_hw, struct mac802154_priv, hw) +#define mac802154_to_priv (_hw) container_of(_hw, struct ieee802154_local, hw)#define MAC802154_CHAN_NONE 0xff/* No channel is assigned */
@@ -109,13 +109,13 @@ 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_monitors_rx (struct mac802154_priv *priv,struct sk_buff *skb); +void mac802154_monitors_rx (struct ieee802154_local *local,struct sk_buff *skb);void mac802154_monitor_setup (struct net_device *dev); -void mac802154_wpans_rx (struct mac802154_priv *priv,struct sk_buff *skb); +void mac802154_wpans_rx (struct ieee802154_local *local,struct sk_buff *skb);void mac802154_wpan_setup (struct net_device *dev); -netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb, +netdev_tx_t mac802154_tx (struct ieee802154_local *local,struct sk_buff *skb,u8 page,u8 chan);/* MIB callbacks */
net/mac802154/iface.c +2 -2
@@ -565,7 +565,7 @@ static int mac802154_parse_frame_start(struct sk_buff *skb,return 0 ; } -void mac802154_wpans_rx (struct mac802154_priv *priv,struct sk_buff *skb) +void mac802154_wpans_rx (struct ieee802154_local *local,struct sk_buff *skb) {int ret;struct mac802154_sub_if_data *sdata;
@@ -579,7 +579,7 @@ void mac802154_wpans_rx(struct mac802154_priv *priv, struct sk_buff *skb) }rcu_read_lock (); -list_for_each_entry_rcu (sdata, &priv->slaves, list) { +list_for_each_entry_rcu (sdata, &local->slaves, list) {if (sdata->type !=IEEE802154_DEV_WPAN || !netif_running (sdata->dev))continue ;
net/mac802154/main.c +86 -86
367 lines not on this page · raw message
net/mac802154/mib.c +10 -11
@@ -36,7 +36,7 @@ struct hw_addr_filt_notify_work {unsigned long changed; }; -static struct mac802154_priv *mac802154_slave_get_priv (struct net_device *dev) +static struct ieee802154_local *mac802154_slave_get_priv (struct net_device *dev) {struct mac802154_sub_if_data *priv =netdev_priv (dev);
@@ -49,12 +49,11 @@ static void hw_addr_notify(struct work_struct *work) {struct hw_addr_filt_notify_work *nw =container_of (work, struct hw_addr_filt_notify_work, work); -struct mac802154_priv *hw =mac802154_slave_get_priv (nw->dev); +struct ieee802154_local *local =mac802154_slave_get_priv (nw->dev);int res; - res = hw->ops->set_hw_addr_filt (&hw->hw, - &hw->hw.hw_filt, - nw->changed); + res = local->ops->set_hw_addr_filt (&local->hw, &local->hw.hw_filt, + nw->changed);if (res)pr_debug ("failed changed mask %lx\n" , nw->changed);
@@ -110,13 +109,13 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)void mac802154_dev_set_ieee_addr (struct net_device *dev) {struct mac802154_sub_if_data *priv =netdev_priv (dev); -struct mac802154_priv *mac = priv->hw; +struct ieee802154_local *local = priv->hw; priv->extended_addr =ieee802154_devaddr_from_raw (dev->dev_addr); -if (mac->ops->set_hw_addr_filt && - mac->hw.hw_filt.ieee_addr != priv->extended_addr) { - mac->hw.hw_filt.ieee_addr = priv->extended_addr; +if (local->ops->set_hw_addr_filt && + local->hw.hw_filt.ieee_addr != priv->extended_addr) { + local->hw.hw_filt.ieee_addr = priv->extended_addr;set_hw_addr_filt (dev,IEEE802154_AFILT_IEEEADDR_CHANGED ); } }
@@ -165,12 +164,12 @@ 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 mac802154_priv *hw =mac802154_slave_get_priv (nw->dev); +struct ieee802154_local *local =mac802154_slave_get_priv (nw->dev);struct mac802154_sub_if_data *priv =netdev_priv (nw->dev);int res;mutex_lock (&priv->hw->phy->pib_lock); - res = hw->ops->set_channel (&hw->hw, priv->page, priv->chan); + res = local->ops->set_channel (&local->hw, priv->page, priv->chan);if (res) {pr_debug ("set_channel failed\n" ); }else {
net/mac802154/monitor.c +2 -2
@@ -57,7 +57,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, } -void mac802154_monitors_rx (struct mac802154_priv *priv,struct sk_buff *skb) +void mac802154_monitors_rx (struct ieee802154_local *local,struct sk_buff *skb) {struct sk_buff *skb2;struct mac802154_sub_if_data *sdata;
@@ -65,7 +65,7 @@ void mac802154_monitors_rx(struct mac802154_priv *priv, struct sk_buff *skb)u8 *data;rcu_read_lock (); -list_for_each_entry_rcu (sdata, &priv->slaves, list) { +list_for_each_entry_rcu (sdata, &local->slaves, list) {if (sdata->type !=IEEE802154_DEV_MONITOR || !netif_running (sdata->dev))continue ;
net/mac802154/rx.c +6 -6
@@ -49,13 +49,13 @@ struct rx_work {static void mac802154_subif_rx (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) { -struct mac802154_priv *priv =mac802154_to_priv (hw); +struct ieee802154_local *local =mac802154_to_priv (hw);mac_cb (skb)->lqi = lqi; skb->protocol =htons (ETH_P_IEEE802154 );skb_reset_mac_header (skb); -if (!(priv->hw.flags &IEEE802154_HW_OMIT_CKSUM )) { +if (!(local->hw.flags &IEEE802154_HW_OMIT_CKSUM )) {u16 crc;if (skb->len <2 ) {
@@ -70,8 +70,8 @@ mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)skb_trim (skb, skb->len -2 );/* CRC */ } -mac802154_monitors_rx (priv, skb); -mac802154_wpans_rx (priv, skb); +mac802154_monitors_rx (local, skb); +mac802154_wpans_rx (local, skb);return ;
@@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work)void ieee802154_rx_irqsafe (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) { -struct mac802154_priv *priv =mac802154_to_priv (hw); +struct ieee802154_local *local =mac802154_to_priv (hw);struct rx_work *work;if (!skb)
@@ -105,6 +105,6 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) work->hw = hw; work->lqi = lqi; -queue_work (priv->dev_workqueue, &work->work); +queue_work (local->dev_workqueue, &work->work); }EXPORT_SYMBOL (ieee802154_rx_irqsafe);
net/mac802154/tx.c +18 -18
@@ -33,7 +33,7 @@struct xmit_work {struct sk_buff *skb;struct work_struct work; -struct mac802154_priv *priv; +struct ieee802154_local *local;u8 chan;u8 page; };
@@ -44,10 +44,10 @@ static void mac802154_xmit_worker(struct work_struct *work)struct mac802154_sub_if_data *sdata;int res; -mutex_lock (&xw->priv->phy->pib_lock); -if (xw->priv->phy->current_channel != xw->chan || - xw->priv->phy->current_page != xw->page) { - res = xw->priv->ops->set_channel (&xw->priv->hw, +mutex_lock (&xw->local->phy->pib_lock); +if (xw->local->phy->current_channel != xw->chan || + xw->local->phy->current_page != xw->page) { + res = xw->local->ops->set_channel (&xw->local->hw, xw->page, xw->chan);if (res) {
@@ -55,20 +55,20 @@ static void mac802154_xmit_worker(struct work_struct *work) goto out; } - xw->priv->phy->current_channel = xw->chan; - xw->priv->phy->current_page = xw->page; + xw->local->phy->current_channel = xw->chan; + xw->local->phy->current_page = xw->page; } - res = xw->priv->ops->xmit (&xw->priv->hw, xw->skb); + res = xw->local->ops->xmit (&xw->local->hw, xw->skb);if (res)pr_debug ("transmission failed\n" ); out: -mutex_unlock (&xw->priv->phy->pib_lock); +mutex_unlock (&xw->local->phy->pib_lock);/* Restart the netif queue on each sub_if_data object. */ rcu_read_lock (); -list_for_each_entry_rcu (sdata, &xw->priv->slaves, list) +list_for_each_entry_rcu (sdata, &xw->local->slaves, list)netif_wake_queue (sdata->dev);rcu_read_unlock ();
@@ -77,20 +77,20 @@ out:kfree (xw); } -netdev_tx_t mac802154_tx (struct mac802154_priv *priv,struct sk_buff *skb, +netdev_tx_t mac802154_tx (struct ieee802154_local *local,struct sk_buff *skb,u8 page,u8 chan) {struct xmit_work *work;struct mac802154_sub_if_data *sdata; -if (!(priv->phy->channels_supported[page] & (1 << chan))) { +if (!(local->phy->channels_supported[page] & (1 << chan))) {WARN_ON (1 ); goto err_tx; } -mac802154_monitors_rx (mac802154_to_priv (&priv->hw), skb); +mac802154_monitors_rx (mac802154_to_priv (&local->hw), skb); -if (!(priv->hw.flags &IEEE802154_HW_OMIT_CKSUM )) { +if (!(local->hw.flags &IEEE802154_HW_OMIT_CKSUM )) {u16 crc =crc_ccitt (0 , skb->data, skb->len);u8 *data =skb_put (skb,2 );
@@ -98,7 +98,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, data[1 ] = crc >>8 ; } -if (skb_cow_head (skb, priv->hw.extra_tx_headroom)) +if (skb_cow_head (skb, local->hw.extra_tx_headroom)) goto err_tx; work =kzalloc (sizeof (*work),GFP_ATOMIC );
@@ -109,17 +109,17 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb,/* Stop the netif queue on each sub_if_data object. */ rcu_read_lock (); -list_for_each_entry_rcu (sdata, &priv->slaves, list) +list_for_each_entry_rcu (sdata, &local->slaves, list)netif_stop_queue (sdata->dev);rcu_read_unlock ();INIT_WORK (&work->work, mac802154_xmit_worker); work->skb = skb; - work->priv = priv; + work->local = local; work->page = page; work->chan = chan; -queue_work (priv->dev_workqueue, &work->work); +queue_work (local->dev_workqueue, &work->work);return NETDEV_TX_OK ;
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 4/10 mac802154: rename mac802154_sub_if_data
In reply to Alexander AringLike wireless this structure should named ieee802154_sub_if_data and not mac802154_sub_if_data. This patch renames the struct and variables to sdata instead priv sometimes.
--- net/mac802154/ieee802154_i.h | 2 +- net/mac802154/iface.c | 137 +++++++++++++++--------------- net/mac802154/mac_cmd.c | 4 +- net/mac802154/main.c | 54 ++++++------ net/mac802154/mib.c | 192 +++++++++++++++++++++---------------------- net/mac802154/monitor.c | 22 ++--- net/mac802154/tx.c | 4 +- 7 files changed, 208 insertions(+), 207 deletions(-)
net/mac802154/ieee802154_i.h +1 -1
@@ -66,7 +66,7 @@ struct ieee802154_local {* Each ieee802154 device/transceiver may have several slaves and able * to be associated with several networks at the same time. */ -struct mac802154_sub_if_data { +struct ieee802154_sub_if_data {struct list_head list;/* the ieee802154_priv->slaves list */ struct ieee802154_local *hw;
net/mac802154/iface.c +69 -68
323 lines not on this page · raw message
net/mac802154/mac_cmd.c +2 -2
@@ -75,11 +75,11 @@ static int mac802154_mlme_start_req(struct net_device *dev,static struct wpan_phy *mac802154_get_phy (const struct net_device *dev) { -struct mac802154_sub_if_data *priv =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =netdev_priv (dev);BUG_ON (dev->type !=ARPHRD_IEEE802154 ); -return to_phy (get_device (&priv->hw->phy->dev)); +return to_phy (get_device (&sdata->hw->phy->dev)); }static struct ieee802154_llsec_ops mac802154_llsec_ops = {
net/mac802154/main.c +27 -27
126 lines not on this page · raw message
net/mac802154/mib.c +96 -96
421 lines not on this page · raw message
net/mac802154/monitor.c +11 -11
@@ -33,14 +33,14 @@static netdev_tx_t mac802154_monitor_xmit (struct sk_buff *skb,struct net_device *dev) { -struct mac802154_sub_if_data *priv; +struct ieee802154_sub_if_data *sdata;u8 chan, page; - priv =netdev_priv (dev); + sdata =netdev_priv (dev);/* FIXME: locking */ - chan = priv->hw->phy->current_channel; - page = priv->hw->phy->current_page; + chan = sdata->hw->phy->current_channel; + page = sdata->hw->phy->current_page;if (chan ==MAC802154_CHAN_NONE )/* not initialized */ return NETDEV_TX_OK ;
@@ -53,14 +53,14 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; -return mac802154_tx (priv->hw, skb, page, chan); +return mac802154_tx (sdata->hw, skb, page, chan); }void mac802154_monitors_rx (struct ieee802154_local *local,struct sk_buff *skb) {struct sk_buff *skb2; -struct mac802154_sub_if_data *sdata; +struct ieee802154_sub_if_data *sdata;u16 crc =crc_ccitt (0 , skb->data, skb->len);u8 *data;
@@ -90,7 +90,7 @@ static const struct net_device_ops mac802154_monitor_ops = {void mac802154_monitor_setup (struct net_device *dev) { -struct mac802154_sub_if_data *priv; +struct ieee802154_sub_if_data *sdata; dev->addr_len =0 ; dev->hard_header_len =0 ;
@@ -105,9 +105,9 @@ void mac802154_monitor_setup(struct net_device *dev) dev->netdev_ops = &mac802154_monitor_ops; dev->ml_priv = &mac802154_mlme_reduced; - priv =netdev_priv (dev); - priv->type =IEEE802154_DEV_MONITOR ; + sdata =netdev_priv (dev); + sdata->type =IEEE802154_DEV_MONITOR ; - priv->chan =MAC802154_CHAN_NONE ;/* not initialized */ - priv->page =0 ; + sdata->chan =MAC802154_CHAN_NONE ;/* not initialized */ + sdata->page =0 ; }
net/mac802154/tx.c +2 -2
@@ -41,7 +41,7 @@ struct xmit_work {static void mac802154_xmit_worker (struct work_struct *work) { struct xmit_work *xw = container_of(work, struct xmit_work, work); -struct mac802154_sub_if_data *sdata; +struct ieee802154_sub_if_data *sdata;int res;mutex_lock (&xw->local->phy->pib_lock);
@@ -81,7 +81,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb, u8 page, u8 chan) {struct xmit_work *work; -struct mac802154_sub_if_data *sdata; +struct ieee802154_sub_if_data *sdata;if (!(local->phy->channels_supported[page] & (1 << chan))) {WARN_ON (1 );
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 5/10 mac802154: rename hw subif_data variable to local
In reply to Alexander AringThis patch renames the hw attribute in struct ieee802154_sub_if_data to local. This avoid confusing with the struct ieee802154_hw hw; inside of local struct.
--- net/mac802154/ieee802154_i.h | 2 +- net/mac802154/iface.c | 12 ++++++------ net/mac802154/mac_cmd.c | 2 +- net/mac802154/main.c | 34 +++++++++++++++++----------------- net/mac802154/mib.c | 38 +++++++++++++++++++------------------- net/mac802154/monitor.c | 6 +++--- 6 files changed, 47 insertions(+), 47 deletions(-)
net/mac802154/ieee802154_i.h +1 -1
@@ -69,7 +69,7 @@ struct ieee802154_local {struct ieee802154_sub_if_data {struct list_head list;/* the ieee802154_priv->slaves list */ -struct ieee802154_local *hw; +struct ieee802154_local *local;struct net_device *dev;int type;
net/mac802154/iface.c +6 -6
@@ -125,9 +125,9 @@ int mac802154_set_mac_params(struct net_device *dev, {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx); sdata->mac_params = *params; -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);return 0 ; }
@@ -137,16 +137,16 @@ void mac802154_get_mac_params(struct net_device *dev, {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx); *params = sdata->mac_params; -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx); }static int mac802154_wpan_open (struct net_device *dev) {int rc;struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -struct wpan_phy *phy = sdata->hw->phy; +struct wpan_phy *phy = sdata->local->phy; rc =mac802154_slave_open (dev);if (rc <0 )
@@ -339,7 +339,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; -return mac802154_tx (sdata->hw, skb, page, chan); +return mac802154_tx (sdata->local, skb, page, chan); }static struct header_ops mac802154_header_ops = {
net/mac802154/mac_cmd.c +1 -1
@@ -79,7 +79,7 @@ static struct wpan_phy *mac802154_get_phy(const struct net_device *dev)BUG_ON (dev->type !=ARPHRD_IEEE802154 ); -return to_phy (get_device (&sdata->hw->phy->dev)); +return to_phy (get_device (&sdata->local->phy->dev)); }static struct ieee802154_llsec_ops mac802154_llsec_ops = {
net/mac802154/main.c +17 -17
@@ -33,26 +33,26 @@ int mac802154_slave_open(struct net_device *dev) {struct ieee802154_sub_if_data *sdata =netdev_priv (dev);struct ieee802154_sub_if_data *subif; -struct ieee802154_local *local = sdata->hw; +struct ieee802154_local *local = sdata->local;int res =0 ;ASSERT_RTNL ();if (sdata->type ==IEEE802154_DEV_WPAN ) { -mutex_lock (&sdata->hw->slaves_mtx); -list_for_each_entry (subif, &sdata->hw->slaves, list) { +mutex_lock (&sdata->local->slaves_mtx); +list_for_each_entry (subif, &sdata->local->slaves, list) {if (subif != sdata && subif->type == sdata->type && subif->running) { -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);return -EBUSY ; } } -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx); } -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx); sdata->running = true; -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);if (local->open_count++ ==0 ) { res = local->ops->start (&local->hw);
@@ -74,7 +74,7 @@ int mac802154_slave_open(struct net_device *dev)netif_start_queue (dev);return 0 ; err: - sdata->hw->open_count--; + sdata->local->open_count--;return res; }
@@ -82,15 +82,15 @@ err:int mac802154_slave_close (struct net_device *dev) {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -struct ieee802154_local *local = sdata->hw; +struct ieee802154_local *local = sdata->local;ASSERT_RTNL ();netif_stop_queue (dev); -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx); sdata->running = false; -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);if (!--local->open_count) local->ops->stop (&local->hw);
@@ -109,7 +109,7 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev) sdata =netdev_priv (dev); sdata->dev = dev; - sdata->hw = local; + sdata->local = local; dev->needed_headroom = local->hw.extra_tx_headroom;
@@ -144,11 +144,11 @@ mac802154_del_iface(struct wpan_phy *phy, struct net_device *dev) sdata =netdev_priv (dev); -BUG_ON (sdata->hw->phy != phy); +BUG_ON (sdata->local->phy != phy); -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx);list_del_rcu (&sdata->list); -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);synchronize_rcu ();unregister_netdevice (sdata->dev);
@@ -394,9 +394,9 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)mutex_unlock (&local->slaves_mtx);list_for_each_entry_safe (sdata, next, &local->slaves, list) { -mutex_lock (&sdata->hw->slaves_mtx); +mutex_lock (&sdata->local->slaves_mtx);list_del (&sdata->list); -mutex_unlock (&sdata->hw->slaves_mtx); +mutex_unlock (&sdata->local->slaves_mtx);unregister_netdevice (sdata->dev); }
net/mac802154/mib.c +19 -19
@@ -42,7 +42,7 @@ static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)BUG_ON (dev->type !=ARPHRD_IEEE802154 ); -return sdata->hw; +return sdata->local; }static void hw_addr_notify (struct work_struct *work)
@@ -72,7 +72,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)INIT_WORK (&work->work, hw_addr_notify); work->dev = dev; work->changed = changed; -queue_work (sdata->hw->dev_workqueue, &work->work); +queue_work (sdata->local->dev_workqueue, &work->work); }void mac802154_dev_set_short_addr (struct net_device *dev,__le16 val)
@@ -85,9 +85,9 @@ void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val) sdata->short_addr = val;spin_unlock_bh (&sdata->mib_lock); -if ((sdata->hw->ops->set_hw_addr_filt) && - (sdata->hw->hw.hw_filt.short_addr != sdata->short_addr)) { - sdata->hw->hw.hw_filt.short_addr = sdata->short_addr; +if ((sdata->local->ops->set_hw_addr_filt) && + (sdata->local->hw.hw_filt.short_addr != sdata->short_addr)) { + sdata->local->hw.hw_filt.short_addr = sdata->short_addr;set_hw_addr_filt (dev,IEEE802154_AFILT_SADDR_CHANGED ); } }
@@ -109,7 +109,7 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)void mac802154_dev_set_ieee_addr (struct net_device *dev) {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -struct ieee802154_local *local = sdata->hw; +struct ieee802154_local *local = sdata->local; sdata->extended_addr =ieee802154_devaddr_from_raw (dev->dev_addr);
@@ -144,9 +144,9 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val) sdata->pan_id = val;spin_unlock_bh (&sdata->mib_lock); -if ((sdata->hw->ops->set_hw_addr_filt) && - (sdata->hw->hw.hw_filt.pan_id != sdata->pan_id)) { - sdata->hw->hw.hw_filt.pan_id = sdata->pan_id; +if ((sdata->local->ops->set_hw_addr_filt) && + (sdata->local->hw.hw_filt.pan_id != sdata->pan_id)) { + sdata->local->hw.hw_filt.pan_id = sdata->pan_id;set_hw_addr_filt (dev,IEEE802154_AFILT_PANID_CHANGED ); } }
@@ -168,15 +168,15 @@ static void phy_chan_notify(struct work_struct *work)struct ieee802154_sub_if_data *sdata =netdev_priv (nw->dev);int res; -mutex_lock (&sdata->hw->phy->pib_lock); +mutex_lock (&sdata->local->phy->pib_lock); res = local->ops->set_channel (&local->hw, sdata->page, sdata->chan);if (res) {pr_debug ("set_channel failed\n" ); }else { - sdata->hw->phy->current_channel = sdata->chan; - sdata->hw->phy->current_page = sdata->page; + sdata->local->phy->current_channel = sdata->chan; + sdata->local->phy->current_page = sdata->page; } -mutex_unlock (&sdata->hw->phy->pib_lock); +mutex_unlock (&sdata->local->phy->pib_lock);kfree (nw); }
@@ -193,10 +193,10 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan) sdata->chan = chan;spin_unlock_bh (&sdata->mib_lock); -mutex_lock (&sdata->hw->phy->pib_lock); -if (sdata->hw->phy->current_channel != sdata->chan || - sdata->hw->phy->current_page != sdata->page) { -mutex_unlock (&sdata->hw->phy->pib_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)
@@ -204,9 +204,9 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)INIT_WORK (&work->work, phy_chan_notify); work->dev = dev; -queue_work (sdata->hw->dev_workqueue, &work->work); +queue_work (sdata->local->dev_workqueue, &work->work); }else { -mutex_unlock (&sdata->hw->phy->pib_lock); +mutex_unlock (&sdata->local->phy->pib_lock); } }
net/mac802154/monitor.c +3 -3
@@ -39,8 +39,8 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, sdata =netdev_priv (dev);/* FIXME: locking */ - chan = sdata->hw->phy->current_channel; - page = sdata->hw->phy->current_page; + chan = sdata->local->phy->current_channel; + page = sdata->local->phy->current_page;if (chan ==MAC802154_CHAN_NONE )/* not initialized */ return NETDEV_TX_OK ;
@@ -53,7 +53,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, dev->stats.tx_packets++; dev->stats.tx_bytes += skb->len; -return mac802154_tx (sdata->hw, skb, page, chan); +return mac802154_tx (sdata->local, skb, page, chan); }
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 6/10 mac802154: rename sdata slaves and slaves_mtx
In reply to Alexander AringThis patch renamens the slaves attribute in sdata to interfaces and slaves_mtx to iflist_mtx. This is similar like the mac80211 stack naming convention.
--- net/mac802154/ieee802154_i.h | 4 ++-- net/mac802154/iface.c | 10 ++++---- net/mac802154/main.c | 54 ++++++++++++++++++++++---------------------- net/mac802154/monitor.c | 2 +- net/mac802154/tx.c | 4 ++-- 5 files changed, 37 insertions(+), 37 deletions(-)
net/mac802154/ieee802154_i.h +2 -2
@@ -42,8 +42,8 @@ struct ieee802154_local {* * So atomic readers can use any of this protection methods. */ -struct list_head slaves; -struct mutex slaves_mtx; +struct list_head interfaces; +struct mutex iflist_mtx;/* This one is used for scanning and other jobs not to be interfered * with serial driver.
net/mac802154/iface.c +5 -5
@@ -125,9 +125,9 @@ int mac802154_set_mac_params(struct net_device *dev, {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -mutex_lock (&sdata->local->slaves_mtx); +mutex_lock (&sdata->local->iflist_mtx); sdata->mac_params = *params; -mutex_unlock (&sdata->local->slaves_mtx); +mutex_unlock (&sdata->local->iflist_mtx);return 0 ; }
@@ -137,9 +137,9 @@ void mac802154_get_mac_params(struct net_device *dev, {struct ieee802154_sub_if_data *sdata =netdev_priv (dev); -mutex_lock (&sdata->local->slaves_mtx); +mutex_lock (&sdata->local->iflist_mtx); *params = sdata->mac_params; -mutex_unlock (&sdata->local->slaves_mtx); +mutex_unlock (&sdata->local->iflist_mtx); }static int mac802154_wpan_open (struct net_device *dev)
@@ -580,7 +580,7 @@ void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb) }rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->slaves, list) { +list_for_each_entry_rcu (sdata, &local->interfaces, list) {if (sdata->type !=IEEE802154_DEV_WPAN || !netif_running (sdata->dev))continue ;
net/mac802154/main.c +27 -27
126 lines not on this page · raw message
net/mac802154/monitor.c +1 -1
@@ -65,7 +65,7 @@ void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)u8 *data;rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->slaves, list) { +list_for_each_entry_rcu (sdata, &local->interfaces, list) {if (sdata->type !=IEEE802154_DEV_MONITOR || !netif_running (sdata->dev))continue ;
net/mac802154/tx.c +2 -2
@@ -68,7 +68,7 @@ out:/* Restart the netif queue on each sub_if_data object. */ rcu_read_lock (); -list_for_each_entry_rcu (sdata, &xw->local->slaves, list) +list_for_each_entry_rcu (sdata, &xw->local->interfaces, list)netif_wake_queue (sdata->dev);rcu_read_unlock ();
@@ -109,7 +109,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,/* Stop the netif queue on each sub_if_data object. */ rcu_read_lock (); -list_for_each_entry_rcu (sdata, &local->slaves, list) +list_for_each_entry_rcu (sdata, &local->interfaces, list)netif_stop_queue (sdata->dev);rcu_read_unlock ();
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 7/10 mac802154: introduce hw_to_local function
In reply to Alexander AringThis patch replace the mac802154_to_priv macro with a static inline function named hw_to_local. This brings a similar naming convention like mac80211 stack.
--- net/mac802154/ieee802154_i.h | 8 ++++++-- net/mac802154/main.c | 6 +++--- net/mac802154/rx.c | 4 ++-- net/mac802154/tx.c | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-)
net/mac802154/ieee802154_i.h +6 -2
@@ -99,10 +99,14 @@ struct ieee802154_sub_if_data {struct mac802154_llsec sec; }; -#define mac802154_to_priv (_hw) container_of(_hw, struct ieee802154_local, hw) -#define MAC802154_CHAN_NONE 0xff/* No channel is assigned */ +static inline struct ieee802154_local * +hw_to_local (struct ieee802154_hw *hw) +{ + return container_of(hw, struct ieee802154_local, hw); +} +extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
net/mac802154/main.c +3 -3
@@ -289,7 +289,7 @@ EXPORT_SYMBOL(ieee802154_alloc_hw);void ieee802154_free_hw (struct ieee802154_hw *hw) { -struct ieee802154_local *local =mac802154_to_priv (hw); +struct ieee802154_local *local =hw_to_local (hw);BUG_ON (!list_empty (&local->interfaces));
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(ieee802154_free_hw);int ieee802154_register_hw (struct ieee802154_hw *hw) { -struct ieee802154_local *local =mac802154_to_priv (hw); +struct ieee802154_local *local =hw_to_local (hw);int rc = -ENOSYS ;if (hw->flags &IEEE802154_HW_TXPOWER ) {
@@ -381,7 +381,7 @@ EXPORT_SYMBOL(ieee802154_register_hw);void ieee802154_unregister_hw (struct ieee802154_hw *hw) { -struct ieee802154_local *local =mac802154_to_priv (hw); +struct ieee802154_local *local =hw_to_local (hw);struct ieee802154_sub_if_data *sdata, *next;flush_workqueue (local->dev_workqueue);
net/mac802154/rx.c +2 -2
@@ -49,7 +49,7 @@ struct rx_work {static void mac802154_subif_rx (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) { -struct ieee802154_local *local =mac802154_to_priv (hw); +struct ieee802154_local *local =hw_to_local (hw);mac_cb (skb)->lqi = lqi; skb->protocol =htons (ETH_P_IEEE802154 );
@@ -90,7 +90,7 @@ static void mac802154_rx_worker(struct work_struct *work)void ieee802154_rx_irqsafe (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi) { -struct ieee802154_local *local =mac802154_to_priv (hw); +struct ieee802154_local *local =hw_to_local (hw);struct rx_work *work;if (!skb)
net/mac802154/tx.c +1 -1
@@ -88,7 +88,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb, goto err_tx; } -mac802154_monitors_rx (mac802154_to_priv (&local->hw), skb); +mac802154_monitors_rx (local, skb);if (!(local->hw.flags &IEEE802154_HW_OMIT_CKSUM )) {u16 crc =crc_ccitt (0 , skb->data, skb->len);
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 8/10 mac802154: introduce IEEE802154_DEV_TO_SUB_IF
In reply to Alexander AringThis function adds a wrapper to call netdev_priv to getting the sdata attribute. This is similar like the IEEE80211_DEV_TO_SUB_IF function inside wireless stack implementation.
--- net/mac802154/ieee802154_i.h | 6 ++++++ net/mac802154/iface.c | 18 ++++++++-------- net/mac802154/mac_cmd.c | 2 +- net/mac802154/main.c | 11 ++++------ net/mac802154/mib.c | 49 ++++++++++++++++++++++---------------------- net/mac802154/monitor.c | 4 ++-- 6 files changed, 47 insertions(+), 43 deletions(-)
net/mac802154/ieee802154_i.h +6 -0
@@ -107,6 +107,12 @@ hw_to_local(struct ieee802154_hw *hw) return container_of(hw, struct ieee802154_local, hw); } +static inline struct ieee802154_sub_if_data * +IEEE802154_DEV_TO_SUB_IF (const struct net_device *dev) +{ +return netdev_priv (dev); +} +extern struct ieee802154_reduced_mlme_ops mac802154_mlme_reduced;extern struct ieee802154_mlme_ops mac802154_mlme_wpan;
net/mac802154/iface.c +9 -9
@@ -33,7 +33,7 @@static int mac802154_wpan_update_llsec (struct net_device *dev) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct ieee802154_mlme_ops *ops =ieee802154_mlme_ops (dev);int rc =0 ;
@@ -56,7 +56,7 @@ static int mac802154_wpan_update_llsec(struct net_device *dev)static int mac802154_wpan_ioctl (struct net_device *dev,struct ifreq *ifr,int cmd) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct sockaddr_ieee802154 *sa = (struct sockaddr_ieee802154 *)&ifr->ifr_addr;int err = -ENOIOCTLCMD ;
@@ -123,7 +123,7 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)int mac802154_set_mac_params (struct net_device *dev,const struct ieee802154_mac_params *params) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);mutex_lock (&sdata->local->iflist_mtx); sdata->mac_params = *params;
@@ -135,7 +135,7 @@ int mac802154_set_mac_params(struct net_device *dev,void mac802154_get_mac_params (struct net_device *dev,struct ieee802154_mac_params *params) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);mutex_lock (&sdata->local->iflist_mtx); *params = sdata->mac_params;
@@ -145,7 +145,7 @@ void mac802154_get_mac_params(struct net_device *dev,static int mac802154_wpan_open (struct net_device *dev) {int rc; -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct wpan_phy *phy = sdata->local->phy; rc =mac802154_slave_open (dev);
@@ -241,7 +241,7 @@ static int mac802154_header_create(struct sk_buff *skb, unsigned len) {struct ieee802154_hdr hdr; -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct ieee802154_mac_cb *cb =mac_cb (skb);int hlen;
@@ -314,7 +314,7 @@ mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)u8 chan, page;int rc; - sdata =netdev_priv (dev); + sdata =IEEE802154_DEV_TO_SUB_IF (dev);spin_lock_bh (&sdata->mib_lock); chan = sdata->chan;
@@ -357,7 +357,7 @@ static const struct net_device_ops mac802154_wpan_ops = {static void mac802154_wpan_free (struct net_device *dev) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);mac802154_llsec_destroy (&sdata->sec);
@@ -384,7 +384,7 @@ void mac802154_wpan_setup(struct net_device *dev) dev->netdev_ops = &mac802154_wpan_ops; dev->ml_priv = &mac802154_mlme_wpan; - sdata =netdev_priv (dev); + sdata =IEEE802154_DEV_TO_SUB_IF (dev); sdata->type =IEEE802154_DEV_WPAN ; sdata->chan =MAC802154_CHAN_NONE ;
net/mac802154/mac_cmd.c +1 -1
@@ -75,7 +75,7 @@ static int mac802154_mlme_start_req(struct net_device *dev,static struct wpan_phy *mac802154_get_phy (const struct net_device *dev) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);BUG_ON (dev->type !=ARPHRD_IEEE802154 );
net/mac802154/main.c +4 -7
@@ -31,7 +31,7 @@int mac802154_slave_open (struct net_device *dev) { -struct ieee802154_sub_if_data *sdata =netdev_priv (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 ;
@@ -81,7 +81,7 @@ err:int mac802154_slave_close (struct net_device *dev) { -struct ieee802154_sub_if_data *sdata =netdev_priv (dev); +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct ieee802154_local *local = sdata->local;ASSERT_RTNL ();
@@ -101,13 +101,12 @@ int mac802154_slave_close(struct net_device *dev)static int mac802154_netdev_register (struct wpan_phy *phy,struct net_device *dev) { -struct ieee802154_sub_if_data *sdata; +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);struct ieee802154_local *local;int err; local =wpan_phy_priv (phy); - sdata =netdev_priv (dev); sdata->dev = dev; sdata->local = local;
@@ -138,12 +137,10 @@ mac802154_netdev_register(struct wpan_phy *phy, struct net_device *dev)static void mac802154_del_iface (struct wpan_phy *phy,struct net_device *dev) { -struct ieee802154_sub_if_data *sdata; +struct ieee802154_sub_if_data *sdata =IEEE802154_DEV_TO_SUB_IF (dev);ASSERT_RTNL (); - sdata =netdev_priv (dev); -BUG_ON (sdata->local->phy != phy);mutex_lock (&sdata->local->iflist_mtx);
net/mac802154/mib.c +25 -24
187 lines not on this page · raw message
net/mac802154/monitor.c +2 -2
@@ -36,7 +36,7 @@ static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,struct ieee802154_sub_if_data *sdata;u8 chan, page; - sdata =netdev_priv (dev); + sdata =IEEE802154_DEV_TO_SUB_IF (dev);/* FIXME: locking */ chan = sdata->local->phy->current_channel;
@@ -105,7 +105,7 @@ void mac802154_monitor_setup(struct net_device *dev) dev->netdev_ops = &mac802154_monitor_ops; dev->ml_priv = &mac802154_mlme_reduced; - sdata =netdev_priv (dev); + sdata =IEEE802154_DEV_TO_SUB_IF (dev); sdata->type =IEEE802154_DEV_MONITOR ; sdata->chan =MAC802154_CHAN_NONE ;/* not initialized */
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 9/10 mac802154: rename dev_workqueue to workqueue
In reply to Alexander AringSmall rename to use the name workqueue than dev_workqueue. To bring the same naming convention like wireless into 802.15.4.
--- net/mac802154/ieee802154_i.h | 2 +- net/mac802154/main.c | 10 +++++----- net/mac802154/mib.c | 4 ++-- net/mac802154/rx.c | 2 +- net/mac802154/tx.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-)
net/mac802154/ieee802154_i.h +1 -1
@@ -48,7 +48,7 @@ struct ieee802154_local {/* This one is used for scanning and other jobs not to be interfered * with serial driver. */ -struct workqueue_struct *dev_workqueue; +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
net/mac802154/main.c +5 -5
@@ -343,9 +343,9 @@ int ieee802154_register_hw(struct ieee802154_hw *hw) local->phy->set_frame_retries = mac802154_set_frame_retries; } - local->dev_workqueue = + local->workqueue =create_singlethread_workqueue (wpan_phy_name (local->phy)); -if (!local->dev_workqueue) { +if (!local->workqueue) { rc = -ENOMEM ; goto out; }
@@ -370,7 +370,7 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)return 0 ; out_wq: -destroy_workqueue (local->dev_workqueue); +destroy_workqueue (local->workqueue); out:return rc; }
@@ -381,8 +381,8 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw)struct ieee802154_local *local =hw_to_local (hw);struct ieee802154_sub_if_data *sdata, *next; -flush_workqueue (local->dev_workqueue); -destroy_workqueue (local->dev_workqueue); +flush_workqueue (local->workqueue); +destroy_workqueue (local->workqueue);rtnl_lock ();
net/mac802154/mib.c +2 -2
@@ -72,7 +72,7 @@ static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)INIT_WORK (&work->work, hw_addr_notify); work->dev = dev; work->changed = changed; -queue_work (sdata->local->dev_workqueue, &work->work); +queue_work (sdata->local->workqueue, &work->work); }void mac802154_dev_set_short_addr (struct net_device *dev,__le16 val)
@@ -205,7 +205,7 @@ void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)INIT_WORK (&work->work, phy_chan_notify); work->dev = dev; -queue_work (sdata->local->dev_workqueue, &work->work); +queue_work (sdata->local->workqueue, &work->work); }else {mutex_unlock (&sdata->local->phy->pib_lock); }
net/mac802154/rx.c +1 -1
@@ -105,6 +105,6 @@ ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi) work->hw = hw; work->lqi = lqi; -queue_work (local->dev_workqueue, &work->work); +queue_work (local->workqueue, &work->work); }EXPORT_SYMBOL (ieee802154_rx_irqsafe);
net/mac802154/tx.c +1 -1
@@ -119,7 +119,7 @@ netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb, work->page = page; work->chan = chan; -queue_work (local->dev_workqueue, &work->work); +queue_work (local->workqueue, &work->work);return NETDEV_TX_OK ;
Signature · 1 line
2.1.2
Alexander Aring
maintainerPATCH 10/10 mac802154: remove ieee802154_addr from driver_ops
In reply to Alexander AringThis driver_ops callback function is never used by any driver.
--- include/net/mac802154.h | 1 - net/mac802154/main.c | 10 ---------- 2 files changed, 11 deletions(-)
include/net/mac802154.h +0 -1
@@ -170,7 +170,6 @@ struct ieee802154_ops {int (*set_hw_addr_filt)(struct ieee802154_hw *hw,struct ieee802154_hw_addr_filt *filt,unsigned long changed); -int (*ieee_addr)(struct ieee802154_hw *hw,__le64 addr);int (*set_txpower)(struct ieee802154_hw *hw,int db);int (*set_lbt)(struct ieee802154_hw *hw,bool on);int (*set_cca_mode)(struct ieee802154_hw *hw,u8 mode);
net/mac802154/main.c +0 -10
@@ -61,16 +61,6 @@ int mac802154_slave_open(struct net_device *dev) goto err; } -if (local->ops->ieee_addr) { -__le64 addr =ieee802154_devaddr_from_raw (dev->dev_addr); - - res = local->ops->ieee_addr (&local->hw, addr); -WARN_ON (res); -if (res) - goto err; -mac802154_dev_set_ieee_addr (dev); - } -netif_start_queue (dev);return 0 ; err:
Signature · 1 line
2.1.2
Hi Alex,
Quoted 38 lines
This patch series removes the not working/not finished hardMAC virtual driver "fakehard". Additional we remove the not used
ieee802154_addrdriver callback ops. The other patches are rename patches for avoiding mainly the "priv variable naming hell" inside the 802.15.4 subsystem. This series introduce 802.11 naming style for used structs and variable naming.This serie based on "[PATCHv2 bluetooth-next 0/7] ieee802154: file movements" patch serie.
Alexander Aring (10):
ieee802154: remove fakehard driver
ieee802154: renameieee802154_devtoieee802154_hw
mac802154: renamemac802154_privtoieee802154_local
mac802154: renamemac802154_sub_if_data
mac802154: rename hwsubif_datavariable to local
mac802154: rename sdata slaves andslaves_mtx
mac802154: introducehw_to_localfunction
mac802154: introduceIEEE802154_DEV_TO_SUB_IF
mac802154: renamedev_workqueueto workqueue
mac802154: removeieee802154_addrfromdriver_opsdrivers/net/ieee802154/Kconfig | 10 - drivers/net/ieee802154/Makefile | 1 - drivers/net/ieee802154/at86rf230.c | 90 ++++---- drivers/net/ieee802154/cc2520.c | 50 ++--- drivers/net/ieee802154/fakehard.c | 427 ------------------------------------- drivers/net/ieee802154/fakelb.c | 78 +++---- drivers/net/ieee802154/mrf24j40.c | 48 ++--- include/net/mac802154.h | 43 ++-- net/mac802154/ieee802154_i.h | 34 +-- net/mac802154/iface.c | 141 ++++++------ net/mac802154/mac_cmd.c | 4 +- net/mac802154/main.c | 265 +++++++++++------------ net/mac802154/mib.c | 206 +++++++++--------- net/mac802154/monitor.c | 26 +-- net/mac802154/rx.c | 22 +- net/mac802154/tx.c | 40 ++-- 16 files changed, 522 insertions(+), 963 deletions(-)
Quoted 1 line
delete mode 100644
drivers/net/ieee802154/fakehard.c
all 10 patches have been applied to bluetooth-next tree.
Regards
Marcel