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 088B2A0566; Tue, 18 Oct 2022 13:29:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D0CF42B7A; Tue, 18 Oct 2022 13:27:58 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2100.outbound.protection.outlook.com [40.107.236.100]) by mails.dpdk.org (Postfix) with ESMTP id 5D4CC42B7A for ; Tue, 18 Oct 2022 13:27:57 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HnkA5OPs8h1S2pS7olpVVcbLcBMK3fe0XWJZ0bcHkd67u7VaJI6BPBiUSnsfb4M8ho4RrFm2YodqoYZo0Q7zhMhaRommIcZb2IkGU1yJrA9Fb35tn3ZdF7Cjp0NVWIIDsr6SbjJMAi/1jVIND0hDAkBBML6BR1+BzxSNZwm/pJ7veFWF/2rnJlCNB1uTVZokiAGrIbOcqdTyYeMGOKoni74dcVOKrkHWXLczlXeciE03LIOeBCzkvUmz66RaNRZD/AECUIQ/zXPJSE4q4lnjvIPQ2il0s5TiGF0KgCVg4a3WzX89NmXPPfz9IQjtXsH0FXXKjLTBqvPVFM4hyqcunQ== 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=gLwy0vFGNjFF/KGMfXTM2U2gd/gvUGBSsbMfcf31Kkk=; b=LWdQip6pYSzSI5LF2lwhkvRGFVU8WUnzxr5pnz+Imfiaitb+H2ayLonM3XIjqyyiDSzZKk0aLXjeFgl9AgSRGVxF6w9sM8SjCM2Q5xga/a8R7pRaBgchSHh9Vzub71sUeqe9D8QTGaEdg4BjbiI3o8je0myUP60Uw7OLwgeuEhwW2ndFdBOfSGclz57UE+6OnjvwaYpUkvB52jaSKTNWTyuxT7TUQWo3IIpKAlaoIVZhpPPxJEsREpy42ImgA4keYgkAGfa2DD4fsWRVOvLBD92FRIL3FWVFQVD9ITn1Fioe+cXjFl42MG9KuZuo8TjLMiW6j/tmJFADwgFP/sOxWg== 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=gLwy0vFGNjFF/KGMfXTM2U2gd/gvUGBSsbMfcf31Kkk=; b=neQzVM+tALvc0SGv3n/ZHTCCYU8/k7Vsg2JY0zUKrOoT0d1HwpoSCMGCa5TooHcpmQqn2KCo29jgeN2bquc7kc72CnDcCX+KBvr0tuM7HDUASdXC/wxBh9sMbJoogF4z7m63opJ1r5We8bjCnTPxzW38pauyaho3uNp68oZistM= 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 CO3PR13MB5686.namprd13.prod.outlook.com (2603:10b6:303:179::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.16; Tue, 18 Oct 2022 11:27:56 +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:27:56 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v4 11/25] net/nfp: support UDP flow item Date: Tue, 18 Oct 2022 19:27:00 +0800 Message-Id: <1666092434-10357-12-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_|CO3PR13MB5686:EE_ X-MS-Office365-Filtering-Correlation-Id: f19fa9f1-2287-4102-1a5b-08dab0fbcda8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j57kqmiMs1VZyJWQL+RaE75/svreWCBulfl19xRkl70ayx0tpcsOZEPGljg+GzwcdNjuixPZdD9L9lZ8/7TeAXW511yiN2n++R7Nom3PIbZM8xwapkRsZv4jWiDQRCtNjgrUETKmmbzFLWOQ5MT0fjFmVKEqNgv0cMLxkSfdHnbXkW3K/8Rjdl/CToZ3xY0nx6Q6W732PVXoux3WsjHR4amExdp1DbstjYZzunausPw6cXYSL3BrkTm6MxKmcqPsA9KrD8vrJIYBMLZYicDD4bhHZ3WVYJt01t5WTOEdxhMXJbeOci8nULxi0trMkdE08yvRi5PVhLSC9iF+n69e4Q6+K2aqnB5FkMsa1RhcUZULpFkcOwhaUsfah7edq4o33DJ30R+kflfQlB/oJYI6SGh88d+Wupkq3nlphE48dBdEfdxMSJHqTCnq0t2Bs7YRmzD1A5g/bcs7OxIMPTRy9+6fC4nNYqnPcN9HVPMToiHW/n+E+Q0/C20xclK07U3ChMeMZ3jkj3hJyqVjNgy56T2HyvZ2h0k8Xa3lfX4lNBeolJFME3d92f2ndtSM0bR1ro3N3UmSSEUEige1kd7n/92cusIGHHaxouijgrCcRBIMZLhdkpCWQVWXHJ1FcUJ4Wg2HjPnRq1Eqof04mIjDGroaKEwfRmS8s0SSwYkjXvPR11h8YL4QurhJoRfOm8zVXfeJimZ0Nu/3W7J9Fh6QxrUmLRx01Gs2OK43usEZ7Pt7xIuJoNjpmalTAtVKg2hccCWGFn1EntHrnimd8Za+vMYRxRW94BaQi4odYAM5JD+BjPqPaxsjiuY8D4UPk4QA 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)(346002)(366004)(39840400004)(396003)(136003)(376002)(451199015)(38350700002)(38100700002)(2906002)(41300700001)(316002)(66946007)(66556008)(66476007)(83380400001)(4326008)(8676002)(6916009)(86362001)(44832011)(2616005)(8936002)(186003)(36756003)(5660300002)(6506007)(107886003)(6666004)(6486002)(478600001)(26005)(6512007)(52116002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?djFSNWZITUNjSVpYbk9TU09ieGg0WkdSMUY3cjNoWWFkaVlTYWRFUFJxcGhn?= =?utf-8?B?VWRyejNPOFh3K2R0VnB1Zm1JLzJ6aWpvRjB3SkRFaTRkeHBudFJ6ekc3dkc0?= =?utf-8?B?VVlTVFQrRWVwS2l6Z2x4L1REL2N1TXpCS3VtWElnS0FtOEF0aU9XU2hSUVEx?= =?utf-8?B?WHJsM2pVeWpNQ3BydUZWK1lhSHBSTTRuanJVZmJZZ1g5Qk1TU2twUHI0T0Ur?= =?utf-8?B?V1JMOStuMEMyS2pYb0NhV2NJSjFqVWR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yazFnQTJTYVRveldHTnY2Y3ZQTVZlRisva0xtTTZuRFN6bTFP?= =?utf-8?B?V0dMZmY3a0llbEN5bzBrQlkwbVlGMGhqSXloL25mSVF3OUFHanVaRlpyQXE0?= =?utf-8?B?REE9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: f19fa9f1-2287-4102-1a5b-08dab0fbcda8 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:27:56.1222 (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: K+g3P1pYP92trlGMOlGHYbs5npfSHzRcH+HX64rojKApZDn5pW8JFCmfbw4WgYbGJH3Jq2CAtgOPt7A3MLndR/lUKSLkIqZm/b/hNUHqGu0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO3PR13MB5686 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 logics to support the offload of UDP item. Signed-off-by: Chaoyong He Reviewed-by: Niklas Söderlund --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/nfp_flow.c | 63 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 108f47d..3f3aaa9 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -33,6 +33,7 @@ ipv6 = Y ipv6_frag_ext = Y port_id = Y tcp = Y +udp = Y vlan = Y [rte_flow actions] diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index 7727c32..afc7099 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -549,6 +549,11 @@ struct nfp_mask_id_entry { key_ls->key_layer |= NFP_FLOWER_LAYER_TP; key_ls->key_size += sizeof(struct nfp_flower_tp_ports); break; + case RTE_FLOW_ITEM_TYPE_UDP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_UDP detected"); + key_ls->key_layer |= NFP_FLOWER_LAYER_TP; + key_ls->key_size += sizeof(struct nfp_flower_tp_ports); + break; default: PMD_DRV_LOG(ERR, "Item type %d not supported.", item->type); return -ENOTSUP; @@ -850,6 +855,47 @@ struct nfp_mask_id_entry { return 0; } +static int +nfp_flow_merge_udp(struct rte_flow *nfp_flow, + char **mbuf_off, + const struct rte_flow_item *item, + const struct nfp_flow_item_proc *proc, + bool is_mask) +{ + char *ports_off; + struct nfp_flower_tp_ports *ports; + const struct rte_flow_item_udp *spec; + const struct rte_flow_item_udp *mask; + struct nfp_flower_meta_tci *meta_tci; + + spec = item->spec; + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge udp: no item->spec!"); + return 0; + } + + meta_tci = (struct nfp_flower_meta_tci *)nfp_flow->payload.unmasked_data; + if (meta_tci->nfp_flow_key_layer & NFP_FLOWER_LAYER_IPV4) { + ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv4) - + sizeof(struct nfp_flower_tp_ports); + } else {/* IPv6 */ + ports_off = *mbuf_off - sizeof(struct nfp_flower_ipv6) - + sizeof(struct nfp_flower_tp_ports); + } + ports = (struct nfp_flower_tp_ports *)ports_off; + + mask = item->mask ? item->mask : proc->mask_default; + if (is_mask) { + ports->port_src = mask->hdr.src_port; + ports->port_dst = mask->hdr.dst_port; + } else { + ports->port_src = spec->hdr.src_port; + ports->port_dst = spec->hdr.dst_port; + } + + return 0; +} + /* Graph of supported items and associated process function */ static const struct nfp_flow_item_proc nfp_flow_item_proc_list[] = { [RTE_FLOW_ITEM_TYPE_END] = { @@ -886,7 +932,8 @@ struct nfp_mask_id_entry { .merge = nfp_flow_merge_vlan, }, [RTE_FLOW_ITEM_TYPE_IPV4] = { - .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP), + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_UDP), .mask_support = &(const struct rte_flow_item_ipv4){ .hdr = { .type_of_service = 0xff, @@ -902,7 +949,8 @@ struct nfp_mask_id_entry { .merge = nfp_flow_merge_ipv4, }, [RTE_FLOW_ITEM_TYPE_IPV6] = { - .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP), + .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_UDP), .mask_support = &(const struct rte_flow_item_ipv6){ .hdr = { .vtc_flow = RTE_BE32(0x0ff00000), @@ -931,6 +979,17 @@ struct nfp_mask_id_entry { .mask_sz = sizeof(struct rte_flow_item_tcp), .merge = nfp_flow_merge_tcp, }, + [RTE_FLOW_ITEM_TYPE_UDP] = { + .mask_support = &(const struct rte_flow_item_udp){ + .hdr = { + .src_port = RTE_BE16(0xffff), + .dst_port = RTE_BE16(0xffff), + }, + }, + .mask_default = &rte_flow_item_udp_mask, + .mask_sz = sizeof(struct rte_flow_item_udp), + .merge = nfp_flow_merge_udp, + }, }; static int -- 1.8.3.1