From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10084.outbound.protection.outlook.com [40.107.1.84]) by dpdk.org (Postfix) with ESMTP id E8CA52BA7 for ; Tue, 5 Mar 2019 10:52:07 +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=xEcXBW+IUCvFAnXlPiNo2IFbxSgwUgO7h7T15qw9glY=; b=iJlsNvuDK/4vGBZRyOW5wZp9ajRg5AyxO2BfUTbByFF9dVzM4lfAYQygQ7dV2s+70a0maN+547UoGy290/OazBt7j4Yb5oa9nWB9fqPBhjOc9+N1MJOiCLPVHyR30ajeRZ0z73Op0cR2cHBrw6Lu4H32inMXTxQHB6TEJdejUuQ= Received: from AM6PR05MB5926.eurprd05.prod.outlook.com (20.179.2.27) by AM6PR05MB4487.eurprd05.prod.outlook.com (52.135.162.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.18; Tue, 5 Mar 2019 09:52:06 +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.1665.020; Tue, 5 Mar 2019 09:52:06 +0000 From: Raslan Darawsheh To: "gaetan.rivet@6wind.com" CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "stephen@networkplumber.org" Thread-Topic: [PATCH v2 4/4] net/failsafe: support secondary process Thread-Index: AQHU0zkXhY0FlFYgQkqdSZXMlvag9Q== Date: Tue, 5 Mar 2019 09:52:06 +0000 Message-ID: <1551779507-10857-4-git-send-email-rasland@mellanox.com> References: <1551779507-10857-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1551779507-10857-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: LO2P265CA0426.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a0::30) 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: 91dcda68-7137-453d-b96c-08d6a1503a3f 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:AM6PR05MB4487; x-ms-traffictypediagnostic: AM6PR05MB4487: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; AM6PR05MB4487; 23:yCE4LX4IJH4HIgakpRejP94afqUXcNfWPakUEHU?= =?iso-8859-1?Q?fWrsuRGW9Ycm4J4NfOf45SkPvMFqv1bHfyaXtWwf7UIDnMGHmZkiHvb3nq?= =?iso-8859-1?Q?0cvkcHHOiieWuAmxmQEs7OwiYXtv8Z0+hfXogWtlmqrYLgzatb14hMJjXr?= =?iso-8859-1?Q?YFl1Q2bXYsj/liLkFee4bcx2fo9YDo+ths9R4qAGj4y8QAM+LUZtKAednS?= =?iso-8859-1?Q?8bFTO5Rhs37M0M0tk+C1QtW/QaYzFQ6xLFpEUbrsFD+uAJAFISVYUohj0w?= =?iso-8859-1?Q?DIATXPNQ9ovDuTaAGW3hZA7C4ZQ49lu9vwk8hvI+jQQawgOMukgH1Niwpp?= =?iso-8859-1?Q?A0v+nJ9+Pp25cG4VXG2i4AzUOBfrl2THjKIS5Ka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ZXqQMH9KJFSqO7mA4j/CF4bnKYGm49O9Uyj8V+gu+sB7?= =?iso-8859-1?Q?AzJsALqlz4e6SCzgOBQZGrtIsZNaX+aMONWrLu8LXhOVQ=3D=3D?= x-microsoft-antispam-prvs: x-forefront-prvs: 0967749BC1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(376002)(366004)(136003)(346002)(189003)(199004)(25786009)(486006)(8936002)(6916009)(3846002)(53936002)(6512007)(52116002)(102836004)(2351001)(2906002)(5660300002)(446003)(2501003)(66066001)(97736004)(478600001)(11346002)(99286004)(305945005)(106356001)(186003)(6486002)(386003)(26005)(14454004)(50226002)(316002)(4326008)(6506007)(68736007)(71190400001)(54906003)(71200400001)(76176011)(105586002)(476003)(5640700003)(7736002)(256004)(36756003)(14444005)(86362001)(6116002)(8676002)(6436002)(2616005)(5024004)(81166006)(81156014); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB4487; 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: lc1T3tMWXBnzMxtee3JBI8KmM9nxoG+yr9M+1lTNQ+cgKXvvibq2sUIEFXcm7JKLXje3quX0OCN17FUnj2jNCxmMmU/sRb7HotKSfYWcti3HBlsgkBnkbpUxrL539LnuZ5C7K8d1yWWljSegnrNlmKu1YmtLrcGHcXVr4foXrLhVevcxxnaS5S6qnlTFiHN2oriNDEQ3PupWKlo8htKRCXK9+iIgFFaxdXJQpitd2tkWs9RuT+vWO1c5LGZ51uwinxIHxdnnFJzEGEIXuGe8XR5TimnmI9fA7cOoM/1Wm+3tcnTs/qisAZG4xPO/n2zc8kZfxkfw+zcygTXq3JbFCfnJatRvlX1qa39v+I02hwvyJNUBoi9lDQicgMzGf6G7DcdTROWtOiTmxyEW7lMpUER5ncUXwpTUwmR1wALT/vY= 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: 91dcda68-7137-453d-b96c-08d6a1503a3f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2019 09:52:06.8966 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB4487 Subject: [dpdk-dev] [PATCH v2 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: Tue, 05 Mar 2019 09:52:08 -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 --- v2: changed devargs_alread_listed return value to be bool. --- drivers/net/failsafe/failsafe.c | 45 +++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsaf= e.c index 68926ca..c3f568b 100644 --- a/drivers/net/failsafe/failsafe.c +++ b/drivers/net/failsafe/failsafe.c @@ -3,6 +3,8 @@ * Copyright 2017 Mellanox Technologies, Ltd */ =20 +#include + #include #include #include @@ -312,11 +314,28 @@ fs_rte_eth_free(const char *name) return ret; } =20 +static bool +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 true; + } + return false; +} + 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 +348,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