DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison
@ 2020-05-04  7:12 Matan Azrad
  2020-05-04  9:15 ` Maxime Coquelin
  2020-05-04 10:05 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Matan Azrad @ 2020-05-04  7:12 UTC (permalink / raw)
  To: dev; +Cc: Viacheslav Ovsiienko, Maxime Coquelin, stable

A regular memcmp function was used to compare between two objects of
type `struct rte_pci_addr`.

Due to the alignment rules of compiler structure builders, some memory
is not initiated in the structure even though all the fields were
initiated.

Therefore, the comparison may fail even though the PCI addresses are
identical and to cause false failure in probe.

Use the dedicated API to compare 2 PCI addresses.

Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
Tested-by: Noa Ezra <noae@mellanox.com>
---
 drivers/vdpa/mlx5/mlx5_vdpa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c
index 9f7353d..1113d6c 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa.c
@@ -305,7 +305,7 @@
 		DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name);
 		if (mlx5_dev_to_pci_addr(ibv_list[n]->ibdev_path, &pci_addr))
 			continue;
-		if (memcmp(addr, &pci_addr, sizeof(pci_addr)))
+		if (rte_pci_addr_cmp(addr, &pci_addr))
 			continue;
 		ibv_match = ibv_list[n];
 		break;
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison
  2020-05-04  7:12 [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison Matan Azrad
@ 2020-05-04  9:15 ` Maxime Coquelin
  2020-05-04 10:05 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-05-04  9:15 UTC (permalink / raw)
  To: Matan Azrad, dev; +Cc: Viacheslav Ovsiienko, stable



On 5/4/20 9:12 AM, Matan Azrad wrote:
> A regular memcmp function was used to compare between two objects of
> type `struct rte_pci_addr`.
> 
> Due to the alignment rules of compiler structure builders, some memory
> is not initiated in the structure even though all the fields were
> initiated.
> 
> Therefore, the comparison may fail even though the PCI addresses are
> identical and to cause false failure in probe.
> 
> Use the dedicated API to compare 2 PCI addresses.
> 
> Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Tested-by: Noa Ezra <noae@mellanox.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison
  2020-05-04  7:12 [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison Matan Azrad
  2020-05-04  9:15 ` Maxime Coquelin
@ 2020-05-04 10:05 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2020-05-04 10:05 UTC (permalink / raw)
  To: Matan Azrad, dev; +Cc: Viacheslav Ovsiienko, stable



On 5/4/20 9:12 AM, Matan Azrad wrote:
> A regular memcmp function was used to compare between two objects of
> type `struct rte_pci_addr`.
> 
> Due to the alignment rules of compiler structure builders, some memory
> is not initiated in the structure even though all the fields were
> initiated.
> 
> Therefore, the comparison may fail even though the PCI addresses are
> identical and to cause false failure in probe.
> 
> Use the dedicated API to compare 2 PCI addresses.
> 
> Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Matan Azrad <matan@mellanox.com>
> Tested-by: Noa Ezra <noae@mellanox.com>
> ---
>  drivers/vdpa/mlx5/mlx5_vdpa.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-04 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-04  7:12 [dpdk-dev] [PATCH] vdpa/mlx5: fix PCI address comparison Matan Azrad
2020-05-04  9:15 ` Maxime Coquelin
2020-05-04 10:05 ` Maxime Coquelin

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git