From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CE00B41E21;
	Thu,  9 Mar 2023 18:21:45 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id B27EB40ED7;
	Thu,  9 Mar 2023 18:21:45 +0100 (CET)
Received: from mga17.intel.com (mga17.intel.com [192.55.52.151])
 by mails.dpdk.org (Postfix) with ESMTP id 562DC40695
 for <dev@dpdk.org>; Thu,  9 Mar 2023 18:21:44 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1678382504; x=1709918504;
 h=from:to:cc:subject:date:message-id:references:
 in-reply-to:content-transfer-encoding:mime-version;
 bh=F1Zcm3O1tH9ScWMnwIJib96ZkZWsmXz+9pa3HDB2wr0=;
 b=nxR0RGjfcKbalE48i5uVoIadtPJDX1fVkHCX5pLY1b0QnySQiajHbpq3
 XdOx5rEvHXqFbYdh1S5JNq5wjYWG4IKzJdnXBiLaJlSiTemMTxfHxYuHx
 4EvnI2sxYFtCs+AFMb67Ephu+Oa0bfXmEILiCmw/iLREf/DQ3nRYYHjZJ
 L6tFY27IL0iYE80s5ew5ydkUI1kK6whhUWPlEYacnT301d2zhpIiPPyvv
 daFXz9q3cudUKOrqtTw0cH97KsjHMDyaXr4cDNCTDy09KRuP72yQlJ0zG
 lauqf2ZfmD/c0P9nRFbpBhnFH3moW3emzser4QYxnTM2z3DYDyqXortoh A==;
X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="316902242"
X-IronPort-AV: E=Sophos;i="5.98,247,1673942400"; d="scan'208";a="316902242"
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 09 Mar 2023 09:20:02 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10644"; a="741635683"
X-IronPort-AV: E=Sophos;i="5.98,247,1673942400"; d="scan'208";a="741635683"
Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16])
 by fmsmga008.fm.intel.com with ESMTP; 09 Mar 2023 09:20:02 -0800
Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by
 ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.21; Thu, 9 Mar 2023 09:20:01 -0800
Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by
 ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.21; Thu, 9 Mar 2023 09:20:01 -0800
Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by
 orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.21 via Frontend Transport; Thu, 9 Mar 2023 09:20:01 -0800
Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173)
 by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2507.21; Thu, 9 Mar 2023 09:20:01 -0800
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=Vy5K5xZK6ISsqAL4rTNYzyoYJ/KiIQRQdnBsilx9bhgwcfTCniumy/w071kpL3PIBKKtG8umyPgXmV/I2uYgA37OaSzIZqYJvUbIXgKkrvfckD5qgt05Jw7G/NZRO1KOKrNU2JnU7NZb5/1O7lfaEkaOkFxkpUAoek5NvIU73nscq8s6zRiTGQ0wl+eM9GRTAJ6sBDtqZTqm7qYeXJgFscNuD2opT+khPLh4oZY9mePgEVOkNbJKHhq2bCdbJxrQXCubcCrLD65q4Ko2K3N6MAhQt6HdmneTDPCh1w6RPty4rx3+XH/+Isv5ZAkR2jNM921UH/2kEz/JtN0rvAByzg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
 bh=656dV1OuPpVwPeb66A/vRAX3F4gJSHrcVh97UUIw3p8=;
 b=LPXzhfi5Q+84KD4G6bfCECey3bRt7/R5m/Sgps4jrNDVEQM6nn00HzmQYTPDU69MMgKyy325FsxlM+81Yr8gngGK7OSPwMbIm2hZMNK6d8p+2whAaO5P2kq9QnKjfJw+15EobTeZc6rOL2aE5KuBkD9MwmBW3ppotoW/1yO/X+o7gwx6KJmdi4feEyixuPD9/Yu9bHtv7I8B9ZqLB7sbQla3KdeQ6a7XSVgr7cGxKDJGt+Bwx8dkOPSCdGWSXGh6aNby6lbQoWmoPO3Q8zT7aYAOus1BOLpwFFV7K1riVmTecMx6V5FeHEVJ6gbczfwmAdW8B8xD6XWomYs2nwQjLw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
Received: from CH0PR11MB5724.namprd11.prod.outlook.com (2603:10b6:610:101::22)
 by PH8PR11MB6928.namprd11.prod.outlook.com (2603:10b6:510:224::12)
 with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.17; Thu, 9 Mar
 2023 17:19:59 +0000
Received: from CH0PR11MB5724.namprd11.prod.outlook.com
 ([fe80::81e6:4df3:9629:7ed4]) by CH0PR11MB5724.namprd11.prod.outlook.com
 ([fe80::81e6:4df3:9629:7ed4%6]) with mapi id 15.20.6178.019; Thu, 9 Mar 2023
 17:19:59 +0000
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>, "Jangra, Yogesh"
 <yogesh.jangra@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, "R, Kamalakannan"
 <kamalakannan.r@intel.com>, "Suresh Narayane, Harshad"
 <harshad.suresh.narayane@intel.com>
Subject: RE: [PATCH] app/testpmd: fix closing softnic port before ethdev ports
Thread-Topic: [PATCH] app/testpmd: fix closing softnic port before ethdev ports
Thread-Index: AQHZUpWpARBX8L4J1EaVq7nwtdmnNa7yo/CAgAAKIdA=
Date: Thu, 9 Mar 2023 17:19:59 +0000
Message-ID: <CH0PR11MB57243F483E32803F24206DD9EBB59@CH0PR11MB5724.namprd11.prod.outlook.com>
References: <20230309144249.1199517-1-yogesh.jangra@intel.com>
 <20230309083109.01baaebb@hermes.local>
In-Reply-To: <20230309083109.01baaebb@hermes.local>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=intel.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: CH0PR11MB5724:EE_|PH8PR11MB6928:EE_
x-ms-office365-filtering-correlation-id: 676feac8-8af8-43f0-d874-08db20c282c3
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: X/Kp6qaWqdun7gg4MkrzYG+o3L2jzaEbom05EWdYABNO8T14EXyQ7i1Jj+WmjTEbZz+tiv8SrSrfF7oRAoPtFvDGmy5gHRlukrol6/064wgnvpRk1+/eRxDxkUePoSzKYHMig0p757CiUVDhsMZQV0Q5Di5sFJ4Xx1J2BdLhtr6UTzSzY7ogBEKLrY4nv2s0+mbxm0NN5VF13IQdu5iP3BksjlNQT3UH/Ym2PJvA2s0gubfKH4kKYCc+xZ9co+Iwi6WKcjSUGzShPJYMpsF4O31t9PJ9vNhMbJ+cNOyGN055LCD/0VTbjMKuCqzCzpusvLIOr4/rBWMEyNkV17SBqHiZscOZ+qbFbaZXSANubRO4u+icD5YCA8mWzZuuomlnTrRlWWt4l+++zkPFdOOhErdEKGJ/Gu8PcLzZo/p9qBxLbL+idLB7F99+LMq4jUKB1Q0PF/e2NKt/Ar8FMI6hEl0ch8Ofv/pXKhMqlrC+2kRRgDzfCMUi1Yx3GG28XJxX5L5lkEyTS9OnREgFn7nDJ2Vl0qRAsBLBWZG2ZzIrXQQGul769mifYoX2NX61/hr0qqnXOBv1tjlNIJGS8MFg02BWHyx73tyLZwGZU36uxWJLHesq8rd6BsUB+hoU0rE68KiplYFhjT+Waxj6ucuq3Wu7PujNLgGTGZY4v3dXX6oGN8JB6X9tdskhn9Mm1kk8Y3FDVar+sHR2ddTwPRs+6w==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
 IPV:NLI; SFV:NSPM; H:CH0PR11MB5724.namprd11.prod.outlook.com; PTR:; CAT:NONE;
 SFS:(13230025)(39860400002)(396003)(346002)(366004)(376002)(136003)(451199018)(2906002)(38070700005)(8676002)(66946007)(5660300002)(8936002)(26005)(52536014)(33656002)(110136005)(41300700001)(76116006)(66446008)(86362001)(66556008)(54906003)(6636002)(316002)(7696005)(71200400001)(478600001)(122000001)(107886003)(38100700002)(82960400001)(66476007)(53546011)(64756008)(55016003)(6506007)(9686003)(4326008)(83380400001)(186003);
 DIR:OUT; SFP:1102; 
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ihmbF00CkvYTXppOSPPHmTUW7DzTaMGY072+nUdmFSx2kV5rSklLOQa3UCM3?=
 =?us-ascii?Q?a1mymXZCO4RfEY9wrLXPF/gi6py3vMrX71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JAYzg2McSNAM+/V2IOxVr6fDuRjJxzBcaVJ8Kj5NwxSQ8Mc6y0VbAlFsiEpv?=
 =?us-ascii?Q?rxe7RG4XFE8vTnfOOakpwiW2iiHYHI+JKB0BzsRwxAZkGCuNxMfvyeiPQyzg?=
 =?us-ascii?Q?S729YpFzb2Y/vzV0tVTvjE0iGDqVKWgYrey533b0apH/9v3VeLKcecqaTqXn?=
 =?us-ascii?Q?63Lw2BFxxfpbUT+Wvx10Yn1IovFVgSB1FnvCm8ocFzYUpN/UeobZqq0IKTdJ?=
 =?us-ascii?Q?9aLtKWR91H7bL2k6V5iMq9Vo1+uf/EwT093RJ6shkbvjB9EaGpIhkvDtgel3?=
 =?us-ascii?Q?c3MMGPvr6XSxw2DnmfNxFrPszUL0N0oZIGz4An4mFMYQhlX8Mz9ZXxonvGv4?=
 =?us-ascii?Q?k3gFiW6DzVxlMG7wgpOESCeaHoQz1TYVZdAK8Qtiy9RNmxqPdp6UBIBGaiqf?=
 =?us-ascii?Q?NCDBW1npoGrQc+/AK43620CD5YEDYM/1cgC2Vijc+vWTLG4P+lBx46NENuRY?=
 =?us-ascii?Q?V4MBYIP9YJWRq8Ei3F/GK1cZ2m9LDZBD9plpcOS/+A8wW4jmhQzZUmxl+rz9?=
 =?us-ascii?Q?fJt44loXuPN8sHenOUP3EGaoUjp9YR/Cz6oLSt7mh1sBs7yfethMQbvYVGvd?=
 =?us-ascii?Q?qJGsgmmPf4/k4k7bocyuqd6Jrs4d8aQuOv+K1GsGeH5IGlrhBxgLOQHEE6eg?=
 =?us-ascii?Q?KQ=3D=3D?=
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: CH0PR11MB5724.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 676feac8-8af8-43f0-d874-08db20c282c3
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Mar 2023 17:19:59.2361 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: m1vvk9veDyh56OHNhRPEU15xk9UeHolsIvQOEi4g96EfgvgUoPg9o7ZchsVI6SgRg9clCzhFNXnY398cV9DVAQ/2jjR24ADZ9jebwYNUCVk=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR11MB6928
X-OriginatorOrg: intel.com
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org



> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Thursday, March 9, 2023 4:31 PM
> To: Jangra, Yogesh <yogesh.jangra@intel.com>
> Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; R=
,
> Kamalakannan <kamalakannan.r@intel.com>; Suresh Narayane, Harshad
> <harshad.suresh.narayane@intel.com>
> Subject: Re: [PATCH] app/testpmd: fix closing softnic port before ethdev =
ports
>=20
> On Thu,  9 Mar 2023 14:42:49 +0000
> Yogesh Jangra <yogesh.jangra@intel.com> wrote:
>=20
> > +		/*
> > +		 * SoftNIC runs on the sevice core, it uses the resources from
> > +		 * the testpmd application. When we run quit command, the
> testpmd
> > +		 * application stops ethdev ports first, SoftNIC will try to
> > +		 * access the port and sometimes that result in segmentation
> > +		 * error. So first closing the SoftNIC port.
> > +		 */
> > +		RTE_ETH_FOREACH_DEV(pt_id) {
> > +			if (!strcmp(ports[pt_id].dev_info.driver_name,
> "net_softnic")) {
> > +				stop_port(pt_id);
> > +				close_port(pt_id);
> > +			}
> > +		}
> > +
>=20
> NAK
> No driver specific hacks please.
>=20
> Instead fix the driver design or bug please.

Hi Stephen,

This is not a Soft NIC driver-specific hack, this is required for working a=
round some of the ethdev drivers that don't implement the stop() API correc=
tly and free up the device queues or some other internal resources on stop(=
) instead of close().

The Soft NIC is a meta-device that sits on top of other "physical" ethdev d=
evices, so when the Soft NIC device continues to poll the queues of those p=
hysical devices after their queues have been freed, the Soft NIC will get a=
 segfault. This fix is required to protect against this sort of incorrect d=
river behavior by simply stopping the Soft NIC devices first.

We already have several driver specific branches in the test-pmd for e.g. L=
AG or virtual devices; IMO this small change falls in the same category and=
 it should get accepted.

Please let us know if this makes sense to you?

Regards,
Cristian