[11/14] net/mlx5: provide IB port for the object being created

Message ID 1553155888-27498-12-git-send-email-viacheslavo@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Shahaf Shuler
Headers
Series net/mlx5: add support for multiport IB devices |

Checks

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

Commit Message

Slava Ovsiienko March 21, 2019, 8:11 a.m. UTC
  The code is updated to provide IB port index for the Verbs
objects being created - QP and Verbs Flows.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c       | 2 ++
 drivers/net/mlx5/mlx5_flow_verbs.c | 1 +
 drivers/net/mlx5/mlx5_txq.c        | 4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
  

Comments

Shahaf Shuler March 21, 2019, 12:15 p.m. UTC | #1
Thursday, March 21, 2019 10:11 AM, Viacheslav Ovsiienko:
> Subject: [PATCH 11/14] net/mlx5: provide IB port for the object being
> created
> 
> The code is updated to provide IB port index for the Verbs objects being
> created - QP and Verbs Flows.
> 
> Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

Acked-by: Shahaf Shuler <shahafs@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5_flow.c       | 2 ++
>  drivers/net/mlx5/mlx5_flow_verbs.c | 1 +
>  drivers/net/mlx5/mlx5_txq.c        | 4 ++--
>  3 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 010d61a..40d6818 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -315,6 +315,7 @@ struct mlx5_flow_tunnel_info {  int
> mlx5_flow_discover_priorities(struct rte_eth_dev *dev)  {
> +	struct mlx5_priv *priv = dev->data->dev_private;
>  	struct {
>  		struct ibv_flow_attr attr;
>  		struct ibv_flow_spec_eth eth;
> @@ -322,6 +323,7 @@ struct mlx5_flow_tunnel_info {
>  	} flow_attr = {
>  		.attr = {
>  			.num_of_specs = 2,
> +			.port = (uint8_t)priv->ibv_port,
>  		},
>  		.eth = {
>  			.type = IBV_FLOW_SPEC_ETH,
> diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c
> b/drivers/net/mlx5/mlx5_flow_verbs.c
> index 9548d12..b69af6c 100644
> --- a/drivers/net/mlx5/mlx5_flow_verbs.c
> +++ b/drivers/net/mlx5/mlx5_flow_verbs.c
> @@ -1550,6 +1550,7 @@
>  	dev_flow->layers = item_flags;
>  	dev_flow->verbs.attr->priority =
>  		mlx5_flow_adjust_priority(dev, priority, subpriority);
> +	dev_flow->verbs.attr->port = (uint8_t)priv->ibv_port;
>  	return 0;
>  }
> 
> diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
> index 25305b6..5062f5c 100644
> --- a/drivers/net/mlx5/mlx5_txq.c
> +++ b/drivers/net/mlx5/mlx5_txq.c
> @@ -445,8 +445,8 @@ struct mlx5_txq_ibv *
>  	attr.mod = (struct ibv_qp_attr){
>  		/* Move the QP to this state. */
>  		.qp_state = IBV_QPS_INIT,
> -		/* Primary port number. */
> -		.port_num = 1,
> +		/* IB device port number. */
> +		.port_num = (uint8_t)priv->ibv_port,
>  	};
>  	ret = mlx5_glue->modify_qp(tmpl.qp, &attr.mod,
>  				   (IBV_QP_STATE | IBV_QP_PORT));
> --
> 1.8.3.1
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 010d61a..40d6818 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -315,6 +315,7 @@  struct mlx5_flow_tunnel_info {
 int
 mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
 {
+	struct mlx5_priv *priv = dev->data->dev_private;
 	struct {
 		struct ibv_flow_attr attr;
 		struct ibv_flow_spec_eth eth;
@@ -322,6 +323,7 @@  struct mlx5_flow_tunnel_info {
 	} flow_attr = {
 		.attr = {
 			.num_of_specs = 2,
+			.port = (uint8_t)priv->ibv_port,
 		},
 		.eth = {
 			.type = IBV_FLOW_SPEC_ETH,
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 9548d12..b69af6c 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1550,6 +1550,7 @@ 
 	dev_flow->layers = item_flags;
 	dev_flow->verbs.attr->priority =
 		mlx5_flow_adjust_priority(dev, priority, subpriority);
+	dev_flow->verbs.attr->port = (uint8_t)priv->ibv_port;
 	return 0;
 }
 
diff --git a/drivers/net/mlx5/mlx5_txq.c b/drivers/net/mlx5/mlx5_txq.c
index 25305b6..5062f5c 100644
--- a/drivers/net/mlx5/mlx5_txq.c
+++ b/drivers/net/mlx5/mlx5_txq.c
@@ -445,8 +445,8 @@  struct mlx5_txq_ibv *
 	attr.mod = (struct ibv_qp_attr){
 		/* Move the QP to this state. */
 		.qp_state = IBV_QPS_INIT,
-		/* Primary port number. */
-		.port_num = 1,
+		/* IB device port number. */
+		.port_num = (uint8_t)priv->ibv_port,
 	};
 	ret = mlx5_glue->modify_qp(tmpl.qp, &attr.mod,
 				   (IBV_QP_STATE | IBV_QP_PORT));