From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <matan@mellanox.com>
Received: from EUR04-DB3-obe.outbound.protection.outlook.com
 (mail-eopbgr60064.outbound.protection.outlook.com [40.107.6.64])
 by dpdk.org (Postfix) with ESMTP id 14A895F29
 for <dev@dpdk.org>; Mon,  9 Jul 2018 09:51:31 +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=6vKWusMYBLU/hiJmukWsVpHoC9fHFuOxh+XBMHj0pJo=;
 b=YozdUOkucV+p3BN0O/n3CfRKn9fXKHgHQiYqbhHYJdbRoRkp+/irvoDuVttG7FR0YqOMCqLWKAFr3Um6kcae5VjpmLVK+Jqb8mM0NbXqsmzltseg7vo9e+ZI1jSJ2MST8QIMQNtlWIJq2denHXujkOg50z+6WWwrujetSA7Hdgw=
Received: from VI1PR0501MB2608.eurprd05.prod.outlook.com (10.168.137.20) by
 VI1PR0501MB2096.eurprd05.prod.outlook.com (10.167.196.12) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.930.20; Mon, 9 Jul 2018 07:51:27 +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
 07:51:27 +0000
From: Matan Azrad <matan@mellanox.com>
To: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "Guo, Jia" <jia.guo@intel.com>,
 "stephen@networkplumber.org" <stephen@networkplumber.org>, "Richardson,
 Bruce" <bruce.richardson@intel.com>, "Yigit, Ferruh"
 <ferruh.yigit@intel.com>, "Ananyev, Konstantin"
 <konstantin.ananyev@intel.com>, "gaetan.rivet@6wind.com"
 <gaetan.rivet@6wind.com>, "Wu, Jingjing" <jingjing.wu@intel.com>, Thomas
 Monjalon <thomas@monjalon.net>, Mordechay Haimovsky <motih@mellanox.com>,
 "Van Haaren, Harry" <harry.van.haaren@intel.com>, "Zhang, Qi Z"
 <qi.z.zhang@intel.com>, "He, Shaopeng" <shaopeng.he@intel.com>, "Iremonger,
 Bernard" <bernard.iremonger@intel.com>, "arybchenko@solarflare.com"
 <arybchenko@solarflare.com>
CC: "jblunck@infradead.org" <jblunck@infradead.org>, "shreyansh.jain@nxp.com"
 <shreyansh.jain@nxp.com>, "dev@dpdk.org" <dev@dpdk.org>, "Guo, Jia"
 <jia.guo@intel.com>, "Zhang, Helin" <helin.zhang@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: enable hotplug detect in
 ixgbe
Thread-Index: AQHUF1JdauwTfrLdNEKcg7SSu6NeeKSGgOKAgAACu6A=
Date: Mon, 9 Jul 2018 07:51:27 +0000
Message-ID: <VI1PR0501MB2608F836A0DF03EDB3086436D2440@VI1PR0501MB2608.eurprd05.prod.outlook.com>
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: <6A0DE07E22DDAD4C9103DF62FEBC09093B800FC5@shsmsx102.ccr.corp.intel.com>
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; VI1PR0501MB2096;
 7:P1aGP2kkRAAWN/8a+nEzPxUdypqbhYedMytcIOTS3HPyZSTo3sDCJvju+0fDcJEoooyWCEKuqmWGXbxlO8k4f9hmLqt7u7CaV4evkZRf3d2bQn+bfgLkDlLQNk89icADIQWtuF2T3WD7t6f7C8F+lKJc/qOTdSP2Fkyp4qIEYZDWtwNg53+YqhZXw55NbLrQvwUefS3YW2uyBu4uH2Ngn+Q1nXbCmMBTnkPj+Ie4jZ3JAutK7ipw8qcxirewevNB
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 1d97d694-4ae4-45a1-3ca4-08d5e570c6e3
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(48565401081)(2017052603328)(7153060)(7193020);
 SRVR:VI1PR0501MB2096; 
x-ms-traffictypediagnostic: VI1PR0501MB2096:
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <VI1PR0501MB20960A4580AE42C793B4760AD2440@VI1PR0501MB2096.eurprd05.prod.outlook.com>
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)(93006095)(93001095)(10201501046)(3002001)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016);
 SRVR:VI1PR0501MB2096; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2096; 
x-forefront-prvs: 07283408BE
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(39860400002)(366004)(346002)(376002)(136003)(396003)(13464003)(189003)(199004)(33656002)(316002)(54906003)(110136005)(99286004)(106356001)(105586002)(68736007)(93886005)(446003)(2501003)(11346002)(97736004)(476003)(305945005)(74316002)(66066001)(5250100002)(3846002)(6116002)(26005)(7736002)(8936002)(186003)(8676002)(81166006)(81156014)(2906002)(6246003)(102836004)(6506007)(53546011)(76176011)(7696005)(6436002)(55016002)(5660300001)(486006)(9686003)(229853002)(53936002)(4326008)(25786009)(7416002)(2900100001)(478600001)(86362001)(14454004)(14444005)(256004)(921003)(1121003);
 DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2096;
 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: ZwxEuQ7icE+oA+4G5a49wSuIvM4K7FHWT455RYexLswQIggLAiOcjbsrX7dJvF60IwkkuAIwmMIVRcvvgR6U/yJ2UrtSdjl2moDzKL0+fdBhtKBuFOgfLcYXTOG4xQ0FwkTOimhCZ+4qrEtvMhFx05kRoyFCUFC+AH3fyMeWLCcesZVkv6dT+DBlKbukt0mBrnzQexr9jGvkxKD/0VQo0XJwE7akZxQEWGd/z5NQ4tbOcBmECam79KU8f4g1c1xfvBEm1G+5bUCQUSH9WOkiDWg5DuJGfShLdS6mt0Y4jVnzAOPPngpANCeZedkgClK97QYo03y9R2GuT+a5BurFVNQXlchK81uCA8gdPUV27aI=
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: 1d97d694-4ae4-45a1-3ca4-08d5e570c6e3
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2018 07:51:27.7300 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2096
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 <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>
X-List-Received-Date: Mon, 09 Jul 2018 07:51:31 -0000

Hi

From: Lu, Wenzhuo
> Hi Jeff,
>=20
> > -----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
> > <bruce.richardson@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>;
> > Ananyev, Konstantin <konstantin.ananyev@intel.com>;
> > gaetan.rivet@6wind.com; Wu, Jingjing <jingjing.wu@intel.com>;
> > thomas@monjalon.net; motih@mellanox.com; matan@mellanox.com;
> Van
> > Haaren, Harry <harry.van.haaren@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>; He, Shaopeng <shaopeng.he@intel.com>;
> > Iremonger, Bernard <bernard.iremonger@intel.com>;
> > arybchenko@solarflare.com
> > Cc: jblunck@infradead.org; shreyansh.jain@nxp.com; dev@dpdk.org; Guo,
> > Jia <jia.guo@intel.com>; Zhang, Helin <helin.zhang@intel.com>
> > 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 <jia.guo@intel.com>
> > ---
> > 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 i=
t 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.=20
He should not raise RMV events for other PMD  ports.