From patchwork Tue Jan 7 19:14:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219025 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Jbi7Vg9D"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrP4F02z9sPK for ; Wed, 8 Jan 2020 06:14:13 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728733AbgAGTOM (ORCPT ); Tue, 7 Jan 2020 14:14:12 -0500 Received: from mail-vi1eur05on2080.outbound.protection.outlook.com ([40.107.21.80]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728307AbgAGTOM (ORCPT ); Tue, 7 Jan 2020 14:14:12 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l688MNzPTkymXHhNmofuhYi9JU9N4zjHkM7hTI+aqaa6rjOERuDOYfgiYYxFa8DWDC0U6XnDltd2wM3HF5TGsMamN9jg7iTFYMAQ9yYrw9qDgyDhANYOAOVaCiAAnl9IXvO4QGICA0R8V+XibMJdqclNGjr7Gr9qP0ZMqH0wRvHzh/BlYipRxX4RCk0aBTRv9xQu+XY2AY30aEgkqxasdH0asGo4Io9RGyXhZBB6Ai6rIscPK9bF7RKT+ROK4rs2DRSvQQflCRXkXobHL4u3Jl6SKk1XlYksHmVrtMS5W32ftNlkPEmdhhxYJoah7oY1RH+r4CSQ96g0xUhBSxfjmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0dH2yFRgMjQON1KULt7r5zNES7a4+dC7ygnAsgjBIDo=; b=UnyYcxgfLAHKIVdMUsmIv6/xOt5kq9fbdrQ+/KicUgklO/GkHYXeXE/dEg4RmMRLZZQtBhtwWSFi4k+ahLRkA0DPur+auNB5zhJxLPQHXMLUFs90CTgv6SEzrPmP3nJ0AEAqLxwGXexOXe2HiMyR398JBD2s8ZC0lVMbZRkfQzM50vTjhfnIzN2z8KnmiEJBjNSZsCmsAa4tTsnGrG4dViaUf52HwVL2CxYQAo3yLIypAd8jDXnJIX/D6PyWYmtdQI26HqdAfN2eia93Uv8aI/8B1cN5FVbJNjvjrTVE9x3RR2wMzgK7G59brwIPhAJDJjUf0rTxAtFQaOMZum6h0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=0dH2yFRgMjQON1KULt7r5zNES7a4+dC7ygnAsgjBIDo=; b=Jbi7Vg9Dt+YhbyRqQAGpDAePK7cmaA7zigm/ahVLdSVO8NdkheDlx6nRGekwj6sIXcXg1m9ji67TWPPTVUISfocFiSrbx5ljt8Ag09mPE5szSVALkB/elAxcUEVnZr+mBxZRLlWbjuXDBnS05CN56KG43nIxVEM6MYYMiNyWy/4= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:07 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:07 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:05 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Zhu Yanjun , Saeed Mahameed Subject: [net-next 01/13] net/mlx5: limit the function in local scope Thread-Topic: [net-next 01/13] net/mlx5: limit the function in local scope Thread-Index: AQHVxY6h8pBaSetOc0yg3zNmK7hxOg== Date: Tue, 7 Jan 2020 19:14:07 +0000 Message-ID: <20200107191335.12272-2-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9e865a3e-80cf-4f82-6ea4-08d793a5c45b x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7aB59DS05r48LOxEcD0/XrGypbj2icd5Nzqrrylzw+t73DopJQa8zw25Q3dfXYUve5BHBFPFK/HfZjGMv0R6tbHzEdspyhTgqzE6IlvJdYZ1Iph5IIcR02Cr5HGWpY1ohKJgRHpsBuXACxrLTFNtM8TwXr+W/Bzp2Qo5mjJuGGnFwoA4pFb8Cl9z4qL08I0c8GO6WlMniKujIftMYjqX1dYmPraMpM3wLV9lKHFa6Kkrz/ZZcx0lBSRilbCGYS9pEKbXEoZUYYVC7VhT1qX84ihRw7uZcmPh8ApH5TGeOGOcV/jaa/WSVoL3JVB4HrWLRFqEUOSevSFgtA/IHJ5Cj3jvj274iX+6M00CBlnFk0Z4WRwgObdsR73O6vBdnsTh4sT/baiZKjKIWd0yjWfi8GscsaYyWJ3zZkzunYXjC4E7icz6bO1bs6rM0JKcELlNvA3V3OAuDnXwaMoSzYEnIG4VmZzYZDSQQyB/PVosg2HgfpLwu6br6xEWIXdC5BhBLAFUEq3ZR5OYQaDSH9xt7dFpyAu4bRrQxXkAoabUn+M= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e865a3e-80cf-4f82-6ea4-08d793a5c45b X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:07.1746 (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-CrossTenant-userprincipalname: YSquotchNLzDp119oln4oz2T/ilI9iha/H83Rm50bqeyTXlLPAaGnpsmEk1fpIwlBJkzkS2SItmd42hMdbdFRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Zhu Yanjun The function mlx5_buf_alloc_node is only used by the function in the local scope. So it is appropriate to limit this function in the local scope. Signed-off-by: Zhu Yanjun Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/alloc.c | 4 ++-- include/linux/mlx5/driver.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c index 549f962cd86e..42198e64a7f4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/alloc.c @@ -71,8 +71,8 @@ static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev, return cpu_handle; } -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, - struct mlx5_frag_buf *buf, int node) +static int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, + struct mlx5_frag_buf *buf, int node) { dma_addr_t t; diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h index 27200dea0297..59cff380f41a 100644 --- a/include/linux/mlx5/driver.h +++ b/include/linux/mlx5/driver.h @@ -928,8 +928,6 @@ void mlx5_start_health_poll(struct mlx5_core_dev *dev); void mlx5_stop_health_poll(struct mlx5_core_dev *dev, bool disable_health); void mlx5_drain_health_wq(struct mlx5_core_dev *dev); void mlx5_trigger_health_work(struct mlx5_core_dev *dev); -int mlx5_buf_alloc_node(struct mlx5_core_dev *dev, int size, - struct mlx5_frag_buf *buf, int node); int mlx5_buf_alloc(struct mlx5_core_dev *dev, int size, struct mlx5_frag_buf *buf); void mlx5_buf_free(struct mlx5_core_dev *dev, struct mlx5_frag_buf *buf); From patchwork Tue Jan 7 19:14:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219026 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="V18FUQ4Q"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrQ58xpz9s29 for ; Wed, 8 Jan 2020 06:14:14 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728745AbgAGTOO (ORCPT ); Tue, 7 Jan 2020 14:14:14 -0500 Received: from mail-vi1eur05on2080.outbound.protection.outlook.com ([40.107.21.80]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728726AbgAGTON (ORCPT ); Tue, 7 Jan 2020 14:14:13 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQQHw3CQggX7l8QZSxDceGobWD0ma9J3RfuN34QgAo/FNh/KBGQV5GjBC+dREKy2qcT6qxVFKJOwLtLczJbjSM2MINijaEmm2IjjhXj8ud8KYGjJ/CEm35rwwMPlq5a+OZSwjGXhW2opjSDnJdu02ZLRQBbfS8NgeRBUNjQewgUxXI/vlyiSJrWkSDkWfGXkF4fgyKyIYcLwSuigPMa2X+fgpKIMt7AbOBHwsK9seetevhjzGQwGOfVZORlQDr6+iiZ3xAi2Y6fBqT/WVThRk57LKP44zoDT7X5TmcUA0XSWn5YyUgxEW2QYJgPIiLHvyaIpWrffzSMLrVCaPKvL+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TRLMYMthbd9Xqg5YbjZ4d/hqJarR+KTsQZcgbv5a2kE=; b=FZF9+fsCFVW4TZ7p9+lDkBNFZAIUT+IR0HpADZIGPIOPfsQsFyNTrmwiKN8D5w6xZWIk8wdAVgTAGfLb4b8eXLou7ENQrJj+Evogn8wlgcq50BRs7Ap+tW+oU8prlErFVLxbLV36kqzx56MpdnO72BeaDCmNtp3aS76FtWNH846k3mi598P2UGxWejpNAA7NGSjDRFdRqVKOao7fDajQMpN4XNp8I9wkai6ucnItjI/vbB1f94LBDl+wKgWZUUGBxGfH+TLFAEIJMoYhWayo2AfAlNYMT6aMwJ3fmD8sfcMWruYXz9Cc6BNg6bIFe37W6bjKza0L5OEnagIe/mUw0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=TRLMYMthbd9Xqg5YbjZ4d/hqJarR+KTsQZcgbv5a2kE=; b=V18FUQ4QFHH2sxx+lnzZ+4xvFkfzP9K+ENPj5ikM89+BXcUVbv/R1HzABsCUABwk4T5+VHskKLD4YvNoJ1v/9T6fhAXZBRtEnJn8WV+qHdyIaNWSyJMqWMCsyvxNQAZoox4C3iGVaWjCMVG0YsgjLTxZlQYgqZdBR0nBOTo4cAI= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:08 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:08 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:07 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Arnd Bergmann , Adhemerval Zanella , Saeed Mahameed Subject: [net-next 02/13] mlx5: work around high stack usage with gcc Thread-Topic: [net-next 02/13] mlx5: work around high stack usage with gcc Thread-Index: AQHVxY6iNHZ24W5b1kyKQWJG1DozAw== Date: Tue, 7 Jan 2020 19:14:08 +0000 Message-ID: <20200107191335.12272-3-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fdacf673-1009-4fb1-6cb8-08d793a5c56a x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1265; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(966005)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: awJGIG2GSGcaBnstbKY5EZyiY9mk1FQH2r1d71oMZ/LWuTGi+QOJmG1BSf7N3xZOQkAtQyV4LwhfSxuNrYptXCVAwb3FGTYNkTa1KfUF340Gx6kJanqs0dJy8mbOEHtezTk6nlk0vUwrLaSpqBPjuvHiUh+pLXRcU1Ek5RHto6DVlMwzt2ekg9JhKeq6ZxUe9l/LIkXqxiSB3q6RjF1sWuXOB9cF9yhYBhq1a0O70Y0lmHJq7az8BKGpxq3+2qDy13rk5qHGGRy0xzw83mYD2zTihSkcZ9mKYC7Tb8NHFhWy7c8SfvCqQgyEF5d9xDLm5XBANKavwJ2CVR3zhjpZhfA3OZmTBDpf2qhd+KFSHqqgFnQNO3S+Wn7gU4ypo5mBHhJ5E9VdqyYJrf6WKoFsi3KhSP+gAfBfCqwN2ahEEXTzEwZ+gZBmPnOxwdBMQGZ8DQ1n1Hx1oGRezVSVu8PsJ2E7E9kA03XV2STR4SngmH8kGSwqHeRbri/ePDOSvhgVlFW3kdSEu6w9Q3D62yqiy4CK1YAlGuUwBzMo++rHDpeJkyJ3KMLuqhZS6CzyFBXVnq6pG2z0XDagIdAx6P6nRQ== MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdacf673-1009-4fb1-6cb8-08d793a5c56a X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:08.8207 (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-CrossTenant-userprincipalname: 2Mw5u4fVRr9iupaCAiPzPcMi3CZAxlNG/MQZ1J56bKOr8KzS5xWydVy9CiVWI3IOGL9aVTLnv4f+RraeOlGYRQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann In some configurations, gcc tries too hard to optimize this code: drivers/net/ethernet/mellanox/mlx5/core/en_stats.c: In function 'mlx5e_grp_sw_update_stats': drivers/net/ethernet/mellanox/mlx5/core/en_stats.c:302:1: error: the frame size of 1336 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] As was stated in the bug report, the reason is that gcc runs into a corner case in the register allocator that is rather hard to fix in a good way. As there is an easy way to work around it, just add a comment and the barrier that stops gcc from trying to overoptimize the function. Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 Cc: Adhemerval Zanella Signed-off-by: Arnd Bergmann Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_stats.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c index 9f09253f9f46..a05158472ed1 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_stats.c @@ -297,6 +297,9 @@ static void mlx5e_grp_sw_update_stats(struct mlx5e_priv *priv) s->tx_tls_drop_bypass_req += sq_stats->tls_drop_bypass_req; #endif s->tx_cqes += sq_stats->cqes; + + /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92657 */ + barrier(); } } } From patchwork Tue Jan 7 19:14:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219027 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="cpAyFai+"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrS2x8sz9s29 for ; Wed, 8 Jan 2020 06:14:16 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728754AbgAGTOP (ORCPT ); Tue, 7 Jan 2020 14:14:15 -0500 Received: from mail-vi1eur05on2080.outbound.protection.outlook.com ([40.107.21.80]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728735AbgAGTOP (ORCPT ); Tue, 7 Jan 2020 14:14:15 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sw338k4x+wzi6w7brHdmn8Iu/lJfRNJ0aNXv3u1Cz2yx7QZ5bsr2SHX0mlWu8xrejfKf4YCfFNgPW1Nwfl6TmFe+o4JuSBUN9JuLpY3y5jserIA142K/fQoe5vXWnjdgnRxe9sw/2BOO8Wp+0EeEu/HsvYkYT+chVZq7fLj0BSqOQ3hxbCCeof/A/J/PXyMWYXZfBdAygyTY2Q7+lwJ86eUtBi2TeMqpL98tzwDPdYL4lZAvgNRbUqSaHkR+zlzgSholOWEdCpx1BS4IutekFXEp5zQU7rGYM3FutQ5EROb/qcwi58rY9/n+d1pF47SQCgnckOB4UMbH/HhlowLXBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MFkZj5ArCSrjujSXtQdr1pho3D5rKvr2KsP49peHA0I=; b=WdRq1KSUAZFAhRJP92JiQlmEuXhTK49QCiOe+FlOeIpUQdz+BVyx1bdmAoI7EM8VqDNXjp1mx0d7R8nG5Klli0twFpb5F2AyLgEb6lcGodW6vb5ow7q8Z2dmUHJTW+aA+gN9O3fVV9rX55hTJewlzrGdk0e9W9kqxUs6zLhs0OYiRu+F5rpDa7usUQSt4+4X4yLCUTvhymJ9MqUMzcnBXivFfAhbiMTTFlHtqUmW0PzVFBAuW880a0MyFdfFAmZWtA1aY7PmDAt0UZW1jXzjYjTIerMUAUvLCBelo5BkrM28k7hqXi8LXz4VxgXU7qjnEkWM20TCV7MMnTSy7zT4Hg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=MFkZj5ArCSrjujSXtQdr1pho3D5rKvr2KsP49peHA0I=; b=cpAyFai+BKSSEfDWFDILkSYXTqyTgrqg/hRXh7TBp7nv7BryVg2Frh9tOnvt/kqFzM921Z+ojWrnCb1TNhJzCAukD7P8DbyZXyJ6lU3jJH72pEflwTWw8he48osp3XP8/5oj0jtpn0wmPFJoTqpOX+jKldpB07rcJZYraLpXfqg= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:10 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:10 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:09 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Tonghao Zhang , Mark Bloch , Saeed Mahameed Subject: [net-next 03/13] net/mlx5e: Support accept action on nic table Thread-Topic: [net-next 03/13] net/mlx5e: Support accept action on nic table Thread-Index: AQHVxY6kQH3f8VYzwEyO/x68fn6/Mw== Date: Tue, 7 Jan 2020 19:14:10 +0000 Message-ID: <20200107191335.12272-4-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1a247bb6-b0c6-4489-2123-08d793a5c677 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4714; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(6666004)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zOFAv1ja9a/AjYueFXiCqphcxrlyGObZaReZYlGo2funCl+q9rXcn6txc5NAbm47mq/htS/Vsli+/v33JSWvDC57EjQ7z2z7R/Z0ToQRkDUio1k39CIDkzWuA/nPOCBsT2DT39CUDhXUc7TasyWiX+9Gzn++On9zGI3fL08K4ODqC0AXlrGTMYj127Z20PfWmV3rlv9SlD1wYtpMn2U74gufIULslAmcpIhmEyUs0Vbk3OHDP4ahkg7t3b1PMD73QSl0qKh6yJ+zEmICuS7V7aNZ8k7HgSQMLYfZidTEsD6J/n+f51NuiN0fK7QHTr2+Gv0Yu6jbYOdw4SzvXuPQmT1eRk4mNACMvIJcse0Wz6R3oHMN8Z0MvukRTHwvV5wdBnc+hJyuWeUYJ2uqpDoxYTnueFM0dYprTDPVz24uysoPISdKnMXAdLmcJnHCDpSlOnWVJoC/ZSuO8wmajzNT0Nb9ERlXDmE7LIdCl48zT40xvgdSIUtbnDp9bwVrX+7SuuCmFX6N3ai3bgNuMll02c8oVY1vsv8gU9TR6zhmGKw= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1a247bb6-b0c6-4489-2123-08d793a5c677 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:10.6496 (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-CrossTenant-userprincipalname: Ehm/j3InmjT5FcBXwx8GRn9pFrZ8MeG3dFInJ0Z6KEbcDMwVhGRl6hqHt53+aG4X5QBzaMTjj6XhFIim6XNa5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Tonghao Zhang In one case, we may forward packets from one vport to others, but only one packets flow will be accepted, which destination ip was assign to VF. +-----+ +-----+ +-----+ | VFn | | VF1 | | VF0 | accept +--+--+ +--+--+ hairpin +--^--+ | | <--------------- | | | | +--+-----------v-+ +--+-------------+ | eswitch PF1 | | eswitch PF0 | +----------------+ +----------------+ tc filter add dev $PF0 protocol all parent ffff: prio 1 handle 1 \ flower skip_sw action mirred egress redirect dev $VF0_REP tc filter add dev $VF0 protocol ip parent ffff: prio 1 handle 1 \ flower skip_sw dst_ip $VF0_IP action pass tc filter add dev $VF0 protocol all parent ffff: prio 2 handle 2 \ flower skip_sw action mirred egress redirect dev $VF1 Signed-off-by: Tonghao Zhang Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 9b32a9c0f497..e8f2d0e4913d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -2842,6 +2842,10 @@ static int parse_tc_nic_actions(struct mlx5e_priv *priv, flow_action_for_each(i, act, flow_action) { switch (act->id) { + case FLOW_ACTION_ACCEPT: + action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | + MLX5_FLOW_CONTEXT_ACTION_COUNT; + break; case FLOW_ACTION_DROP: action |= MLX5_FLOW_CONTEXT_ACTION_DROP; if (MLX5_CAP_FLOWTABLE(priv->mdev, From patchwork Tue Jan 7 19:14:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219028 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="drg+P4j1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrV0cpmz9s29 for ; Wed, 8 Jan 2020 06:14:18 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728760AbgAGTOR (ORCPT ); Tue, 7 Jan 2020 14:14:17 -0500 Received: from mail-vi1eur05on2080.outbound.protection.outlook.com ([40.107.21.80]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728747AbgAGTOQ (ORCPT ); Tue, 7 Jan 2020 14:14:16 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eZ2J4DhFHd0ZqDNw7BdwZGXSh53iPWlV3B/CblonFu2nhz0zptdYk9wfwaM6c7WBWU+2dUR8QeCo+F88XAlb8kMowDkpHZWMgPxKR/ZZ/C26dQWFgsFIm0d3+iE0KVZWWqEt08QdycfIT10LluBDrhLoQh/QtjOfS8ySUdJsHcsCY2GzxGdBXRrvyOututn/zbICD5ych2X7dadjXmMCqFmVk9/j2iuluymA4jUhlUCm++6w6KhVvRwA1NOYtOJrRBWB4oF2VR7h+YmjSOM9f/G3zYIKTsBVaT1U4HyOOSoMlJpXbCPcaRN1uSmT6XEwqE52NZMPci1GT/AdA++e2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i6RBhsOO+92UsiW7UjKt7igQ/KmD5LArQwcE7CjjF6M=; b=J6BvldoSZmIFEfispax1qOFpOHH9Ty5C7WFAJpjYC+ARDgqWD1tX44ryEu6ZRIk5TiH01rKuaB0PogtL/UOw1yz4aX4syk2izS9qyuEKApMplPcx3U2iFnqZWVPbx4O2bvNDd8kMqhqfPg4yy9qlTdLLufHmuWOOsMLorHytJrHIfpBqGu81+Pob320FDK33FC+JpNOgM+Gekfrt9dMXJjVTHAgNdojQ7lki5gbaZPuoik6KjTWS+gGpkBTNrUON3gmaVhYtf8og+4fw+mB/UKIqcZyUnR/3mo5jChInuikGHUySQ0TTT4SE32E0bvVUMF428jmjwiGPvtwQijU//Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=i6RBhsOO+92UsiW7UjKt7igQ/KmD5LArQwcE7CjjF6M=; b=drg+P4j1a8V7ET60q/zDfK7gexmVsk4UuuBbVLjvZvzdmzyHnO52WM6tfc/Mc0k2Pm9FC9Wp7XF3ISkQt6FKBDGcsvWJ+7e4he3GlOV/jhiENDTMjEnz1I//gLfEpggrkfnKmMqhGTyyq9g1CtbWh1vmM3OH7vPU1ArpUaqpVgM= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:12 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:12 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:11 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Fan Li , Tariq Toukan , Saeed Mahameed Subject: [net-next 04/13] net/mlx5: Increase the max number of channels to 128 Thread-Topic: [net-next 04/13] net/mlx5: Increase the max number of channels to 128 Thread-Index: AQHVxY6lXM8blMx3EUWLOQITbzeyow== Date: Tue, 7 Jan 2020 19:14:12 +0000 Message-ID: <20200107191335.12272-5-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b823c5ca-1e79-4b0b-4449-08d793a5c7a1 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1284; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0MWmH4QVsJvE68Ja2GMW4FqhIYUqBckykW0O6wRFK5Vq9VW5e2yYqwinj8JVa65w/XmsjCdDAqPbFg3vJlY4f0vsru+sgyUowCgMCpYdUzwbbufbqKfY37iAX5YgaUlz9xNhx7PXEkgN09YbV19+SIxbDZg9rcs+fKehlanCQxrjMl4hMF5YFbdNETP1BgxyvaktQqz70Bl405utsowjlEE5OvOWazVjoGBNm4eIDREJMh7BBVYXmA3ZbLMP+1OBhGooEqMx0btM6A4zuxXKgS4rlUoAu58T3ywxWI6kXuPdNPy5ZZ89nA+kjlomIFX29+T8O2Vm9klx+x62eKLesGyTkY/3SZnIhgJSxeSdy+2Bcpzk3rnXHuJr559u/D+t8NILtbH/qWbbEKtQZeLY9uHuS3h2k367OT+FbWodXljpgHbBCtwpj2HocRUEaFQ21Cf7wESUaiQhpx38kkX1gsMwCkuWwPcfKBLCn5SPu4pp7JzGRJrTF2rOis8c+j3vlMVAVJoI5yk6oEX2ON4am9elbTCE7KF/B/ibLDG/c6M= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b823c5ca-1e79-4b0b-4449-08d793a5c7a1 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:12.5785 (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-CrossTenant-userprincipalname: mO9UZq1fiAwsKfVomE6TBUUFE0IQl8HUuo3kOp9pNlWTLDsDnj58Q1ZFaHq8z0l9yicmLshhX2gHYAb51DwRGg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Fan Li Currently the max number of channels is limited to 64, which is half of the indirection table size to allow some flexibility. But on servers with more than 64 cores, users may want to utilize more queues. This patch increases the advertised max number of channels to 128 by changing the ratio between channels and indirection table slots to 1:1. At the same time, the driver still enable no more than 64 channels at loading. Users can change it by ethtool afterwards. Signed-off-by: Fan Li Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 6 +++--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 +++++++----- .../net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h index 9c8427698238..fc80b59db9a8 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -135,7 +135,7 @@ struct page_pool; #define MLX5E_LOG_INDIR_RQT_SIZE 0x7 #define MLX5E_INDIR_RQT_SIZE BIT(MLX5E_LOG_INDIR_RQT_SIZE) #define MLX5E_MIN_NUM_CHANNELS 0x1 -#define MLX5E_MAX_NUM_CHANNELS (MLX5E_INDIR_RQT_SIZE >> 1) +#define MLX5E_MAX_NUM_CHANNELS MLX5E_INDIR_RQT_SIZE #define MLX5E_MAX_NUM_SQS (MLX5E_MAX_NUM_CHANNELS * MLX5E_MAX_NUM_TC) #define MLX5E_TX_CQ_POLL_BUDGET 128 #define MLX5E_TX_XSK_POLL_BUDGET 64 @@ -1175,11 +1175,11 @@ int mlx5e_attach_netdev(struct mlx5e_priv *priv); void mlx5e_detach_netdev(struct mlx5e_priv *priv); void mlx5e_destroy_netdev(struct mlx5e_priv *priv); void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv); -void mlx5e_build_nic_params(struct mlx5_core_dev *mdev, +void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, struct mlx5e_rss_params *rss_params, struct mlx5e_params *params, - u16 max_channels, u16 mtu); + u16 mtu); void mlx5e_build_rq_params(struct mlx5_core_dev *mdev, struct mlx5e_params *params); void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 319b39f25592..78737fd42616 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4739,17 +4739,19 @@ void mlx5e_build_rss_params(struct mlx5e_rss_params *rss_params, tirc_default_config[tt].rx_hash_fields; } -void mlx5e_build_nic_params(struct mlx5_core_dev *mdev, +void mlx5e_build_nic_params(struct mlx5e_priv *priv, struct mlx5e_xsk *xsk, struct mlx5e_rss_params *rss_params, struct mlx5e_params *params, - u16 max_channels, u16 mtu) + u16 mtu) { + struct mlx5_core_dev *mdev = priv->mdev; u8 rx_cq_period_mode; params->sw_mtu = mtu; params->hard_mtu = MLX5E_ETH_HARD_MTU; - params->num_channels = max_channels; + params->num_channels = min_t(unsigned int, MLX5E_MAX_NUM_CHANNELS / 2, + priv->max_nch); params->num_tc = 1; /* SQ */ @@ -4986,8 +4988,8 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, if (err) return err; - mlx5e_build_nic_params(mdev, &priv->xsk, rss, &priv->channels.params, - priv->max_nch, netdev->mtu); + mlx5e_build_nic_params(priv, &priv->xsk, rss, &priv->channels.params, + netdev->mtu); mlx5e_timestamp_init(priv); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c index 3ed8ab2d703d..7c87f523e370 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c @@ -87,8 +87,8 @@ int mlx5i_init(struct mlx5_core_dev *mdev, mlx5e_set_netdev_mtu_boundaries(priv); netdev->mtu = netdev->max_mtu; - mlx5e_build_nic_params(mdev, NULL, &priv->rss_params, &priv->channels.params, - priv->max_nch, netdev->mtu); + mlx5e_build_nic_params(priv, NULL, &priv->rss_params, &priv->channels.params, + netdev->mtu); mlx5i_build_nic_params(mdev, &priv->channels.params); mlx5e_timestamp_init(priv); From patchwork Tue Jan 7 19:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219030 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="iCaziPab"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrW6SP9z9s29 for ; Wed, 8 Jan 2020 06:14:19 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728764AbgAGTOT (ORCPT ); Tue, 7 Jan 2020 14:14:19 -0500 Received: from mail-vi1eur05on2080.outbound.protection.outlook.com ([40.107.21.80]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728726AbgAGTOS (ORCPT ); Tue, 7 Jan 2020 14:14:18 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e+NTb8fHuKOfHme2ZDQkQfGY1HrXyE456eJYa+ANKtIYfvpiO+EaUrOq0AdnIAbkq2Odg/IndXwGyg0fXH4QbRF+YjBrevtrBPnMrQCqFjaaC4vQ9WQ+ygWWqrfyn7Ql9Td6gqLCf10MU3pEx+ZbnvCNApZcJRjhOorCD0E3y+HTHVSJBk0DGuxdj842b4HX20HevDgH3KR2XGc80ev12IlyCgYxlpdXG+wobKuUPj6J8Aprzx5ESuPGb9L9R2SQqdokF0La1zAMg5a/FXC0DDUpIMntj4Vy04QPH4erClULHSa1cggyAhcaTRyV4X99+1zlvx4A5oJuAW5y+/RbGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jGr1WABUaqnwLcXG6JEeG9WLjpdy453PHj44QAcXahw=; b=fGS6OgmLv5ZD2k8rQmudumNljRve1OHIKeVMYKJQOsEFyyE49bdN+d0tDOfzF2vXCRmnUXG+l9CGgACtCaDKeYIUc03jurg31hgVqcA/O5keagYIihfcTby/JuOUkltrImPmKRc2QDSeH89w7c0btpnGQ0uEf9k4T3t9NrS06Oj+sB+0rfyuwLGqabbXCfB/BqeMt0lyBa0jjGHwad2HoaKZydMiGBwrPg5yYx57ptaNPKh8btklaZvTuyZd23FkrMzuqchxj4yYjaS+Przu0ffQ41H3aV4LJQBfFvN3osfVjmRiWK/ncRRd7F44+DCr3BHT/78FjXfZkRZz73p+mQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=jGr1WABUaqnwLcXG6JEeG9WLjpdy453PHj44QAcXahw=; b=iCaziPabWMPiqhZPubW6NAadumIzI0UnKJJ/K1INFJTbz6kZAUuLQ7s3HB9DjlNJv6IDodNnXr5V4R3p6p4/MKpdOrnXk0ScXBV3WoewZlL51T+QaMzW/yvVVyX+J85oqIoOLJ7UXzhRN5Zhtr+QTYDqMEkJ3l/KbJZIoi1R61s= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:14 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:14 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:12 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Parav Pandit , Saeed Mahameed Subject: [net-next 05/13] net/mlx5: Reduce No CQ found log level from warn to debug Thread-Topic: [net-next 05/13] net/mlx5: Reduce No CQ found log level from warn to debug Thread-Index: AQHVxY6mayJ0UZHDhUOMrBjdodw2OA== Date: Tue, 7 Jan 2020 19:14:13 +0000 Message-ID: <20200107191335.12272-6-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b36bb6b5-a642-4c3c-b779-08d793a5c873 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QVoC3fJB3+ppkMyW8BUdimshYXbzQBdrMiWt5t+Qa0x3r9SG2YfArH/o2qCNpNmShqV0is13SIDFk4KDHM6IwmOzsfMz1ixyQ37n4p7srLptDrWir4y/jQLOd+R03bzlk/towR4Fji9/cfRVLE42MQWMqeZ7bAqTIgmrglo8DSCM1A+pRj/emHEgUMPiGCrxGXm7LfrcNadV0rg+rYHvonKIkX8oNfRjGLItjTPF1YPg1tvSIv4yPSEuUGh3HVh5gruhYqyDzb3EdMQ2QmcTYEktLAD3/UAd+5lVgIuLDAa6IhCDO9LGhjmd5sfXXgescrzePn5lURsOTXY53T71E+Z9N1TyZiW3MOXypCUc2P4kGQ4NStk2uPGATG9V75GmRazaLozdcdcYZf36//5AsUo8X8ROlUilwJhr470WWxzowj3AoWdr6pANFuy7MYzUdQJ6waB3Gro/OOkY/p9KPtlKzPtNrcfl3s6K3/Dd3zQZJBR58Uas/CLU9icUkcQXFev4LRdPtqUI5TTFMYFuqSF/Svfm2bKat/3yRXCZNXo= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b36bb6b5-a642-4c3c-b779-08d793a5c873 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:13.9427 (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-CrossTenant-userprincipalname: /nMHC1Ao9KPt8iX5ca0yAVR9jB80hQ9gKE1TaSqtjDxxbJB2bTImXNdmXtyF2ZVo+jd6lFBfiAVkf4cxDQvEIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit In below sequence, a EQE entry arrives for a CQ which is on the path of being destroyed. cpu-0 cpu-1 ------ ----- mlx5_core_destroy_cq() mlx5_eq_comp_int() mlx5_eq_del_cq() [..] radix_tree_delete() [..] [..] mlx5_eq_cq_get() /* Didn't find CQ is * a valid case. */ /* destroy CQ in hw */ mlx5_cmd_exec() This is still a valid scenario and correct delete CQ sequence, as mirror of the CQ create sequence. Hence, suppress the non harmful debug message from warn to debug level. Keep the debug log message rate limited because user application can trigger it repeatedly. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 580c71cb9dfa..2c716abc0f27 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -156,7 +156,8 @@ static int mlx5_eq_comp_int(struct notifier_block *nb, cq->comp(cq, eqe); mlx5_cq_put(cq); } else { - mlx5_core_warn(eq->dev, "Completion event for bogus CQ 0x%x\n", cqn); + dev_dbg_ratelimited(eq->dev->device, + "Completion event for bogus CQ 0x%x\n", cqn); } ++eq->cons_index; From patchwork Tue Jan 7 19:14:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219031 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="l7J3l5qX"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrd1RFqz9s29 for ; Wed, 8 Jan 2020 06:14:25 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728769AbgAGTOY (ORCPT ); Tue, 7 Jan 2020 14:14:24 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728726AbgAGTOX (ORCPT ); Tue, 7 Jan 2020 14:14:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZW8t8A4rbjg+Aum/dq5okHXzCXqQ/YQmdqr1pBRWd58+1ul894jyZSUzRIzlsOQ6T5IVwpQnDfliIOgbiKWym3x58Pp21EkFVlhxEa6y9Cr9clhcOz6h6oQkLrc6Vqw7e9Zx04B5Z9v4XptygOvcc2KchHbwBFWDQGjbACd+W4gYF/w6cpsR3+mKBDg7z7u2Cdg1Up7kyHMFaR+qKpAIr4lscdVuK9vaAgqB2UcPG6DweXnTjkbnU2gV7iqvbAsqeZnKn5KzRTJ/c7vJmXExxJKlIbzbk/MpyHawTQc9uAfUm5dmuBAjH1ltb6OYeO49J2KatKbegmMVb8xKDtEqmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U0vj5IS+yPzmFZhUWTtQCazBWCNRBx+qiRdo66VYcMQ=; b=Z7CKO1wrdIodOifS98HkRbvaa/3URfsPcuJpBeonKfjJtRHiBqWhsv+7bH1iCKTe50+SZmt8nvUhopmi0p0SQgXGOL9RqlsoYDWImcm16Crzf/1/0PHIzG+4ZCzuRFpbmHW5784lrrMZOevTef+U40e4Hi1d6aOmKfVUwpqXlhN0P5Hv2KmDAppLgettCHdQkb3hC2brLw2pnFgexdKx8rkM6RPudTGXHPxLD3Lf46ecIYEBu4fmDR5D+DcYfB2hPsL3oIzR5mV6jSbs2QwMs9+Jlt3FeBmx/8L7m3QvVgxAHhR1ovUei7eGHvUBkvufl8dtHe0OnEG7/au8degP1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=U0vj5IS+yPzmFZhUWTtQCazBWCNRBx+qiRdo66VYcMQ=; b=l7J3l5qXtnAoqF6OOMCxIvMfoPN+m/hkIsnVMxlMrRK0aNCuiaWrmXPxBOzdsC+Tr9+74S7WJvrfI5EEo5awuMu8pC6c896go91BWMk7O8QsZV5oBqQZI7Y4xQnd6E/7mYmiKctuPdOld0irKA37i/nU5MgfKE+HNTulBnaGmuw= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:15 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:15 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:14 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Parav Pandit , Saeed Mahameed Subject: [net-next 06/13] net/mlx5: Use async EQ setup cleanup helpers for multiple EQs Thread-Topic: [net-next 06/13] net/mlx5: Use async EQ setup cleanup helpers for multiple EQs Thread-Index: AQHVxY6muTL8UF7jEEum8ietOBBP1Q== Date: Tue, 7 Jan 2020 19:14:15 +0000 Message-ID: <20200107191335.12272-7-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: e639808d-7927-490e-6aa2-08d793a5c955 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:133; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Vsdbmht7LUEjy6g2rsxaNBDCPIQ5+4ThitOL365/REEszEmdH2AA/NMdj9IAls15TWqESCpHo1B+WOrcdCq56h2IWQ9NHfyHFy5Cle4JFxlJJ+nTjDMDBgCkzPVKpiSxmZGxVqJWs5I88BxoJJV/YRZkSZ0GPUPYc8OXUsRN9FMXbGRftH3qsmb2RcLugviET3kKXktWZW4PamsuGkMEYOjZ1swWErBxPn7aYDuMjABqk7cYrYsEVefKZSNDfTOwovvRZKwM0S0BI+2Wsfr7N4JxVZuqKqpswJGGaj67Kec7ZcBw1E3RZkiqJr17F1bFWBAOqqcQ8SpUFkrkiGLxkreynQ8iLu1sEhrmQ+w86PwslZz+VOD+EX7z9sgXCrH7SpMz5kKYfhUrCsRZi+YyNLqrUezzU+JnX4oWzePo3DmEXxplMgBq/ZZ1Z41iN2D9cIFme+/mqjPJ2IswQ4OhkZjsBnhy6IdEe2M7swd1emgSpsxydQ8QPEFDf1OT2+qIOLdrWrd7eQplhWb3hRze7tQ7ffp58YIP0sDs3vO32KE= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: e639808d-7927-490e-6aa2-08d793a5c955 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:15.4218 (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-CrossTenant-userprincipalname: NldXV/HxTsLGS/vl2Wxx/Wxkita41eWQlexJEGXdTGJ6gJAwBw99DGQLPW1WFJSM7wcFQWJwLdxP5qhkzqAjSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Parav Pandit Use helper routines to setup and teardown multiple EQs and reuse the code in setup, cleanup and error unwinding flows. Signed-off-by: Parav Pandit Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 114 ++++++++----------- 1 file changed, 49 insertions(+), 65 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 2c716abc0f27..cccea3a8eddd 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -564,6 +564,39 @@ static void gather_async_events_mask(struct mlx5_core_dev *dev, u64 mask[4]) gather_user_async_events(dev, mask); } +static int +setup_async_eq(struct mlx5_core_dev *dev, struct mlx5_eq_async *eq, + struct mlx5_eq_param *param, const char *name) +{ + int err; + + eq->irq_nb.notifier_call = mlx5_eq_async_int; + + err = create_async_eq(dev, &eq->core, param); + if (err) { + mlx5_core_warn(dev, "failed to create %s EQ %d\n", name, err); + return err; + } + err = mlx5_eq_enable(dev, &eq->core, &eq->irq_nb); + if (err) { + mlx5_core_warn(dev, "failed to enable %s EQ %d\n", name, err); + destroy_async_eq(dev, &eq->core); + } + return err; +} + +static void cleanup_async_eq(struct mlx5_core_dev *dev, + struct mlx5_eq_async *eq, const char *name) +{ + int err; + + mlx5_eq_disable(dev, &eq->core, &eq->irq_nb); + err = destroy_async_eq(dev, &eq->core); + if (err) + mlx5_core_err(dev, "failed to destroy %s eq, err(%d)\n", + name, err); +} + static int create_async_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = dev->priv.eq_table; @@ -573,77 +606,45 @@ static int create_async_eqs(struct mlx5_core_dev *dev) MLX5_NB_INIT(&table->cq_err_nb, cq_err_event_notifier, CQ_ERROR); mlx5_eq_notifier_register(dev, &table->cq_err_nb); - table->cmd_eq.irq_nb.notifier_call = mlx5_eq_async_int; param = (struct mlx5_eq_param) { .irq_index = 0, .nent = MLX5_NUM_CMD_EQE, + .mask[0] = 1ull << MLX5_EVENT_TYPE_CMD, }; - - param.mask[0] = 1ull << MLX5_EVENT_TYPE_CMD; - err = create_async_eq(dev, &table->cmd_eq.core, ¶m); - if (err) { - mlx5_core_warn(dev, "failed to create cmd EQ %d\n", err); - goto err0; - } - err = mlx5_eq_enable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); - if (err) { - mlx5_core_warn(dev, "failed to enable cmd EQ %d\n", err); + err = setup_async_eq(dev, &table->cmd_eq, ¶m, "cmd"); + if (err) goto err1; - } + mlx5_cmd_use_events(dev); - table->async_eq.irq_nb.notifier_call = mlx5_eq_async_int; param = (struct mlx5_eq_param) { .irq_index = 0, .nent = MLX5_NUM_ASYNC_EQE, }; gather_async_events_mask(dev, param.mask); - err = create_async_eq(dev, &table->async_eq.core, ¶m); - if (err) { - mlx5_core_warn(dev, "failed to create async EQ %d\n", err); + err = setup_async_eq(dev, &table->async_eq, ¶m, "async"); + if (err) goto err2; - } - err = mlx5_eq_enable(dev, &table->async_eq.core, - &table->async_eq.irq_nb); - if (err) { - mlx5_core_warn(dev, "failed to enable async EQ %d\n", err); - goto err3; - } - table->pages_eq.irq_nb.notifier_call = mlx5_eq_async_int; param = (struct mlx5_eq_param) { .irq_index = 0, .nent = /* TODO: sriov max_vf + */ 1, + .mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_REQUEST, }; - param.mask[0] = 1ull << MLX5_EVENT_TYPE_PAGE_REQUEST; - err = create_async_eq(dev, &table->pages_eq.core, ¶m); - if (err) { - mlx5_core_warn(dev, "failed to create pages EQ %d\n", err); - goto err4; - } - err = mlx5_eq_enable(dev, &table->pages_eq.core, - &table->pages_eq.irq_nb); - if (err) { - mlx5_core_warn(dev, "failed to enable pages EQ %d\n", err); - goto err5; - } + err = setup_async_eq(dev, &table->pages_eq, ¶m, "pages"); + if (err) + goto err3; - return err; + return 0; -err5: - destroy_async_eq(dev, &table->pages_eq.core); -err4: - mlx5_eq_disable(dev, &table->async_eq.core, &table->async_eq.irq_nb); err3: - destroy_async_eq(dev, &table->async_eq.core); + cleanup_async_eq(dev, &table->async_eq, "async"); err2: mlx5_cmd_use_polling(dev); - mlx5_eq_disable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); + cleanup_async_eq(dev, &table->cmd_eq, "cmd"); err1: - destroy_async_eq(dev, &table->cmd_eq.core); -err0: mlx5_eq_notifier_unregister(dev, &table->cq_err_nb); return err; } @@ -651,28 +652,11 @@ static int create_async_eqs(struct mlx5_core_dev *dev) static void destroy_async_eqs(struct mlx5_core_dev *dev) { struct mlx5_eq_table *table = dev->priv.eq_table; - int err; - - mlx5_eq_disable(dev, &table->pages_eq.core, &table->pages_eq.irq_nb); - err = destroy_async_eq(dev, &table->pages_eq.core); - if (err) - mlx5_core_err(dev, "failed to destroy pages eq, err(%d)\n", - err); - - mlx5_eq_disable(dev, &table->async_eq.core, &table->async_eq.irq_nb); - err = destroy_async_eq(dev, &table->async_eq.core); - if (err) - mlx5_core_err(dev, "failed to destroy async eq, err(%d)\n", - err); + cleanup_async_eq(dev, &table->pages_eq, "pages"); + cleanup_async_eq(dev, &table->async_eq, "async"); mlx5_cmd_use_polling(dev); - - mlx5_eq_disable(dev, &table->cmd_eq.core, &table->cmd_eq.irq_nb); - err = destroy_async_eq(dev, &table->cmd_eq.core); - if (err) - mlx5_core_err(dev, "failed to destroy command eq, err(%d)\n", - err); - + cleanup_async_eq(dev, &table->cmd_eq, "cmd"); mlx5_eq_notifier_unregister(dev, &table->cq_err_nb); } From patchwork Tue Jan 7 19:14:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219032 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="QjfY9+6L"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrg0fx6z9s29 for ; Wed, 8 Jan 2020 06:14:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728775AbgAGTO0 (ORCPT ); Tue, 7 Jan 2020 14:14:26 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728726AbgAGTOZ (ORCPT ); Tue, 7 Jan 2020 14:14:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=acC+J75srTfZFz5+tfA/uwm24y4PnhhSYrkm4nMF8WNyE6kwYwWWl/qIsRMYKOXedsG7yqQNhrDssN7WmKQGY/gkDiqZywn705AXpVjeOlJYRBmfCPEdupCVkZhuHYZZABg4Y5mozL3vMoCv0HAobCLGrVSNsIod/xCBPTO+HIPxt63LKs0EIc5sQp5LA8zOHU7quIfaE3h3wav4qJPuA3MzscF1T9qHVm+AHtVH7t8EEefeUEZB1zVArbL4Ux8w6+xvbn/RWBu1m5iM58ykULsP8Lglg7C6/DElqe3aLGf8CQQ6x0xrR/1BYlWetqOSTkOWwrnbleDAGadUBGoA1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gwK7dahji+bDP98ysDbcn/fphtzKRNnjFRAKQd7d7fc=; b=CTUzTurX7LBdrsmNqOUEh796+yo6WvKxJFxMMq0d5JxqfoySMBh5NEYydUXQ8vA3sAWVZxqdnb/3boSuLKVR8nF9mgMcoAlvwS3V2sRu46OoPBFcfZpOlMbuZ0B4ie67ARyz7/0rlNuxesMW6Q2kC2EoNejKzL8Nw1/O7L3QQIdETLlNqEegDbkBgYkwMvqdlXl+tLjZaPCUDw+LF46ZPx/etorlJp469NSqXzjo+tXVwt75C5o6DltcNjUIZXM/azd21VdhlQAMSeXVmInslU/rhrTOBiXbArrqMIx6+Saf7BSgpFyTY7eLkcEYiTjZP4vmZgN6rIal442C5eucrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=gwK7dahji+bDP98ysDbcn/fphtzKRNnjFRAKQd7d7fc=; b=QjfY9+6LUbpG3ZOehpO6IygWc7VYP38gIFue/gV19q3s7vm6WmVNw/RkQXqZaFqABmV9BQWoKaBGzfysrhEjEn87WJF6+VI0mKh5gFzxSiz81KGTMtBbWBaryAJSK/v9bTKUUgLxCDF9YfY0iOiUKrhCfGK9MmPA7ttd8ml29h0= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:17 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:17 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:15 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Alex Vesker , Saeed Mahameed Subject: [net-next 07/13] net/mlx5: DR, Use attributes struct for FW flow table creation Thread-Topic: [net-next 07/13] net/mlx5: DR, Use attributes struct for FW flow table creation Thread-Index: AQHVxY6nj2sItiY4JUGu4GBXhSs2CA== Date: Tue, 7 Jan 2020 19:14:16 +0000 Message-ID: <20200107191335.12272-8-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 1d5a0437-853f-44f7-0109-08d793a5ca21 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:46; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 88QlCeGQOflBjuelNMAOXswzd2CVDWafp0eR/bo/8/irVb7ZiqlmxIlTuF0xTgrsodnPLHwFvR9mChWJtzHwTG+CYeCqOdEVgH6g/i20ZDQ+IOi3xpLCMCC7vg58meTvpXal8Roj4v+RgNTT0x4V+4Gmig44yLGgir/9/7STewLVb4gK6Gy5zxD8iX5cCSaRaQInqKFtKJixVn+zFUmzFI7MxXMqz0tBos4eEOUyv74F1v4W6/YV2FPwT+DTsBwrHrKOpwM25uxUluqyiN9SprrhZMsCMa2x4cqePwAglhlF9tSbXCu/JYSvda1AJ+Nm/X09NTVac4eJz5f+4YmqUvHoY26dPD+XHaGO6XD6TwC14WZpPgY4jzbElvIXzSm+pRdZIhpvBRmPpECVnSLVWZeSOEKqhgXQRNMkLv+g/ihWt/TZSQGcGGCXdazFWAKjT7dB/8LMxpO/ydiFyicOAQQttXrtjQvubJtNmMp+mumUKzzU35YKlZPiA20l3xtixKwf7mOfM49vuUKUVnk5K00bgNc2SrziAtXJLVYBFTQ= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d5a0437-853f-44f7-0109-08d793a5ca21 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:16.7981 (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-CrossTenant-userprincipalname: p+0Stx34W+aQ5hzyYVmSO0fjxEmyKjYFD53BpBRFGgSi8JXVfRKrl2VqZrf4+m7QjN1ro33YBp7QGn+i6FuzAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alex Vesker Instead of using multiple variables use a simple struct. The number of passed argument was too high after adding the encap decap support bits arguments used for multiple destination reformat. Signed-off-by: Alex Vesker Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/dr_cmd.c | 39 ++++++++++--------- .../mellanox/mlx5/core/steering/dr_fw.c | 12 ++++-- .../mellanox/mlx5/core/steering/dr_table.c | 16 ++++---- .../mellanox/mlx5/core/steering/dr_types.h | 18 ++++++--- 4 files changed, 50 insertions(+), 35 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c index 41662c4e2664..ec35b297dcab 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c @@ -320,12 +320,7 @@ int mlx5dr_cmd_destroy_flow_group(struct mlx5_core_dev *mdev, } int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev, - u32 table_type, - u64 icm_addr_rx, - u64 icm_addr_tx, - u8 level, - bool sw_owner, - bool term_tbl, + struct mlx5dr_cmd_create_flow_table_attr *attr, u64 *fdb_rx_icm_addr, u32 *table_id) { @@ -335,37 +330,43 @@ int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev, int err; MLX5_SET(create_flow_table_in, in, opcode, MLX5_CMD_OP_CREATE_FLOW_TABLE); - MLX5_SET(create_flow_table_in, in, table_type, table_type); + MLX5_SET(create_flow_table_in, in, table_type, attr->table_type); ft_mdev = MLX5_ADDR_OF(create_flow_table_in, in, flow_table_context); - MLX5_SET(flow_table_context, ft_mdev, termination_table, term_tbl); - MLX5_SET(flow_table_context, ft_mdev, sw_owner, sw_owner); - MLX5_SET(flow_table_context, ft_mdev, level, level); + MLX5_SET(flow_table_context, ft_mdev, termination_table, attr->term_tbl); + MLX5_SET(flow_table_context, ft_mdev, sw_owner, attr->sw_owner); + MLX5_SET(flow_table_context, ft_mdev, level, attr->level); - if (sw_owner) { + if (attr->sw_owner) { /* icm_addr_0 used for FDB RX / NIC TX / NIC_RX * icm_addr_1 used for FDB TX */ - if (table_type == MLX5_FLOW_TABLE_TYPE_NIC_RX) { + if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_RX) { MLX5_SET64(flow_table_context, ft_mdev, - sw_owner_icm_root_0, icm_addr_rx); - } else if (table_type == MLX5_FLOW_TABLE_TYPE_NIC_TX) { + sw_owner_icm_root_0, attr->icm_addr_rx); + } else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_NIC_TX) { MLX5_SET64(flow_table_context, ft_mdev, - sw_owner_icm_root_0, icm_addr_tx); - } else if (table_type == MLX5_FLOW_TABLE_TYPE_FDB) { + sw_owner_icm_root_0, attr->icm_addr_tx); + } else if (attr->table_type == MLX5_FLOW_TABLE_TYPE_FDB) { MLX5_SET64(flow_table_context, ft_mdev, - sw_owner_icm_root_0, icm_addr_rx); + sw_owner_icm_root_0, attr->icm_addr_rx); MLX5_SET64(flow_table_context, ft_mdev, - sw_owner_icm_root_1, icm_addr_tx); + sw_owner_icm_root_1, attr->icm_addr_tx); } } + MLX5_SET(create_flow_table_in, in, flow_table_context.decap_en, + attr->decap_en); + MLX5_SET(create_flow_table_in, in, flow_table_context.reformat_en, + attr->reformat_en); + err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); if (err) return err; *table_id = MLX5_GET(create_flow_table_out, out, table_id); - if (!sw_owner && table_type == MLX5_FLOW_TABLE_TYPE_FDB) + if (!attr->sw_owner && attr->table_type == MLX5_FLOW_TABLE_TYPE_FDB && + fdb_rx_icm_addr) *fdb_rx_icm_addr = (u64)MLX5_GET(create_flow_table_out, out, icm_address_31_0) | (u64)MLX5_GET(create_flow_table_out, out, icm_address_39_32) << 32 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c index 60ef6e6171e3..9d2180cb095f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c @@ -7,6 +7,7 @@ struct mlx5dr_fw_recalc_cs_ft * mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u32 vport_num) { + struct mlx5dr_cmd_create_flow_table_attr ft_attr = {}; struct mlx5dr_fw_recalc_cs_ft *recalc_cs_ft; u32 table_id, group_id, modify_hdr_id; u64 rx_icm_addr, modify_ttl_action; @@ -16,9 +17,14 @@ mlx5dr_fw_create_recalc_cs_ft(struct mlx5dr_domain *dmn, u32 vport_num) if (!recalc_cs_ft) return NULL; - ret = mlx5dr_cmd_create_flow_table(dmn->mdev, MLX5_FLOW_TABLE_TYPE_FDB, - 0, 0, dmn->info.caps.max_ft_level - 1, - false, true, &rx_icm_addr, &table_id); + ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB; + ft_attr.level = dmn->info.caps.max_ft_level - 1; + ft_attr.term_tbl = true; + + ret = mlx5dr_cmd_create_flow_table(dmn->mdev, + &ft_attr, + &rx_icm_addr, + &table_id); if (ret) { mlx5dr_err(dmn, "Failed creating TTL W/A FW flow table %d\n", ret); goto free_ttl_tbl; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c index e178d8d3dbc9..7a4e6a43bdea 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c @@ -211,6 +211,7 @@ static int dr_table_destroy_sw_owned_tbl(struct mlx5dr_table *tbl) static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl) { + struct mlx5dr_cmd_create_flow_table_attr ft_attr = {}; u64 icm_addr_rx = 0; u64 icm_addr_tx = 0; int ret; @@ -221,13 +222,14 @@ static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl) if (tbl->tx.s_anchor) icm_addr_tx = tbl->tx.s_anchor->chunk->icm_addr; - ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev, - tbl->table_type, - icm_addr_rx, - icm_addr_tx, - tbl->dmn->info.caps.max_ft_level - 1, - true, false, NULL, - &tbl->table_id); + ft_attr.table_type = tbl->table_type; + ft_attr.icm_addr_rx = icm_addr_rx; + ft_attr.icm_addr_tx = icm_addr_tx; + ft_attr.level = tbl->dmn->info.caps.max_ft_level - 1; + ft_attr.sw_owner = true; + + ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev, &ft_attr, + NULL, &tbl->table_id); return ret; } diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index 290fe61c33d0..bc82b76cf04e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -867,6 +867,17 @@ struct mlx5dr_cmd_query_flow_table_details { u64 sw_owner_icm_root_0; }; +struct mlx5dr_cmd_create_flow_table_attr { + u32 table_type; + u64 icm_addr_rx; + u64 icm_addr_tx; + u8 level; + bool sw_owner; + bool term_tbl; + bool decap_en; + bool reformat_en; +}; + /* internal API functions */ int mlx5dr_cmd_query_device(struct mlx5_core_dev *mdev, struct mlx5dr_cmd_caps *caps); @@ -904,12 +915,7 @@ int mlx5dr_cmd_destroy_flow_group(struct mlx5_core_dev *mdev, u32 table_id, u32 group_id); int mlx5dr_cmd_create_flow_table(struct mlx5_core_dev *mdev, - u32 table_type, - u64 icm_addr_rx, - u64 icm_addr_tx, - u8 level, - bool sw_owner, - bool term_tbl, + struct mlx5dr_cmd_create_flow_table_attr *attr, u64 *fdb_rx_icm_addr, u32 *table_id); int mlx5dr_cmd_destroy_flow_table(struct mlx5_core_dev *mdev, From patchwork Tue Jan 7 19:14:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219033 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="Aj3GnOEl"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrj5v67z9s29 for ; Wed, 8 Jan 2020 06:14:29 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728781AbgAGTO2 (ORCPT ); Tue, 7 Jan 2020 14:14:28 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728770AbgAGTO2 (ORCPT ); Tue, 7 Jan 2020 14:14:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E9iGHaISGIbI26VzZLKruA+mtnDMEAZWIKRpBbRNndIAQQAlKll3wS2P8vz0MyzRDIBLBKL7YeQwlUxAovc9A0cP94N0WTnLnLtC3+TQRKA3VD3o5tAx7+WdsSgGAXiZEd/g4joFXNsX+VKuDWb7cXzwvWkPhxFIrXTQmcz+pex0gsOR7MUGoVewh7EGvqTIhXnUa0DXYfDSCxWDnxO+rXCdxsl2N5cfgdxE9J3RRDcQC7d1Be5IR0fJuAEY9krto58ZB46+7nnNO9DtlsT1nvgpNqC4bsROo83M/O1tuq2xFkgVgks87eH5QVD/eUKx2Q99PbfH022+gB1CAUPxJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B91BeKX20nvVM5HGa/mx5U/yX6HLdmc0TFL9QZBhRoA=; b=mKsPXP7CiNCOQ8cJDAQCRbrdhTfu/dYNOp9x6v2DPgNzebWAOKTBy6qCDOv94Q7zAl6TbpGf4Mr9x2La+v7bcaQDOpSH6uC4gHKSjLmmI2DWY7ASasndkA3xLMCiC2o9xuubUXAEsfP8mjjhJf9OwpDAR41reogdY1t9mfGez2cSDWN47CLwZZ3qY4pqXUIyVCj4kCtBgnM8sSwSA8ks2T2Ragv1Vw+vPTZqE3Mabbberm8XWPfInbykncpKtbl7mFnvtYGSrTFffnqsKL4tFvvFZli5lKbJ5xulBwGnuEusZa+ZxXsLiuOxft4xpVs6aZaaaR7lL83h9coHedG3tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=B91BeKX20nvVM5HGa/mx5U/yX6HLdmc0TFL9QZBhRoA=; b=Aj3GnOElVXzagPgKdPmfneT1lGGg5obP80oCR/VqzLEQEXed7c1dtjzP1h3sLifrw4peu6uCozsMwqQKvxHvYk7npCHXz8GUtx5jb0s1qPSEDCWXHhwtdY3YJAYqqJtaSFdTIPfF2WiglbcHcR3qG64ZvPhGIxaOgk/AnTc0fbA= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:18 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:18 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:17 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Erez Shitrit , Saeed Mahameed Subject: [net-next 08/13] net/mlx5: DR, Create FTE entry in the FW from SW-steering Thread-Topic: [net-next 08/13] net/mlx5: DR, Create FTE entry in the FW from SW-steering Thread-Index: AQHVxY6o0W+R2dEPP0SUep3p2EQ7qw== Date: Tue, 7 Jan 2020 19:14:18 +0000 Message-ID: <20200107191335.12272-9-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b995c6a8-52a2-4e58-4578-08d793a5cb22 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2043; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fR2wp6XCV6rTx5PgrVng3Z25KffRKDYFHfdwUfmB5EBEay3a5RJ6EUPae91p48vCcDTX8307G2O26ba5TdYZusDEgVLOfDgZc/CEo9VF88bdJjorIvkWZvOqkUwV/dFIQL0i4ZGpuqIlCkE6fLz/fgcDFjbpIk/N/pAfbszsIFO6MyT4z9GGfYHKIWbiO1McajB0b3Lg0ebEI4UCRmt0LS3uZlkPgFkZsXAn26gADGXS7eVEIl96qLqBrMh9PIlyWbe7TKF+bxovqYOTfyocUNzG/YU+ucPRoW9DWbdg/6nF4dmvfKkMQTNs4yw3FA8dvZ+4PtPU5inBInhpB2Cp1R/V//YAr8NF9saFHVhG7d1VokGqJa85j/4a3xddkDOQ0JndBIjP9JyYrvGlZ8D6RdwTlLnwUTmOe02w3sxqCKyouqO/tk8Y7OCOIRejcYNGg4SfL7N4oRX2Ko0cVrNG88+6Kb0AJ5iBj7QWM49b+OrDZDtVFhlTan1mqfaWdLKQB0wRrxxHZbjkxC3sUOltc5fV28470ZVA2x8+xPhtTkQ= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b995c6a8-52a2-4e58-4578-08d793a5cb22 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:18.5221 (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-CrossTenant-userprincipalname: C7yQIAl7Zrr6d1OEyt3jcESOgen2cnnhvORoafN0OE9auGQsN55anYuYFV80PD/JCWBhG8lmP7qiF3w9n12NZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Erez Shitrit Implement the FW command to setup a FTE (Flow Table Entry) into the FW managed flow tables. Signed-off-by: Erez Shitrit Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/dr_cmd.c | 205 ++++++++++++++++++ .../mellanox/mlx5/core/steering/dr_types.h | 37 ++++ 2 files changed, 242 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c index ec35b297dcab..461b39376daf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_cmd.c @@ -479,3 +479,208 @@ int mlx5dr_cmd_query_gid(struct mlx5_core_dev *mdev, u8 vhca_port_num, return 0; } + +static int mlx5dr_cmd_set_extended_dest(struct mlx5_core_dev *dev, + struct mlx5dr_cmd_fte_info *fte, + bool *extended_dest) +{ + int fw_log_max_fdb_encap_uplink = MLX5_CAP_ESW(dev, log_max_fdb_encap_uplink); + int num_fwd_destinations = 0; + int num_encap = 0; + int i; + + *extended_dest = false; + if (!(fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST)) + return 0; + for (i = 0; i < fte->dests_size; i++) { + if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) + continue; + if (fte->dest_arr[i].type == MLX5_FLOW_DESTINATION_TYPE_VPORT && + fte->dest_arr[i].vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID) + num_encap++; + num_fwd_destinations++; + } + + if (num_fwd_destinations > 1 && num_encap > 0) + *extended_dest = true; + + if (*extended_dest && !fw_log_max_fdb_encap_uplink) { + mlx5_core_warn(dev, "FW does not support extended destination"); + return -EOPNOTSUPP; + } + if (num_encap > (1 << fw_log_max_fdb_encap_uplink)) { + mlx5_core_warn(dev, "FW does not support more than %d encaps", + 1 << fw_log_max_fdb_encap_uplink); + return -EOPNOTSUPP; + } + + return 0; +} + +int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, + int opmod, int modify_mask, + struct mlx5dr_cmd_ft_info *ft, + u32 group_id, + struct mlx5dr_cmd_fte_info *fte) +{ + u32 out[MLX5_ST_SZ_DW(set_fte_out)] = {}; + void *in_flow_context, *vlan; + bool extended_dest = false; + void *in_match_value; + unsigned int inlen; + int dst_cnt_size; + void *in_dests; + u32 *in; + int err; + int i; + + if (mlx5dr_cmd_set_extended_dest(dev, fte, &extended_dest)) + return -EOPNOTSUPP; + + if (!extended_dest) + dst_cnt_size = MLX5_ST_SZ_BYTES(dest_format_struct); + else + dst_cnt_size = MLX5_ST_SZ_BYTES(extended_dest_format); + + inlen = MLX5_ST_SZ_BYTES(set_fte_in) + fte->dests_size * dst_cnt_size; + in = kvzalloc(inlen, GFP_KERNEL); + if (!in) + return -ENOMEM; + + MLX5_SET(set_fte_in, in, opcode, MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY); + MLX5_SET(set_fte_in, in, op_mod, opmod); + MLX5_SET(set_fte_in, in, modify_enable_mask, modify_mask); + MLX5_SET(set_fte_in, in, table_type, ft->type); + MLX5_SET(set_fte_in, in, table_id, ft->id); + MLX5_SET(set_fte_in, in, flow_index, fte->index); + if (ft->vport) { + MLX5_SET(set_fte_in, in, vport_number, ft->vport); + MLX5_SET(set_fte_in, in, other_vport, 1); + } + + in_flow_context = MLX5_ADDR_OF(set_fte_in, in, flow_context); + MLX5_SET(flow_context, in_flow_context, group_id, group_id); + + MLX5_SET(flow_context, in_flow_context, flow_tag, + fte->flow_context.flow_tag); + MLX5_SET(flow_context, in_flow_context, flow_source, + fte->flow_context.flow_source); + + MLX5_SET(flow_context, in_flow_context, extended_destination, + extended_dest); + if (extended_dest) { + u32 action; + + action = fte->action.action & + ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; + MLX5_SET(flow_context, in_flow_context, action, action); + } else { + MLX5_SET(flow_context, in_flow_context, action, + fte->action.action); + if (fte->action.pkt_reformat) + MLX5_SET(flow_context, in_flow_context, packet_reformat_id, + fte->action.pkt_reformat->id); + } + if (fte->action.modify_hdr) + MLX5_SET(flow_context, in_flow_context, modify_header_id, + fte->action.modify_hdr->id); + + vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan); + + MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[0].ethtype); + MLX5_SET(vlan, vlan, vid, fte->action.vlan[0].vid); + MLX5_SET(vlan, vlan, prio, fte->action.vlan[0].prio); + + vlan = MLX5_ADDR_OF(flow_context, in_flow_context, push_vlan_2); + + MLX5_SET(vlan, vlan, ethtype, fte->action.vlan[1].ethtype); + MLX5_SET(vlan, vlan, vid, fte->action.vlan[1].vid); + MLX5_SET(vlan, vlan, prio, fte->action.vlan[1].prio); + + in_match_value = MLX5_ADDR_OF(flow_context, in_flow_context, + match_value); + memcpy(in_match_value, fte->val, sizeof(u32) * MLX5_ST_SZ_DW_MATCH_PARAM); + + in_dests = MLX5_ADDR_OF(flow_context, in_flow_context, destination); + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { + int list_size = 0; + + for (i = 0; i < fte->dests_size; i++) { + unsigned int id, type = fte->dest_arr[i].type; + + if (type == MLX5_FLOW_DESTINATION_TYPE_COUNTER) + continue; + + switch (type) { + case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE_NUM: + id = fte->dest_arr[i].ft_num; + type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + break; + case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: + id = fte->dest_arr[i].ft_id; + break; + case MLX5_FLOW_DESTINATION_TYPE_VPORT: + id = fte->dest_arr[i].vport.num; + MLX5_SET(dest_format_struct, in_dests, + destination_eswitch_owner_vhca_id_valid, + !!(fte->dest_arr[i].vport.flags & + MLX5_FLOW_DEST_VPORT_VHCA_ID)); + MLX5_SET(dest_format_struct, in_dests, + destination_eswitch_owner_vhca_id, + fte->dest_arr[i].vport.vhca_id); + if (extended_dest && (fte->dest_arr[i].vport.flags & + MLX5_FLOW_DEST_VPORT_REFORMAT_ID)) { + MLX5_SET(dest_format_struct, in_dests, + packet_reformat, + !!(fte->dest_arr[i].vport.flags & + MLX5_FLOW_DEST_VPORT_REFORMAT_ID)); + MLX5_SET(extended_dest_format, in_dests, + packet_reformat_id, + fte->dest_arr[i].vport.reformat_id); + } + break; + default: + id = fte->dest_arr[i].tir_num; + } + + MLX5_SET(dest_format_struct, in_dests, destination_type, + type); + MLX5_SET(dest_format_struct, in_dests, destination_id, id); + in_dests += dst_cnt_size; + list_size++; + } + + MLX5_SET(flow_context, in_flow_context, destination_list_size, + list_size); + } + + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_COUNT) { + int max_list_size = BIT(MLX5_CAP_FLOWTABLE_TYPE(dev, + log_max_flow_counter, + ft->type)); + int list_size = 0; + + for (i = 0; i < fte->dests_size; i++) { + if (fte->dest_arr[i].type != + MLX5_FLOW_DESTINATION_TYPE_COUNTER) + continue; + + MLX5_SET(flow_counter_list, in_dests, flow_counter_id, + fte->dest_arr[i].counter_id); + in_dests += dst_cnt_size; + list_size++; + } + if (list_size > max_list_size) { + err = -EINVAL; + goto err_out; + } + + MLX5_SET(flow_context, in_flow_context, flow_counter_list_size, + list_size); + } + + err = mlx5_cmd_exec(dev, in, inlen, out, sizeof(out)); +err_out: + kvfree(in); + return err; +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index bc82b76cf04e..09ac9aadad1a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -1057,6 +1057,43 @@ int mlx5dr_send_postsend_formatted_htbl(struct mlx5dr_domain *dmn, int mlx5dr_send_postsend_action(struct mlx5dr_domain *dmn, struct mlx5dr_action *action); +struct mlx5dr_cmd_ft_info { + u32 id; + u16 vport; + enum fs_flow_table_type type; +}; + +struct mlx5dr_cmd_flow_destination_hw_info { + enum mlx5_flow_destination_type type; + union { + u32 tir_num; + u32 ft_num; + u32 ft_id; + u32 counter_id; + struct { + u16 num; + u16 vhca_id; + u32 reformat_id; + u8 flags; + } vport; + }; +}; + +struct mlx5dr_cmd_fte_info { + u32 dests_size; + u32 index; + struct mlx5_flow_context flow_context; + u32 *val; + struct mlx5_flow_act action; + struct mlx5dr_cmd_flow_destination_hw_info *dest_arr; +}; + +int mlx5dr_cmd_set_fte(struct mlx5_core_dev *dev, + int opmod, int modify_mask, + struct mlx5dr_cmd_ft_info *ft, + u32 group_id, + struct mlx5dr_cmd_fte_info *fte); + struct mlx5dr_fw_recalc_cs_ft { u64 rx_icm_addr; u32 table_id; From patchwork Tue Jan 7 19:14:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219034 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="HsFN0spt"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrm5hqnz9s29 for ; Wed, 8 Jan 2020 06:14:32 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728793AbgAGTOc (ORCPT ); Tue, 7 Jan 2020 14:14:32 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728778AbgAGTOb (ORCPT ); Tue, 7 Jan 2020 14:14:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OthJvl4QvEkp5H0uy9wBRu4smp1ECA+soPWP8Y13RyIIXwOhl0D/V1VKY3xXEeaOGl5Cz5/fnrE8JU/iW8YgHBubXXzdt5k0TUQ1eFLPstjTY6YHT/2ip6NhT1A7rYzrIL+7RnLffBUgDUjdXYMIjZwQLLkO36rN5gEctLRzmaazUAnydDto7b3RrrM0BMcl6yZ2x2hQhMlJUWi2YwEBO0QIUONiA+dOYHemX3L7SdytmmgHa1EgfzN8hQYBw+yd7NhYAzlyxb6qc+A/SZ86XiInGfUK6Lp/xPn9N5Etyac6MGNW/+Wv4xp+1BYnSzEtYfG6fPVypdI21/pBS0o8+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QVqXSD7tsHPMG3NDxC7zlLE9/38uAwuOsuT9izcoQiQ=; b=ElRa5Ql+n6pJHNTmrrVUu7Oaw0PlWvfcATxZhNfOqvM16nW/i3Mi4gErT+I6st8jxO7hQvwtrgjGDAYPbIH5x8TWLmTF9haFmCLuRCu0otPKI/cFKAwJuD3QOfwuc56Sgk7YhW7NXgkS2wG36gM26BmV5b//lo9ChRZ4GDOCXOEamgy9hUkyuZ45CgQ4EZbmhyPuqq/8rQvRfBwEwiZHLQgLNrWMQFR3vyPN677fvK4GURXWq78ViXGxqqCQ6NSbhL6cxU6XYnhXhEJAnbJA6ZQ5ufPrFLR4eALKzj2m6UuZDdAFAKsyn+g6kGNftex+NaEyq2YjKJjRBITWjc0M6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=QVqXSD7tsHPMG3NDxC7zlLE9/38uAwuOsuT9izcoQiQ=; b=HsFN0sptGzsW5x9gYwS1N4mE/tHof8CjiB5er1vSr0AMPU34rV/4KbBSCu7sJGmDuei3JE75PICPkxM1IU9V34Y35dBXMnj5cmgVgnXSliq6nSNuGmB7sUU3A+EBaEk8yGITjxJnFajP9a2ip7wBvVQdxWrcdoT1NOZwpgv6VVI= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:20 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:20 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:18 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Erez Shitrit , Saeed Mahameed Subject: [net-next 09/13] net/mlx5: DR, Create multi-destination table for SW-steering use Thread-Topic: [net-next 09/13] net/mlx5: DR, Create multi-destination table for SW-steering use Thread-Index: AQHVxY6pfyA9TBpWcUu3VqhrBDAFDg== Date: Tue, 7 Jan 2020 19:14:20 +0000 Message-ID: <20200107191335.12272-10-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f2274f0d-4c45-4fd9-46af-08d793a5cc04 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2733; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(6666004)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2Q3pGtrG3unz2BWp+MtuNqVE6CwLA30mD4c7gly9Ka0wy9T3OaCPCMbqOjOBSFpS1XXClOmAU4unHIMjHH+zvayzJ/NRQvHAA3DN7aXaAKgR76P/bTiAlLxGSbh5wru28PWqjJhVMf+4KVcT8FMT2C4H+BMh703kHugAYhG44q2JBMB3KNgQcBk9HeQK634WFcZGRGs3gkfE9c1dYSERJ0zdZ1yWQA1rs8Qitn8EAUmd02ASzgTF86+JU8VyP+anMh5cvM3XdcozeXntwZJIB9DMQ30lbZ5D28mx/Rnt4R1vTlB7IdhBTwrr7hYJTEoCYiHbz9HAQoVfoc4t9xDhK1UgUF5QfwxC8N0pGXUEQBm2im4fM+p4CI0UoF5MIW+02ZNLZkGdIgPdKz0XjFStvCjDHLPZwLoOpY5fEKZ+9YE9dM0W6YooJgPl2ccgRRX0NX4neEe9g6AoG0tquAh/waCSZZM+Lw86iwSfuRdS6h3xwPoX/ag7O8D7hlDXfnzy3RIaIuT8ac+SPhDFuq81yfr71Brb10SDRawDWndZoOc= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2274f0d-4c45-4fd9-46af-08d793a5cc04 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:20.0452 (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-CrossTenant-userprincipalname: Pu6J0rkg7TtT1yaNY0wF1XAURBHMh06C7p33aNwRnbm44er5C4qR30VQX7Fc8NqorBPEemXpHERyuUHA0Pifzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Erez Shitrit Currently SW steering doesn't have the means to access HW iterators to support multi-destination (FTEs) flow table entries. In order to support multi-destination FTEs for port-mirroring, SW steering will create a dedicated multi-destination FW managed flow table and FTEs via direct FW commands that we introduced in the previous patch. Signed-off-by: Erez Shitrit Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/dr_fw.c | 67 +++++++++++++++++++ .../mellanox/mlx5/core/steering/dr_types.h | 8 +++ 2 files changed, 75 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c index 9d2180cb095f..1fbcd012bb85 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_fw.c @@ -97,3 +97,70 @@ void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn, kfree(recalc_cs_ft); } + +int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn, + struct mlx5dr_cmd_flow_destination_hw_info *dest, + int num_dest, + bool reformat_req, + u32 *tbl_id, + u32 *group_id) +{ + struct mlx5dr_cmd_create_flow_table_attr ft_attr = {}; + struct mlx5dr_cmd_fte_info fte_info = {}; + u32 val[MLX5_ST_SZ_DW_MATCH_PARAM] = {}; + struct mlx5dr_cmd_ft_info ft_info = {}; + int ret; + + ft_attr.table_type = MLX5_FLOW_TABLE_TYPE_FDB; + ft_attr.level = dmn->info.caps.max_ft_level - 2; + ft_attr.reformat_en = reformat_req; + ft_attr.decap_en = reformat_req; + + ret = mlx5dr_cmd_create_flow_table(dmn->mdev, &ft_attr, NULL, tbl_id); + if (ret) { + mlx5dr_err(dmn, "Failed creating multi dest FW flow table %d\n", ret); + return ret; + } + + ret = mlx5dr_cmd_create_empty_flow_group(dmn->mdev, + MLX5_FLOW_TABLE_TYPE_FDB, + *tbl_id, group_id); + if (ret) { + mlx5dr_err(dmn, "Failed creating multi dest FW flow group %d\n", ret); + goto free_flow_table; + } + + ft_info.id = *tbl_id; + ft_info.type = FS_FT_FDB; + fte_info.action.action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST; + fte_info.dests_size = num_dest; + fte_info.val = val; + fte_info.dest_arr = dest; + + ret = mlx5dr_cmd_set_fte(dmn->mdev, 0, 0, &ft_info, *group_id, &fte_info); + if (ret) { + mlx5dr_err(dmn, "Failed setting fte into table %d\n", ret); + goto free_flow_group; + } + + return 0; + +free_flow_group: + mlx5dr_cmd_destroy_flow_group(dmn->mdev, MLX5_FLOW_TABLE_TYPE_FDB, + *tbl_id, *group_id); +free_flow_table: + mlx5dr_cmd_destroy_flow_table(dmn->mdev, *tbl_id, + MLX5_FLOW_TABLE_TYPE_FDB); + return ret; +} + +void mlx5dr_fw_destroy_md_tbl(struct mlx5dr_domain *dmn, + u32 tbl_id, u32 group_id) +{ + mlx5dr_cmd_del_flow_table_entry(dmn->mdev, FS_FT_FDB, tbl_id); + mlx5dr_cmd_destroy_flow_group(dmn->mdev, + MLX5_FLOW_TABLE_TYPE_FDB, + tbl_id, group_id); + mlx5dr_cmd_destroy_flow_table(dmn->mdev, tbl_id, + MLX5_FLOW_TABLE_TYPE_FDB); +} diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index 09ac9aadad1a..c37226a14311 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -1108,4 +1108,12 @@ void mlx5dr_fw_destroy_recalc_cs_ft(struct mlx5dr_domain *dmn, int mlx5dr_domain_cache_get_recalc_cs_ft_addr(struct mlx5dr_domain *dmn, u32 vport_num, u64 *rx_icm_addr); +int mlx5dr_fw_create_md_tbl(struct mlx5dr_domain *dmn, + struct mlx5dr_cmd_flow_destination_hw_info *dest, + int num_dest, + bool reformat_req, + u32 *tbl_id, + u32 *group_id); +void mlx5dr_fw_destroy_md_tbl(struct mlx5dr_domain *dmn, u32 tbl_id, + u32 group_id); #endif /* _DR_TYPES_H_ */ From patchwork Tue Jan 7 19:14:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219035 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="SZPH5U3p"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrp6mQsz9s29 for ; Wed, 8 Jan 2020 06:14:34 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728798AbgAGTOe (ORCPT ); Tue, 7 Jan 2020 14:14:34 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728784AbgAGTOd (ORCPT ); Tue, 7 Jan 2020 14:14:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iWTSoXTqvzpmX94xzJNJjmgZC4HBj/pgsV4ONVoK/zqq2aYa44+xQENMOnhRBCYSWkq0DTGi/P4mY+jGWVDs/2HsBuuQ+7MVLUahbRxs+0eRT9Hz3oobQSq1nqZKQK197LXu5H/L/wJpyDgoD2pY0+Y5e4s6MH7AyGCu0UgrwvqXBgzrldiT1/FWmv7VLevLlthPCPTMyDrSvJKwz4iahxFkkIp0qR00MHCOYDGlHe0LPPfdMDtemlFnDtlaVz947LlkZm3z+Z7NNd8PRjx2EsTc5re7Cl50hpgnnIJE+m1iqLAlWB7O4b+DcK7Gl2904Slid/JdBelZUKSgjv5Bgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aVj+jo3tEd+1OQ6Wnb/y+X5nKHWnFOL9rCzbgl6fIi8=; b=hxh0jX4udoUvyQvOcqGb3/iZ0s5hMnk0eRq1xucfXeu+7Gv4zOt/4aYx5QNH1EZMgNFCFdlatcNvfoWO7THgI2hpKclC5Y7Pa0pJZsgJhLuLM7DCxHTOEBK/6Dk3RevueZdd/q6gSlRdEETU2TI4UIlpXL/Mm5yhrZoOj03WF+0+BpMXa81GSC6k7QSZQoj2ERbsE/mH5fvTkX0h7YBVN7QhVM+OBIBMO8TwX7teVqJq6HTUbfuvtvcRrXojsKrprYybYCE1eefLozUaDTMb6Yu2qO23G8LZuiG8UcET8h3ouHQs2mzb6w5+fua9GGDKbkvVJyCcaOP8V/OAuXEuhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=aVj+jo3tEd+1OQ6Wnb/y+X5nKHWnFOL9rCzbgl6fIi8=; b=SZPH5U3p53TxlJbVvYFXIqLIgs396m8t+yGG5abPOZB7SOAgNH1agHF7iXE9HH3jqlUT/YrHTvIfC/0xoTYzmRkbdxqob00OZtURq6YhWA5Psgp9MpfeMibgNv/r9LXVo8A/YRmxigJDwurdG6hD9xxwlLd/Q8wcDMnQHuXdFAA= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:22 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:22 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:20 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Erez Shitrit , Saeed Mahameed Subject: [net-next 10/13] net/mlx5: DR, Pass table flags at creation to lower layer Thread-Topic: [net-next 10/13] net/mlx5: DR, Pass table flags at creation to lower layer Thread-Index: AQHVxY6qOpifm9At6EOGhPvh0/V00Q== Date: Tue, 7 Jan 2020 19:14:21 +0000 Message-ID: <20200107191335.12272-11-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f43b6baf-a8b4-4428-a567-08d793a5cd02 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:949; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: m4HgCJbMmn+9mIyI1gukQX0Uyp9lmU0Hbb4BPV7vTZ0oQ/d1fryGasTLl4Un3LZbg7zQtiMuBMlMGEDAvIEMPQ8GARzGE+gXQtbTc3wKCvo8JUSMQedCIUqLOrtzeDyZhfDU2ycyb+8mIuSeLfOA4+4bv0hgD3seYCloMcG1PoqiGhthmP8vSAhREi4tFbBT9I6jZKbT8NUKCV+6dWudt5sJfD8SdvunwlqKKSWTsf5KlY0F6Ry/pJnw2/JGSzauxUP7PPS/O1c4vIfhklYD8gOdGeELQfKgqxOeHawUs6oC6KNZJtJ4/5LKr16UNHmy8oG3mVHO625olNxk8XJuc9+SsOcBgYob4c2kOYQoyo2e1vX7LhA9EoUnOdjprdlSEqDhF/XwsZWXz9uvRWElOQ6S4MJrjswaDvSpu5T0+ecwZznuvbuSC3//l/3tVTyatcZZXo3n1x8DhFEWpfmdhVcYg/6vlzrQ5w2WaBqxF29eUUeRLEr8IYT54mLhUPZw/pao0OI0DPEF0VVZ+y2VizVwsvJDa3y6or2e4T587/k= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: f43b6baf-a8b4-4428-a567-08d793a5cd02 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:21.5843 (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-CrossTenant-userprincipalname: dqw3W/eAjPZqBxn16mn9nbBeE4SkMCdyp9Zjb0KISkcY46++YXwiq3lrnJ3zDGATPwGDi52TgyNtTt0+zJJp/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Erez Shitrit We need to have the flow-table flags when creation sw-steering tables, this parameter exists in the layer between fs_core to sw_steering, this patch gives it to the creation function. Signed-off-by: Erez Shitrit Signed-off-by: Saeed Mahameed --- .../net/ethernet/mellanox/mlx5/core/steering/dr_table.c | 7 ++++++- .../net/ethernet/mellanox/mlx5/core/steering/dr_types.h | 1 + drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c index 7a4e6a43bdea..14ce2d7dbb66 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c @@ -211,6 +211,8 @@ static int dr_table_destroy_sw_owned_tbl(struct mlx5dr_table *tbl) static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl) { + bool en_encap = !!(tbl->flags & MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT); + bool en_decap = !!(tbl->flags & MLX5_FLOW_TABLE_TUNNEL_EN_DECAP); struct mlx5dr_cmd_create_flow_table_attr ft_attr = {}; u64 icm_addr_rx = 0; u64 icm_addr_tx = 0; @@ -227,6 +229,8 @@ static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl) ft_attr.icm_addr_tx = icm_addr_tx; ft_attr.level = tbl->dmn->info.caps.max_ft_level - 1; ft_attr.sw_owner = true; + ft_attr.decap_en = en_decap; + ft_attr.reformat_en = en_encap; ret = mlx5dr_cmd_create_flow_table(tbl->dmn->mdev, &ft_attr, NULL, &tbl->table_id); @@ -234,7 +238,7 @@ static int dr_table_create_sw_owned_tbl(struct mlx5dr_table *tbl) return ret; } -struct mlx5dr_table *mlx5dr_table_create(struct mlx5dr_domain *dmn, u32 level) +struct mlx5dr_table *mlx5dr_table_create(struct mlx5dr_domain *dmn, u32 level, u32 flags) { struct mlx5dr_table *tbl; int ret; @@ -247,6 +251,7 @@ struct mlx5dr_table *mlx5dr_table_create(struct mlx5dr_domain *dmn, u32 level) tbl->dmn = dmn; tbl->level = level; + tbl->flags = flags; refcount_set(&tbl->refcount, 1); ret = dr_table_init(tbl); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index c37226a14311..de6bfa655326 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -679,6 +679,7 @@ struct mlx5dr_table { u32 level; u32 table_type; u32 table_id; + u32 flags; struct list_head matcher_list; struct mlx5dr_action *miss_action; refcount_t refcount; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index 3d587d0bdbbe..8ed0f087b1e0 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -74,7 +74,7 @@ static int mlx5_cmd_dr_create_flow_table(struct mlx5_flow_root_namespace *ns, next_ft); tbl = mlx5dr_table_create(ns->fs_dr_domain.dr_domain, - ft->level); + ft->level, ft->flags); if (!tbl) { mlx5_core_err(ns->dev, "Failed creating dr flow_table\n"); return -EINVAL; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h index adda9cbfba45..fb3ac697df1b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h @@ -46,7 +46,7 @@ void mlx5dr_domain_set_peer(struct mlx5dr_domain *dmn, struct mlx5dr_domain *peer_dmn); struct mlx5dr_table * -mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level); +mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level, u32 flags); int mlx5dr_table_destroy(struct mlx5dr_table *table); @@ -131,7 +131,7 @@ mlx5dr_domain_set_peer(struct mlx5dr_domain *dmn, struct mlx5dr_domain *peer_dmn) { } static inline struct mlx5dr_table * -mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level) { return NULL; } +mlx5dr_table_create(struct mlx5dr_domain *domain, u32 level, u32 flags) { return NULL; } static inline int mlx5dr_table_destroy(struct mlx5dr_table *table) { return 0; } From patchwork Tue Jan 7 19:14:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219036 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="azqJWyKW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrs1YjSz9s29 for ; Wed, 8 Jan 2020 06:14:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728802AbgAGTOg (ORCPT ); Tue, 7 Jan 2020 14:14:36 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728778AbgAGTOf (ORCPT ); Tue, 7 Jan 2020 14:14:35 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z48cSOqmwn6/gjiC/YMmq85ktM1kI5I4GuH1JgxeTq8Kf22jx+4BgZiPmQ6Faq9AatERIOTzifVM0kbZ3G2rBBzEF9MCz1uHMVVDRwzpkkIVa6ajMKBph4MrQRFvjj1RLGMLNhVS+eYmuzfUzdvkGMzNA7sQAR7tLL6HZLJd3fAL73NxpDuKNCLtAc/gPjFNQvUXsvIaCqOzV3qay89TzJQiU7IswN+obaaFGSjItJ5KMbDqDH7fJnNgQOu2ck5JSqWDd3AeZvMHi4g/7p8wZaMm1YwQeJYbNUiVHWXTcoSPy1nrBhektyIx3Ru7hJLpQXvGpftO9hpYxIuix+NY0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fk7d2QecBLz9gkkcS6/gyrmj3Zygo36Rn65jTJJWOQM=; b=kMisXiw/xYSeqeCMiLRzJk47upSVtE0flRYIAVUqwcUjWTLX3loSL0rsuVsVBYZA9gsc0PHn+cxhRHCXa0rqSbBmIWHyPtlepfvS4HfV4Bc9Iw2ztyXrYo5ua3jgfWBY7qiqDEQMViSrceizIapE9Cd8MJtpxZt6okLA4ps/9QGNK+bjbtiOksb/bZXiE6rNWvlFxLExek334IzqW/LcpcmVTr0CaaQvzlers6AQ7+Zf2QhLJnJ+PBXzXcgAtMinBayc9A+vkaFO0qU75tCO0DqLsm55l82gx6rT4dpdh881LJivpYP9/JBs8Z0/Dqfv6Zs+Zx5q7GSmy3kmZkxPIQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=fk7d2QecBLz9gkkcS6/gyrmj3Zygo36Rn65jTJJWOQM=; b=azqJWyKWTHvJ6S8ofqUApan0/idx4l8wIeFCYmtxCkBEWZCskmqHbLwxgR2+bnuKHU7/RXVtNzd+KKhwWEwISnn6EIQjpqig0GwqAykRLpfBt6RN47tQnF5QIC+hEQe+N7s4VXfxLr74sESadM7IQV1YtD7tIaxgbwPxkPi/3nA= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:24 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:24 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:22 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Alex Vesker , Erez Shitrit , Saeed Mahameed Subject: [net-next 11/13] net/mlx5: DR, Align dest FT action creation to API Thread-Topic: [net-next 11/13] net/mlx5: DR, Align dest FT action creation to API Thread-Index: AQHVxY6rM0ZjAnlIQUSPvyM+tBeCLg== Date: Tue, 7 Jan 2020 19:14:23 +0000 Message-ID: <20200107191335.12272-12-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 0be070db-6d48-414b-8888-08d793a5ce5a x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:773; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: E68PN72ENXCM/ygiKWj3ngGaQFPMo0BdiO8FXAY8IVYUMFTGihlU/UZ4f4PN9sdafh6LfClfMcDjl58MeSnyH45GDECYFUwRe4CwA3RNOaGNVT3PXtE85lZUyd98zRvm4EdLDJdkE3XyoDRmhSA2K32apQ0ObfZX9n9Idncbf/DgG2tZTiDbnRGVxlyzKE9UWqKU654sr6nN7RAUr58+lH5X7vN22gCZoY0BEBi/AiwhGwTDODmT0IJWI+0CNoEInTux2hTqIFIYoG0AwsEBsX7Vd++xdyPigWX3rlXImcqE2dNeV74TltuwtTCT5wTE+hbASdY9lp1kI83yRq/7/6/pyZ9Pog59QSNwuLbgtfyXhHsfROvXVtmLoXBgBDOeCKYiQ6SfDvFrPs6YjLeEZ9vf2cKzd3/hEJ2WCZHjvNplkg6uCMr3sa3X9xvQfVfgloJjZuoOmumiGSDw5bSrBcyOxT7rgEJlkwWyW6KcGolz7Xi13nQIDDaeZKXx6PfnAtUMiZ/YT3Cw4q5F+gBxN678gMjTDfDlE1tjtOkgg6I= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0be070db-6d48-414b-8888-08d793a5ce5a X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:23.8490 (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-CrossTenant-userprincipalname: dPiwf+Cb88ylWZO9ccMrs82qKtFCn3zNhMapC80o9TMAgFCkG/0xkeIvJvIRO88m/D5xt+d2qzXDfBiERM/70A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alex Vesker Function prefix was changed to be similar to other action APIs. In order to support other FW tables the mlx5_flow_table struct was replaced with table id and type. Signed-off-by: Alex Vesker Reviewed-by: Erez Shitrit Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/dr_action.c | 21 ++++++++++++------- .../mellanox/mlx5/core/steering/dr_types.h | 5 +++-- .../mellanox/mlx5/core/steering/fs_dr.c | 6 +++--- .../mellanox/mlx5/core/steering/mlx5dr.h | 8 +++---- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c index 004c56c2fc0c..3e2318761c8c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c @@ -690,9 +690,9 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, /* get the relevant addresses */ if (!action->dest_tbl.fw_tbl.rx_icm_addr) { - ret = mlx5dr_cmd_query_flow_table(action->dest_tbl.fw_tbl.mdev, - action->dest_tbl.fw_tbl.ft->type, - action->dest_tbl.fw_tbl.ft->id, + ret = mlx5dr_cmd_query_flow_table(dmn->mdev, + action->dest_tbl.fw_tbl.type, + action->dest_tbl.fw_tbl.id, &output); if (!ret) { action->dest_tbl.fw_tbl.tx_icm_addr = @@ -982,8 +982,8 @@ mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl) } struct mlx5dr_action * -mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, - struct mlx5_core_dev *mdev) +mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *dmn, + struct mlx5_flow_table *ft) { struct mlx5dr_action *action; @@ -992,8 +992,11 @@ mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, return NULL; action->dest_tbl.is_fw_tbl = 1; - action->dest_tbl.fw_tbl.ft = ft; - action->dest_tbl.fw_tbl.mdev = mdev; + action->dest_tbl.fw_tbl.type = ft->type; + action->dest_tbl.fw_tbl.id = ft->id; + action->dest_tbl.fw_tbl.dmn = dmn; + + refcount_inc(&dmn->refcount); return action; } @@ -1559,7 +1562,9 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action) switch (action->action_type) { case DR_ACTION_TYP_FT: - if (!action->dest_tbl.is_fw_tbl) + if (action->dest_tbl.is_fw_tbl) + refcount_dec(&action->dest_tbl.fw_tbl.dmn->refcount); + else refcount_dec(&action->dest_tbl.tbl->refcount); break; case DR_ACTION_TYP_TNL_L2_TO_L2: diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index de6bfa655326..27f1d931bf9f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -743,10 +743,11 @@ struct mlx5dr_action { union { struct mlx5dr_table *tbl; struct { - struct mlx5_flow_table *ft; + struct mlx5dr_domain *dmn; + u32 id; + enum fs_flow_table_type type; u64 rx_icm_addr; u64 tx_icm_addr; - struct mlx5_core_dev *mdev; } fw_tbl; }; } dest_tbl; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index 8ed0f087b1e0..e51262ec77bb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -184,13 +184,13 @@ static struct mlx5dr_action *create_vport_action(struct mlx5dr_domain *domain, dest_attr->vport.vhca_id); } -static struct mlx5dr_action *create_ft_action(struct mlx5_core_dev *dev, +static struct mlx5dr_action *create_ft_action(struct mlx5dr_domain *domain, struct mlx5_flow_rule *dst) { struct mlx5_flow_table *dest_ft = dst->dest_attr.ft; if (mlx5_dr_is_fw_table(dest_ft->flags)) - return mlx5dr_create_action_dest_flow_fw_table(dest_ft, dev); + return mlx5dr_action_create_dest_flow_fw_table(domain, dest_ft); return mlx5dr_action_create_dest_table(dest_ft->fs_dr_table.dr_table); } @@ -373,7 +373,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, actions[num_actions++] = tmp_action; break; case MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE: - tmp_action = create_ft_action(dev, dst); + tmp_action = create_ft_action(domain, dst); if (!tmp_action) { err = -ENOMEM; goto free_actions; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h index fb3ac697df1b..932362d89c66 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h @@ -75,8 +75,8 @@ struct mlx5dr_action * mlx5dr_action_create_dest_table(struct mlx5dr_table *table); struct mlx5dr_action * -mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, - struct mlx5_core_dev *mdev); +mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain, + struct mlx5_flow_table *ft); struct mlx5dr_action * mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, @@ -165,8 +165,8 @@ static inline struct mlx5dr_action * mlx5dr_action_create_dest_table(struct mlx5dr_table *table) { return NULL; } static inline struct mlx5dr_action * -mlx5dr_create_action_dest_flow_fw_table(struct mlx5_flow_table *ft, - struct mlx5_core_dev *mdev) { return NULL; } +mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *domain, + struct mlx5_flow_table *ft) { return NULL; } static inline struct mlx5dr_action * mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, From patchwork Tue Jan 7 19:14:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219037 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="anPPMWqb"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrw3zftz9sPK for ; Wed, 8 Jan 2020 06:14:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728809AbgAGTOj (ORCPT ); Tue, 7 Jan 2020 14:14:39 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728784AbgAGTOj (ORCPT ); Tue, 7 Jan 2020 14:14:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mTxQ3winTJG290zUd78yRHyXEqFLyNoGdVw+Qwyd1hX7k/YOMfZMb1V5426QAmCsyCsEHNwSXreMYyXtN6I7+Nbic/jvEHCV+6uHKJDLTwpcqFC0tX8nVOLCkDW5iOaTOkPyTG1cG1D9ywNb+uAY5S1X3ixcC0x1sz9WHuALO6KPOe1vwNKiS2AyEQn3PI59WIjbAPp3eaaCDUr8P5faHbzSENAz+RSi7wbK6MGWBz0k1aLWZbrxUebOp6mO5tKLnFvJZZLQidcZbhZkXTpba6jmn2Tl51MxFq6fKos5tjeLrlbYlvxKFFKpNlyW/cC2DVFbiTDJ70DOrKm8ePmNLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l/6TTsaN0d8Y8pOZUlgOzAyL45UinA+L58UjzVQZ8jY=; b=PrVesY6g/h2awuX32TjOc+W1ErwBy/v2SqldOw/KahjEXBCtek0yQvBs4S0gvSTxFaxgeUdB8YbSvdBK9eNdoDUYJZFbJErQ0PWw0E3keMran1zU5Eza70zX1ZXf8dHQMlxlG+rGVI5uMZIoUESLRBhbzAhHuscNfIwwW/LrIgn93jGH+4caY9iXR3EX1EbLYOU0+ynY5uFcgVNDmZ6GhrNIV1m819FSlBYITPfF1A+PSYPpfRXkk4wPt7FqgUUCcTkdaRWloV/kz6/BloDGU1934co57OmYRqUIYQAmYJf2QRpu06VJDOMO+w5ATOXSAQXaLrAfdA+sKAc6f8lufg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=l/6TTsaN0d8Y8pOZUlgOzAyL45UinA+L58UjzVQZ8jY=; b=anPPMWqbag3RCc6qwEeFDcrTWTz3jTxl4H3VT5mOZskVe//IkT/9H5nQXmH9/6RpNO06rcddRNaYgH7zzulOjm3HCbqo6JSJ61dz5opgIGrxUaJ978TXXB7hcq+Y6IBa7Ou8sgex1wx/yoGQ96fOF1MNS1YYycX4e8ZDw39LeNo= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:25 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:25 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:24 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Alex Vesker , Saeed Mahameed Subject: [net-next 12/13] net/mlx5: DR, Add support for multiple destination table action Thread-Topic: [net-next 12/13] net/mlx5: DR, Add support for multiple destination table action Thread-Index: AQHVxY6s5ZJIKES1Pka//Hmhn6JJWg== Date: Tue, 7 Jan 2020 19:14:25 +0000 Message-ID: <20200107191335.12272-13-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ff221664-7e37-4020-5da3-08d793a5cf47 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:326; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: QXZGv43DZeB/j71BIRTbDm6/k9KIat8Q9m+HNp+fI9wv8k3OpGHtIrp4tCGPLBsnrqP6OjUGQpKzlKZM75J0rEPbObtx5AVDkrhaXvieSwi7PJpF/GKT/jDm1RJMAR4GzEONnwzmN6quK8xybxyquLmWKfGbzMdPSJ/Ne6nS9XEZY1Knwf3bhUqJ3wKmLK08wjbugKZ734rt7nJIghQiEjcFE7eWo3gW7bbKu81/o97hppFns5fmpzVk8PkIJo3Tjpf7RObG44V2MvkPt4+JmIaaX96k4HIKfAC4zI5rVxiGPSUpveIKqSXlFZplRA5QK/YHfEUW+XG5Y3fsMdZO90NJvliy/Pvhq7GJ5pVYC4TRwMHKA3c7Eqv2FvicKGvxdIEzdzc3q7Uop1ngA9DNUkdHWuziuj4bc0dD2U9DE5JDXje/dPrRbVFeCTBXsBya21C3KUElRAg8haiaqF/5wgpS2pd2SjEbML/DOB2kIv3va1hbO07fZZlTSi0CgosICXQbnjkIughMHoQM0xRKK9nMWu4HrK58l2X9FlsjWIY= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff221664-7e37-4020-5da3-08d793a5cf47 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:25.3861 (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-CrossTenant-userprincipalname: vMlb+Lw2djJb+lBojbySjmhssfJmjfL4tw0csrFqpHJML6ToAaPTUWjJyb/kGHOKYI+LXv41mGDG3Kcebt2koA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alex Vesker A multiple destination table action allows HW packet duplication to multiple destinations, this is useful for multicast or mirroring traffic for debug. Duplicating is done using a FW flow table with multiple destinations. The new action creation function, mlx5dr_action_create_mult_dest_tbl will allow creating a single table to iterate over several dr actions. Signed-off-by: Alex Vesker Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/dr_action.c | 114 ++++++++++++++++++ .../mellanox/mlx5/core/steering/dr_types.h | 3 + .../mellanox/mlx5/core/steering/mlx5dr.h | 15 +++ 3 files changed, 132 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c index 3e2318761c8c..9359eed10889 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c @@ -981,6 +981,104 @@ mlx5dr_action_create_dest_table(struct mlx5dr_table *tbl) return NULL; } +struct mlx5dr_action * +mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn, + struct mlx5dr_action_dest *dests, + u32 num_of_dests) +{ + struct mlx5dr_cmd_flow_destination_hw_info *hw_dests; + struct mlx5dr_action **ref_actions; + struct mlx5dr_action *action; + bool reformat_req = false; + u32 num_of_ref = 0; + int ret; + int i; + + if (dmn->type != MLX5DR_DOMAIN_TYPE_FDB) { + mlx5dr_err(dmn, "Multiple destination support is for FDB only\n"); + return NULL; + } + + hw_dests = kzalloc(sizeof(*hw_dests) * num_of_dests, GFP_KERNEL); + if (!hw_dests) + return NULL; + + ref_actions = kzalloc(sizeof(*ref_actions) * num_of_dests * 2, GFP_KERNEL); + if (!ref_actions) + goto free_hw_dests; + + for (i = 0; i < num_of_dests; i++) { + struct mlx5dr_action *reformat_action = dests[i].reformat; + struct mlx5dr_action *dest_action = dests[i].dest; + + ref_actions[num_of_ref++] = dest_action; + + switch (dest_action->action_type) { + case DR_ACTION_TYP_VPORT: + hw_dests[i].vport.flags = MLX5_FLOW_DEST_VPORT_VHCA_ID; + hw_dests[i].type = MLX5_FLOW_DESTINATION_TYPE_VPORT; + hw_dests[i].vport.num = dest_action->vport.caps->num; + hw_dests[i].vport.vhca_id = dest_action->vport.caps->vhca_gvmi; + if (reformat_action) { + reformat_req = true; + hw_dests[i].vport.reformat_id = + reformat_action->reformat.reformat_id; + ref_actions[num_of_ref++] = reformat_action; + hw_dests[i].vport.flags |= MLX5_FLOW_DEST_VPORT_REFORMAT_ID; + } + break; + + case DR_ACTION_TYP_FT: + hw_dests[i].type = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE; + if (dest_action->dest_tbl.is_fw_tbl) + hw_dests[i].ft_id = dest_action->dest_tbl.fw_tbl.id; + else + hw_dests[i].ft_id = dest_action->dest_tbl.tbl->table_id; + break; + + default: + mlx5dr_dbg(dmn, "Invalid multiple destinations action\n"); + goto free_ref_actions; + } + } + + action = dr_action_create_generic(DR_ACTION_TYP_FT); + if (!action) + goto free_ref_actions; + + ret = mlx5dr_fw_create_md_tbl(dmn, + hw_dests, + num_of_dests, + reformat_req, + &action->dest_tbl.fw_tbl.id, + &action->dest_tbl.fw_tbl.group_id); + if (ret) + goto free_action; + + refcount_inc(&dmn->refcount); + + for (i = 0; i < num_of_ref; i++) + refcount_inc(&ref_actions[i]->refcount); + + action->dest_tbl.is_fw_tbl = true; + action->dest_tbl.fw_tbl.dmn = dmn; + action->dest_tbl.fw_tbl.type = FS_FT_FDB; + action->dest_tbl.fw_tbl.ref_actions = ref_actions; + action->dest_tbl.fw_tbl.num_of_ref_actions = num_of_ref; + + kfree(hw_dests); + + return action; + +free_action: + kfree(action); +free_ref_actions: + kfree(ref_actions); +free_hw_dests: + kfree(hw_dests); + return NULL; +} + struct mlx5dr_action * mlx5dr_action_create_dest_flow_fw_table(struct mlx5dr_domain *dmn, struct mlx5_flow_table *ft) @@ -1566,6 +1664,22 @@ int mlx5dr_action_destroy(struct mlx5dr_action *action) refcount_dec(&action->dest_tbl.fw_tbl.dmn->refcount); else refcount_dec(&action->dest_tbl.tbl->refcount); + + if (action->dest_tbl.is_fw_tbl && + action->dest_tbl.fw_tbl.num_of_ref_actions) { + struct mlx5dr_action **ref_actions; + int i; + + ref_actions = action->dest_tbl.fw_tbl.ref_actions; + for (i = 0; i < action->dest_tbl.fw_tbl.num_of_ref_actions; i++) + refcount_dec(&ref_actions[i]->refcount); + + kfree(ref_actions); + + mlx5dr_fw_destroy_md_tbl(action->dest_tbl.fw_tbl.dmn, + action->dest_tbl.fw_tbl.id, + action->dest_tbl.fw_tbl.group_id); + } break; case DR_ACTION_TYP_TNL_L2_TO_L2: refcount_dec(&action->reformat.dmn->refcount); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h index 27f1d931bf9f..0fc52d634e10 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_types.h @@ -745,9 +745,12 @@ struct mlx5dr_action { struct { struct mlx5dr_domain *dmn; u32 id; + u32 group_id; enum fs_flow_table_type type; u64 rx_icm_addr; u64 tx_icm_addr; + struct mlx5dr_action **ref_actions; + u32 num_of_ref_actions; } fw_tbl; }; } dest_tbl; diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h index 932362d89c66..e1edc9c247b7 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/mlx5dr.h @@ -33,6 +33,11 @@ struct mlx5dr_match_parameters { u64 *match_buf; /* Device spec format */ }; +struct mlx5dr_action_dest { + struct mlx5dr_action *dest; + struct mlx5dr_action *reformat; +}; + #ifdef CONFIG_MLX5_SW_STEERING struct mlx5dr_domain * @@ -83,6 +88,11 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, u32 vport, u8 vhca_id_valid, u16 vhca_id); +struct mlx5dr_action * +mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn, + struct mlx5dr_action_dest *dests, + u32 num_of_dests); + struct mlx5dr_action *mlx5dr_action_create_drop(void); struct mlx5dr_action *mlx5dr_action_create_tag(u32 tag_value); @@ -173,6 +183,11 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *domain, u32 vport, u8 vhca_id_valid, u16 vhca_id) { return NULL; } +static inline struct mlx5dr_action * +mlx5dr_action_create_mult_dest_tbl(struct mlx5dr_domain *dmn, + struct mlx5dr_action_dest *dests, + u32 num_of_dests) { return NULL; } + static inline struct mlx5dr_action * mlx5dr_action_create_drop(void) { return NULL; } From patchwork Tue Jan 7 19:14:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 1219039 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=mellanox.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=Mellanox.com header.i=@Mellanox.com header.b="DVjoPEr0"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 47shrz5hyKz9s29 for ; Wed, 8 Jan 2020 06:14:43 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728811AbgAGTOm (ORCPT ); Tue, 7 Jan 2020 14:14:42 -0500 Received: from mail-vi1eur05on2055.outbound.protection.outlook.com ([40.107.21.55]:6105 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728806AbgAGTOl (ORCPT ); Tue, 7 Jan 2020 14:14:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MapqW7CyIlvRZU4e1RN7mWyM3tbb+nZcrG6PBLTwNyHKGNGQ7SwgpkAq4oXrzc06OXANjlcOp5lOrCvzMFIRvap4YDQug+NYl+LRgvm8lIboUO47rCPH5CZX7OJXgwaIkIgP6YFKGaXQt7orOOAcxezyS7MbSsukogVj7yFeJx/pdQnjQSfI+WqhRCTnH0AwVgFiullKrG8KbWwZ/1kBwqtSwn+MRDd2jlaecp04zDEuDC0whDZLhqVuX6xMKjwGYuff7/a3WFMjnt+Yx9DIduGJ97vlQtqkAMY0nQCZjpcp4em1xL/3AjAsPiDRB8dASGvmxvjYmjq3c7XzSTXq4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DolsK9eB3G6xWUF1qYvoMnTT7t3FpOq0yUuFLxxOOMA=; b=GhFnTh89v9ZPqoqspAEXmT4dTAo0dKAoxK0B/mDG9rG3yOQtyauek5wttAQ+AkNqnVlyCo15FjFEdhTkeD0cAgTPBGbdl3betmQEtIdVB+7n3XfLNyLWSsQSQ+I1y/PMrCwVyBFJvd+1maFGKX5kdDjEaPJlhCtmjlqQ0JpwbWZGDsmfvl0OXLe/khjWVLgAucTDe0SOsXBOtQ3moGEkPFNTZ15/e7AfgJ1UY+HUXvaz7nDWOG97xzmbLaQk/caJ5Pxrsz62FqU2JLwcJu2NTY7p+3CS7g5EcA2Y2PVTg9MRt9g6heuct/tM9RZeiuxQTbtI0Nw6r6DDM9Dh8M1fkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=DolsK9eB3G6xWUF1qYvoMnTT7t3FpOq0yUuFLxxOOMA=; b=DVjoPEr0FYJK4G8yBObeSX8Wr0Jvf/U0rsZzVIZHeNWyfy8l+Q00sADZFPnHd3Ja3illEGiDVQla7CCj4pk/WOmAteUObRlsad4+Qvu56ttmQFO6Mfe6tf0CgRaq4q2KXSFprmG++y54wr9jvVkqQO0LSWb6KIcuyc3EgHmS0UM= Received: from AM6PR05MB5094.eurprd05.prod.outlook.com (20.177.34.93) by AM6PR05MB5411.eurprd05.prod.outlook.com (20.177.189.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.11; Tue, 7 Jan 2020 19:14:27 +0000 Received: from AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a]) by AM6PR05MB5094.eurprd05.prod.outlook.com ([fe80::d9f3:f3b8:86b2:a40a%7]) with mapi id 15.20.2602.015; Tue, 7 Jan 2020 19:14:27 +0000 Received: from smtp.office365.com (209.116.155.178) by BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2581.12 via Frontend Transport; Tue, 7 Jan 2020 19:14:25 +0000 From: Saeed Mahameed To: "David S. Miller" CC: "netdev@vger.kernel.org" , Alex Vesker , Saeed Mahameed Subject: [net-next 13/13] net/mlx5: DR, Create multiple destination action from dr_create_fte Thread-Topic: [net-next 13/13] net/mlx5: DR, Create multiple destination action from dr_create_fte Thread-Index: AQHVxY6t/QfdqUAmoESHd2bg67aCtA== Date: Tue, 7 Jan 2020 19:14:27 +0000 Message-ID: <20200107191335.12272-14-saeedm@mellanox.com> References: <20200107191335.12272-1-saeedm@mellanox.com> In-Reply-To: <20200107191335.12272-1-saeedm@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.24.1 x-originating-ip: [209.116.155.178] x-clientproxiedby: BYAPR06CA0068.namprd06.prod.outlook.com (2603:10b6:a03:14b::45) To AM6PR05MB5094.eurprd05.prod.outlook.com (2603:10a6:20b:9::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=saeedm@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: b63c0b21-dcc5-47ca-7c4f-08d793a5d036 x-ms-traffictypediagnostic: AM6PR05MB5411:|AM6PR05MB5411: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-forefront-prvs: 027578BB13 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(366004)(136003)(346002)(39860400002)(376002)(199004)(189003)(81166006)(52116002)(6916009)(8936002)(81156014)(8676002)(26005)(86362001)(36756003)(316002)(5660300002)(107886003)(6506007)(4326008)(478600001)(1076003)(16526019)(956004)(2616005)(2906002)(66446008)(64756008)(66556008)(66476007)(71200400001)(66946007)(6486002)(6512007)(54906003)(186003)(54420400002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR05MB5411; H:AM6PR05MB5094.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-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8yDRAJh6cq2eBsNiMZgr/8AoVMlC/oKu5d6lgEzYcNKFh2ktzlK426whiFPCfoeXzJUnXFtiNsN1126Ae1OW7U6BXEAXnW78ka5hg2qvNiLOoVXI8mNOwfyd1pwEurAMJhG/pep5Ep8CaKI3GRuLrkEYWDOQAEcOEfrKSlkW2NDn5SYndjDqiDUzJJ2CwYF6agpkDDhMOFQ3XE5mg+TLS0sZjzlNdf/d2uhzUWua1xa+beKWj7+mXigr7rCumNB3Di49WLVoqxYoKL+ytLVydmx0rUpkPMKnQRdcYTWYYHrPROtK3Vkl48AGIZupUgucH+PWzfkbaQlw35w5bLHGzA4uw5+93cfu1M9qntfqyv5ftktehfO+CdPolfsm5PrWXCVKAEQkY8PUhbGXlkYneA0wNuljlkp6xFicE2Y0ueYbRlQr1eK+A/0NwcMJ1mpbG1BldM07lMgnuEbV5+oseTBVQMIXbQ+IrpGlHA/Ylr9BtMZKOYGYOV2/U0LFEl6GyOoISeESam+b37Csi9CTsUvgHhImYJKAPEpFTNaaPYE= MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b63c0b21-dcc5-47ca-7c4f-08d793a5d036 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2020 19:14:27.1531 (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-CrossTenant-userprincipalname: iROgoplhEXCrHVHHviBS3iE4QoRK1uEFTT6h70f/6ghLr6qxycawpSRKgN1xEn2Y/TkIQ+Y56BXrdIGqDlcpww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5411 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alex Vesker Until now it was possible to pass a packet to a single destination such as vport or flow table. With the new support if multiple vports or multiple tables are provided as destinations, fs_dr will create a multiple destination table action, this action should replace other destination actions provided to mlx5dr_create_rule. Each vport destination can be provided with a reformat actions which will be done before forwarding the packet to the vport. Signed-off-by: Alex Vesker Signed-off-by: Saeed Mahameed --- .../mellanox/mlx5/core/steering/fs_dr.c | 88 +++++++++++++++---- 1 file changed, 72 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c index e51262ec77bb..b43275cde8bf 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/fs_dr.c @@ -206,6 +206,12 @@ static struct mlx5dr_action *create_action_push_vlan(struct mlx5dr_domain *domai return mlx5dr_action_create_push_vlan(domain, htonl(vlan_hdr)); } +static bool contain_vport_reformat_action(struct mlx5_flow_rule *dst) +{ + return dst->dest_attr.type == MLX5_FLOW_DESTINATION_TYPE_VPORT && + dst->dest_attr.vport.flags & MLX5_FLOW_DEST_VPORT_REFORMAT_ID; +} + #define MLX5_FLOW_CONTEXT_ACTION_MAX 20 static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, struct mlx5_flow_table *ft, @@ -213,7 +219,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, struct fs_fte *fte) { struct mlx5dr_domain *domain = ns->fs_dr_domain.dr_domain; - struct mlx5dr_action *term_action = NULL; + struct mlx5dr_action_dest *term_actions; struct mlx5dr_match_parameters params; struct mlx5_core_dev *dev = ns->dev; struct mlx5dr_action **fs_dr_actions; @@ -223,6 +229,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, struct mlx5dr_rule *rule; struct mlx5_flow_rule *dst; int fs_dr_num_actions = 0; + int num_term_actions = 0; int num_actions = 0; size_t match_sz; int err = 0; @@ -233,18 +240,38 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, sizeof(*actions), GFP_KERNEL); - if (!actions) - return -ENOMEM; + if (!actions) { + err = -ENOMEM; + goto out_err; + } fs_dr_actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, sizeof(*fs_dr_actions), GFP_KERNEL); if (!fs_dr_actions) { - kfree(actions); - return -ENOMEM; + err = -ENOMEM; + goto free_actions_alloc; + } + + term_actions = kcalloc(MLX5_FLOW_CONTEXT_ACTION_MAX, + sizeof(*term_actions), GFP_KERNEL); + if (!term_actions) { + err = -ENOMEM; + goto free_fs_dr_actions_alloc; } match_sz = sizeof(fte->val); + /* Drop reformat action bit if destination vport set with reformat */ + if (fte->action.action & MLX5_FLOW_CONTEXT_ACTION_FWD_DEST) { + list_for_each_entry(dst, &fte->node.children, node.list) { + if (!contain_vport_reformat_action(dst)) + continue; + + fte->action.action &= ~MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT; + break; + } + } + /* The order of the actions are must to be keep, only the following * order is supported by SW steering: * TX: push vlan -> modify header -> encap @@ -335,7 +362,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, goto free_actions; } fs_dr_actions[fs_dr_num_actions++] = tmp_action; - term_action = tmp_action; + term_actions[num_term_actions++].dest = tmp_action; } if (fte->flow_context.flow_tag) { @@ -354,7 +381,8 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, enum mlx5_flow_destination_type type = dst->dest_attr.type; u32 id; - if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX) { + if (num_actions == MLX5_FLOW_CONTEXT_ACTION_MAX || + num_term_actions >= MLX5_FLOW_CONTEXT_ACTION_MAX) { err = -ENOSPC; goto free_actions; } @@ -379,7 +407,7 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, goto free_actions; } fs_dr_actions[fs_dr_num_actions++] = tmp_action; - term_action = tmp_action; + term_actions[num_term_actions++].dest = tmp_action; break; case MLX5_FLOW_DESTINATION_TYPE_VPORT: tmp_action = create_vport_action(domain, dst); @@ -388,7 +416,14 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, goto free_actions; } fs_dr_actions[fs_dr_num_actions++] = tmp_action; - term_action = tmp_action; + term_actions[num_term_actions].dest = tmp_action; + + if (dst->dest_attr.vport.flags & + MLX5_FLOW_DEST_VPORT_REFORMAT_ID) + term_actions[num_term_actions].reformat = + dst->dest_attr.vport.pkt_reformat->action.dr_action; + + num_term_actions++; break; default: err = -EOPNOTSUPP; @@ -399,9 +434,22 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, params.match_sz = match_sz; params.match_buf = (u64 *)fte->val; - - if (term_action) - actions[num_actions++] = term_action; + if (num_term_actions == 1) { + if (term_actions->reformat) + actions[num_actions++] = term_actions->reformat; + + actions[num_actions++] = term_actions->dest; + } else if (num_term_actions > 1) { + tmp_action = mlx5dr_action_create_mult_dest_tbl(domain, + term_actions, + num_term_actions); + if (!tmp_action) { + err = -EOPNOTSUPP; + goto free_actions; + } + fs_dr_actions[fs_dr_num_actions++] = tmp_action; + actions[num_actions++] = tmp_action; + } rule = mlx5dr_rule_create(group->fs_dr_matcher.dr_matcher, ¶ms, @@ -412,7 +460,9 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, goto free_actions; } + kfree(term_actions); kfree(actions); + fte->fs_dr_rule.dr_rule = rule; fte->fs_dr_rule.num_actions = fs_dr_num_actions; fte->fs_dr_rule.dr_actions = fs_dr_actions; @@ -420,13 +470,18 @@ static int mlx5_cmd_dr_create_fte(struct mlx5_flow_root_namespace *ns, return 0; free_actions: - for (i = 0; i < fs_dr_num_actions; i++) + /* Free in reverse order to handle action dependencies */ + for (i = fs_dr_num_actions - 1; i >= 0; i--) if (!IS_ERR_OR_NULL(fs_dr_actions[i])) mlx5dr_action_destroy(fs_dr_actions[i]); - mlx5_core_err(dev, "Failed to create dr rule err(%d)\n", err); - kfree(actions); + kfree(term_actions); +free_fs_dr_actions_alloc: kfree(fs_dr_actions); +free_actions_alloc: + kfree(actions); +out_err: + mlx5_core_err(dev, "Failed to create dr rule err(%d)\n", err); return err; } @@ -533,7 +588,8 @@ static int mlx5_cmd_dr_delete_fte(struct mlx5_flow_root_namespace *ns, if (err) return err; - for (i = 0; i < rule->num_actions; i++) + /* Free in reverse order to handle action dependencies */ + for (i = rule->num_actions - 1; i >= 0; i--) if (!IS_ERR_OR_NULL(rule->dr_actions[i])) mlx5dr_action_destroy(rule->dr_actions[i]);