From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9FF0AA0560; Tue, 18 Oct 2022 13:28:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5585442905; Tue, 18 Oct 2022 13:27:50 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id DCCCC427FF for ; Tue, 18 Oct 2022 13:27:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nz9wWSoDcFrKzRiUIIfkWzseaApSEtdepyRAef2xq45mxgT9a/Nr8LYKfzM9INcM1STiCbw24dghS9xnN/5aIkj76J1pcXuHjw88zcBuV+yEhhOen+yeKXkqd8lD8lGB17Rj2kHe09A7SE/RfxHYtGFM64gJa6HUxp+WhwJoGE27xemPafGoIrX3u7rRWmFeM+7oggOqE5gxuFMa4CBjIpgjQY7+rrZtHTxAJsM690qIMP3m9Dfsyf2sldkkY1xh2WydXv18Ybshic5jVIPfsVntQk2xfyARk6OKTgBQ96WIG8EXIlTdPFTFZSMp3o9kwLhsKU+L8AlI7jK7UIXDOg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s3kcVuR7UPHSN8djKrvd68jWJJ5F+8HA8o25hDkk46I=; b=Lwfmg0R1xYeabtPWyS6R4N0w6g1l4Y/xg0ZUphNGfsjHADO4oCyURMjBmGOZ1DR4NC6xwTeOgOK8wnadqSw+aDMRfsxj6gfCTeasn9s+qVMLSAsqCmbbW3kXxUwywnrsdLC0vpKhG7rZcnR0KrAu9OUeafP1qTVKSh0cuyVc+eBdFDK/morql3uq3K4M2ldYEWT+rDC6aWyLvP/xdvVOjJhJ85gRNIibhYEsJHseycax16/yqss71d/MyseXIWUlMk5Fzk2SGrktHgmjFlZhpzqWXQE5BzLh/ZSK9uo1NGFioU8NVsg3JnqQ646hNv2Tf2zAGQ++hawXJtWdLc2wog== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=corigine.com; dmarc=pass action=none header.from=corigine.com; dkim=pass header.d=corigine.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=corigine.onmicrosoft.com; s=selector2-corigine-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s3kcVuR7UPHSN8djKrvd68jWJJ5F+8HA8o25hDkk46I=; b=saQCx4kb8ON3wcbV6Wo995weDxQEpBZu/YPL/izrAZoAGLcxK1NK2pdedzXawSCRTcSlioL/8beK8TTy669vp23V+nFs+I/oYDFYgqGw0HHQpZIuOMIlUckOLGHmbnIh5phPHxBSiTPVk3FHAuRihDhedDMUJQw93fm8Eu7Gbpk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=corigine.com; Received: from SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) by CO3PR13MB5686.namprd13.prod.outlook.com (2603:10b6:303:179::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16; Tue, 18 Oct 2022 11:27:47 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::7c26:1a0b:2825:6f4b%4]) with mapi id 15.20.5723.014; Tue, 18 Oct 2022 11:27:47 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 07/25] net/nfp: support VLAN flow item Date: Tue, 18 Oct 2022 19:26:56 +0800 Message-Id: <1666092434-10357-8-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR02CA0052.apcprd02.prod.outlook.com (2603:1096:4:54::16) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5686:EE_ X-MS-Office365-Filtering-Correlation-Id: 62ad8825-db69-4584-3836-08dab0fbc83a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K+WHQt8F3cX8LuGNuFzRp14seMIGhh3Zv6aYsw2f6Nl5jGJoOEr09rR0Wdlm1MXjO8OMhoiRFbWuF7pY24VV6UAhuk4YicX30IvI7gs1d+cLtnEnNp1NnB69accCbwADjTSbUasN7uGUepQZHFL+7S/fvv+noeqpcjOIKWkeoLAMqvwnRwsk/qNXYKL2d9QAfNCB2cDvjQDjWs7JO39NB8r5UiAa771uz+zBwwuk9QXkAo42Id/Mbfev/3iLduKmnOdoHENdty2AMGwn7fXlwwuyherL9Jc0r0CMjW7QrvkmlB/JucLOidRyF5mz2uEy4d9pkCeHU11sXEWaeI14rcIlxSPkFhTD4Fapcun7aMjndNQP6PALpSo9E9o/MrTIhmM3usbOXWHA1Xcb1gAScpqHHPcJEfFlD42Ztjv/kuu/i73ySAhdwCUCaOIxuncHvop/IfizijoB30syxOQ6lSyx5Y4UVpPaGzqvgWf2F1gGjXVmqkkKMkanEbCcT3y1YOwf4tfgl3mrTckfGqF/xGFESBs7tISg1oz1ZOkwh2f/2yOPBBNC65zcOnF82OfDK+sd4j5BZxjBThoESePmu6OCoZTIE4sBGJ/4gT4E3lRoriutveEdJszZj30Aa2nWMHmnYNHfG5OYSyDIPGxKKfFNPpsKw9JkeB6LQgSBs++wvkLLbwdMMGecmIHK1DQFKAVGY7RqEqi66xN4djELraMCxk8uqtU22/UuVpSJDh1GXUSp58y4X+pEa2a5Vmh7QnwROctogyCJm1P9fvlepHdCYXgpOd0rR2Isf/xEBLff7Cr1zExBoJaYTM4eEaZX X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR13MB5545.namprd13.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(346002)(366004)(39840400004)(396003)(136003)(376002)(451199015)(38350700002)(38100700002)(2906002)(41300700001)(316002)(66946007)(66556008)(66476007)(83380400001)(4326008)(8676002)(6916009)(86362001)(44832011)(2616005)(8936002)(186003)(36756003)(5660300002)(6506007)(107886003)(6666004)(6486002)(478600001)(26005)(6512007)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WTJFK216RXlPYlhFc0ZBUVRBbUNqUUoxMkhwN0hMYjFhcnVhY3l0YVVwZlZF?= =?utf-8?B?OE9XVmx6enRYQ1dZTUpKb2E2d1BMUFhPVzY0djlLWFNzRnp4SHluUkpVZXZG?= =?utf-8?B?b3AxV3IwclFjcnVTdFBmOUJma2Q4YVFTZkozTkMzRzJWSGNuNWFvMHQycG9Z?= =?utf-8?B?L2lqKzJWUjBpS1dOU1JQZTdPWGJtSER2UFk0Y1FaQ1ROV05XR2I2c0JqUGFk?= =?utf-8?B?NklWUXdOcGE1cGlUSnp0bTNtRTNSRkF3TUxWRXRGejNER09qSE1PemNkRGtm?= =?utf-8?B?Wm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dEtjS1px?= =?utf-8?B?aWVPMVY4NjVJTUROU0kwY3dnVHR3eEI0WWFHalg4eXdvSGxCa2gxSTVVQWs4?= =?utf-8?B?ckE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62ad8825-db69-4584-3836-08dab0fbc83a X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2022 11:27:47.1540 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: fe128f2c-073b-4c20-818e-7246a585940c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Dcon2r8snnFR5Jdn85nAVKEw5Jr9Z8ygnQi5CCQCfQaTXlEwPH0xvYb/WzjrB80atOaTSAx/j9WeJ1om+AOm8ho1mqTrJivk4jJKKTnNElM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5686 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add the corresponding data structure and logics, to support the offload of VLAN item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 46 ++++++++++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_flow.h | 2 ++ 3 files changed, 49 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index f91da82..b0af2a0 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -29,6 +29,7 @@ Usage doc = Y [rte_flow items] eth = Y port_id = Y +vlan = Y [rte_flow actions] count = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index dcc0942..72e642c 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -530,6 +530,10 @@ struct nfp_mask_id_entry { ethdev->data->dev_private; key_ls->port = rte_cpu_to_be_32(representor->port_id); break; + case RTE_FLOW_ITEM_TYPE_VLAN: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_VLAN detected"); + key_ls->vlan = NFP_FLOWER_MASK_VLAN_CFI; + break; default: PMD_DRV_LOG(ERR, "Item type %d not supported.", item->type); return -ENOTSUP; @@ -641,12 +645,42 @@ struct nfp_mask_id_entry { return 0; } +static int +nfp_flow_merge_vlan(struct rte_flow *nfp_flow, + __rte_unused char **mbuf_off, + const struct rte_flow_item *item, + const struct nfp_flow_item_proc *proc, + bool is_mask) +{ + struct nfp_flower_meta_tci *meta_tci; + const struct rte_flow_item_vlan *spec; + const struct rte_flow_item_vlan *mask; + + spec = item->spec; + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge vlan: no item->spec!"); + return 0; + } + + mask = item->mask ? item->mask : proc->mask_default; + if (is_mask) { + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.mask_data; + meta_tci->tci |= mask->tci; + } else { + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + meta_tci->tci |= spec->tci; + } + + return 0; +} + /* Graph of supported items and associated process function */ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { [RTE_FLOW_ITEM_TYPE_END] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_ETH), }, [RTE_FLOW_ITEM_TYPE_ETH] = { + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_VLAN), .mask_support = &(const struct rte_flow_item_eth){ .hdr = { .dst_addr.addr_bytes = "\xff\xff\xff\xff\xff\xff", @@ -659,6 +693,18 @@ struct nfp_mask_id_entry { .mask_sz = sizeof(struct rte_flow_item_eth), .merge = nfp_flow_merge_eth, }, + [RTE_FLOW_ITEM_TYPE_VLAN] = { + .mask_support = &(const struct rte_flow_item_vlan){ + .hdr = { + .vlan_tci = RTE_BE16(0xefff), + .eth_proto = RTE_BE16(0xffff), + }, + .has_more_vlan = 1, + }, + .mask_default = &rte_flow_item_vlan_mask, + .mask_sz = sizeof(struct rte_flow_item_vlan), + .merge = nfp_flow_merge_vlan, + }, }; static int diff --git a/drivers/net/nfp/nfp_flow.h b/drivers/net/nfp/nfp_flow.h index f1fbada..f6bd3e4 100644 --- a/drivers/net/nfp/nfp_flow.h +++ b/drivers/net/nfp/nfp_flow.h @@ -25,6 +25,8 @@ #define NFP_FL_META_FLAG_MANAGE_MASK (1 << 7) +#define NFP_FLOWER_MASK_VLAN_CFI (1 << 12) + #define NFP_MASK_TABLE_ENTRIES 1024 /* The maximum action list size (in bytes) supported by the NFP. */ -- 1.8.3.1