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 B5394A0544; Mon, 10 Oct 2022 16:51:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A56E34021E; Mon, 10 Oct 2022 16:51:12 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2084.outbound.protection.outlook.com [40.107.243.84]) by mails.dpdk.org (Postfix) with ESMTP id 68FBC40146 for ; Mon, 10 Oct 2022 16:51:11 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFEMOqiGndDrbDBbdH5kU6eToi4ADDs0DU/xOK1no17xqc2c+wf73Opok95FWPWuqY+1LWxc/wvpF4MEsMyOIGi6hnK8YefDC+xrxVaEPy0IKc/xWaidhnEYcjuKpq+sQw0zxH+jbCEUuP63OUq3yZCE/gBuZ327cbCWwn876ZTGKOK7bnvWBhwsCUKjIuCjyrDbteAEdLTLAnhAWORmttDnOfCHoz5ylfJe5NJ3AO0qKfq7mNQaxvE334ygx4STXob5YIccDM4ZiOYfXsHQ7Z36O1nI1Eft8aosmmRRkrRkv/YW1jmP6oxFja/WyfGJSzYFp32arqmOexeiUEJKYg== 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=jtP09AiAWhXWUd7QveZIa1Yg/bi+UNFYNxGxDn1UYus=; b=a2BvLStQwbDEwqoAK+sNbQs8LhObZZn0efkM34+XShxrGAs6pdZe1ZLZSz6bfvNa+ynwJmnADveNclXbB46wiQ7hpq4WDnwe+6H3rtFjYv2YEH3OeciPCziPf38lxXJvfr/Ou1FPGUGSEpoT8332S8VwS+eIARNrNu2NAoFOTPE/j/6P2Ib3I4SqyMsad5iPljXu4PEX+sZcG8ku2NMaKvh2midflMTIx5sKOBvxmwW0Lf01PAPq1+g4l0GDLUqRdBbL1Y/jkEdOTh19Cff8eYDEo9PRLBE6FjCnD9zRNa+WHBt6K31IhSwVP7SAMDSiHsgfMaWY8v46lclFjRfZLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jtP09AiAWhXWUd7QveZIa1Yg/bi+UNFYNxGxDn1UYus=; b=gtoCPkythnAuKTsoMmELaI1j/K7HEMk7u0YdxPHYIhkM1rHL/bgsppOqkNtIaylP13X9gkL01CcE7DY9WYhC7x8GmeH9mdyqJ8aCvDUf+0w+cRYhDjEj55cozkVZMScjIMSsNNIxYbezozCjGKvYbn6tk+6/+AqI2EKidZgiDmc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MN2PR12MB4301.namprd12.prod.outlook.com (2603:10b6:208:1d4::22) by PH7PR12MB6858.namprd12.prod.outlook.com (2603:10b6:510:1b4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Mon, 10 Oct 2022 14:51:09 +0000 Received: from MN2PR12MB4301.namprd12.prod.outlook.com ([fe80::7900:1b25:bc:104c]) by MN2PR12MB4301.namprd12.prod.outlook.com ([fe80::7900:1b25:bc:104c%7]) with mapi id 15.20.5709.015; Mon, 10 Oct 2022 14:51:09 +0000 Message-ID: <0f2d733d-4f52-b117-9d0d-762cb890b82e@amd.com> Date: Mon, 10 Oct 2022 15:51:04 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH v2 03/24] net/nfp: add the flow APIs of nfp PMD Content-Language: en-US To: Chaoyong He Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com, dev@dpdk.org References: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> <1665382142-21684-4-git-send-email-chaoyong.he@corigine.com> From: Ferruh Yigit In-Reply-To: <1665382142-21684-4-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0568.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:276::18) To MN2PR12MB4301.namprd12.prod.outlook.com (2603:10b6:208:1d4::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4301:EE_|PH7PR12MB6858:EE_ X-MS-Office365-Filtering-Correlation-Id: 03f850d2-3959-4648-2adc-08daaaceddf0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xA+Rkc+thd46auxn7rJ9g9VFNc1gMb0AmILKnqFie5WcKhBVC2DXQJk7uYjSo32wWjxs4XHE0HkhbIkqfCVY9i3sXYH3PvBeqE5/SIMh6gj5DUgGzNjQqo3R9DQQewxEOMv4pVdeGZN+vIzcJez96PrKKfckK98UIi7L7p1xLT8MeXtZoKjEfjGabxkXjvplZ4pWPCsUOM9XIGRvDQRowmEW5Wk0Uf/tarBc1xgmndnB2WDuTlzt15lhpPfercwpGo9VvVQB2u5KSRmfumKb1SbFAA9Hbzjtg8HbhMPPH4xmWTx404QketMN68EQh9yldtaAnqrmTvsDeeaFcDg1aoZogEYancEW68p+rC6xnezPTUEO28PYDGROQfJczk9zJERhk5gvsTFtoBo3IUb0/t9QR7pErZIsfpJBcxQ4T4fQimt1NzF+6CA+C5sXR4AbDLWbqNH8vBlasvHWVEB6mff4ED4Clxk28X9ZHgw/jt0oM8hEoDq65KXjX2Wa2cO3InL0VLe/a7+DUa+VL3ibiXg2lHHVzpcVMBzwfoAMA+OsBUuZKaTeudXAagehqgdW8VaZjSeuHYs2v587snjD7AgwK1C5RXxwn00Xp31OMwnnv8J1CL2hqaiSIosnGXwag3l7F9Q0VYXbwXv5tfFx8QMeM1UGK8cLHcK9UqO4Jm26Xvvfu3jMW3/+SVWHEWD6DEwhtaorZsLqgkDS+ujQZmrIqQJgZckCsxFs2sA7Dll8RelhGrXC5GuguPQaJTEcb2QiMELineUXCrMnrCC1EXb87vlLIxgAqYbNd0hboAo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR12MB4301.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(136003)(39860400002)(346002)(396003)(376002)(451199015)(2616005)(4326008)(6512007)(478600001)(66556008)(6486002)(66946007)(5660300002)(8676002)(186003)(44832011)(53546011)(26005)(31696002)(36756003)(86362001)(66476007)(6506007)(38100700002)(2906002)(66574015)(83380400001)(41300700001)(8936002)(6666004)(31686004)(316002)(6916009)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eHRTV0puNlYyVWZnVGRiQklHdlVEYUh3OVBhM2kxNmpFUTZoenlnb0swdnp3?= =?utf-8?B?bmhnMGJjclZIUFNDcHJVMGcvQUZsQXBELzEwdTNRMEhpL1ZWU3JkUFBsVWlD?= =?utf-8?B?cjNRQ3ZWZ3J6dElKOWw1MDZXNERTdHZpMFAzUWRBY3RROERkYmxiZnlNOTF5?= =?utf-8?B?TGJ0OXBRSjc1ODh5d1lVV0cwZFZYajIxK01jQjN0VVk0Vm5YcnZNclZzdFV5?= =?utf-8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XdXd3ZlY0JzL1lBbCsvbU8wRDRvUUZibFo0?= =?utf-8?B?dlFNMUViR1h3WDIvWEVtczdtWDRDV2g5NGVGVTAva2JSdjhTNWRYOUhWb2dQ?= =?utf-8?Q?pphw=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03f850d2-3959-4648-2adc-08daaaceddf0 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB4301.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 14:51:09.1710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: o7rI5ECmrXGkSWf8+WFpvU9H3m5uz/d3nFXO1xiBzLWaWOKPKmIrkzweW8AdaPV8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6858 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 On 10/10/2022 7:08 AM, Chaoyong He wrote: > Add the flow validate/create/query/destroy/flush API of nfp PMD. > > The flow create API construct a control cmsg and send it to > firmware, then add this flow to the hash table. > > The flow query API get flow stats from the flow_priv structure. > Note there exist an rte_spin_lock to prevent the update and query > action occur at the same time. > > The flow destroy API construct a control cmsg and send it to > firmware, then adelete this flow from the hash table. > > The flow flush API just iterate the flows in hash table and > call the flow destroy API. > > Signed-off-by: Chaoyong He > Reviewed-by: Niklas Söderlund <...> > +static void > +nfp_flow_stats_get(struct rte_eth_dev *dev, > + struct rte_flow *nfp_flow, > + void *data) > +{ > + uint32_t ctx_id; > + struct rte_flow *flow; > + struct nfp_flow_priv *priv; > + struct nfp_fl_stats *stats; > + struct rte_flow_query_count *query; > + > + priv = nfp_flow_dev_to_priv(dev); > + flow = nfp_flow_table_search(priv, nfp_flow); > + if (flow == NULL) { > + PMD_DRV_LOG(ERR, "Can not find statistics for this flow."); > + return; > + } > + > + query = (struct rte_flow_query_count *)data; > + ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id); > + stats = &priv->stats[ctx_id]; > + > + rte_spinlock_lock(&priv->stats_lock); > + if (stats->pkts && stats->bytes) { Is it guaranteed that 'query' ("void *data") is zeroed out when it is provided by application? > + query->hits = stats->pkts; > + query->bytes = stats->bytes; > + query->hits_set = 1; > + query->bytes_set = 1; > + stats->pkts = 0; > + stats->bytes = 0; need to check 'reset' field of action to decide reset or not. <...> > @@ -75,6 +101,7 @@ struct nfp_fl_stats { > > struct nfp_flow_priv { > uint32_t hash_seed; /**< Hash seed for hash tables in this structure. */ > + uint64_t flower_version; /**< Flow version, always increase. */ Is this version to keep unique value per flow configuration? If so as far as I can see '.validate' is updating this value, is this expected? Also who suppose to use this value?