mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
test-runner: add a radio parameters structure for creation
Support is coming to configure radios with a specific set of interface type and cipher support, so the input to create_hwsim_radio is better suited to use a parameter structure rather than adding more parameters.
This commit is contained in:
parent
2d51622c0b
commit
2d173e5f24
@ -750,9 +750,14 @@ static int read_radio_id(void)
|
|||||||
return current_radio_id++;
|
return current_radio_id++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct hwsim_radio_params {
|
||||||
|
unsigned int channels;
|
||||||
|
bool p2p_device;
|
||||||
|
bool use_chanctx;
|
||||||
|
};
|
||||||
|
|
||||||
static int create_hwsim_radio(const char *radio_name,
|
static int create_hwsim_radio(const char *radio_name,
|
||||||
const unsigned int channels, bool p2p_device,
|
struct hwsim_radio_params *params)
|
||||||
bool use_chanctx)
|
|
||||||
{
|
{
|
||||||
char *argv[7];
|
char *argv[7];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
@ -1110,9 +1115,7 @@ static bool configure_hw_radios(struct l_settings *hw_settings,
|
|||||||
':');
|
':');
|
||||||
for (i = 0; i < num_radios_requested; i++) {
|
for (i = 0; i < num_radios_requested; i++) {
|
||||||
struct wiphy *wiphy;
|
struct wiphy *wiphy;
|
||||||
unsigned int channels;
|
struct hwsim_radio_params params = { 0 };
|
||||||
bool p2p_device;
|
|
||||||
bool use_chanctx;
|
|
||||||
|
|
||||||
wiphy = l_new(struct wiphy, 1);
|
wiphy = l_new(struct wiphy, 1);
|
||||||
|
|
||||||
@ -1120,29 +1123,28 @@ static bool configure_hw_radios(struct l_settings *hw_settings,
|
|||||||
|
|
||||||
/* radio not in radio_confs, use default parameters */
|
/* radio not in radio_confs, use default parameters */
|
||||||
if (!l_strv_contains(radio_conf_list, wiphy->name)) {
|
if (!l_strv_contains(radio_conf_list, wiphy->name)) {
|
||||||
channels = 1;
|
params.channels = 1;
|
||||||
p2p_device = true;
|
params.p2p_device = true;
|
||||||
use_chanctx = true;
|
params.use_chanctx = true;
|
||||||
goto create;
|
goto create;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!l_settings_get_uint(hw_settings, wiphy->name,
|
if (!l_settings_get_uint(hw_settings, wiphy->name,
|
||||||
HW_CONFIG_PHY_CHANNELS,
|
HW_CONFIG_PHY_CHANNELS,
|
||||||
&channels))
|
¶ms.channels))
|
||||||
channels = 1;
|
params.channels = 1;
|
||||||
|
|
||||||
if (!l_settings_get_bool(hw_settings, wiphy->name,
|
if (!l_settings_get_bool(hw_settings, wiphy->name,
|
||||||
HW_CONFIG_PHY_P2P, &p2p_device))
|
HW_CONFIG_PHY_P2P, ¶ms.p2p_device))
|
||||||
p2p_device = true;
|
params.p2p_device = true;
|
||||||
|
|
||||||
if (!l_settings_get_bool(hw_settings, wiphy->name,
|
if (!l_settings_get_bool(hw_settings, wiphy->name,
|
||||||
HW_CONFIG_PHY_CHANCTX,
|
HW_CONFIG_PHY_CHANCTX,
|
||||||
&use_chanctx))
|
¶ms.use_chanctx))
|
||||||
use_chanctx = true;
|
params.use_chanctx = true;
|
||||||
|
|
||||||
create:
|
create:
|
||||||
wiphy->id = create_hwsim_radio(wiphy->name, channels,
|
wiphy->id = create_hwsim_radio(wiphy->name, ¶ms);
|
||||||
p2p_device, use_chanctx);
|
|
||||||
wiphy->can_ap = true;
|
wiphy->can_ap = true;
|
||||||
|
|
||||||
if (wiphy->id < 0) {
|
if (wiphy->id < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user