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 B6EFCA0032; Fri, 21 Oct 2022 10:04:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B2FA742C21; Fri, 21 Oct 2022 10:02:54 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2127.outbound.protection.outlook.com [40.107.237.127]) by mails.dpdk.org (Postfix) with ESMTP id E158D42C08 for ; Fri, 21 Oct 2022 10:02:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Vv9+O2Zzy3hclJpOOnHFVwZLf+8KDS6zUrPgdniKJRyFLJE5gttk9PGmx+LtLBKSSATRw9h4g6hUalDKGODBYnWfy7+zc9v+B6fUJZ+F4ZI2juJCpKClUX4S446FDASygk00/Ju2VT4Lzweh98cr4X763hj99a0nLh1dOUvTfqBeOgLrpwCMuj6SRDjNqHxI33PaQotsVRnvlcqt2H3lf0O5MtIEZVeqKQ3vfD7QeW9tVJcoVX2tp3qooBWq855ucfUNXEWl2WbhfiaXw0rylsmkav5z+ctfK4kqW/EE8BVBU+X2ybXiw639Wf3NXiFQMyjN09zKzmifsICdAlZVfQ== 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=rQH71/t42+B4cBq+T5fePLFaV5lA8f/+edhE2nIUlKE=; b=NlliaSoy7nbzWM9+S+yNmKOqRiH8Dxn2b2m3dHx0rKIXXA1eSRM2GzR/zdN9A+3hcGp+fh/tRFYMMc2ODSiGUx23vfhK82P35ODu0QAcu/AagXrCcUGhDgFVzPXR9C6SQYRDkrMo2hGxZBb1bkBsr8ENUsYGpDYo4fgv3jIEO7WDzGAs0baXREs1F4SRX6d3ofJ74uM69sKYLadWLPfgs4+DYBvS39HUlFCQNsblHUBKQlDGmJEpPetgLgIVSLvqBZErekci+4oJGzIKR4yb2sAzQwk+juTvz7+U/i8QcIbkA+PGkLzsv9pkW++keDRFC4ZimXXwnWM0+Qqagkb7pA== 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=rQH71/t42+B4cBq+T5fePLFaV5lA8f/+edhE2nIUlKE=; b=kyFgIrU1pclNqiT/rwwcFq5hDW3up/x4i1HCEI+7/Oe58rODD+rxvmARvMPFL2WHW/jXm+oNzGKtn1iwG0DqEr5S5lY4C4qTk/uMYC6qDl+DbLaY5ebyKwQITrjNhBQa1GoRrQ8/TGIRqoM+E2sbBjV8QlCwGJIhEeGBH5F+rFg= 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 DM6PR13MB4493.namprd13.prod.outlook.com (2603:10b6:5:1b9::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.22; Fri, 21 Oct 2022 08:02:49 +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; Fri, 21 Oct 2022 08:02:49 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, Chaoyong He Subject: [PATCH v6 14/27] net/nfp: support SCTP flow item Date: Fri, 21 Oct 2022 16:01:50 +0800 Message-Id: <1666339323-24016-15-git-send-email-chaoyong.he@corigine.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> References: <1666232391-29152-1-git-send-email-chaoyong.he@corigine.com> <1666339323-24016-1-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0051.apcprd01.prod.exchangelabs.com (2603:1096:4:193::6) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|DM6PR13MB4493:EE_ X-MS-Office365-Filtering-Correlation-Id: d19d8eed-f06e-4970-f37f-08dab33aa57f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J45Hmq8r88U+qaX0//zkN1gKd2O5P8phM+26/7OrrAkD9o+Uzp2fL35GQqoVEFx782ZpiGKBkOOqGSWExgQoqHCJW2hf8IEwCyvaRyPzpoCI/38DQrQXH8+CmDxjqCOA8QC481ildhPsdF0djHa2AKtmJVm662eoKeKbLYGzf7cGeglwS3eP7A2t4JNEnMKvps6KNwj6Fr7QiVuNnxjP8vzN0IM61h6gWosGHH0yri55KIbt/XvhY3l77nqXbgdNrV19tZKcsq+/Xdlsv2RINMS5+7f3etxI7ZjeOUUssjba9aiDZxBNixJHIbhuvqLayzjDqM9oPqGna07j13Z9GRRBxJ4EXF0j4OKayIYMtIJhcG+RrZ/nOpzwEqutwwznnFVW+PNNEhbHepKWTPpzE25zH3LKx/yXQAin1rc53jiAEFX3kxHkq/2WahgkFtpSK758UkKPufyTDF2MpME4gSb2fkzjG1BvsHxhe331aOw8NxVuj8kx7exvb7pIKrkcAda/4HPSdCihn70KleOgh0KImkCiq/VEEpO/4YSGFV0Q6Rxmj9ppzHm/SJb4t/jtdCxKT+0Z2GUruM473NLKjHfiN8nWx0BLAHba+XGXbDpDhkFIeREvWVslXSfJHVh2aueLIsITjSiyrqZ8TpaCdxF9vJRla2SU2reB6GXBOXt5JSefS0+Dq0u94ov/pO5ZopXAezn1+JCkylA1/Js6vGxo5wUlFeu6529Ze29d62lzo54mHTCB7eMApzwHaTcveRK4aIjwRY9tl5rQYsVSPw== 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)(136003)(396003)(376002)(39830400003)(451199015)(36756003)(8936002)(66556008)(86362001)(41300700001)(478600001)(83380400001)(2906002)(5660300002)(186003)(6916009)(38350700002)(2616005)(4326008)(6512007)(66476007)(52116002)(66946007)(316002)(8676002)(6666004)(6506007)(26005)(107886003)(38100700002)(6486002)(44832011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dDErU1hXeExmMWlsTUNOeVN2MXB2SzltY2NXWlBsU0ZSS0FsZzZOU2xzSTFF?= =?utf-8?B?SDhFaHA1ZVl5MXk5ellPbTY0MjV1MTJ6bDEvejFMdFBRWW41eThtR0FHSFZH?= =?utf-8?B?MzhyRVVtNlZDS21EamZaRklOU2tJWGtkL2hJeTV5dlgxRWxLemxaWUl3ditY?= =?utf-8?B?MFNVa1psVHFnYzJxdzd3MTdkY2VZNmJYZWNjeVlFM2JobzREY1NiVFZjbzMv?= =?utf-8?B?ZVo0SlhvNjVyN1pVdzNLVjdwRWs0ai9LNE9qekp2WnFnZktCa0RyaVphdS9B?= =?utf-8?B?RmZiM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zM4ZEhMZHlE?= =?utf-8?B?YTFOR29lZzN2TURwTjZ1b2FMWlhEUkQyZlhuRWE2WUM1Wi9rMXpNNkk3Wm5v?= =?utf-8?B?UWc9PQ==?= X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: d19d8eed-f06e-4970-f37f-08dab33aa57f X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 08:02:49.5415 (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: itU3WN+if80wAQhcphXZaOTd6qVZvid0NDiqSg2K8if59evAFJAgTb7QbPYfU9HfEskGL5qm2+Sg00KCIAzPLftZZpNHV8848qO90HLIqFw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR13MB4493 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 SCTP 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 0af740a..27575d1 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -31,6 +31,7 @@ eth = Y ipv4 = Y ipv6 = Y port_id = Y +sctp = Y tcp = Y udp = Y vlan = Y diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c index b13559b..13b2b30 100644 --- a/drivers/net/nfp/nfp_flow.c +++ b/drivers/net/nfp/nfp_flow.c @@ -542,6 +542,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_SCTP: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ITEM_TYPE_SCTP 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; @@ -878,6 +883,47 @@ struct nfp_mask_id_entry { return 0; } +static int +nfp_flow_merge_sctp(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; + struct nfp_flower_meta_tci *meta_tci; + const struct rte_flow_item_sctp *spec; + const struct rte_flow_item_sctp *mask; + + spec = item->spec; + if (spec == NULL) { + PMD_DRV_LOG(DEBUG, "nfp flow merge sctp: 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] = { @@ -915,7 +961,8 @@ struct nfp_mask_id_entry { }, [RTE_FLOW_ITEM_TYPE_IPV4] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, - RTE_FLOW_ITEM_TYPE_UDP), + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_SCTP), .mask_support = &(const struct rte_flow_item_ipv4){ .hdr = { .type_of_service = 0xff, @@ -932,7 +979,8 @@ struct nfp_mask_id_entry { }, [RTE_FLOW_ITEM_TYPE_IPV6] = { .next_item = NEXT_ITEM(RTE_FLOW_ITEM_TYPE_TCP, - RTE_FLOW_ITEM_TYPE_UDP), + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_SCTP), .mask_support = &(const struct rte_flow_item_ipv6){ .hdr = { .vtc_flow = RTE_BE32(0x0ff00000), @@ -972,6 +1020,17 @@ struct nfp_mask_id_entry { .mask_sz = sizeof(struct rte_flow_item_udp), .merge = nfp_flow_merge_udp, }, + [RTE_FLOW_ITEM_TYPE_SCTP] = { + .mask_support = &(const struct rte_flow_item_sctp){ + .hdr = { + .src_port = RTE_BE16(0xffff), + .dst_port = RTE_BE16(0xffff), + }, + }, + .mask_default = &rte_flow_item_sctp_mask, + .mask_sz = sizeof(struct rte_flow_item_sctp), + .merge = nfp_flow_merge_sctp, + }, }; static int -- 1.8.3.1