rue/net: adapt to the new rue modular framework
Add to register and unregister rue net ops through rue modular framework. Signed-off-by: Honglin Li <honglinli@tencent.com> Reviewed-by: Haisu Wang <haisuwang@tencent.com>
This commit is contained in:
parent
ca8edadc91
commit
55f6748cd1
|
@ -6,7 +6,13 @@
|
|||
#include <linux/percpu.h>
|
||||
#include <linux/mutex.h>
|
||||
|
||||
struct rue_ops {};
|
||||
struct rue_ops {
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
struct rue_net_ops *net;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern int sysctl_net_qos_enable;
|
||||
|
||||
extern bool rue_installed;
|
||||
extern struct rue_ops *rue_mod_ops;
|
||||
|
@ -16,6 +22,10 @@ extern struct mutex rue_mutex;
|
|||
int register_rue_ops(struct rue_ops *ops);
|
||||
int try_unregister_rue_ops(void);
|
||||
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
#define RUE_NET_FUNC(ops, func) ops->net->func /* RUE NET OPs */
|
||||
#endif
|
||||
|
||||
#define RUE_FUNC(subsys, ops, func) RUE_##subsys##_FUNC(ops, func)
|
||||
|
||||
#define RUE_CALL_TYPE(subsys, func, retype, ...) \
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <net/sock.h>
|
||||
#include <net/inet_sock.h>
|
||||
#include <net/gen_stats.h>
|
||||
#include <linux/rue.h>
|
||||
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
|
||||
|
@ -78,7 +79,7 @@ struct cgroup_cls_state {
|
|||
unsigned long *whitelist_rports;
|
||||
};
|
||||
|
||||
struct net_cls_module_function {
|
||||
struct rue_net_ops {
|
||||
int (*read_rx_stat)(struct cgroup_subsys_state *css,
|
||||
struct seq_file *sf);
|
||||
int (*read_tx_stat)(struct cgroup_subsys_state *css,
|
||||
|
@ -114,43 +115,12 @@ struct net_cls_module_function {
|
|||
extern int sysctl_net_qos_enable;
|
||||
extern int rx_throttle_all_enabled;
|
||||
extern int tx_throttle_all_enabled;
|
||||
extern struct net_cls_module_function netcls_modfunc;
|
||||
extern struct dev_bw_config bw_config[];
|
||||
extern struct dev_limit_config limit_bw_config[];
|
||||
extern struct dev_bw_config online_max_config[];
|
||||
extern struct dev_limit_config online_min_config[];
|
||||
extern int netqos_notifier(struct notifier_block *this,
|
||||
unsigned long event, void *ptr);
|
||||
extern int p_read_rx_stat(struct cgroup_subsys_state *css,
|
||||
struct seq_file *sf);
|
||||
extern int p_read_tx_stat(struct cgroup_subsys_state *css,
|
||||
struct seq_file *sf);
|
||||
extern void p_dump_rx_tb(struct seq_file *m);
|
||||
extern void p_dump_tx_tb(struct seq_file *m);
|
||||
extern void p_dump_rx_bps_limit_tb(struct cgroup_subsys_state *css,
|
||||
struct seq_file *sf);
|
||||
extern void p_dump_tx_bps_limit_tb(struct cgroup_subsys_state *css,
|
||||
struct seq_file *sf);
|
||||
extern void p_cgroup_set_rx_limit(struct cls_token_bucket *tb, u64 rate);
|
||||
extern void p_cgroup_set_tx_limit(struct cls_token_bucket *tb, u64 rate);
|
||||
extern int p_write_rx_bps_minmax(int ifindex, u64 min, u64 max, int all);
|
||||
extern int p_write_tx_bps_minmax(int ifindex, u64 min, u64 max, int all);
|
||||
extern int p_write_rx_online_bps_max(int ifindex, u64 max);
|
||||
extern int p_write_tx_online_bps_max(int ifindex, u64 max);
|
||||
extern int p_write_rx_online_bps_min(struct cgroup_cls_state *cs,
|
||||
int ifindex, u64 rate);
|
||||
extern int p_write_tx_online_bps_min(struct cgroup_cls_state *cs,
|
||||
int ifindex, u64 rate);
|
||||
extern int p_rx_online_list_del(struct cgroup_cls_state *cs);
|
||||
extern int p_tx_online_list_del(struct cgroup_cls_state *cs);
|
||||
extern int p_write_rx_min_rwnd_segs(struct cgroup_subsys_state *css,
|
||||
struct cftype *cft, u64 value);
|
||||
extern u64 p_read_rx_min_rwnd_segs(struct cgroup_subsys_state *css,
|
||||
struct cftype *cft);
|
||||
extern u32 p_cls_cgroup_adjust_wnd(struct sock *sk, u32 wnd,
|
||||
u32 mss, u16 wscale);
|
||||
extern int p_cls_cgroup_factor(const struct sock *sk);
|
||||
extern bool p_is_low_prio(struct sock *sk);
|
||||
|
||||
static inline struct
|
||||
cgroup_cls_state *css_cls_state(struct cgroup_subsys_state *css)
|
||||
|
|
25
kernel/rue.c
25
kernel/rue.c
|
@ -25,16 +25,29 @@ static bool rue_used(void)
|
|||
return !!total;
|
||||
}
|
||||
|
||||
static int check_net_patch_state(struct rue_ops *ops, bool state)
|
||||
{
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
if (state && !ops->net)
|
||||
return -EINVAL;
|
||||
|
||||
if (!state)
|
||||
sysctl_net_qos_enable = 0;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_patch_state(struct rue_ops *ops)
|
||||
{
|
||||
int ret = 0;
|
||||
bool state = !!ops; /* true: patch, false: unpatch */
|
||||
|
||||
if (ops) {
|
||||
/* check if patching */
|
||||
} else {
|
||||
/* check if unpatching */
|
||||
}
|
||||
return ret;
|
||||
ret = check_net_patch_state(ops, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int register_rue_ops(struct rue_ops *ops)
|
||||
|
|
|
@ -24,138 +24,10 @@ EXPORT_SYMBOL_GPL(rx_throttle_all_enabled);
|
|||
int tx_throttle_all_enabled;
|
||||
EXPORT_SYMBOL_GPL(tx_throttle_all_enabled);
|
||||
|
||||
struct net_cls_module_function netcls_modfunc;
|
||||
EXPORT_SYMBOL_GPL(netcls_modfunc);
|
||||
|
||||
/* the last one more for all_dev config */
|
||||
struct dev_bw_config bw_config[MAX_NIC_SUPPORT + 1];
|
||||
EXPORT_SYMBOL_GPL(bw_config);
|
||||
|
||||
int p_read_rx_stat(struct cgroup_subsys_state *css, struct seq_file *sf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_read_rx_stat);
|
||||
|
||||
int p_read_tx_stat(struct cgroup_subsys_state *css, struct seq_file *sf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_read_tx_stat);
|
||||
|
||||
void p_dump_rx_tb(struct seq_file *m)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_dump_rx_tb);
|
||||
|
||||
void p_dump_tx_tb(struct seq_file *m)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_dump_tx_tb);
|
||||
|
||||
void
|
||||
p_dump_rx_bps_limit_tb(struct cgroup_subsys_state *css, struct seq_file *sf)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_dump_rx_bps_limit_tb);
|
||||
|
||||
void
|
||||
p_dump_tx_bps_limit_tb(struct cgroup_subsys_state *css, struct seq_file *sf)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_dump_tx_bps_limit_tb);
|
||||
|
||||
void p_cgroup_set_rx_limit(struct cls_token_bucket *tb, u64 rate)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_cgroup_set_rx_limit);
|
||||
|
||||
void p_cgroup_set_tx_limit(struct cls_token_bucket *tb, u64 rate)
|
||||
{
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_cgroup_set_tx_limit);
|
||||
|
||||
int p_write_rx_bps_minmax(int ifindex, u64 min, u64 max, int all)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_rx_bps_minmax);
|
||||
|
||||
int p_write_tx_bps_minmax(int ifindex, u64 min, u64 max, int all)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_tx_bps_minmax);
|
||||
|
||||
int p_write_rx_online_bps_max(int ifindex, u64 max)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_rx_online_bps_max);
|
||||
|
||||
int p_write_tx_online_bps_max(int ifindex, u64 max)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_tx_online_bps_max);
|
||||
|
||||
int
|
||||
p_write_rx_online_bps_min(struct cgroup_cls_state *cs, int ifindex, u64 rate)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_rx_online_bps_min);
|
||||
|
||||
int
|
||||
p_write_tx_online_bps_min(struct cgroup_cls_state *cs, int ifindex, u64 rate)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_tx_online_bps_min);
|
||||
|
||||
int p_rx_online_list_del(struct cgroup_cls_state *cs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_rx_online_list_del);
|
||||
|
||||
int p_tx_online_list_del(struct cgroup_cls_state *cs)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_tx_online_list_del);
|
||||
|
||||
int p_write_rx_min_rwnd_segs(struct cgroup_subsys_state *css,
|
||||
struct cftype *cft, u64 value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_write_rx_min_rwnd_segs);
|
||||
|
||||
u64 p_read_rx_min_rwnd_segs(struct cgroup_subsys_state *css, struct cftype *cft)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_read_rx_min_rwnd_segs);
|
||||
|
||||
u32 p_cls_cgroup_adjust_wnd(struct sock *sk, u32 wnd, u32 mss, u16 wscale)
|
||||
{
|
||||
return wnd;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_cls_cgroup_adjust_wnd);
|
||||
|
||||
int p_cls_cgroup_factor(const struct sock *sk)
|
||||
{
|
||||
return WND_DIVISOR;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_cls_cgroup_factor);
|
||||
|
||||
bool p_is_low_prio(struct sock *sk)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(p_is_low_prio);
|
||||
|
||||
struct dev_limit_config limit_bw_config[MAX_NIC_SUPPORT];
|
||||
EXPORT_SYMBOL_GPL(limit_bw_config);
|
||||
|
||||
|
@ -260,11 +132,9 @@ static void cgrp_css_offline(struct cgroup_subsys_state *css)
|
|||
|
||||
cls_cgroup_stats_destroy(&cs->rx_stats);
|
||||
cls_cgroup_stats_destroy(&cs->tx_stats);
|
||||
if (READ_ONCE(netcls_modfunc.rx_online_list_del) &&
|
||||
READ_ONCE(netcls_modfunc.tx_online_list_del)) {
|
||||
netcls_modfunc.rx_online_list_del(cs);
|
||||
netcls_modfunc.tx_online_list_del(cs);
|
||||
}
|
||||
|
||||
RUE_CALL_INT(NET, rx_online_list_del, cs);
|
||||
RUE_CALL_INT(NET, tx_online_list_del, cs);
|
||||
}
|
||||
|
||||
static void cgrp_css_free(struct cgroup_subsys_state *css)
|
||||
|
@ -403,11 +273,11 @@ static ssize_t write_bps_limit(struct kernfs_open_file *of,
|
|||
if (!rx_rate)
|
||||
cs->rx_scale = WND_DIVISOR;
|
||||
|
||||
if (rx_rate != -1 && READ_ONCE(netcls_modfunc.cgroup_set_rx_limit))
|
||||
netcls_modfunc.cgroup_set_rx_limit(&cs->rx_bucket, rx_rate);
|
||||
if (rx_rate != -1)
|
||||
RUE_CALL_VOID(NET, cgroup_set_rx_limit, &cs->rx_bucket, rx_rate);
|
||||
|
||||
if (tx_rate != -1 && READ_ONCE(netcls_modfunc.cgroup_set_tx_limit))
|
||||
netcls_modfunc.cgroup_set_tx_limit(&cs->tx_bucket, tx_rate);
|
||||
if (tx_rate != -1)
|
||||
RUE_CALL_VOID(NET, cgroup_set_tx_limit, &cs->tx_bucket, tx_rate);
|
||||
ret = nbytes;
|
||||
|
||||
out_finish:
|
||||
|
@ -508,13 +378,13 @@ static ssize_t write_bps_dev_limit(struct kernfs_open_file *of,
|
|||
if (!rx_rate)
|
||||
cs->rx_dev_scale[ifindex] = WND_DIVISOR;
|
||||
|
||||
if (rx_rate > -1 && READ_ONCE(netcls_modfunc.cgroup_set_rx_limit))
|
||||
netcls_modfunc.cgroup_set_rx_limit(&cs->rx_dev_bucket[ifindex],
|
||||
rx_rate);
|
||||
if (rx_rate > -1)
|
||||
RUE_CALL_VOID(NET, cgroup_set_rx_limit, &cs->rx_dev_bucket[ifindex],
|
||||
rx_rate);
|
||||
|
||||
if (tx_rate > -1 && READ_ONCE(netcls_modfunc.cgroup_set_tx_limit))
|
||||
netcls_modfunc.cgroup_set_tx_limit(&cs->tx_dev_bucket[ifindex],
|
||||
tx_rate);
|
||||
if (tx_rate > -1)
|
||||
RUE_CALL_VOID(NET, cgroup_set_tx_limit, &cs->tx_dev_bucket[ifindex],
|
||||
tx_rate);
|
||||
ret = nbytes;
|
||||
|
||||
out_finish:
|
||||
|
@ -747,15 +617,15 @@ static ssize_t write_dev_online_bps_max(struct kernfs_open_file *of,
|
|||
online_max_config[ifindex].name = name;
|
||||
strncpy(online_max_config[ifindex].name, dev_name, strlen(dev_name));
|
||||
|
||||
if (rx_rate > -1 && READ_ONCE(netcls_modfunc.write_rx_online_bps_max)) {
|
||||
if (rx_rate > -1) {
|
||||
online_max_config[ifindex].rx_bps_max = rx_rate;
|
||||
netcls_modfunc.write_rx_online_bps_max(ifindex,
|
||||
online_max_config[ifindex].rx_bps_max);
|
||||
RUE_CALL_INT(NET, write_rx_online_bps_max, ifindex,
|
||||
online_max_config[ifindex].rx_bps_max);
|
||||
}
|
||||
if (tx_rate > -1 && READ_ONCE(netcls_modfunc.write_tx_online_bps_max)) {
|
||||
if (tx_rate > -1) {
|
||||
online_max_config[ifindex].tx_bps_max = tx_rate;
|
||||
netcls_modfunc.write_tx_online_bps_max(ifindex,
|
||||
online_max_config[ifindex].tx_bps_max);
|
||||
RUE_CALL_INT(NET, write_tx_online_bps_max, ifindex,
|
||||
online_max_config[ifindex].tx_bps_max);
|
||||
}
|
||||
ret = nbytes;
|
||||
|
||||
|
@ -858,10 +728,10 @@ static ssize_t write_dev_online_bps_min(struct kernfs_open_file *of,
|
|||
online_min_config[ifindex].name = name;
|
||||
strncpy(online_min_config[ifindex].name, dev_name, strlen(dev_name));
|
||||
|
||||
if (rx_rate > -1 && READ_ONCE(netcls_modfunc.write_rx_online_bps_min))
|
||||
netcls_modfunc.write_rx_online_bps_min(cs, ifindex, rx_rate);
|
||||
if (tx_rate > -1 && READ_ONCE(netcls_modfunc.write_tx_online_bps_min))
|
||||
netcls_modfunc.write_tx_online_bps_min(cs, ifindex, tx_rate);
|
||||
if (rx_rate > -1)
|
||||
RUE_CALL_INT(NET, write_rx_online_bps_min, cs, ifindex, rx_rate);
|
||||
if (tx_rate > -1)
|
||||
RUE_CALL_INT(NET, write_tx_online_bps_min, cs, ifindex, tx_rate);
|
||||
ret = nbytes;
|
||||
|
||||
out_finish:
|
||||
|
@ -967,24 +837,22 @@ static ssize_t write_dev_bps_config(struct kernfs_open_file *of,
|
|||
bw_config[ifindex].name = name;
|
||||
strncpy(bw_config[ifindex].name, dev_name, strlen(dev_name));
|
||||
|
||||
if (v[0] > -1 && v[1] > -1 &&
|
||||
READ_ONCE(netcls_modfunc.write_rx_bps_minmax)) {
|
||||
if (v[0] > -1 && v[1] > -1) {
|
||||
bw_config[ifindex].rx_bps_min = v[0];
|
||||
bw_config[ifindex].rx_bps_max = v[1];
|
||||
netcls_modfunc.write_rx_bps_minmax(ifindex,
|
||||
bw_config[ifindex].rx_bps_min,
|
||||
bw_config[ifindex].rx_bps_max,
|
||||
set_all_dev);
|
||||
RUE_CALL_INT(NET, write_rx_bps_minmax, ifindex,
|
||||
bw_config[ifindex].rx_bps_min,
|
||||
bw_config[ifindex].rx_bps_max,
|
||||
set_all_dev);
|
||||
}
|
||||
|
||||
if (v[2] > -1 && v[3] > -1 &&
|
||||
READ_ONCE(netcls_modfunc.write_tx_bps_minmax)) {
|
||||
if (v[2] > -1 && v[3] > -1) {
|
||||
bw_config[ifindex].tx_bps_min = v[2];
|
||||
bw_config[ifindex].tx_bps_max = v[3];
|
||||
netcls_modfunc.write_tx_bps_minmax(ifindex,
|
||||
bw_config[ifindex].tx_bps_min,
|
||||
bw_config[ifindex].tx_bps_max,
|
||||
set_all_dev);
|
||||
RUE_CALL_INT(NET, write_tx_bps_minmax, ifindex,
|
||||
bw_config[ifindex].tx_bps_min,
|
||||
bw_config[ifindex].tx_bps_max,
|
||||
set_all_dev);
|
||||
}
|
||||
|
||||
if (set_all_dev) {
|
||||
|
@ -1055,42 +923,33 @@ EXPORT_SYMBOL_GPL(netqos_notifier);
|
|||
static int write_rx_min_rwnd_segs(struct cgroup_subsys_state *css,
|
||||
struct cftype *cft, u64 value)
|
||||
{
|
||||
if (READ_ONCE(netcls_modfunc.write_rx_min_rwnd_segs))
|
||||
return netcls_modfunc.write_rx_min_rwnd_segs(css, cft, value);
|
||||
return 0;
|
||||
return RUE_CALL_INT(NET, write_rx_min_rwnd_segs, css, cft, value);
|
||||
}
|
||||
|
||||
static u64 read_rx_min_rwnd_segs(struct cgroup_subsys_state *css,
|
||||
struct cftype *cft)
|
||||
{
|
||||
if (READ_ONCE(netcls_modfunc.read_rx_min_rwnd_segs))
|
||||
return netcls_modfunc.read_rx_min_rwnd_segs(css, cft);
|
||||
return 0;
|
||||
return RUE_CALL_TYPE(NET, read_rx_min_rwnd_segs, u64, css, cft);
|
||||
}
|
||||
|
||||
int read_class_stat(struct seq_file *sf, void *v)
|
||||
{
|
||||
struct cgroup_subsys_state *css = seq_css(sf);
|
||||
|
||||
if (READ_ONCE(netcls_modfunc.read_rx_stat) &&
|
||||
READ_ONCE(netcls_modfunc.read_tx_stat)) {
|
||||
netcls_modfunc.read_rx_stat(css, sf);
|
||||
netcls_modfunc.read_tx_stat(css, sf);
|
||||
}
|
||||
RUE_CALL_INT(NET, read_rx_stat, css, sf);
|
||||
RUE_CALL_INT(NET, read_tx_stat, css, sf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rx_dump(struct seq_file *sf, void *v)
|
||||
{
|
||||
if (READ_ONCE(netcls_modfunc.dump_rx_tb))
|
||||
netcls_modfunc.dump_rx_tb(sf);
|
||||
RUE_CALL_VOID(NET, dump_rx_tb, sf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tx_dump(struct seq_file *sf, void *v)
|
||||
{
|
||||
if (READ_ONCE(netcls_modfunc.dump_tx_tb))
|
||||
netcls_modfunc.dump_tx_tb(sf);
|
||||
RUE_CALL_VOID(NET, dump_tx_tb, sf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1098,11 +957,8 @@ int bps_limit_dump(struct seq_file *sf, void *v)
|
|||
{
|
||||
struct cgroup_subsys_state *css = seq_css(sf);
|
||||
|
||||
if (READ_ONCE(netcls_modfunc.dump_rx_bps_limit_tb) &&
|
||||
READ_ONCE(netcls_modfunc.dump_tx_bps_limit_tb)) {
|
||||
netcls_modfunc.dump_rx_bps_limit_tb(css, sf);
|
||||
netcls_modfunc.dump_tx_bps_limit_tb(css, sf);
|
||||
}
|
||||
RUE_CALL_VOID(NET, dump_rx_bps_limit_tb, css, sf);
|
||||
RUE_CALL_VOID(NET, dump_tx_bps_limit_tb, css, sf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -735,11 +735,12 @@ void tcp_rcv_space_adjust(struct sock *sk)
|
|||
bool is_low = 0;
|
||||
int scale = 0;
|
||||
|
||||
if (sysctl_net_qos_enable &&
|
||||
READ_ONCE(netcls_modfunc.is_low_prio) &&
|
||||
READ_ONCE(netcls_modfunc.cls_cgroup_factor)) {
|
||||
is_low = netcls_modfunc.is_low_prio(sk);
|
||||
scale = netcls_modfunc.cls_cgroup_factor(sk);
|
||||
if (sysctl_net_qos_enable) {
|
||||
is_low = RUE_CALL_TYPE(NET, is_low_prio, bool, sk);
|
||||
scale = RUE_CALL_INT(NET, cls_cgroup_factor, sk);
|
||||
|
||||
if (unlikely(!scale))
|
||||
scale = WND_DIVISOR;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -267,6 +267,9 @@ static u16 tcp_select_window(struct sock *sk)
|
|||
struct net *net = sock_net(sk);
|
||||
u32 old_win = tp->rcv_wnd;
|
||||
u32 cur_win, new_win;
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
u32 orig_new_win;
|
||||
#endif
|
||||
|
||||
/* Make the window 0 if we failed to queue the data because we
|
||||
* are out of memory. The window is temporary, so we don't store
|
||||
|
@ -306,11 +309,17 @@ static u16 tcp_select_window(struct sock *sk)
|
|||
new_win = min(new_win, (65535U << tp->rx_opt.rcv_wscale));
|
||||
|
||||
#ifdef CONFIG_CGROUP_NET_CLASSID
|
||||
if (sysctl_net_qos_enable &&
|
||||
READ_ONCE(netcls_modfunc.cls_cgroup_adjust_wnd))
|
||||
new_win = netcls_modfunc.cls_cgroup_adjust_wnd(sk, new_win,
|
||||
inet_csk(sk)->icsk_ack.rcv_mss,
|
||||
tp->rx_opt.rcv_wscale);
|
||||
if (sysctl_net_qos_enable) {
|
||||
orig_new_win = new_win;
|
||||
|
||||
new_win = RUE_CALL_TYPE(NET, cls_cgroup_adjust_wnd, u32,
|
||||
sk, new_win,
|
||||
inet_csk(sk)->icsk_ack.rcv_mss,
|
||||
tp->rx_opt.rcv_wscale);
|
||||
|
||||
if (unlikely(!new_win))
|
||||
new_win = orig_new_win;
|
||||
}
|
||||
#endif
|
||||
/* RFC1323 scaling applied */
|
||||
new_win >>= tp->rx_opt.rcv_wscale;
|
||||
|
|
Loading…
Reference in New Issue