Commit 776e59de authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

mac802154: set extended address filter on ifup

This patch moves the setting of hardware extended address filtering
inside of interface up instead doing it directly inside of netlink interface.
Also we don't need to set the sdata extended attribute in netlink. This
is already done by ndo_set_mac_address of net_device_ops.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent ab24f50f
...@@ -135,7 +135,6 @@ ieee802154_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); ...@@ -135,7 +135,6 @@ ieee802154_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
/* MIB callbacks */ /* MIB callbacks */
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val); void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val);
__le16 mac802154_dev_get_short_addr(const struct net_device *dev); __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); __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_pan_id(struct net_device *dev, __le16 val);
void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan); void mac802154_dev_set_page_channel(struct net_device *dev, u8 page, u8 chan);
......
...@@ -110,6 +110,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -110,6 +110,7 @@ mac802154_wpan_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static int mac802154_wpan_mac_addr(struct net_device *dev, void *p) static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
{ {
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct sockaddr *addr = p; struct sockaddr *addr = p;
if (netif_running(dev)) if (netif_running(dev))
...@@ -117,7 +118,8 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p) ...@@ -117,7 +118,8 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
/* FIXME: validate addr */ /* FIXME: validate addr */
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
mac802154_dev_set_ieee_addr(dev); sdata->extended_addr = ieee802154_netdev_to_extended_addr(dev->dev_addr);
return mac802154_wpan_update_llsec(dev); return mac802154_wpan_update_llsec(dev);
} }
...@@ -202,6 +204,12 @@ static int mac802154_wpan_open(struct net_device *dev) ...@@ -202,6 +204,12 @@ static int mac802154_wpan_open(struct net_device *dev)
goto out; goto out;
} }
if (local->hw.flags & IEEE802154_HW_AFILT) {
rc = drv_set_extended_addr(local, sdata->extended_addr);
if (rc < 0)
goto out;
}
if (local->hw.flags & IEEE802154_HW_TXPOWER) { if (local->hw.flags & IEEE802154_HW_TXPOWER) {
rc = drv_set_tx_power(local, sdata->mac_params.transmit_power); rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
if (rc < 0) if (rc < 0)
......
...@@ -43,7 +43,6 @@ static int mac802154_mlme_start_req(struct net_device *dev, ...@@ -43,7 +43,6 @@ static int mac802154_mlme_start_req(struct net_device *dev,
mac802154_dev_set_pan_id(dev, addr->pan_id); mac802154_dev_set_pan_id(dev, addr->pan_id);
mac802154_dev_set_short_addr(dev, addr->short_addr); mac802154_dev_set_short_addr(dev, addr->short_addr);
mac802154_dev_set_ieee_addr(dev);
mac802154_dev_set_page_channel(dev, page, channel); mac802154_dev_set_page_channel(dev, page, channel);
if (ops->llsec) { if (ops->llsec) {
......
...@@ -102,20 +102,6 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev) ...@@ -102,20 +102,6 @@ __le16 mac802154_dev_get_short_addr(const struct net_device *dev)
return ret; return ret;
} }
void mac802154_dev_set_ieee_addr(struct net_device *dev)
{
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_local *local = sdata->local;
sdata->extended_addr = ieee802154_devaddr_from_raw(dev->dev_addr);
if (local->ops->set_hw_addr_filt &&
local->hw.hw_filt.ieee_addr != sdata->extended_addr) {
local->hw.hw_filt.ieee_addr = sdata->extended_addr;
set_hw_addr_filt(dev, IEEE802154_AFILT_IEEEADDR_CHANGED);
}
}
__le16 mac802154_dev_get_pan_id(const struct net_device *dev) __le16 mac802154_dev_get_pan_id(const struct net_device *dev)
{ {
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
......
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