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 4DF2941EBB for ; Fri, 17 Mar 2023 11:15:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 473D742FB2; Fri, 17 Mar 2023 11:15:14 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 6E55840395; Fri, 17 Mar 2023 11:15:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679048111; x=1710584111; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=MCo4Y41PUEMhSLZEDXw2aCm+YCs+K/0MZoo+4W8gFwk=; b=RqZdZzUk9N5rzlgGEn6TTbfWwmJ2/ubEwnZg5lzSIlC8b8uLC5Lh1FEW ogkMS6hg54oHNMvKcgJFaumraKnaFSrToBWD/Ss0Ikv9knq5JabcTITLc XMG/SM6OOwTjLAFLQRDe7Qu+4ffLK4xr1y6bFEjMHPcvsG7qBNhiNNRsT lqeuCu6iqhiOhKGx+5KDXk9OujsuoQG8SdcyuQVyBzLISTO63J8ug7doL WDefMhcw3JmnkP5BFty5z/Wcjq8sDqh/Cwx0/BetQu4s++APZjNWNPyth y+cZhYWYgOaHvPk3ZjFq20tahUK4Pq3Mcdu/hyd67vKpcwdfozs8jtRag Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="340593054" X-IronPort-AV: E=Sophos;i="5.98,268,1673942400"; d="scan'208";a="340593054" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2023 03:15:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10651"; a="744509520" X-IronPort-AV: E=Sophos;i="5.98,268,1673942400"; d="scan'208";a="744509520" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga008.fm.intel.com with ESMTP; 17 Mar 2023 03:15:10 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 17 Mar 2023 03:15:09 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 17 Mar 2023 03:15:09 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21 via Frontend Transport; Fri, 17 Mar 2023 03:15:09 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.21; Fri, 17 Mar 2023 03:15:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EYDqX91PauDofAtvJOrZlbaZeXgPTzdgQraEc04gEHcqOFbpI54WVATX9opc+dJ6dTKbUXdgedZOviqqqHvQzGmM1kDP5GX2FYkP2hwuNJW7Jm/zFIYYk4Hp1vTfQHwKvqnm9BW1FfMOr7K5Dgw/5A/7MKUD1xBNrLWf/FO/IiRacyxqRB0SnaLLH7WGHJ9XDG5MRmNkEgWwx9vvbkf9a40DhLUKUKte2MyKVD/SR496OQltrRMIAQ3K3L45ySe/VrDpMavJfCY0kNG641IliCtHVHrCgmFYu7HM8XEORpJKOWxAIXN2kyQc1rlTdz5auq7KaeDK6JZlsoB0W+BCnQ== 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=tCCBegbo5BixVlIpscfFRag4H5J/znHMZPmH8KI4ZxQ=; b=j1RgOR8yAyQAxvW9o8wz7i3kjRi+CWqVjEsDO1+zwvNNPrlM6HYSluf9Z4R7d0RT7eugxGE0ibO+r2xNS2DBLyQgI0lc7vzSke8Auf7afe7uQmMnBczNSJliGoOGoB9596BPcQsQgT2DLyIVY67YjbtePfs3oxABVXGPvBJmx4pPg65FrTMh5TF50TQ7mkpK26nIbv44y1YV9IHMUfW+uxDcpuyT8oIVQ2V3OaqXr7gJZnJrd+zfl9Qu4R9Y/nTK2spr0hVg8XI3VvlyXtaM+6Jca2js7P2Z8091GQ+UaRrs3SsihUXXpFrySLqs8KDOg1BQKuNIrp0gArn05g7DLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM4PR11MB5994.namprd11.prod.outlook.com (2603:10b6:8:5d::20) by SA1PR11MB8349.namprd11.prod.outlook.com (2603:10b6:806:383::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.35; Fri, 17 Mar 2023 10:15:06 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::2c5d:49cd:a9b4:f764]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::2c5d:49cd:a9b4:f764%6]) with mapi id 15.20.6178.035; Fri, 17 Mar 2023 10:15:07 +0000 From: "Zhang, Qi Z" To: "Ye, MingjinX" , "dev@dpdk.org" CC: "Yang, Qiming" , "stable@dpdk.org" , "Zhou, YidingX" , "Zhang, Ke1X" Subject: RE: [PATCH v4] net/ice: fix ice dcf control thread crash Thread-Topic: [PATCH v4] net/ice: fix ice dcf control thread crash Thread-Index: AQHZWI9jePdohWtwME+rLgqM/P21D67+wHhg Date: Fri, 17 Mar 2023 10:15:06 +0000 Message-ID: References: <20230315082018.4260-1-mingjinx.ye@intel.com> <20230317050936.5513-1-mingjinx.ye@intel.com> In-Reply-To: <20230317050936.5513-1-mingjinx.ye@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DM4PR11MB5994:EE_|SA1PR11MB8349:EE_ x-ms-office365-filtering-correlation-id: adcc3acd-1be0-4a7a-a723-08db26d07b64 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9I/QrfiSMUebuphnGh5hsduocCkq3FvUoxxoMxvK5JA3bjSbPdJ12RCyL8l+sXwapgfDvkeGSv2glLlIVnvrnflJqPJljIOiU5rE8i8UniDFIIzD6tlgTEck4rrqUs74JhukbbqcukxOkgO/Ru+K126aoLlSJ7BKXBDIgnTXHbL2avkaIPBG2nBsEQD+L99+r39Vd/nD78CsI4Jsha1VDLPosDxYj+ixorfPXscMHja/yJlX516j3DRVK8IngrCbXKMkhuBNeHr42X56TIWNsxtcu92zhzPRRqJx2qVZUdDGrTK9TEaVJrxtF/sadlHW/l5ZpeyfxWtknlN65ViCig9yqMTR9i84XWABNJ82CLleP7We0TPSxR4A2+SjizHcO7lc/V1krYRhNAqogTR1C9YGXBzCi5vZgrRYmRcmNX8/Ypaxwqb5frL7R/vPMCwxnCZVZ7Y2HiFJ0CFQrDf8++DBs0bxPI4pw+jf3H43smbGE5eCpcOcTQuO23c8TYHD9LeGx0KZrJ0zRyLnzZgyJ8ZxpQL6IC8ZpnlxmT4G8l4vTW9sYg/VpikDh0dTigZs3MIUt0jfCctqGGdFGxMJILvGvJK0u026Sr8esitdTAh00fYFio2GxvZ8z3HVZ10QRJNxAD0pVjG1slU+osIwrQOo6xZ+CxbmFla+lFrqvF2xzaLd6J+YqGBLcuUFneLQXXCWnUHnqi7Cmd3CCgixjw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5994.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(376002)(39860400002)(136003)(396003)(366004)(346002)(451199018)(82960400001)(7696005)(71200400001)(53546011)(186003)(9686003)(6506007)(83380400001)(26005)(107886003)(86362001)(122000001)(5660300002)(8936002)(52536014)(41300700001)(33656002)(478600001)(55016003)(110136005)(54906003)(2906002)(4326008)(38100700002)(450100002)(76116006)(66556008)(66476007)(66946007)(8676002)(64756008)(66446008)(316002)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8sOAS7VatQG6SmhuAnF6KMHeGtqR2tG4q9K47JwKkKb8WWits67T7B9C3k3i?= =?us-ascii?Q?XzbkdzjuP3ZOsW0rc6LjNWnVWEPzwjlorGM1cwwHj+kPfWanAiF1g4X2FPUR?= =?us-ascii?Q?5DulgXqmmHIy/CrHTq9QYHGn2ZRjfwb2pYQfQFcUu5fC2y+0FK8tD9DvUiWI?= =?us-ascii?Q?JTr5e4oeNwSOTfowDPDs/paLD19wyULemSvq5I2lRSOrOF6nndMspCKHQmdM?= =?us-ascii?Q?XXDTnGhHuojGCd3GO9lr/PefLPla83L0j3no8CTPMRpzLUlLqe1INTecNueZ?= =?us-ascii?Q?wgabgcdb3xfl43IPUN+qc9GMmmZZk9WLxxXb20NeSNn4tdYSdi/+JFixtMx9?= =?us-ascii?Q?2B3mU8QJNwZ9woguJL0G8ELLZeTbHp+TfTEqwWYxEPLuh0Za37eZarg1EiC3?= =?us-ascii?Q?8nlOqfmK5OPhEwTRMDjztsXWmgokOsW7hZ9bFvV20apkfgsL5mElYpZvnSJr?= =?us-ascii?Q?31wb0meRS69Y2iNhCTkU6Bzm/f96x9oXetIsiTFeB7fxrwtnWqiWngJYRboO?= =?us-ascii?Q?3YOKPiuB+jNQLVE/ZUi9EeBVrKZ7pz6l2JC54pHhQorDZz8ThLHgoLv/R1O2?= =?us-ascii?Q?wP+nV+barSEiASHmbdi02SUyB7tW+2BomX0Rg5vUnkZmSJ5Nh1EH++iGW0Q9?= =?us-ascii?Q?5k1+fVtRd5/tc5NObvxjURh4qBkvPnOsDjOBEJiqVNCajjg2VgOAE5I9HT/5?= =?us-ascii?Q?MDGj40zEBcsP67crpo5HVk/lJR5KJl/Qo8OAfPs4VEp2XPaeXcj2nasEPoQE?= =?us-ascii?Q?ONC1RRw7QSZHOqP/CM4ba8xOz5VOammRx+JIMMK30ZYlpfMYnKiLv//6pvnM?= =?us-ascii?Q?O59XhE8EQi7VOJLfe8xFDUhq1nGy+n869Rw0AE2CuBRZ7BmC3eoygDFz0Q/I?= =?us-ascii?Q?AQcMhcz1jVhYaYnf+eyBBLyxlwdTatH5nJGUBuGGJa8Aj+1CrTTDAvn61E8i?= =?us-ascii?Q?KbxGbA6EkitzdjDr6P2uAxVat+KnQD2P+NpsLMKmZqIaf4YnhzVBjMSMNptT?= =?us-ascii?Q?GyFCx2XwINJ/sMYp1XtY8OPHk4Gdvlbno0pJLbW56R3S/iqsdHBssL4rspXI?= =?us-ascii?Q?cysPXPFNXBi06V//dLtilOLC4Ix17XfWZTCHXs8jK17AyFLK38WAEPG/Co9l?= =?us-ascii?Q?IWDic2h/vnSdhPT8EKuDNh4miDMSqubTPUKuY9TLffw5IDW0P3wNiZj8fWyo?= =?us-ascii?Q?El+IOiUoi7SjBeCb27+IObWdDTYZEBcrn1FZy4nZAXfalqgRCfdnqLMOtKxB?= =?us-ascii?Q?K4UpmhtERTPY0O30QbAfsLTCtVH0TuMP6LkKiAal2Ucu0qQY4+DfGHqRuX6g?= =?us-ascii?Q?M5ZtJO9jM+hzpRxwicViyoZI0Q6q8ilZEnfKI53Wr4fsrjWZvmnZge0MEeRp?= =?us-ascii?Q?7ThdsBAbPmlrCdDuvS5M0BIVBFMzRz8H2+QiDLmYzTMfA2NqG83OXenk31mw?= =?us-ascii?Q?ik3Am7cycU78Y3iFngica1qW09PIoajoTqvpL1kUUWGKofuTYdpSnisoGkq5?= =?us-ascii?Q?BeQ4Rj+IoKXjKzgcaSFkV3qbPQrp4fHKqMT3NoyiPXmAqQvycHx71BeN0s3A?= =?us-ascii?Q?errYSE/xW3XzSlBHk7Bcmn4a7GolRxyT6aQPvn6s?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5994.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: adcc3acd-1be0-4a7a-a723-08db26d07b64 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Mar 2023 10:15:06.7679 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LQp8+oSUKzsC5SwVuXc4s3Evnd6e2Fc9mNY4YUNU2Lp8Cuk1/gNorQyuSqnwRTYF4asPIcj3kq68tlfS9nh9+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8349 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > -----Original Message----- > From: Ye, MingjinX > Sent: Friday, March 17, 2023 1:10 PM > To: dev@dpdk.org > Cc: Yang, Qiming ; stable@dpdk.org; Zhou, YidingX > ; Ye, MingjinX ; Zhang, > Ke1X ; Zhang, Qi Z > Subject: [PATCH v4] net/ice: fix ice dcf control thread crash >=20 > The control thread accesses the hardware resources after the resources we= re > released, which results in a segment error. >=20 > The 'ice-reset' threads are detached, so thread resources cannot be > reclaimed by `pthread_join` calls. >=20 > This commit synchronizes the number of 'ice-reset' threads by adding two > variables (the 'vsi_update_thread_num' static global and the > 'vsi_thread_lock' static global spinlock). When releasing HW resources, w= e > clear the event callback function. That makes these threads exit quickly. > After the number of 'ice-reset' threads decreased to be 0, we release > resources. >=20 > Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF") > Fixes: 931ee54072b1 ("net/ice: support QoS bandwidth config after VF rese= t > in DCF") > Fixes: c7e1a1a3bfeb ("net/ice: refactor DCF VLAN handling") > Fixes: 0b02c9519432 ("net/ice: handle PF initialization by DCF") > Fixes: b71573ec2fc2 ("net/ice: retry getting VF VSI map after failure") > Fixes: 7564d5509611 ("net/ice: add DCF hardware initialization") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ke Zhang > Signed-off-by: Mingjin Ye > --- > v2: add pthread_exit() for windows > --- > v3: Optimization. It is unsafe for a thread to forcibly exit, which will = cause > the spin lock to not be released correctly > --- > v4: Safely wait for all event threads to end > --- > drivers/net/ice/ice_dcf.c | 18 ++++++++++++++-- > drivers/net/ice/ice_dcf.h | 1 + > drivers/net/ice/ice_dcf_parent.c | 37 ++++++++++++++++++++++++++++++++ > 3 files changed, 54 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index > 1c3d22ae0f..169520f5bb 100644 > --- a/drivers/net/ice/ice_dcf.c > +++ b/drivers/net/ice/ice_dcf.c > @@ -543,6 +543,8 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw > *hw) > ice_dcf_disable_irq0(hw); >=20 > for (;;) { > + if (hw->vc_event_msg_cb =3D=3D NULL) > + break; > if (ice_dcf_get_vf_resource(hw) =3D=3D 0 && > ice_dcf_get_vf_vsi_map(hw) >=3D 0) { > err =3D 0; > @@ -555,8 +557,10 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw > *hw) > rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); > } >=20 > - rte_intr_enable(pci_dev->intr_handle); > - ice_dcf_enable_irq0(hw); > + if (hw->vc_event_msg_cb !=3D NULL) { > + rte_intr_enable(pci_dev->intr_handle); > + ice_dcf_enable_irq0(hw); > + } >=20 > rte_spinlock_unlock(&hw->vc_cmd_send_lock); >=20 > @@ -749,6 +753,12 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, > struct ice_dcf_hw *hw) > struct rte_pci_device *pci_dev =3D RTE_ETH_DEV_TO_PCI(eth_dev); > struct rte_intr_handle *intr_handle =3D pci_dev->intr_handle; >=20 > + /* Clear event callbacks, `VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE` > + * event will be ignored and all running `ice-thread` threads > + * will exit quickly. > + */ > + hw->vc_event_msg_cb =3D NULL; > + > if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS) > if (hw->tm_conf.committed) { > ice_dcf_clear_bw(hw); > @@ -760,6 +770,10 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, > struct ice_dcf_hw *hw) > rte_intr_callback_unregister(intr_handle, > ice_dcf_dev_interrupt_handler, hw); >=20 > + /* Wait for all `ice-thread` threads to exit. */ > + while (ice_dcf_event_handle_num() > 0) > + rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME); > + > ice_dcf_mode_disable(hw); > iavf_shutdown_adminq(&hw->avf); >=20 > diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h index > 7f42ebabe9..6c636a7497 100644 > --- a/drivers/net/ice/ice_dcf.h > +++ b/drivers/net/ice/ice_dcf.h > @@ -143,6 +143,7 @@ int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw > *hw, int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc, > void *buf, uint16_t buf_size); > int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw); > +int ice_dcf_event_handle_num(void); > int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw); > void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw= ); > int ice_dcf_configure_rss_key(struct ice_dcf_hw *hw); diff --git > a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c > index 01e390ddda..0ff08e179e 100644 > --- a/drivers/net/ice/ice_dcf_parent.c > +++ b/drivers/net/ice/ice_dcf_parent.c > @@ -14,6 +14,9 @@ >=20 > #define ICE_DCF_VSI_UPDATE_SERVICE_INTERVAL 100000 /* us */ > static rte_spinlock_t vsi_update_lock =3D RTE_SPINLOCK_INITIALIZER; > +static rte_spinlock_t vsi_thread_lock =3D RTE_SPINLOCK_INITIALIZER; > +static int vsi_update_thread_num; Is this correct? Consider a scenario where we have two NICs and two DCFs ru= nning in the same DPDK process. Should the parameters be specific to each D= CF? > + >=20 > struct ice_dcf_reset_event_param { > struct ice_dcf_hw *dcf_hw; > @@ -130,6 +133,9 @@ ice_dcf_vsi_update_service_handler(void *param) >=20 > rte_spinlock_lock(&vsi_update_lock); >=20 > + if (hw->vc_event_msg_cb =3D=3D NULL) > + goto update_end; > + > if (!ice_dcf_handle_vsi_update_event(hw)) { > __atomic_store_n(&parent_adapter->dcf_state_on, true, > __ATOMIC_RELAXED); > @@ -150,10 +156,14 @@ ice_dcf_vsi_update_service_handler(void *param) > if (hw->tm_conf.committed) > ice_dcf_replay_vf_bw(hw, reset_param->vf_id); >=20 > +update_end: > rte_spinlock_unlock(&vsi_update_lock); >=20 > free(param); >=20 > + rte_spinlock_lock(&vsi_thread_lock); > + vsi_update_thread_num--; > + rte_spinlock_unlock(&vsi_thread_lock); > return NULL; > } >=20 > @@ -183,6 +193,10 @@ start_vsi_reset_thread(struct ice_dcf_hw *dcf_hw, > bool vfr, uint16_t vf_id) > PMD_DRV_LOG(ERR, "Failed to start the thread for reset > handling"); > free(param); > } > + > + rte_spinlock_lock(&vsi_thread_lock); > + vsi_update_thread_num++; > + rte_spinlock_unlock(&vsi_thread_lock); > } >=20 > static uint32_t > @@ -262,6 +276,18 @@ ice_dcf_handle_pf_event_msg(struct ice_dcf_hw > *dcf_hw, > PMD_DRV_LOG(DEBUG, > "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event"); > break; > case VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE: > + /* If the event handling callback is empty, the event cannot > + * be handled. Therefore we ignore this event. > + */ > + if (dcf_hw->vc_event_msg_cb =3D=3D NULL) { > + PMD_DRV_LOG(DEBUG, > + "VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE > event " > + "received: VF%u with VSI num %u, ignore > processing", > + pf_msg->event_data.vf_vsi_map.vf_id, > + pf_msg->event_data.vf_vsi_map.vsi_id); > + break; > + } > + > PMD_DRV_LOG(DEBUG, > "VIRTCHNL_EVENT_DCF_VSI_MAP_UPDATE event : VF%u with VSI num %u", > pf_msg->event_data.vf_vsi_map.vf_id, > pf_msg->event_data.vf_vsi_map.vsi_id); > @@ -505,3 +531,14 @@ ice_dcf_uninit_parent_adapter(struct rte_eth_dev > *eth_dev) > ice_flow_uninit(parent_adapter); > ice_dcf_uninit_parent_hw(parent_hw); > } > + > +int ice_dcf_event_handle_num(void) > +{ > + int ret; > + > + rte_spinlock_lock(&vsi_thread_lock); > + ret =3D vsi_update_thread_num; > + rte_spinlock_unlock(&vsi_thread_lock); > + > + return ret; > +} > -- > 2.25.1