Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314629
b: refs/heads/master
c: 66b69d4
h: refs/heads/master
i:
  314627: 1530e82
v: v3
  • Loading branch information
alex.bluesman.smirnov@gmail.com authored and David S. Miller committed Jun 27, 2012
1 parent 2186699 commit 36a0429
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48e44d5057144b4e28615e3e1ce725b2ca887b40
refs/heads/master: 66b69d4d7fe3026a4add368b72905b4d7878c320
1 change: 1 addition & 0 deletions trunk/net/mac802154/mac802154.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ void mac802154_dev_set_short_addr(struct net_device *dev, u16 val);
void mac802154_dev_set_ieee_addr(struct net_device *dev);
u16 mac802154_dev_get_pan_id(const struct net_device *dev);
void mac802154_dev_set_pan_id(struct net_device *dev, u16 val);
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan);

#endif /* MAC802154_H */
44 changes: 44 additions & 0 deletions trunk/net/mac802154/mib.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

#include "mac802154.h"

struct phy_chan_notify_work {
struct work_struct work;
struct net_device *dev;
};

struct hw_addr_filt_notify_work {
struct work_struct work;
struct net_device *dev;
Expand Down Expand Up @@ -139,3 +144,42 @@ void mac802154_dev_set_pan_id(struct net_device *dev, u16 val)
set_hw_addr_filt(dev, IEEE802515_AFILT_PANID_CHANGED);
}
}

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 mac802154_sub_if_data *priv = netdev_priv(nw->dev);
int res;

res = hw->ops->set_channel(&hw->hw, priv->page, priv->chan);
if (res)
pr_debug("set_channel failed\n");

kfree(nw);
}

void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan)
{
struct mac802154_sub_if_data *priv = netdev_priv(dev);
struct phy_chan_notify_work *work;

BUG_ON(dev->type != ARPHRD_IEEE802154);

spin_lock_bh(&priv->mib_lock);
priv->page = page;
priv->chan = chan;
spin_unlock_bh(&priv->mib_lock);

if (priv->hw->phy->current_channel != priv->chan ||
priv->hw->phy->current_page != priv->page) {
work = kzalloc(sizeof(*work), GFP_ATOMIC);
if (!work)
return;

INIT_WORK(&work->work, phy_chan_notify);
work->dev = dev;
queue_work(priv->hw->dev_workqueue, &work->work);
}
}

0 comments on commit 36a0429

Please sign in to comment.