From patchwork Wed Oct 3 01:56:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 45915 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A69C42C24; Wed, 3 Oct 2018 03:56:57 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by dpdk.org (Postfix) with ESMTP id 010812BE3 for ; Wed, 3 Oct 2018 03:56:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eVlADM6JQfirdfW7QqpBKjUMGDmu31ed3fxvum/2WjA=; b=LC4XobMX3nMTS501Sxsj8XrmoNT9/gNgo3xj1/7dKmku1LXoe8wPCGHZochv2Wirzu6iG4AfUQjD6vLDW2VFIPvOVbfv8/05nYIM4FzA7XLr53UwAF8eJwOfyQzIguIz9cjpohRVWAOf5GhE9mTJ9EIUBj1qUF0oZZRqIwze8h4= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4057.eurprd05.prod.outlook.com (52.134.67.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Wed, 3 Oct 2018 01:56:53 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Wed, 3 Oct 2018 01:56:52 +0000 From: Yongseok Koh To: Adrien Mazarguil , Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [PATCH 1/2] ethdev: add jump action to description table Thread-Index: AQHUWrxa1kMkTLJIXEODk6vyJuUKsQ== Date: Wed, 3 Oct 2018 01:56:52 +0000 Message-ID: <20181003015640.36306-2-yskoh@mellanox.com> References: <20181003015640.36306-1-yskoh@mellanox.com> In-Reply-To: <20181003015640.36306-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DM5PR21CA0034.namprd21.prod.outlook.com (2603:10b6:3:ed::20) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4057; 6:kBi3zWmcw/PDpQBKrV+3V1xg67KKHvN+bKD2msyB1nDx2sowxb/jjeXfaORAndM53oIvNvFBiVPqHeSz2P00u4avF8UVujDJ3aetQJwS2W+S7LiOhN/hj2k+U5CyAiHwAxKdySSmEGg8BEMI2Mze7QRMeVcE2hqUmFSuLOXNGPf3GDqay9qmnzJPmg013/bh4TSRtAZxSik29y8wIPcOCL5ZieVgwlgoTlT5gaKwGGR6F9dhzssojfgrlAUMxa1i+18C5FC4FaRoOCcaeelvGL15Wypo5tkViWPm/t1sbqs7jl/NYL+yYFB+Tqk7dU1cp0E4wEFd/DCie3UWi8fdleyCPpEGurM6nqYbhQNsQbl34DSQzgg9Sg2mHK/rDsTloYg4RRUkGlAeMMAvK82Aq0MsrrDRB9SQLUvKR5eWY3GCzn+8ytWQkmwI1kyxw0V3i/bw4xDu7e+vAUTGS+A1fw==; 5:z6Ryi7ftdAOaxBbmhTYdqr5+lDyDC8ud9clkff5fZi2vJra0071JZd3L5yBZEwBqmdvuSgXsYr1yZoFBuq6D7Q8+bi0On3RTvdYET6swPMtjR6MPOImoc0SFn+V59WzMj1eEVaV+CUsQduwa7ugvrRkehL3x/g3ie8G6F8gGnEE=; 7:pD0Mmn4wLLLoHJvaqxCbxYsMRArJ0mu1ajSoB2QHItdaXQboUhSxy/UPDTLcN2LiZilbWaiKcPRBATanJA+4Ky8EvWhYPT0Xml6CcRyiSb2RA/TUFIoLXFjOvGu7sgI65Mf7eAFtvpN1dtSloiiqVk/LsWTxQgttbUfhHZcV6ny+NuJ1WCNM7zfp3b2hNT3mPOGMNwn1W2gzSEU8KNrMJJWf7suenyxjRfO7V2JHmcB+oBkNwpocmWPvlh66EZBb x-ms-office365-filtering-correlation-id: 7993527a-2b1b-436b-288f-08d628d37cf2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4057; x-ms-traffictypediagnostic: DB3PR0502MB4057: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:DB3PR0502MB4057; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4057; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(346002)(39860400002)(366004)(376002)(199004)(189003)(8936002)(316002)(256004)(6116002)(2906002)(6486002)(14444005)(76176011)(71190400001)(99286004)(14454004)(3846002)(386003)(6506007)(5250100002)(186003)(26005)(71200400001)(1076002)(36756003)(52116002)(54906003)(110136005)(2616005)(476003)(446003)(6436002)(478600001)(11346002)(486006)(7736002)(25786009)(102836004)(105586002)(106356001)(68736007)(5660300001)(8676002)(81156014)(81166006)(107886003)(97736004)(4326008)(6636002)(6512007)(66066001)(86362001)(53936002)(305945005)(2900100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4057; H:DB3PR0502MB3980.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-microsoft-antispam-message-info: +aCKMljS0adddfrn4MlLgShgx+ewPX2n46UItMyIzzIkJXSg5M06VQVb1pt00Jsk++AAGmxau5YH7yOXIXGpKNjLHHDlNB0nlQc1t8eIt6JIBLYOGUtvWO4cnjYbnkLia99YBruKYsP4RGcQXsFaV/psluIz52HXOZVE4SZgbcbuP+rE2ngFvXeOp8oZ3FnVCL9epqKIg9Cp/Ryy/onkROX4ZWUKlsO2EgLVnUIra1kSwtb/F+wD0+2jLhGDxnzDNB90FXrWI4Un82HLbY07tXoBv+5OFuEEw9fSkWnChTs3lmu3iz/YMC5fmM09oC23yy67HhYihOUEN52KW8ww5kfdWm/TYvc3iMxpUTrLy3Y= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7993527a-2b1b-436b-288f-08d628d37cf2 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 01:56:52.7775 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4057 Subject: [dpdk-dev] [PATCH 1/2] ethdev: add jump action to description table X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Yongseok Koh --- app/test-pmd/config.c | 2 +- lib/librte_ethdev/rte_flow.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 794aa5268..641ac5e17 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -1141,7 +1141,7 @@ static const struct { MK_FLOW_ACTION(END, 0), MK_FLOW_ACTION(VOID, 0), MK_FLOW_ACTION(PASSTHRU, 0), - MK_FLOW_ACTION(JUMP, 0), + MK_FLOW_ACTION(JUMP, sizeof(struct rte_flow_action_jump)), MK_FLOW_ACTION(MARK, sizeof(struct rte_flow_action_mark)), MK_FLOW_ACTION(FLAG, 0), MK_FLOW_ACTION(QUEUE, sizeof(struct rte_flow_action_queue)), diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c index cff4b5209..00ed67b5a 100644 --- a/lib/librte_ethdev/rte_flow.c +++ b/lib/librte_ethdev/rte_flow.c @@ -80,6 +80,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { MK_FLOW_ACTION(END, 0), MK_FLOW_ACTION(VOID, 0), MK_FLOW_ACTION(PASSTHRU, 0), + MK_FLOW_ACTION(JUMP, sizeof(struct rte_flow_action_jump)), MK_FLOW_ACTION(MARK, sizeof(struct rte_flow_action_mark)), MK_FLOW_ACTION(FLAG, 0), MK_FLOW_ACTION(QUEUE, sizeof(struct rte_flow_action_queue)), From patchwork Wed Oct 3 01:56:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongseok Koh X-Patchwork-Id: 45917 X-Patchwork-Delegate: shahafs@mellanox.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4D2143237; Wed, 3 Oct 2018 03:57:01 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80085.outbound.protection.outlook.com [40.107.8.85]) by dpdk.org (Postfix) with ESMTP id 3D4402BF9 for ; Wed, 3 Oct 2018 03:56:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sgY79lgj519uDLcZmvEBjMCh2NamRXao7LGzZN8rf+E=; b=SZ3E4Fpx9OfeMx9t7e9h7bIOL/63UaoLx9BaBmqcqgC80jPL1Cg9KKKRcV2ugnjxv4vgYhJ+aocmub3kUw9iS8M1fzjguyMnwZn3vXlIKseK0riW6lzWgXsp3UZDH5+7kqx0zUcKsbI68FoULXshUHWM1UAMQZV8lyeImwFUjiE= Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com (52.134.72.27) by DB3PR0502MB4057.eurprd05.prod.outlook.com (52.134.67.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Wed, 3 Oct 2018 01:56:54 +0000 Received: from DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045]) by DB3PR0502MB3980.eurprd05.prod.outlook.com ([fe80::1cb0:661b:ecab:6045%2]) with mapi id 15.20.1185.024; Wed, 3 Oct 2018 01:56:54 +0000 From: Yongseok Koh To: Adrien Mazarguil , Shahaf Shuler CC: "dev@dpdk.org" , Yongseok Koh Thread-Topic: [PATCH 2/2] net/mlx5: support multiple groups and jump action Thread-Index: AQHUWrxbzfQXY4uX5kWMXNWDWFgDlg== Date: Wed, 3 Oct 2018 01:56:54 +0000 Message-ID: <20181003015640.36306-3-yskoh@mellanox.com> References: <20181003015640.36306-1-yskoh@mellanox.com> In-Reply-To: <20181003015640.36306-1-yskoh@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DM5PR21CA0034.namprd21.prod.outlook.com (2603:10b6:3:ed::20) To DB3PR0502MB3980.eurprd05.prod.outlook.com (2603:10a6:8:10::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DB3PR0502MB4057; 6:lIK+fStF6ZNMb3X5LqaqIQZW4t2AvJGG7E2Yl3vmDn5veH9XPA2WhWt8LjsefU2WqAVZu/dRjHvCiiG0/q53xiqkylQfVDvPUsVKiTJcqKKyUZqTN5MTAlpniV5ZOZSab9L24bZb5eDhHov2kYEXAgUWUte787SGONqfA+qi5yDsSK/xjkFACwrKAwrtiqDJ6PU6BAIi0+MpuHDKg+0wWhb+7aAsM3NMhdg+Hz216XrJoSFT6W/VtDTLz1Vf8NCA/udDWL6z02IbLFQB49nLlJ7NgS7OTI3F3fnR3/PQawx0BksHNk1FXHhrw3zWqvTKCq2WYJGzcR0iMiYQ7hBq03WjvpOpVAjLQT2KUUQ9WVYnMbjiQIar1zsNfEVNCbEc9NvQikJFJamk9/kHO25k0reJXchDjeHV/FF2BE8rVnWRR0GXfY1NR8mF/7eRyFFwolQ90s8QFC96BcJ7b/Ji7w==; 5:OhrzGnMsjmHK/Rkytgj0NaeB7UZBAKcrlybpWnAPgsXx05a7E28q7YHUX1lJn8pLzFxXpE0w+lAne+GkSyMG1oakIEpJC/Oot1cedzAUlpZkhoneZxaQiXHensmiD9Qikwe49YeXBvqF0UShWbQ397yTH6wdMXE74Cgv7HHrulM=; 7:e52GEiIc2Y+8/7Qi/dpx6eHAjVjMFsDbPVfu+Zoz7Z6Ai5a2WyIfDYKRhHjzMfbkM5332Za9HzUt5Y/DE3x50hf/o99HrVFKAh3TG0BwL/ZJRBXKb0Q1nTYhX2ZIsmMhsbCsfH9HAUwXfsCEQOc5yauTi9MnPW+6GdcPrlZCv6vEejv24qqVdaZjo8Sa21NE/IJrHS6pzdRxuP8ju1qjLToRTQH5faMO2AftTo1IW9lhGSAuIrZFEuxsn/ogDVE4 x-ms-office365-filtering-correlation-id: 58536b5f-e0f9-4992-10cb-08d628d37e1c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0502MB4057; x-ms-traffictypediagnostic: DB3PR0502MB4057: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(6055026)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:DB3PR0502MB4057; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0502MB4057; x-forefront-prvs: 0814A2C7A3 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(136003)(346002)(39860400002)(366004)(376002)(199004)(189003)(8936002)(316002)(256004)(6116002)(2906002)(6486002)(14444005)(76176011)(71190400001)(99286004)(14454004)(3846002)(386003)(6506007)(5250100002)(186003)(26005)(71200400001)(1076002)(36756003)(52116002)(54906003)(110136005)(2616005)(476003)(446003)(6436002)(478600001)(11346002)(486006)(7736002)(25786009)(102836004)(105586002)(106356001)(68736007)(5660300001)(8676002)(81156014)(81166006)(107886003)(97736004)(4326008)(6636002)(6512007)(66066001)(86362001)(53936002)(305945005)(2900100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0502MB4057; H:DB3PR0502MB3980.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-microsoft-antispam-message-info: CX+Th3o99SgYgRt4LMh2X/g4w7SxcSXVR9vclrCixobGLh0DwPSWcYWBl8CO4RnLxv5cVQZ6GpDHl7+XN0wF70VSiLNZTbyQV/dkQnJK4Lb306Ooujw+fLDyrt4EsgyLT+3c5/aBf9UMpMf4PWjQBqfuvYoiDPzQVz/z/kiavNu8bW15KMf3p8QMgK8iIQwW5pY1fufKoYiqXkqs7j7ZdZjMuKZtALFsd3y3dMGIo/xvrSTAFb9T/VDzON5xaK4+TZYITcgPfsOkCLUburtWA/YHJ5Xzbc9b/1Gox+1IugTjUoPtbpoLk08TrF+jlvDwbx81t/Wsq2/ltLpA2MOVFFte77t6p49P6ZKLhKgKBWk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 58536b5f-e0f9-4992-10cb-08d628d37e1c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Oct 2018 01:56:54.5818 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0502MB4057 Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: support multiple groups and jump action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_flow has 'group' attribute and 'jump' action in order to support multiple groups. This feature is known as multi-table support ('chain' in linux TC flower) in general because a group means a table of flows. Example commands are: flow create 0 transfer priority 1 ingress pattern eth / vlan vid is 100 / end actions jump group 1 / end flow create 0 transfer priority 1 ingress pattern eth / vlan vid is 200 / end actions jump group 2 / end flow create 0 transfer group 1 priority 2 ingress pattern eth / vlan vid is 100 / ipv4 dst spec 192.168.40.0 dst prefix 24 / end actions drop / end flow create 0 transfer group 1 priority 2 ingress pattern end actions of_pop_vlan / port_id id 1 / end flow create 0 transfer group 2 priority 2 ingress pattern eth / vlan vid is 200 / ipv4 dst spec 192.168.40.0 dst prefix 24 / end actions of_pop_vlan / port_id id 2 / end flow create 0 transfer group 2 priority 2 ingress pattern end actions port_id id 2 / end With theses flows, if a packet having vlan 200 and src_ip as 192.168.40.1, this packet will firstly hit the 1st flow. Then it will hit the 5th flow because of the 'jump' action. As a result, the packet will be forwarded to port 2 (VF representor) with vlan tag being stripped off. If the packet had vlan 100 instead, it would be dropped by the 3rd flow. Signed-off-by: Yongseok Koh --- drivers/net/mlx5/Makefile | 10 ++++++ drivers/net/mlx5/meson.build | 4 +++ drivers/net/mlx5/mlx5_flow.h | 5 +++ drivers/net/mlx5/mlx5_flow_tcf.c | 78 +++++++++++++++++++++++++++++++++++----- 4 files changed, 88 insertions(+), 9 deletions(-) diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index ca1de9f21..92bae9dfc 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -347,6 +347,16 @@ mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh enum TCA_VLAN_PUSH_VLAN_PRIORITY \ $(AUTOCONF_OUTPUT) $Q sh -- '$<' '$@' \ + HAVE_TCA_CHAIN \ + linux/rtnetlink.h \ + enum TCA_CHAIN \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ + HAVE_TC_ACT_GOTO_CHAIN \ + linux/pkt_cls.h \ + define TC_ACT_GOTO_CHAIN \ + $(AUTOCONF_OUTPUT) + $Q sh -- '$<' '$@' \ HAVE_SUPPORTED_40000baseKR4_Full \ /usr/include/linux/ethtool.h \ define SUPPORTED_40000baseKR4_Full \ diff --git a/drivers/net/mlx5/meson.build b/drivers/net/mlx5/meson.build index fd93ac162..696624838 100644 --- a/drivers/net/mlx5/meson.build +++ b/drivers/net/mlx5/meson.build @@ -182,6 +182,10 @@ if build 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ], [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h', 'TCA_VLAN_PUSH_VLAN_PRIORITY' ], + [ 'HAVE_TCA_CHAIN', 'linux/rtnetlink.h', + 'TCA_CHAIN' ], + [ 'HAVE_TC_ACT_GOTO_CHAIN', 'linux/pkt_cls.h', + 'TC_ACT_GOTO_CHAIN' ], [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', 'RDMA_NL_NLDEV' ], [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 7117f1471..d4253110c 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -78,6 +78,7 @@ #define MLX5_FLOW_ACTION_OF_PUSH_VLAN (1u << 8) #define MLX5_FLOW_ACTION_OF_SET_VLAN_VID (1u << 9) #define MLX5_FLOW_ACTION_OF_SET_VLAN_PCP (1u << 10) +#define MLX5_FLOW_ACTION_JUMP (1u << 11) #define MLX5_FLOW_FATE_ACTIONS \ (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | MLX5_FLOW_ACTION_RSS) @@ -125,6 +126,10 @@ /* Max number of actions per DV flow. */ #define MLX5_DV_MAX_NUMBER_OF_ACTIONS 8 +/* Due to a limitation on driver/FW. */ +#define MLX5_FLOW_GROUP_ID_MAX 3 +#define MLX5_FLOW_GROUP_PRIORITY_MAX 14 + enum mlx5_flow_drv_type { MLX5_FLOW_TYPE_MIN, MLX5_FLOW_TYPE_DV, diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index b78998ec0..4adc6bd6e 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -148,6 +148,12 @@ struct tc_vlan { #ifndef HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE #define TCA_FLOWER_KEY_VLAN_ETH_TYPE 25 #endif +#ifndef HAVE_TCA_CHAIN +#define TCA_CHAIN 11 +#endif +#ifndef HAVE_TC_ACT_GOTO_CHAIN +#define TC_ACT_GOTO_CHAIN 0x20000000 +#endif #ifndef IPV6_ADDR_LEN #define IPV6_ADDR_LEN 16 @@ -225,7 +231,9 @@ struct flow_tcf_ptoi { unsigned int ifindex; /**< Network interface index. */ }; -#define MLX5_TCF_FATE_ACTIONS (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID) +#define MLX5_TCF_FATE_ACTIONS \ + (MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_PORT_ID | \ + MLX5_FLOW_ACTION_JUMP) #define MLX5_TCF_VLAN_ACTIONS \ (MLX5_FLOW_ACTION_OF_POP_VLAN | MLX5_FLOW_ACTION_OF_PUSH_VLAN | \ MLX5_FLOW_ACTION_OF_SET_VLAN_VID | MLX5_FLOW_ACTION_OF_SET_VLAN_PCP) @@ -370,14 +378,25 @@ flow_tcf_validate_attributes(const struct rte_flow_attr *attr, struct rte_flow_error *error) { /* - * Supported attributes: no groups, some priorities and ingress only. - * Don't care about transfer as it is the caller's problem. + * Supported attributes: groups, some priorities and ingress only. + * group is supported only if kernel supports chain. Don't care about + * transfer as it is the caller's problem. */ - if (attr->group) + if (attr->group > MLX5_FLOW_GROUP_ID_MAX) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_GROUP, attr, - "groups are not supported"); - if (attr->priority > 0xfffe) + "group ID larger than " + RTE_STR(MLX5_FLOW_GROUP_ID_MAX) + " isn't supported"); + else if (attr->group > 0 && + attr->priority > MLX5_FLOW_GROUP_PRIORITY_MAX) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, + attr, + "lowest priority level is " + RTE_STR(MLX5_FLOW_GROUP_PRIORITY_MAX) + " when group is configured"); + else if (attr->priority > 0xfffe) return rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, attr, @@ -428,6 +447,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, } spec, mask; union { const struct rte_flow_action_port_id *port_id; + const struct rte_flow_action_jump *jump; const struct rte_flow_action_of_push_vlan *of_push_vlan; const struct rte_flow_action_of_set_vlan_vid * of_set_vlan_vid; @@ -675,6 +695,16 @@ flow_tcf_validate(struct rte_eth_dev *dev, action_flags |= MLX5_FLOW_ACTION_PORT_ID; port_id_dev = &rte_eth_devices[conf.port_id->id]; break; + case RTE_FLOW_ACTION_TYPE_JUMP: + conf.jump = actions->conf; + if (attr->group >= conf.jump->group) + return rte_flow_error_set + (error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "can't jump to a group backward"); + action_flags |= MLX5_FLOW_ACTION_JUMP; + break; case RTE_FLOW_ACTION_TYPE_DROP: if (action_flags & MLX5_TCF_FATE_ACTIONS) return rte_flow_error_set @@ -755,7 +785,8 @@ flow_tcf_validate(struct rte_eth_dev *dev, * Maximum size of memory for items. */ static int -flow_tcf_get_items_and_size(const struct rte_flow_item items[], +flow_tcf_get_items_and_size(const struct rte_flow_attr *attr, + const struct rte_flow_item items[], uint64_t *item_flags) { int size = 0; @@ -764,6 +795,8 @@ flow_tcf_get_items_and_size(const struct rte_flow_item items[], size += SZ_NLATTR_STRZ_OF("flower") + SZ_NLATTR_NEST + /* TCA_OPTIONS. */ SZ_NLATTR_TYPE_OF(uint32_t); /* TCA_CLS_FLAGS_SKIP_SW. */ + if (attr->group > 0) + size += SZ_NLATTR_TYPE_OF(uint32_t); /* TCA_CHAIN. */ for (; items->type != RTE_FLOW_ITEM_TYPE_END; items++) { switch (items->type) { case RTE_FLOW_ITEM_TYPE_VOID: @@ -853,6 +886,13 @@ flow_tcf_get_actions_and_size(const struct rte_flow_action actions[], SZ_NLATTR_TYPE_OF(struct tc_mirred); flags |= MLX5_FLOW_ACTION_PORT_ID; break; + case RTE_FLOW_ACTION_TYPE_JUMP: + size += SZ_NLATTR_NEST + /* na_act_index. */ + SZ_NLATTR_STRZ_OF("gact") + + SZ_NLATTR_NEST + /* TCA_ACT_OPTIONS. */ + SZ_NLATTR_TYPE_OF(struct tc_gact); + flags |= MLX5_FLOW_ACTION_JUMP; + break; case RTE_FLOW_ACTION_TYPE_DROP: size += SZ_NLATTR_NEST + /* na_act_index. */ SZ_NLATTR_STRZ_OF("gact") + @@ -938,7 +978,7 @@ flow_tcf_nl_brand(struct nlmsghdr *nlh, uint32_t handle) * otherwise NULL and rte_ernno is set. */ static struct mlx5_flow * -flow_tcf_prepare(const struct rte_flow_attr *attr __rte_unused, +flow_tcf_prepare(const struct rte_flow_attr *attr, const struct rte_flow_item items[], const struct rte_flow_action actions[], uint64_t *item_flags, uint64_t *action_flags, @@ -951,7 +991,7 @@ flow_tcf_prepare(const struct rte_flow_attr *attr __rte_unused, struct nlmsghdr *nlh; struct tcmsg *tcm; - size += flow_tcf_get_items_and_size(items, item_flags); + size += flow_tcf_get_items_and_size(attr, items, item_flags); size += flow_tcf_get_actions_and_size(actions, action_flags); dev_flow = rte_zmalloc(__func__, size, MNL_ALIGNTO); if (!dev_flow) { @@ -1022,6 +1062,7 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, } spec, mask; union { const struct rte_flow_action_port_id *port_id; + const struct rte_flow_action_jump *jump; const struct rte_flow_action_of_push_vlan *of_push_vlan; const struct rte_flow_action_of_set_vlan_vid * of_set_vlan_vid; @@ -1056,6 +1097,8 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, */ tcm->tcm_info = TC_H_MAKE((attr->priority + 1) << 16, RTE_BE16(ETH_P_ALL)); + if (attr->group > 0) + mnl_attr_put_u32(nlh, TCA_CHAIN, attr->group); mnl_attr_put_strz(nlh, TCA_KIND, "flower"); na_flower = mnl_attr_nest_start(nlh, TCA_OPTIONS); mnl_attr_put_u32(nlh, TCA_FLOWER_FLAGS, TCA_CLS_FLAGS_SKIP_SW); @@ -1330,6 +1373,23 @@ flow_tcf_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow, mnl_attr_nest_end(nlh, na_act); mnl_attr_nest_end(nlh, na_act_index); break; + case RTE_FLOW_ACTION_TYPE_JUMP: + conf.jump = actions->conf; + na_act_index = + mnl_attr_nest_start(nlh, na_act_index_cur++); + assert(na_act_index); + mnl_attr_put_strz(nlh, TCA_ACT_KIND, "gact"); + na_act = mnl_attr_nest_start(nlh, TCA_ACT_OPTIONS); + assert(na_act); + mnl_attr_put(nlh, TCA_GACT_PARMS, + sizeof(struct tc_gact), + &(struct tc_gact){ + .action = TC_ACT_GOTO_CHAIN | + conf.jump->group, + }); + mnl_attr_nest_end(nlh, na_act); + mnl_attr_nest_end(nlh, na_act_index); + break; case RTE_FLOW_ACTION_TYPE_DROP: na_act_index = mnl_attr_nest_start(nlh, na_act_index_cur++);