Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: Christoffer Holmstedt <christoffer@christofferholmstedt.se>
Cc: linux-wpan@vger.kernel.org
Subject: Re: [PATCH v3 wpan-tools 1/3] info: add cca mode descriptive text to output
Date: Wed, 10 Jun 2015 14:17:13 +0200	[thread overview]
Message-ID: <20150610121712.GA6647@omega> (raw)
In-Reply-To: <1433935089-27119-2-git-send-email-christoffer@christofferholmstedt.se>

On Wed, Jun 10, 2015 at 01:18:07PM +0200, Christoffer Holmstedt wrote:
> Signed-off-by: Christoffer Holmstedt <christoffer@christofferholmstedt.se>
> ---
>  src/info.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
>  1 file changed, 63 insertions(+), 18 deletions(-)
> 
> diff --git a/src/info.c b/src/info.c
> index 2434bef6a87f..364c02f718aa 100644
> --- a/src/info.c
> +++ b/src/info.c
> @@ -146,6 +146,41 @@ static void print_freq_handler(int channel_page, int channel)
>  	}
>  }
>  
> +static char cca_mode_buf[100];
> +
> +const char *print_cca_mode_handler(enum nl802154_cca_modes cca_mode,
> +				   enum nl802154_cca_opts cca_opt)
> +{
> +	switch (cca_mode) {
> +	case NL802154_CCA_ENERGY:
> +		return "Energy above threshold";
> +	case NL802154_CCA_CARRIER:
> +		return "Carrier sense only";
> +	case NL802154_CCA_ENERGY_CARRIER:
> +		switch (cca_opt) {
> +		case NL802154_CCA_OPT_ENERGY_CARRIER_AND:
> +			return "Carrier sense with energy above threshold (logical operator is 'and')";
> +		case NL802154_CCA_OPT_ENERGY_CARRIER_OR:
> +			return "Carrier sense with energy above threshold (logical operator is 'or')";
> +		default:
> +			sprintf(cca_mode_buf,
> +				"Unknown CCA option (%d) for CCA mode (%d)",
> +				cca_opt,
> +				cca_mode);
> +			return cca_mode_buf;
> +		}
> +	case NL802154_CCA_ALOHA:
> +		return "ALOHA";
> +	case NL802154_CCA_UWB_SHR:
> +		return "UWB preamble sense based on the SHR of a frame";
> +	case NL802154_CCA_UWB_MULTIPEXED:
> +		return "UWB preamble sense based on the packet with the multiplexed preamble";
> +	default:
> +		sprintf(cca_mode_buf, "Unknown CCA mode (%d)", cca_mode);
> +		return cca_mode_buf;
> +	}
> +}
> +
>  static const char *commands[NL802154_CMD_MAX + 1] = {
>  	[NL802154_CMD_UNSPEC] = "unspec",
>  	[NL802154_CMD_GET_WPAN_PHY] = "get_wpan_phy",
> @@ -235,23 +270,13 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
>  	}
>  
>  	if (tb_msg[NL802154_ATTR_CCA_MODE]) {
> +		enum nl802154_cca_opts cca_opt = 99;

use:

NL802154_CCA_OPT_ATTR_MAX

should always be invalid. Maybe there exists a better way to evaluate
the tb_msg[NL802154_ATTR_CCA_MODE] first when somewhere is a cca_mode
which have some option (like cca_mode == 3). I don't know how to do it
_exactly_ better now. I am fine with your current solution.

Can you try to add first a patch which updates the nl802154.h from the
kernel "just for syncing" and then replace the cca_mode printout. And
please fixup patch 2 with 1.

Then you have:

1. patch which sync the nl802154 header with the kernel
2. patch which replace the cca modes printout with your implementation.


Current behaviour would have some state in wpan-tools which we
havn't any cca output, this is the case when I apply patch 1 only in your
series.

- Alex

  reply	other threads:[~2015-06-10 12:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  9:20 [PATCH wpan-tools 0/2] Update cca mode and options output Christoffer Holmstedt
2015-06-04 11:02 ` Alexander Aring
2015-06-04 11:24   ` Christoffer Holmstedt
2015-06-04 11:51 ` Varka Bhadram
2015-06-04 12:12   ` Christoffer Holmstedt
2015-06-09 14:05 ` [PATCH v2 wpan-tools 0/2] Update CCA mode and CCA " christoffer
2015-06-09 14:05   ` [PATCH v2 wpan-tools 1/2] info: add cca mode descriptive text to output christoffer
2015-06-09 14:05   ` [PATCH v2 wpan-tools 2/2] info: remove old cca options capabilities output christoffer
2015-06-10 11:18 ` [PATCH v3 wpan-tools 0/3] Update CCA mode and CCA options output Christoffer Holmstedt
2015-06-10 11:18   ` [PATCH v3 wpan-tools 1/3] info: add cca mode descriptive text to output Christoffer Holmstedt
2015-06-10 12:17     ` Alexander Aring [this message]
2015-06-10 12:29       ` Christoffer Holmstedt
2015-06-10 12:39       ` [PATCH wpan-tools] nl802154: fix misspelled enum Christoffer Holmstedt
2015-06-10 12:42         ` Alexander Aring
2015-06-10 13:07       ` [PATCH v4 wpan-tools] info: update CCA mode and CCA options output Christoffer Holmstedt
2015-06-10 13:45         ` Alexander Aring
2015-06-11  6:16           ` Christoffer Holmstedt
2015-06-11  7:42             ` Alexander Aring
2015-06-11  8:13               ` Christoffer Holmstedt
2015-06-11  8:16         ` [PATCH v5 " Christoffer Holmstedt
2015-06-11 10:14         ` [PATCH v4 " Alexander Aring
2015-06-11 11:14           ` Christoffer Holmstedt
2015-06-11 12:25           ` [PATCH v6 " Christoffer Holmstedt
2015-06-11 13:28             ` Alexander Aring
2015-06-10 11:18   ` [PATCH v3 wpan-tools 2/3] info: remove old cca options capabilities output Christoffer Holmstedt
2015-06-10 11:18   ` [PATCH v3 wpan-tools 3/3] nl802154: fix misspelled enum Christoffer Holmstedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150610121712.GA6647@omega \
    --to=alex.aring@gmail.com \
    --cc=christoffer@christofferholmstedt.se \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox