From patchwork Mon Jan 30 15:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13121391 X-Patchwork-Delegate: stefan@osg.samsung.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EEB7C54EED for ; Mon, 30 Jan 2023 15:50:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237736AbjA3Puv (ORCPT ); Mon, 30 Jan 2023 10:50:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237990AbjA3Pui (ORCPT ); Mon, 30 Jan 2023 10:50:38 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD67842DE4 for ; Mon, 30 Jan 2023 07:50:27 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 6AAFAE0008; Mon, 30 Jan 2023 15:50:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675093826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EMceWOT0lwlbGZo+3g5/yUzadG2Ncnd3KE3++qy+xy8=; b=O0obdhLBCwSWzDnHQAWzMDslz3oiHEWbzdTFnq5m99HTYiV0U/cCpVnMlsy1tZYj8Gz2yY oNAIL9T3WDdYx6W3OjJBlqj268+8Qgvsj9o3PuNhbKF9EUPFJEjyJSvqJ+7xTB1f14ytdF jh6q4gNcmq6ShGRkbQ4e2aVSz1cdpjdf3o93oYifx/FFk8CCcuajTwoEgoisttZr9BJxcN 8hRALn+n9sS2YzCRjn1D/f9KU05wA/Mt+ieUdB7iLb4b3EG1sFnesq0lhXZL/qWhakzEcN Qatlt6AfZ7Iot+OgNhK53CjYtZ2LvtOiRsfAuFLU+JjhbzmJGW8Vb38NIRU+bw== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Guilhem Imberton , Thomas Petazzoni , Miquel Raynal Subject: [wpan-tools 1/2] iwpan: Synchronize nl802154.h with the latest beaconing changes Date: Mon, 30 Jan 2023 16:50:21 +0100 Message-Id: <20230130155022.115117-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130155022.115117-1-miquel.raynal@bootlin.com> References: <20230130155022.115117-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org The content of this file has evolved, reflect the changes accepted in the mainline Linux kernel here with the additional beaconing definitions. Signed-off-by: Miquel Raynal --- src/nl802154.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/nl802154.h b/src/nl802154.h index 648fc93..dbad1c9 100644 --- a/src/nl802154.h +++ b/src/nl802154.h @@ -74,6 +74,8 @@ enum nl802154_commands { NL802154_CMD_TRIGGER_SCAN, NL802154_CMD_ABORT_SCAN, NL802154_CMD_SCAN_DONE, + NL802154_CMD_SEND_BEACONS, + NL802154_CMD_STOP_BEACONS, /* add new commands above here */ @@ -142,6 +144,7 @@ enum nl802154_attrs { NL802154_ATTR_SCAN_MEAN_PRF, NL802154_ATTR_SCAN_DURATION, NL802154_ATTR_SCAN_DONE_REASON, + NL802154_ATTR_BEACON_INTERVAL, /* add attributes here, update the policy in nl802154.c */ From patchwork Mon Jan 30 15:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miquel Raynal X-Patchwork-Id: 13121392 X-Patchwork-Delegate: stefan@osg.samsung.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30C18C54EAA for ; Mon, 30 Jan 2023 15:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237297AbjA3Puy (ORCPT ); Mon, 30 Jan 2023 10:50:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237862AbjA3Pul (ORCPT ); Mon, 30 Jan 2023 10:50:41 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FEC16A54 for ; Mon, 30 Jan 2023 07:50:29 -0800 (PST) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 651A6E0002; Mon, 30 Jan 2023 15:50:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675093828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+lk5BhyUXCk0wAHnoa2lzAXjGYSpRRgr9FFxs99Fc6Q=; b=Fvmde/eFxEbEG8SBAh1d2KNQDKD7v96tlpKePxqCiMXaI0tvan5JQ/qikIYkRfxiezA4Lz /ZHwSc/Rlf2lPBuDqji3tUgRzruLJHIusXcP7nVaQO2BONeq0NduF98TJknDN03TCU49+Y XgKN+uog8/iGG04aKBzp5VnMW+G+xug4X+xTsZ977Vt0d+ytHMc+MKuz4EIBcBl+irvlYg Dp6fXhWMZxvxUSRYT9nffSyrTZ5BpD1T9jn/t2sKQOk+zO6tr8awxT/SuwUOFJ8lQanw+B aKLiCrDjNLvdWVajNVWdoCHDYpYc8EJacR1khvMU+AfFPT8Wpziq0xcNNwZ5aQ== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Guilhem Imberton , Thomas Petazzoni , Miquel Raynal Subject: [wpan-tools 2/2] iwpan: Add beaconing support Date: Mon, 30 Jan 2023 16:50:22 +0100 Message-Id: <20230130155022.115117-3-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130155022.115117-1-miquel.raynal@bootlin.com> References: <20230130155022.115117-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org From: David Girault Support interacting with the kernel to request beacons to be sent or stopped on a particular interface. Signed-off-by: David Girault Signed-off-by: Miquel Raynal --- src/scan.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/scan.c b/src/scan.c index 63a5e24..e92702d 100644 --- a/src/scan.c +++ b/src/scan.c @@ -546,3 +546,46 @@ COMMAND(scan, trigger, NL802154_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, scan_trigger_handler, "Launch scanning on this virtual interface with the given configuration.\n" SCAN_TYPES); + +SECTION(beacons); + +static int send_beacons_handler(struct nl802154_state *state, struct nl_cb *cb, + struct nl_msg *msg, int argc, char **argv, + enum id_input id) +{ + unsigned long interval; + bool valid_interval; + int tpset; + + tpset = get_option_value(&argc, &argv, "interval", &interval, &valid_interval); + if (tpset) + return tpset; + if (valid_interval && interval > UINT8_MAX) + return 1; + + if (argc) + return 1; + + /* Optional arguments */ + if (valid_interval) + NLA_PUT_U8(msg, NL802154_ATTR_BEACON_INTERVAL, interval); + + return 0; + +nla_put_failure: + return -ENOBUFS; +} + +static int stop_beacons_handler(struct nl802154_state *state, struct nl_cb *cb, + struct nl_msg *msg, int argc, char **argv, + enum id_input id) +{ + return 0; +} + +COMMAND(beacons, stop, NULL, + NL802154_CMD_STOP_BEACONS, 0, CIB_NETDEV, stop_beacons_handler, + "Stop sending beacons on this interface."); +COMMAND(beacons, send, "[interval ]", + NL802154_CMD_SEND_BEACONS, 0, CIB_NETDEV, send_beacons_handler, + "Send beacons on this virtual interface at a regular pace.");