Lines Matching refs:pi
40 static int brcmf_pno_store_request(struct brcmf_pno_info *pi, in brcmf_pno_store_request() argument
43 if (WARN(pi->n_reqs == BRCMF_PNO_MAX_BUCKETS, in brcmf_pno_store_request()
48 mutex_lock(&pi->req_lock); in brcmf_pno_store_request()
49 pi->reqs[pi->n_reqs++] = req; in brcmf_pno_store_request()
50 mutex_unlock(&pi->req_lock); in brcmf_pno_store_request()
54 static int brcmf_pno_remove_request(struct brcmf_pno_info *pi, u64 reqid) in brcmf_pno_remove_request() argument
58 mutex_lock(&pi->req_lock); in brcmf_pno_remove_request()
61 if (pi->n_reqs == 0) in brcmf_pno_remove_request()
65 for (i = 0; i < pi->n_reqs; i++) { in brcmf_pno_remove_request()
66 if (pi->reqs[i]->reqid == reqid) in brcmf_pno_remove_request()
70 if (WARN(i == pi->n_reqs, "reqid not found\n")) { in brcmf_pno_remove_request()
76 pi->n_reqs--; in brcmf_pno_remove_request()
79 if (!pi->n_reqs || i == pi->n_reqs) in brcmf_pno_remove_request()
83 while (i <= pi->n_reqs - 1) { in brcmf_pno_remove_request()
84 pi->reqs[i] = pi->reqs[i + 1]; in brcmf_pno_remove_request()
89 mutex_unlock(&pi->req_lock); in brcmf_pno_remove_request()
155 static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) in brcmf_pno_set_random() argument
163 for (ri = 0; ri < pi->n_reqs; ri++) in brcmf_pno_set_random()
164 if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { in brcmf_pno_set_random()
165 mac_addr = pi->reqs[ri]->mac_addr; in brcmf_pno_set_random()
166 mac_mask = pi->reqs[ri]->mac_addr_mask; in brcmf_pno_set_random()
188 pi->reqs[ri]->reqid, pfn_mac.mac); in brcmf_pno_set_random()
296 static int brcmf_pno_prep_fwconfig(struct brcmf_pno_info *pi, in brcmf_pno_prep_fwconfig() argument
305 brcmf_dbg(SCAN, "n_reqs=%d\n", pi->n_reqs); in brcmf_pno_prep_fwconfig()
306 if (WARN_ON(!pi->n_reqs)) in brcmf_pno_prep_fwconfig()
313 *scan_freq = pi->reqs[0]->scan_plans[0].interval; in brcmf_pno_prep_fwconfig()
314 for (i = 1; i < pi->n_reqs; i++) { in brcmf_pno_prep_fwconfig()
315 sr = pi->reqs[i]; in brcmf_pno_prep_fwconfig()
324 fw_buckets = kcalloc(pi->n_reqs, sizeof(*fw_buckets), GFP_KERNEL); in brcmf_pno_prep_fwconfig()
329 for (i = 0; i < pi->n_reqs; i++) { in brcmf_pno_prep_fwconfig()
330 sr = pi->reqs[i]; in brcmf_pno_prep_fwconfig()
347 for (i = 0; i < pi->n_reqs; i++) { in brcmf_pno_prep_fwconfig()
356 return pi->n_reqs; in brcmf_pno_prep_fwconfig()
364 struct brcmf_pno_info *pi) in brcmf_pno_config_networks() argument
371 for (i = 0; i < pi->n_reqs; i++) { in brcmf_pno_config_networks()
372 r = pi->reqs[i]; in brcmf_pno_config_networks()
394 struct brcmf_pno_info *pi; in brcmf_pno_config_sched_scans() local
402 pi = ifp_to_pno(ifp); in brcmf_pno_config_sched_scans()
403 n_buckets = brcmf_pno_prep_fwconfig(pi, &pno_cfg, &buckets, in brcmf_pno_config_sched_scans()
446 err = brcmf_pno_set_random(ifp, pi); in brcmf_pno_config_sched_scans()
450 err = brcmf_pno_config_networks(ifp, pi); in brcmf_pno_config_sched_scans()
470 struct brcmf_pno_info *pi; in brcmf_pno_start_sched_scan() local
475 pi = ifp_to_pno(ifp); in brcmf_pno_start_sched_scan()
476 ret = brcmf_pno_store_request(pi, req); in brcmf_pno_start_sched_scan()
482 brcmf_pno_remove_request(pi, req->reqid); in brcmf_pno_start_sched_scan()
483 if (pi->n_reqs) in brcmf_pno_start_sched_scan()
492 struct brcmf_pno_info *pi; in brcmf_pno_stop_sched_scan() local
497 pi = ifp_to_pno(ifp); in brcmf_pno_stop_sched_scan()
500 if (!pi->n_reqs) in brcmf_pno_stop_sched_scan()
503 err = brcmf_pno_remove_request(pi, reqid); in brcmf_pno_stop_sched_scan()
509 if (pi->n_reqs) in brcmf_pno_stop_sched_scan()
517 struct brcmf_pno_info *pi; in brcmf_pno_attach() local
520 pi = kzalloc(sizeof(*pi), GFP_KERNEL); in brcmf_pno_attach()
521 if (!pi) in brcmf_pno_attach()
524 cfg->pno = pi; in brcmf_pno_attach()
525 mutex_init(&pi->req_lock); in brcmf_pno_attach()
531 struct brcmf_pno_info *pi; in brcmf_pno_detach() local
534 pi = cfg->pno; in brcmf_pno_detach()
537 WARN_ON(pi->n_reqs); in brcmf_pno_detach()
538 mutex_destroy(&pi->req_lock); in brcmf_pno_detach()
539 kfree(pi); in brcmf_pno_detach()
552 u64 brcmf_pno_find_reqid_by_bucket(struct brcmf_pno_info *pi, u32 bucket) in brcmf_pno_find_reqid_by_bucket() argument
556 mutex_lock(&pi->req_lock); in brcmf_pno_find_reqid_by_bucket()
558 if (bucket < pi->n_reqs) in brcmf_pno_find_reqid_by_bucket()
559 reqid = pi->reqs[bucket]->reqid; in brcmf_pno_find_reqid_by_bucket()
561 mutex_unlock(&pi->req_lock); in brcmf_pno_find_reqid_by_bucket()
565 u32 brcmf_pno_get_bucket_map(struct brcmf_pno_info *pi, in brcmf_pno_get_bucket_map() argument
573 mutex_lock(&pi->req_lock); in brcmf_pno_get_bucket_map()
574 for (i = 0; i < pi->n_reqs; i++) { in brcmf_pno_get_bucket_map()
575 req = pi->reqs[i]; in brcmf_pno_get_bucket_map()
593 mutex_unlock(&pi->req_lock); in brcmf_pno_get_bucket_map()