From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BED1CA0C41;
	Tue, 19 Oct 2021 23:28:01 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 81EC0410F1;
	Tue, 19 Oct 2021 23:28:01 +0200 (CEST)
Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com
 [209.85.208.172])
 by mails.dpdk.org (Postfix) with ESMTP id 2F0E240142
 for <dev@dpdk.org>; Tue, 19 Oct 2021 23:28:00 +0200 (CEST)
Received: by mail-lj1-f172.google.com with SMTP id l5so8596416lja.13
 for <dev@dpdk.org>; Tue, 19 Oct 2021 14:28:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=hAxB6/3MBo4GkipvQXp0ZiZtDFyJKmtiP21nPmm45h0=;
 b=J2spbFfts4F7Y3wVZqw4676FtP+s6GrYZyffDL7MofwHNfEo7uM5uKDxCeyH+Qqn7A
 m4949FFo7nj+bZjWupHg6Fpbu4vKeEKC0Re2LUvtmS8cTemU7uyIQePGwcZaXnvdF0jL
 NYcGteKubqH161JMcMpJ+5m/Y0Lpklkpm9EDQpxFCQ6tju40uAutMTYQeqQvKUWVI4qI
 KK92c3X3SAZlUI1/Ne5vUvu3tkGUg081aTtFBrB4LZ0US3WoJ/hRRrblaN4AZZdPqyrQ
 B7D16nxI9i8Is+9ORHSV13VJ9a8tMplj3SA+tdIts9/9w6HLlYHmCbi+oN2F/GCDrNH7
 Tu4A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=hAxB6/3MBo4GkipvQXp0ZiZtDFyJKmtiP21nPmm45h0=;
 b=R6eQaNfIcYdlyssLQnbCCmVXyA22ciqlnzYz2dfMsiWy3tpuL1omA6SLTRFRZYUJGR
 gMKnmJLWBHAhwInMu897CA/pZd1o1v32eUJflrhbwm70XtePuG4x6DXu2HHDxm7L47l4
 c1/pDwTqZuJPtSYmR6/MvrTkaujG5m6BrkR28YNUccL5NIaFRyxoCp7B60S9gsquydJQ
 /FwKzvSDVmsiv5mlyU0bsYivffkMR3Ghdr+396GN/ENhzN/qjWd5HWYrhB13ISwaqokt
 gOc5VOc8wNSHAbW7UN377mQboAM9YKvOhi5HWBieWwDFMCnHVbvFTmFllyqGGhE888Vi
 +RLg==
X-Gm-Message-State: AOAM532BMzvxs34CKgEnxOWbTFPL3xfM4vALo0WltFcAc5cJvxPepHsx
 owk9eFSQy4E4EGgvjDMPbno=
X-Google-Smtp-Source: ABdhPJyl9WnEXqhj7w6fHq3x7F905GqvWDb7UFiGdEnRJ4woR8GqR5QGaPqjZ/YcCsnQQCX4pXSRNQ==
X-Received: by 2002:a05:651c:17a5:: with SMTP id
 bn37mr9159474ljb.514.1634678879741; 
 Tue, 19 Oct 2021 14:27:59 -0700 (PDT)
Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru.
 [37.110.65.23])
 by smtp.gmail.com with ESMTPSA id u15sm18213ljo.132.2021.10.19.14.27.59
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 19 Oct 2021 14:27:59 -0700 (PDT)
Date: Wed, 20 Oct 2021 00:27:58 +0300
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>, Bruce Richardson <bruce.richardson@intel.com>,
 <david.marchand@redhat.com>, <mdr@ashroe.eu>, <thomas@monjalon.net>
Message-ID: <20211020002758.47063c5a@sovereign>
In-Reply-To: <20211019183543.132084-4-hkalra@marvell.com>
References: <20210826145726.102081-1-hkalra@marvell.com>
 <20211019183543.132084-1-hkalra@marvell.com>
 <20211019183543.132084-4-hkalra@marvell.com>
X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v4 3/7] eal/interrupts: avoid direct access
 to interrupt handle
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

2021-10-20 00:05 (UTC+0530), Harman Kalra:
> Making changes to the interrupt framework to use interrupt handle
> APIs to get/set any field. Direct access to any of the fields
> should be avoided to avoid any ABI breakage in future.

I get and accept the point why EAL also should use the API.
However, mentioning ABI is still a wrong wording.
There is no ABI between EAL structures and EAL functions by definition of ABI.

> 
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
> ---
>  lib/eal/freebsd/eal_interrupts.c |  92 ++++++----
>  lib/eal/linux/eal_interrupts.c   | 287 +++++++++++++++++++------------
>  2 files changed, 234 insertions(+), 145 deletions(-)
> 
> diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c
[...]
> @@ -135,9 +137,18 @@ rte_intr_callback_register(const struct rte_intr_handle *intr_handle,
>  				ret = -ENOMEM;
>  				goto fail;
>  			} else {
> -				src->intr_handle = *intr_handle;
> -				TAILQ_INIT(&src->callbacks);
> -				TAILQ_INSERT_TAIL(&intr_sources, src, next);
> +				src->intr_handle = rte_intr_instance_alloc();
> +				if (src->intr_handle == NULL) {
> +					RTE_LOG(ERR, EAL, "Can not create intr instance\n");
> +					free(callback);
> +					ret = -ENOMEM;

goto fail?

> +				} else {
> +					rte_intr_instance_copy(src->intr_handle,
> +							       intr_handle);
> +					TAILQ_INIT(&src->callbacks);
> +					TAILQ_INSERT_TAIL(&intr_sources, src,
> +							  next);
> +				}
>  			}
>  		}
>  
[...]
> @@ -213,7 +226,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle,
>  	struct rte_intr_callback *cb, *next;
>  
>  	/* do parameter checking first */
> -	if (intr_handle == NULL || intr_handle->fd < 0) {
> +	if (intr_handle == NULL || rte_intr_fd_get(intr_handle) < 0) {

The handle is checked for NULL inside the accessor, here and in other places:
grep -R 'intr_handle == NULL ||' lib/eal

>  		RTE_LOG(ERR, EAL,
>  		"Unregistering with invalid input parameter\n");
>  		return -EINVAL;

> diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c
[...]