hwsim: remove unconditional packet delay

This was initially put in to solve an issue that was specific to
mac80211_hwsim where the connect callback would get queued and
delayed until after the connect event. This caused IWD to get very
confused.

Later it was found that "real" drivers can sometimes do this so
some code was added to IWD core to handle it.

Now there isn't much point to delay all frames unless a rule specifies
so change the behavior back to sending out frames immediately.
This commit is contained in:
James Prestwood 2021-08-18 15:09:29 -07:00 committed by Denis Kenzior
parent a4ee9c8152
commit 382bbf1861
1 changed files with 15 additions and 8 deletions

View File

@ -1436,9 +1436,11 @@ static void frame_delay_callback(struct l_timeout *timeout, void *user_data)
else
send_frame_destroy(send_info);
l_timeout_remove(timeout);
if (timeout)
l_timeout_remove(timeout);
}
/*
* Process frames in a similar way to how the kernel built-in hwsim medium
* does this, with an additional optimization for unicast frames and
@ -1457,7 +1459,7 @@ static void process_frame(struct hwsim_frame *frame)
struct radio_info_rec *radio = entry->data;
struct send_frame_info *send_info;
bool drop = drop_mcast;
uint32_t delay = HWSIM_DELAY_MIN_MS;
uint32_t delay = 0;
if (radio == frame->src_radio)
continue;
@ -1499,11 +1501,16 @@ static void process_frame(struct hwsim_frame *frame)
send_info->radio = radio;
send_info->frame = hwsim_frame_ref(frame);
if (!l_timeout_create_ms(delay, frame_delay_callback,
send_info, NULL)) {
l_error("Error delaying frame, frame will be dropped");
send_frame_destroy(send_info);
}
if (delay) {
if (!l_timeout_create_ms(delay, frame_delay_callback,
send_info, NULL)) {
l_error("Error delaying frame %ums, "
"frame will be dropped", delay);
send_frame_destroy(send_info);
}
} else
frame_delay_callback(NULL, send_info);
}
hwsim_frame_unref(frame);
@ -1999,7 +2006,7 @@ static struct l_dbus_message *rule_add(struct l_dbus *dbus,
rule->id = next_rule_id++;
rule->source_any = true;
rule->destination_any = true;
rule->delay = HWSIM_DELAY_MIN_MS;
rule->delay = 0;
rule->enabled = false;
if (!rules)