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 C85CFA0560; Tue, 18 Oct 2022 15:18:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB58140395; Tue, 18 Oct 2022 15:18:37 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 721404021D for ; Tue, 18 Oct 2022 15:18:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666099115; x=1697635115; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=n1fPnXF+n3oRZ+VDsTk8H8mk5Bot6CEYYBWS3rZQ0JY=; b=OamMu6iw2lIsSnX8m9xx73VjplTF1bBKWeRaZDHXyamFla8IdUK+oW/E LXUK3iCwcnSRDkgi0CBTV0NoA7irfmoza32aWiZQlslii/YpUiuhAYuFT GE+jRwzGNdyRFhTCjWgr1vpX66E7qlz+nsuY0Y+U9vsyJBcSsXZSWoD8K P92EB/Q0/Jofeok20G2M8qzsqdTzKJprvk6uy2T2fzGHMF+eqiTJueiA4 GiDtQMTwKMP6tzwD876waipbXL/lXNMzGy2ji5dipt34z7y4uFUa0/9OR MYBY+Xu0nazHLiX/bbFa4Bq/lvovsL4X+34QXWsQNk310JRa8o6jwRJad Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="306083567" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="306083567" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 06:18:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="606534237" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="606534237" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga006.jf.intel.com with ESMTP; 18 Oct 2022 06:18:21 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2375.31; Tue, 18 Oct 2022 06:18:21 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 06:18:20 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 18 Oct 2022 06:18:20 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.107) 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.2375.31; Tue, 18 Oct 2022 06:18:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kSbx+0Ug5iBNfzciK6Fx27tTPREaaQt42kBwX4ubKJrB8rixxsM7xFUK9cp4l2om09r9eX5Gt3vmOJplZ8y3Y+KMRjtM/woGrjqtinB9mHWWmyaAAdIWiYCzqV9MB0dfJLSNr/p+VaX2RusaFLTIiw0le1OYSf9lWOUX2mEi/LF8tqcpcuw2nCGp/2mkdvOVuQjUPwyu6+qPiB0iBnnYDu4JFA3Cxz0rNct624RRAnZLqNnJkDkPokOjRy/rP3MMFDIqBr46XVLs4J/bnogHSt6LKOojnW0Ngrkxu7X9MPBRoXSVZzEY2ULsSikVDAlZef2EG0sipIHeLEfBS+zyWg== 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=NKzEbXLZtAb7h8J2E862Nms8JJJpbiMDTq9atgF+4Dk=; b=U+4C+cEMvTwrh29Wkh/HUofgBxjulHXuSdkEzCyiz14mD9rVmhIguzl7NoITRWGqxItBkAxW5DpYbvIR1OPJtaR98n4MH+U9V6y8L86/eT4+iqMy3WC5kgZIoZv+PIqpaq/X5t/OOctF8XcpsMVBQ1O5/trpXqX0u3d4jir9yhChpDWUdLt2rpNV/gau5junbKmC15HtT0TJi8D75tkETdjydfCgc7tZE+JGy5Yj/3UgfTupra0INIxB1stxp3emzWa5kQj/Kbwd8ztq7H8qnmZOyzSV5iaNnhwIaEs/ORWSA1AYFrv5QBgSWYgP4q4txbZUHVwAyIUFWFgFaLt5Fg== 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 DM8PR11MB5704.namprd11.prod.outlook.com (2603:10b6:8:23::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.32; Tue, 18 Oct 2022 13:18:18 +0000 Received: from DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::6fc4:1ff0:a5db:6546]) by DM4PR11MB5994.namprd11.prod.outlook.com ([fe80::6fc4:1ff0:a5db:6546%3]) with mapi id 15.20.5723.033; Tue, 18 Oct 2022 13:18:18 +0000 From: "Zhang, Qi Z" To: "Zhou, YidingX" , "dev@dpdk.org" CC: "Zhou, YidingX" , "stable@dpdk.org" Subject: RE: [PATCH v4] net/iavf: fix error of virtchnl command Thread-Topic: [PATCH v4] net/iavf: fix error of virtchnl command Thread-Index: AQHY3st6tjyrb0Gyk0qc7rfhOh8s4K4UKIbQ Date: Tue, 18 Oct 2022 13:18:18 +0000 Message-ID: References: <20220919060654.1092715-1-yidingx.zhou@intel.com> <20221013062017.96065-1-yidingx.zhou@intel.com> In-Reply-To: <20221013062017.96065-1-yidingx.zhou@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 dlp-product: dlpe-windows 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_|DM8PR11MB5704:EE_ x-ms-office365-filtering-correlation-id: c06f907d-139b-4500-14f7-08dab10b38ff x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1psSwgCcdoYxPsPn5fwHXxcyvlFW8ncyIG94VucbCFAWtmia8ZhN3u9oZCbYV3Jw0o+vJIIcopBub/x+7Z3KzuXg/QCBs0Roh7NZPTbsR9WhW1TfTmFmy+qOCR731bj9bOL8AhIvqfF/uXlgad+C1e2mIO7dVWln5MWDDmTfGExBOlX1QBVki/yvYQREwhDous4LWtvXwuEEH53+iY/414bu0not+I+qbNmRmcTmfz2b2d7+GGW6nfUq03+NLjVOOSWQRwek5eemSDcIn//YW+vcTKLNYBgrp1b7jB3pNR/C7D/6u41s9kwO3uf/oHNAV6lRwU3LydJIxhE8t8emXLGkgT2Qz9t+QdApGo0KOlBcZrBlR8CcSapfmlBgUIrvYuoG9OAM4KLydfgDa4ZNFWIkzcIO/ps0SEB+U1KTRqaMFG06kD1OkDRxgiyL2AhCpgy+hnIS4CIqWiDQVitDLIBtVGc8L5DIE1zVnuI2Jg+h+DE8i3rrW1BEX0a5yih99DZ5SGeSc98Jq4JZ7VT55b1teGkglAkiROcW9Yh0wVgCaIV2t4VG+Ai4yyO04nn5a6Fvv93viruo8kjHl+rEtyCtuUmB5mwoHPGiQjn7+ExhlUaaVeZegkIgokVM5YpN/qTPbVSSIXFMP+vgjng3Pe7X974RoHbuZwXLus+cKwoImq48fQbTG3/xQJ/lTKVGtW6Ihm+Y0wDBseikgjiIMXUPbgQTG3W7ZZsbsaIlqunpMVLJw2NSwqT4kb7k6KE53UIkezDHMpO/pEwmdPh8bw== 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:(13230022)(346002)(376002)(366004)(396003)(39850400004)(136003)(451199015)(54906003)(53546011)(186003)(38070700005)(83380400001)(86362001)(5660300002)(82960400001)(38100700002)(122000001)(2906002)(450100002)(4326008)(52536014)(64756008)(55016003)(8936002)(8676002)(478600001)(26005)(9686003)(7696005)(6506007)(316002)(66446008)(66476007)(66556008)(66946007)(76116006)(41300700001)(71200400001)(110136005)(33656002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?xkdTwe4SKVohbxj3x2b8s9i0wQXdvZDk6HetZCBU5oi26Rrk9uldtM+u1Aoe?= =?us-ascii?Q?dOVnPy9T2dphkdNldoh7g0JuTV6+Z8B7XjkJtCN5Bd5YV6TRpCgg5dAZOHSC?= =?us-ascii?Q?VIeAiCCJ+IKbiE8nepGT+U1H3mQHyYJ05B5SS2ULrA6hTRWQCsgKXmvRwtnL?= =?us-ascii?Q?IWWgikQ555btDM216KlWoa3VSWiRdkC++LlzlexAOtDOcfIdHKpGJjlKNhNI?= =?us-ascii?Q?m+zPJaGxnX6DWkQYUkrlmQrnquRRnkP/W3ajboUXriXf0pGJ7VFKln/ZEHYZ?= =?us-ascii?Q?Ry1TcwKC0oVLzNdSoeFSjY7tRKGY0oC6v1hUHylbVpC7fYPb4gP9eQFch/9E?= =?us-ascii?Q?WM+y8eHqjy0H31E8MA3nqddYSKNyNE153OHhaSd7dUPJ9vTdQmxwi9wqLPav?= =?us-ascii?Q?pwzA5rLZFhBgdmx8zK6J+ih8NQJ1bUidaRv3g0O2BvCcqHZYz1W8WYwhnKoX?= =?us-ascii?Q?/v3FgqSPG04oWvWtPaVWwtVpzj6Nihux+cJte1ssWsHkon5ivxcgk57dHpVJ?= =?us-ascii?Q?V9vs8i+cKVp/jcP/pOSgypPi5AzYfs1Jm8ThLBawrHuTJwx6/bO6jaRQcj/Z?= =?us-ascii?Q?u3TOyiHAW/bsDWeTMgU3gkDoZIHKXLF8Hr1y5isIqgX5nccnIRe4HIyPSdhH?= =?us-ascii?Q?4UR8OBrhbVXBX1ISyrxRUq5MML7i3HvwqoKyBIsByg3uFF9+HxMsG5/ZXdRv?= =?us-ascii?Q?ned0i86/x0M/6RpxxGdhxGT9nj1/oWI5c6axLdlAd/UP49Oh0Bx4TI+k0ktZ?= =?us-ascii?Q?dDwqXcsXI1oV3V0uQQ0Td7Fs7x8Wrhe7hVuo9ALy57EqS3io7ouJeWdtiSiW?= =?us-ascii?Q?KrrjZF0Px6vHileeojnnfIzrO3UQ0Czu1suXtY3uSzMLyC0q3tv5Rpic/3ni?= =?us-ascii?Q?C1955KvNSQ7LPhO16n2f5WW/xiKqDG898ZDYUoL/Q3CUGCEbJgcNDKvvw0A1?= =?us-ascii?Q?qsP3l/mfIu4mOiS5QjEOJXA5fE+/0LcyEloegEtc9O5vEcoD5D9e/f+eoBer?= =?us-ascii?Q?36ay3nETMr50aOUy6iJWzhjYsao4Yxqyv6RQjsNlrMl3PHjn0R2qegrYczQV?= =?us-ascii?Q?n4jT41rOCzaNoWnerA3d9Hd4MxyxM9EOp33j/1X695z5YlT4IkMJIFGOKcZc?= =?us-ascii?Q?pOMTEwMpiHZkdn9/a3q/Pfo7NLBwEfHi7BPBjZ/Y6Z4AvgZQgdNBhm89LNHt?= =?us-ascii?Q?R3QdXF6cGeTIljTp8rSdR3Zbn2ovBrAI+9lHMV6/hdT5FQRvVDp1n4KujoO5?= =?us-ascii?Q?9riK42mgw0i6Tnup7tXNTi2uRxV6Xcfpes2iTVER68bfuJy4nFIrBkUcxJp1?= =?us-ascii?Q?U9ZBXt3A77FvxZQyKCuvHHjSc+Jhu+zlW3LG6DQ5/C5CGlVlVIPFHNovqhDj?= =?us-ascii?Q?DRXNH+/mFJXm3dj688XYZQw0BXDSmti4biwsH9BVIN8GDg6gjo/46usm2m2H?= =?us-ascii?Q?89xYlYPQCRP5VtDp+v29PHqOuaZgKXDX4n3YVqZHReppzJUhfSY3DmuBS59Z?= =?us-ascii?Q?Fz3WCuhecxIG02gKa8znPtwgiG4++/Cp0dEZcyBxYnX5t4z2E8j0MjRR8Hgu?= =?us-ascii?Q?ZofO0yQs74Zeo5EDxzMHKZNUaCaZe1mVEgDDF9YJ?= 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: c06f907d-139b-4500-14f7-08dab10b38ff X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Oct 2022 13:18:18.4719 (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: ZyXjl83SUw9vB04+QWTkjRYBoeua5VGf9gt1yETpI4yOynGmPrPOBcTsOxqzEZEX2yy+77CPTSn37P2mrXZCYg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR11MB5704 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Yiding Zhou > Sent: Thursday, October 13, 2022 2:20 PM > To: dev@dpdk.org > Cc: Zhou, YidingX ; stable@dpdk.org > Subject: [PATCH v4] net/iavf: fix error of virtchnl command >=20 > When the device is bonded, bond pmd will register callback for LSC event. > This callback will execute some virtchnl commands in eal-intr-thread to > reinitialize the device with interrupts disabled. In this case, responses= to all > commands not be received. Can we reword this commit log a little bit? I think first of all, the patch is about code refactor, it separate all eth= erdev event notification from interrupt handler thread to a separated threa= d.=20 Secondary, it also fixed the problem in bond. >=20 > This commit starts a thread to handle all events to fix this issue. >=20 > Fixes: 48de41ca11f0 ("net/avf: enable link status update") > CC: stable@dpdk.org >=20 > Signed-off-by: Yiding Zhou > --- > v4: add 'reset' and 'ipsec' event handling > v3: fix CI errors > --- > drivers/net/iavf/iavf.h | 2 + > drivers/net/iavf/iavf_ethdev.c | 5 ++ > drivers/net/iavf/iavf_vchnl.c | 152 +++++++++++++++++++++++++++++++-- > 3 files changed, 153 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index > 26b858f6f0..1edebab8dc 100644 > --- a/drivers/net/iavf/iavf.h > +++ b/drivers/net/iavf/iavf.h > @@ -424,6 +424,8 @@ _atomic_set_async_response_cmd(struct iavf_info > *vf, enum virtchnl_ops ops) } int iavf_check_api_version(struct iavf_ad= apter > *adapter); int iavf_get_vf_resource(struct iavf_adapter *adapter); > +void iavf_dev_event_handler_fini(void); > +int iavf_dev_event_handler_init(void); > void iavf_handle_virtchnl_msg(struct rte_eth_dev *dev); int > iavf_enable_vlan_strip(struct iavf_adapter *adapter); int > iavf_disable_vlan_strip(struct iavf_adapter *adapter); diff --git > a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index > 782be82c7f..633d684804 100644 > --- a/drivers/net/iavf/iavf_ethdev.c > +++ b/drivers/net/iavf/iavf_ethdev.c > @@ -2631,6 +2631,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) > rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, > ð_dev->data->mac_addrs[0]); >=20 > + if (iavf_dev_event_handler_init()) > + goto init_vf_err; > + > if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) > { > /* register callback func to eal lib */ > rte_intr_callback_register(pci_dev->intr_handle, > @@ -2785,6 +2788,8 @@ iavf_dev_uninit(struct rte_eth_dev *dev) >=20 > iavf_dev_close(dev); >=20 > + iavf_dev_event_handler_fini(); > + > return 0; > } >=20 > diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.= c index > 4327c5a786..43e18ca5f7 100644 > --- a/drivers/net/iavf/iavf_vchnl.c > +++ b/drivers/net/iavf/iavf_vchnl.c > @@ -2,6 +2,7 @@ > * Copyright(c) 2017 Intel Corporation > */ >=20 > +#include > #include > #include > #include > @@ -11,6 +12,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > @@ -27,6 +29,145 @@ > #define MAX_TRY_TIMES 2000 > #define ASQ_DELAY_MS 1 >=20 > +#define MAX_EVENT_PENDING 16 > + > +struct iavf_event_element { > + TAILQ_ENTRY(iavf_event_element) next; > + struct rte_eth_dev *dev; > + enum rte_eth_event_type event; > + void *param; > + size_t param_alloc_size; > + uint8_t param_alloc_data[0]; > +}; > + > +struct iavf_event_handler { > + uint32_t ndev; > + pthread_t tid; > + int fd[2]; > + pthread_mutex_t lock; > + TAILQ_HEAD(event_lsit, iavf_event_element) pending; }; > + > +static struct iavf_event_handler event_handler =3D { > + .fd =3D {-1, -1}, > +}; > + > +#ifndef TAILQ_FOREACH_SAFE > +#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ > + for ((var) =3D TAILQ_FIRST((head)); \ > + (var) && ((tvar) =3D TAILQ_NEXT((var), field), 1); \ > + (var) =3D (tvar)) > +#endif > + > +static void * > +iavf_dev_event_handle(void *param __rte_unused) { > + struct iavf_event_handler *handler =3D &event_handler; > + TAILQ_HEAD(event_list, iavf_event_element) pending; > + > + while (true) { > + char unused[MAX_EVENT_PENDING]; > + ssize_t nr =3D read(handler->fd[0], &unused, sizeof(unused)); > + if (nr <=3D 0) > + break; > + > + TAILQ_INIT(&pending); > + pthread_mutex_lock(&handler->lock); > + TAILQ_CONCAT(&pending, &handler->pending, next); > + pthread_mutex_unlock(&handler->lock); > + > + struct iavf_event_element *pos, *save_next; > + TAILQ_FOREACH_SAFE(pos, &pending, next, save_next) { > + TAILQ_REMOVE(&pending, pos, next); > + rte_eth_dev_callback_process(pos->dev, pos->event, > pos->param); > + rte_free(pos); > + } > + } > + return NULL; > +} > + > +static void > +iavf_dev_event_post(struct rte_eth_dev *dev, > + enum rte_eth_event_type event, > + void *param, size_t param_alloc_size) { > + struct iavf_event_handler *handler =3D &event_handler; > + char notify_byte; > + struct iavf_event_element *elem =3D rte_malloc(NULL, sizeof(*elem) + > param_alloc_size, 0); > + if (!elem) > + return; > + > + elem->dev =3D dev; > + elem->event =3D event; > + elem->param =3D param; > + elem->param_alloc_size =3D param_alloc_size; > + if (param && param_alloc_size) { > + rte_memcpy(elem->param_alloc_data, param, > param_alloc_size); > + elem->param =3D elem->param_alloc_data; > + } > + > + pthread_mutex_lock(&handler->lock); > + TAILQ_INSERT_TAIL(&handler->pending, elem, next); > + pthread_mutex_unlock(&handler->lock); > + > + ssize_t nw =3D write(handler->fd[1], ¬ify_byte, 1); > + RTE_SET_USED(nw); > +} > + > +int > +iavf_dev_event_handler_init(void) > +{ > + struct iavf_event_handler *handler =3D &event_handler; > + > + if (__atomic_add_fetch(&handler->ndev, 1, __ATOMIC_RELAXED) !=3D > 1) > + return 0; > +#if defined(RTE_EXEC_ENV_IS_WINDOWS) && > RTE_EXEC_ENV_IS_WINDOWS !=3D 0 > + int err =3D _pipe(handler->fd, MAX_EVENT_PENDING, O_BINARY); #else > + int err =3D pipe(handler->fd); > +#endif > + if (err !=3D 0) { > + __atomic_sub_fetch(&handler->ndev, 1, > __ATOMIC_RELAXED); > + return -1; > + } > + > + TAILQ_INIT(&handler->pending); > + pthread_mutex_init(&handler->lock, NULL); > + > + if (rte_ctrl_thread_create(&handler->tid, "iavf-event-thread", > + NULL, iavf_dev_event_handle, NULL)) { > + __atomic_sub_fetch(&handler->ndev, 1, > __ATOMIC_RELAXED); > + return -1; > + } > + > + return 0; > +} > + > +void > +iavf_dev_event_handler_fini(void) > +{ > + struct iavf_event_handler *handler =3D &event_handler; > + > + if (__atomic_sub_fetch(&handler->ndev, 1, __ATOMIC_RELAXED) !=3D > 0) > + return; > + > + int unused =3D pthread_cancel(handler->tid); > + RTE_SET_USED(unused); > + close(handler->fd[0]); > + close(handler->fd[1]); > + handler->fd[0] =3D -1; > + handler->fd[1] =3D -1; > + > + pthread_join(handler->tid, NULL); > + pthread_mutex_destroy(&handler->lock); > + > + struct iavf_event_element *pos, *save_next; > + TAILQ_FOREACH_SAFE(pos, &handler->pending, next, save_next) { > + TAILQ_REMOVE(&handler->pending, pos, next); > + rte_free(pos); > + } > +} > + > static uint32_t > iavf_convert_link_speed(enum virtchnl_link_speed virt_link_speed) { @@ = - > 278,8 +419,8 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, > uint8_t *msg, > case VIRTCHNL_EVENT_RESET_IMPENDING: > PMD_DRV_LOG(DEBUG, > "VIRTCHNL_EVENT_RESET_IMPENDING event"); > vf->vf_reset =3D true; > - rte_eth_dev_callback_process(dev, > RTE_ETH_EVENT_INTR_RESET, > - NULL); > + iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET, > + NULL, 0); > break; > case VIRTCHNL_EVENT_LINK_CHANGE: > PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE > event"); @@ -293,7 +434,7 @@ iavf_handle_pf_event_msg(struct > rte_eth_dev *dev, uint8_t *msg, > vf->link_speed =3D iavf_convert_link_speed(speed); > } > iavf_dev_link_update(dev, 0); > - rte_eth_dev_callback_process(dev, > RTE_ETH_EVENT_INTR_LSC, NULL); > + iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_LSC, NULL, > 0); > break; > case VIRTCHNL_EVENT_PF_DRIVER_CLOSE: > PMD_DRV_LOG(DEBUG, > "VIRTCHNL_EVENT_PF_DRIVER_CLOSE event"); @@ -359,9 +500,8 @@ > iavf_handle_virtchnl_msg(struct rte_eth_dev *dev) > desc.subtype =3D >=20 > RTE_ETH_EVENT_IPSEC_UNKNOWN; > desc.metadata =3D ev- > >ipsec_event_data; > - rte_eth_dev_callback_process(dev, > - > RTE_ETH_EVENT_IPSEC, > - &desc); > + iavf_dev_event_post(dev, > RTE_ETH_EVENT_IPSEC, > + &desc, sizeof(desc)); > return; > } >=20 > -- > 2.34.1