From patchwork Thu Oct 25 19:48:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 10656425 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E150914BD for ; Thu, 25 Oct 2018 19:49:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D45E12C2FA for ; Thu, 25 Oct 2018 19:49:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C89FB2C46B; Thu, 25 Oct 2018 19:49:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0832A2C469 for ; Thu, 25 Oct 2018 19:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725905AbeJZEXT (ORCPT ); Fri, 26 Oct 2018 00:23:19 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:35190 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725784AbeJZEXT (ORCPT ); Fri, 26 Oct 2018 00:23:19 -0400 Received: by mail-io1-f66.google.com with SMTP id 79-v6so6268765iou.2 for ; Thu, 25 Oct 2018 12:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobcopeland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ZWQk8+9SYxnIn8VMm2J+GtO0Wffa5LczGepiGJlwmt4=; b=NcI4+W2A+Rl5ncDOEWIWpusFy+ZBihGjAtbMZyzVW4peuHxI+XOJ3GCARWWWWjLYoN yBg80ybJ6KdOdqxBaEZ0y8DkLpY9t/3yRg/zYWw1MQMIw0zusYDAJ/XqrcYmXChtp1Te WoqwEMdCB9QbCo9y618reXdNVzV26PlHYAor3nrOqklEmJvY78d5G9jICS4pQYy3qWMd F7BUZ2pTNXvKD0AFsJymSelgaINUk6FoEf0cxJlBaluELfnVFp+p1ZxvE+ztMVuhMJbO oTjQi5+P4iAKIozFJOTbvXxX+OcMnKgmquGQpcW33fPLZHrLqK78NvP3ytE/6tv5cOHx 54IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ZWQk8+9SYxnIn8VMm2J+GtO0Wffa5LczGepiGJlwmt4=; b=ZM7raoC9U+hKA83WWpIH6cxKaYcXc4CEig1lgk6vS3D2WFA7wUwe2sP9L8xzRWlia1 C4k0GJpEjfjMt96AwDKnlQS9tZjUJN1Sa1DcrT1PP4zzIoh31HyocM6rEvqCUoMlBaBh SgWrdiPYj2rnzsHlZRX1IfZ1rJFAuAtEvSNHW270ba6nNsYqBaa39pEhHAoGWsz14cFz RgCDA60EMOHF8gYgcs+dKvjzR8zzQfsMvSrkZdLobFCd5ebE5LO0pwA79hT3uMilyb7m KSMpYrxVVsrzA/PwF59wN2eNpMbUUo5/fGrw07XxJX52RiqSeP1tTNCU2MJYNeSCRRjG bHww== X-Gm-Message-State: AGRZ1gKLyGxGp5TexXRvcR8opQOS+zmhreGD91NUcNtcx0fkE+CHzwDq JhWfAMMG98koLuxakKiMXF8sLA== X-Google-Smtp-Source: AJdET5erQ9Y2H3fdnqf1mJ1mDTZOFCXEgIDaeuEKoEVhNQjpNGIJe5OkCi3dJ3rm5D4CO2LJ26Wj3A== X-Received: by 2002:a6b:7b4c:: with SMTP id m12-v6mr397235iop.9.1540496951494; Thu, 25 Oct 2018 12:49:11 -0700 (PDT) Received: from hash (CPE30b5c2fb365b-CM18593342f28f.cpe.net.cable.rogers.com. [99.232.51.173]) by smtp.gmail.com with ESMTPSA id 125-v6sm3490159iov.28.2018.10.25.12.49.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 12:49:10 -0700 (PDT) Received: from bob by hash with local (Exim 4.89) (envelope-from ) id 1gFlcz-00034A-ET; Thu, 25 Oct 2018 15:49:09 -0400 From: Bob Copeland To: Johannes Berg Cc: linux-wireless@vger.kernel.org, kernel-team@fb.com, Bob Copeland , Bob Copeland Subject: [PATCH 1/3] mac80211: mesh: advertise gates in mesh formation Date: Thu, 25 Oct 2018 15:48:52 -0400 Message-Id: <20181025194854.11676-1-me@bobcopeland.com> X-Mailer: git-send-email 2.11.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Connected to Mesh Gate subfield (802.11-2016 9.4.2.98.7) in the Mesh Formation Info field is currently unset. This field may be useful in determining which MBSSes to join or which mesh STAs to peer with. If this mesh STA is a gate, by having turned on mesh gate announcements, or if we have a path to one (e.g. by having received RANNs) then set this bit to 1. Signed-off-by: Bob Copeland --- net/mac80211/mesh.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 8bad414c52ad..19205c821dee 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -254,6 +254,8 @@ int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata, struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; u8 *pos, neighbors; u8 meshconf_len = sizeof(struct ieee80211_meshconf_ie); + bool is_connected_to_gate = ifmsh->num_gates > 0 || + ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol; if (skb_tailroom(skb) < 2 + meshconf_len) return -ENOMEM; @@ -278,7 +280,7 @@ int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata, /* Mesh Formation Info - number of neighbors */ neighbors = atomic_read(&ifmsh->estab_plinks); neighbors = min_t(int, neighbors, IEEE80211_MAX_MESH_PEERINGS); - *pos++ = neighbors << 1; + *pos++ = (neighbors << 1) | is_connected_to_gate; /* Mesh capability */ *pos = 0x00; *pos |= ifmsh->mshcfg.dot11MeshForwarding ? From patchwork Thu Oct 25 19:48:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 10656427 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E0EF514DE for ; Thu, 25 Oct 2018 19:49:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D37D62C469 for ; Thu, 25 Oct 2018 19:49:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74F62C46E; Thu, 25 Oct 2018 19:49:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373DF2C469 for ; Thu, 25 Oct 2018 19:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726003AbeJZEXY (ORCPT ); Fri, 26 Oct 2018 00:23:24 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:45182 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725784AbeJZEXX (ORCPT ); Fri, 26 Oct 2018 00:23:23 -0400 Received: by mail-io1-f65.google.com with SMTP id p83-v6so6241860iod.12 for ; Thu, 25 Oct 2018 12:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobcopeland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mqiCydNCGpPZbXmPy27/5ByY+QLuDG7aQHKQeWXnLTs=; b=haig1atz52daKAWVtU6lSkFx2C0iNLfrApz4QOgeofWymRjqyM9x3PLjGvnTYBUL+n 8pQFEqZczZtdZ230jw+EGCkN377VUSDDV2T0sE2dukKM31iDyqsylAt3kBAlU0PHY8oZ ZSd5TAlu0GXa718dn9DaJ/E50/rApX7uibfagd3lKNt+qCuZu2ZeT4LyoDwqpXsJWK6b iJCL+/sYUbHBh8uwbwKluJqS57GNzgfGpnc2NAR8R5t0OzGptC80Ot++j1qSXhhwneLm 4TOtbUuF0iKZ1rUrBy2G8sPHLmUsncUMcdlywFnqM9dmJM7grLBbUbQiJgEwZ9gZgTrJ iwuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mqiCydNCGpPZbXmPy27/5ByY+QLuDG7aQHKQeWXnLTs=; b=VZYZuZJ5MYZTgkMV8BObfcWDMqSMDw23t+nMUfDfdLnsvzX0dK+6Ws3Mzebmp/kvK7 sl0cpT/5x4yaQ3rM1shEuA/5lcyfT/KAU26Fr6skeaVO8OsULMUuDvF4KfnhdjDXRPEv TtAYMmtTXNZOoWvyQAlY9Rsb9MzEDCuv2nduIOPIv7aRoBBYrhlldwyc0bG9rWzYEqkV gGtElF8zN3p5GzEEoa/yBR1Z78KBANs/Odi5IgbOeqUrouyP6LLhT8kZgyGU25fckP6w ANldwKEyR7DJlUd393ijJGYp01sgT/g/syepFbBimbFF1ejOjIFdAdEwyNUsv0nR82tR SK1w== X-Gm-Message-State: AGRZ1gKbhhAxOlDa+F5wrznuve9K2deqbbgT88/g5603tWc6suyEJdfr JPbpB4nmkk+8yfT+ntzFSGsFTA== X-Google-Smtp-Source: AJdET5eL0joskfEmBuMPogOM/QARCSPzAgMSZe9NGetLOWw3u08EBfUJ2gqA936jyD1p8R/coH0Dog== X-Received: by 2002:a6b:901:: with SMTP id t1-v6mr364296ioi.207.1540496955692; Thu, 25 Oct 2018 12:49:15 -0700 (PDT) Received: from hash (CPE30b5c2fb365b-CM18593342f28f.cpe.net.cable.rogers.com. [99.232.51.173]) by smtp.gmail.com with ESMTPSA id m70-v6sm1234432itm.27.2018.10.25.12.49.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 12:49:15 -0700 (PDT) Received: from bob by hash with local (Exim 4.89) (envelope-from ) id 1gFld4-00034O-AD; Thu, 25 Oct 2018 15:49:14 -0400 From: Bob Copeland To: Johannes Berg Cc: linux-wireless@vger.kernel.org, kernel-team@fb.com, Bob Copeland , Bob Copeland Subject: [PATCH 2/3] {nl,mac}80211: report gate connectivity in station info Date: Thu, 25 Oct 2018 15:48:53 -0400 Message-Id: <20181025194854.11676-2-me@bobcopeland.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181025194854.11676-1-me@bobcopeland.com> References: <20181025194854.11676-1-me@bobcopeland.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Capture the current state of gate connectivity from the mesh formation field in mesh config whenever we receive a beacon, and report that via GET_STATION. This allows applications doing mesh peering in userspace to make peering decisions based on peers' current upstream connectivity. Signed-off-by: Bob Copeland --- include/linux/ieee80211.h | 2 ++ include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 3 +++ net/mac80211/mesh_plink.c | 3 +++ net/mac80211/sta_info.c | 4 +++- net/mac80211/sta_info.h | 2 ++ net/wireless/nl80211.c | 1 + 7 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 0ef67f837ae1..407d6fd66fa9 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -812,6 +812,8 @@ enum mesh_config_capab_flags { IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40, }; +#define IEEE80211_MESHCONF_FORM_CONNECTED_TO_GATE 0x1 + /** * mesh channel switch parameters element's flag indicator * diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 1fa41b7a1be3..f2cb1a3c9651 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1296,6 +1296,7 @@ struct cfg80211_tid_stats { * @rx_beacon: number of beacons received from this peer * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received * from this peer + * @connected_to_gate: true if mesh STA has a path to mesh gate * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs. @@ -1350,6 +1351,8 @@ struct station_info { u64 rx_beacon; u64 rx_duration; u8 rx_beacon_signal_avg; + u8 connected_to_gate; + struct cfg80211_tid_stats *pertid; s8 ack_signal; s8 avg_ack_signal; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 6d610bae30a9..f2d79f9b4b5a 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3074,6 +3074,8 @@ enum nl80211_sta_bss_param { * with an FCS error (u32, from this station). This count may not include * some packets with an FCS error due to TA corruption. Hence this counter * might not be fully accurate. + * @NL80211_STA_INFO_CONNECTED_TO_GATE: set to true if STA has a path to a + * mesh gate * @__NL80211_STA_INFO_AFTER_LAST: internal * @NL80211_STA_INFO_MAX: highest possible station info attribute */ @@ -3116,6 +3118,7 @@ enum nl80211_sta_info { NL80211_STA_INFO_ACK_SIGNAL_AVG, NL80211_STA_INFO_RX_MPDUS, NL80211_STA_INFO_FCS_ERROR_COUNT, + NL80211_STA_INFO_CONNECTED_TO_GATE, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 5b5b0f95ffd1..5f45a2b273df 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c @@ -590,6 +590,9 @@ void mesh_neighbour_update(struct ieee80211_sub_if_data *sdata, if (!sta) goto out; + sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & + IEEE80211_MESHCONF_FORM_CONNECTED_TO_GATE; + if (mesh_peer_accepts_plinks(elems) && sta->mesh->plink_state == NL80211_PLINK_LISTEN && sdata->u.mesh.accepting_plinks && diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index fb8c2252ac0e..971f06911ff8 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -2267,7 +2267,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, BIT_ULL(NL80211_STA_INFO_PLINK_STATE) | BIT_ULL(NL80211_STA_INFO_LOCAL_PM) | BIT_ULL(NL80211_STA_INFO_PEER_PM) | - BIT_ULL(NL80211_STA_INFO_NONPEER_PM); + BIT_ULL(NL80211_STA_INFO_NONPEER_PM) | + BIT_ULL(NL80211_STA_INFO_CONNECTED_TO_GATE); sinfo->llid = sta->mesh->llid; sinfo->plid = sta->mesh->plid; @@ -2279,6 +2280,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo, sinfo->local_pm = sta->mesh->local_pm; sinfo->peer_pm = sta->mesh->peer_pm; sinfo->nonpeer_pm = sta->mesh->nonpeer_pm; + sinfo->connected_to_gate = sta->mesh->connected_to_gate; #endif } diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 9a04327d71d1..8eb29041be54 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h @@ -364,6 +364,7 @@ DECLARE_EWMA(mesh_fail_avg, 20, 8) * @nonpeer_pm: STA power save mode towards non-peer neighbors * @processed_beacon: set to true after peer rates and capabilities are * processed + * @connected_to_gate: true if mesh STA has a path to a mesh gate * @fail_avg: moving percentage of failed MSDUs */ struct mesh_sta { @@ -381,6 +382,7 @@ struct mesh_sta { u8 plink_retries; bool processed_beacon; + bool connected_to_gate; enum nl80211_plink_state plink_state; u32 plink_timeout; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 744b5851bbf9..ce8c082e6389 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -4731,6 +4731,7 @@ static int nl80211_send_station(struct sk_buff *msg, u32 cmd, u32 portid, PUT_SINFO(LOCAL_PM, local_pm, u32); PUT_SINFO(PEER_PM, peer_pm, u32); PUT_SINFO(NONPEER_PM, nonpeer_pm, u32); + PUT_SINFO(CONNECTED_TO_GATE, connected_to_gate, u8); if (sinfo->filled & BIT_ULL(NL80211_STA_INFO_BSS_PARAM)) { bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); From patchwork Thu Oct 25 19:48:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bob Copeland X-Patchwork-Id: 10656429 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B373514DE for ; Thu, 25 Oct 2018 19:49:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A588C2C469 for ; Thu, 25 Oct 2018 19:49:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E972C46E; Thu, 25 Oct 2018 19:49:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 060242C469 for ; Thu, 25 Oct 2018 19:49:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726014AbeJZEXZ (ORCPT ); Fri, 26 Oct 2018 00:23:25 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:33289 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725784AbeJZEXZ (ORCPT ); Fri, 26 Oct 2018 00:23:25 -0400 Received: by mail-io1-f68.google.com with SMTP id l25-v6so6260438ioj.0 for ; Thu, 25 Oct 2018 12:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bobcopeland-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fycvqBAtfE40J048mJ8Ij50lgVhHr4bugNStCwA6+d4=; b=xWBfJbfS6rhTOv7t3QBNSk3T3frc9V339TXE3dS7uOpd7PbsKgIMLQ2FA43HmpHJeD WOrA1+hXlOoyZmMFsODRG1Fa2eVxZihDedJ9q33tkwYyD1GUaWXAz+hWyeENzM/AG263 IRr+grdaoJtp7+xIk3PLXbjc+1NqrF0thXLau+vZSMLltyBkbXxIzNye5e6wzlL9+5xc YjNOU81XlMlwfGz4zCHYIAn663k4Bk3mw0J/0yNjIyMjRkJ4gF5tsWuNgYS7g2y9Ow0V eJxN4rggXEDdmKqkNbefALywdMddRqP8oq5Q4cjcYbZV8T1gLIYSBO4Rtp9Vlja939yK pHQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fycvqBAtfE40J048mJ8Ij50lgVhHr4bugNStCwA6+d4=; b=js7QkbuEWhSqyYcM1Xo6S5svX5Ohw/8XwtrX59jSH72Ohmg+Hc8riqCqGt6ct+sU43 IjcLIAhPb2cUWc4HrsbPyPlyTurD7XNJHTvvCdyaHJIhKMXUeB8HgGTOAcmAPciVh1Vv YFopUxFWA6chfuPI098XtFpYYK6hC/GIahoH45IphTxLMHvBVrJyXilWg3aVFsuAed4x XyS7rPG9f6m2N8k105r+hC99C/ttt39WGhw84gOo0JTXKlHMXE0UMwXCiIhJePp8vLkg uGHfedymlD5U0CCR4vzxo0+A83n0+GUx3PKwgN88dkKwfDpqHuSuGQrqNwOLFtIY5ANz nhSQ== X-Gm-Message-State: AGRZ1gLZXUqA4cI6S1svuLX6Knq1gt3ONGC8OQ8dCBbwJ/L/LGZ2ig07 lMJRa1hk3XVfMJtqAAsjzaV15A== X-Google-Smtp-Source: AJdET5cuaJjv8HI01wSndqDrzcElJNr4uOpiXHDsP2SC2UdAFniKdoPp6SlMjG3d/Yvj5/0n1ZD+uQ== X-Received: by 2002:a6b:b2d0:: with SMTP id b199-v6mr397851iof.140.1540496957713; Thu, 25 Oct 2018 12:49:17 -0700 (PDT) Received: from hash (CPE30b5c2fb365b-CM18593342f28f.cpe.net.cable.rogers.com. [99.232.51.173]) by smtp.gmail.com with ESMTPSA id s20-v6sm3131017ioa.1.2018.10.25.12.49.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 12:49:17 -0700 (PDT) Received: from bob by hash with local (Exim 4.89) (envelope-from ) id 1gFld6-00034Y-A0; Thu, 25 Oct 2018 15:49:16 -0400 From: Bob Copeland To: Johannes Berg Cc: linux-wireless@vger.kernel.org, kernel-team@fb.com, Bob Copeland , Bob Copeland Subject: [PATCH 3/3] {nl,mac}80211: add dot11MeshConnectedToMeshGate to meshconf Date: Thu, 25 Oct 2018 15:48:54 -0400 Message-Id: <20181025194854.11676-3-me@bobcopeland.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181025194854.11676-1-me@bobcopeland.com> References: <20181025194854.11676-1-me@bobcopeland.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When userspace is controlling mesh routing, it may have better knowledge about whether a mesh STA is connected to a mesh gate than the kernel mpath table. Add dot11MeshConnectedToMeshGate to the mesh config so that such applications can explicitly signal that a mesh STA is connected to a gate, which will then be advertised in the beacon. Signed-off-by: Bob Copeland --- include/net/cfg80211.h | 5 +++++ include/uapi/linux/nl80211.h | 6 ++++++ net/mac80211/cfg.c | 3 +++ net/mac80211/debugfs_netdev.c | 3 +++ net/mac80211/mesh.c | 3 ++- net/wireless/nl80211.c | 8 +++++++- 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f2cb1a3c9651..cddaa9dacb27 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -1562,6 +1562,10 @@ struct bss_parameters { * @plink_timeout: If no tx activity is seen from a STA we've established * peering with for longer than this time (in seconds), then remove it * from the STA's list of peers. Default is 30 minutes. + * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is + * connected to a mesh gate in mesh formation info. If false, the + * value in mesh formation is determined by the presence of root paths + * in the mesh path table */ struct mesh_config { u16 dot11MeshRetryTimeout; @@ -1581,6 +1585,7 @@ struct mesh_config { u16 dot11MeshHWMPperrMinInterval; u16 dot11MeshHWMPnetDiameterTraversalTime; u8 dot11MeshHWMPRootMode; + bool dot11MeshConnectedToMeshGate; u16 dot11MeshHWMPRannInterval; bool dot11MeshGateAnnouncementProtocol; bool dot11MeshForwarding; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f2d79f9b4b5a..d04391ae4acd 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3898,6 +3898,11 @@ enum nl80211_mesh_power_mode { * remove it from the STA's list of peers. You may set this to 0 to disable * the removal of the STA. Default is 30 minutes. * + * @NL80211_MESHCONF_CONNECTED_TO_GATE: If set to true then this mesh STA + * will advertise that it is connected to a gate in the mesh formation + * field. If left unset then the mesh formation field will only + * advertise such if there is an active root mesh path. + * * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use */ enum nl80211_meshconf_params { @@ -3930,6 +3935,7 @@ enum nl80211_meshconf_params { NL80211_MESHCONF_POWER_MODE, NL80211_MESHCONF_AWAKE_WINDOW, NL80211_MESHCONF_PLINK_TIMEOUT, + NL80211_MESHCONF_CONNECTED_TO_GATE, /* keep last */ __NL80211_MESHCONF_ATTR_AFTER_LAST, diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 51622333d460..6d1c54f28df7 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2028,6 +2028,9 @@ static int ieee80211_update_mesh_config(struct wiphy *wiphy, nconf->dot11MeshAwakeWindowDuration; if (_chg_mesh_attr(NL80211_MESHCONF_PLINK_TIMEOUT, mask)) conf->plink_timeout = nconf->plink_timeout; + if (_chg_mesh_attr(NL80211_MESHCONF_CONNECTED_TO_GATE, mask)) + conf->dot11MeshConnectedToMeshGate = + nconf->dot11MeshConnectedToMeshGate; ieee80211_mbss_info_change_notify(sdata, BSS_CHANGED_BEACON); return 0; } diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index c813207bb123..cff0fb3578c9 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c @@ -641,6 +641,8 @@ IEEE80211_IF_FILE(dot11MeshHWMPconfirmationInterval, IEEE80211_IF_FILE(power_mode, u.mesh.mshcfg.power_mode, DEC); IEEE80211_IF_FILE(dot11MeshAwakeWindowDuration, u.mesh.mshcfg.dot11MeshAwakeWindowDuration, DEC); +IEEE80211_IF_FILE(dot11MeshConnectedToMeshGate, + u.mesh.mshcfg.dot11MeshConnectedToMeshGate, DEC); #endif #define DEBUGFS_ADD_MODE(name, mode) \ @@ -762,6 +764,7 @@ static void add_mesh_config(struct ieee80211_sub_if_data *sdata) MESHPARAMS_ADD(dot11MeshHWMPconfirmationInterval); MESHPARAMS_ADD(power_mode); MESHPARAMS_ADD(dot11MeshAwakeWindowDuration); + MESHPARAMS_ADD(dot11MeshConnectedToMeshGate); #undef MESHPARAMS_ADD } #endif diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index 19205c821dee..4869280a6413 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c @@ -255,7 +255,8 @@ int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata, u8 *pos, neighbors; u8 meshconf_len = sizeof(struct ieee80211_meshconf_ie); bool is_connected_to_gate = ifmsh->num_gates > 0 || - ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol; + ifmsh->mshcfg.dot11MeshGateAnnouncementProtocol || + ifmsh->mshcfg.dot11MeshConnectedToMeshGate; if (skb_tailroom(skb) < 2 + meshconf_len) return -ENOMEM; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index ce8c082e6389..05ac44d6d5c4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6123,7 +6123,9 @@ static int nl80211_get_mesh_config(struct sk_buff *skb, nla_put_u16(msg, NL80211_MESHCONF_AWAKE_WINDOW, cur_params.dot11MeshAwakeWindowDuration) || nla_put_u32(msg, NL80211_MESHCONF_PLINK_TIMEOUT, - cur_params.plink_timeout)) + cur_params.plink_timeout) || + nla_put_u8(msg, NL80211_MESHCONF_CONNECTED_TO_GATE, + cur_params.dot11MeshConnectedToMeshGate)) goto nla_put_failure; nla_nest_end(msg, pinfoattr); genlmsg_end(msg, hdr); @@ -6180,6 +6182,7 @@ nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = { NL80211_MESH_POWER_MAX), [NL80211_MESHCONF_AWAKE_WINDOW] = { .type = NLA_U16 }, [NL80211_MESHCONF_PLINK_TIMEOUT] = { .type = NLA_U32 }, + [NL80211_MESHCONF_CONNECTED_TO_GATE] = { .type = NLA_U8 }, }; static const struct nla_policy @@ -6291,6 +6294,9 @@ do { \ FILL_IN_MESH_PARAM_IF_SET(tb, cfg, rssi_threshold, mask, NL80211_MESHCONF_RSSI_THRESHOLD, nla_get_s32); + FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshConnectedToMeshGate, mask, + NL80211_MESHCONF_CONNECTED_TO_GATE, + nla_get_u8); /* * Check HT operation mode based on * IEEE 802.11-2016 9.4.2.57 HT Operation element.