Skip to content

Commit

Permalink
[=] schedulers have been updated with some optimizing changes
Browse files Browse the repository at this point in the history
[-] removed unnecessary "memset" calls after "calloc"
[~] changed using of "xqc_send_ctl_get_srtt"
  • Loading branch information
Ya-Pasha-364shy committed Apr 17, 2024
1 parent 3607442 commit d4c6884
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 42 deletions.
14 changes: 3 additions & 11 deletions src/transport/scheduler/xqc_scheduler_backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ xqc_backup_scheduler_get_path(void *scheduler, xqc_connection_t *conn,
xqc_packet_out_t *packet_out, int check_cwnd, int reinject,
xqc_bool_t *cc_blocked)
{
xqc_path_ctx_t *best_path[XQC_PATH_CLASS_PERF_CLASS_SIZE];
xqc_bool_t has_path[XQC_PATH_CLASS_PERF_CLASS_SIZE];
xqc_path_ctx_t *best_path[XQC_PATH_CLASS_PERF_CLASS_SIZE] = { NULL };
xqc_bool_t has_path[XQC_PATH_CLASS_PERF_CLASS_SIZE] = { XQC_FALSE };
xqc_path_perf_class_t path_class;
xqc_bool_t available_path_exists;

Expand All @@ -44,14 +44,6 @@ xqc_backup_scheduler_get_path(void *scheduler, xqc_connection_t *conn,
*cc_blocked = XQC_FALSE;
}

for (path_class = XQC_PATH_CLASS_AVAILABLE_HIGH;
path_class < XQC_PATH_CLASS_PERF_CLASS_SIZE;
path_class++)
{
best_path[path_class] = NULL;
has_path[path_class] = XQC_FALSE;
}

xqc_list_for_each_safe(pos, next, &conn->conn_paths_list) {
path = xqc_list_entry(pos, xqc_path_ctx_t, path_list);

Expand Down Expand Up @@ -87,7 +79,7 @@ xqc_backup_scheduler_get_path(void *scheduler, xqc_connection_t *conn,
path_srtt = xqc_send_ctl_get_srtt(path->path_send_ctl);

if (best_path[path_class] == NULL
|| path_srtt < best_path[path_class]->path_send_ctl->ctl_srtt)
|| path_srtt < xqc_send_ctl_get_srtt(best_path[path_class]->path_send_ctl))
{
best_path[path_class] = path;
}
Expand Down
2 changes: 1 addition & 1 deletion src/transport/scheduler/xqc_scheduler_backup.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

extern const xqc_scheduler_callback_t xqc_backup_scheduler_cb;

#endif /* _XQC_SCHEDULER_BACKUP_H_INCLUDED_ */
#endif /* _XQC_SCHEDULER_BACKUP_H_INCLUDED_ */
2 changes: 1 addition & 1 deletion src/transport/scheduler/xqc_scheduler_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

xqc_bool_t xqc_scheduler_check_path_can_send(xqc_path_ctx_t *path, xqc_packet_out_t *packet_out, int check_cwnd);

#endif
#endif /* _XQC_SCHEDULER_COMMON_H_INCLUDED_ */
3 changes: 1 addition & 2 deletions src/transport/scheduler/xqc_scheduler_interop.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ xqc_interop_scheduler_get_path(void *scheduler,
if (path->app_path_status == XQC_APP_PATH_STATUS_AVAILABLE) {
best_path = path;
min_rtt = path_srtt;

} else {
best_standby_path = path;
min_rtt_standby = path_srtt;
Expand Down Expand Up @@ -112,4 +111,4 @@ const xqc_scheduler_callback_t xqc_interop_scheduler_cb = {
.xqc_scheduler_size = xqc_interop_scheduler_size,
.xqc_scheduler_init = xqc_interop_scheduler_init,
.xqc_scheduler_get_path = xqc_interop_scheduler_get_path,
};
};
2 changes: 1 addition & 1 deletion src/transport/scheduler/xqc_scheduler_interop.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

extern const xqc_scheduler_callback_t xqc_interop_scheduler_cb;

#endif
#endif /* _XQC_SCHEDULER_INTEROP_H_INCLUDED_ */
40 changes: 16 additions & 24 deletions src/transport/scheduler/xqc_scheduler_minrtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "src/transport/scheduler/xqc_scheduler_common.h"
#include "src/transport/xqc_send_ctl.h"

#define INVALID_PATH_CLASS -1

static size_t
xqc_minrtt_scheduler_size()
Expand All @@ -25,8 +26,9 @@ xqc_minrtt_scheduler_get_path(void *scheduler,
xqc_connection_t *conn, xqc_packet_out_t *packet_out, int check_cwnd, int reinject,
xqc_bool_t *cc_blocked)
{
xqc_path_ctx_t *best_path[XQC_PATH_CLASS_PERF_CLASS_SIZE];
xqc_path_perf_class_t path_class;
xqc_path_perf_class_t best_path_class = INVALID_PATH_CLASS;
xqc_path_ctx_t *best_path[XQC_PATH_CLASS_PERF_CLASS_SIZE] = { NULL };

xqc_list_head_t *pos, *next;
xqc_path_ctx_t *path;
Expand All @@ -37,13 +39,6 @@ xqc_minrtt_scheduler_get_path(void *scheduler,
xqc_bool_t reached_cwnd_check = XQC_FALSE;
xqc_bool_t path_can_send;

for (path_class = XQC_PATH_CLASS_AVAILABLE_HIGH;
path_class < XQC_PATH_CLASS_PERF_CLASS_SIZE;
path_class++)
{
best_path[path_class] = NULL;
}

if (cc_blocked) {
*cc_blocked = XQC_FALSE;
}
Expand Down Expand Up @@ -90,6 +85,7 @@ xqc_minrtt_scheduler_get_path(void *scheduler,
|| path_srtt < best_path[path_class]->path_send_ctl->ctl_srtt)
{
best_path[path_class] = path;
best_path_class = path_class;
}

skip_path:
Expand All @@ -103,24 +99,20 @@ xqc_minrtt_scheduler_get_path(void *scheduler,
best_path[path_class] ? best_path[path_class]->path_id : -1);
}


for (path_class = XQC_PATH_CLASS_AVAILABLE_HIGH;
path_class < XQC_PATH_CLASS_PERF_CLASS_SIZE;
path_class++)
if (best_path_class != INVALID_PATH_CLASS
&& best_path[best_path_class] != NULL)
{
if (best_path[path_class] != NULL) {
xqc_log(conn->log, XQC_LOG_DEBUG, "|best path:%ui|frame_type:%s|"
"pn:%ui|size:%ud|reinj:%d|path_class:%d|",
best_path[path_class]->path_id,
xqc_frame_type_2_str(packet_out->po_frame_types),
packet_out->po_pkt.pkt_num,
packet_out->po_used_size, reinject, path_class);
return best_path[path_class];
}
xqc_log(conn->log, XQC_LOG_DEBUG, "|best path:%ui|frame_type:%s|"
"pn:%ui|size:%ud|reinj:%d|path_class:%d|",
best_path[best_path_class]->path_id,
xqc_frame_type_2_str(packet_out->po_frame_types),
packet_out->po_pkt.pkt_num,
packet_out->po_used_size, reinject, best_path_class);
return best_path[best_path_class];
} else {
xqc_log(conn->log, XQC_LOG_DEBUG, "|No available paths to schedule|conn:%p|", conn);
return NULL;
}

xqc_log(conn->log, XQC_LOG_DEBUG, "|No available paths to schedule|conn:%p|", conn);
return NULL;
}

const xqc_scheduler_callback_t xqc_minrtt_scheduler_cb = {
Expand Down
2 changes: 1 addition & 1 deletion src/transport/scheduler/xqc_scheduler_minrtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@

extern const xqc_scheduler_callback_t xqc_minrtt_scheduler_cb;

#endif /* _XQC_SCHEDULER_MINRTT_H_INCLUDED_ */
#endif /* _XQC_SCHEDULER_MINRTT_H_INCLUDED_ */
2 changes: 1 addition & 1 deletion src/transport/scheduler/xqc_scheduler_rap.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

extern const xqc_scheduler_callback_t xqc_rap_scheduler_cb;

#endif
#endif /* _XQC_SCHEDULER_MINRTT_H_INCLUDED_ */

0 comments on commit d4c6884

Please sign in to comment.