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 6CFA845540;
	Tue,  2 Jul 2024 00:00:42 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 574554029F;
	Tue,  2 Jul 2024 00:00:42 +0200 (CEST)
Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com
 [209.85.210.42]) by mails.dpdk.org (Postfix) with ESMTP id 79FB540289
 for <dev@dpdk.org>; Tue,  2 Jul 2024 00:00:40 +0200 (CEST)
Received: by mail-ot1-f42.google.com with SMTP id
 46e09a7af769-700cb05c118so1736766a34.2
 for <dev@dpdk.org>; Mon, 01 Jul 2024 15:00:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1719871239;
 x=1720476039; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:from:to:cc:subject:date
 :message-id:reply-to;
 bh=CCtaFZSArZHJuAtLO0uOxFQod2VB3HXAqqiwJjBxgXo=;
 b=2BBpovXOiulWUsEBPKydGrYLKfTdUdycZX2XRNjMQEfRBBR+LLH6EBu1/SM+0oZx/E
 frj5SNZBFheMpVxYexrSl/CZ9i1KpcCHW6YsSvqPzpxVErrEG+UbDBhCeMsMAR/fDl2T
 4NaAsnCGh04iZ1tFWc8sXyl/7TZ+ynYk60cS9Pk0pvys5VzLcBpRhuuDoD3Xp2/7DMmA
 OVa8Aicn/bIEqGzAkNOL92P/9zeIctKmR/sdXJQW+DTD8WYmY4luM8ID6RH8Ox5E7XMI
 zjuKVO9MsEcMR355kGKEezypUtirCwk7mTJTHX/yVSU9O9P2zLJcdSG7Xgv4EKhdywU2
 j4Iw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1719871239; x=1720476039;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=CCtaFZSArZHJuAtLO0uOxFQod2VB3HXAqqiwJjBxgXo=;
 b=h4+nnXvPE398uI0koV+01bkgSk/y8XR8Tob231/MZ3blCl7lURk+L6RZXM2nOeSJ4a
 1HjCpXAWk2+r0ffhdOos1G1TQBwakaF2sljzg2YbYlhCeotlu2vccIe5gW6smUE2or15
 AjRfZKWV3Xl09wUO988pY2mcjmVCMUh13lSNjsbJp5RTY5QdWWhR/6N/dPasIrSc2Pa5
 bVsdCftwysoBFe3p7HevDoWDvXkDrfSgkKSQHONpaCHDWL79Nm0QVfsHce5Cgd7zuLPe
 5DBX1jHS048MfM/LaVLjpD8u+R1Lq/S9prwDnIeilCxz+aIm63hDOGTXv1v5ZekhWXUA
 k9vA==
X-Gm-Message-State: AOJu0YxwahNBO4ahblLs+qrpPlfZYPFCodqAPZNitbejAvCj4NvnTDXF
 h56owgT2KeAnqGkimZL/Gg1s/xBKj8MeV/nypN3yY+gVpmh9e8gAJZWEa3J0570=
X-Google-Smtp-Source: AGHT+IFkxHEqzc7n9ypyLPPkwB2NC3CDkuKY3xNxfbLQ5pfFvmCEx1oLVo7CNI55LmW0fvTBXjGFrA==
X-Received: by 2002:a05:6870:d0c2:b0:259:8c82:999 with SMTP id
 586e51a60fabf-25db3443296mr7438270fac.25.1719871239434; 
 Mon, 01 Jul 2024 15:00:39 -0700 (PDT)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-70803ecf8cdsm7009125b3a.126.2024.07.01.15.00.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 01 Jul 2024 15:00:39 -0700 (PDT)
Date: Mon, 1 Jul 2024 15:00:36 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Shani Peretz <shperetz@nvidia.com>
Cc: <dev@dpdk.org>, <mkashani@nvidia.com>, <jblunck@infradead.org>, Dariusz
 Sosnowski <dsosnowski@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,
 Chenbo Xia <chenbox@nvidia.com>, Nipun Gupta <nipun.gupta@amd.com>, Tyler
 Retzlaff <roretzla@linux.microsoft.com>
Subject: Re: [PATCH] eal/common: fix inconsistent representation of PCI numbers
Message-ID: <20240701150036.200131e9@hermes.local>
In-Reply-To: <20240701200117.6349-1-shperetz@nvidia.com>
References: <20240701200117.6349-1-shperetz@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
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

On Mon, 1 Jul 2024 23:01:17 +0300
Shani Peretz <shperetz@nvidia.com> wrote:

> --- a/drivers/bus/pci/pci_common.c
> +++ b/drivers/bus/pci/pci_common.c
> @@ -501,6 +501,15 @@ rte_pci_dump(FILE *f)
>  		pci_dump_one_device(f, dev);
>  	}
>  }
> +static int
> +pci_cmp_name(const struct rte_device *dev1, const void *name2)

Blank line between functions please

> +{
> +	const struct rte_pci_device *dev = RTE_DEV_TO_PCI_CONST(dev1);
> +	char name2_addr[sizeof(struct rte_pci_addr)] = {0};

This should just be a rte_pci_addr type, not char.
And don't need to initialize it.

> +	dev1->bus->parse(name2, (void *)&name2_addr);

If it was the correct type, cast would not be needed.

> +
> +	return memcmp(&name2_addr, &(dev->addr), sizeof(struct rte_pci_addr));

Use existing rte_pci_addr_cmp()

> +}