From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30064.outbound.protection.outlook.com [40.107.3.64]) by dpdk.org (Postfix) with ESMTP id 8EFC21B4BC for ; Wed, 4 Jul 2018 09:06:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NS8i5zfYIcHVTTouY9ybvee1zdpoj8311K+WRuF+uUM=; b=vyU8HdWUJrF+8W9njT6+3HvfOo75byPhlyFHcYiUvAyqXZVJkg1+qlq78LMr8ZJR1q+yswadi5Q8OnTmKYYgJec/et5XbL0zyKwk6J0VGsaY1y5+IUHjkF88QLnzAO+AQ5byu3lnboy50BnRcqd1klSg2YKNZZcAgy15ydPqijA= Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com (10.168.137.20) by VI1PR0501MB2766.eurprd05.prod.outlook.com (10.172.11.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.18; Wed, 4 Jul 2018 07:06:15 +0000 Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com ([fe80::9dd0:9bdb:fd59:b615]) by VI1PR0501MB2608.eurprd05.prod.outlook.com ([fe80::9dd0:9bdb:fd59:b615%7]) with mapi id 15.20.0906.026; Wed, 4 Jul 2018 07:06:15 +0000 From: Matan Azrad To: Thomas Monjalon , "Guo, Jia" CC: "dev@dpdk.org" , "stephen@networkplumber.org" , "bruce.richardson@intel.com" , "ferruh.yigit@intel.com" , "konstantin.ananyev@intel.com" , "gaetan.rivet@6wind.com" , "jingjing.wu@intel.com" , Mordechay Haimovsky , "harry.van.haaren@intel.com" , "qi.z.zhang@intel.com" , "shaopeng.he@intel.com" , "bernard.iremonger@intel.com" , "shreyansh.jain@nxp.com" , "helin.zhang@intel.com" Thread-Topic: [dpdk-dev] [PATCH V4 8/9] app/testpmd: show example to handle hot unplug Thread-Index: AQHUD5ShApRc/UVJmkyJ3gcmutq4qKR5/MwQgANGWwCAANyMAIAAezmQ Date: Wed, 4 Jul 2018 07:06:15 +0000 Message-ID: References: <1498711073-42917-1-git-send-email-jia.guo@intel.com> <07fb8f04-adee-fd0e-05b5-8d1bcca1338d@intel.com> <2612071.aGzFhBPpOt@xps> In-Reply-To: <2612071.aGzFhBPpOt@xps> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2766; 7:/P5neXaQWbMrDDyqQ1YfhtYbmBmC3Z2v5x7Yvgd5CEX0Iv2QYueXDsvq+TGweCqZYDykddDp5MS3vVbPYNLIYWrONVLNVEPXGMYLzfZQsTfLAOgnbeQWUxixo5d42wIRNvrBC2ax61LoCZRAdr+Tx0DMIOEYQ53G20ip5skbJdw5cv3//qWjRmkQkPTYidMG9PEeF/fnWKU0BUnOylaOSH/jvYJxVoc/bqMHt1I6ddYY3HofAlSonz4My+avttEu x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 5c784cd7-b48b-4f02-92e1-08d5e17ca262 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(48565401081)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2766; x-ms-traffictypediagnostic: VI1PR0501MB2766: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2766; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2766; x-forefront-prvs: 0723A02764 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(136003)(396003)(39860400002)(51444003)(189003)(199004)(53546011)(53936002)(305945005)(7736002)(9686003)(229853002)(2906002)(6246003)(97736004)(74316002)(66066001)(6436002)(26005)(316002)(86362001)(25786009)(186003)(68736007)(4326008)(55016002)(54906003)(110136005)(486006)(476003)(8676002)(14454004)(76176011)(33656002)(106356001)(99286004)(7416002)(81166006)(93886005)(81156014)(5250100002)(105586002)(8936002)(256004)(6506007)(7696005)(5660300001)(3846002)(14444005)(2900100001)(6116002)(102836004)(11346002)(446003)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2766; H:VI1PR0501MB2608.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: HlNg1CTlmZHyXBSTUF/N+g7+97ZipA1G+W4GsC6qyf39nFGfLIhKdFJWS/kSewpRE8+89cO/sjjecwp9ljwlRzb7XCdbIvou4xCyCXeAqbWhPm8O1QK9lXihR8SpV7LYckYWZahz/XqNV4zEPlGywI8J1CPaVAQ+qMh132Mc4b/Qt42d3yg21ETxGYKJxXT0Hg3cA6JP0GNypFG3suLMgKIQ2BlOCUo4o0wS8K3grlZQNpKS3mMDxFx7FWcviLzjAFI1s+e/vp/KLi0s4JbRhgQm1Oy7OkrvhZfwfKe4/3yKUqthh7OZsD2CDcFnwmfhC288N61MQDD71wilD/gMMXgzjf/kz/5Hs6spDmJwVuM= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c784cd7-b48b-4f02-92e1-08d5e17ca262 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Jul 2018 07:06:15.8706 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2766 Subject: Re: [dpdk-dev] [PATCH V4 8/9] app/testpmd: show example to handle hot unplug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jul 2018 07:06:18 -0000 Hi Thomas, Guo From: Thomas Monjalon > 03/07/2018 11:35, Guo, Jia: > > On 7/1/2018 3:46 PM, Matan Azrad wrote: > > > From: Jeff Guo > > >> --- a/app/test-pmd/testpmd.c > > >> +++ b/app/test-pmd/testpmd.c > > >> @@ -2206,9 +2209,12 @@ eth_dev_event_callback(char > *device_name, > > >> enum rte_dev_event_type type, > > >> case RTE_DEV_EVENT_REMOVE: > > >> RTE_LOG(ERR, EAL, "The device: %s has been removed!\n", > > >> device_name); > > >> - /* TODO: After finish failure handle, begin to stop > > >> - * packet forward, stop port, close port, detach port. > > >> - */ > > >> + ret =3D rte_eth_dev_get_port_by_name(device_name, > &port_id); > > > As you probably know, 1 rte_device may be associated to more than one > ethdev ports, so the ethdev port name can be different from rte_device > name. > > > Looks like we need a new ethdev API to get all the ports associated t= o > one rte_device. > > > > agree, seems that the the old ethdev API have some issue when got all > > port by device name. we could check with ethdev maintainer and fix it > > by specific ethdev patch later. >=20 > This ethdev function could return an error if several ports match. >=20 Just to clarify: The ethdev name may be different from the rte_device name of a port, The rte_eth_dev_get_port_by_name() searches the ethdev name and not the rte= _device name. > Ideally, we should not use this function at all. > If you want to manage an ethdev port, why are you using an EAL event? > There is an ethdev callback mechanism for port removal. So, looks like the EAL event should trigger an ethdev event for all the por= ts associated to this rte_device. I think that the best one to do it is the PMD, so maybe the PMD(which wants= to support hot unplug) should register to the EAL event and to trigger an = ethdev RMV event from the EAL callback. What do you think? =20