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 17FB2A0584; Wed, 19 Oct 2022 13:12:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CA8D7427FF; Wed, 19 Oct 2022 13:12:07 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id F3707410D1 for ; Wed, 19 Oct 2022 13:12:06 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLeKdrrb/8DEARImW4YmGu3fgTh/uooy7Fu4O4hAbzwoXa8fCfCL820tuH/8AS2pen7WUey73+/UoJiUpXe3D4zDMUljLdRx3ESbuB3Wv/yILynoaqDGRMJHyM74Hq9/PucyE2gJha2qF5ILY0JHIHCv4LzrxkBUiVkWOykpPTlP4TG96W4KPdEWZ32FgoBgc4vagMFr+A1LWdzAU8hgrVez6lJ/B7EHBGqgjCTVIN/dd7aeyAn361FC10G9cUWZb6dyZPpwyWw06/c8/rsWOoIDH8msIOMpEwZ8dZvPKqzHNweO+u48334DRspKFIb+nj5TrW2jZFm43f0YHEKCMA== 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=wF49vgxYFrxh3s+Bc2/T3fLnemw7V2Y7KJiAZtVhs6k=; b=AzspczifgO9xplafpZVT4y4g0Wx/mpowPSk0+IkvXGUqxhRRogI0gmOtQ+MifvFdURlToqIGVVsBkB3K1kZIcir3t8DPuPPaN8siH3CTzjx2P1YeV/VSySD6XEmJSwuPO1Hfq4CuGWlq8qs+s6/DQEkHTpbTyZ7PXfwNq67OO9fgc1CtmIv+2+hb7nN2KOpgz7hzvo+awAqBet7w7DcUdpRUNWoP6LMg4PPGb3VddvfZGgsV4puZvBtS3at0rVC4q3LVr5FbtWA/65GAyZ2zZKVVGDoXxY1nB+akpjSZIUVtSHi9LeADlhSWYiVidyBaJbEi5l1QOF1fxzQLf0NiZA== 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=wF49vgxYFrxh3s+Bc2/T3fLnemw7V2Y7KJiAZtVhs6k=; b=zl9OF9JT60azqUVqGb+2ZrjaJQcN/CQXKjY1Y8qBzZYR8tDASmEhfW0h3e2G4ynLZKdXz00e0Gio43rUkrx9Y5zoQ55hZbq9VkdwQmGYrI2CZK32uMEvquUc1bJ0PIaPTFVXEfvPqih5A3iZgiCSowiPlrhgi9g77GIf9AqIuYg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) by MW6PR12MB7072.namprd12.prod.outlook.com (2603:10b6:303:238::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Wed, 19 Oct 2022 11:12:05 +0000 Received: from DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25]) by DM6PR12MB4297.namprd12.prod.outlook.com ([fe80::b9fd:e732:4585:6b25%7]) with mapi id 15.20.5723.033; Wed, 19 Oct 2022 11:12:05 +0000 Message-ID: <2c989a1e-5a95-1ae0-ea0b-e29a6b76b67a@amd.com> Date: Wed, 19 Oct 2022 12:11:59 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 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 , Niklas Soderlund , "dev@dpdk.org" References: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> <1665382142-21684-4-git-send-email-chaoyong.he@corigine.com> <0f2d733d-4f52-b117-9d0d-762cb890b82e@amd.com> From: Ferruh Yigit In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO6P123CA0045.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:2fe::14) To DM6PR12MB4297.namprd12.prod.outlook.com (2603:10b6:5:211::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR12MB4297:EE_|MW6PR12MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: cf390e87-8c5f-4c83-3140-08dab1c2c0d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7IRff1U2hcq3wP7+wlZkoEI8K8Iwi4FOpGrBbi3wwrkN6E8FsrdB5Uq0OyB1HedKYLHeY4OFHiKosoq10XCeDdR0h6aS7HisDdDkaAvV2gZJGN9pvzsY1bUI/SBPJzKU22+T5TreO+oCjaEu5pKM0Y+rKMOUdh2H5f+RcwAp4EXFnPji9mTbRbxmBDVSOz2pJti2uyNNcdDrwEF0VyWemz4Y5UBJ3pUH2f85NqshlRleyr0SAhMlTpXnBjf1vQHyEzmdDn8s7Cw1jOWv69fwOM7ijg39xqNohlFpzB5k5Cl10DnvSzLkeCIcI1xGIt1vqXs0jH8SXP3pakAz+t2RfmUBH6v19U1RxgUz05DZ1iEeB39rG+23EFQ+DFBq6wU6zLY91q/kGnb/selHLb9XK2QNSYUb2GSHI6XEcRr7koGdohPYYfwYC3G4dJe5qW6a/dhkfwkCrQ1cvsaTgk0pTKZQ8bUlrPG2j291Z8LFO+Nm3FOJAHx6m1yz9ogdmGfLQ2QSFNUi00pf+gcYXaLuQ3TO1en/2hhC87jXYyWjWMOCuaXnE7tFSpVHJFAIz5RLcpgRldFL39sPxkKHhrRmX6fr5vLla7aezNvoM/ADhXmz5eVgIUg4NbQEGZKhIWFlQZ7UCHMEV54dBe/Puse+OH1Y9WvZWk7e2o23V1huaxeUIljwqaZObfOA5OQCI174/6D+yoaNaCuPoygciTnt/X5nu+p8AGmjAy4WK69+bXGH9m3QE732AmLTFgjQLpezkjgO98CNCcvSW23wOMXoGacBbMwS/J5KW3e/Kf1B+NI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB4297.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(366004)(39860400002)(346002)(396003)(136003)(376002)(451199015)(38100700002)(86362001)(6666004)(41300700001)(6506007)(316002)(53546011)(6512007)(6916009)(26005)(54906003)(5660300002)(31696002)(8936002)(4326008)(6486002)(478600001)(44832011)(36756003)(66946007)(66476007)(8676002)(83380400001)(66556008)(31686004)(186003)(2906002)(2616005)(66574015)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YUJEYWswK0FxSnp4ZzI3TE1pcUVkUEYyMm42ZFNNWjFXd3JMcFlXZDFrTEk4?= =?utf-8?B?MHlVZXozTTl6dlRTK3dOdFpKTjhWclpTMC9OWDllbm5CcTlCWVdYZTNpakwy?= =?utf-8?B?b3FwbjI1bkU5VDc2bTQ2eGNScEhYMWV1ekJVM3JqaTBMUm8wVU9uMzZLQUFi?= =?utf-8?B?R3luUXNvRGRtNjhGZmtDK09jeFhUTm1DK0xB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8?B?RnpFT3VxLzBSbHI0Qnl1Z3o0ZC9SWjBPNWRTUHhWZnlNS0U5RkYwaDN2L0ti?= =?utf-8?B?OXBIRnNXVlpPa1k0YTlsV0ZyNlBtZndwRWh2MzVZTFlRbnV3RE9qUEZ4ZEZM?= =?utf-8?Q?Hc1LBplcKbQ3/FqjpRWjGIiou?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf390e87-8c5f-4c83-3140-08dab1c2c0d2 X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB4297.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2022 11:12:04.9692 (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: sMMcXFfLznYcNoYgM5EmvjN7V0Cd1lwv8MJBCtnRfJ/Y0yVmxANyFzk0CT+XzIsk X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB7072 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/19/2022 4:00 AM, Chaoyong He wrote: >> 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? >> Let me clarify this comment, When "stats->pkts == 0", not taken this branch and 'query' fields are not updated. How caller can know if 'query' has random values or assigned values, won't it be good to memset query. >>> + 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. >> And this one also seems not answered, to there is an attribute of action to request resetting stats, above code ignores it. >> <...> >> >>> @@ -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? > > Yes, it is expected. > > This value is part of the nfp_flow_meta, and which is part of the flow offloaded > to the firmware. > And the content of the flow offloaded to the firmware is the ABI of the firmware, > so it's can't easily change. I am not sure we are on same page. This variable is increased when a flow rule is added or validated by application, how this is part of ABI? Also whenever application validates a flow this 'flower_version' value is increased. Application is just validating the flow, not adding a flow so nothing changes in the HW config. And this increase in the 'flower_version' variable may cause driver/hw think that config is changed?