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 43DD34589E; Fri, 30 Aug 2024 05:11:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B440042E64; Fri, 30 Aug 2024 05:10:54 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2123.outbound.protection.outlook.com [40.107.223.123]) by mails.dpdk.org (Postfix) with ESMTP id D513D402B1 for ; Fri, 30 Aug 2024 05:10:51 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F0vJJd8bcsiV5FR+4zzEWbzeAlHh2eAVj5Ht6soxbqN0QZp2XnOopIm+FnREb6lJ4KVaUYPtJu5xUCVA70kgQz0zSxdTqb8voLLDKnzA5jfCadC2JSGyj4f2+gy93z+bodLxZPx9ZV1SWbe1aTwnv/80JbuzAkbTr6rxuhSakwAzJwkNHZ2rvCreb58819eQpYrheeomDMqRLvLke9R9FQ1O6NxrCStTpklpgos9wvehRvLQqSCsAp96FrbqF1MuxKobyxLNQKNWG19IMjOqD6xnEItzlw3iYhc5QcgxY3Ryt3X34ZgzRO5LYF6OCoCq3qjfvQ32VkqBwzVVZtsMag== 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=viPsvN+0sPx/zxYmBKrheMXmW94CBLyYYGtPhtqT81U=; b=uViFyS5CwM+X2f0yK9SljmxG3aJZIQ9yJbh8ZveK3tiwLuUMnZ4fMggXM2W81aJ2JG6SbmtvIgm05qoUFwVTf1XACPoVtcm0BvDPylkESGC2ypYpk7YzzR6ovAHviXW5VJTvsNpQjOW5zCDzZ3RGDRjUpvSYGqzrJ9+2LFHShQDwRZmofx1D3f4LEM68Nr6R3oA0Ky2uzPmQXS2cWpJppI9JETHhVXN0YmtrkcuZ7BrHo9ke57oTMi0HykXNhOUuxgC6Oitk4NQiZl3iEwDL17SKbQZBVdrTHY1l4T5XbaJ+WFtA2l9DathmCOD6RefpfkmZ9b8THqBiNI45HD66oQ== 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=viPsvN+0sPx/zxYmBKrheMXmW94CBLyYYGtPhtqT81U=; b=QDa6vV9/Y3wGpD0pdl34onhSIPGB9eGzp1SBD3fp2pSgKjPDUA89jNLvJyQJXUH9po49SVEG3mwh4rZBQa8NIxtonq5OxDkZemnRuMgj5/oZvwK+Um1JWTH38MWgeSksJJQrvvz79gqC38tBB9K7Hx7+JQlxkg75dE/Jh4usWPA= 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 PH7PR13MB6244.namprd13.prod.outlook.com (2603:10b6:510:247::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.23; Fri, 30 Aug 2024 03:10:50 +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 03:10:50 +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 11:10:25 +0800 Message-Id: <20240830031025.2422579-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240830031025.2422579-1-chaoyong.he@corigine.com> References: <20240830031025.2422579-1-chaoyong.he@corigine.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: CY8P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:930:6b::27) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH7PR13MB6244:EE_ X-MS-Office365-Filtering-Correlation-Id: ecad388e-701c-4548-0d29-08dcc8a159d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|366016|1800799024|376014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mXjWV2gTZGeAoQAl8TsIV/YWOKf5en5gLkpYRAtTy9S7UgCLAjT3viBr9Kr+?= =?us-ascii?Q?7LBxslGbh4/q8zm3oTUnJ2SUEokOZ88JZaqkyNj+/3HA6ub/8plO5JeiN8B5?= =?us-ascii?Q?t4OlkaXDx3Kp1tvyg9gI3pnhY2B4M7d4kPmGmJUBB5HyKfaMgE3MtV4GodVa?= =?us-ascii?Q?D+3OLb04/cCHiwHYDsNwsq+gE9dPSpcFYIhy3JCCODhDUW8jR/MgehLhZQDR?= =?us-ascii?Q?vom3VAEpHcnDzSdLEjeKHy4PAJegDuIUABa1NBLPI53UX0kJcVNUTl9ciI2I?= =?us-ascii?Q?jIb7/f9dDMuGOSIuuZA7949z04ck2cj05YOjcXv7msa1vvUVaXAhe446/iOQ?= =?us-ascii?Q?Tu8OM25FyzbCFHdypxwyZ5qkcjGX+l8ECS0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5qtgyHyJbcVnnqN325I4PBnj+9Hcr3yCbuWPdb9f3n8jJ7?= =?us-ascii?Q?e9Vn4/zY3Q1wyIC7bOl4Amv4ZAku+TMSBWjYYMBefHf4YRGwE/NAs2LWZngD?= =?us-ascii?Q?fX6vDdDZvKsf6bKO/3Cpy1KsMAIHM1Y+VchxZN+j3IW0po1o0w=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)(52116014)(366016)(1800799024)(376014)(38350700014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?QI1uulUgjDH5wx6qrjpKh27dAKvhAw1Ipbm33ffnc/f/sDWcBxY8CIXmwt06?= =?us-ascii?Q?tIs7a79/sz+ia07cERMQZBp218P5sm712YxeyufEghqcScW9yEgdGdR/tFMV?= =?us-ascii?Q?bJA8TO1CtmuTcYjV9elE4KuqiZ3XpMyuo9Umze0K9nj5FDHyn8NTfJKrSYe8?= =?us-ascii?Q?pQCFZLrbA2dbz3GenYrU6N56i1AtPekveok18ofoQwFamk5a0mtMQeYiaVW3?= =?us-ascii?Q?SEr1diGUmg39m2AcGSEhhHkGbh3cOmeipl39nbZ9owLMeHAfotssLDh+hY/Y?= =?us-ascii?Q?t86yo8N53nw9o8DC8UhWHR2tHcdSbhws1qgA3sq+4UjwY0DUn7qqL0fdorKy?= =?us-ascii?Q?86AV3gqGMjxgtnCfcGU3StN8mLcMiPiWyHpPe0skiBQWJXgIYVMd7XZHaMac?= =?us-ascii?Q?wjV5AISqUfuBkS5MegKZ1nhYkNDZ55H/8mpdlgg522uXI3sYJHsr3Uk6LhyU?= =?us-ascii?Q?0OzgqU7KryJe9ypqdTcCZPPJA6P2bbmqBdQ8zehlod1gDNxNv4PXQZDSR28t?= =?us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3rIy55B6ed?= =?us-ascii?Q?UfEbNUhWlaaCoQYtPBIRZ1RQXWT8rxgCJPCFbAtUE21lSTIp1XNrrcA0lhZ5?= =?us-ascii?Q?+CWJ3BKRu5sto0NH9ADPonv7qTLQqzbtQQPSJ9nlKtJyiYSUox7FeM31uGW3?= =?us-ascii?Q?0f/0s56qw1hQECX6PQxg1ThgN9gTewhaToLf383I5TnF8xn1l7hphq0yqoZ+?= =?us-ascii?Q?Gw=3D=3D?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: ecad388e-701c-4548-0d29-08dcc8a159d4 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2024 03:10:50.5052 (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: hBpKGi63kDQAU6ozdFNqxbr5/2IpY2yIGy3MG0a+oh2vqWCPjDmC/vnpVlCC4rk+4Xbus4ia775xl/mGUxQbnlxrntJGywXC/p4Jpm2HIg4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR13MB6244 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 50b0742b18..21a53eab68 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); @@ -1068,6 +1074,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; @@ -1092,6 +1101,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 @@ -1873,6 +1889,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; @@ -1895,6 +1914,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