From mboxrd@z Thu Jan 1 00:00:00 1970 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 96719C43334 for ; Mon, 20 Jun 2022 14:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349033AbiFTOZG (ORCPT ); Mon, 20 Jun 2022 10:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349958AbiFTOYi (ORCPT ); Mon, 20 Jun 2022 10:24:38 -0400 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::222]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D053329347; Mon, 20 Jun 2022 06:40:24 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 123C940013; Mon, 20 Jun 2022 13:40:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1655732422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xsmXwpaLpw1nXtS9xDuA/axbZikDTvzLXsvuEZT4atc=; b=nA/ja+VE4cgqATIXV6Ln0kUocmi9QnC0u0KGLCpgQt/6qQvs1xTM7CzEFhG+tIvxtPIyaW qCD3xW5x8ZTz0ge9cKORYzfRkGSBBTniRqAaQEEIAmc0dKNbibjoRpvQzDWqtRvCQ3HLoN Ke9xbyQ28NUVDjDqN07a6hT8osZW1Av3YH3mfPVPFLluFPpXFjKNyBn3OYKD2ZuAB9sN/x zcsKF4mCU6YbBHyPw6maFLZobSqXvmyAUfHXEA5Wn7dMXmtOwHQeGgA3iazlSHRFus5ad6 h/7HRtg/mBSULGAL74046/woRoDehONOwSApSeKTCzhRmbQygYJf0BOa3ZXiIQ== From: Miquel Raynal To: Alexander Aring , Stefan Schmidt , linux-wpan@vger.kernel.org Cc: "David S. Miller" , Jakub Kicinski , Paolo Abeni , Eric Dumazet , netdev@vger.kernel.org, David Girault , Romuald Despres , Frederic Blain , Nicolas Schodet , Thomas Petazzoni , Miquel Raynal Subject: [PATCH wpan-next v3 1/4] net: mac802154: Allow the creation of coordinator interfaces Date: Mon, 20 Jun 2022 15:40:15 +0200 Message-Id: <20220620134018.62414-2-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220620134018.62414-1-miquel.raynal@bootlin.com> References: <20220620134018.62414-1-miquel.raynal@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org As a first strep in introducing proper PAN management and association, we need to be able to create coordinator interfaces which might act as coordinator or PAN coordinator. Hence, let's add the minimum support to allow the creation of these interfaces. This might be restrained and improved later. Signed-off-by: Miquel Raynal --- net/mac802154/iface.c | 14 ++++++++------ net/mac802154/rx.c | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c index 500ed1b81250..7ac0c5685d3f 100644 --- a/net/mac802154/iface.c +++ b/net/mac802154/iface.c @@ -273,13 +273,13 @@ ieee802154_check_concurrent_iface(struct ieee802154_sub_if_data *sdata, if (nsdata != sdata && ieee802154_sdata_running(nsdata)) { int ret; - /* TODO currently we don't support multiple node types - * we need to run skb_clone at rx path. Check if there - * exist really an use case if we need to support - * multiple node types at the same time. + /* TODO currently we don't support multiple node/coord + * types we need to run skb_clone at rx path. Check if + * there exist really an use case if we need to support + * multiple node/coord types at the same time. */ - if (wpan_dev->iftype == NL802154_IFTYPE_NODE && - nsdata->wpan_dev.iftype == NL802154_IFTYPE_NODE) + if (wpan_dev->iftype != NL802154_IFTYPE_MONITOR && + nsdata->wpan_dev.iftype != NL802154_IFTYPE_MONITOR) return -EBUSY; /* check all phy mac sublayer settings are the same. @@ -577,6 +577,7 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, wpan_dev->short_addr = cpu_to_le16(IEEE802154_ADDR_BROADCAST); switch (type) { + case NL802154_IFTYPE_COORD: case NL802154_IFTYPE_NODE: ieee802154_be64_to_le64(&wpan_dev->extended_addr, sdata->dev->dev_addr); @@ -636,6 +637,7 @@ ieee802154_if_add(struct ieee802154_local *local, const char *name, ieee802154_le64_to_be64(ndev->perm_addr, &local->hw.phy->perm_extended_addr); switch (type) { + case NL802154_IFTYPE_COORD: case NL802154_IFTYPE_NODE: ndev->type = ARPHRD_IEEE802154; if (ieee802154_is_valid_extended_unicast_addr(extended_addr)) { diff --git a/net/mac802154/rx.c b/net/mac802154/rx.c index b8ce84618a55..39459d8d787a 100644 --- a/net/mac802154/rx.c +++ b/net/mac802154/rx.c @@ -203,7 +203,7 @@ __ieee802154_rx_handle_packet(struct ieee802154_local *local, } list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (sdata->wpan_dev.iftype != NL802154_IFTYPE_NODE) + if (sdata->wpan_dev.iftype == NL802154_IFTYPE_MONITOR) continue; if (!ieee802154_sdata_running(sdata)) -- 2.34.1