netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Schmidt <stefan@datenfreihafen.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Alexander Aring <alex.aring@gmail.com>,
	linux-wpan@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	netdev@vger.kernel.org, David Girault <david.girault@qorvo.com>,
	Romuald Despres <romuald.despres@qorvo.com>,
	Frederic Blain <frederic.blain@qorvo.com>,
	Nicolas Schodet <nico@ni.fr.eu.org>,
	Guilhem Imberton <guilhem.imberton@qorvo.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan-next v2 11/11] ieee802154: Give the user the association list
Date: Sat, 16 Sep 2023 17:36:41 +0200	[thread overview]
Message-ID: <385bff6c-1322-d2ea-16df-6e005888db0b@datenfreihafen.org> (raw)
In-Reply-To: <20230901170501.1066321-12-miquel.raynal@bootlin.com>

Hello Miquel.

On 01.09.23 19:05, Miquel Raynal wrote:
> Upon request, we must be able to provide to the user the list of
> associations currently in place. Let's add a new netlink command and
> attribute for this purpose.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>   include/net/nl802154.h    |  18 ++++++-
>   net/ieee802154/nl802154.c | 107 ++++++++++++++++++++++++++++++++++++++
>   2 files changed, 123 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/nl802154.h b/include/net/nl802154.h
> index 8b26faae49e8..4c752f799957 100644
> --- a/include/net/nl802154.h
> +++ b/include/net/nl802154.h
> @@ -81,6 +81,7 @@ enum nl802154_commands {
>   	NL802154_CMD_ASSOCIATE,
>   	NL802154_CMD_DISASSOCIATE,
>   	NL802154_CMD_SET_MAX_ASSOCIATIONS,
> +	NL802154_CMD_LIST_ASSOCIATIONS,
>   
>   	/* add new commands above here */
>   
> @@ -151,6 +152,7 @@ enum nl802154_attrs {
>   	NL802154_ATTR_SCAN_DONE_REASON,
>   	NL802154_ATTR_BEACON_INTERVAL,
>   	NL802154_ATTR_MAX_ASSOCIATIONS,
> +	NL802154_ATTR_PEER,
>   
>   	/* add attributes here, update the policy in nl802154.c */
>   
> @@ -389,8 +391,6 @@ enum nl802154_supported_bool_states {
>   	NL802154_SUPPORTED_BOOL_MAX = __NL802154_SUPPORTED_BOOL_AFTER_LAST - 1
>   };
>   
> -#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
> -
>   enum nl802154_dev_addr_modes {
>   	NL802154_DEV_ADDR_NONE,
>   	__NL802154_DEV_ADDR_INVALID,
> @@ -410,12 +410,26 @@ enum nl802154_dev_addr_attrs {
>   	NL802154_DEV_ADDR_ATTR_SHORT,
>   	NL802154_DEV_ADDR_ATTR_EXTENDED,
>   	NL802154_DEV_ADDR_ATTR_PAD,
> +	NL802154_DEV_ADDR_ATTR_PEER_TYPE,
>   
>   	/* keep last */
>   	__NL802154_DEV_ADDR_ATTR_AFTER_LAST,
>   	NL802154_DEV_ADDR_ATTR_MAX = __NL802154_DEV_ADDR_ATTR_AFTER_LAST - 1
>   };
>   
> +enum nl802154_peer_type {
> +	NL802154_PEER_TYPE_UNSPEC,
> +
> +	NL802154_PEER_TYPE_PARENT,
> +	NL802154_PEER_TYPE_CHILD,
> +
> +	/* keep last */
> +	__NL802154_PEER_TYPE_AFTER_LAST,
> +	NL802154_PEER_TYPE_MAX = __NL802154_PEER_TYPE_AFTER_LAST - 1
> +};
> +
> +#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
> +
>   enum nl802154_key_id_modes {
>   	NL802154_KEY_ID_MODE_IMPLICIT,
>   	NL802154_KEY_ID_MODE_INDEX,
> diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
> index e16e57fc34d0..e26d7cec02ce 100644
> --- a/net/ieee802154/nl802154.c
> +++ b/net/ieee802154/nl802154.c
> @@ -235,6 +235,7 @@ static const struct nla_policy nl802154_policy[NL802154_ATTR_MAX+1] = {
>   	[NL802154_ATTR_BEACON_INTERVAL] =
>   		NLA_POLICY_MAX(NLA_U8, IEEE802154_ACTIVE_SCAN_DURATION),
>   	[NL802154_ATTR_MAX_ASSOCIATIONS] = { .type = NLA_U32 },
> +	[NL802154_ATTR_PEER] = { .type = NLA_NESTED },
>   
>   #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
>   	[NL802154_ATTR_SEC_ENABLED] = { .type = NLA_U8, },
> @@ -1717,6 +1718,107 @@ static int nl802154_set_max_associations(struct sk_buff *skb, struct genl_info *
>   	return 0;
>   }
>   
> +static int nl802154_send_peer_info(struct sk_buff *msg,
> +				   struct netlink_callback *cb,
> +				   u32 seq, int flags,
> +				   struct cfg802154_registered_device *rdev,
> +				   struct wpan_dev *wpan_dev,
> +				   struct ieee802154_pan_device *peer,
> +				   enum nl802154_peer_type type)
> +{
> +	struct nlattr *nla;
> +	void *hdr;
> +
> +	ASSERT_RTNL();
> +
> +	hdr = nl802154hdr_put(msg, NETLINK_CB(cb->skb).portid, seq, flags,
> +			      NL802154_CMD_LIST_ASSOCIATIONS);
> +	if (!hdr)
> +		return -ENOBUFS;
> +
> +	genl_dump_check_consistent(cb, hdr);
> +
> +	if (nla_put_u32(msg, NL802154_ATTR_GENERATION,
> +			wpan_dev->association_generation))


This one still confuses me. I only ever see it increasing in the code. 
Did I miss something?

regards
Stefan Schmidt

  reply	other threads:[~2023-09-16 15:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-01 17:04 [PATCH wpan-next v2 00/11] ieee802154: Associations between devices Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 01/11] ieee802154: Let PAN IDs be reset Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 02/11] ieee802154: Internal PAN management Miquel Raynal
2023-09-16 15:36   ` Stefan Schmidt
2023-09-17 11:50     ` Alexander Aring
2023-09-18  9:01       ` Miquel Raynal
2023-09-18 11:11         ` Alexander Aring
2023-09-18 14:15           ` Miquel Raynal
2023-09-18 23:01             ` Alexander Aring
2023-09-19  7:14               ` Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 03/11] ieee802154: Add support for user association requests Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 04/11] mac802154: Handle associating Miquel Raynal
2023-09-16 15:36   ` Stefan Schmidt
2023-09-01 17:04 ` [PATCH wpan-next v2 05/11] ieee802154: Add support for user disassociation requests Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 06/11] mac802154: Handle disassociations Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 07/11] mac802154: Handle association requests from peers Miquel Raynal
2023-09-16 15:36   ` Stefan Schmidt
2023-09-18  7:36     ` Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 08/11] ieee802154: Add support for limiting the number of associated devices Miquel Raynal
2023-09-01 17:04 ` [PATCH wpan-next v2 09/11] mac802154: Follow " Miquel Raynal
2023-09-01 17:05 ` [PATCH wpan-next v2 10/11] mac802154: Handle disassociation notifications from peers Miquel Raynal
2023-09-01 17:05 ` [PATCH wpan-next v2 11/11] ieee802154: Give the user the association list Miquel Raynal
2023-09-16 15:36   ` Stefan Schmidt [this message]
2023-09-18  7:08     ` Miquel Raynal
2023-09-18 15:41       ` Stefan Schmidt

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=385bff6c-1322-d2ea-16df-6e005888db0b@datenfreihafen.org \
    --to=stefan@datenfreihafen.org \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=david.girault@qorvo.com \
    --cc=edumazet@google.com \
    --cc=frederic.blain@qorvo.com \
    --cc=guilhem.imberton@qorvo.com \
    --cc=kuba@kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nico@ni.fr.eu.org \
    --cc=pabeni@redhat.com \
    --cc=romuald.despres@qorvo.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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;
as well as URLs for NNTP newsgroup(s).