diff options
author | Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de> | 2014-02-17 05:34:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-17 16:42:39 -0500 |
commit | 4244db1b0b7bc9ab7b67d8c1c38de6cf15bc87a8 (patch) | |
tree | c729b4b8546421f0f17fd5e9bee0820e2335882d /net/mac802154 | |
parent | 7dcbd22a97eb0689e6c583ad630ae0e7341e34c1 (diff) |
ieee802154: add netlink APIs for smartMAC configuration
Introduce new netlink attributes for SET_PHY_ATTRS:
* CSMA minimal backoff exponent
* CSMA maximal backoff exponent
* CSMA retry limit
* frame retransmission limit
The CSMA attributes shall correspond to minBE, maxBE and maxCSMABackoffs of
802.15.4, respectively. The frame retransmission shall correspond to
maxFrameRetries of 802.15.4, unless given as -1: then the old behaviour
of the stack shall apply. For RF2xy, the old behaviour is to not do
channel sensing at all and simply send *right now*, which is not
intended behaviour for most applications and actually prohibited for
some channel/page combinations.
For all values except frame retransmission limit, the defaults of
802.15.4 apply. Frame retransmission limits are set to -1 to indicate
backward-compatible behaviour.
Signed-off-by: Phoebe Buckheister <phoebe.buckheister@itwm.fraunhofer.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac802154')
-rw-r--r-- | net/mac802154/ieee802154_dev.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/mac802154/ieee802154_dev.c b/net/mac802154/ieee802154_dev.c index 4707f36546d3..b75bb01e5c6b 100644 --- a/net/mac802154/ieee802154_dev.c +++ b/net/mac802154/ieee802154_dev.c | |||
@@ -205,6 +205,27 @@ static int mac802154_set_cca_ed_level(struct wpan_phy *phy, s32 level) | |||
205 | return priv->ops->set_cca_ed_level(&priv->hw, level); | 205 | return priv->ops->set_cca_ed_level(&priv->hw, level); |
206 | } | 206 | } |
207 | 207 | ||
208 | static int mac802154_set_csma_params(struct wpan_phy *phy, u8 min_be, | ||
209 | u8 max_be, u8 retries) | ||
210 | { | ||
211 | struct mac802154_priv *priv = wpan_phy_priv(phy); | ||
212 | |||
213 | if (!priv->ops->set_csma_params) | ||
214 | return -ENOTSUPP; | ||
215 | |||
216 | return priv->ops->set_csma_params(&priv->hw, min_be, max_be, retries); | ||
217 | } | ||
218 | |||
219 | static int mac802154_set_frame_retries(struct wpan_phy *phy, s8 retries) | ||
220 | { | ||
221 | struct mac802154_priv *priv = wpan_phy_priv(phy); | ||
222 | |||
223 | if (!priv->ops->set_frame_retries) | ||
224 | return -ENOTSUPP; | ||
225 | |||
226 | return priv->ops->set_frame_retries(&priv->hw, retries); | ||
227 | } | ||
228 | |||
208 | struct ieee802154_dev * | 229 | struct ieee802154_dev * |
209 | ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops) | 230 | ieee802154_alloc_device(size_t priv_data_len, struct ieee802154_ops *ops) |
210 | { | 231 | { |
@@ -286,6 +307,8 @@ int ieee802154_register_device(struct ieee802154_dev *dev) | |||
286 | priv->phy->set_lbt = mac802154_set_lbt; | 307 | priv->phy->set_lbt = mac802154_set_lbt; |
287 | priv->phy->set_cca_mode = mac802154_set_cca_mode; | 308 | priv->phy->set_cca_mode = mac802154_set_cca_mode; |
288 | priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level; | 309 | priv->phy->set_cca_ed_level = mac802154_set_cca_ed_level; |
310 | priv->phy->set_csma_params = mac802154_set_csma_params; | ||
311 | priv->phy->set_frame_retries = mac802154_set_frame_retries; | ||
289 | 312 | ||
290 | rc = wpan_phy_register(priv->phy); | 313 | rc = wpan_phy_register(priv->phy); |
291 | if (rc < 0) | 314 | if (rc < 0) |