From nobody Sun Mar 27 20:14:11 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id EC4661A54127; Sun, 27 Mar 2022 20:14:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KRRqm0Sqqz4nql; Sun, 27 Mar 2022 20:14:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8+8UbWOsHqOCcZUi6K42UUUl6ND5N+a/KMGOu3mgqHM=; b=sBGua6OOpoF5TyfPYu4sI2H5Zrtfu1hGADkNQE74u67UUYj9t7EvZTEssjw+gpTBKmX9Ce Mbu1XnFZhAGMbdoYbPIAHq42ONpz0oN7Tt+ZeX2dYTJA8/bpuyCtCeTyAg78Wu0APzIO8A OCPJX7hn3g2DY8KGFOi9Cc8RSD9l+YHoeYHtxI5Nybw8cFVtuSYUm203aUO1xHu9fvrCOF TGDk8mXQ+rAnzraQgCpvrcPLhTUygLluKltPJAYjnexlgzUbUjOSStcC7dIQxLalxtGcAA hB4A44U760gJ+Q5Gg5PejHb662g2I9gOzUrj6lp4DgozouiZ2qY3g9p3fk6U/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79AFF1BBF7; Sun, 27 Mar 2022 20:14:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 22RKEBTS037371; Sun, 27 Mar 2022 20:14:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKEB0c037370; Sun, 27 Mar 2022 20:14:11 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:14:11 GMT Message-Id: <202203272014.22RKEB0c037370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4836b8ac0ed3 - stable/13 - LinuxKPI: 802.11: use cfg80211_chandef_create() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4836b8ac0ed3a3b155a7fb5f2322221f48c81687 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412052; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8+8UbWOsHqOCcZUi6K42UUUl6ND5N+a/KMGOu3mgqHM=; b=I+sJ3Gx0dwVma7iPdj+DkMoEHJusjJKWbz+2EPj/aQuJW9cu9lY+HCFYaAh+WYuhwekv/w tRkMIzedtErnobpTL6scigM4annzLutXxQVkNok70DUSksmOsyaURUVA87qEU/OiRH3jpe O8EeTHaxjHsciRHiAIvRdGPeK1CfQ5FrIZ7xfZX7CTI7qcr+5l4j2VSBlmTUTjoA+/o6R4 9W4gstfs837OGrS+fS9401lWZC/hMSFg2QqaTxtjwTOdCAseu/R23UVi6+gm81gVuweNQN R8GWMsVHZHqRAL/g5V0MjUREfp1Io4iIqDKpeHpU2FH74dqQ6W0MEHN/AC10LQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412052; a=rsa-sha256; cv=none; b=CN+SsbEO8yNVCusySGGKbyJ239CV5zpVSkqX9dyYPiPYUPh5AXBd5ZOzEzL1zGaSsy0xWV UOCsyhSz+G5LHrIFsgoluq3jI78yUBI4Hhzdb1hll7KgiSp684LjMkdNzToGiqL6KSxUkv 1h9nmoRXdnNU9aT0T6v0xnOHe82lOgIAUMNkF+2/AE9gQoNANVNLs1DLMVwyd+hKwVkqah S+YUDwGLy5f2sPcdvFNDZV6igEXjwyKsl7m9TFemyAkXPPWpc+yR6sQ3rjlrRNIshJMsX6 NMh3fm1125uMT08+Z5MzqnWkRfmPLRa2j6QHjMrT+4jXVpZabrOHBJNv6C1H2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4836b8ac0ed3a3b155a7fb5f2322221f48c81687 commit 4836b8ac0ed3a3b155a7fb5f2322221f48c81687 Author: Bjoern A. Zeeb AuthorDate: 2022-03-24 15:43:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:12:17 +0000 LinuxKPI: 802.11: use cfg80211_chandef_create() Rather than manually setting up a chandef and then effectively forcing a memcpy, use cfg80211_chandef_create() to do the work for us entirely. This works here as we do not store the resulting chandef separately for other use. While here remove a duplicate assignment in cfg80211_chandef_create(). Sponsored by: The FreeBSD Foundation (cherry picked from commit 4a07abdeb8ce5271996d85f648832e3d7bc741a7) --- sys/compat/linuxkpi/common/include/net/cfg80211.h | 2 +- sys/compat/linuxkpi/common/src/linux_80211.c | 14 +++----------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/cfg80211.h b/sys/compat/linuxkpi/common/include/net/cfg80211.h index 896559247620..64aef659c771 100644 --- a/sys/compat/linuxkpi/common/include/net/cfg80211.h +++ b/sys/compat/linuxkpi/common/include/net/cfg80211.h @@ -1166,9 +1166,9 @@ cfg80211_chandef_create(struct cfg80211_chan_def *chandef, KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); + memset(chandef, 0, sizeof(*chandef)); chandef->chan = chan; chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ - chandef->chan = chan; switch (chan_flag) { case NL80211_CHAN_NO_HT: diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index 4805097fcd4f..e9e75488882a 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -2629,7 +2629,6 @@ lkpi_ic_set_channel(struct ieee80211com *ic) } else { struct ieee80211_channel *c = ic->ic_curchan; struct linuxkpi_ieee80211_channel *chan; - struct cfg80211_chan_def chandef; if (c == NULL || c == IEEE80211_CHAN_ANYC || lhw->ops->config == NULL) { @@ -2645,16 +2644,12 @@ lkpi_ic_set_channel(struct ieee80211com *ic) return; } - memset(&chandef, 0, sizeof(chandef)); - chandef.chan = chan; - chandef.width = NL80211_CHAN_WIDTH_20_NOHT; - chandef.center_freq1 = chandef.chan->center_freq; - /* XXX max power for scanning? */ IMPROVE(); hw = LHW_TO_HW(lhw); - hw->conf.chandef = chandef; + cfg80211_chandef_create(&hw->conf.chandef, chan, + NL80211_CHAN_NO_HT); error = lkpi_80211_mo_config(hw, IEEE80211_CONF_CHANGE_CHANNEL); if (error != 0 && error != EOPNOTSUPP) { @@ -3430,15 +3425,12 @@ linuxkpi_ieee80211_ifattach(struct ieee80211_hw *hw) channels = supband->channels; for (i = 0; i < supband->n_channels; i++) { - struct cfg80211_chan_def chandef; if (channels[i].flags & IEEE80211_CHAN_DISABLED) continue; - memset(&chandef, 0, sizeof(chandef)); - cfg80211_chandef_create(&chandef, &channels[i], + cfg80211_chandef_create(&hw->conf.chandef, &channels[i], NL80211_CHAN_NO_HT); - hw->conf.chandef = chandef; break; } }