From nobody Thu Mar 24 16:14:21 2022 X-Original-To: dev-commits-src-main@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 ED2C91A20549; Thu, 24 Mar 2022 16:14:21 +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 4KPVfP626Vz4k9h; Thu, 24 Mar 2022 16:14:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648138461; 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=2iXANSBLyic45UaB25DxarzRntJ2+k3dNcJEwZ0u1TY=; b=WcUgLQGIQuUER5UBNTB3mpe2O7Np6v60OqUVmeOJZJScv0ly12AWnxleQh9I19H03N14ER zzomBo3vfAB2EiZu24stvv9/8LhD22HRBeUBJkI8mhlzkV3LPrpkCkwVwhymiuTYrqJS0I dKOIcE+EYa7KReAxcXX2+kUULlnDlTwFgQyFSyVfRFMN4VY51czrVl6fDujbfmD9VS4LHi 0fE3s+9EEXfl6+PZ2cThjlvG1pvIq8oujlgk4kZEBnn9x7jDVLoZMwJ7UwTKCeDlDyX2Nz lZRn0Hdbv4igx+ai2uJ9Dl+xycrLoWRE3U8QeT7NSQX6HesZ8r0Ek+WikEBsrg== 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 9CED21B298; Thu, 24 Mar 2022 16:14:21 +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 22OGELU6077644; Thu, 24 Mar 2022 16:14:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22OGELwh077643; Thu, 24 Mar 2022 16:14:21 GMT (envelope-from git) Date: Thu, 24 Mar 2022 16:14:21 GMT Message-Id: <202203241614.22OGELwh077643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 4a07abdeb8ce - main - LinuxKPI: 802.11: use cfg80211_chandef_create() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 4a07abdeb8ce5271996d85f648832e3d7bc741a7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648138461; 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=2iXANSBLyic45UaB25DxarzRntJ2+k3dNcJEwZ0u1TY=; b=RO5weo9E/AHi5hL1ZjV0J+hqzFDR+V/yvh3Bbc+WQHewKuUevVdfFNE5pE7dy387B8fhdA Gik039+CMU19w+j1M3Kn6J2etDTp1kVlYjNuXFnI2IXOG7TMU7bbGEnWswOO3pxBjLpe2o GtqMNPPcpdeme1kPglwKhFQCGluD+nGp+gda19eyj9I9zBzjzDkfvTMg7USBlnABmgSUc+ +jNYmu6Uky80/gdcuSqThnLxP6HGoLyFDY65QOxdAeJ13y6MjR/en3PtrfclNsCWxfBupN wBtbqQQUALznoiaCH4TfS0EPNGBSfnAI5JTgvDNHxbTeBrWsSsJpNZrqOtBHHQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648138461; a=rsa-sha256; cv=none; b=pYE4bRRHUsmd2Mga/MoAY+sWcfJ2BOMkVL7QqFr/Jp5hGy/SEzwkiCHVgX7hM2zSzE9hb6 tZyq258ZNAjVnfqKTKUVH+sGgcaOca1dL8m6L8tjDYgBkVJPkideD3IQVcnLBDUyQRnue0 MvUH0VpgP9RaTt7sil9xOq9/lVXXMTvxS++klzZ6KrE69u+UCUkHOaUWCJUb9ZLsFGA4gE DBmTyLDZnlZkbmqdEESZYFJopVpYDjz0yJ8pHcpEaKahHuGvnHuZU1ak6h6u3exEF9ySRg 1Mo2IvR9v7WMqPpsWENzXsl6P5KoEEnckw3JxSf4EbQr8ijH7WDjMQDMi4tKEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=4a07abdeb8ce5271996d85f648832e3d7bc741a7 commit 4a07abdeb8ce5271996d85f648832e3d7bc741a7 Author: Bjoern A. Zeeb AuthorDate: 2022-03-24 15:43:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-24 15:43:22 +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 MFC after: 3 days --- 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; } }