From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50087.outbound.protection.outlook.com [40.107.5.87]) by dpdk.org (Postfix) with ESMTP id 5A92C3572 for ; Mon, 18 Mar 2019 17:05: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=So/VYIZNXq0oC4A8chMbCsrakSaGti2yvMJQxKDWy78=; b=rQOE3LrCuF4ZSM/ouji33oIzyPU/0IfUnf+/WBAMV8l5yccNXBV+OkTCXDzU+V7wLuxMIOxiXRO1m8u1bs+QROCTKcaozeZRQhYl5cq1ABN3UrZHiuoqx5FkUwcefdDQUWd82/ZY1B8lEt95BNb5MGgGR1JqSvUx2H0ZwNvjpdQ= Received: from AM6PR05MB5926.eurprd05.prod.outlook.com (20.179.2.27) by AM6PR05MB5798.eurprd05.prod.outlook.com (20.178.94.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Mon, 18 Mar 2019 16:05:28 +0000 Received: from AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::ddb7:2093:62c0:59fb]) by AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::ddb7:2093:62c0:59fb%2]) with mapi id 15.20.1709.015; Mon, 18 Mar 2019 16:05:28 +0000 From: Raslan Darawsheh To: "gaetan.rivet@6wind.com" CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "stephen@networkplumber.org" Thread-Topic: [PATCH v3 4/4] net/failsafe: support secondary process Thread-Index: AQHU3aRniD5D+j9qxk2cwrqJBS+Xjg== Date: Mon, 18 Mar 2019 16:05:27 +0000 Message-ID: <1552925103-2821-5-git-send-email-rasland@mellanox.com> References: <1551779507-10857-1-git-send-email-rasland@mellanox.com> <1552925103-2821-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1552925103-2821-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: LNXP123CA0003.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::15) 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: 02b95439-d086-4a22-af3c-08d6abbb89b0 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:AM6PR05MB5798; x-ms-traffictypediagnostic: AM6PR05MB5798: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 098076C36C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(68736007)(6486002)(36756003)(316002)(8936002)(50226002)(5640700003)(53936002)(6916009)(6436002)(71200400001)(97736004)(71190400001)(6512007)(256004)(3846002)(14444005)(6116002)(86362001)(66066001)(2906002)(76176011)(52116002)(5660300002)(5024004)(54906003)(2616005)(386003)(102836004)(81156014)(81166006)(478600001)(26005)(186003)(6506007)(8676002)(305945005)(14454004)(106356001)(4326008)(105586002)(2501003)(11346002)(446003)(2351001)(476003)(7736002)(99286004)(25786009)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5798; 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: +AYaKScaRrl7qOnswxmqaLpfvjyWHFIZ5nW+HHh0EwCAdDYvrJvXvxbsjr/fVuBOUkZPhYek5jqZ0d/91XBaPlqV1rR+o4wcFXSJWz9LmiPrzVtv+40BcoOeJdptmGu/+w4aH7tAvY8W6xrPlh81UAnOBeRb96M1YHQ0WBAKQHML/gJcyVnhytWyvvMALmRoktJy/BERIO8CXuDoMsPLFHLdxLF5EFnWJMTBHSPr2PicVFbq+tAoGbptjuWaeYt04mPqei75G8V3atFD0xtuGVw7YXM0fdU5fEkj0RiktLbvjBSE8UuKMWL1OzyDVpUUck4r+Ftgmft7Upmig+3vyM2i7Re3F8UN8jxewtsBPZ7lbPpUojaEP6OfV9yJa3MePQaYKGh58HXQlMz8yidZSiMCM2dE3bFMC4xAgZAc9Ro= 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: 02b95439-d086-4a22-af3c-08d6abbb89b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2019 16:05:27.9537 (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: AM6PR05MB5798 Subject: [dpdk-dev] [PATCH v3 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: Mon, 18 Mar 2019 16:05:29 -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 e53a89d..42dfaca 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 @@ -318,11 +320,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", @@ -335,9 +354,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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5B786A05FE for ; Mon, 18 Mar 2019 17:06:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EE9194F90; Mon, 18 Mar 2019 17:05:39 +0100 (CET) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50087.outbound.protection.outlook.com [40.107.5.87]) by dpdk.org (Postfix) with ESMTP id 5A92C3572 for ; Mon, 18 Mar 2019 17:05: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=So/VYIZNXq0oC4A8chMbCsrakSaGti2yvMJQxKDWy78=; b=rQOE3LrCuF4ZSM/ouji33oIzyPU/0IfUnf+/WBAMV8l5yccNXBV+OkTCXDzU+V7wLuxMIOxiXRO1m8u1bs+QROCTKcaozeZRQhYl5cq1ABN3UrZHiuoqx5FkUwcefdDQUWd82/ZY1B8lEt95BNb5MGgGR1JqSvUx2H0ZwNvjpdQ= Received: from AM6PR05MB5926.eurprd05.prod.outlook.com (20.179.2.27) by AM6PR05MB5798.eurprd05.prod.outlook.com (20.178.94.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Mon, 18 Mar 2019 16:05:28 +0000 Received: from AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::ddb7:2093:62c0:59fb]) by AM6PR05MB5926.eurprd05.prod.outlook.com ([fe80::ddb7:2093:62c0:59fb%2]) with mapi id 15.20.1709.015; Mon, 18 Mar 2019 16:05:28 +0000 From: Raslan Darawsheh To: "gaetan.rivet@6wind.com" CC: "dev@dpdk.org" , Thomas Monjalon , Raslan Darawsheh , "stephen@networkplumber.org" Thread-Topic: [PATCH v3 4/4] net/failsafe: support secondary process Thread-Index: AQHU3aRniD5D+j9qxk2cwrqJBS+Xjg== Date: Mon, 18 Mar 2019 16:05:27 +0000 Message-ID: <1552925103-2821-5-git-send-email-rasland@mellanox.com> References: <1551779507-10857-1-git-send-email-rasland@mellanox.com> <1552925103-2821-1-git-send-email-rasland@mellanox.com> In-Reply-To: <1552925103-2821-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: LNXP123CA0003.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:d2::15) 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: 02b95439-d086-4a22-af3c-08d6abbb89b0 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:AM6PR05MB5798; x-ms-traffictypediagnostic: AM6PR05MB5798: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-forefront-prvs: 098076C36C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(136003)(346002)(366004)(396003)(189003)(199004)(68736007)(6486002)(36756003)(316002)(8936002)(50226002)(5640700003)(53936002)(6916009)(6436002)(71200400001)(97736004)(71190400001)(6512007)(256004)(3846002)(14444005)(6116002)(86362001)(66066001)(2906002)(76176011)(52116002)(5660300002)(5024004)(54906003)(2616005)(386003)(102836004)(81156014)(81166006)(478600001)(26005)(186003)(6506007)(8676002)(305945005)(14454004)(106356001)(4326008)(105586002)(2501003)(11346002)(446003)(2351001)(476003)(7736002)(99286004)(25786009)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5798; 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: +AYaKScaRrl7qOnswxmqaLpfvjyWHFIZ5nW+HHh0EwCAdDYvrJvXvxbsjr/fVuBOUkZPhYek5jqZ0d/91XBaPlqV1rR+o4wcFXSJWz9LmiPrzVtv+40BcoOeJdptmGu/+w4aH7tAvY8W6xrPlh81UAnOBeRb96M1YHQ0WBAKQHML/gJcyVnhytWyvvMALmRoktJy/BERIO8CXuDoMsPLFHLdxLF5EFnWJMTBHSPr2PicVFbq+tAoGbptjuWaeYt04mPqei75G8V3atFD0xtuGVw7YXM0fdU5fEkj0RiktLbvjBSE8UuKMWL1OzyDVpUUck4r+Ftgmft7Upmig+3vyM2i7Re3F8UN8jxewtsBPZ7lbPpUojaEP6OfV9yJa3MePQaYKGh58HXQlMz8yidZSiMCM2dE3bFMC4xAgZAc9Ro= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02b95439-d086-4a22-af3c-08d6abbb89b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2019 16:05:27.9537 (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: AM6PR05MB5798 Subject: [dpdk-dev] [PATCH v3 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190318160527.mhr40Gwn-o_cbxXtGdArn1pYPJmXGQTPvEnX1VcLqrM@z> 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 e53a89d..42dfaca 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 @@ -318,11 +320,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", @@ -335,9 +354,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