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 E8D96A0543; Tue, 25 Oct 2022 10:02:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B443C42C39; Tue, 25 Oct 2022 10:00:40 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2105.outbound.protection.outlook.com [40.107.223.105]) by mails.dpdk.org (Postfix) with ESMTP id AAA4B42C1A for ; Tue, 25 Oct 2022 10:00:29 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CLarJTG849p/chQU5noTUjsgCruOoT1T+xsHOtEXStZgDVMNwJUrDnvWK3SmW+SvTFNBM2I9sNo3ILDbz5z9LS5iAFzSS58XyrvWHG4nS3mSCN4J+IQRKhRYarWrH8aI3F6wIGJ6ZzkdAi5NcM1LRN8/IYwbUAlTENWETYMQgdT6s2o30t/zkEzS7qYjTai53tSEVgQEo9sktsWD0QrkM+PSiswxkOaSTET1kK8d+GMvLl23V1XR3ack3MPFazhOKPqmfbNpkhKHXxnvmiAOiUGiZO6uXD97KCVoWA5P8yd9s288F6Cqzf8Te/Z8wpgWt5zql9LNFIoltmxyyNaQ6w== 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=y/RxdqwhS+Sm6720XaunjWC6mXg8PHzA4nYJCgTFlII=; b=NjVJ2Uu7Zn26djmDAi7YO6yRy1ZTroiaOYArvhZOt4PaxirSZecxR39g2SNWa7I6V6nqK4n/b0e5/nG7Udvt2LH4LPo5bNeS7cUT+NNZqvq0u9iNsX5nlDwXB5c4QbLG6yrb2G5iOlUGTAex97/SCBez/xajYR3bQyQ3ehDemYpnUzTiSbKhjRWEybgKu6M2qAFqV1wvQerngdzH06PibYJ2CWRHrS8dH8+sw8rAQ/Q0+QvbZMxCWFc2J7Ma+7eQK5wbrNv3fbhL9Gf71kCoYwV51Qye1tkKlcxJG2oDlA3IMmtuFCJI2RKYS0V5gr3Q5FW+MefbyWrcTb7Th4TUvQ== 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=y/RxdqwhS+Sm6720XaunjWC6mXg8PHzA4nYJCgTFlII=; b=NZ6PHUwGpGOB/fjPcaGzi05tGWWnrWQl75zuOeyk+Vo3AtpY3oA2Jg9xDfY/kePdf4mwkoO3azHwAh5L4TSk27z0Dfo4+UVTcPBIZ1uX8TaW0sraKSbY8L74AsXcrRGnAx4x2AYetTKLAc25q0biVi5ytqI5LYlxUvtVMTkjXes= 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 MW5PR13MB5439.namprd13.prod.outlook.com (2603:10b6:303:196::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20; Tue, 25 Oct 2022 08:00:28 +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:28 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v3 18/26] net/nfp: support IPv4 NVGRE encap flow action Date: Tue, 25 Oct 2022 15:59:10 +0800 Message-Id: <20221025075918.7778-19-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_|MW5PR13MB5439:EE_ X-MS-Office365-Filtering-Correlation-Id: c0fafe9e-204a-46ee-dd20-08dab65efb0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V+XL4z2v5qEAjYSMOI/5DiBbd57oxbkn9yA9fnZBY5EVJQj+/kk0r7W3YOcUy60YhanZ57GkC/GvsNER+PMa/0bdlGfK1VjU9a5VPJAIAMqVfGjOPByJ27NI1AK0BdUoVa8OnxMdeIQ1+26n4oc0a8AgXxg11gr7teENnISbTUxxKdfzuAj+0McOxzNB7g3z2wI7AfKMQ8NeiShnKcWi9yn10qOrr10F74C+M2hKaAme1TijkPPKxIj9PfDlxZ0l/pyWXs9zxou47gjXuNrfgHHqCVmuFZYCTonk0o6Qtl/d7UdbBhCLANleJXMSH2pe3XVX9jkbFCxRDYWu76CgIt956OZm1KfhlNeydoaVOFtZaHPZ5VP7gYFs+Msf0rx9O6UYbm9IM7myNSie/FhnXaf2OsAvL0OjL6T8sMtN/EbYuMCtfAE2O/AfgHWIGCPq9bNruPOZ8R50cPMp9KIfCzXRHe25qLP71An1kS2A+OJOWy7xYPYvKZ40xxXtxtmNfKznUkoXN2iy1lI9HADzmLe9JGbjNsc4WzseXlFRXWvuTrF3u9M07yyg+yabyff2zbstHo51vbPjQdW3Ef8fZRN49DwXHzjnKAbPsZZS9Tls0CEQDid4eFhL0QbeHiI1CkofcE/FV8JY69isjiWM+S6bL7qwtPDGoxEf7ctj0eTTXbdjUeHCXIFyBxMSJtjpi4OZ5jX7r/I91Nxi013f9bYSiDT+f6Agp37EQRQR33FE0TXbh/+mIxCV725HerRftOKcmvvsmJv2uoKZp+dcGg== 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)(39850400004)(366004)(396003)(346002)(376002)(136003)(451199015)(6506007)(478600001)(316002)(38100700002)(52116002)(38350700002)(2906002)(41300700001)(5660300002)(6486002)(44832011)(66946007)(66476007)(4326008)(66556008)(8676002)(6916009)(1076003)(8936002)(6512007)(86362001)(2616005)(26005)(107886003)(6666004)(36756003)(186003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?a3VCMlZobXlvT29lYnp5bHRKSVlvTGs1TG5nSHRiRzZWRDI1WWVHV2EwVEg1?= =?utf-8?B?WVBBdWVHbWREMkpnenRXTk1UUEdRT0NscEtHV0c1SGpKK25TdzBlcTAwUmFW?= =?utf-8?B?T0Zwd3lGZDFSTGEraHJNRTlhemJhQmFwc2RxNWp5bEtwR05HckFLQ1ZTdHp1?= =?utf-8?B?c3NDejB5NUJOdTByeXM1WndHNHBJZVVac1phTGNPSzNNVHBGcjRJQm9YSkFr?= =?utf-8?B?aDFYcmphbUxvZ1I1bzg1OE5UQWEzVWpIaFZMR05NVCtLU1cveU9OZ21NMWtQ?=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GFBbHZqUm9NdEdZTHB0VCtPYm1kU0RNWEVzL21F?= =?utf-8?B?RUN5N3MxVG81S05INUUwaERXbmVIRjZqNUkwR043RjBoL1lKTXFML1ArWm1m?= =?utf-8?B?elE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0fafe9e-204a-46ee-dd20-08dab65efb0a 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:28.3195 (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: rQQp5Dt1LL6t3SWnvpDoIz8OJpqHsu1YhxYee2RRe2mpS1shViiTiMoeK42Eph8aC2uZdcOQGMAuVBrVDukz7CRZlr9pUONdQiEamCS0sWg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW5PR13MB5439 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 of IPv4 NVGRE tunnel. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- drivers/net/nfp/nfp_flow.c | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index ee9c2a36e0..cc09ba45e2 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -47,6 +47,10 @@ struct vxlan_data { sizeof(struct rte_ipv6_hdr) + \ sizeof(struct rte_udp_hdr) + \ sizeof(struct rte_flow_item_geneve)) +#define NVGRE_V4_LEN (sizeof(struct rte_ether_hdr) + \ + sizeof(struct rte_ipv4_hdr) + \ + sizeof(struct rte_flow_item_gre) + \ + sizeof(rte_be32_t)) /* gre key */ /* Process structure associated with a flow item */ struct nfp_flow_item_proc { @@ -2827,6 +2831,41 @@ nfp_flow_action_geneve_encap_v6(struct nfp_app_fw_flower *app_fw_flower, tun, eth, ipv6); } +static int +nfp_flow_action_nvgre_encap_v4(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) +{ + const struct rte_ether_hdr *eth; + const struct rte_flow_item_ipv4 *ipv4; + const struct rte_flow_item_gre *gre; + 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; + ipv4 = (const struct rte_flow_item_ipv4 *)(eth + 1); + gre = (const struct rte_flow_item_gre *)(ipv4 + 1); + + pre_tun = (struct nfp_fl_act_pre_tun *)actions; + memset(pre_tun, 0, act_pre_size); + nfp_flow_pre_tun_v4_process(pre_tun, ipv4->hdr.dst_addr); + + set_tun = (struct nfp_fl_act_set_tun *)(act_data + act_pre_size); + memset(set_tun, 0, act_set_size); + nfp_flow_set_tun_process(set_tun, NFP_FL_TUN_GRE, 0, + ipv4->hdr.time_to_live, ipv4->hdr.type_of_service); + set_tun->tun_proto = gre->protocol; + + /* Send the tunnel neighbor cmsg to fw */ + return nfp_flower_add_tun_neigh_v4_encap(app_fw_flower, nfp_flow_meta, + tun, eth, ipv4); +} + static int nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, char *act_data, @@ -2865,6 +2904,10 @@ nfp_flow_action_raw_encap(struct nfp_app_fw_flower *app_fw_flower, ret = nfp_flow_action_geneve_encap_v6(app_fw_flower, act_data, actions, raw_encap, nfp_flow_meta, tun); break; + case NVGRE_V4_LEN: + ret = nfp_flow_action_nvgre_encap_v4(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