From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by dpdk.org (Postfix) with ESMTP id C4EDADE0 for ; Sat, 28 Feb 2015 00:33:14 +0100 (CET) Received: by wesw62 with SMTP id w62so23203662wes.9 for ; Fri, 27 Feb 2015 15:33:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=AED23gfM4iKCKcNdV+9sr6VLOATsfT+aWxDo2eMYXCA=; b=V9I/UCKy5Kmq3dc3AkRTl2oUzqOpUKrsSQYCg3EWRBSvFFC4T+/dMmzJbDBj837CVS Zi1Z3PgEDblBHOeJDNUyX69W7wbs9f0GJkaw8ztTpIYXAsPzWszYjc1dKMPD05DHsOoD c3P4PVyfkVWB1m8A0DV3RXJ3knOXhs6tiAIZuBYvh1aPV55llNPnsfeedC9TS6Eu7KMO e7lfH4z8sUwmDhmrA8d/obGXvn6VwmXA2Iv0pNJqIVhQ1PP0sqhAkIru7z0Y73K4zXF4 I4QbxVKfu09HK3XwiGanSEu+48HAAfWeGgZINqn8Xhih2fGA110y8MtvIC4GLVUmhHxK tzRQ== X-Gm-Message-State: ALoCoQmM/0bosR0+/a7ED3tZectGV8fgU/VdafIC8oOoi0geXBWrYAH/RgU5oR6j73oIKmrlcicv X-Received: by 10.180.198.101 with SMTP id jb5mr11032140wic.92.1425079994678; Fri, 27 Feb 2015 15:33:14 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id j9sm7968637wjy.18.2015.02.27.15.33.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Feb 2015 15:33:12 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Sat, 28 Feb 2015 00:32:35 +0100 Message-ID: <2513998.N5MFrvXWu9@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <54F00B63.5050003@igel.co.jp> References: <1424837093-5661-13-git-send-email-mukawa@igel.co.jp> <54F00B63.5050003@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v15] testpmd: Add port hotplug support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2015 23:33:15 -0000 2015-02-27 15:14, Tetsuya Mukawa: > On 2015/02/27 3:49, De Lara Guarch, Pablo wrote: > > > >> -----Original Message----- > >> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tetsuya Mukawa > >> Sent: Wednesday, February 25, 2015 7:32 PM > >> To: dev@dpdk.org > >> Subject: [dpdk-dev] [PATCH v15] testpmd: Add port hotplug support > >> > >> The patch introduces following commands. > >> - port attach [ident] > >> - port detach [port_id] > >> - attach: attaching a port > >> - detach: detaching a port > >> - ident: pci address of physical device. > >> Or device name and parameters of virtual device. > >> (ex. 0000:02:00.0, eth_pcap0,iface=eth0) > >> - port_id: port identifier > >> > >> v15: > >> - Replace rte_eal_dev_attach() by rte_eth_dev_attach() > >> - Replace rte_eal_dev_detach() by rte_eth_dev_detach() > >> > >> v7: > >> - Fix doc. > >> (Thanks to Iremonger, Bernard) > >> - Fix port checking implementation of star_port(); > >> (Thanks to Qiu, Michael) > >> v5: > >> - Add testpmd documentation. > >> (Thanks to Iremonger, Bernard) > >> v4: > >> - Fix strings of command help. > >> > >> Signed-off-by: Tetsuya Mukawa > >> --- > >> app/test-pmd/cmdline.c | 137 +++++++++++++++---- > >> app/test-pmd/config.c | 102 ++++++++------ > >> app/test-pmd/parameters.c | 22 ++- > >> app/test-pmd/testpmd.c | 199 +++++++++++++++++++++------- > >> app/test-pmd/testpmd.h | 18 ++- > >> doc/guides/testpmd_app_ug/testpmd_funcs.rst | 57 ++++++++ > >> 6 files changed, 409 insertions(+), 126 deletions(-) > >> > > [...] > > > >> @@ -1423,12 +1443,8 @@ set_fwd_ports_list(unsigned int *portlist, > >> unsigned int nb_pt) > >> again: > >> for (i = 0; i < nb_pt; i++) { > >> port_id = (portid_t) portlist[i]; > >> - if (port_id >= nb_ports) { > >> - printf("Invalid port id %u >= %u\n", > >> - (unsigned int) port_id, > >> - (unsigned int) nb_ports); > >> + if (port_id_is_invalid(port_id, ENABLED_WARN)) > > Sorry for catching this late, but there is a segmentation fault when this function gets called > > when parsing "portmask" at testpmd initialization, since port_id_is_invalid function needs to have array "ports" initialized. > > I would revert the change, but not sure if this is need for other reasons. > > Hi Pablo, > > I appreciate for your reporting. > I could reproduce the issue with portmask option like below > $ sudo ./testpmd -c f -n 1 -- --portmask 0x1 -i > > As a result of investigation, when 'launch_args_parse()' is called, port > structure hasn't been allocated yet. > As you said, this causes the issue. > > I guess we can have 2 options to fix the issue. > > Option1: > Fix 'set_fwd_ports_list()' to work even when port structure hasn't been > initialized yet. > I guess this implementation is much complex for readers of test-pmd code. > > Option2: > Move initialization code of ports like below. > > int main () { > > init_port(); /* only initialize port structure here*/ > launch_args_parse(); > init_config(); /* So far, port initialization code is > implemented in init_config() */ > > } > > I guess 2nd option may be better. > How do you think? > I will send a patch to implement 2nd option. > if you are ok to fix like above, could you please check and acked it? For the record, Tetsuya chose the second option: http://dpdk.org/browse/dpdk/commit/?id=ffc468ff3cfe768