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 DD2D1A0543; Tue, 25 Oct 2022 10:01:52 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BCFF342C18; Tue, 25 Oct 2022 10:00:28 +0200 (CEST) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2127.outbound.protection.outlook.com [40.107.212.127]) by mails.dpdk.org (Postfix) with ESMTP id 7AD0742670 for ; Tue, 25 Oct 2022 10:00:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fu31xS2N98CXQ9IXg+bpkKLrVL8ZiWCl9XYt0OrF2XmtfI/+Oora0FDS9Zdy/Qcu7q4NAo4gzr0/iRFzovUr/mEwR3Op0W1JC/cG0o2LmCeOQVIT/LufmlS9UVRnJhkfXP10AvF1d1tCjFmJ3qCtH4PcgK19ECinFfYuk2TQj8ymn9xHM26NPw5yFgUxTrNNbrXIhWVbA82LVE4Kog0TZdv6ktdKn8EZz03r88IrCeBjnm95TaA5j0PGRSiDTvBylwymN83GnBBKW8zoYw77C29wE93zZHU/ZH3eLomPgVgLWQjEPZTg8Ws1aZdD+aiBJ3Ja62EIoMwAze7dweLy2Q== 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=uI8XgCvsUW9YnuhnxrjzfO5G0L8OgbwG03tzSJAHEu4=; b=e8aVc+TNlYA9wo7rSpAF9S+WC5BSurcJqHleeQ8sDHgfkL6QQ4iu7oXsmxJr4gmoYJMqL0eOFkPZjxtrJuPi79wcVHG8jZeJeGkC7nLctEvINNEY3jSvpIRtm9ht5kVj/1NP6X4JOkfivK6OyW16KEFSyf1PIJyCjWpbb/VbaiBOb3b7jDlQ5/vWR4EwUfiA7tBTq3kVykP0Di0qMz45nruPWTfp7dwvs+738apQoLnqTHJCheQGkUEZviEI1FIRyUUL0qQitGmr0peCIDC24oRyqWvCvv9q7hLn9G9padqBKa+0TXNkPx9fVcJO3dNY50+2GqVomDumNCGibOPmDQ== 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=uI8XgCvsUW9YnuhnxrjzfO5G0L8OgbwG03tzSJAHEu4=; b=ijfB8F4RNg5BMER/3f+EaMWp1IJJcTnJrFRdTtVfe4IWXHtKZ0xvJnsU9Nq+52hK+z9MS2DlpjJu75MyYnE/JPBLAhcRrVwtkJXE1wYLuJ2nr3cga95vNhOeFrt4dGb97UzVFTm9knTIg8dl43rEWlA4pGfCvg2bUpL7wBxvB/w= 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 DM6PR13MB3924.namprd13.prod.outlook.com (2603:10b6:5:28f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Tue, 25 Oct 2022 08:00:18 +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, 25 Oct 2022 08:00:18 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 13/26] net/nfp: support IPv6 GENEVE encap flow action Date: Tue, 25 Oct 2022 15:59:05 +0800 Message-Id: <20221025075918.7778-14-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.29.3 In-Reply-To: <20221025075918.7778-1-chaoyong.he@corigine.com> References: <1666427069-10553-1-git-send-email-chaoyong.he@corigine.com> <20221025075918.7778-1-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR01CA0142.apcprd01.prod.exchangelabs.com (2603:1096:4:8f::22) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB3924:EE_ X-MS-Office365-Filtering-Correlation-Id: 99ca9316-d9cc-4487-870e-08dab65ef501 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HC1E9qpq1trhTeJW/1kzh1wbDdGGemBuvI8GQvNsvp59Wx61dTJuslxCuf0qymTkbdXHqAXCv6UhwwwYN/t1Oa0NowQA0nKfQpwj1fo/BzPbBlV8LeB1Yv9D3UKNm6ZQ4t1X0JLT+AQpY/CyGyl8wTJ5dCvgV6Gy9srmJaZ9g4K+VheG7tYM4cmUDX6SwVbuTDAXiTsc/2QvtFlkjjaRBPDHg+YkMePE9MdAfA+l/nPMaZ85heAUwNJ0ti4kE8dnCE/WdKyQWvjEZYwhkE+CBqxTGQmWSVaAFzz4uoQDkjphHKkuUjJ36xUVQCvbg21fEw5diPvnfhgfjR5IZhQ+Xh4TcbK60hH97khEubyH5CuMkVA38JQkDcmy5va31wiSZkht3mo8L2/XTAOJPasABRvf+Q24z8wa5uLvJ7Y2M17jf1tv2NG4WkzBA8zW2Ny98ojTjXSNNivygY6l5nySiC2T81YQDWDd9DhE2IYeU2oB5hyasr4FZpVr8zA7R5hkeT1vUwxWZBlmFkgOL52CThqNVbrWYbFmWNgPnJJZvSJW7rLW0eAtr3BUUjND3dXSnoZJrCV18YbqRaw5sRAlU1gfqSsTdsWGm/T13G0GsNOqpoNhWTFSEK5Xir1oINfen4liREe/VFB15O5viMc2HxO8ldKTGJv3CSEVL9DblzFRdcOHEqqm2XwAyj0dETAV1ADN3ATRIyW6DvYmbHUSadUbLmlZiL+pfGYWryxJPmTVUOuQIK2XrobXi5YIJyF5ZizlN5ZWa+VPReM7NGiB7Q== 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)(366004)(136003)(346002)(39850400004)(396003)(451199015)(86362001)(2906002)(6666004)(186003)(1076003)(107886003)(83380400001)(38100700002)(41300700001)(2616005)(8936002)(6512007)(36756003)(5660300002)(66476007)(66556008)(4326008)(8676002)(52116002)(66946007)(26005)(44832011)(6506007)(478600001)(6486002)(6916009)(38350700002)(316002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RXNYUDRHY2loMFRDYWttd214SWhWSytRRHB1blV5UVZLOVBLNGJxSTZwR05x?= =?utf-8?B?UGNRanpOUzM3SXprV2VFR0tMVnd0eEhLMUVsamphS2VsNE5MN2xEdTZlQ3pq?= =?utf-8?B?dXcwZGs4alB2Qjh2Nk5xTTd0REljcWF4bkp0OC9OYnRldlRuaFBkejBRTUhE?= =?utf-8?B?dkoyYllxS1oyOC9RMUdTOC9MNnAzanpuMFUyZVo5M1hveUovZUMxazh1b2V3?= =?utf-8?B?bWZNRFMwVEZ6TnpMdE9WUHFsWjdaNFVDQiswc25kRjhaWU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FHRDZlZXFTUFhRVXNCSzBnY3MvOWQ0NFZ3ZlpmMVljTjdKb2FzSmUrbDVP?= =?utf-8?B?VDR5ZW9QSzJFRGhRQkZEZ1ZjRWZ6d2JOV1VyNzZBZkRtWGhEVGdDTXZxUDV0?= =?utf-8?B?UFE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99ca9316-d9cc-4487-870e-08dab65ef501 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2022 08:00:18.2089 (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: cF9hOX/dQC9yZNyveLLnAVOpDh4elyPtaCIYD00iVEK3edR/nHFkZopRunU9oBRgEi6ttA12nlSoxLvfKqP+ybm4cXYkYMBDt5yIfz46ZRA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB3924 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 offload support of encap action for IPv6 GENEVE tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 7d19781bd9..8416229f20 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -43,6 +43,10 @@ struct vxlan_data { sizeof(struct rte_ipv4_hdr) + \ sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_flow_item_geneve)) +#define GENEVE_V6_LEN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv6_hdr) + \ + sizeof(struct rte_udp_hdr) + \ + sizeof(struct rte_flow_item_geneve)) /* Process structure associated with a flow item */ struct nfp_flow_item_proc { @@ -2672,6 +2676,47 @@ nfp_flow_action_geneve_encap_v4(struct nfp_app_fw_flower *app_fw_flower, tun, eth, ipv4); } +static int +nfp_flow_action_geneve_encap_v6(struct nfp_app_fw_flower *app_fw_flower, + char *act_data, + char *actions, + const struct rte_flow_action_raw_encap *raw_encap, + struct nfp_fl_rule_metadata *nfp_flow_meta, + struct nfp_fl_tun *tun) +{ + uint8_t tos; + uint64_t tun_id; + const struct rte_ether_hdr *eth; + const struct rte_flow_item_udp *udp; + const struct rte_flow_item_ipv6 *ipv6; + const struct rte_flow_item_geneve *geneve; + struct nfp_fl_act_pre_tun *pre_tun; + struct nfp_fl_act_set_tun *set_tun; + size_t act_pre_size = sizeof(struct nfp_fl_act_pre_tun); + size_t act_set_size = sizeof(struct nfp_fl_act_set_tun); + + eth = (const struct rte_ether_hdr *)raw_encap->data; + ipv6 = (const struct rte_flow_item_ipv6 *)(eth + 1); + udp = (const struct rte_flow_item_udp *)(ipv6 + 1); + geneve = (const struct rte_flow_item_geneve *)(udp + 1); + + pre_tun = (struct nfp_fl_act_pre_tun *)actions; + memset(pre_tun, 0, act_pre_size); + nfp_flow_pre_tun_v6_process(pre_tun, ipv6->hdr.dst_addr); + + set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size); + memset(set_tun, 0, act_set_size); + tos = (ipv6->hdr.vtc_flow >> RTE_IPV6_HDR_TC_SHIFT) & 0xff; + tun_id = (geneve->vni[0] << 16) | (geneve->vni[1] << 8) | geneve->vni[2]; + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_GENEVE, tun_id, + ipv6->hdr.hop_limits, tos); + set_tun->tun_proto = geneve->protocol; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v6_encap(app_fw_flower, nfp_flow_meta, + tun, eth, ipv6); +} + static int nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, @@ -2706,6 +2751,10 @@ nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, ret = nfp_flow_action_geneve_encap_v4(app_fw_flower, act_data, actions, raw_encap, nfp_flow_meta, tun); break; + case GENEVE_V6_LEN: + ret = nfp_flow_action_geneve_encap_v6(app_fw_flower, act_data, + actions, raw_encap, nfp_flow_meta, tun); + break; default: PMD_DRV_LOG(ERR, "Not an valid raw encap action conf."); ret = -EINVAL; -- 2.29.3