netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Mi <chrism@mellanox.com>
To: netdev@vger.kernel.org
Cc: gerlitz.or@gmail.com, stephen@networkplumber.org,
	dsahern@gmail.com, marcelo.leitner@gmail.com, phil@nwl.cc
Subject: [patch iproute2 v8 0/2] tc: Add batchsize feature to batch mode
Date: Wed, 10 Jan 2018 12:27:40 +0900	[thread overview]
Message-ID: <20180110032742.8127-1-chrism@mellanox.com> (raw)

Currently in tc batch mode, only one command is read from the batch
file and sent to kernel to process. With this patchset, at most 128
commands can be accumulated before sending to kernel.

We introduced two new functions in patch 1 to support for sending
multiple messages. In patch 2, we add this support for filter and
actions add/delete/change/replace commands.

But please note that kernel still processes the requests one by one.
To process the requests in parallel in kernel is another effort.
The time we're saving in this patchset is the user mode and kernel mode
context switch. So this patchset works on top of the current kernel.

Using the following script in kernel, we can generate 1,000,000 rules.
	tools/testing/selftests/tc-testing/tdc_batch.py

Without this patchset, 'tc -b $file' exection time is:

real    0m15.555s
user    0m7.211s
sys     0m8.284s

With this patchset, 'tc -b $file' exection time is:

real    0m12.360s
user    0m6.082s
sys     0m6.213s

The insertion rate is improved more than 10%.

v3
==
1. Instead of hacking function rtnl_talk directly, add a new function
   rtnl_talk_msg.
2. remove most of global variables to use parameter passing
3. divide the previous patch into 4 patches.

v4
==
1. Remove function setcmdlinetotal. Now in function batch, we read one
   more line to determine if we are reaching the end of file.
2. Remove function __rtnl_check_ack. Now __rtnl_talk calls __rtnl_talk_msg
   directly.
3. if (batch_size < 1)
        batch_size = 1;

v5
==
1. Fix a bug that can't deal with batch file with blank line.
2. Describe the limitation in man page.

v6
==
1. Add support for mixed commands.
2. Fix a bug that not all messages are acked if batch size > 1.

v7
==
1. We can tell exactly which command fails.
2. Add a new function rtnl_talk_iov
3. Allocate the memory in function batch() instead of each client.
4. Remove option -bs.

v8
==
1. Replace strcmp with matches.
2. Recycle buffers.


Chris Mi (2):
  lib/libnetlink: Add functions rtnl_talk_msg and rtnl_talk_iov
  tc: Add batchsize feature for filter and actions

 include/libnetlink.h |   6 ++
 lib/libnetlink.c     |  82 +++++++++++++++++++------
 tc/m_action.c        |  60 ++++++++++++-------
 tc/tc.c              | 165 ++++++++++++++++++++++++++++++++++++++++++++++-----
 tc/tc_common.h       |   5 +-
 tc/tc_filter.c       |  97 +++++++++++++++++-------------
 6 files changed, 319 insertions(+), 96 deletions(-)

-- 
2.14.2

             reply	other threads:[~2018-01-10  3:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  3:27 Chris Mi [this message]
2018-01-10  3:27 ` [patch iproute2 v8 1/2] lib/libnetlink: Add functions rtnl_talk_msg and rtnl_talk_iov Chris Mi
2018-01-10 19:20   ` David Ahern
2018-01-10 20:12     ` Phil Sutter
2018-01-11 15:08       ` Phil Sutter
2018-01-12  0:06         ` David Ahern
2018-01-11  5:34     ` Chris Mi
2018-01-10  3:27 ` [patch iproute2 v8 2/2] tc: Add batchsize feature for filter and actions Chris Mi
2018-01-10 11:42   ` Marcelo Ricardo Leitner
2018-01-11  5:32     ` Chris Mi
2018-01-10 19:41   ` David Ahern
2018-01-11  5:39     ` Chris Mi

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=20180110032742.8127-1-chrism@mellanox.com \
    --to=chrism@mellanox.com \
    --cc=dsahern@gmail.com \
    --cc=gerlitz.or@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=phil@nwl.cc \
    --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;
as well as URLs for NNTP newsgroup(s).