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 6C1B0458A2; Fri, 30 Aug 2024 09:13:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C4A642E81; Fri, 30 Aug 2024 09:13:50 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2126.outbound.protection.outlook.com [40.107.237.126]) by mails.dpdk.org (Postfix) with ESMTP id 50AC442E6F for ; Fri, 30 Aug 2024 09:13:48 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=srmw2Eg5q+tD4C3eaROyTeV4tl8+G3iwOK7QYiE7yaIHh8Ruz+x82vQmSqfA5pekGwn8t/GmEZ1LS1Ifyhvc1VhXUv5Q0WJ56a2FrS77+nxh1/QmYADzMosMK9Kd4sAGNLMF7jqRYRItaer4xmwoXpotdBRwWfmZCrbY+LYripRKUUxmPe2ARD+SXxBB9jVXwC49BSdqCP2Zud4VMWZlhWm+mzqD1en6q3bFwft5Jd2GtWAslmFAAfMgV9exDd5PARrVYw2UBpqSDKpb+GajjruSOpMGaEKEkw2yGPX7YFuDWAvPrzEQYJOA+HJeqKwFKw2GwJ6yiU2pbYVclJ87Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=QQRDb77/3Q+elDwl2WIn9eWnk7lAJExA9rHbZ+nqmbA=; b=kZ2WvRZj9x8q2M5fBwYwJw+xXA76jWE3UglKX+Oo0jvslCsqgjUC0hGbgzbtjId/AyoO1F/7nYDD1vKF7KtPUGb7203+tptArjuGiQbrh2qjpCmiYNXJ8CsCBUvXYTbtBCSjnY5MSCBP3PTTNo5Xw5q+35KISWGlKfSR6R1v7qDS9SYisafIZ7HQoYLQut8gcKCQ7wp21tUMwrppkEZaODfh51pMJM2TGJD9nG/U/6dC0jZ6bSfJ07ePPYFIrpYFccdXIlgyvwnLZD89XOUsmxbe9+HqiF8secfOSqkK048nuwEAqGWjNLm/TlB4+s6t5/vzsi873DwZSm1AN42oxg== 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=QQRDb77/3Q+elDwl2WIn9eWnk7lAJExA9rHbZ+nqmbA=; b=AM4zZUkDWD7h54hJQUsyEirahwrIBkW50O0tFkAYKbuBifsy56zZUYBdPbOF1mAWtz7GFh9vocbDwKc0OECKccTkuxK9Rv/KxbmtTVYSrKXc6E0gQtaiFgUU94Sbk/JwTK21vGNcqBKDUgIXoivNxKR7v/bpdX3mdzo2/m4OriI= 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 DS1PR13MB7124.namprd13.prod.outlook.com (2603:10b6:8:218::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.19; Fri, 30 Aug 2024 07:13:45 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::b900:5f05:766f:833%4]) with mapi id 15.20.7897.021; Fri, 30 Aug 2024 07:13:44 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He Subject: [PATCH 2/2] net/nfp: flow rule supports match Ethernet type Date: Fri, 30 Aug 2024 15:13:23 +0800 Message-Id: <20240830071323.2581557-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240830071323.2581557-1-chaoyong.he@corigine.com> References: <20240830071323.2581557-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CYZPR14CA0044.namprd14.prod.outlook.com (2603:10b6:930:a0::28) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DS1PR13MB7124:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e92add9-ec20-4b93-5d95-08dcc8c3486d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|1800799024|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9KhnnFLSWA2W8e9qjtDiRJ0lt+aw0qlVU8d8wrrGRe7YkncpbJvYVSar5pTr?= =?us-ascii?Q?Fxk+U8iuQJwjmEJoEZiTLCQ1fDhZvC8hOlzb4Ib9CBWr0MS/qIkeDsVjiEli?= =?us-ascii?Q?o4eytGs+jfzMW3MSBzABN3fanDysI5G/rPn2ntnk8LxSnXrLQHLd+H/ZekDN?= =?us-ascii?Q?wqP/KZCcTPa8WvUgpK6UAdmKBxD+1JEaiNr+6Cj3g1+sXCHlG0nmhv/XbvY3?= =?us-ascii?Q?/XXu7L7rDZTnUtHWY1CNRopjw/dxAd/+sCZ5WzIjfFfhpYOD4xN6Zt/bbpS+?= =?us-ascii?Q?nNkrWPKGWiVoUpf5nV/Q6f8FMh2z5lRR1Ps1iFQBWTH/BI3KLPQUK9Ih4b59?= =?us-ascii?Q?WyLzkKtTYz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ascii?Q?QramBPnhCJMxfzf1mA24NTaClaVjcHJQx4FnmTUS+O3vhhbPvFNRbLB7OVez?= =?us-ascii?Q?UiQAOgNKGYZazqYH5n1CdGbvLyAusrgOKfd0Kgtyfoh+YBUOYZfCiV50+nPy?= =?us-ascii?Q?DW5PPOLEhqp3UQ7zVMJS/193gURgOoEzzM2K10krEgLfzXdjgA=3D=3D?= 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:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?jb9c6FIbVPWw4TchIuE28KiVypvOLfRAt4528TOYs965tUHyR2M1V11RNVLt?= =?us-ascii?Q?OA+lVJZ0YEBMN0abFcH/BU/l+g95//bxP9u/XdC+lcLyc71gfJC3knZi3QcA?= =?us-ascii?Q?Hp9S0wPiyDa4nrCMbXXh/l/AbBJ5Iq7mv5YeILPQq5Dfh6MTbsu2JjY3RvWD?= =?us-ascii?Q?PXt2p3Ypbmoiqol/ZVfQpjxixm37NQjFvd4WwFfKGvJEuGG/vCLBeMW/12CW?= =?us-ascii?Q?VWn1a7qW0H+Bmeha2c5TjzJSx8K8Z/NrQD0sTwbhvTJjaR2q+962k/lBMESc?= =?us-ascii?Q?oAAN1uHO/cqIBMVyo2aNiZ92dWvPbvYlYjovsG7JNKuhH0eZpyIoA7w7Lw8H?= =?us-ascii?Q?raux9/EH+RgT50w1MFN06l+lIR5HzN2rnz4f6/V5FUBzEyl9QUXRU4R2sMwv?= =?us-ascii?Q?P7KtU9cOBWzHLqZI2UEjKIpaA4fE8yRi8wN6m2Dao1+PJArbrintTlPeCUIN?= =?us-ascii?Q?z9KP2FAKNxfskjVVlmyrO342PsFetatM0K7JNl96fbZ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UL6VbyKgGg9vWipWfLTq1a/8G+Et3AOv5niongL542OjSQl?= =?us-ascii?Q?WFIa2b7V9y7GTZYFLPD05LLvXChH9X3qK1HRsg2QbroUL9zAVkY8HAzZ774O?= =?us-ascii?Q?WqSINnTyoTOcu3h5nuRMew5t0cq7mn+unwwk10epRr/hV29ANG/AThMhVumv?= =?us-ascii?Q?jojiZ0HkyOvL4zv5DABe6Y+D4PPD61J2WVU74DcqhC127on02rDZkoiPpf3g?= =?us-ascii?Q?9A=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e92add9-ec20-4b93-5d95-08dcc8c3486d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 07:13:44.1988 (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: HGFTScjV7rT6yvncvegjThJAtTaM+12ZdrEeNtTF8+fDDiob9u92TZA32RM8bVaZNEkqBwbCJ1Jf0AKci05ypWIDxqQWN6AN40cJT6TQGAw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS1PR13MB7124 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 From: Long Wu Add the support of match ethernet type item when using flower firmware, with a limit that it can only be used alone. Signed-off-by: Long Wu Reviewed-by: Chaoyong He --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 14 ++++++++++ drivers/net/nfp/flower/nfp_flower_flow.c | 34 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 5d23227c24..5fc4210d8b 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -708,6 +708,20 @@ struct nfp_flower_ipv6_gre_tun { rte_be32_t reserved2; }; +/* + * L3 other (1W/4B) + * 3 2 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | reserved | ethertype | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * Note: This is only used when no specific L3 header available. + */ +struct nfp_flower_l3_other { + rte_be16_t reserved; + rte_be16_t ethertype; +}; + struct nfp_fl_act_head { uint8_t jump_id; uint8_t len_lw; diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index f24e9cee9c..20c8b4a1b1 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -26,6 +26,7 @@ #define NFP_FLOWER_LAYER_VXLAN RTE_BIT32(7) #define NFP_FLOWER_LAYER2_GRE RTE_BIT32(0) +#define NFP_FLOWER_LAYER2_L3_OTHER RTE_BIT32(3) #define NFP_FLOWER_LAYER2_QINQ RTE_BIT32(4) #define NFP_FLOWER_LAYER2_GENEVE RTE_BIT32(5) #define NFP_FLOWER_LAYER2_GENEVE_OP RTE_BIT32(6) @@ -962,10 +963,15 @@ struct nfp_item_flag { bool outer_ip6_flag; }; +struct nfp_item_shared_flag { + bool l3_other_flag; +}; + struct nfp_item_calculate_param { const struct rte_flow_item *item; struct nfp_fl_key_ls *key_ls; struct nfp_item_flag *flag; + struct nfp_item_shared_flag shared_flag; }; typedef int (*nfp_flow_key_check_item_fn)(struct nfp_item_calculate_param *param); @@ -1065,6 +1071,9 @@ nfp_flow_key_layers_check_items(const struct rte_flow_item items[], PMD_DRV_LOG(ERR, "Flow item %d check fail", item->type); return ret; } + + if (item->type != RTE_FLOW_ITEM_TYPE_ETH) + param->shared_flag.l3_other_flag = true; } return 0; @@ -1089,6 +1098,13 @@ nfp_flow_item_calculate_eth(struct nfp_item_calculate_param *param) key_ls->key_layer |= NFP_FLOWER_LAYER_MAC; key_ls->key_size += sizeof(struct nfp_flower_mac_mpls); + + if (!param->shared_flag.l3_other_flag && spec->type != 0) { + key_ls->key_layer |= NFP_FLOWER_LAYER_EXT_META; + key_ls->key_size += sizeof(struct nfp_flower_ext_meta); + key_ls->key_layer_two |= NFP_FLOWER_LAYER2_L3_OTHER; + key_ls->key_size += sizeof(struct nfp_flower_l3_other); + } } static void @@ -1870,6 +1886,9 @@ nfp_flow_merge_eth(struct nfp_flow_merge_param *param) const struct rte_flow_item *item; const struct rte_flow_item_eth *spec; const struct rte_flow_item_eth *mask; + struct nfp_flower_l3_other *l3_other; + struct nfp_flower_meta_tci *meta_tci; + struct nfp_flower_ext_meta *ext_meta = NULL; item = param->item; spec = item->spec; @@ -1892,6 +1911,21 @@ nfp_flow_merge_eth(struct nfp_flow_merge_param *param) eth->mpls_lse = 0; *param->mbuf_off += sizeof(struct nfp_flower_mac_mpls); + meta_tci = (struct nfp_flower_meta_tci *)param->nfp_flow->payload.unmasked_data; + if ((meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_EXT_META) != 0) + ext_meta = (struct nfp_flower_ext_meta *)(meta_tci + 1); + + if (ext_meta != NULL && + (ext_meta->nfp_flow_key_layer2 & NFP_FLOWER_LAYER2_L3_OTHER) != 0) { + l3_other = (void *)(*param->mbuf_off); + if (param->is_mask) + l3_other->ethertype = mask->type; + else + l3_other->ethertype = spec->type; + + *param->mbuf_off += sizeof(struct nfp_flower_l3_other); + } + eth_end: return 0; } -- 2.39.1