Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Apr 2022 09:33:52 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: e4e2ad470e6b - stable/13 - LinuxKPI: 802.11: implement ieee80211_probereq_get()
Message-ID:  <202204180933.23I9Xqj8018564@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=e4e2ad470e6b47f4e549fb27c8ab3030795226a7

commit e4e2ad470e6b47f4e549fb27c8ab3030795226a7
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-04-15 12:53:06 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-04-18 09:32:58 +0000

    LinuxKPI: 802.11: implement ieee80211_probereq_get()
    
    Implement ieee80211_probereq_get() needed by Realtek drivers.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit ade774b19f9a7b35f01cbca68e51a768d1dd0773)
---
 sys/compat/linuxkpi/common/include/net/mac80211.h |  9 ++++--
 sys/compat/linuxkpi/common/src/linux_80211.c      | 34 +++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index a5195581f237..59101e334376 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -905,6 +905,8 @@ void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,
 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
+struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,
+    uint8_t *, uint8_t *, size_t, size_t);
 
 /* -------------------------------------------------------------------------- */
 
@@ -1868,10 +1870,11 @@ ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 
 static __inline struct sk_buff *
 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
-    uint8_t *ssid, size_t ssid_len, int _x)
+    uint8_t *ssid, size_t ssid_len, size_t tailroom)
 {
-	TODO();
-	return (NULL);
+
+	return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,
+	    tailroom));
 }
 
 static __inline void
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index 227016b77d82..9355098295a9 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4232,6 +4232,40 @@ linuxkpi_ieee80211_queue_work(struct ieee80211_hw *hw,
 	queue_work(lhw->workq, w);
 }
 
+struct sk_buff *
+linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
+    uint8_t *ssid, size_t ssid_len, size_t tailroom)
+{
+	struct sk_buff *skb;
+	struct ieee80211_frame *wh;
+	uint8_t *p;
+	size_t len;
+
+	len = sizeof(*wh);
+	len += 2 + ssid_len;
+
+	skb = dev_alloc_skb(hw->extra_tx_headroom + len + tailroom);
+	if (skb == NULL)
+		return (NULL);
+
+	skb_reserve(skb, hw->extra_tx_headroom);
+
+	wh = skb_put_zero(skb, sizeof(*wh));
+	wh->i_fc[0] = IEEE80211_FC0_VERSION_0;
+	wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT;
+	IEEE80211_ADDR_COPY(wh->i_addr1, ieee80211broadcastaddr);
+	IEEE80211_ADDR_COPY(wh->i_addr2, addr);
+	IEEE80211_ADDR_COPY(wh->i_addr3, ieee80211broadcastaddr);
+
+	p = skb_put(skb, 2 + ssid_len);
+	*p++ = IEEE80211_ELEMID_SSID;
+	*p++ = ssid_len;
+	if (ssid_len > 0)
+		memcpy(p, ssid, ssid_len);
+
+	return (skb);
+}
+
 struct sk_buff *
 linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *hw,
     struct ieee80211_vif *vif)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202204180933.23I9Xqj8018564>