mac802154: check for really changes
This patch adds check if the value is really changed inside pib/mib.
If a transceiver do support only one value for e.g. max_be then this
will also handle that the driver layer doesn't need to care about
handling to set one value only.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
index c636015..45c4dc3 100644
--- a/net/mac802154/cfg.c
+++ b/net/mac802154/cfg.c
@@ -73,6 +73,10 @@
ASSERT_RTNL();
+ if (wpan_phy->current_page == page &&
+ wpan_phy->current_channel == channel)
+ return 0;
+
ret = drv_set_channel(local, page, channel);
if (!ret) {
wpan_phy->current_page = page;
@@ -91,6 +95,9 @@
ASSERT_RTNL();
+ if (wpan_phy_cca_cmp(&wpan_phy->cca, cca))
+ return 0;
+
/* check if phy support this setting */
if (!(local->hw.flags & IEEE802154_HW_CCA_MODE))
return -EOPNOTSUPP;
@@ -108,6 +115,9 @@
{
ASSERT_RTNL();
+ if (wpan_dev->pan_id == pan_id)
+ return 0;
+
wpan_dev->pan_id = pan_id;
return 0;
}
@@ -121,6 +131,10 @@
ASSERT_RTNL();
+ if (wpan_dev->min_be == min_be &&
+ wpan_dev->max_be == max_be)
+ return 0;
+
if (!(local->hw.flags & IEEE802154_HW_CSMA_PARAMS))
return -EOPNOTSUPP;
@@ -135,6 +149,9 @@
{
ASSERT_RTNL();
+ if (wpan_dev->short_addr == short_addr)
+ return 0;
+
wpan_dev->short_addr = short_addr;
return 0;
}
@@ -148,6 +165,9 @@
ASSERT_RTNL();
+ if (wpan_dev->csma_retries == max_csma_backoffs)
+ return 0;
+
if (!(local->hw.flags & IEEE802154_HW_CSMA_PARAMS))
return -EOPNOTSUPP;
@@ -164,6 +184,9 @@
ASSERT_RTNL();
+ if (wpan_dev->frame_retries == max_frame_retries)
+ return 0;
+
if (!(local->hw.flags & IEEE802154_HW_FRAME_RETRIES))
return -EOPNOTSUPP;
@@ -179,6 +202,9 @@
ASSERT_RTNL();
+ if (wpan_dev->lbt == mode)
+ return 0;
+
if (!(local->hw.flags & IEEE802154_HW_LBT))
return -EOPNOTSUPP;