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;
{
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;
}
{
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)
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 = {
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 = {
{
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);
netif_start_queue(dev);
return 0;
err:
- sdata->hw->open_count--;
+ sdata->local->open_count--;
return res;
}
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);
sdata = netdev_priv(dev);
sdata->dev = dev;
- sdata->hw = local;
+ sdata->local = local;
dev->needed_headroom = local->hw.extra_tx_headroom;
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);
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);
}
BUG_ON(dev->type != ARPHRD_IEEE802154);
- return sdata->hw;
+ return sdata->local;
}
static void hw_addr_notify(struct work_struct *work)
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)
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);
}
}
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);
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);
}
}
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);
}
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)
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);
}
}
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;
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);
}