[v4,10/10] net/mlx5: support negative identifiers for port representors

Message ID 20180705083934.5535-11-adrien.mazarguil@6wind.com (mailing list archive)
State Superseded, archived
Headers
Series net/mlx5: add port representor support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Adrien Mazarguil July 5, 2018, 8:45 a.m. UTC
  This patch brings support for BlueField representors.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Cc: Shahaf Shuler <shahafs@mellanox.com>
--
v3 changes:

- This patch was not present in prior revisions.
---
 drivers/net/mlx5/mlx5.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Shahaf Shuler July 9, 2018, 11:58 a.m. UTC | #1
Adrien, thank for this patch.

Thursday, July 5, 2018 11:46 AM, Adrien Mazarguil:
> Subject: [PATCH v4 10/10] net/mlx5: support negative identifiers for port
> representors
> 
> This patch brings support for BlueField representors.
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> Cc: Shahaf Shuler <shahafs@mellanox.com>
> --
> v3 changes:
> 
> - This patch was not present in prior revisions.
> ---
>  drivers/net/mlx5/mlx5.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> 12a77afa8..df7f39844 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -1330,6 +1330,14 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> __rte_unused,
>  			memset(&list[i].info, 0, sizeof(list[i].info));
>  			continue;
>  		}
> +		/*
> +		 * Port representors not associated with any VFs (e.g. on
> +		 * BlueField devices) report -1 as a port identifier.
> +		 * Quietly set it to zero since DPDK only supports positive
> +		 * values.
> +		 */

I am waiting for the final answer from the BlueField team about the way they are going to enum the BlueField representors. 
In case it will be the same as x86 I think we can drop this patch, otherwise use it, agree?

> +		if (list[i].info.representor && list[i].info.port_name == -1)
> +			list[i].info.port_name = 0;
>  	}
>  	if (nl_rdma >= 0)
>  		close(nl_rdma);
> --
> 2.11.0
  
Adrien Mazarguil July 10, 2018, 9:37 a.m. UTC | #2
On Mon, Jul 09, 2018 at 11:58:05AM +0000, Shahaf Shuler wrote:
> Adrien, thank for this patch.
> 
> Thursday, July 5, 2018 11:46 AM, Adrien Mazarguil:
> > Subject: [PATCH v4 10/10] net/mlx5: support negative identifiers for port
> > representors
> > 
> > This patch brings support for BlueField representors.
> > 
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> > Cc: Shahaf Shuler <shahafs@mellanox.com>
> > --
> > v3 changes:
> > 
> > - This patch was not present in prior revisions.
> > ---
> >  drivers/net/mlx5/mlx5.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index
> > 12a77afa8..df7f39844 100644
> > --- a/drivers/net/mlx5/mlx5.c
> > +++ b/drivers/net/mlx5/mlx5.c
> > @@ -1330,6 +1330,14 @@ mlx5_pci_probe(struct rte_pci_driver *pci_drv
> > __rte_unused,
> >  			memset(&list[i].info, 0, sizeof(list[i].info));
> >  			continue;
> >  		}
> > +		/*
> > +		 * Port representors not associated with any VFs (e.g. on
> > +		 * BlueField devices) report -1 as a port identifier.
> > +		 * Quietly set it to zero since DPDK only supports positive
> > +		 * values.
> > +		 */
> 
> I am waiting for the final answer from the BlueField team about the way they are going to enum the BlueField representors. 
> In case it will be the same as x86 I think we can drop this patch, otherwise use it, agree?

No problem.

Note this patch is also based on the assumption that there's only one such
device, but I couldn't verify it.
  

Patch

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 12a77afa8..df7f39844 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1330,6 +1330,14 @@  mlx5_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 			memset(&list[i].info, 0, sizeof(list[i].info));
 			continue;
 		}
+		/*
+		 * Port representors not associated with any VFs (e.g. on
+		 * BlueField devices) report -1 as a port identifier.
+		 * Quietly set it to zero since DPDK only supports positive
+		 * values.
+		 */
+		if (list[i].info.representor && list[i].info.port_name == -1)
+			list[i].info.port_name = 0;
 	}
 	if (nl_rdma >= 0)
 		close(nl_rdma);