Skip to content

Commit

Permalink
mac802154: mac802154_mlme_start_req() optimisation.
Browse files Browse the repository at this point in the history
mac802154_mlme_start_req() calls
ieee802154_mlme_ops(dev)->llsec->set_params() on the net_device
passed into it, however, this net_device will always be a mac802154
net_device, so just call mac802154_set_params() directly instead.

Signed-off-by: Lennert Buytenhek <[email protected]>
Acked-by: Alexander Aring <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
buytenh authored and holtmann committed May 26, 2015
1 parent 66a3297 commit 641459c
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions net/mac802154/mac_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ static int mac802154_mlme_start_req(struct net_device *dev,
u8 pan_coord, u8 blx,
u8 coord_realign)
{
struct ieee802154_mlme_ops *ops = ieee802154_mlme_ops(dev);
int rc = 0;
struct ieee802154_llsec_params params;
int changed = 0;

ASSERT_RTNL();

Expand All @@ -47,26 +47,19 @@ static int mac802154_mlme_start_req(struct net_device *dev,
dev->ieee802154_ptr->short_addr = addr->short_addr;
mac802154_dev_set_page_channel(dev, page, channel);

if (ops->llsec) {
struct ieee802154_llsec_params params;
int changed = 0;
params.pan_id = addr->pan_id;
changed |= IEEE802154_LLSEC_PARAM_PAN_ID;

params.coord_shortaddr = addr->short_addr;
changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;
params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
changed |= IEEE802154_LLSEC_PARAM_HWADDR;

params.pan_id = addr->pan_id;
changed |= IEEE802154_LLSEC_PARAM_PAN_ID;
params.coord_hwaddr = params.hwaddr;
changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;

params.hwaddr = ieee802154_devaddr_from_raw(dev->dev_addr);
changed |= IEEE802154_LLSEC_PARAM_HWADDR;
params.coord_shortaddr = addr->short_addr;
changed |= IEEE802154_LLSEC_PARAM_COORD_SHORTADDR;

params.coord_hwaddr = params.hwaddr;
changed |= IEEE802154_LLSEC_PARAM_COORD_HWADDR;

rc = ops->llsec->set_params(dev, &params, changed);
}

return rc;
return mac802154_set_params(dev, &params, changed);
}

static int mac802154_set_mac_params(struct net_device *dev,
Expand Down

0 comments on commit 641459c

Please sign in to comment.