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 405D2A0A02; Thu, 20 Oct 2022 04:23:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9B0C42C62; Thu, 20 Oct 2022 04:21:37 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2092.outbound.protection.outlook.com [40.107.237.92]) by mails.dpdk.org (Postfix) with ESMTP id 2704F42CB2 for ; Thu, 20 Oct 2022 04:21:35 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JuspxHQRDWmOdIfexdeaMmNSq1G3dKQxOHra8fWxiFSB4HY/z2q76ucXJlbWgGZ7ZSN3vnkS82Gw6h0aripYYexAJuimsgq+nqUR9/DG7jmkpsrEfM/u7qfuELrCEAKk/i/0lGcm7tp0wQdcV6ICZpgc8WiCMrdF7cr5ZMrrOTdAkLsn1t2i6ZVjACQjJ5FqvZV42b1JX1cowCV+guGFMHgJUqI+L5+9tUciAm6jDotk/9YPz3agw8pCtr6ys4CNBrq9FkjxRAJFsJlHVs9wV/Y8hM2Kd9Fsp1xMQ73dSvbcRyzEUxVRVIKnycDA15YW9oPaF2arGI2+arHMhbE7FQ== 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=FBPaJG42+dCocFNHLWEZK0YWlXILSd74UegFqi2PUcs=; b=hFh1+oYp0Q1YdcIDmwrfrOkh+YzC9+43vWYzpx55mB2hBuk+zbQp02umW9CCW39sYnIqwFwsSCblNZ72barb5njs5S9FhDlv9wwpIKyVQbZY3ZETFGlGoCShLZEy6hqn6HMDqVAGKIGbU9sfegZlm+Kiryda7jknNxgUoQBo+xXvqm+b56eJwOwMICYREeBxoBlItbqfqQ+KgXXnRqjyNPWLdSElZ1ipGfCSEr+mmsycZVNWd/GnhN14MPXDEcYUbnAMOjzE54B1Q5hcJ0ScrmIzsA756oV62zVKxmhGY7dfItUI7UyRfNS3NQlM9pq+VL0peEEpNFaiSpdP29ezRg== 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=FBPaJG42+dCocFNHLWEZK0YWlXILSd74UegFqi2PUcs=; b=fzlIlLaI9JrBnS1vkG9Nq+HLnS4ML2bRnFezTjYVZe6UfujOhfDj47MP7St2EZMnI62DXgOazUBCCdF1L2fdL56TKJgo8LuffBIfl3/MUVbowZDdq4lTkaSJy5/h3oTOKeELNHIvjvyqQvo6GJbOaLo1lkXKYbDM+GJ2KZaIZj8= 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 CO3PR13MB5784.namprd13.prod.outlook.com (2603:10b6:303:167::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Thu, 20 Oct 2022 02:21:33 +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; Thu, 20 Oct 2022 02:21:33 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v5 19/25] net/nfp: support SRC IPv6 flow action Date: Thu, 20 Oct 2022 10:19:45 +0800 Message-Id: <1666232391-29152-20-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> References: <1666092434-10357-1-git-send-email-chaoyong.he@corigine.com> <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR02CA0048.apcprd02.prod.outlook.com (2603:1096:4:196::23) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|CO3PR13MB5784:EE_ X-MS-Office365-Filtering-Correlation-Id: 02ba205e-ba00-498a-713a-08dab241ce74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pEab6aoeuCoSDejWddgtHgtxV5dkyah0A7/PXRANq8KScCstnnQvpwHXeku3V/pqYSmLSIju+X/rCQO7h6LUSrMjGQTI9T/Vhq/N5urSSbVlOK6sC3xbenI+IKelTfiCGkNbQGOFF/wQQLgoAbdKxqUQE+h0nYem4jm8uOV7cLXFRHex0VOHpwWRgoDvh7hAVFOl8TmNyc9m4Gq5nsjuoGwI9BiBG3If1/TEeSsMdiIAU27KcZNQxgo3TQULOmWDh+E/MZiF+8yFMjgLdHsahEG+PqBsmnQSDv6XBxdabz6sEalS8Dm29LBeO1vnRYEtaKnrXqb+kSmV588fYK8kW3isfSpqXFSck9HY/YDzaYoQPTQ5iTABQoFFh2SS16+YT3bLOxgjwKRCVH0ZIuIpkX/J0uATiUo9YCorzXZDJu40RETOnX8w6HFg4dD5uPcMG/saEDJHj+3S/ZwD31ZJPQwxBLvr5kSN8ArmzIKOjFdsqbrJrQmtXC0+AoeHXSYzbI0g5sWicqAhnWZttpRK6D/dNT1Q3Wm5KucI80AZexsVu02r9DGpd7oi9vdHMrOZeakrCtMrF5HdKwxTuxHQxLE56KCx9ihjy9rg/sFxXnMPvcuBEt4+XUxhbpUFzE3FgxeGyIeepIIQS6MexqPjBxncC+eZy4aB4IIxXdb9AWIMGCg+HbiU+ru4Iwfal0amUrkB47QwAUImk4tvS16Zfh2gpPxKaSND0onRAo1bbHqr0hQuF4dfGp1zq2SGq+SmvTvoLQ0373GnnUGNYhaYuQ== 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)(136003)(346002)(396003)(39840400004)(366004)(376002)(451199015)(6916009)(44832011)(2906002)(316002)(8676002)(478600001)(41300700001)(66556008)(66476007)(6486002)(36756003)(4326008)(66946007)(5660300002)(38100700002)(8936002)(38350700002)(2616005)(6512007)(52116002)(186003)(86362001)(6506007)(6666004)(107886003)(83380400001)(26005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RDhOc1l5dDZqVWNlWEFXQVhURDFJTEJVcjAwcUI2cVl6ODVqdVhmWGYzWC9P?= =?utf-8?B?ZUoxd0pUcEJ6MzFPK3dZMldmYjJyVHNuYjY3SnVwNVI5alhjeFA0U0c1WU92?= =?utf-8?B?M3lqeWVoUEI3TU5hYXJNb2tlT3JBUFoyOWRFeWRKcExEZy9IS0tkZWJIWEtv?= =?utf-8?B?djNjamw4OHBtUU1TcDhmM0VuRnNHTVNOa1RkNWxLZ01EaU50QkhiUEpRaFNs?= =?utf-8?B?ZDB3QnpQRHRpMDZ2dHltZUM2eUNPZysxaEdaTzJ6UjlzeUR1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OUlwU3N0bWxUdWxjVTlycjJSK3IySnRWaFk4MmtDYVUwUjU2?= =?utf-8?B?Z0dzaE1ISVo0STRCNk1UcjVrWXlhYVo3cUZDelRmeGxPUUJ5NDVPaHVCWGFK?= =?utf-8?B?ZlE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02ba205e-ba00-498a-713a-08dab241ce74 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2022 02:21:33.5670 (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: SVaZcGWmYrlKy4RlrGoMk3At6+ZhSTp90oa4mTYv1KZPYtkpc9I7V8E3i2ehkhzNuK2Lq31ZMt6AAZPgFIMg4Bkewi/AYpMHDKLkRtaMVg8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5784 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 set source IPv6 address action. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/flower/nfp_flower_cmsg.h | 33 ++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_flow.c | 35 ++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index ddc457f..b17c701 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -46,5 +46,6 @@ of_set_vlan_vid = Y port_id = Y set_ipv4_dst = Y set_ipv4_src = Y +set_ipv6_src = Y set_mac_dst = Y set_mac_src = Y diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 77cb51d..45e50dd 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -399,6 +399,39 @@ struct nfp_fl_act_set_ip4_addrs { rte_be32_t ipv4_dst; }; +/* + * IPv6 addr + * 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 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | - |opcode | |jump_id| - | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_127_96_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_127_96 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_95_64_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_95_64 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_63_32_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_63_32 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_31_0_mask | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | ipv6_addr_31_0 | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_set_ipv6_addr { + struct nfp_fl_act_head head; + rte_be16_t reserved; + struct { + rte_be32_t mask; + rte_be32_t exact; + } ipv6[4]; +}; + int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower); int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower, struct nfp_flower_representor *repr); diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 5bd1eec..21a7168 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -637,6 +637,10 @@ struct nfp_mask_id_entry { ip_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC detected"); + key_ls->act_size += sizeof(struct nfp_fl_act_set_ipv6_addr); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -1328,6 +1332,32 @@ struct nfp_mask_id_entry { set_ip->ipv4_dst = set_ipv4->ipv4_addr; } +static void +nfp_flow_action_set_ipv6(char *act_data, + const struct rte_flow_action *action, + bool ip_src_flag) +{ + int i; + size_t act_size; + struct nfp_fl_act_set_ipv6_addr *set_ip; + const struct rte_flow_action_set_ipv6 *set_ipv6; + + set_ip = (struct nfp_fl_act_set_ipv6_addr *)act_data; + set_ipv6 = (const struct rte_flow_action_set_ipv6 *)action->conf; + + if (ip_src_flag) + set_ip->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_SRC; + else + set_ip->head.jump_id = NFP_FL_ACTION_OPCODE_SET_IPV6_DST; + + act_size = sizeof(struct nfp_fl_act_set_ipv6_addr); + set_ip->head.len_lw = act_size >> NFP_FL_LW_SIZ; + set_ip->reserved = 0; + + for (i = 0; i < 4; i++) + set_ip->ipv6[i].exact = set_ipv6->ipv6_addr[i]; +} + static int nfp_flow_action_push_vlan(char *act_data, const struct rte_flow_action *action) @@ -1462,6 +1492,11 @@ struct nfp_mask_id_entry { ip_set_flag = true; } break; + case RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC"); + nfp_flow_action_set_ipv6(position, action, true); + position += sizeof(struct nfp_fl_act_set_ipv6_addr); + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; -- 1.8.3.1