From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id AD6E65A53 for ; Fri, 27 Feb 2015 11:06:46 +0100 (CET) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 27 Feb 2015 02:02:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,658,1418112000"; d="scan'208";a="658025045" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga001.jf.intel.com with ESMTP; 27 Feb 2015 02:06:44 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.218]) by IRSMSX101.ger.corp.intel.com ([163.33.3.153]) with mapi id 14.03.0195.001; Fri, 27 Feb 2015 10:06:43 +0000 From: "De Lara Guarch, Pablo" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [PATCH] testpmd: Fix segmentation fault when portmask is specified Thread-Index: AQHQUl1NJiGxNglKz0Wp/86+Pyc6iZ0ERVdQ Date: Fri, 27 Feb 2015 10:06:43 +0000 Message-ID: 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: [163.33.239.181] 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: Fri, 27 Feb 2015 10:06:47 -0000 > -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Friday, February 27, 2015 7:16 AM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo; Tetsuya Mukawa > Subject: [PATCH] testpmd: Fix segmentation fault when portmask is > specified >=20 > If testpmd is invoked with portmask option like below, segmentation > fault will be occured. This patch fixes the issue. >=20 > Reported-by: De Lara Guarch, Pablo > Signed-off-by: Tetsuya Mukawa > --- > app/test-pmd/testpmd.c | 37 +++++++++++++++++++++++-------------- > 1 file changed, 23 insertions(+), 14 deletions(-) >=20 > 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 " > -- > 1.9.1 Acked-by: Pablo de Lara