ieee802154: mac802154: wireless transformation
Subsystems (5)
Alexander Aring
maintainercover ieee802154: mac802154: wireless transformation
Hi,
this is the first part to make the mac802154/ieee802154 implementation like wireless. There is much things do to but at around 10 patches I will send a complete patch series of my work to make the review easier.
This patch renames more variables/structs like it's also available in wireless. I think this was done also in the current implementation but all variables was renamed and now I get confuse about priv/ipriv (I call it priv variable hell) and netdev/ieee802154_dev.
We rename the ieee802154_dev to ieee802154_hw, like a ieee80211_hw.
The mac802154_priv is now ieee802154_local, like a ieee80211_local. The mac802154_sub_if_data is now ieee802154_sub_if_data.
Also change the variables name to this so there should never be a variable priv and you don't know if it's a mac802154_sub_if_data or mac802154_priv. That's confusing me so much sometimes. Now it's also clear to see mutliple dereferencing. Please send patches for this, if you like.
The next step is the frame parsing like wireless and interface registration like wireless.
The last one replace the receiving workqueue with a tasklet, which is also used in wireless. This have a less overhead and I removed a kmalloc call in this hot path.
- Alex
Alexander Aring (11):
ieee802154: rename ieee802154_dev to ieee802154_hw
mac802154: rename ieee802154_dev.c to main.c
mac802154: remove not functional monitor device
ieee802154: add new interface types
nl802154: add missing endif comment
mac802154: rename mac802154_priv to ieee802154_local
mac802154: rename mac802154_sub_if_data to ieee802154_sub_if_data
mac802154: rename mac802154.h to ieee802154_i.h
mac802154: rename hw subif_data variable to local
mac802154: use hw_to_local
mac802154: rx: use tasklet instead workqueue
drivers/net/ieee802154/at86rf230.c | 90 ++++---- drivers/net/ieee802154/cc2520.c | 50 ++--- drivers/net/ieee802154/mrf24j40.c | 48 ++-- include/linux/nl802154.h | 15 +- include/net/mac802154.h | 46 ++-- net/ieee802154/nl-phy.c | 4 +- net/mac802154/Makefile | 4 +- net/mac802154/ieee802154_dev.c | 415 ----------------------------------- net/mac802154/ieee802154_i.h | 178 +++++++++++++++ net/mac802154/llsec.c | 2 +- net/mac802154/mac802154.h | 172 --------------- net/mac802154/mac_cmd.c | 6 +- net/mac802154/main.c | 435 +++++++++++++++++++++++++++++++++++++ net/mac802154/mib.c | 207 +++++++++--------- net/mac802154/monitor.c | 117 ---------- net/mac802154/rx.c | 60 ++--- net/mac802154/tx.c | 42 ++-- net/mac802154/wpan.c | 145 +++++++------ 18 files changed, 958 insertions(+), 1078 deletions(-) delete mode 100644 net/mac802154/ieee802154_dev.c create mode 100644 net/mac802154/ieee802154_i.h delete mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/main.c delete mode 100644 net/mac802154/monitor.c
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 1/11 ieee802154: rename ieee802154_dev to ieee802154_hw
The 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.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- drivers/net/ieee802154/at86rf230.c | 90 +++++++++++++++++++------------------- drivers/net/ieee802154/cc2520.c | 50 ++++++++++----------- drivers/net/ieee802154/mrf24j40.c | 48 ++++++++++---------- include/net/mac802154.h | 44 +++++++++---------- net/mac802154/ieee802154_dev.c | 34 +++++++------- net/mac802154/mac802154.h | 2 +- net/mac802154/rx.c | 12 ++--- 7 files changed, 140 insertions(+), 140 deletions(-)
drivers/net/ieee802154/at86rf230.c +45 -45
@@ -79,7 +79,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;
@@ -805,7 +805,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;
@@ -1013,7 +1013,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);
@@ -1022,15 +1022,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
@@ -1065,15 +1065,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 ; }
@@ -1085,18 +1085,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 &IEEE802515_AFILT_SADDR_CHANGED ) {u16 addr =le16_to_cpu (filt->short_addr);
@@ -1139,9 +1139,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
@@ -1158,17 +1158,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); }
@@ -1186,9 +1186,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 ;
@@ -1198,10 +1198,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 )
@@ -1219,9 +1219,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/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_dev.c +17 -17
@@ -239,8 +239,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;
@@ -289,9 +289,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);
@@ -301,49 +301,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;
@@ -381,11 +381,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);
@@ -409,7 +409,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/mac802154.h +1 -1
@@ -31,7 +31,7 @@/* mac802154 device private data */ struct mac802154_priv { -struct ieee802154_dev hw; +struct ieee802154_hw hw;struct ieee802154_ops *ops;/* ieee802154 phy */
net/mac802154/rx.c +6 -6
@@ -46,12 +46,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);
@@ -87,14 +87,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)
@@ -106,7 +106,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.0.3
Alexander Aring
maintainerPATCH 2/11 mac802154: rename ieee802154_dev.c to main.c
In reply to Alexander AringThis file contains hw functionality which is similar to the net/mac80211/main.c file.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/Makefile | 2 +- net/mac802154/ieee802154_dev.c | 415 ----------------------------------------- net/mac802154/main.c | 411 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 412 insertions(+), 416 deletions(-) delete mode 100644 net/mac802154/ieee802154_dev.c create mode 100644 net/mac802154/main.c
net/mac802154/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_MAC802154) += mac802154.o -mac802154-objs := ieee802154_dev.o rx.o tx.o mac_cmd.o mib.o \ +mac802154-objs := main.o rx.o tx.o mac_cmd.o mib.o \ monitor.o wpan.o llsec.o ccflags-y += -D__CHECK_ENDIAN__
net/mac802154/ieee802154_dev.c deleted +0 -415
415 lines not on this page · raw message
net/mac802154/main.c new file +411 -0
411 lines not on this page · raw message
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 3/11 mac802154: remove not functional monitor device
In reply to Alexander AringThis is broken in many ways, drop the current monitor device support and later we will implement a new implement for this.
--- include/linux/nl802154.h | 1 - net/mac802154/Makefile | 2 +- net/mac802154/mac802154.h | 3 -- net/mac802154/main.c | 5 -- net/mac802154/monitor.c | 117 ---------------------------------------------- net/mac802154/rx.c | 1 - net/mac802154/tx.c | 2 - 7 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 net/mac802154/monitor.c
include/linux/nl802154.h +0 -1
@@ -174,7 +174,6 @@ enum { __IEEE802154_DEV_INVALID =-1 ,IEEE802154_DEV_WPAN , -IEEE802154_DEV_MONITOR , __IEEE802154_DEV_MAX, };
net/mac802154/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_MAC802154) += mac802154.o mac802154-objs := main.o rx.o tx.o mac_cmd.o mib.o \ - monitor.o wpan.o llsec.o + wpan.o llsec.o ccflags-y += -D__CHECK_ENDIAN__
net/mac802154/mac802154.h +0 -3
@@ -113,9 +113,6 @@ 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_monitor_setup (struct net_device *dev); -void mac802154_wpans_rx (struct mac802154_priv *priv,struct sk_buff *skb);void mac802154_wpan_setup (struct net_device *dev);
net/mac802154/main.c +0 -5
@@ -161,11 +161,6 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)int err = -ENOMEM ;switch (type) { -case IEEE802154_DEV_MONITOR : - dev =alloc_netdev (sizeof (struct mac802154_sub_if_data ), - name,NET_NAME_UNKNOWN , - mac802154_monitor_setup); -break ;case IEEE802154_DEV_WPAN : dev = alloc_netdev(sizeof(struct mac802154_sub_if_data), name, NET_NAME_UNKNOWN,
net/mac802154/monitor.c deleted +0 -117
117 lines not on this page · raw message
net/mac802154/rx.c +0 -1
@@ -74,7 +74,6 @@ 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);return ;
net/mac802154/tx.c +0 -2
@@ -92,8 +92,6 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, goto err_tx; } -mac802154_monitors_rx (mac802154_to_priv (&priv->hw), skb); -if (!(priv->hw.flags &IEEE802154_HW_OMIT_CKSUM )) {u16 crc =crc_ccitt (0 , skb->data, skb->len);u8 *data =skb_put (skb,2 );
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 4/11 ieee802154: add new interface types
In reply to Alexander AringThis patch adds the new interface types NODE, MONITOR and COORD. The NODE has the identically number like WPAN_DEV and should be backwards compatible with current userspace tools.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- include/linux/nl802154.h | 12 ++++++++---- net/ieee802154/nl-phy.c | 4 ++-- net/mac802154/main.c | 4 ++-- net/mac802154/wpan.c | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-)
include/linux/nl802154.h +8 -4
@@ -170,12 +170,16 @@ enum {#define IEEE802154_CMD_MAX (__IEEE802154_CMD_MAX - 1) -enum { - __IEEE802154_DEV_INVALID =-1 , +enum nl802154_iftype { +NL802154_IFTYPE_UNSPEC =-1 , -IEEE802154_DEV_WPAN , +NL802154_IFTYPE_NODE , +NL802154_IFTYPE_MONITOR , +NL802154_IFTYPE_COORD , - __IEEE802154_DEV_MAX, +/* keep last */ +NUM_NL802154_IFTYPES , +NL802154_IFTYPE_MAX =NUM_NL802154_IFTYPES -1 };#endif
net/ieee802154/nl-phy.c +2 -2
@@ -176,7 +176,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)const char *devname;int rc = -ENOBUFS ;struct net_device *dev; -int type = __IEEE802154_DEV_INVALID; +enum nl802154_iftype type =NL802154_IFTYPE_UNSPEC ;pr_debug ("%s\n" , __func__);
@@ -221,7 +221,7 @@ int ieee802154_add_iface(struct sk_buff *skb, struct genl_info *info)if (info->attrs[IEEE802154_ATTR_DEV_TYPE ]) { type =nla_get_u8 (info->attrs[IEEE802154_ATTR_DEV_TYPE ]); -if (type >= __IEEE802154_DEV_MAX) { +if (type >NL802154_IFTYPE_MAX ) { rc = -EINVAL ; goto nla_put_failure; }
net/mac802154/main.c +2 -2
@@ -38,7 +38,7 @@ int mac802154_slave_open(struct net_device *dev)ASSERT_RTNL (); -if (priv->type ==IEEE802154_DEV_WPAN ) { +if (priv->type ==NL802154_IFTYPE_NODE ) {mutex_lock (&priv->hw->slaves_mtx);list_for_each_entry (subif, &priv->hw->slaves, list) { if (subif != priv && subif->type == priv->type &&
@@ -161,7 +161,7 @@ mac802154_add_iface(struct wpan_phy *phy, const char *name, int type)int err = -ENOMEM ;switch (type) { -case IEEE802154_DEV_WPAN : +case NL802154_IFTYPE_NODE : dev =alloc_netdev (sizeof (struct mac802154_sub_if_data ), name,NET_NAME_UNKNOWN , mac802154_wpan_setup);
net/mac802154/wpan.c +2 -2
@@ -389,7 +389,7 @@ void mac802154_wpan_setup(struct net_device *dev) dev->ml_priv = &mac802154_mlme_wpan; priv =netdev_priv (dev); - priv->type =IEEE802154_DEV_WPAN ; + priv->type =NL802154_IFTYPE_NODE ; priv->chan =MAC802154_CHAN_NONE ; priv->page =0 ;
@@ -580,7 +580,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) { -if (sdata->type !=IEEE802154_DEV_WPAN || +if (sdata->type !=NL802154_IFTYPE_NODE || !netif_running (sdata->dev))continue ;
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 5/11 nl802154: add missing endif comment
In reply to Alexander Aring--- include/linux/nl802154.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nl802154.h +1 -1
@@ -182,4 +182,4 @@ enum nl802154_iftype {NL802154_IFTYPE_MAX =NUM_NL802154_IFTYPES -1 }; -#endif +#endif /* NL802154_H */
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 6/11 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. This also avoid the priv variable hell.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/mac802154.h | 10 +-- net/mac802154/main.c | 172 +++++++++++++++++++++++----------------------- net/mac802154/mib.c | 21 +++--- net/mac802154/rx.c | 10 +-- net/mac802154/tx.c | 34 ++++----- net/mac802154/wpan.c | 4 +- 6 files changed, 125 insertions(+), 126 deletions(-)
net/mac802154/mac802154.h +5 -5
@@ -30,7 +30,7 @@#include "llsec.h" /* mac802154 device private data */ -struct mac802154_priv { +struct ieee802154_local {struct ieee802154_hw hw;struct ieee802154_ops *ops;
@@ -73,7 +73,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;
@@ -103,7 +103,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 */
@@ -113,10 +113,10 @@ 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_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/main.c +86 -86
367 lines not on this page · raw message
net/mac802154/mib.c +10 -11
@@ -40,7 +40,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);
@@ -53,12 +53,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);
@@ -114,13 +113,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,IEEE802515_AFILT_IEEEADDR_CHANGED ); } }
@@ -169,12 +168,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/rx.c +5 -5
@@ -53,13 +53,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 ) {
@@ -74,7 +74,7 @@ mac802154_subif_rx(struct ieee802154_hw *hw, struct sk_buff *skb, u8 lqi)skb_trim (skb, skb->len -2 );/* CRC */ } -mac802154_wpans_rx (priv, skb); +mac802154_wpans_rx (local, skb);return ;
@@ -93,7 +93,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)
@@ -108,6 +108,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 +17 -17
@@ -37,7 +37,7 @@struct xmit_work {struct sk_buff *skb;struct work_struct work; -struct mac802154_priv *priv; +struct ieee802154_local *local;u8 chan;u8 page; };
@@ -48,10 +48,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) {
@@ -59,20 +59,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 ();
@@ -81,18 +81,18 @@ 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; } -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 );
@@ -100,7 +100,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 );
@@ -111,17 +111,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 ;
net/mac802154/wpan.c +2 -2
@@ -566,7 +566,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 !=NL802154_IFTYPE_NODE || !netif_running (sdata->dev))continue ;
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 7/11 mac802154: rename mac802154_sub_if_data to ieee802154_sub_if_data
In reply to Alexander AringIn wireless they don't name it macXXXX it's ieeeXXXX.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/mac802154.h | 2 +- net/mac802154/mac_cmd.c | 4 +- net/mac802154/main.c | 52 ++++++------- net/mac802154/mib.c | 192 +++++++++++++++++++++++----------------------- net/mac802154/tx.c | 4 +- net/mac802154/wpan.c | 137 +++++++++++++++++---------------- 6 files changed, 196 insertions(+), 195 deletions(-)
net/mac802154/mac802154.h +1 -1
@@ -70,7 +70,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/mac_cmd.c +2 -2
@@ -79,11 +79,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 +26 -26
120 lines not on this page · raw message
net/mac802154/mib.c +96 -96
421 lines not on this page · raw message
net/mac802154/tx.c +2 -2
@@ -45,7 +45,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);
@@ -85,7 +85,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 );
net/mac802154/wpan.c +69 -68
323 lines not on this page · raw message
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 8/11 mac802154: rename mac802154.h to ieee802154_i.h
In reply to Alexander AringThis patch name the mac802154.h INTERNAL header to ieee802154_i.h like wireless stack. This avoids confusing with the not internal header net/mac802154.h header.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/ieee802154_i.h | 167 ++++++++++++++++++++++++++++++++++++++++++ net/mac802154/llsec.c | 2 +- net/mac802154/mac802154.h | 169 ------------------------------------------- net/mac802154/mac_cmd.c | 2 +- net/mac802154/main.c | 2 +- net/mac802154/mib.c | 2 +- net/mac802154/rx.c | 2 +- net/mac802154/tx.c | 2 +- net/mac802154/wpan.c | 2 +- 9 files changed, 174 insertions(+), 176 deletions(-) create mode 100644 net/mac802154/ieee802154_i.h delete mode 100644 net/mac802154/mac802154.h
net/mac802154/ieee802154_i.h new file +167 -0
@@ -0,0 +1,167 @@ +/* +* Copyright (C) 2007-2012 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: +* Pavel Smolenskiy <[email protected]> +* Maxim Gorbachyov <[email protected]> +* Dmitry Eremin-Solenikov <[email protected]> +* Alexander Smirnov <[email protected]> +*/ +#ifndef __IEEE802154_I_H +#define __IEEE802154_I_H + +#include <linux/mutex.h> +#include <net/mac802154.h> +#include <net/ieee802154_netdev.h> + +#include "llsec.h" + +struct ieee802154_local ; + +/* Slave interface definition. +* +* Slaves represent typical network interfaces available from userspace. +* Each ieee802154 device/transceiver may have several slaves and able +* to be associated with several networks at the same time. +*/ +struct ieee802154_sub_if_data { +struct list_head list;/* the ieee802154_priv->slaves list */ + +struct ieee802154_local *hw; +struct net_device *dev; + +int type; +bool running; + +spinlock_t mib_lock; + +__le16 pan_id; +__le16 short_addr; +__le64 extended_addr; + +u8 chan; +u8 page; + +struct ieee802154_mac_params mac_params; + +/* MAC BSN field */ +u8 bsn; +/* MAC DSN field */ +u8 dsn; + +/* protects sec from concurrent access by netlink. access by +* encrypt/decrypt/header_create safe without additional protection. +*/ +struct mutex sec_mtx; + +struct mac802154_llsec sec; +}; + +/* mac802154 device private data */ +struct ieee802154_local { +struct ieee802154_hw hw; +struct ieee802154_ops *ops; + +/* ieee802154 phy */ +struct wpan_phy *phy; + +int open_count; + +/* As in mac80211 slaves list is modified: +* 1) under the RTNL +* 2) protected by slaves_mtx; +* 3) in an RCU manner +* +* So atomic readers can use any of this protection methods. +*/ +struct list_head slaves; +struct mutex slaves_mtx; + +/* This one is used for scanning and other jobs not to be interfered +* with serial driver. +*/ +struct workqueue_struct *dev_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 running; +}; + +#define MAC802154_DEVICE_STOPPED 0x00 +#define MAC802154_DEVICE_RUN 0x01 + +#define mac802154_to_priv (_hw) container_of(_hw, struct ieee802154_local, hw) + +#define MAC802154_CHAN_NONE 0xff/* No channel is assigned */ + +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_wpans_rx (struct ieee802154_local *local,struct sk_buff *skb); +void mac802154_wpan_setup (struct net_device *dev); + +netdev_tx_t mac802154_tx (struct ieee802154_local *local,struct sk_buff *skb, +u8 page,u8 chan); + +/* MIB callbacks */ +void mac802154_dev_set_short_addr (struct net_device *dev,__le16 val); +__le16 mac802154_dev_get_short_addr (const struct net_device *dev); +void mac802154_dev_set_ieee_addr (struct net_device *dev); +__le16 mac802154_dev_get_pan_id (const struct net_device *dev); +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, +const struct ieee802154_llsec_params *params, +int changed); + +int mac802154_add_key (struct net_device *dev, +const struct ieee802154_llsec_key_id *id, +const struct ieee802154_llsec_key *key); +int mac802154_del_key (struct net_device *dev, +const struct ieee802154_llsec_key_id *id); + +int mac802154_add_dev (struct net_device *dev, +const struct ieee802154_llsec_device *llsec_dev); +int mac802154_del_dev (struct net_device *dev,__le64 dev_addr); + +int mac802154_add_devkey (struct net_device *dev, +__le64 device_addr, +const struct ieee802154_llsec_device_key *key); +int mac802154_del_devkey (struct net_device *dev, +__le64 device_addr, +const struct ieee802154_llsec_device_key *key); + +int mac802154_add_seclevel (struct net_device *dev, +const struct ieee802154_llsec_seclevel *sl); +int mac802154_del_seclevel (struct net_device *dev, +const struct ieee802154_llsec_seclevel *sl); + +void mac802154_lock_table (struct net_device *dev); +void mac802154_get_table (struct net_device *dev, +struct ieee802154_llsec_table **t); +void mac802154_unlock_table (struct net_device *dev); + +#endif /* __IEEE802154_I_H */
net/mac802154/llsec.c +1 -1
@@ -20,7 +20,7 @@#include <net/ieee802154.h> #include <crypto/algapi.h> -#include "mac802154.h" +#include "ieee802154_i.h" #include "llsec.h" static void llsec_key_put (struct mac802154_llsec_key *key);
net/mac802154/mac802154.h deleted +0 -169
169 lines not on this page · raw message
net/mac802154/mac_cmd.c +1 -1
@@ -31,7 +31,7 @@#include <net/mac802154.h> #include <net/nl802154.h> -#include "mac802154.h" +#include "ieee802154_i.h" static int mac802154_mlme_start_req(struct net_device *dev, struct ieee802154_addr *addr,
net/mac802154/main.c +1 -1
@@ -27,7 +27,7 @@#include <net/route.h> #include <net/wpan-phy.h> -#include "mac802154.h" +#include "ieee802154_i.h" int mac802154_slave_open (struct net_device *dev) {
net/mac802154/mib.c +1 -1
@@ -27,7 +27,7 @@#include <net/ieee802154_netdev.h> #include <net/wpan-phy.h> -#include "mac802154.h" +#include "ieee802154_i.h" struct phy_chan_notify_work {struct work_struct work;
net/mac802154/rx.c +1 -1
@@ -30,7 +30,7 @@#include <net/mac802154.h> #include <net/ieee802154_netdev.h> -#include "mac802154.h" +#include "ieee802154_i.h" /* The IEEE 802.15.4 standard defines 4 MAC packet types: * - beacon frame
net/mac802154/tx.c +1 -1
@@ -29,7 +29,7 @@#include <net/mac802154.h> #include <net/wpan-phy.h> -#include "mac802154.h" +#include "ieee802154_i.h" /* IEEE 802.15.4 transceivers can sleep during the xmit session, so process * packets through the workqueue.
net/mac802154/wpan.c +1 -1
@@ -33,7 +33,7 @@#include <net/ieee802154.h> #include <net/wpan-phy.h> -#include "mac802154.h" +#include "ieee802154_i.h" static int mac802154_wpan_update_llsec (struct net_device *dev) {
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 9/11 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.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/ieee802154_i.h | 2 +- net/mac802154/mac_cmd.c | 2 +- net/mac802154/main.c | 34 +++++++++++++++++----------------- net/mac802154/mib.c | 38 +++++++++++++++++++------------------- net/mac802154/wpan.c | 12 ++++++------ 5 files changed, 44 insertions(+), 44 deletions(-)
net/mac802154/ieee802154_i.h +1 -1
@@ -36,7 +36,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/mac_cmd.c +1 -1
@@ -83,7 +83,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 ==NL802154_IFTYPE_NODE ) { -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);
@@ -389,9 +389,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
@@ -46,7 +46,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)
@@ -76,7 +76,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)
@@ -89,9 +89,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,IEEE802515_AFILT_SADDR_CHANGED ); } }
@@ -113,7 +113,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);
@@ -148,9 +148,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,IEEE802515_AFILT_PANID_CHANGED ); } }
@@ -172,15 +172,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); }
@@ -197,10 +197,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)
@@ -208,9 +208,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/wpan.c +6 -6
@@ -129,9 +129,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 ; }
@@ -141,16 +141,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 )
@@ -343,7 +343,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 = {
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 10/11 mac802154: use hw_to_local
In reply to Alexander AringThis patch replace the mac802154_to_priv macro with a static inline function named hw_to_local.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- net/mac802154/ieee802154_i.h | 8 ++++++-- net/mac802154/main.c | 6 +++--- net/mac802154/rx.c | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-)
net/mac802154/ieee802154_i.h +6 -2
@@ -101,10 +101,14 @@ struct ieee802154_local {#define MAC802154_DEVICE_STOPPED 0x00#define MAC802154_DEVICE_RUN 0x01 -#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
@@ -284,7 +284,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->slaves));
@@ -296,7 +296,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 ) {
@@ -376,7 +376,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
@@ -53,7 +53,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 );
@@ -93,7 +93,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)
Signature · 1 line
2.0.3
Alexander Aring
maintainerPATCH 11/11 mac802154: rx: use tasklet instead workqueue
In reply to Alexander AringTasklets have much less overhead than workqueues and we save the heap allocation on this hot path.
This patch is part of getting wireless feeling into the ieee802154 implementation.
--- include/net/mac802154.h | 2 ++ net/mac802154/ieee802154_i.h | 7 +++++++ net/mac802154/main.c | 29 +++++++++++++++++++++++++++ net/mac802154/rx.c | 47 ++++++++------------------------------------ 4 files changed, 46 insertions(+), 39 deletions(-)
include/net/mac802154.h +2 -0
@@ -195,4 +195,6 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw);void ieee802154_rx_irqsafe (struct ieee802154_hw *hw,struct sk_buff *skb,u8 lqi); +void ieee802154_rx (struct ieee802154_hw *hw,struct sk_buff *skb); +#endif /* NET_MAC802154_H */
net/mac802154/ieee802154_i.h +7 -0
@@ -27,6 +27,10 @@struct ieee802154_local ; +enum { +IEEE802154_RX_MSG =1 , +}; +/* Slave interface definition. * * Slaves represent typical network interfaces available from userspace.
@@ -96,6 +100,9 @@ struct ieee802154_local {* read them using any of protection methods. */ bool running; + +struct tasklet_struct tasklet; +struct sk_buff_head skb_queue; };#define MAC802154_DEVICE_STOPPED 0x00
net/mac802154/main.c +29 -0
@@ -230,6 +230,29 @@ static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries)return local->ops->set_frame_retries (&local->hw, retries); } +static void ieee802154_tasklet_handler (unsigned long data) +{ +struct ieee802154_local *local = (struct ieee802154_local *)data; +struct sk_buff *skb; + +while ((skb =skb_dequeue (&local->skb_queue))) { +switch (skb->pkt_type) { +case IEEE802154_RX_MSG : +/* Clear skb->pkt_type in order to not confuse kernel +* netstack. +*/ + skb->pkt_type =0 ; +ieee802154_rx (&local->hw, skb); +break ; +default : +WARN (1 ,"mac80211: Packet is of unknown type %d\n" , + skb->pkt_type); +kfree_skb (skb); +break ; + } + } +} +struct ieee802154_hw *ieee802154_alloc_hw (size_t priv_data_len,struct ieee802154_ops *ops) {
@@ -278,6 +301,12 @@ ieee802154_alloc_hw(size_t priv_data_len, struct ieee802154_ops *ops)INIT_LIST_HEAD (&local->slaves);mutex_init (&local->slaves_mtx); +tasklet_init (&local->tasklet, + ieee802154_tasklet_handler, + (unsigned long )local); + +skb_queue_head_init (&local->skb_queue); +return &local->hw; }EXPORT_SYMBOL (ieee802154_alloc_hw);
net/mac802154/rx.c +8 -39
70 lines not on this page · raw message
Signature · 1 line
2.0.3
Hi Alex,
Looks good to me. The monitor devices work fine for us on both our wireless and plc interfaces using tcpdump. Out of interest, in what way are they broken?
- Martin.
Quoted 69 lines · Alexander Aring
Hi,
this is the first part to make the mac802154/ieee802154 implementation like wireless. There is much things do to but at around 10 patches I will send a complete patch series of my work to make the review easier.
This patch renames more variables/structs like it's also available in wireless. I think this was done also in the current implementation but all variables was renamed and now I get confuse about priv/ipriv (I call it priv variable hell) and netdev/ieee802154_dev.
We rename the
ieee802154_devtoieee802154_hw, like aieee80211_hw.The
mac802154_privis nowieee802154_local, like aieee80211_local. Themac802154_sub_if_datais nowieee802154_sub_if_data.Also change the variables name to this so there should never be a variable priv and you don't know if it's a
mac802154_sub_if_dataormac802154_priv. That's confusing me so much sometimes. Now it's also clear to see mutliple dereferencing. Please send patches for this, if you like.The next step is the frame parsing like wireless and interface registration like wireless.
The last one replace the receiving workqueue with a tasklet, which is also used in wireless. This have a less overhead and I removed a kmalloc call in this hot path.
- Alex
Alexander Aring (11):
ieee802154: renameieee802154_devtoieee802154_hw
mac802154: renameieee802154_dev.ctomain.c
mac802154: remove not functional monitor device
ieee802154: add new interface types
nl802154: add missing endif comment
mac802154: renamemac802154_privtoieee802154_local
mac802154: renamemac802154_sub_if_datatoieee802154_sub_if_data
mac802154: renamemac802154.htoieee802154_i.h
mac802154: rename hwsubif_datavariable to local
mac802154: usehw_to_local
mac802154: rx: use tasklet instead workqueuedrivers/net/ieee802154/at86rf230.c | 90 ++++---- drivers/net/ieee802154/cc2520.c | 50 ++--- drivers/net/ieee802154/mrf24j40.c | 48 ++-- include/linux/nl802154.h | 15 +- include/net/mac802154.h | 46 ++-- net/ieee802154/nl-phy.c | 4 +- net/mac802154/Makefile | 4 +- net/mac802154/ieee802154_dev.c | 415 ----------------------------------- net/mac802154/ieee802154_i.h | 178 +++++++++++++++ net/mac802154/llsec.c | 2 +- net/mac802154/mac802154.h | 172 --------------- net/mac802154/mac_cmd.c | 6 +- net/mac802154/main.c | 435 +++++++++++++++++++++++++++++++++++++ net/mac802154/mib.c | 207 +++++++++--------- net/mac802154/monitor.c | 117 ---------- net/mac802154/rx.c | 60 ++--- net/mac802154/tx.c | 42 ++-- net/mac802154/wpan.c | 145 +++++++------ 18 files changed, 958 insertions(+), 1078 deletions(-) delete mode 100644 net/mac802154/ieee802154_dev.c create mode 100644 net/mac802154/ieee802154_i.h delete mode 100644 net/mac802154/mac802154.h create mode 100644 net/mac802154/main.c delete mode 100644 net/mac802154/monitor.c
Alexander Aring
maintainerHi,
Quoted 4 lines · Martin Townsend
Hi Alex,
Looks good to me. The monitor devices work fine for us on both our wireless and plc interfaces using tcpdump. Out of interest, in what way are they broken?
Okay, in my setup I can't set any channels to the monitor interface. It's only working if I set some channel hardcoded and the remove of the monitor interface is also broken.
I gave up to understand how it works. If you see [0] you will see:
dev->ml_priv = &mac802154_mlme_reduced;
The mac802154_mlme_reduced struct is defined at [1]. It has only the
.get_phy = mac802154_get_phy,
assign.
But mac802154_get_phy has a assertion on:
BUG_ON(dev->type != ARPHRD_IEEE802154);
Back to [0] you will see:
dev->type = ARPHRD_IEEE802154_MONITOR;
which doesn't fit together with a
BUG_ON(dev->type != ARPHRD_IEEE802154);
I never hit this BUG_ON and really doesn't know what's going on there, I want to implement a MONITOR interface like 80211. :-)
Nevertheless I gave up to understand what going on there and I can't also set channels. Also removing the monitor interface with iz doesn't work (I think there was some deadlock).
A monitor device should be going into the promiscous mode of a device. But we also don't support this. Okay if you device doesn't has a hardware filter, it's like to have a promiscous mode. But sometimes promiscous mode also doesn't care about CRC or something else. A monitor device should also be able to show broken packets.
I drop this interface type because it really bypass only the mac802154 stack and nothing else. I don't want to say "we don't need a MONITOR interface type", but this is for my opinion in an not useful state.
And really I don't want to insert something mainline which breaks any existing support (monitor, fakelb, crypto, ...). I can't do a deletion of net/mac802154 (ieee802154) and simple add a new one, but deleting of subsubsystems like montior, fakelb and add a rework of this should not make any problems.
- Alex
[0] http://lxr.free-electrons.com/source/net/mac802154/monitor.c
[1] http://lxr.free-electrons.com/source/net/mac802154/mac_cmd.c#L105
[2] http://lxr.free-electrons.com/source/net/mac802154/mac_cmd.c#L80
It would be good to have a way of cleanly putting devices into promiscuous mode, currently we have to patch the mrf driver to do this.
I look forward to trying out the new monitor interface. :)
- Martin.
Quoted 70 lines · Alexander Aring
Hi,
Quoted 4 lines · Martin Townsend
Hi Alex,
Looks good to me. The monitor devices work fine for us on both our wireless and plc interfaces using tcpdump. Out of interest, in what way are they broken?
Okay, in my setup I can't set any channels to the monitor interface. It's only working if I set some channel hardcoded and the remove of the monitor interface is also broken.
I gave up to understand how it works. If you see [0] you will see:
dev->ml_priv=&mac802154_mlme_reduced;The
mac802154_mlme_reducedstruct is defined at [1]. It has only the.get_phy =
mac802154_get_phy,assign.
But
mac802154_get_phyhas a assertion on:
BUG_ON(dev->type != ARPHRD_IEEE802154);Back to [0] you will see:
dev->type=ARPHRD_IEEE802154_MONITOR;which doesn't fit together with a
BUG_ON(dev->type != ARPHRD_IEEE802154);I never hit this
BUG_ONand really doesn't know what's going on there, I want to implement a MONITOR interface like 80211. :-)Nevertheless I gave up to understand what going on there and I can't also set channels. Also removing the monitor interface with iz doesn't work (I think there was some deadlock).
A monitor device should be going into the promiscous mode of a device. But we also don't support this. Okay if you device doesn't has a hardware filter, it's like to have a promiscous mode. But sometimes promiscous mode also doesn't care about CRC or something else. A monitor device should also be able to show broken packets.
I drop this interface type because it really bypass only the mac802154 stack and nothing else. I don't want to say "we don't need a MONITOR interface type", but this is for my opinion in an not useful state.
And really I don't want to insert something mainline which breaks any existing support (monitor, fakelb, crypto, ...). I can't do a deletion of net/mac802154 (ieee802154) and simple add a new one, but deleting of subsubsystems like montior, fakelb and add a rework of this should not make any problems.
- Alex
[0] http://lxr.free-electrons.com/source/net/mac802154/monitor.c
[1] http://lxr.free-electrons.com/source/net/mac802154/mac_cmd.c#L105
[2] http://lxr.free-electrons.com/source/net/mac802154/mac_cmd.c#L80
--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Alexander Aring
maintainerQuoted 6 lines · Alexander Aring
And really I don't want to insert something mainline which breaks any existing support (monitor, fakelb, crypto, ...). I can't do a deletion of net/mac802154 (ieee802154) and simple add a new one, but deleting of subsubsystems like montior, fakelb and add a rework of this should not make any problems.
okay, that's maybe not correct I want to drop the channel setting feature while xmit which "could" be use for channel hoping On multiple interfaces.
The reason are more... this is a sync callback and I can't deal with a async xmit with that. Okay I can solve this to make the channel setting async but... if somebody want channel hoping then the logic for that should be in userspace. We don't have any kernelspace implementation of any protocol which use the channel hoping feature.
btw. the wireless implementation forbids multiple interface with different channels. [0]
[0] is a neat introduction how wireless userspace access works. Page 21/35 "only matching PHY parameters possible e.g. all virtual interfaces are on one channel".
- Alex
Alexander Aring
maintainerQuoted 2 lines · Martin Townsend
It would be good to have a way of cleanly putting devices into promiscuous mode, currently we have to patch the mrf driver to do this.
hacked solution which came not mainline because it had some issues which I don't know yet anymore.
https://github.com/linux-wpan/linux-wpan-next/commit/55d497e2d8dc08d0673bb9be24d649a79afc5e9e
- Alex