Skip to content

Commit

Permalink
P2P2: Allow WFD R2 capabilities to be configured
Browse files Browse the repository at this point in the history
Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
  • Loading branch information
Shivani Baranwal authored and Jouni Malinen committed Dec 20, 2024
1 parent 8ad20c5 commit 8dd1cf6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
29 changes: 27 additions & 2 deletions p2p.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,25 @@ static enum sigma_cmd_result cmd_sta_set_p2p(struct sigma_dut *dut,
}
}

val = get_param(cmd, "WFDR2Capabilities");
if (val) {
if (strcasecmp(val, "On") == 0) {
/* Support Wi-Fi Direct R2 capabilities */
dut->p2p_r2_capable = true;
sigma_dut_print(dut, DUT_MSG_INFO,
"Wi-Fi Direct R2 Capabilities ON");
snprintf(buf, sizeof(buf),
"P2P_SET chan_switch_req_enable 1");
if (wpa_command(intf, buf) < 0)
return ERROR_SEND_STATUS;
} else {
dut->p2p_r2_capable = false;
sigma_dut_print(dut, DUT_MSG_INFO,
"Wi-Fi Direct R2 Capabilities OFF");
}

}

return 1;
}

Expand Down Expand Up @@ -986,8 +1005,13 @@ cmd_sta_start_autonomous_go(struct sigma_dut *dut, struct sigma_conn *conn,
return -2;
}

snprintf(buf, sizeof(buf), "P2P_GROUP_ADD %sfreq=%d",
dut->persistent ? "persistent " : "", freq);
if (dut->p2p_r2_capable)
snprintf(buf, sizeof(buf), "P2P_GROUP_ADD %sfreq=%d he p2p2",
dut->persistent ? "persistent " : "", freq);
else
snprintf(buf, sizeof(buf), "P2P_GROUP_ADD %sfreq=%d",
dut->persistent ? "persistent " : "", freq);

if (wpa_command(intf, buf) < 0) {
wpa_ctrl_detach(ctrl);
wpa_ctrl_close(ctrl);
Expand Down Expand Up @@ -1930,6 +1954,7 @@ enum sigma_cmd_result cmd_sta_p2p_reset(struct sigma_dut *dut,
wpa_command(get_station_ifname(dut), "P2P_SET ps 96");
wpa_command(get_station_ifname(dut), "P2P_SET ps 0");
wpa_command(intf, "P2P_SET ps 0");
wpa_command(intf, "P2P_SET chan_switch_req_enable 0");
wpa_command(intf, "SET persistent_reconnect 1");
wpa_command(intf, "SET ampdu 1");
run_system(dut, "iptables -F INPUT");
Expand Down
1 change: 1 addition & 0 deletions sigma_dut.h
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ struct sigma_dut {
int group_mgmt_ciphers_capa; /* bitmap of enum sigma_cipher_suites
* values */
bool usd_enabled;
bool p2p_r2_capable;
};


Expand Down

0 comments on commit 8dd1cf6

Please sign in to comment.