From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84466A00BE; Fri, 12 Jun 2020 07:56:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CEC9B1B91B; Fri, 12 Jun 2020 07:56:12 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7E1121B3BB; Fri, 12 Jun 2020 07:56:10 +0200 (CEST) IronPort-SDR: lKyYPUt+BGaYl/qwkqihn+LnImx7aKuCDqgtUBF2AqjV0VDG1fIZY/M2SzSynvomWVchwU5x28 26W8o2APrVHw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 22:56:09 -0700 IronPort-SDR: 80n8xLcL1KuHJ71Dgk/IK5thgRIhR2otN7UDgw9DQWRnahkcSs+Q3GZ21h+UgGXnQ5+Qc8aeZm S9nTo5+uThOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,502,1583222400"; d="scan'208";a="419361006" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.116]) ([10.67.68.116]) by orsmga004.jf.intel.com with ESMTP; 11 Jun 2020 22:56:06 -0700 To: wangyunjian , dev@dpdk.org Cc: jerry.lilijun@huawei.com, xudingke@huawei.com, stable@dpdk.org References: From: Jeff Guo Message-ID: <515b5d64-b43b-14c0-4f73-0818fc7340b9@intel.com> Date: Fri, 12 Jun 2020 13:56:05 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH 2/3] eal: fix remove incorrect event_cb X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" hi, yunjian On 6/3/2020 8:55 PM, wangyunjian wrote: > From: Yunjian Wang > > When the device_name is NULL, it will remove the event_cb directly. > We need to compare the 'cb_fn' and 'cb_arg' at the same time. > > Fixes: a753e53d517b ("eal: add device event monitor framework") > Cc: stable@dpdk.org > > Signed-off-by: Yunjian Wang > --- > lib/librte_eal/common/eal_common_dev.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c > index 4cfdb80..6b465bc 100644 > --- a/lib/librte_eal/common/eal_common_dev.c > +++ b/lib/librte_eal/common/eal_common_dev.c > @@ -516,7 +516,12 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name) > event_cb->cb_arg != cb_arg)) > continue; > } > - } else if (device_name != NULL) { > + } else if (device_name == NULL && event_cb->dev_name == NULL) { > + if (event_cb->cb_fn != cb_fn || > + (cb_arg != (void *)-1 && > + event_cb->cb_arg != cb_arg)) > + continue; > + } else { If we expect flush all event_cb when device_name is NULL, why we should check the cb_fn and cb_arg? > continue; > } >