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 E03A8A0560; Tue, 18 Oct 2022 13:29:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E86042BB5; Tue, 18 Oct 2022 13:28:17 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2139.outbound.protection.outlook.com [40.107.93.139]) by mails.dpdk.org (Postfix) with ESMTP id 4F77142B9C for ; Tue, 18 Oct 2022 13:28:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aA2LIYna5HHBOYvrHiArtH1MmraAlAj++P3ttlGR9HwUsvu1IcGpr3vaxutYcvLMwbzmyRP/BSaM0L/zmbA04bxASUbNW7ouRNKOabF/VECYO2a+DCRG3ozS1byj7i3bbEMrSs4oDNHs0w5cjBUhZUo2TXfMGFrVdrEZPbJ5fzw+VAQD2Pt2TBEFXuCUb+rMRIBDhrjM5ZUme8k+WgRNa+HwWo3seKJZqd0itsgizYXciXqf9/ddx/fsTKoM9Ra4nb+dIAnnMirTqvVp34DOQC2ZCXj0dzU2WfKj+BfjgOlaaDnl6VjTXAgRRmpOz0598PcjRaKRHJygFk6MPc3K+A== 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=nhPSGSHWRj9huYOqTfE0qstvT3rVqdWjR9h4DVDzulk=; b=eDvqfpLLpHXDTpwPu5GODnSgtn2aszxs1sckGrrkNpy9+fKQVVOXQAsNE1FwIDzUYM71A8ZwPTu5A6iCNeAytDrxuXm608Zj/ZtldKna5eeBX+9hnRzfqUDaV38t9LrZQC1bc/jspSQrex2Nf1m1COEkL0mXMsyQsqR91fsVVxqMaCEIUG4BeMMUwqDvAboWefTkG/WE2LAebS9EdDxnYzUhV3pFU1hEs+Ck/WWdY3MrWYNeMAXkrzLgJ7vfDuyNLfPTLrjMenLyuk6MBA9EVV/4F0YlJnjWoySUc2A5a6Mzrcaj5cEZvFj8fY+4zO+P3swpCXXRb7N1T+z3GDDf1g== 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=nhPSGSHWRj9huYOqTfE0qstvT3rVqdWjR9h4DVDzulk=; b=mhYXWNvm6/vZ5O6MSNbyBFqS3sB64QPlWln2b72+0VPDUvGkzT6ohgbpri77G/K7+KinOzBmcuvm8scKwgVxVLDVG1uS30bJFFMcTIOpaQmofA5a9ve7PPPwgj2FWd/2rlLoGbs+w5+P/o4mVeTVU6n4xoUEv2LxWEm4HRBR0ho= 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 SA0PR13MB4160.namprd13.prod.outlook.com (2603:10b6:806:93::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 18 Oct 2022 11:28:15 +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:28:15 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 19/25] net/nfp: support SRC IPv6 flow action Date: Tue, 18 Oct 2022 19:27:08 +0800 Message-Id: <1666092434-10357-20-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_|SA0PR13MB4160:EE_ X-MS-Office365-Filtering-Correlation-Id: a06c995b-44db-4425-0d0d-08dab0fbd8cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JSIfZx2V03CWfXkccmoBngtqlbSBgYRpWg+QO2RPCBFGWvtMkE7jIqJnGeXVOe4yX1Qqj3GkPYsmYSSotiXQVTW7G1K+bRJqJ/J7kiaCKMix7rezRn84L7mO+lRmU7YVzhmKO3Tg6xFvIfAuW/oPn+zWi+DKfqbmpjOUU9rTN+chW/9dVdKQG6ppPeKvq2mAgpL4lB4Vcu8TmtJpqYtnVqpeZvX+LbjuOUkEg+CZpZCpkmT7O4txuIH0SEnSF5ZcoJViS9Y88cVBZN5xLTSZ6UYsvkAUkzVvBQ+YgsG03lCnuo4U2xLEGnY7O388gwAdXNevQnkQxDG3iSxcgJ1XDNX5APCS9/ikBizOqc91YC2pU3DDziabHPr8Lith10qfe9J/UmNK27g8faY+jZ5pWAzaNMigcfEDpWxT8MzoXdla/4EaJp0sgwzzYkCpr6WBJoZr7QQsaZ9kQjTK7WCi3jFrRal9xOFzjQX6pEJMek/OJO8spqrcisuMrG/9nzP/b5Z8UlW4x+f8nvQRQuJA2GozXB5jNoqhQ15DFwyhypFN8wuSqJsaPoGjXZHjru3iOaqidLX+iqD8no4MPPLm2V+U+Fo9nKTsxWsm2F4vMzRmE7Juw8oy/cX9dra+gYTLs7fCIMQPd2w5p/72ycWIjcZ3pwCk2nTdpSyU0i8eucJeLY9hHR5YP8GyPsO4OXnvGipea1cYuk8QO5C6I8EYTDEImJkMIzKr7iAiXtlC3CPyCFVlyRFoCRFKWY+LAUqI54KHhIKy+Uv8ek0npickrSTy9s9hIVxfR31BKK6hN3CUpE6SP9Q53lzxNCcV8Qob 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)(376002)(39840400004)(346002)(396003)(366004)(451199015)(6486002)(36756003)(41300700001)(4326008)(38350700002)(8676002)(66556008)(66946007)(107886003)(6506007)(6512007)(66476007)(5660300002)(2616005)(6666004)(44832011)(8936002)(26005)(478600001)(86362001)(186003)(6916009)(52116002)(83380400001)(316002)(2906002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?akdHdnFtMjhtc3BWU3ZuYmtDQzBJY09KeVpQN2NhOTN5aEdIVU42SlBRVFRx?= =?utf-8?B?MkFyZFo5NHJQRnNMeStyUHlyRTRHZXVkTTczbkljNTRKMHo2QlpiNDVzeWNL?= =?utf-8?B?djAxb2xIb0dKK1lRanMyWUpFRjI3ekhUVGtKTGFrQ0dFWWprOVl6RDQzVFNP?= =?utf-8?B?YlFHNXNJdXBJSFdDZy9jSVE2ejBUUEFKZ1orRjVLdmd6WFhLMWF6OUNCWlpu?= =?utf-8?B?ekxBU3hJQU9wY1ZJOE5sU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aGE0UE1XcUZyVDE3SHgz?= =?utf-8?B?V0R3eW1kNjJOWU1Yd00wSnBJaEh5alhkV1dMa29EZDNDdkZBR0UxWFMxdC9D?= =?utf-8?B?ME94YTlrQlFWaFFOcDgzYTkxT2g5dnFjaE5mTlhJam1zWDRDRWF3anNnZGU3?= =?utf-8?B?SXc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: a06c995b-44db-4425-0d0d-08dab0fbd8cb 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:28:14.9793 (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: qBpmxzba2oqMDjhfPxCt5lfUsNfkqS/bjJJM+6BFXr0OS3MIBG7cuY1E9BWI+JFrzKd4xSBcmjpx7aDvW36A1dAuyOZSWqntddkH/DuLyfE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR13MB4160 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 9bcc8d6..d841782 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -47,5 +47,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 19fc8ca..839f559 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -649,6 +649,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; @@ -1340,6 +1344,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) @@ -1474,6 +1504,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