From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [patch iproute2 v7 2/2] tc: Add batchsize feature for filter and actions Date: Tue, 9 Jan 2018 08:01:20 -0800 Message-ID: <20180109080120.230eb2a5@xeon-e3> References: <20180109065908.19754-1-chrism@mellanox.com> <20180109065908.19754-3-chrism@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, gerlitz.or@gmail.com, dsahern@gmail.com, marcelo.leitner@gmail.com, phil@nwl.cc To: Chris Mi Return-path: Received: from mail-pf0-f180.google.com ([209.85.192.180]:38107 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932718AbeAIQB2 (ORCPT ); Tue, 9 Jan 2018 11:01:28 -0500 Received: by mail-pf0-f180.google.com with SMTP id k19so1786954pfj.5 for ; Tue, 09 Jan 2018 08:01:27 -0800 (PST) In-Reply-To: <20180109065908.19754-3-chrism@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: On Tue, 9 Jan 2018 15:59:08 +0900 Chris Mi wrote: > +static bool batchsize_enabled(int argc, char *argv[]) > +{ > + if (argc < 2) > + return false; > + if ((strcmp(argv[0], "filter") && strcmp(argv[0], "action")) > + || (strcmp(argv[1], "add") && strcmp(argv[1], "delete") > + && strcmp(argv[1], "change") && strcmp(argv[1], "replace"))) > + return false; > + > + return true; > +} Maybe this should be a table, also the action can be abbreviated as in: tc qd a dev eth0 ... Actually, I have been wondering if all of IP commmand parsing needs to be more table driven.