From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00045.outbound.protection.outlook.com [40.107.0.45]) by dpdk.org (Postfix) with ESMTP id EB21C4C9F for ; Thu, 28 Feb 2019 16:49:29 +0100 (CET) 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=6wc7gGwpg4SaGbjlAVw8iInKXvfeBUo/OpdzN5pnqz8=; b=BRJxrwcNJ3Tl2Dw4omaOSi2fius6G5zLF7zrkPF6HO2AevbYnv2bwCHyg2JMfGlvLXaJmnMbxxjYmOvrJuYsvnMedLTQ+XpS8hfKtMSDv13xA5r/FZyQbTn59QR/Jx3juQ4Lh6Oz74nsDJPY2r9riys//xC/6u+Zf9QWlAz/q/k= Received: from AM6PR05MB5926.eurprd05.prod.outlook.com (20.179.2.27) by AM6PR05MB5458.eurprd05.prod.outlook.com (20.177.118.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Thu, 28 Feb 2019 15:49:28 +0000 Received: from AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::4d49:8512:d097:4a52]) by AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::4d49:8512:d097:4a52%4]) with mapi id 15.20.1643.022; Thu, 28 Feb 2019 15:49:28 +0000 From: Raslan Darawsheh To: "gaetan.rivet@6wind.com" CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh Thread-Topic: [PATCH 4/4] net/failsafe: support secondary process Thread-Index: AQHUz30whb8G+kDBQ02sT2CHFEPznw== Date: Thu, 28 Feb 2019 15:49:28 +0000 Message-ID: <1551368952-1871-5-git-send-email-rasland@mellanox.com> References: <1551368952-1871-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1551368952-1871-1-git-send-email-rasland@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: LO2P265CA0431.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a0::35) To AM6PR05MB5926.eurprd05.prod.outlook.com (2603:10a6:20b:a9::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a0445731-cc56-402d-ce82-08d69d945273 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM6PR05MB5458; x-ms-traffictypediagnostic: AM6PR05MB5458: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; AM6PR05MB5458; 23:NRi6+H5lRP7hGU/NpYR6MjVkQ+BEvRIB4BtjYj2?= =?iso-8859-1?Q?8wGFt6JLlmA/QF+ytR0Le+pwcXTU+CXUyO4cjVD002QPQagT9dVHB+GL1c?= =?iso-8859-1?Q?RpBWyM5UV497qHfStp5tT3+Z8Uw503waWFKiid8k4erYXHN1T71+Jx3n07?= =?iso-8859-1?Q?8WIFsfJu8yfOX3wpLSzVOeH1rotwvqEuYsooig+Coizib0SWUprB6l8gLp?= =?iso-8859-1?Q?hdi/9JkzcLleyx31DV8rZfyMW8wswL+sf2XUaTa5yvK98gxU20fJ6Vw7ys?= =?iso-8859-1?Q?8VA96K4NXLleiAjwsI2J5HCaSHJc+IpNbx3oyNepOJx3/GAnO/rd05/M1T?= =?iso-8859-1?Q?05/GVJZADFhToGe5HIRGmsGzsBKL4jIHWq5y/wzuZTIGLzv3K3HHh7I0Ha?= =?iso-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mylwNfRIomL5PjAy51sI+fkQhrj/hhZub90xlPjPLRviPCWy?= =?iso-8859-1?Q?NzXWYxf0EprBMSISaq9Vf1ZdgaiHurS+xKUoL/vc4hkr6IQV761Y4xCndi?= =?iso-8859-1?Q?CDBahdOE=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0962D394D2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(136003)(39860400002)(366004)(376002)(189003)(199004)(6116002)(3846002)(71200400001)(71190400001)(54906003)(25786009)(476003)(36756003)(478600001)(14454004)(2616005)(5660300002)(7736002)(305945005)(486006)(97736004)(6916009)(446003)(11346002)(50226002)(102836004)(8936002)(76176011)(52116002)(107886003)(81166006)(81156014)(8676002)(68736007)(186003)(386003)(2906002)(2501003)(6506007)(316002)(99286004)(53936002)(6436002)(6486002)(5640700003)(106356001)(2351001)(14444005)(256004)(5024004)(66066001)(26005)(4326008)(6512007)(86362001)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5458; H:AM6PR05MB5926.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: RIwPu1rlKaWsLnigHCRP7XXUlKhrpc2OUAMHscUYm9OTCWjBr15BMO42hoeu3TR5inIqDQM+ualhfmMAN6fbZ/P0bgeHmcWYt4KeHBJL7AlYY6cmJqwyBFS7aCwjR2gyFQD0SKfi/TrwxsCnBGlGLVmaj2BaAUKhtRFK52DTXDdAzDehn8+UxVyE7d03qFmpVpt5TIDhQcAyVoa1YBJIFqzoZJOnj63OVRAxLhVsQMCstsnkY2i6sZxQdM/zHFo13v0/R5mjXy6DFMH/DAXt8ROFEII+7XQu2DOfGGff3vCKb2YJqCje1FysbW3NSuT8CbzpXqrh62L4vkf4faLh2Fw31+k8WJ6Ssp7sxPM+o/9uDr8aZ4T+bOvYE1jCIOH1dGw+05v6Lp92cIJlFpeEAPBy2UE/nMSAOwMJWPRmHeM= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0445731-cc56-402d-ce82-08d69d945273 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Feb 2019 15:49:27.9062 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5458 Subject: [dpdk-dev] [PATCH 4/4] net/failsafe: support secondary process 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: Thu, 28 Feb 2019 15:49:30 -0000 Add implementation for probe in secondary. Failsafe will attempt to attach all the sub-devices in secondary process. Signed-off-by: Raslan Darawsheh Signed-off-by: Thomas Monjalon --- drivers/net/failsafe/failsafe.c | 43 +++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsaf= e.c index 68926ca..fa083fa 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -313,10 +313,27 @@ fs_rte_eth_free(const char *name) } =20 static int +devargs_already_listed(struct rte_devargs *devargs) +{ + struct rte_devargs *list_da; + + RTE_EAL_DEVARGS_FOREACH(devargs->bus->name, list_da) { + if (strcmp(list_da->name, devargs->name) =3D=3D 0) + /* devargs already in the list */ + return 1; + } + return 0; +} + +static int rte_pmd_failsafe_probe(struct rte_vdev_device *vdev) { const char *name; struct rte_eth_dev *eth_dev; + struct sub_device *sdev; + struct rte_devargs devargs; + uint8_t i; + int ret; =20 name =3D rte_vdev_device_name(vdev); INFO("Initializing " FAILSAFE_DRIVER_NAME " for %s", @@ -329,9 +346,33 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev) ERROR("Failed to probe %s", name); return -1; } - /* TODO: request info from primary to set up Rx and Tx */ eth_dev->dev_ops =3D &failsafe_ops; eth_dev->device =3D &vdev->device; + eth_dev->rx_pkt_burst =3D (eth_rx_burst_t)&failsafe_rx_burst; + eth_dev->tx_pkt_burst =3D (eth_tx_burst_t)&failsafe_tx_burst; + /* + * Failsafe will attempt to probe all of its sub-devices. + * Any failure in sub-devices is not a fatal error. + * A sub-device can be plugged later. + */ + FOREACH_SUBDEV(sdev, i, eth_dev) { + /* rebuild devargs to be able to get the bus name. */ + ret =3D rte_devargs_parse(&devargs, + sdev->devargs.name); + if (ret !=3D 0) { + ERROR("Failed to parse devargs %s", + devargs.name); + continue; + } + if (!devargs_already_listed(&devargs)) { + ret =3D rte_dev_probe(devargs.name); + if (ret !=3D 0) { + ERROR("Failed to probe devargs %s", + devargs.name); + continue; + } + } + } rte_eth_dev_probing_finish(eth_dev); return 0; } --=20 2.7.4