From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jingjing.wu@intel.com>
Received: from mga09.intel.com (mga09.intel.com [134.134.136.24])
 by dpdk.org (Postfix) with ESMTP id 6A1524C57
 for <dev@dpdk.org>; Wed, 28 Jun 2017 11:11:02 +0200 (CEST)
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 28 Jun 2017 02:10:52 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.40,274,1496127600"; d="scan'208";a="119718467"
Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202])
 by fmsmga005.fm.intel.com with ESMTP; 28 Jun 2017 02:10:52 -0700
Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by
 fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Wed, 28 Jun 2017 02:10:52 -0700
Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by
 FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Wed, 28 Jun 2017 02:10:51 -0700
Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.116]) by
 SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0319.002;
 Wed, 28 Jun 2017 17:10:50 +0800
From: "Wu, Jingjing" <jingjing.wu@intel.com>
To: "Dai, Wei" <wei.dai@intel.com>, "thomas@monjalon.net"
 <thomas@monjalon.net>, "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "Ananyev,
 Konstantin" <konstantin.ananyev@intel.com>, "Zhang, Helin"
 <helin.zhang@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH v2 4/5] app/testpmd: add command to test NIC reset
Thread-Index: AQHS71ArTlMLbP7CT0qdMW7RWHZcRKI5/LCw
Date: Wed, 28 Jun 2017 09:10:50 +0000
Message-ID: <9BB6961774997848B5B42BEC655768F810DB3522@SHSMSX103.ccr.corp.intel.com>
References: <1495873329-43303-1-git-send-email-wei.dai@intel.com>
 <1498572438-25125-1-git-send-email-wei.dai@intel.com>
 <1498572438-25125-5-git-send-email-wei.dai@intel.com>
In-Reply-To: <1498572438-25125-5-git-send-email-wei.dai@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH v2 4/5] app/testpmd: add command to test NIC
	reset
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 28 Jun 2017 09:11:02 -0000



> -----Original Message-----
> From: Dai, Wei
> Sent: Tuesday, June 27, 2017 10:07 PM
> To: thomas@monjalon.net; Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev,
> Konstantin <konstantin.ananyev@intel.com>; Zhang, Helin
> <helin.zhang@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>
> Subject: [PATCH v2 4/5] app/testpmd: add command to test NIC reset
>=20
> When a NIC is reset, a message will show it.
> And then user can run the command "reset_port port_id"
> to process it.
>=20
> Signed-off-by: Wei Dai <wei.dai@intel.com>
> ---
>  app/test-pmd/cmdline.c | 31 +++++++++++++++++++++++++++++++  app/test-
> pmd/config.c  | 13 +++++++++++++  app/test-pmd/testpmd.h |  1 +
>  3 files changed, 45 insertions(+)
>=20
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> ff8ffd2..90f6bde 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -2588,6 +2588,36 @@ cmdline_parse_inst_t cmd_stop =3D {
>  	},
>  };
>=20
> +/* *** reset a port *** */
> +struct cmd_reset_port_result {
> +	cmdline_fixed_string_t command;
> +	uint8_t port_id;
> +};
> +
> +static void cmd_reset_port_parsed(__attribute__((unused)) void
> *parsed_result,
> +			    __attribute__((unused)) struct cmdline *cl,
> +			    __attribute__((unused)) void *data) {
> +	struct cmd_reset_port_result *res =3D parsed_result;
> +	reset_port(res->port_id);
> +}
> +
> +cmdline_parse_token_string_t cmd_reset_port_cmd =3D
> +	TOKEN_STRING_INITIALIZER(struct cmd_reset_port_result, command,
> +"reset_port"); cmdline_parse_token_num_t cmd_reset_port_id =3D
> +	TOKEN_NUM_INITIALIZER(struct cmd_reset_port_result, port_id,
> UINT8);
> +
> +cmdline_parse_inst_t cmd_reset_port =3D {
> +	.f =3D cmd_reset_port_parsed,
> +	.data =3D NULL,
> +	.help_str =3D "reset_port <port_id>",

You can just add one more option in the commands
"port start|stop|close <port_id>" and " port start|stop|close all"
To "port start|stop|close|reset <port_id>" and " port start|stop|close|rese=
t all" instead of defining a new one.