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 68C2BA0544; Mon, 10 Oct 2022 16:48:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09F964021E; Mon, 10 Oct 2022 16:48:58 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2052.outbound.protection.outlook.com [40.107.237.52]) by mails.dpdk.org (Postfix) with ESMTP id D15CD40146 for ; Mon, 10 Oct 2022 16:48:56 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AJbLBKAWffKz1NY88kd+w7isauPCDkeOj2HNDqHB+Di5Br/W9kuDe3UDRHJSMG+uR4OTgC1POQJcXmH4KtMr7h87GsQxh4Gn+G3Hw54C4VanyahEgKosWski886r/0zJ1FHMgW1EVeXfdglWjoc+cMCplNIRsVf65zXjTY7qWEfcwFRPhP1J/32GMyB2vlhL4OKQb7y+wn8GjgYwDNRgUQjRCW0AHBHrk9BDNhAhvzM1+Sb+OGxnmmFOdn6PAuDEIBwKDQo+LvxcqqMtNZfDU3lZAyf1YcpHgP93k5C/2lciXwYtntWHrN7BIzrYsShOxm6MZTemBU6OXROvV0zTAg== 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=uaL1VIFKK/sTMhCXrM1bQfSM8jcnhjvx0tscTe9Tkio=; b=h1eI0qEvnwUOchIHYDmJDpPdxlGapn0i/kTqEBuIh+uZJ2JzSVbWuJhpdIt8p0LXzlc+3oJpYScCslmfCgJoVbmvkp1XP3TOTcvpW/y4Ni9bKOyRJEuEX7/ox2e7kdB4jp+WQYGR4mFMQQrzHH3+Wx03nNBZblOu4Gv2SrXlT2UACblYL0YORoqwBY22lzyLiE2AaOm/biezATxFTcjdAwkQs5YkYbqxgtmXuljQB49A5dPUOMHZ1rZ5RQRtD8kPaMot8F0lNtfg0Ef/wpF8VzNadgux3eIsk5PRYRIxKBn1SisVCDVkzlKgmzi0b+VhZBeNf7BpeP2OJSgkiLkRCA== 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=uaL1VIFKK/sTMhCXrM1bQfSM8jcnhjvx0tscTe9Tkio=; b=5kVN72iO+fIqm56A4d7CLIs9zo6DiEca+IlyftuVjj0dueXlCamE8Z/cEthlpmnWs6eOhmLndyCjiQwSX7Bv7xLAm9TrjM75XCib9vGmh239uZQqXRcSmlzCtephA6z39YHoYCErmw0FFKi4PNSzZmqsVrUiZOvZdh61zm/0V2U= 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 MN2PR12MB4584.namprd12.prod.outlook.com (2603:10b6:208:24e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24; Mon, 10 Oct 2022 14:48:48 +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:48:47 +0000 Message-ID: <79e92e9b-6642-b3c4-40bd-26d04c7b1ea9@amd.com> Date: Mon, 10 Oct 2022 15:48:43 +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 01/24] net/nfp: add the stats process logic in ctrl VNIC service Content-Language: en-US To: Chaoyong He , dev@dpdk.org Cc: oss-drivers@corigine.com, niklas.soderlund@corigine.com References: <1665382142-21684-1-git-send-email-chaoyong.he@corigine.com> <1665382142-21684-2-git-send-email-chaoyong.he@corigine.com> From: Ferruh Yigit In-Reply-To: <1665382142-21684-2-git-send-email-chaoyong.he@corigine.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0303.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::20) To MN2PR12MB4301.namprd12.prod.outlook.com (2603:10b6:208:1d4::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN2PR12MB4301:EE_|MN2PR12MB4584:EE_ X-MS-Office365-Filtering-Correlation-Id: 41b452c8-609a-4405-dc57-08daaace899b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4FheOVDpDsaiXWPA3XNRUvfYieE0wjvwFRO3tdb+DRGbLSIoJjSL8WLLvtc8xdhde+c7Q9I/p1pxDC1iu6sEPdLLLjfVM67Dk0/ewUtelNUC0clZMKr0bPpK8a8mYw6mdnKi7IOZ0PTaCJ0Vlk5lt1FcVat5rNcqbeMY9mCUt9DUOvxEk0UkkdH4OkURT4pITqsxYis3eadWQ00fW5TTB7PRjk6wcHFqSNHf9mxc4OElR/1zEX2aaxhrLdGfgPGu+VACh/N+lTKrqp39LZdtFrrTqCZbWxTuwmPrX/gqMQoUTOkB+fpDOCDm1my/8+mqeOI68eKSDe1oTwQNcG5CYJZEulQT8r+TROioi6MILzO4BUm17AER96LbeKjTorWPeMMdESypjeok5m4LBdwLlDdIF1tYP0e9rD012Q9tvQakr1fHdFN2O7RQgHK+OltNPyiUnH6RDCSuECIlsPbL3ib815cc99+5rDthe/SVONgjOBsO66JSjZbk/M9RFOcWIAlHSJrcIiPNsrkQCQXnR1e5XxbDePk/r1YuLuksWsv/D8iGbUPNoZYenr4QVbpVeUs1IZJoQexncROnx0Yp7bVj0wgD5GsJs32R3rcWFtiXICNpWEURLpL59ayPC9XaaVnwUA4bvoRo8WvdAB3S6eLU4Z7TZtjLJRsboRec5nVlQ0ZBsvV9eebDOWsHgw3D/YfZer4lTaJbfEhu6/H7akk/l4y059yoEPw6o+5Iv0qc1oPPiX1FuwSB9SpP8vVUjiPBYGmUPbSBEzB6RAlmCzw2LghZvEajNWCP7ooMqII= 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)(376002)(346002)(366004)(136003)(39860400002)(396003)(451199015)(36756003)(31686004)(44832011)(66574015)(38100700002)(83380400001)(186003)(86362001)(31696002)(5660300002)(66556008)(6512007)(2616005)(478600001)(26005)(6486002)(8676002)(2906002)(53546011)(6506007)(316002)(66476007)(41300700001)(8936002)(66946007)(4326008)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VzRFL2tVMnJHNGhqaDIrWUhPTGFmZmxaVUwyM0pCNi9GUmQ3dnN0VkI3RWMv?= =?utf-8?B?Y0NYRy9LZWxlMDAraEFMSHd0ZEsxSlRtNElWN2xXMlZLRVhaLzd0ZXFxU1hW?= =?utf-8?B?NjJaSnMyWndqUUlkeEZKVndzTitkV01sTE9lMkRvbUVSRTkrd08zbmRlZVhW?= =?utf-8?B?U091UUR2bDRDVlhlcXhkOFNJYzZ3WUNNakVMRHV2VkpucnRsbWFpbXR2dkZ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QvOVdCZWJMeGh6aTBPcFcvOFNDVXZWdEhOa2FTbVQy?= =?utf-8?B?UXRHU3FPb2IzRVVPWU5tZkJiWmxXZkdHRENvWmN3M2UyVUgwVzFVbDRPRDFX?= =?utf-8?Q?sxdTuCkV4hh0/a2dw+edMw2kq?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41b452c8-609a-4405-dc57-08daaace899b 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:48:47.8162 (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: t5Sj/6WvwNtLWA1wWaYxOT1aPF1G3RkYDncbWCDYKNiglUP67XI3XWgucDO69KMe X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4584 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 stats process logic in the ctrl VNIC service. > The flower firmware pass the flow stats to nfp driver through > control message, we store them in the flow_priv structure. > > Signed-off-by: Chaoyong He > Reviewed-by: Niklas Söderlund <...> > +static void > +nfp_flower_cmsg_rx_stats(struct nfp_flow_priv *flow_priv, > + struct rte_mbuf *mbuf) > +{ > + char *msg; > + uint16_t i; > + uint16_t count; > + uint16_t msg_len; > + uint32_t ctx_id; > + struct nfp_flower_stats_frame *stats; > + > + msg = rte_pktmbuf_mtod(mbuf, char *) + NFP_FLOWER_CMSG_HLEN; > + msg_len = mbuf->data_len - NFP_FLOWER_CMSG_HLEN; > + count = msg_len / sizeof(struct nfp_flower_stats_frame); > + > + rte_spinlock_lock(&flow_priv->stats_lock); > + for (i = 0; i < count; i++) { > + stats = (struct nfp_flower_stats_frame *)msg + i; > + ctx_id = rte_be_to_cpu_32(stats->stats_con_id); > + flow_priv->stats[ctx_id].pkts += rte_be_to_cpu_32(stats->pkt_count); > + flow_priv->stats[ctx_id].bytes += rte_be_to_cpu_64(stats->byte_count); Like below comment, 'stats' is a pointer and I don't see any code that allocates memory that this pointer points, at this stage it has invalid value and above code will crash. I assume that memory allocation is in next patch, in that case this patch should come after it. <...> > void > nfp_flower_ctrl_vnic_poll(struct nfp_app_fw_flower *app_fw_flower) > { > - uint16_t i; > uint16_t count; > struct nfp_net_rxq *rxq; > struct nfp_net_hw *ctrl_hw; > @@ -242,9 +308,8 @@ > count = nfp_flower_ctrl_vnic_recv(rxq, pkts_burst, MAX_PKT_BURST); > if (count != 0) { > app_fw_flower->ctrl_vnic_rx_count += count; > - /* Process cmsgs here, only free for now */ > - for (i = 0; i < count; i++) > - rte_pktmbuf_free(pkts_burst[i]); > + /* Process cmsgs here */ > + nfp_flower_cmsg_rx(app_fw_flower->flow_priv, pkts_burst, count); At this point, as far as I can see, 'app_fw_flower->flow_priv' is not pointing to any allocated memory, so it is an invalid pointer.