MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mesh_pick_bss

Function mesh_pick_bss

freebsd/net80211/ieee80211_scan_sta.c:1900–1982  ·  view source on GitHub ↗

* Pick an mbss network to join or find a channel * to use to start an mbss network. */

Source from the content-addressed store, hash-verified

1898 * to use to start an mbss network.
1899 */
1900static int
1901mesh_pick_bss(struct ieee80211_scan_state *ss, struct ieee80211vap *vap)
1902{
1903 struct sta_table *st = ss->ss_priv;
1904 struct ieee80211_mesh_state *ms = vap->iv_mesh;
1905 struct sta_entry *selbs;
1906 struct ieee80211_channel *chan;
1907
1908 KASSERT(vap->iv_opmode == IEEE80211_M_MBSS,
1909 ("wrong opmode %u", vap->iv_opmode));
1910
1911 if (st->st_newscan) {
1912 sta_update_notseen(st);
1913 st->st_newscan = 0;
1914 }
1915 if (ss->ss_flags & IEEE80211_SCAN_NOPICK) {
1916 /*
1917 * Manual/background scan, don't select+join the
1918 * bss, just return. The scanning framework will
1919 * handle notification that this has completed.
1920 */
1921 ss->ss_flags &= ~IEEE80211_SCAN_NOPICK;
1922 return 1;
1923 }
1924 /*
1925 * Automatic sequencing; look for a candidate and
1926 * if found join the network.
1927 */
1928 /* NB: unlocked read should be ok */
1929 if (TAILQ_FIRST(&st->st_entry) == NULL) {
1930 IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN,
1931 "%s: no scan candidate\n", __func__);
1932 if (ss->ss_flags & IEEE80211_SCAN_NOJOIN)
1933 return 0;
1934notfound:
1935 if (ms->ms_idlen != 0) {
1936 /*
1937 * No existing mbss network to join and we have
1938 * a meshid; start one up. If no channel was
1939 * specified, try to select a channel.
1940 */
1941 if (vap->iv_des_chan == IEEE80211_CHAN_ANYC ||
1942 IEEE80211_IS_CHAN_RADAR(vap->iv_des_chan)) {
1943 struct ieee80211com *ic = vap->iv_ic;
1944
1945 /* XXX VHT */
1946 chan = adhoc_pick_channel(ss, 0);
1947 if (chan != NULL) {
1948 chan = ieee80211_ht_adjust_channel(ic,
1949 chan, vap->iv_flags_ht);
1950 chan = ieee80211_vht_adjust_channel(ic,
1951 chan, vap->iv_flags_vht);
1952 }
1953 } else
1954 chan = vap->iv_des_chan;
1955 if (chan != NULL) {
1956 ieee80211_create_ibss(vap, chan);
1957 return 1;

Callers

nothing calls this directly

Calls 8

sta_update_notseenFunction · 0.85
adhoc_pick_channelFunction · 0.85
sta_dec_failsFunction · 0.85
select_bssFunction · 0.85
demote11bFunction · 0.85
ieee80211_sta_joinFunction · 0.85

Tested by

no test coverage detected