From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id E6690959 for ; Sat, 28 Feb 2015 06:42:04 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 27 Feb 2015 21:36:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,665,1418112000"; d="scan'208";a="460560016" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by FMSMGA003.fm.intel.com with ESMTP; 27 Feb 2015 21:26:21 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.195.1; Sat, 28 Feb 2015 13:42:00 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.197]) with mapi id 14.03.0195.001; Sat, 28 Feb 2015 13:41:52 +0800 From: "Fu, JingguoX" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask is specified Thread-Index: AQHQUl1iJW6ulTU3X0WOt/wyZORpQJ0FioHA Date: Sat, 28 Feb 2015 05:41:53 +0000 Message-ID: <6BD6202160B55B409D423293115822625ED93E@SHSMSX101.ccr.corp.intel.com> References: <1425021375-5763-1-git-send-email-mukawa@igel.co.jp> In-Reply-To: <1425021375-5763-1-git-send-email-mukawa@igel.co.jp> 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] testpmd: Fix segmentation fault when portmask is specified 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: Sat, 28 Feb 2015 05:42:05 -0000 Tested-by: Jingguo Fu =20 - Tested Commit: 8a6f6d45d290a27ef923d10925c4893380697b31 - OS: Fedora20 3.11.10-301.fc20.x86_64 - GCC: gcc version 4.8.3 20140911 - CPU: Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz - NIC: Intel Corporation Device [8086:1563] - Default x86_64-native-linuxapp-gcc configuration - Total 1 case, 1 passed, 0 failed =20 - Case: test_checksum_checking Description: Check testpmd can be startup with cmdline for checksum Command / instruction: Start testpmd with command line as: ./x86_64-native-linuxapp-gcc/app/testpmd -c 0x1fffffffff -n 4 --= -i --coremask=3D0x400 --portmask=3D0x3 --nb-cores=3D2 --enable-rx-cksum --= disable-hw-vlan --disable-rss --rxd=3D1024 --txd=3D1024 --rxfreet=3D0 Start ports: set fwd cusm start Expected test result: Testpmd can startup. -----Original Message----- From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Tetsuya Mukawa Sent: Friday, February 27, 2015 15:16 To: dev@dpdk.org Subject: [dpdk-dev] [PATCH] testpmd: Fix segmentation fault when portmask i= s specified If testpmd is invoked with portmask option like below, segmentation fault will be occured. This patch fixes the issue. Reported-by: De Lara Guarch, Pablo Signed-off-by: Tetsuya Mukawa --- app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 43329ed..61291be 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -579,20 +579,6 @@ init_config(void) socket_num); } =20 - /* Configuration of Ethernet ports. */ - ports =3D rte_zmalloc("testpmd: ports", - sizeof(struct rte_port) * RTE_MAX_ETHPORTS, - RTE_CACHE_LINE_SIZE); - if (ports =3D=3D NULL) { - rte_exit(EXIT_FAILURE, - "rte_zmalloc(%d struct rte_port) failed\n", - RTE_MAX_ETHPORTS); - } - - /* enabled allocated ports */ - for (pid =3D 0; pid < nb_ports; pid++) - ports[pid].enabled =3D 1; - FOREACH_PORT(pid, ports) { port =3D &ports[pid]; rte_eth_dev_info_get(pid, &port->dev_info); @@ -1999,6 +1985,26 @@ init_port_dcb_config(portid_t pid,struct dcb_config = *dcb_conf) return 0; } =20 +static void +init_port(void) +{ + portid_t pid; + + /* Configuration of Ethernet ports. */ + ports =3D rte_zmalloc("testpmd: ports", + sizeof(struct rte_port) * RTE_MAX_ETHPORTS, + RTE_CACHE_LINE_SIZE); + if (ports =3D=3D NULL) { + rte_exit(EXIT_FAILURE, + "rte_zmalloc(%d struct rte_port) failed\n", + RTE_MAX_ETHPORTS); + } + + /* enabled allocated ports */ + for (pid =3D 0; pid < nb_ports; pid++) + ports[pid].enabled =3D 1; +} + int main(int argc, char** argv) { @@ -2013,6 +2019,9 @@ main(int argc, char** argv) if (nb_ports =3D=3D 0) RTE_LOG(WARNING, EAL, "No probed ethernet devices\n"); =20 + /* allocate port structures, and init them */ + init_port(); + set_def_fwd_config(); if (nb_lcores =3D=3D 0) rte_panic("Empty set of forwarding logical cores - check the " --=20 1.9.1