Commit a5e1ec53 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: rename mac802154_priv to ieee802154_local

This patch rename the mac802154_priv to ieee802154_local. The
mac802154_priv structure is like ieee80211_local and so we name it
ieee802154_local.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 5a504397
......@@ -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 */
......
......@@ -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;
......
This diff is collapsed.
......@@ -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,11 +49,10 @@ 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,
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 {
......
......@@ -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;
......
......@@ -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);
......@@ -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 @@ static void mac802154_xmit_worker(struct work_struct *work)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment