From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id AD930F610 for ; Mon, 19 Dec 2016 18:49:52 +0100 (CET) Received: by mail-wm0-f45.google.com with SMTP id t79so107959493wmt.0 for ; Mon, 19 Dec 2016 09:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=4Ua0PUL8PcjsdIWLEr9WJ9HGb3W+zm/rf9vwl2R57sI=; b=AARumrlJMElcQrCprUCTxQs3xNr7ebRY3Qk1PDmX+xcC/tDKLTlTMocbjyYz0xVmOO bW5UiE5oHTwLWGvG0+7JoCCI/uNCuTVGoKE0srGIWCmycIj8hm87/AFwQG7tvGBohZDX xjajiBRqhAfN98mbkVSe/5PXKiWoKVLVn/yfAVAu9qboU+p8t4HgXE6M3fO0WPw7tJJI tDrohHPXp6GcmHMbF8narghcEpa3Co/R+gASR6cLDBmXgKo+3VeQK1Tl1tLHxrAlfV+S manTrHKopNRcMgbDYW3a5n3FT+GeiS6I0+0zUa9WeXjaQvICcw4rn3s6TgqyGHIJuMZO pdtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=4Ua0PUL8PcjsdIWLEr9WJ9HGb3W+zm/rf9vwl2R57sI=; b=EecVDe+cqwLU6+hOk9xwDz8r+qdbC468gOtg506103KbGdHkWdCq5ctoIlsvzI14Ax +nMRtangf3Y+43Xt+5k/qfQTCQCM/pJEpRAUmnYK8rwhGk58JdCeVg5KFdrYKfBBA7wP KSknxdP4MK4bhV2F5A+wiISrMegSvmTBuqNafSWm7yuOW5ajqNrQ3KiRzAFwdFdaLThk ssRW60WdHGRgjikfPkpwQZnWFLsUiSCM3pYN3YKUV24B7lnNjvR/DKWQvs5kdMt3Do8/ 8qYnQgGdG/zSAFHE/e7HzMLXYvemGCCSaWBAcdbYb+ZsEaM3G9rSDjhKmxgbB65BwYCe o1+w== X-Gm-Message-State: AIkVDXKLmXcBxgcuW11nlDL4CB8nBY5WGH/1c806j9+WpHZu3z0bh1IKn4sb0ZTIdulNNg6g X-Received: by 10.28.191.87 with SMTP id p84mr14867748wmf.63.1482169792208; Mon, 19 Dec 2016 09:49:52 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id c202sm21463826wme.1.2016.12.19.09.49.50 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 19 Dec 2016 09:49:51 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Date: Mon, 19 Dec 2016 18:49:00 +0100 Message-Id: <8a8d3efbf0258cc3afa5b334b180e049ce2f9ee3.1482168851.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 10/25] app/testpmd: add flow flush command X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Dec 2016 17:49:52 -0000 Syntax: flow flush {port_id} Destroy all flow rules on a port. Signed-off-by: Adrien Mazarguil Acked-by: Olga Shern --- app/test-pmd/cmdline.c | 3 +++ app/test-pmd/cmdline_flow.c | 43 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0dc6c63..6e2b289 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -811,6 +811,9 @@ static void cmd_help_long_parsed(void *parsed_result, " (select|add)\n" " Set the input set for FDir.\n\n" + "flow flush {port_id}\n" + " Destroy all flow rules.\n\n" + "flow list {port_id} [group {group_id}] [...]\n" " List existing flow rules sorted by priority," " filtered by group identifiers.\n\n" diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index bd3da38..49578eb 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -63,6 +63,7 @@ enum index { FLOW, /* Sub-level commands. */ + FLUSH, LIST, /* List arguments. */ @@ -179,6 +180,9 @@ static const enum index next_list_attr[] = { static int parse_init(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); +static int parse_flush(struct context *, const struct token *, + const char *, unsigned int, + void *, unsigned int); static int parse_list(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -240,10 +244,19 @@ static const struct token token_list[] = { .name = "flow", .type = "{command} {port_id} [{arg} [...]]", .help = "manage ingress/egress flow rules", - .next = NEXT(NEXT_ENTRY(LIST)), + .next = NEXT(NEXT_ENTRY + (FLUSH, + LIST)), .call = parse_init, }, /* Sub-level commands. */ + [FLUSH] = { + .name = "flush", + .help = "destroy all flow rules", + .next = NEXT(NEXT_ENTRY(PORT_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), + .call = parse_flush, + }, [LIST] = { .name = "list", .help = "list existing flow rules", @@ -316,6 +329,31 @@ parse_init(struct context *ctx, const struct token *token, return len; } +/** Parse tokens for flush command. */ +static int +parse_flush(struct context *ctx, const struct token *token, + const char *str, unsigned int len, + void *buf, unsigned int size) +{ + struct buffer *out = buf; + + /* Token name must match. */ + if (parse_default(ctx, token, str, len, NULL, 0) < 0) + return -1; + /* Nothing else to do if there is no buffer. */ + if (!out) + return len; + if (!out->command) { + if (ctx->curr != FLUSH) + return -1; + if (sizeof(*out) > size) + return -1; + out->command = ctx->curr; + ctx->object = out; + } + return len; +} + /** Parse tokens for list command. */ static int parse_list(struct context *ctx, const struct token *token, @@ -698,6 +736,9 @@ static void cmd_flow_parsed(const struct buffer *in) { switch (in->command) { + case FLUSH: + port_flow_flush(in->port); + break; case LIST: port_flow_list(in->port, in->args.list.group_n, in->args.list.group); -- 2.1.4