From patchwork Sat Feb 10 10:42:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 136581 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 465B343AE5; Sat, 10 Feb 2024 11:42:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1478D4067D; Sat, 10 Feb 2024 11:42:42 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2132.outbound.protection.outlook.com [40.107.223.132]) by mails.dpdk.org (Postfix) with ESMTP id 669A4402CF for ; Sat, 10 Feb 2024 11:42:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=matUP0pCZtCrMb0R49XklZ2+BDMnDclPKE5H4kJgLeZZ7PXTdFj3g0rP3yRafIOSFE9sNyQHou/Vsq/htDkze/49/qrKx2rSk/duj5wVKR3roc8Gowqi+oUHzkdEmSDkxTbqmdNlZ6fpIpy5nLZjzIP1VUe4EbHYBffw0uXYdEi0VqheOYksYUQyCt5eaMBCA9APRO7rKUOzF6c0J9Gp1gueW37XovgciQRhVD/ofPLGjx0Aorhsq7Ll3wFUqThtB/5R3fCJ/OWexOZmPreB7/lA8GHiWgrkNWiKShTi5YvMLc4ezg0/VFXvwnnlZHwgOpV2sM75SKPQLuXe85Ze/g== 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=CQeGHIcrbP2ieQIO6bdSRZGeh6ARucnAv+H4ZaI04Bs=; b=Ctdp1OT8hh5Jo/jzLKaDeGs+1mNL/J++HdY7YRuWuuk/3X8+0XhczYzoNChrRONr9iK/BzhI23Y8Jql7k4H/8HpPH0loRZRjhK08ivdvs9A2iMxyAWsqpK1UfoycnOTsiozxgEeNBQhwSOuvXVAc5182V/VJxGUpi1KznZFP8KojTOZ0eQdV5ujFf80+RxCDrRp4u6l9jow9xsVRrspLydfB+gOaKQEqfjNUB5WvkrdF/M1k4cqp061nP7n/vQSYvT32TSnqhbp+yxaUsyEeJI3NAJXh/sNFJBFq9DWj3TzLZBIkheWGrmceVsXwb/DETn8h5+ZeXSeUqRc50y/SYQ== 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=CQeGHIcrbP2ieQIO6bdSRZGeh6ARucnAv+H4ZaI04Bs=; b=BuhN7GNbZIjS0BsSxZ4Ct9lqhpUI4xGinDXyAj76tXJjXmLh8rglygKbqX6O4daCMnGS+KdEg5ZG27Iq+8LJAogo6bVs+o8Y9RKTprOQ1O5SiLE42Qa6wGtlVKpUwHtqaWsWCryJUVCN8Nk1A/V+kgcr21kUIyGxaXKFjLA8B14= 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 PH0PR13MB5421.namprd13.prod.outlook.com (2603:10b6:510:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.24; Sat, 10 Feb 2024 10:42:37 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7270.031; Sat, 10 Feb 2024 10:42:37 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH 1/4] net/nfp: support MARK flow action Date: Sat, 10 Feb 2024 18:42:10 +0800 Message-Id: <20240210104214.1248772-2-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 63aaecc9-3c47-4ead-026b-08dc2a24ff87 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PLtMcS7VX4xQ2EGzymIwJ14krDZp5PQGeFtOYtclyig294sqd6ZE1gWo9libAknud/LnmHgzUaft8ND8mOrrCpmDsVYc+yI63TAomfudMS3uqYAT8zL8k9B5OaxxAl4XWQtLzgPjktnw+VoOdO3o4+mv6aJzbzwr9CrU54iLT3f68LekKagrGQcfVZ5KIB/uyoqjVyfA/Oo4df0hXPV/BE6m/fei4EX2FQLljAbk5dNxKmy1Xs7NqA55TK1LPk/j6ECGIdyJ/AMmFKawiU/PvF+Ekt9l8u9Ty99zOzDXo9FqjAuIAZxjgoa2KCua+MxQS/msX4snowqInb5RXuV5r5XePrYqnbhCURjbEofI3cRtXVvqT7Z0UX/y1E17uGORHDBZBfM3FVRxVVe8fhhx0UqmdrJ4C7/iM6EoAVJsb1FdEel4XroeE6dr7JXK8FwxY61walV/QyesrJ1OWBHFu5VNm2LeOsuOwHrf61Qd+ekQInU0jpZsfCcCTEf+39JoejbFi1p75C/r1Zhh6V049kH2nq3tk5eA9hPNz9I9efkBN+TlAW2t9oa2z1/gGur57kV1e4W+5kgmeftnrh8iA75xPGJ4vjCtxOrGIOsCVjl1TSVT1kOElYRalMM2hdae 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:(13230031)(346002)(366004)(39830400003)(396003)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(66556008)(6666004)(52116002)(478600001)(316002)(86362001)(6512007)(6486002)(5660300002)(6506007)(4326008)(66946007)(44832011)(66476007)(2906002)(6916009)(2616005)(8676002)(1076003)(107886003)(83380400001)(26005)(41300700001)(54906003)(8936002)(36756003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zAPA/B94SQJIERDdE09z3Vx7iVJiFWNGGZiHpPl4ct4DuMRoCqAxhonjELA7XTZ4i+zK6ysRbQZ7tv0ySkeV/RIjWnUQJsOeTTPuVyra29DChRTH0sdK94X2eH8/SE/ePoNch5s1lo40dBue11FrZ6uhtg/w9HnLFVCHS7REU325VFcavypU1nDh5ZjLU9OHbMNt31pPj6cmqrP6xp4WET4tfXiM1ZKDcrj2kkzUJWrZtF8yMI4PMl9NnfyDXQIOJuLa7up0B/dsf+vWXeJcrQ+nEaRbIJqUsIVOmHsbGBDZiMyvs1SQhwW2WMt0os0GbbuMZPd0yjs5v+DUwxGT5qM1JeIazDDG++7MHBdXYkBQifI2LGFHPA6L5tbjnTmS6oJN7amneGM1HIGVUuiu1Ylh0HGSbVb75zjmYLet/cV8p+YX4QfOJstfsCQIWXVjpSVnt3nD9PXYECDmXbaH1s0tmv/iMSNGyW1JoEw+eNXkrp8E6cNYQDgIFU+XY6pyhGCD2XDSxmen0Hn6P1CJRb4jeHZdpAlkoZFCfNQr1KyIaFMUDR5PthCFswxDRFCdEqVna2tJNiWY1Fi14zaX6crzRkbtywLd2HzDIA+AvGNJnEK3D8hV/UxcniidHct0MeM4j+RdjxL4RQaf/ANHOGLg6t1NCeCRXEuWvh3XUHDPjfxsB+DmbE39WEOpdpUEqujWYjMAzpMrZvpZS0BqQaIVdICHAypZ4L2m2o10lsoPx5oUBIQ52rXTzU+Gih7RvMyXKAVWyCwbu6bbcggjf++VppmTS/KVl+sAlz/HS0RHY6HmELSYSs9h1f4Hmv6oDMgBXX9GafV/LtcuqqG+qzBDIUM1s74exxfETVzZpkeugyjSfuFXUIXlUqD643qudHY6OChqJL/DfSNs5GpEXaQoEFaFyDPbGa/1FfJCVKAHBioAW32XoLHyv+BMTrI6AFOVa8S5MHHtf926vVz8G9SlWizX6w0GSH2QOU4c+930/5B/wxSu6NKDKySvAMxHzeXc/dXZe2lL/zWdhvju37WrlxUb23hZcaNWgiP1/ZoDWhgnIFA6Wp2FlOJzIfw60lo0QFGqibQecIurm7OAfb344F8x7GsskA3z4a2LntTUJWImPJyrSqEtzcIJ+gx3rd+/mMdX+JUvmx4EvLargvR8BKI9EZSotxNu6MILLK/M8XRqyG5RD+T3qGn2STXEQiqqfUUoMPbydn5PZGleUgXacNyyX2SL8CVAkAgV+PHs1Shq+RSNxnLG1XafTUIzL/MNexT2aT1trpxmrw8RRC8tYBHX1VIl25z3ThboxAj5aP5u11+GurolyNLyN5jyWyqWnRCs6CXt8A5t7/xUXheQTS56voGsORxPU7hecnlj+v6Q6BlHgliekr63X4KPqBZpbbrqPdRKnnCbWL2OCjyKFfaPDezqEVWwOPswsagH5axNQN7uxlaFnzRIC+O2qlXcrLUqWvn1ygKNFeVvbaZpK9mSY0KdjoOARAx8/HYoyuBL4/4n4KUu+fw+IGNHNOGpldxP6wgnFPEUGyd3hAxM66m1HlzdjzBXdivNGcJoLevvQh4beyMFym95ISm1YB3c60N1QC4RNi56bdeHpA== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63aaecc9-3c47-4ead-026b-08dc2a24ff87 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2024 10:42:37.6703 (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: NQ0Or9OdFPQeHJx/ymDe3hENrW3Q5pJdtgLhYKI0+bsRM4KMerOxcgcHgI31EXbMwpb839NKfgJNDvZ3XxgoOIFA6qDr+BkCAzCiZGeDvqw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5421 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 From: Long Wu Add the corresponding logics to support the offload of MARK action. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower_cmsg.h | 16 ++++++++++++++ drivers/net/nfp/flower/nfp_flower_flow.c | 27 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h index 8fb55f44a2..c94ea706bb 100644 --- a/drivers/net/nfp/flower/nfp_flower_cmsg.h +++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h @@ -959,6 +959,22 @@ struct nfp_fl_act_meter { rte_be32_t profile_id; }; +/* + * Mark + * 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 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | res | opcode | res | len_lw| reserved | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Mark | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +struct nfp_fl_act_mark { + struct nfp_fl_act_head head; + rte_be16_t reserved; + rte_be32_t mark; +}; + 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/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index e26be30d18..8667f8e901 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -83,6 +83,7 @@ #define NFP_FL_ACTION_OPCODE_METER 24 #define NFP_FL_ACTION_OPCODE_CT_NAT_EXT 25 #define NFP_FL_ACTION_OPCODE_PUSH_GENEVE 26 +#define NFP_FL_ACTION_OPCODE_SET_MARK 27 #define NFP_FL_ACTION_OPCODE_NUM 32 #define NFP_FL_OUT_FLAGS_LAST RTE_BIT32(15) @@ -1138,6 +1139,10 @@ nfp_flow_key_layers_calculate_actions(const struct rte_flow_action actions[], case RTE_FLOW_ACTION_TYPE_CONNTRACK: PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_CONNTRACK detected"); break; + case RTE_FLOW_ACTION_TYPE_MARK: + key_ls->act_size += sizeof(struct nfp_fl_act_mark); + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_MARK detected"); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -3487,6 +3492,23 @@ nfp_flow_action_meter(struct nfp_flower_representor *representor, return 0; } +static void +nfp_flow_action_mark(char *act_data, + const struct rte_flow_action *action) +{ + struct nfp_fl_act_mark *fl_mark; + const struct rte_flow_action_mark *mark; + size_t act_size = sizeof(struct nfp_fl_act_mark); + + mark = action->conf; + + fl_mark = (struct nfp_fl_act_mark *)act_data; + fl_mark->head.jump_id = NFP_FL_ACTION_OPCODE_SET_MARK; + fl_mark->head.len_lw = act_size >> NFP_FL_LW_SIZ; + fl_mark->reserved = 0; + fl_mark->mark = rte_cpu_to_be_32(mark->id); +} + static uint32_t nfp_flow_count_output(const struct rte_flow_action actions[]) { @@ -3734,6 +3756,11 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor, case RTE_FLOW_ACTION_TYPE_CONNTRACK: PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_CONNTRACK"); break; + case RTE_FLOW_ACTION_TYPE_MARK: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_MARK"); + nfp_flow_action_mark(position, action); + position += sizeof(struct nfp_fl_act_mark); + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; From patchwork Sat Feb 10 10:42:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 136582 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E490343AE5; Sat, 10 Feb 2024 11:42:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5511142EB6; Sat, 10 Feb 2024 11:42:43 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2139.outbound.protection.outlook.com [40.107.223.139]) by mails.dpdk.org (Postfix) with ESMTP id 4AFA0402DF for ; Sat, 10 Feb 2024 11:42:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IwzQ7O0mUmvWA7Kp3ledAc19HEfF5bZP+SjI9hMNxX2Zn8HhXgwOq1vBOZ3e8vaE/mVa2BCpIRrheuXJ2WM5kqJDyav1eSsVwkWHu01S7QXMQ4O2HMJlyyPPdWXFkQv3yPbKvMWI/GFtl1c/SWErZ4QruRMb7NLQTP3yYBchiviQ5kuYXwSicnHZU6QKmMqvx4y2f3ofeuF8+oP7H937ibk299w1zr77uCbauXJ6qq/nVqPXTr4oFumihjms2NCR3uGzacjBOBwFuUkA0EODiwj+FxyGGEkM8gHQMl2hFdSjGXVQxVlJwm1YFzMJX5u2a8IcAEQfqJ2kflWFVqXWWQ== 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=EzZD/GOFHPqdhbaIpbSOt0szFjCYGwB5Oq0kaenUcFY=; b=S3rc4XNS5zZo2n767UR8CextzbPG01O4YeFp2WjwzTMxBzQJqeTOIHIjTSo5A0Qkv6PEuHH7KYT5ZbWPwnlMpgAA+Jem5wFTl8wxQbnrnHqAPU3tRI0nwfEu83nsFqLJpyJ6JO8KceXycA3NCR3VhxIlAWFgu/Mmto5g+BtmYTtKadkcx6sB1fMay0+yY4ypV6AxHgOr7Rhxe3dr27YjGE2BYLdNVI1SEluSomcLvfroMJmZFIF5I7idDWBpI1qfd8t+zhbTbTobkYC2ai+qtFQOXKGzlopcAKElKQEvJg1VpBrgR7N7k2sZqZfqbwzp4iFz8leadmb5t7V4U9cEZQ== 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=EzZD/GOFHPqdhbaIpbSOt0szFjCYGwB5Oq0kaenUcFY=; b=fMuAVDizscJ1V3egaz5wm92SijnzeUt+oXtNoQlCjUIBvxROIcPpkXrUIWfKdIBlelLdlasadJZvCktflBVNvOzQAn+VIU6dfTtwnzNmUBJXKLKEf7s68YX6wZ5aRf/1vebhzylR/O6oWgvYpxhTelUTAeyVUM8CjMozi63nwjQ= 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 PH0PR13MB5421.namprd13.prod.outlook.com (2603:10b6:510:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.24; Sat, 10 Feb 2024 10:42:40 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7270.031; Sat, 10 Feb 2024 10:42:39 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH 2/4] net/nfp: add interface to check representor Date: Sat, 10 Feb 2024 18:42:11 +0800 Message-Id: <20240210104214.1248772-3-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 47241f7b-2d8a-4b4d-1d55-08dc2a2500d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GgRE6qAZKGx3ZpVcjb7yAgNP+FhpfdM9wyFzRiixJXPRBfanncWX9GVJwkME6XXJZfurzym7joDJzO3mJG0KDXGK/LQPd4i2/gnBdF/7t7B6boKGOJUpBJbOqGtpEeF3PDGaKopzNOraI3grruFg8sXaEmHeeD7yYScCuFt8wrsR1pLdqfrw1WTGiTMiUEiJ/60R++A6CGgHk0SW34X/N/AqhYK9DgVG+dB2jNi942Yntgk4+JGHOuTQBe21Kd03lKYFs836IuuKzRm71lTCspQfTLqbp+QIDJhLAjGcZpceUk4bvgUmi2dPACFSAph1I02MZBoQZQ/3c6ThvaNOJDMuur2VM6rKb0HwNkBanCj3kWtupLcf9bhZbz+55kT3y3CjvanvbZX8mGSCPGYSsITaO0/oGX8ChuPZqy2iTDra9+bQ8cYclIZf58qrmtRQdk8F6RQGKn6hEaPIi2e9v9D4BdiChUSO01JWCNuAn+H4R9ZLYpkcXliq5Nmx4TzAjaOKp35TGTs3kLNtkgMq0wsnDrf5ILFOUeKjsMLgZjdJpYI62SYAQhp3KdfzSQcSSYMsqk6hi6QU5FqKFxkMuGL6m/ZYb/GoJ+pUr4IIdX1MfufRg3NU+Mnr9hwhoaoH 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:(13230031)(346002)(366004)(39830400003)(396003)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(66556008)(6666004)(52116002)(478600001)(316002)(86362001)(6512007)(6486002)(5660300002)(6506007)(4326008)(66946007)(44832011)(66476007)(2906002)(6916009)(2616005)(8676002)(1076003)(107886003)(83380400001)(26005)(41300700001)(54906003)(8936002)(36756003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Jno1Ti9H6nnSR0umhRK4odnBHS8mKzCh1xd8BK4oMvOMqf0ZWD3ZIfNnKr6HWeUcem40zGIZ1IlA62eMLQ/sQ0cMXXRJJvgHqv9DWPD28pasSvTTAiZhjBG5k5n7ACQ1pnhv8zxmf+sgy6ZH2v2sEoIIdnOwNoIkohXKRsa/kzIqROk7JgRI4m51FXLOiWU0V7xzNALDSZQEQuiVA1DQ5Wu71I2dNkmy99tFao8DRrOOLtmE8s49QiQyJWS2mT3uXXAw4oKMfCETDXnzzL0pBFMV7muizCwCR0qd4qCIJJjWTCBzyz7fVxHxGW/SDvfL4cDC7eNFZMf5NL38yFka4KH+KoXP/PbtielBmvNK6U+1InI+D1Gr+NfddB4I3uDW9BvEm+tVz5TyI3YkAH2n57Yp/yG5YDIiepgOyleu2BZGDttoN51CosiLvQRLKRTZ4J8FS4JDAM0VwLfmIrZpnHWkBticKPipHNZoSQz7SeibgXa9sGxFDvPHIAaIZ02MzZI9S54tzIpJADEH+JeJTnNYYnotvqgJx9D/QovpM7d/zf0O9yGXX2M0LMQTVynXMeTJHVfR/e3geOqABAVEQk/Sj24KZzZLkln6EI1eOBpvXimhbr7nrQ+nqOdT44xpxud9pg8ffvQBT6XJIyXyhGFbRk//eKJw5+/dLqEuVAfut6HRPubaBDt0llpMD0zMcGtVzaumiMNDn2YRhcdFpLMBwuOvL+3g3kYG7adjUFq5us1DR6CCgIzhkKOsZ4+rFSkRYmtXBdfA1pE5Xv5i2TcgXnkDh0Cv20OfaNrd4KXciroALdbY84rmOZYcIyxY0+7ocdyVIjCU7OTkyyblCmS8F4vA7SmeG4lz6f/+yx1oNj1+x6gW7SALpnzOooH3XTRIKgWWAj7+cZC2PMti2JKWOmBxz1E8UPGeNSWYMejHVwc8+/24AhHq7Lf+poAi7KMGfSY4aw4lnWxB55QXwwK8s30krLFtTJahPkPKgKpjcDPN7s5907we8HOWCnH18CM+yf0BKAnBquvi/TEMHyXMG8z0oc8nVsEO+YmdnKeCEzDrTrraNNpSzaaE7FJt215Ylwc3tcfpqlGGE1hsvv+F6xjNOAU1iQ8x6mkR2taHL4FgYfSZK74M/4m9ifkE8XDuvQADTVD17Pgy6jloibfC//1d9eRBv0/jE/u5QZBK6QQ5AHa47atjqODaLW97PSzY6djdrke0neu2PuWRmxFZosp0TtzosGfPJgq1qJts9OwavCJBh4QAoM5323ZfLBr5JWqwUOIvGgszkNbVAVlPlnPX2JcLge/Mb6LHaQausxIg+Ary+Tn63+JoWpdlJA4maJhiUTNZZk1hoFIqadrj+Mal77QvUaJgENNhP9/HYs8odbdUHohSIxmd0WxufT219gYYUUVc99jNsyEgTQF1T90bcSFHIfseNxM+rRKMv0vgK9IIm2lAEYZL4/2VKHM0ZBxSV4sfnuW8u8suj9tIFsf1gfdm/5zdvyqjm53jApGxE72eHXuEBqUaq9kzMsvEsnqFaj3LALTmhhdJe5YNy59x/YNLY0sNSqJv+w5oR7o6vuVIfBckR8LK12dw4fd7AXo5u8Xwc8eyclRmzQ== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47241f7b-2d8a-4b4d-1d55-08dc2a2500d3 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2024 10:42:39.8814 (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: MPfWSny/h9SrqazyMVlnTb9vyKO5wj2ZWhQ0U6og2ALF1GN4N2/5M//ROXJOWZ3/xfPoR9ES0hWYkxP37boqja0K86hizrLmqkrFrbGvCME= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5421 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 From: Long Wu Add a interface to check if a device is a representor. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/net/nfp/flower/nfp_flower_flow.c | 2 +- drivers/net/nfp/nfp_mtr.c | 2 +- drivers/net/nfp/nfp_net_common.c | 10 ++++++++-- drivers/net/nfp/nfp_net_common.h | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 8667f8e901..07833fdbdb 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -4348,7 +4348,7 @@ int nfp_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops) { - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) { + if (!nfp_net_dev_is_repr(dev)) { *ops = NULL; PMD_DRV_LOG(ERR, "Port is not a representor."); return -EINVAL; diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c index 255977ec22..11da5c07ed 100644 --- a/drivers/net/nfp/nfp_mtr.c +++ b/drivers/net/nfp/nfp_mtr.c @@ -1066,7 +1066,7 @@ static const struct rte_mtr_ops nfp_mtr_ops = { int nfp_net_mtr_ops_get(struct rte_eth_dev *dev, void *arg) { - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0) { + if (!nfp_net_dev_is_repr(dev)) { PMD_DRV_LOG(ERR, "Port is not a representor"); return -EINVAL; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 72c9a41b00..7a0b0c9973 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -156,6 +156,12 @@ static const uint32_t nfp_net_link_speed_nfp2rte[] = { [NFP_NET_CFG_STS_LINK_RATE_100G] = RTE_ETH_SPEED_NUM_100G, }; +bool +nfp_net_dev_is_repr(const struct rte_eth_dev *eth_dev) +{ + return ((eth_dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0); +} + static uint16_t nfp_net_link_speed_rte2nfp(uint16_t speed) { @@ -241,7 +247,7 @@ nfp_net_get_hw(const struct rte_eth_dev *dev) { struct nfp_net_hw *hw; - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) { + if (nfp_net_dev_is_repr(dev)) { struct nfp_flower_representor *repr; repr = dev->data->dev_private; hw = repr->app_fw_flower->pf_hw; @@ -2139,7 +2145,7 @@ nfp_net_firmware_version_get(struct rte_eth_dev *dev, hw = nfp_net_get_hw(dev); - if ((dev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR) != 0) { + if (nfp_net_dev_is_repr(dev)) { snprintf(vnic_version, FW_VER_LEN, "%d.%d.%d.%d", hw->ver.extend, hw->ver.class, hw->ver.major, hw->ver.minor); diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index e374739022..1d96b0e9d1 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -307,6 +307,7 @@ int nfp_net_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa); int nfp_net_fec_set(struct rte_eth_dev *dev, uint32_t fec_capa); +bool nfp_net_dev_is_repr(const struct rte_eth_dev *eth_dev); #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\ ((struct nfp_app_fw_nic *)app_fw_priv) From patchwork Sat Feb 10 10:42:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 136583 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 705D443AE5; Sat, 10 Feb 2024 11:43:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CA2642EC2; Sat, 10 Feb 2024 11:42:45 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2112.outbound.protection.outlook.com [40.107.223.112]) by mails.dpdk.org (Postfix) with ESMTP id 77DCB42EB9 for ; Sat, 10 Feb 2024 11:42:43 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R2/m2Jl/IoUjFsu+ax8aTp+3noeVW2Ekyo8VvUMQcTbXGzkmzgfY7Su0JPUTN4EADriUMd9gvMBeKVSr6r01/eBCvEfF1ZOp07KdDNY87K1s1UFS9BPd4PcpiOOmPqY9T9mzRPN3n9O0jdduSX66rD1iT3LRtTxj+WjuZlEdNYtlgS9cFvWDUwm1eCJPa9zGthJ+dQT2JDb/ZRMl7DrPXUkYOkVALVqOyUeRjhWO8tPW3iZJASOt3iN7m8E5FXtIY6DarDNZFyN6YPVJv065gjJS5wyAYPiqvEQabS2qm74Zzv5ph9d2qZ1UNYf8liBAQ/aax6xpEh+9hAWyOhKXYg== 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=W8ROtbaRH0cL2dezx1gB4EvmpFdIVHDOKPsRp7vIeI4=; b=eJKM4Z4Eyp3X60m35iPfx+1lY9XfZwTTm5a+iHoONBy6Dfy8aU2XYjcwzxfakHLlqNqWug66+0trDN8noRgAmVsid5/nnnDA1nsaxQlZGJW8LRqoyVhLhS2gNAe5q1QROu9AnQ+KzwUo7cJsWFKW09tbgcBMYXUXf9yY8baoUcL+DISUAB8sdXagkdlm2sN/6c4oxYXH+/4H56IsWXA5UCKxBhJ9iaezYACoViRNSb9WZwI69wjKewRp1dXdldDkg7wFjHjRo2aDv7z3mZk3Ga7QvvwO8HzRwbsrF8GbVKjJxj6dSD3wXU5rAJgEIUWK9Mq+XmX8+AI4QXTxrWvB0A== 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=W8ROtbaRH0cL2dezx1gB4EvmpFdIVHDOKPsRp7vIeI4=; b=Oa0IkwC7/5cZRVvbXMcAnZiYidEe4fxYQKKujJZPd5h8l0X2OQ57sgSo7RlAvh9DjECXoRaF7+1+4g9dcPowD5xenGpuLSsYwv5beq4E0Pb3ETQH4OmOTLIL0ZdcUjt1EOjptaFJ4iwv9IElzjsIouVd6+aTKEyCtYLRU4nfYq8= 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 PH0PR13MB5421.namprd13.prod.outlook.com (2603:10b6:510:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.24; Sat, 10 Feb 2024 10:42:42 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7270.031; Sat, 10 Feb 2024 10:42:42 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH 3/4] net/nfp: representor adds RSS configuration Date: Sat, 10 Feb 2024 18:42:12 +0800 Message-Id: <20240210104214.1248772-4-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f06633d-a50b-4912-d40c-08dc2a250246 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: On3waEaaDQYWQfRRxlNvYbxbbgNBVosmi4pdL1VGJl0NoN+/CSdXNS6MoAxlRpNtkacyDw70re19bIYMaO9mr88McDaDO8DdEEq09b6RN+L6S1swmBaBhfYJfASGsgPFJkTeUxlXMDdWMSNtitcZ2B1D5z/dYJsEIeWtELPckPCK+jFB4NqAWyOgpN3xE3CrNPL9IzKCrXEgeuI9QQJL3ttfvRFyBDUhUeNwozSA7Y1gFWZzT3rdt15KezOtHJKYlq/AUvkEK4WQNrzaD/lSaNGM1etiyX32uwqplJo171phiUS+BHjvvkK8S7dSxzseiQkh5YyvvDe67c24934t9CuJ6k7+IURgbhHAShHpDOlUnphcc2OsZBLfjmzQXuNalnDEcLE/vQQyCF+WKxS4uRuC0CCJGrPO5+gEnrZ4iKerXwt8ifXAWTtcryNQSy85nDPspYKkgEF/YjiBXcQDE+fhsvFVxGNeUHcCfmDCAD0FwkqksopD0OvvVYSDMcREmvtTbbuu7c8U9GUqOMlP2fIMjFuLHlYMC7Wvfy0DVPQOlMkQ1ED74Vf7K14+T5AluzW6cB0obvsEbbbvYn+8YTVCKxCC5M2grNpax3KA8PCPXh95L63C/RTWtF0wGew/ 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:(13230031)(346002)(366004)(39830400003)(396003)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(66556008)(6666004)(52116002)(478600001)(316002)(86362001)(6512007)(6486002)(5660300002)(6506007)(4326008)(66946007)(44832011)(66476007)(2906002)(6916009)(2616005)(8676002)(1076003)(107886003)(83380400001)(26005)(41300700001)(54906003)(8936002)(36756003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EYSfzWzXcUWSe01CBVm4lmKItpLxlhFu1WtsUZMDWdVz8LUBcta+WYk3SM7CI1+YYoDVsy9OazoLfNfwTiMS+JLXQX1Muw9wjf4sRdzcOv1l55Si9JHTT7hy+JnTTsU74+eqpW7bSBXJYt9v5Y0F8bLGguJchpQ+3wb7pWd2LuP/YVIVVVWICxUxN2yUxtkjglxhUFFRPXkeoEL0ZOejMQiQLWUB3itahkXWtC6lhLiEPazq2iFN5I8I45w/xGjYg1Fc8XDy73TVhJ2qGODCjWrAxKMtHp0QXCFmQRjsoJSAj5phszvqXiIKjUhtMHr1xSUxokWV8LQZeBz0rjt6zZFfhF/6L/P8QFznfyNVT+FDLNDolxvK9j6lJI7+31uErHogPuUcVID54CCpPoW3uKDYYFoIZuICalIxO9qmsWEZkoh4dWnzrzubVQsV7cuwBZXTpCg4XvFs4z1Ccckiy/ha+bJlFyr7+/JK5xLxDlbIVUoPIXBGnSOG4sTOOdlsNf5Xwx0z+Dfo7GaOwbEFIL2aL9su0J7YAFG0/GtbFCpP96HlfDECMqZqx2TR/QbYv0Lf9kXIF5gF+3XbEpBHli+p4+EfAC2mUAv7T+n/HUJh5OeHcQEGD70iiTYC6s4kvXSQ28GVQlQ1y3hCgEMZd1SYURfiganxu1Um2CgP8ew4rAFkSGySmaiV8/oG0H026EoDaDdy8P9SWicNHajYZ7MxSOD2ry9E7QT8XtGb32KV8DtXjtmK/DMFRZCHJU5+RK2b5Ivf9+Lc2/Yfvi9aalo7gTXMLuMNrZIWJjYGXEzkTWzSfmgYqO+tfndCQY2Z3oOxoCZ1bAP7mw7+apTrDhZRzPkegjinWzOhAuTfPH3geGv8DQUUbQbhLazreUMZzjAQAz0F6uisH01qS8caOnbDwOiSkTzjXMaMTGHMXXzEbN2cEAfVR+TxWz0+bFjsaHGjXMG2p/aNGXa1tGKKbiewWpKNlCaJjy2G0ZH+vQZQEQbfnb0LZnYcOPzZjWm/hL3zJsJcPx/YH4MB/BNL+Eyms02hlX/e79dFPh+3dkAOcAU768ZpCgzCC15IQBWO0wtxUl7U4+GKQg1P6dt2rLe5OCfRItihhYfqE6y/B23xkBOU5cO8WedSKU/u/DPMvj8Yj0tQFPu0YAiHZDdkz8qCfT9nYaeSpaLqusVNCrO223xNtgpg69L53+gqDqC/1mQb6pQagop7tj5fbDWsM5KTfF+ISs5CFCaCVHLgyLrez1L2p1rSpX3GXDU8j9DV0/R9U8ynv2aUBJYecCwksb7wstxJJxGREtUwKX3oZlb2G60Te+jt8kiNZaPQiEYF2EiVjXwEkgZdTO3ptVshYZ5jeSDC7DjxlyDNjqJLPXk+I/bN/IVpTraK4NqfDjZQ3JbdfSI+j/3iM2xvVQ7AVgmw5dI3LlAOy9NrwAWTGCod6SefsIenYD6M03GOht20gwFJ5caJATrmOVCCg7up04ajObWh6koI7dE0awGljjOt+yBJTkh1dN2FupDLK4kB3VaQRSxX4MfR4YwxemAEKydPzUJN0YyepBMBAN5BMmkTGE9sG0qVxkxFrZTQo/pCR5u9i40pFx7MvXA3mHp5aQ== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f06633d-a50b-4912-d40c-08dc2a250246 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2024 10:42:42.0778 (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: 7aU1pPmeMcuOeyQRN2peiUQbsl/z3GJP5GvvKi2KU8ewgWTyg7ZlhuZuWCAKyWInJrjupzgL4RWapra82OcvoQhvtSb2saIf73OUBQT+kpA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5421 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 From: Long Wu Add RSS configuration in representor initializaion. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- drivers/common/nfp/nfp_common_ctrl.h | 1 + drivers/net/nfp/flower/nfp_flower.c | 12 ++++++++++-- drivers/net/nfp/flower/nfp_flower_representor.c | 13 +++++++++++++ drivers/net/nfp/nfp_net_common.c | 17 ++++++----------- drivers/net/nfp/nfp_net_common.h | 9 +++++++++ 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h index d65fcd17cb..d0a3fc696c 100644 --- a/drivers/common/nfp/nfp_common_ctrl.h +++ b/drivers/common/nfp/nfp_common_ctrl.h @@ -253,6 +253,7 @@ struct nfp_net_fw_ver { #define NFP_NET_CFG_RSS_IPV4_SCTP (1 << 14) /* RSS for IPv4/SCTP */ #define NFP_NET_CFG_RSS_IPV6_SCTP (1 << 15) /* RSS for IPv6/SCTP */ #define NFP_NET_CFG_RSS_TOEPLITZ (1 << 24) /* Use Toeplitz hash */ +#define NFP_NET_CFG_RSS_CRC32 (1 << 26) /* Use CRC32 hash */ #define NFP_NET_CFG_RSS_KEY (NFP_NET_CFG_RSS_BASE + 0x4) #define NFP_NET_CFG_RSS_KEY_SZ 0x28 #define NFP_NET_CFG_RSS_ITBL (NFP_NET_CFG_RSS_BASE + 0x4 + \ diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c index e84e6ebbff..c6a744e868 100644 --- a/drivers/net/nfp/flower/nfp_flower.c +++ b/drivers/net/nfp/flower/nfp_flower.c @@ -31,6 +31,8 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) uint32_t new_ctrl; uint32_t update = 0; struct nfp_net_hw *net_hw; + struct rte_eth_conf *dev_conf; + struct rte_eth_rxmode *rxmode; struct nfp_flower_representor *repr; repr = dev->data->dev_private; @@ -48,8 +50,14 @@ nfp_flower_pf_start(struct rte_eth_dev *dev) /* Writing configuration parameters in the device */ nfp_net_params_setup(net_hw); - update |= NFP_NET_CFG_UPDATE_RSS; - new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + dev_conf = &dev->data->dev_conf; + rxmode = &dev_conf->rxmode; + + if ((rxmode->mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) != 0) { + nfp_net_rss_config_default(dev); + update |= NFP_NET_CFG_UPDATE_RSS; + new_ctrl |= nfp_net_cfg_ctrl_rss(hw->cap); + } /* Enable device */ new_ctrl |= NFP_NET_CFG_CTRL_ENABLE; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 4f4df0cd2e..7284a1e84d 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -44,6 +44,12 @@ static int nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) { + struct nfp_net_hw *pf_hw; + struct nfp_flower_representor *repr; + + repr = dev->data->dev_private; + pf_hw = repr->app_fw_flower->pf_hw; + /* Hardcoded pktlen and queues for now */ dev_info->max_rx_queues = 1; dev_info->max_tx_queues = 1; @@ -64,6 +70,13 @@ nfp_flower_repr_dev_infos_get(__rte_unused struct rte_eth_dev *dev, dev_info->max_mac_addrs = 1; + if ((pf_hw->super.cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) { + dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + dev_info->flow_type_rss_offloads = NFP_NET_RSS_CAP; + dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ; + dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ; + } + return 0; } diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c index 7a0b0c9973..66aaf7ab09 100644 --- a/drivers/net/nfp/nfp_net_common.c +++ b/drivers/net/nfp/nfp_net_common.c @@ -1269,16 +1269,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) if ((cap & NFP_NET_CFG_CTRL_RSS_ANY) != 0) { dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_RSS_HASH; - - dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 | - RTE_ETH_RSS_NONFRAG_IPV4_TCP | - RTE_ETH_RSS_NONFRAG_IPV4_UDP | - RTE_ETH_RSS_NONFRAG_IPV4_SCTP | - RTE_ETH_RSS_IPV6 | - RTE_ETH_RSS_NONFRAG_IPV6_TCP | - RTE_ETH_RSS_NONFRAG_IPV6_UDP | - RTE_ETH_RSS_NONFRAG_IPV6_SCTP; - + dev_info->flow_type_rss_offloads = NFP_NET_RSS_CAP; dev_info->reta_size = NFP_NET_CFG_RSS_ITBL_SZ; dev_info->hash_key_size = NFP_NET_CFG_RSS_KEY_SZ; } @@ -1794,7 +1785,11 @@ nfp_net_rss_hash_write(struct rte_eth_dev *dev, cfg_rss_ctrl |= NFP_NET_CFG_RSS_IPV6_SCTP; cfg_rss_ctrl |= NFP_NET_CFG_RSS_MASK; - cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ; + + if (nfp_net_dev_is_repr(dev)) + cfg_rss_ctrl |= NFP_NET_CFG_RSS_CRC32; + else + cfg_rss_ctrl |= NFP_NET_CFG_RSS_TOEPLITZ; /* Configuring where to apply the RSS hash */ nn_cfg_writel(hw, NFP_NET_CFG_RSS_CTRL, cfg_rss_ctrl); diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h index 1d96b0e9d1..04482455d2 100644 --- a/drivers/net/nfp/nfp_net_common.h +++ b/drivers/net/nfp/nfp_net_common.h @@ -41,6 +41,15 @@ #define NFP_BEAT_LENGTH 8 +/* RSS capability*/ +#define NFP_NET_RSS_CAP (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \ + RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV6_SCTP) + /* * Each PF has corresponding word to beat: * Offset | Usage From patchwork Sat Feb 10 10:42:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaoyong He X-Patchwork-Id: 136584 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6BC7B43AE5; Sat, 10 Feb 2024 11:43:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B8F8A42EC4; Sat, 10 Feb 2024 11:42:46 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2114.outbound.protection.outlook.com [40.107.223.114]) by mails.dpdk.org (Postfix) with ESMTP id 918CD42EC4 for ; Sat, 10 Feb 2024 11:42:45 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iW0B/iKA7MtCxWEtz0GdG6o9CwywaxMH0ZdC9POB3H1iHbHDkwwKmfon4yDX9IHNM2v4kMceqoHhHU/PsqVyMXcCgOHN8B8nIv9siXLb9RxVi/Gd+hRzYElA1Bjs4g2GBI+FVcELrdX1RitIvP085xdftuSVGvgPhpe5yMXRnU8CKkslBEhmtMq5mZhTyTZ1iFMs63s2zu3FKroRcUi2G+UruXhq6EMjYPK5JzX1vqKZ9Gg4u7k91NmUimqb0ScXznNSzm6WIJkIdH+Dx+U0r9W/Clh856yg8y7PWc9NgivNz/Cm2v8ZaCt5FP7KvmJ2b1or7oGjTftryKSLXY4Ojw== 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=aLRD/Wgu9Ytk2Knc6MGZthmjVImpgYrrCMwzObDgp2Q=; b=Mk/FUFJ5/QvhgwS2zhkGziDiyqI9XVL6/4/oQIjXlT3qaPbyeuxnMLtsRszantMXGNxVxGm8EXYNUTRVYZztzC/AvK8zY5SyyiB/avbfhDTeGXk/E1kzM4j1OcGWfRJTL1gsUOcKaLD1TKBIC0trPZQdH9/S7UKharhCYnLQNVMOXjlBz6iqW9WyGiRw/9391XM2e2rtMDMMA8XlimwUoQU7u5GulSZGxTVjh9IRyyHkHCKQhgC8fV/2XHDk9jgNTyuUU/0Vq884tYvHeQ8w0gQYTVfLWbOEnot3WtzAFSMxahhz26i5WiP3WNybskDvIDrKBerx6I40tM/S1gh4zg== 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=aLRD/Wgu9Ytk2Knc6MGZthmjVImpgYrrCMwzObDgp2Q=; b=DyBsh7pjtEsG2VaRxbSgUWMsU1c6VBolP1/sUC2KPeSsF0iLrr3I3lz8m88NZBZ9aZeX5hhyOAUs/9wMbFxwnlUzQe0neWglkfNLiu2nud0F9OP7GlCS6w/U4BhhOCYfEutUP1oLZ8GQYh+oe8Dg6J9H/b2cHylkTPtc9ixZFnM= 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 PH0PR13MB5421.namprd13.prod.outlook.com (2603:10b6:510:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.24; Sat, 10 Feb 2024 10:42:44 +0000 Received: from SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa]) by SJ0PR13MB5545.namprd13.prod.outlook.com ([fe80::8e02:f738:570a:f8aa%7]) with mapi id 15.20.7270.031; Sat, 10 Feb 2024 10:42:44 +0000 From: Chaoyong He To: dev@dpdk.org Cc: oss-drivers@corigine.com, Long Wu , Chaoyong He , Peng Zhang Subject: [PATCH 4/4] net/nfp: support RSS flow action Date: Sat, 10 Feb 2024 18:42:13 +0800 Message-Id: <20240210104214.1248772-5-chaoyong.he@corigine.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20240210104214.1248772-1-chaoyong.he@corigine.com> References: <20240210104214.1248772-1-chaoyong.he@corigine.com> X-ClientProxiedBy: SG2PR02CA0129.apcprd02.prod.outlook.com (2603:1096:4:188::19) To SJ0PR13MB5545.namprd13.prod.outlook.com (2603:10b6:a03:424::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR13MB5545:EE_|PH0PR13MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 51a0ee39-2965-42fc-1ed4-08dc2a250371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +iA/KfGZ4TWsPEnXOfyYqeCvVaf8VkKWDbdBCZYFC10fzqfihu1M6f5kKDzm41KCHYbYfbEbZYxPnG56cToOomHaC1Wt9nKtLC6gQ7XvdSqUIKsTlR6vm5V2wI2utFQPxaFSC5HUi3spRJEB+1uKRMVC3OFn4WYzHFmeT3qPlVoLgngQ+Ppx8Jp/V2oSSFtHxL9wKvLI6KU5WDtpvAX22GXaY1nHM81W6lStVl2fBIuKMa1ssx400nOYlKXNW5No8CZVOFWlt8lXpneNR3HzQjWXZdJkAY88e9naUOQ7qArZUUKYTGu3naS8gY9mCSrDAhYrLA1lpFux6PcylDo5jzrjpflZ8vSmbuLOHNR/HiYaxXIjzt2sz4RUC4GWdi0IliP/kVwkvOZByWeU/qB64ax3KvU0NuiGtlE/dYAb9azsxfwxGIzPcWg5efVRVEwh7Wz4Tx16R1Rqgh76Ur1JE56Vv5TlNsepxzwQJeFzaW3Jpzwx9gQGoLgzZSCLFFaBT4vo4wtBtmNN74hbwweS+5tebEAxVb1OEmS7GKi267E/HNETD95Z26GjWOsv4MUrQ7ja5hRODwGrh48Cd7tHoT/dZw13PVeahZoDiGgWZtVyGRgeE3vqq1Nir5hQazH1 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:(13230031)(346002)(366004)(39830400003)(396003)(136003)(376002)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(38100700002)(66556008)(6666004)(52116002)(478600001)(316002)(86362001)(6512007)(6486002)(5660300002)(6506007)(4326008)(66946007)(44832011)(66476007)(2906002)(6916009)(2616005)(8676002)(1076003)(107886003)(83380400001)(26005)(41300700001)(54906003)(8936002)(36756003)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8gzol+17jdUmFpee2fHYv57g9UqAQAWZm66Y9j3+eXHP6MuPTBzoRpJGvH7lHUT8NgMVh2EBzwu5rf5XHtQC3Qx9xq676PN821ABwsGf24gQ535YjoIoxPfEnAVf6jMzJyFdsezaySiNgSJwVhbte7uxfIpFWMW49FR6U9Wm9H5T5a87rnRkRE/+sdAc1mKMMenuy02YUvYkURyqP+FQeN2sKen63Uh3zdpFtDGoliuMFDwleamReM4rYJcwzEF4LK9a8wJVdm6Lem1WbKRcgMy62gnLftUs9F8061Je7rFYUW2iCPZCUVTqEqtLmjIh41sQusixCpaEwt52VYTUTLfTSuSkgt7vuRoYsk2GknzpaVRikOntuhjbAdTpaSyf7FDmOailb+CdbqebrPtaoidxjyHbgnXTrSbgxda1Sk5yWwtA8MriRXKall5IcecAU0CVh3kzCC4RJ3U88HTc+xQ7BrGpD39Xa08T3EIF4ubYkCAftJ7fBNmEMYa6F9S4p61yH4iVSCelYrsS9BoUmpi6vWnnicZSxqp5gKr6e9M2tmJvLAb/0CQarmSF6+vZXR83Mu6kxWZMFfsuQJeH1pmAoPE1GG2nOQNhJSm8SzrutPuZDjXkKJk4maFhzeUuIew8rA/ErqD3oMnTyuJsRoimdJe91UXB3oZI2YdI55ZuNgKx1oLGYAg1q1IYQ8iV3XIkm3iNrubm/W7mZbT/eW2ONvlvMBXX5K89PxMrnGIWy8qAC9TLwlp1QXuQMke/GeFXkeEtC78/b9UDuLMp+TkjaCMIQ5fVX14JuOHFhTT77vIUwJE2+CuN2ttn7/wdByYLPBJPhry26Erb7gvY0LPYY1dPpUHua2UK2AF6fk74cBOTRWf1fzHrBV0bDVrquhqNqQB0Y2+alnn+piOZSanrQ1IcdeOK95tPAkN9wb32DvyBXPoTGBhhjPxB1bqEduPacfyzaFc1q/rM2kjlId3vbOWZcux+VSKRz9yvfCjuN+F6slyoqSmMW5S03Q4jJ+2JsPjCdsvKPHDkMsMczAKrl23zDtVENLyzyRT/pgCohfbcQutjIHofvs+pGbk9/koy1d5sJXVsINm3R+Wq0oDAV4jdDVPUnuW+/dYNYVKWCS456eZqJsFg49Su0DlwSpokfkB12A+srBKzDBV6gnPUPusmacuCKK06JmWGzMvczBulQHIianYcA+dpIgVVs8b0LOWimLDbx9Auv+eR5t3AkJi9fWCeqi1bEYY1SbttByQY4yC9lVET5L1PyBFz3yexbQ3mWZyNmYD/lqKS1PYp863HK9peXiXBh9Kmr1eVzDcNYLFh3NTWW+BqH7EBWoxymf7/gT1sK+YIfimJuqgr5LvmV7X+KqDOFoEsr7xYb8KI762c4vK0foGszLaEl7mGjPW+/0+ThkGku0e3P327AJvtS3O6TZmHTl6B9kmw4h3j7Ye+6J51TS/j0TYEKiCOIqvce0+hp0Tl4IcBldmfV7jObBrmlFbeE+sv9CoOZiwC7wQVY4SUTh5/5rdbbS7Bp0+slAoacnr0xWqJh4OcXcyuptsr+Q4ZCiuYjYmxhDpDfVYDcSg+B16NkvNQTFBCRzOSSreS7tfevAexmA== X-OriginatorOrg: corigine.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51a0ee39-2965-42fc-1ed4-08dc2a250371 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR13MB5545.namprd13.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2024 10:42:44.1015 (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: 2N2A9a63qre75vl/1pejl88buN+5/ymtrCG6MrQo72q0LvcCVmptr7z1g310mZ85dauSFbhT+9bsFSlz1f2gHvc4JlioC0FSebTsdph2X/Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR13MB5421 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 From: Long Wu Add the corresponding logics to support the offload of RSS action. Signed-off-by: Long Wu Reviewed-by: Chaoyong He Reviewed-by: Peng Zhang --- doc/guides/nics/features/nfp.ini | 1 + drivers/net/nfp/flower/nfp_flower_flow.c | 124 ++++++++++++++++++ drivers/net/nfp/flower/nfp_flower_flow.h | 8 ++ .../net/nfp/flower/nfp_flower_representor.c | 6 + .../net/nfp/flower/nfp_flower_representor.h | 1 + 5 files changed, 140 insertions(+) diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini index 3494111f86..b20049b4f5 100644 --- a/doc/guides/nics/features/nfp.ini +++ b/doc/guides/nics/features/nfp.ini @@ -59,6 +59,7 @@ queue = Y raw_decap = Y raw_encap = Y represented_port = Y +rss = Y port_id = Y set_ipv4_dscp = Y set_ipv4_dst = Y diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 07833fdbdb..1e208b9107 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -1143,6 +1143,9 @@ nfp_flow_key_layers_calculate_actions(const struct rte_flow_action actions[], key_ls->act_size += sizeof(struct nfp_fl_act_mark); PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_MARK detected"); break; + case RTE_FLOW_ACTION_TYPE_RSS: + PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_RSS detected"); + break; default: PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type); return -ENOTSUP; @@ -3509,6 +3512,116 @@ nfp_flow_action_mark(char *act_data, fl_mark->mark = rte_cpu_to_be_32(mark->id); } +static int +nfp_flow_action_rss_add(struct nfp_flower_representor *representor, + const struct rte_flow_action *action, + struct nfp_fl_rss **rss_store) +{ + int ret; + struct nfp_net_hw *pf_hw; + struct rte_eth_rss_conf rss_conf; + struct nfp_fl_rss *rss_store_tmp; + const struct rte_flow_action_rss *rss; + uint8_t rss_key[NFP_NET_CFG_RSS_KEY_SZ]; + + if (nfp_flower_repr_is_vf(representor)) + return 0; + + rss = action->conf; + + if (rss->key_len > NFP_NET_CFG_RSS_KEY_SZ) { + PMD_DRV_LOG(ERR, "Unsupported rss key length."); + return -ENOTSUP; + } + + rss_conf.rss_hf = 0; + rss_conf.rss_key = rss_key; + pf_hw = representor->app_fw_flower->pf_hw; + ret = nfp_net_rss_hash_conf_get(pf_hw->eth_dev, &rss_conf); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Get RSS conf failed."); + return ret; + } + + rss_store_tmp = calloc(1, sizeof(struct nfp_fl_rss)); + if (rss_store_tmp == NULL) { + PMD_DRV_LOG(ERR, "Alloc memory for rss storage failed."); + return -ENOMEM; + } + + if (rss->types != 0) { + rss_conf.rss_hf |= rss->types; + + rss_store_tmp->types = rss->types; + } + + if (rss->key_len != 0 && rss->key != NULL) { + memcpy(rss_conf.rss_key, rss->key, rss->key_len); + rss_conf.rss_key_len = rss->key_len; + + memcpy(rss_store_tmp->key, rss->key, rss->key_len); + rss_store_tmp->key_len = rss->key_len; + } + + ret = nfp_net_rss_hash_update(pf_hw->eth_dev, &rss_conf); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Update RSS conf failed."); + free(rss_store_tmp); + return ret; + } + + *rss_store = rss_store_tmp; + + return 0; +} + +static int +nfp_flow_action_rss_del(struct nfp_flower_representor *representor, + struct rte_flow *nfp_flow) +{ + int ret; + struct nfp_net_hw *pf_hw; + struct nfp_fl_rss *rss_store; + struct rte_eth_rss_conf rss_conf; + uint8_t rss_key[NFP_NET_CFG_RSS_KEY_SZ]; + + if (nfp_flower_repr_is_vf(representor)) + return 0; + + rss_conf.rss_hf = 0; + rss_conf.rss_key = rss_key; + pf_hw = representor->app_fw_flower->pf_hw; + ret = nfp_net_rss_hash_conf_get(pf_hw->eth_dev, &rss_conf); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Get RSS conf failed."); + goto exit; + } + + rss_store = nfp_flow->rss; + + if ((rss_conf.rss_hf & rss_store->types) != 0) + rss_conf.rss_hf &= (~(rss_store->types)); + + /* Need default RSS configuration */ + if (rss_conf.rss_hf == 0) + rss_conf.rss_hf = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6; + + if (rss_conf.rss_key_len == rss_store->key_len && + memcmp(rss_conf.rss_key, rss_store->key, rss_store->key_len) == 0) { + rss_conf.rss_key = NULL; + rss_conf.rss_key_len = 0; + } + + ret = nfp_net_rss_hash_update(pf_hw->eth_dev, &rss_conf); + if (ret != 0) + PMD_DRV_LOG(ERR, "Update RSS conf failed."); + +exit: + free(nfp_flow->rss); + + return ret; +} + static uint32_t nfp_flow_count_output(const struct rte_flow_action actions[]) { @@ -3761,6 +3874,13 @@ nfp_flow_compile_action(struct nfp_flower_representor *representor, nfp_flow_action_mark(position, action); position += sizeof(struct nfp_fl_act_mark); break; + case RTE_FLOW_ACTION_TYPE_RSS: + PMD_DRV_LOG(DEBUG, "Process RTE_FLOW_ACTION_TYPE_RSS"); + ret = nfp_flow_action_rss_add(representor, action, &nfp_flow->rss); + if (ret != 0) + return ret; + nfp_flow->type = NFP_FLOW_RSS; + break; default: PMD_DRV_LOG(ERR, "Unsupported action type: %d", action->type); return -ENOTSUP; @@ -4099,6 +4219,10 @@ nfp_flow_destroy(struct rte_eth_dev *dev, /* Delete the entry in pre tunnel table */ ret = nfp_pre_tun_table_check_del(representor, nfp_flow); break; + case NFP_FLOW_RSS: + /* Clear corresponding RSS configuration */ + ret = nfp_flow_action_rss_del(representor, nfp_flow); + break; default: PMD_DRV_LOG(ERR, "Invalid nfp flow type %d.", nfp_flow->type); ret = -EINVAL; diff --git a/drivers/net/nfp/flower/nfp_flower_flow.h b/drivers/net/nfp/flower/nfp_flower_flow.h index 75f18c6bd5..5d927edde9 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.h +++ b/drivers/net/nfp/flower/nfp_flower_flow.h @@ -33,6 +33,7 @@ enum nfp_flow_type { NFP_FLOW_COMMON, NFP_FLOW_ENCAP, NFP_FLOW_DECAP, + NFP_FLOW_RSS, }; struct nfp_fl_key_ls { @@ -121,6 +122,12 @@ struct nfp_ipv6_addr_entry { int ref_count; }; +struct nfp_fl_rss { + uint8_t key[NFP_NET_CFG_RSS_KEY_SZ]; + uint32_t key_len; + uint64_t types; +}; + #define NFP_TUN_PRE_TUN_RULE_LIMIT 32 struct nfp_flow_priv { @@ -166,6 +173,7 @@ struct nfp_flow_priv { struct rte_flow { struct nfp_fl_payload payload; struct nfp_fl_tun tun; + struct nfp_fl_rss *rss; size_t length; uint32_t hash_key; uint32_t mtr_id; diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index 7284a1e84d..b2c55879ca 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -860,3 +860,9 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower) return ret; } + +bool +nfp_flower_repr_is_vf(struct nfp_flower_representor *repr) +{ + return repr->repr_type == NFP_REPR_TYPE_VF; +} diff --git a/drivers/net/nfp/flower/nfp_flower_representor.h b/drivers/net/nfp/flower/nfp_flower_representor.h index 8053617562..7a4e7ecfc1 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.h +++ b/drivers/net/nfp/flower/nfp_flower_representor.h @@ -24,5 +24,6 @@ struct nfp_flower_representor { }; int nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower); +bool nfp_flower_repr_is_vf(struct nfp_flower_representor *repr); #endif /* __NFP_FLOWER_REPRESENTOR_H__ */