* [PATCH bluetooth-next 0/2] ieee802154: add support for current cca ed level
@ 2015-05-27 11:42 Alexander Aring
2015-05-27 11:42 ` [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info Alexander Aring
2015-05-27 11:42 ` [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level Alexander Aring
0 siblings, 2 replies; 7+ messages in thread
From: Alexander Aring @ 2015-05-27 11:42 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
Hi,
this patch series based on ("ieee802154: add set transmit power support")
and support handling for setting current phy cca ed level. This value should
only be necessary if cca_mode is something with an energy detection level
threshold and max frame retries is 0 or above, which do the CSMA-CA handling.
Currently this value is printed always out, doesn't depend if it's really
used or not. It's just represent the current register setting when phy
supports this handling.
- Alex
Alexander Aring (2):
nl802154: add support for cca ed level info
nl802154: add support to set cca ed level
include/net/cfg802154.h | 1 +
net/ieee802154/nl802154.c | 37 +++++++++++++++++++++++++++++++++++++
net/ieee802154/rdev-ops.h | 11 +++++++++++
net/ieee802154/trace.h | 15 +++++++++++++++
net/mac802154/cfg.c | 19 +++++++++++++++++++
5 files changed, 83 insertions(+)
--
2.4.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info
2015-05-27 11:42 [PATCH bluetooth-next 0/2] ieee802154: add support for current cca ed level Alexander Aring
@ 2015-05-27 11:42 ` Alexander Aring
2015-05-27 11:54 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
2015-05-27 11:42 ` [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level Alexander Aring
1 sibling, 2 replies; 7+ messages in thread
From: Alexander Aring @ 2015-05-27 11:42 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch adds information about the current cca ed level when the phy
is dumped over nl802154.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
net/ieee802154/nl802154.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index 5c9d524..a89d9d0 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -211,6 +211,7 @@ static const struct nla_policy nl802154_policy[NL802154_ATTR_MAX+1] = {
[NL802154_ATTR_CCA_MODE] = { .type = NLA_U32, },
[NL802154_ATTR_CCA_OPT] = { .type = NLA_U32, },
+ [NL802154_ATTR_CCA_ED_LEVEL] = { .type = NLA_S32, },
[NL802154_ATTR_SUPPORTED_CHANNEL] = { .type = NLA_U32, },
@@ -421,6 +422,12 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
goto nla_put_failure;
}
+ if (rdev->wpan_phy.flags & WPAN_PHY_FLAG_CCA_ED_LEVEL) {
+ if (nla_put_s32(msg, NL802154_ATTR_CCA_ED_LEVEL,
+ rdev->wpan_phy.cca_ed_level))
+ goto nla_put_failure;
+ }
+
if (nl802154_put_capabilities(msg, rdev))
goto nla_put_failure;
--
2.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level
2015-05-27 11:42 [PATCH bluetooth-next 0/2] ieee802154: add support for current cca ed level Alexander Aring
2015-05-27 11:42 ` [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info Alexander Aring
@ 2015-05-27 11:42 ` Alexander Aring
2015-05-27 11:55 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
1 sibling, 2 replies; 7+ messages in thread
From: Alexander Aring @ 2015-05-27 11:42 UTC (permalink / raw)
To: linux-wpan; +Cc: kernel, Alexander Aring
This patch adds support for setting the current cca ed level value over
nl802154.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
include/net/cfg802154.h | 1 +
net/ieee802154/nl802154.c | 30 ++++++++++++++++++++++++++++++
net/ieee802154/rdev-ops.h | 11 +++++++++++
net/ieee802154/trace.h | 15 +++++++++++++++
net/mac802154/cfg.c | 19 +++++++++++++++++++
5 files changed, 76 insertions(+)
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h
index 2e3bb01..290a9a6 100644
--- a/include/net/cfg802154.h
+++ b/include/net/cfg802154.h
@@ -44,6 +44,7 @@ struct cfg802154_ops {
int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel);
int (*set_cca_mode)(struct wpan_phy *wpan_phy,
const struct wpan_phy_cca *cca);
+ int (*set_cca_ed_level)(struct wpan_phy *wpan_phy, s32 ed_level);
int (*set_tx_power)(struct wpan_phy *wpan_phy, s32 power);
int (*set_pan_id)(struct wpan_phy *wpan_phy,
struct wpan_dev *wpan_dev, __le16 pan_id);
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index a89d9d0..7dbb1f4 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -790,6 +790,28 @@ static int nl802154_set_cca_mode(struct sk_buff *skb, struct genl_info *info)
return rdev_set_cca_mode(rdev, &cca);
}
+static int nl802154_set_cca_ed_level(struct sk_buff *skb, struct genl_info *info)
+{
+ struct cfg802154_registered_device *rdev = info->user_ptr[0];
+ s32 ed_level;
+ int i;
+
+ if (!(rdev->wpan_phy.flags & WPAN_PHY_FLAG_CCA_ED_LEVEL))
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL802154_ATTR_CCA_ED_LEVEL])
+ return -EINVAL;
+
+ ed_level = nla_get_s32(info->attrs[NL802154_ATTR_CCA_ED_LEVEL]);
+
+ for (i = 0; i < rdev->wpan_phy.supported.cca_ed_levels_size; i++) {
+ if (ed_level == rdev->wpan_phy.supported.cca_ed_levels[i])
+ return rdev_set_cca_ed_level(rdev, ed_level);
+ }
+
+ return -EINVAL;
+}
+
static int nl802154_set_tx_power(struct sk_buff *skb, struct genl_info *info)
{
struct cfg802154_registered_device *rdev = info->user_ptr[0];
@@ -1123,6 +1145,14 @@ static const struct genl_ops nl802154_ops[] = {
NL802154_FLAG_NEED_RTNL,
},
{
+ .cmd = NL802154_CMD_SET_CCA_ED_LEVEL,
+ .doit = nl802154_set_cca_ed_level,
+ .policy = nl802154_policy,
+ .flags = GENL_ADMIN_PERM,
+ .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
+ NL802154_FLAG_NEED_RTNL,
+ },
+ {
.cmd = NL802154_CMD_SET_TX_POWER,
.doit = nl802154_set_tx_power,
.policy = nl802154_policy,
diff --git a/net/ieee802154/rdev-ops.h b/net/ieee802154/rdev-ops.h
index 3645611..b2155a1 100644
--- a/net/ieee802154/rdev-ops.h
+++ b/net/ieee802154/rdev-ops.h
@@ -75,6 +75,17 @@ rdev_set_cca_mode(struct cfg802154_registered_device *rdev,
}
static inline int
+rdev_set_cca_ed_level(struct cfg802154_registered_device *rdev, s32 ed_level)
+{
+ int ret;
+
+ trace_802154_rdev_set_cca_ed_level(&rdev->wpan_phy, ed_level);
+ ret = rdev->ops->set_cca_ed_level(&rdev->wpan_phy, ed_level);
+ trace_802154_rdev_return_int(&rdev->wpan_phy, ret);
+ return ret;
+}
+
+static inline int
rdev_set_tx_power(struct cfg802154_registered_device *rdev,
s32 power)
{
diff --git a/net/ieee802154/trace.h b/net/ieee802154/trace.h
index 1f1cecc..257806d 100644
--- a/net/ieee802154/trace.h
+++ b/net/ieee802154/trace.h
@@ -123,6 +123,21 @@ TRACE_EVENT(802154_rdev_set_cca_mode,
WPAN_CCA_PR_ARG)
);
+TRACE_EVENT(802154_rdev_set_cca_ed_level,
+ TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
+ TP_ARGS(wpan_phy, ed_level),
+ TP_STRUCT__entry(
+ WPAN_PHY_ENTRY
+ __field(s32, ed_level)
+ ),
+ TP_fast_assign(
+ WPAN_PHY_ASSIGN;
+ __entry->ed_level = ed_level;
+ ),
+ TP_printk(WPAN_PHY_PR_FMT ", ed_level: %d", WPAN_PHY_PR_ARG,
+ __entry->ed_level)
+);
+
DECLARE_EVENT_CLASS(802154_le16_template,
TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
__le16 le16arg),
diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
index ab12fa2..317c466 100644
--- a/net/mac802154/cfg.c
+++ b/net/mac802154/cfg.c
@@ -106,6 +106,24 @@ ieee802154_set_cca_mode(struct wpan_phy *wpan_phy,
}
static int
+ieee802154_set_cca_ed_level(struct wpan_phy *wpan_phy, s32 ed_level)
+{
+ struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
+ int ret;
+
+ ASSERT_RTNL();
+
+ if (wpan_phy->cca_ed_level == ed_level)
+ return 0;
+
+ ret = drv_set_cca_ed_level(local, ed_level);
+ if (!ret)
+ wpan_phy->cca_ed_level = ed_level;
+
+ return ret;
+}
+
+static int
ieee802154_set_tx_power(struct wpan_phy *wpan_phy, s32 power)
{
struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
@@ -213,6 +231,7 @@ const struct cfg802154_ops mac802154_config_ops = {
.del_virtual_intf = ieee802154_del_iface,
.set_channel = ieee802154_set_channel,
.set_cca_mode = ieee802154_set_cca_mode,
+ .set_cca_ed_level = ieee802154_set_cca_ed_level,
.set_tx_power = ieee802154_set_tx_power,
.set_pan_id = ieee802154_set_pan_id,
.set_short_addr = ieee802154_set_short_addr,
--
2.4.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info
2015-05-27 11:42 ` [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info Alexander Aring
@ 2015-05-27 11:54 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
1 sibling, 0 replies; 7+ messages in thread
From: Varka Bhadram @ 2015-05-27 11:54 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 05/27/2015 05:12 PM, Alexander Aring wrote:
> This patch adds information about the current cca ed level when the phy
> is dumped over nl802154.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/ieee802154/nl802154.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> index 5c9d524..a89d9d0 100644
> --- a/net/ieee802154/nl802154.c
> +++ b/net/ieee802154/nl802154.c
> @@ -211,6 +211,7 @@ static const struct nla_policy nl802154_policy[NL802154_ATTR_MAX+1] = {
>
> [NL802154_ATTR_CCA_MODE] = { .type = NLA_U32, },
> [NL802154_ATTR_CCA_OPT] = { .type = NLA_U32, },
> + [NL802154_ATTR_CCA_ED_LEVEL] = { .type = NLA_S32, },
>
> [NL802154_ATTR_SUPPORTED_CHANNEL] = { .type = NLA_U32, },
>
> @@ -421,6 +422,12 @@ static int nl802154_send_wpan_phy(struct cfg802154_registered_device *rdev,
> goto nla_put_failure;
> }
>
> + if (rdev->wpan_phy.flags & WPAN_PHY_FLAG_CCA_ED_LEVEL) {
> + if (nla_put_s32(msg, NL802154_ATTR_CCA_ED_LEVEL,
> + rdev->wpan_phy.cca_ed_level))
> + goto nla_put_failure;
> + }
> +
> if (nl802154_put_capabilities(msg, rdev))
> goto nla_put_failure;
>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
--
Varka Bhadram
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level
2015-05-27 11:42 ` [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level Alexander Aring
@ 2015-05-27 11:55 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
1 sibling, 0 replies; 7+ messages in thread
From: Varka Bhadram @ 2015-05-27 11:55 UTC (permalink / raw)
To: Alexander Aring, linux-wpan; +Cc: kernel
On 05/27/2015 05:12 PM, Alexander Aring wrote:
> This patch adds support for setting the current cca ed level value over
> nl802154.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Reviewed-by: Varka Bhadram <varkabhadram@gmail.com>
--
Varka Bhadram
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level
2015-05-27 11:42 ` [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level Alexander Aring
2015-05-27 11:55 ` Varka Bhadram
@ 2015-05-27 17:32 ` Marcel Holtmann
1 sibling, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2015-05-27 17:32 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
Hi Alex,
> This patch adds support for setting the current cca ed level value over
> nl802154.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> include/net/cfg802154.h | 1 +
> net/ieee802154/nl802154.c | 30 ++++++++++++++++++++++++++++++
> net/ieee802154/rdev-ops.h | 11 +++++++++++
> net/ieee802154/trace.h | 15 +++++++++++++++
> net/mac802154/cfg.c | 19 +++++++++++++++++++
> 5 files changed, 76 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info
2015-05-27 11:42 ` [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info Alexander Aring
2015-05-27 11:54 ` Varka Bhadram
@ 2015-05-27 17:32 ` Marcel Holtmann
1 sibling, 0 replies; 7+ messages in thread
From: Marcel Holtmann @ 2015-05-27 17:32 UTC (permalink / raw)
To: Alexander Aring; +Cc: linux-wpan, kernel
Hi Alex,
> This patch adds information about the current cca ed level when the phy
> is dumped over nl802154.
>
> Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> ---
> net/ieee802154/nl802154.c | 7 +++++++
> 1 file changed, 7 insertions(+)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-05-27 17:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 11:42 [PATCH bluetooth-next 0/2] ieee802154: add support for current cca ed level Alexander Aring
2015-05-27 11:42 ` [PATCH bluetooth-next 1/2] nl802154: add support for cca ed level info Alexander Aring
2015-05-27 11:54 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
2015-05-27 11:42 ` [PATCH bluetooth-next 2/2] nl802154: add support to set cca ed level Alexander Aring
2015-05-27 11:55 ` Varka Bhadram
2015-05-27 17:32 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.