提交 0144238b 编写于 作者: K Kozlov Dmitry

shaper: move thread local variables to stack

上级 8a8680bf
...@@ -24,12 +24,6 @@ ...@@ -24,12 +24,6 @@
#define TCA_BUF_MAX 64*1024 #define TCA_BUF_MAX 64*1024
#define MAX_MSG 16384 #define MAX_MSG 16384
static __thread struct {
struct nlmsghdr n;
struct tcmsg t;
char buf[TCA_BUF_MAX];
} req;
struct qdisc_opt struct qdisc_opt
{ {
char *kind; char *kind;
...@@ -129,6 +123,12 @@ static int qdisc_htb_class(struct qdisc_opt *qopt, struct nlmsghdr *n) ...@@ -129,6 +123,12 @@ static int qdisc_htb_class(struct qdisc_opt *qopt, struct nlmsghdr *n)
static int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flags, struct qdisc_opt *opt) static int tc_qdisc_modify(struct rtnl_handle *rth, int ifindex, int cmd, unsigned flags, struct qdisc_opt *opt)
{ {
struct {
struct nlmsghdr n;
struct tcmsg t;
char buf[TCA_BUF_MAX];
} req;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg)); req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
...@@ -209,6 +209,12 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu ...@@ -209,6 +209,12 @@ static int install_police(struct rtnl_handle *rth, int ifindex, int rate, int bu
int mtu = 0, flowid = 1; int mtu = 0, flowid = 1;
unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */ unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */
struct {
struct nlmsghdr n;
struct tcmsg t;
char buf[TCA_BUF_MAX];
} req;
struct qdisc_opt opt1 = { struct qdisc_opt opt1 = {
.kind = "ingress", .kind = "ingress",
.handle = 0xffff0000, .handle = 0xffff0000,
...@@ -287,6 +293,12 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority, ...@@ -287,6 +293,12 @@ static int install_htb_ifb(struct rtnl_handle *rth, int ifindex, __u32 priority,
{ {
struct rtattr *tail, *tail1, *tail2, *tail3; struct rtattr *tail, *tail1, *tail2, *tail3;
struct {
struct nlmsghdr n;
struct tcmsg t;
char buf[TCA_BUF_MAX];
} req;
struct qdisc_opt opt1 = { struct qdisc_opt opt1 = {
.kind = "htb", .kind = "htb",
.handle = 0x00010001 + priority, .handle = 0x00010001 + priority,
...@@ -471,6 +483,12 @@ int init_ifb(const char *name) ...@@ -471,6 +483,12 @@ int init_ifb(const char *name)
struct rtattr *tail; struct rtattr *tail;
struct ifreq ifr; struct ifreq ifr;
int r; int r;
struct {
struct nlmsghdr n;
struct tcmsg t;
char buf[TCA_BUF_MAX];
} req;
struct qdisc_opt opt = { struct qdisc_opt opt = {
.kind = "htb", .kind = "htb",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册