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 6A244A0032; Fri, 21 Oct 2022 10:03:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D98F542C0E; Fri, 21 Oct 2022 10:02:47 +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 A690642C02 for ; Fri, 21 Oct 2022 10:02:43 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D+4p8UQRWNSTMPVSuLPaZOkGru1RCm4d4IbRnw5/XDFzNb23d20fPSo6bOi7mTUUwGytp43SvJmUFlhGtlUws6aPI3H3eiNvV5Nr+R0Bcd8Stf7eF9e2/yHJEJhG02pb2vfQ9BTyC8ct0DhcAR4bA+zwQ1JU6pSLqMsKQ3dWy77jj8kZVlOWSiWD+hlZGQUFENrbguTUl8shfMpp9e8Mu0hI9emKfwRreDLUNxVUmaOKZGDBQH1V3UIPELx8Fy8P9d0uj4W+h6l5xU/u3dg/AlWixrS4GQ/460BYhblQ16kKjo+GQ60Z3i4+/3k1RPbiEhejGWrfHyaKOpRBDpdMSQ== 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=DToN0ZfBi7tK1PhY6OHKlhpzvGZpBo93mQRlt5+A7vk=; b=Ym7i/eugVkkrtLSvS+TuwXt9zgvmB5SShYf1bLXH2erJDVvhr780AnY1drJ0a+yZI7oF4z8JsA/C/zBdPSIpr8iApx2w0lsinH1lc3McPomDPzGpIugVFgjrOLIYEtZNlTr3SgE8vaV/HjaiLQJ10nHC0XJ1h+MGTnQbYmGwPEfKGW4y47rskry7bvYsyE7sFy0cJllOotaGxv4Gn/j6FMZEWEZtYp0aRG1z1yZtV/7v6KsJLW6252AocctQb5QQL+085eONp1gUqqcGmVBojBzIK6dVPFTxBpsMmK2B6RDgCmHoRjTke29Zcomc91+uRVY54u7uaOjrJP7Y3kryow== 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=DToN0ZfBi7tK1PhY6OHKlhpzvGZpBo93mQRlt5+A7vk=; b=AopOgazfG50uuPHVdiidL7J5Xjbuxf5Ocz8tmpnS+6v+McHJ1lIbWmpN4vC1GseQi4nGNLlO0wJpO6YMm7ew7Vj5g5TReisM5civhoBx3QBwK1Fz84z1WqPNpghUqVH6fIe29KJ5i1lFZHwf5k1Ra6AoHNxQJ5x5HPQ5PQ2TE/s= 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 BL3PR13MB5162.namprd13.prod.outlook.com (2603:10b6:208:339::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.17; Fri, 21 Oct 2022 08:02:40 +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; Fri, 21 Oct 2022 08:02:39 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 09/27] net/nfp: support VLAN flow item Date: Fri, 21 Oct 2022 16:01:45 +0800 Message-Id: <1666339323-24016-10-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|BL3PR13MB5162:EE_ X-MS-Office365-Filtering-Correlation-Id: a5930cb5-b2fe-43c3-42b7-08dab33a9f63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QvpL3Sn1MfY+vzSqDOLCyySl29nosOlptWPzKFfTBY7DN3nuNTZmZEjNC61PD1uYaos56kkUzz6WMufEB8rHf3NoqvU7G6Ye7xsrYhSSx+VnFp0f8V39H8txuvP0T5OEWnzeI/MUcoyBuSRt0tBQLvcSt2MoT1Pk5eDAHdp3nGd4xutXuIci7szj+H9i8KBYV/F3Au/TAWJxaLao/qZt9mA2Al6bSaetDhmGkW7ogJpa0jC29KvDlGe+Kh69SSTsdTzwCGT/QGk1cOgMSrS5bAhjSIwA0rU0eEksG32Q4NI9QGM8SsxIKOr6NiYa3H/MZkRcrzXNaiDOfPQX/CUtIuOV7BEk/x+wW2EDJ0D+AJk6Yma/ALMydtRJiEClJQlXMOCc8AGQhZvJSkLL4xZxcHi4eYJiFjR1wIIDm9yRU1qRn9SqllS22kRu++OrJxO0R1fIaHRrZfaHZ/HcSePHBTxbun5kMfaVizJ7OOVCMLBRI56370uudzsWMc7CBprIlCT4SqeXZOZTTGOMfipdPf8Sd8NgppMyz12imijLg95CWmc98xrv4ezk5yUkmnzciTOf7sSFdjHG3xGhcznP7kPcMRKqYrZDcMgQuSj2CmDanJYWyWr+3GmpiOw83XOGlJM+8x+2sTLGNAcYRW1FUFDKaJgD6yerTRjnuUCdj1OTl/2JK4kpjOupmgZgwFp1wViILFluvOr1tQiXuaKEDPbTmI5q44Bd1pPAdxuT7rEKRLWavqe+HllPfkxzCfZ2j8D36+DPIWnw4l9h/klqcA== 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)(376002)(396003)(346002)(136003)(39840400004)(366004)(451199015)(2616005)(6916009)(38350700002)(6512007)(6506007)(52116002)(8936002)(66946007)(4326008)(186003)(107886003)(8676002)(41300700001)(2906002)(66556008)(316002)(66476007)(38100700002)(44832011)(26005)(5660300002)(6666004)(83380400001)(478600001)(6486002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Nk5QNWZ5L1NkaDdESVZGV0p3NkVtamdmWEZIVWpLLzlsUTVSdkNHWC80K0o3?= =?utf-8?B?alpOVVcvTnB3VXJWdGI2SFVsVVhheTdQb1lvbFN6NDN6SEVOcEdGSFM5REJZ?= =?utf-8?B?OXJoMGNVbEc0bVhXZFZmczAzdEtZa1NIYTEvd3V6Q2hzbm1lbzZBWWZnVGpE?= =?utf-8?B?YTJ3b0c1SWppYzVqSHBDZXJyVHBMOThtbEpMUHRwdXJ2YUNzWFVGQzhBWnJw?= =?utf-8?B?djF6bWFrbXdCbVBhcmdRTEJwWnA0NElVRDJRdS9j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JdW9rYWJ6TER6RjFCTW1udkFHcWNnbGI1?= =?utf-8?B?c1NXVVU5L1IrTSs3Y3JIL1RPMWFnSWEzRGxSbnRtTjJhQUhzNXFmUm1iREhP?= =?utf-8?B?aVE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a5930cb5-b2fe-43c3-42b7-08dab33a9f63 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:02:39.3028 (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: uI8Oc9T6xMvp2UEo+OwvPWYlX0xzDNRPoi05G6VRG00NKEg3YVEvIjGNuz6wgf475yOy2soyaAK6H0Mv0pW+pYjlXOppK/AGgHo5toXXnBI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR13MB5162 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 36b1221..802fa6a 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -518,6 +518,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; @@ -623,12 +627,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", @@ -641,6 +675,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 2fdffa1..40cd062 100644 --- a/drivers/net/nfp/nfp_flow.h +++ b/drivers/net/nfp/nfp_flow.h @@ -26,6 +26,8 @@ #define NFP_FL_META_FLAG_MANAGE_MASK RTE_BIT32(7) +#define NFP_FLOWER_MASK_VLAN_CFI RTE_BIT32(12) + #define NFP_MASK_TABLE_ENTRIES 1024 /* The maximum action list size (in bytes) supported by the NFP. */ -- 1.8.3.1