From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60051.outbound.protection.outlook.com [40.107.6.51]) by dpdk.org (Postfix) with ESMTP id 2DD532BF3 for ; Mon, 9 Jul 2018 11:04:14 +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=QimLlDqUUGmkN7pt6TzltWVZPFkW1ggObuaFS1Qa8ms=; b=ACxtjxqCqRcwrSUxSe7efC8G/YD5XB4yh6QtPDtty/GiWgUFrPKff0WDMlvkDLWf0RWVAb0rb2Jw35Coieg+4MSyfyqOZIcFZhNhdTeQixYEHJnIjZErB6StWErBEyMsVocLPoVPMKworUt7hDCmI5BPnU0rSHK3Tf+1x7ysfdY= Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com (10.168.137.20) by VI1PR0501MB2592.eurprd05.prod.outlook.com (10.168.137.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Mon, 9 Jul 2018 09:04:12 +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.0930.022; Mon, 9 Jul 2018 09:04:12 +0000 From: Matan Azrad To: Jeff Guo , "Lu, Wenzhuo" , "stephen@networkplumber.org" , "Richardson, Bruce" , "Yigit, Ferruh" , "Ananyev, Konstantin" , "gaetan.rivet@6wind.com" , "Wu, Jingjing" , Thomas Monjalon , Mordechay Haimovsky , "Van Haaren, Harry" , "Zhang, Qi Z" , "He, Shaopeng" , "Iremonger, Bernard" , "arybchenko@solarflare.com" CC: "jblunck@infradead.org" , "shreyansh.jain@nxp.com" , "dev@dpdk.org" , "Zhang, Helin" Thread-Topic: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: enable hotplug detect in ixgbe Thread-Index: AQHUF1JdauwTfrLdNEKcg7SSu6NeeKSGgOKAgAACu6CAABN1AIAAAKQA Date: Mon, 9 Jul 2018 09:04:12 +0000 Message-ID: References: <1530787185-5915-1-git-send-email-jia.guo@intel.com> <1531119413-17298-1-git-send-email-jia.guo@intel.com> <1531119413-17298-2-git-send-email-jia.guo@intel.com> <6A0DE07E22DDAD4C9103DF62FEBC09093B800FC5@shsmsx102.ccr.corp.intel.com> In-Reply-To: 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; VI1PR0501MB2592; 7:FLxBhA8VN9mqYhsHkPujNQ1GRL7CovhUEkf2jSgCXCwEVGUqORwhcvdxnCxMtyhUs+OnbyhipfPcL7nnHzzhnB+OX3rbhZG7IwhATNhNiRkQLAslXDIyjf1vn5zSEEFW8l7oL8XQ5lSdlqpEOmcR0eey6amqMPjfJ5OkT/NCeTheR0Gs2uz/uLc5IuDN1pBbem3ZXJG5Sn/bttYs8ia8YclhNGwEWAydhJgYGjDuFSRsg55JN3RwB0vdFI6xr52N x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 3393fad3-5a42-48dd-5322-08d5e57af05d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0501MB2592; x-ms-traffictypediagnostic: VI1PR0501MB2592: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197)(228905959029699); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0501MB2592; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2592; x-forefront-prvs: 07283408BE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(136003)(396003)(346002)(39860400002)(366004)(13464003)(199004)(189003)(3846002)(102836004)(106356001)(81156014)(81166006)(8936002)(486006)(11346002)(6116002)(105586002)(74316002)(7416002)(53546011)(6436002)(476003)(8676002)(7696005)(5660300001)(305945005)(86362001)(7736002)(6506007)(446003)(54906003)(97736004)(2906002)(68736007)(76176011)(316002)(53936002)(4326008)(93886005)(256004)(2501003)(14444005)(478600001)(25786009)(5250100002)(14454004)(186003)(2900100001)(26005)(9686003)(55016002)(229853002)(99286004)(33656002)(66066001)(6246003)(110136005)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2592; H:VI1PR0501MB2608.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Y//WDjU5RpcOCJ6FX6unZx+zXFD99FUUelYxZRto/kgATyXUyyKaOXbbq0gHGmnodIcnqS55xeGEaN7Vy9NVHgLUxILmxE67nf7ImlEoC9hTU0zo9NLcG21W9P2Wa1Remqg8eA86aE5EdmKbLINgvWcrEsuD8b2O4HfVePF5j5ctdBDe36FQq3PCIW1VrtfUgZOTAz4vyytKj9wwfrHkGHuqF7sALwy89qQRbmqTXsagGKLSIKwUOyFC/qkAB7WMiH3dE4VYd4j6jw14Ox7mWBZHyhfARFbKaZI+3nzul5zTHESDCL5/P8+0c+uqJn623FMCDRIB0iUrQ1GNuP+AB3cZcqTzO3jJrVLgtC1VIHo= 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: 3393fad3-5a42-48dd-5322-08d5e57af05d X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2018 09:04:12.2430 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2592 Subject: Re: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: enable hotplug detect in ixgbe 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: Mon, 09 Jul 2018 09:04:14 -0000 Hi From: Jeff Guo=20 > hi, wenzhuo and matan. >=20 >=20 > On 7/9/2018 3:51 PM, Matan Azrad wrote: > > Hi > > > > From: Lu, Wenzhuo > >> Hi Jeff, > >> > >>> -----Original Message----- > >>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jeff Guo > >>> Sent: Monday, July 9, 2018 2:57 PM > >>> To: stephen@networkplumber.org; Richardson, Bruce > >>> ; Yigit, Ferruh > >>> ; Ananyev, Konstantin > >>> ; gaetan.rivet@6wind.com; Wu, > Jingjing > >>> ; thomas@monjalon.net; > motih@mellanox.com; > >>> matan@mellanox.com; > >> Van > >>> Haaren, Harry ; Zhang, Qi Z > >>> ; He, Shaopeng ; > >>> Iremonger, Bernard ; > >>> arybchenko@solarflare.com > >>> Cc: jblunck@infradead.org; shreyansh.jain@nxp.com; dev@dpdk.org; > >>> Guo, Jia ; Zhang, Helin > >>> Subject: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: enable hotplug detect > >>> in ixgbe > >>> > >>> This patch aim to enable hotplug detect in ixgbe pmd driver. Firstly > >>> it set the flags RTE_PCI_DRV_INTR_RMV in drv_flags to announce the > >>> hotplug ability, and then use rte_dev_event_callback_register to > >>> register the hotplug event callback to eal. When eal detect the > >>> hotplug event, it will call the callback to process it, if the event > >>> is hotplug remove, it will trigger the RTE_ETH_EVENT_INTR_RMV event > >>> into ethdev callback to let app process the hotplug for the ethdev. > >>> > >>> This is an example for other driver, that if any driver support > >>> hotplug feature could be use this way to enable hotplug detect. > >>> > >>> Signed-off-by: Jeff Guo > >>> --- > >>> v2->v1: > >>> refine some doc. > >>> --- > >>> drivers/net/ixgbe/ixgbe_ethdev.c | 46 > >>> +++++++++++++++++++++++++++++++++++++++- > >>> 1 file changed, 45 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > >>> b/drivers/net/ixgbe/ixgbe_ethdev.c > >>> index 87d2ad0..83ce026 100644 > >>> --- a/drivers/net/ixgbe/ixgbe_ethdev.c > >>> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > >>> @@ -1534,6 +1534,47 @@ generate_random_mac_addr(struct > ether_addr > >>> *mac_addr) > >>> memcpy(&mac_addr->addr_bytes[3], &random, 3); } > >>> > >>> +static void > >>> +eth_dev_event_callback(char *device_name, enum > rte_dev_event_type > >>> type, > >>> + __rte_unused void *arg) > >>> +{ > >>> + uint32_t pid; > >>> + > >>> + if (type >=3D RTE_DEV_EVENT_MAX) { > >>> + fprintf(stderr, "%s called upon invalid event %d\n", > >>> + __func__, type); > >>> + fflush(stderr); > >>> + } > >>> + > >>> + switch (type) { > >>> + case RTE_DEV_EVENT_REMOVE: > >>> + PMD_DRV_LOG(INFO, "The device: %s has been > >> removed!\n", > >>> + device_name); > >>> + > >>> + if (!device_name) > >>> + return; > >>> + > >>> + for (pid =3D 0; pid < RTE_MAX_ETHPORTS; pid++) { > >>> + if (rte_eth_devices[pid].device) { > >>> + if (!strcmp(device_name, > >>> + rte_eth_devices[pid].device->name)) { > >>> + _rte_eth_dev_callback_process( > >>> + &rte_eth_devices[pid], > >>> + RTE_ETH_EVENT_INTR_RMV, > >>> NULL); > >>> + continue; > >>> + } > >>> + } > >>> + } > >>> + break; > >>> + case RTE_DEV_EVENT_ADD: > >>> + RTE_LOG(INFO, EAL, "The device: %s has been added!\n", > >>> + device_name); > >>> + break; > >>> + default: > >>> + break; > >>> + } > >>> +} > >> I don't get the point. Looks like this's a very common rte code. Why > >> is it put in ixgbe pmd? > > Jeff needs to detect if the removed device is related to this PMD, than= to > raise RMV events for all this PMD ethdev associated ports. > > He should not raise RMV events for other PMD ports. > > >=20 > It should be like wenzhuo said that i could no strong reason to let commo= n > way in ixgbe pmd. And sure raise RMV events for none related PMD ports i= s > not my hope. > Will plan to let it go into the eth dev layer to process it. >=20 How can you run ethdev function from EAL context? How can the ethdev layer know which ports are related to the EAL device rem= oval? How can ethdev layer know if the port supports removal?