From: David Ahern <dsahern@gmail.com>
To: Chris Mi <chrism@mellanox.com>, netdev@vger.kernel.org
Cc: gerlitz.or@gmail.com, stephen@networkplumber.org,
marcelo.leitner@gmail.com
Subject: Re: [patch iproute2 v5 2/3] tc: Add -bs option to batch mode
Date: Tue, 2 Jan 2018 21:25:11 -0700 [thread overview]
Message-ID: <9326994a-de20-1eb6-71bc-fb757ad05872@gmail.com> (raw)
In-Reply-To: <20180103025517.3767-3-chrism@mellanox.com>
You need a patch description here ...
On 1/2/18 7:55 PM, Chris Mi wrote:
> static int tc_action_modify(int cmd, unsigned int flags,
> - int *argc_p, char ***argv_p)
> + int *argc_p, char ***argv_p,
> + int batch_size, int index, bool send)
> {
> int argc = *argc_p;
> char **argv = *argv_p;
> int ret = 0;
> - struct {
> - struct nlmsghdr n;
> - struct tcamsg t;
> - char buf[MAX_MSG];
> - } req = {
> - .n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg)),
> - .n.nlmsg_flags = NLM_F_REQUEST | flags,
> - .n.nlmsg_type = cmd,
> - .t.tca_family = AF_UNSPEC,
> + tc_action_req *req;
> + struct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };
> + struct iovec *iov = &msg_iov[index];
Reverse xmas tree is the coding standard for net code. Please check all
new code to conform to this standard.
I have not reviewed all of this patch, but I firmly believe the batching
size option needs to be able handle a file with mixed commands. Your use
case is filter and action adds and deletes, but you should allow users
(e.g., test suites) to benefit from this performance speed up with test
cases that have single files with all of the commands.
For example,
$ cat tc.batch
qdisc add dev eth2 ingress
filter add dev eth2 ingress protocol ip pref 21 flower dst_ip
192.168.1.0/16 action drop
filter add dev eth2 ingress protocol ip pref 22 flower dst_ip
192.168.2.0/16 action drop
filter add dev eth2 ingress protocol ip pref 23 flower dst_ip
192.168.3.0/16 action drop
filter add dev eth2 ingress protocol ip pref 24 flower dst_ip
192.168.4.0/16 action drop
filter add dev eth2 ingress protocol ip pref 25 flower dst_ip
192.168.5.0/16 action drop
qdisc del dev eth2 ingress
(and consider this to be a huge file to really stress tc code paths for
example). Right now, the above file fails:
$ tc -b tc.batch -bs 5
Segmentation fault
Also, your changes fail to break out on an error:
$ tc -b tc.batch -bs 1
RTNETLINK answers: File exists
We have an error talking to the kernel, -1
RTNETLINK answers: File exists
We have an error talking to the kernel, -1
RTNETLINK answers: File exists
We have an error talking to the kernel, -1
RTNETLINK answers: File exists
We have an error talking to the kernel, -1
RTNETLINK answers: File exists
We have an error talking to the kernel, -1
where as the existing command does this:
$ tc -b tc.batch
RTNETLINK answers: File exists
We have an error talking to the kernel
Command failed tc.batch:1
next prev parent reply other threads:[~2018-01-03 4:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 2:55 [patch iproute2 v5 0/3] tc: Add -bs option to batch mode Chris Mi
2018-01-03 2:55 ` [patch iproute2 v5 1/3] lib/libnetlink: Add a function rtnl_talk_msg Chris Mi
2018-01-03 4:08 ` David Ahern
2018-01-04 7:27 ` Chris Mi
2018-01-03 2:55 ` [patch iproute2 v5 2/3] tc: Add -bs option to batch mode Chris Mi
2018-01-03 4:25 ` David Ahern [this message]
2018-01-04 7:32 ` Chris Mi
2018-01-03 2:55 ` [patch iproute2 v5 3/3] man: Add -bs option to tc manpage Chris Mi
2018-01-03 2:57 ` [patch iproute2 v5 0/3] tc: Add -bs option to batch mode David Ahern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9326994a-de20-1eb6-71bc-fb757ad05872@gmail.com \
--to=dsahern@gmail.com \
--cc=chrism@mellanox.com \
--cc=gerlitz.or@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox