[02/13] net/mlx5: query hca hairpin capabilities

Message ID 1569479349-36962-3-git-send-email-orika@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series add hairpin feature |

Checks

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

Commit Message

Ori Kam Sept. 26, 2019, 6:28 a.m. UTC
  This commit query and store the hairpin capabilities from the device.

Those capabilities will be used when creating the hairpin queue.

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5.h           | 4 ++++
 drivers/net/mlx5/mlx5_devx_cmds.c | 7 +++++++
 2 files changed, 11 insertions(+)
  

Comments

Slava Ovsiienko Sept. 26, 2019, 9:31 a.m. UTC | #1
> -----Original Message-----
> From: Ori Kam <orika@mellanox.com>
> Sent: Thursday, September 26, 2019 9:29
> To: Matan Azrad <matan@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; jingjing.wu@intel.com;
> stephen@networkplumber.org
> Subject: [PATCH 02/13] net/mlx5: query hca hairpin capabilities
> 
> This commit query and store the hairpin capabilities from the device.
> 
> Those capabilities will be used when creating the hairpin queue.
> 
> Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>

> ---
>  drivers/net/mlx5/mlx5.h           | 4 ++++
>  drivers/net/mlx5/mlx5_devx_cmds.c | 7 +++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index
> d4d2ca8..cd896c8 100644
> --- a/drivers/net/mlx5/mlx5.h
> +++ b/drivers/net/mlx5/mlx5.h
> @@ -184,6 +184,10 @@ struct mlx5_hca_attr {
>  	uint32_t tunnel_lro_vxlan:1;
>  	uint32_t lro_max_msg_sz_mode:2;
>  	uint32_t
> lro_timer_supported_periods[MLX5_LRO_NUM_SUPP_PERIODS];
> +	uint32_t hairpin:1;
> +	uint32_t log_max_hairpin_queues:5;
> +	uint32_t log_max_hairpin_wq_data_sz:5;
> +	uint32_t log_max_hairpin_num_packets:5;
>  };
> 
>  /* Flow list . */
> diff --git a/drivers/net/mlx5/mlx5_devx_cmds.c
> b/drivers/net/mlx5/mlx5_devx_cmds.c
> index acfe1de..b072c37 100644
> --- a/drivers/net/mlx5/mlx5_devx_cmds.c
> +++ b/drivers/net/mlx5/mlx5_devx_cmds.c
> @@ -327,6 +327,13 @@ struct mlx5_devx_obj *
>  	attr->flow_counters_dump = MLX5_GET(cmd_hca_cap, hcattr,
>  					    flow_counters_dump);
>  	attr->eswitch_manager = MLX5_GET(cmd_hca_cap, hcattr,
> eswitch_manager);
> +	attr->hairpin = MLX5_GET(cmd_hca_cap, hcattr, hairpin);
> +	attr->log_max_hairpin_queues = MLX5_GET(cmd_hca_cap, hcattr,
> +						log_max_hairpin_queues);
> +	attr->log_max_hairpin_wq_data_sz = MLX5_GET(cmd_hca_cap,
> hcattr,
> +
> log_max_hairpin_wq_data_sz);
> +	attr->log_max_hairpin_num_packets = MLX5_GET
> +		(cmd_hca_cap, hcattr, log_min_hairpin_wq_data_sz);
>  	attr->eth_net_offloads = MLX5_GET(cmd_hca_cap, hcattr,
>  					  eth_net_offloads);
>  	attr->eth_virt = MLX5_GET(cmd_hca_cap, hcattr, eth_virt);
> --
> 1.8.3.1
  

Patch

diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index d4d2ca8..cd896c8 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -184,6 +184,10 @@  struct mlx5_hca_attr {
 	uint32_t tunnel_lro_vxlan:1;
 	uint32_t lro_max_msg_sz_mode:2;
 	uint32_t lro_timer_supported_periods[MLX5_LRO_NUM_SUPP_PERIODS];
+	uint32_t hairpin:1;
+	uint32_t log_max_hairpin_queues:5;
+	uint32_t log_max_hairpin_wq_data_sz:5;
+	uint32_t log_max_hairpin_num_packets:5;
 };
 
 /* Flow list . */
diff --git a/drivers/net/mlx5/mlx5_devx_cmds.c b/drivers/net/mlx5/mlx5_devx_cmds.c
index acfe1de..b072c37 100644
--- a/drivers/net/mlx5/mlx5_devx_cmds.c
+++ b/drivers/net/mlx5/mlx5_devx_cmds.c
@@ -327,6 +327,13 @@  struct mlx5_devx_obj *
 	attr->flow_counters_dump = MLX5_GET(cmd_hca_cap, hcattr,
 					    flow_counters_dump);
 	attr->eswitch_manager = MLX5_GET(cmd_hca_cap, hcattr, eswitch_manager);
+	attr->hairpin = MLX5_GET(cmd_hca_cap, hcattr, hairpin);
+	attr->log_max_hairpin_queues = MLX5_GET(cmd_hca_cap, hcattr,
+						log_max_hairpin_queues);
+	attr->log_max_hairpin_wq_data_sz = MLX5_GET(cmd_hca_cap, hcattr,
+						    log_max_hairpin_wq_data_sz);
+	attr->log_max_hairpin_num_packets = MLX5_GET
+		(cmd_hca_cap, hcattr, log_min_hairpin_wq_data_sz);
 	attr->eth_net_offloads = MLX5_GET(cmd_hca_cap, hcattr,
 					  eth_net_offloads);
 	attr->eth_virt = MLX5_GET(cmd_hca_cap, hcattr, eth_virt);