Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 16:15:20 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r347758 - in stable/12/sys/dev/mlx5: . mlx5_core mlx5_en
Message-ID:  <201905161615.x4GGFK1T064766@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 16:15:20 2019
New Revision: 347758
URL: https://svnweb.freebsd.org/changeset/base/347758

Log:
  MFC r347295:
  Add vnic steering drop statistics in mlx5en(4).
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
  stable/12/sys/dev/mlx5/mlx5_en/en.h
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  stable/12/sys/dev/mlx5/mlx5_ifc.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c	Thu May 16 16:14:43 2019	(r347757)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_cmd.c	Thu May 16 16:15:20 2019	(r347758)
@@ -412,6 +412,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor
 	case MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT:
 	case MLX5_CMD_OP_QUERY_HCA_VPORT_GID:
 	case MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY:
+	case MLX5_CMD_OP_QUERY_VNIC_ENV:
 	case MLX5_CMD_OP_QUERY_VPORT_COUNTER:
 	case MLX5_CMD_OP_ALLOC_Q_COUNTER:
 	case MLX5_CMD_OP_QUERY_Q_COUNTER:
@@ -537,6 +538,7 @@ const char *mlx5_command_str(int command)
 	MLX5_COMMAND_STR_CASE(MODIFY_HCA_VPORT_CONTEXT);
 	MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_GID);
 	MLX5_COMMAND_STR_CASE(QUERY_HCA_VPORT_PKEY);
+	MLX5_COMMAND_STR_CASE(QUERY_VNIC_ENV);
 	MLX5_COMMAND_STR_CASE(QUERY_VPORT_COUNTER);
 	MLX5_COMMAND_STR_CASE(SET_WOL_ROL);
 	MLX5_COMMAND_STR_CASE(QUERY_WOL_ROL);

Modified: stable/12/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/en.h	Thu May 16 16:14:43 2019	(r347757)
+++ stable/12/sys/dev/mlx5/mlx5_en/en.h	Thu May 16 16:15:20 2019	(r347758)
@@ -186,7 +186,8 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *);
   m(+1, u64 tx_queue_dropped, "tx_queue_dropped", "Transmit queue dropped") \
   m(+1, u64 tx_defragged, "tx_defragged", "Transmit queue defragged") \
   m(+1, u64 rx_wqe_err, "rx_wqe_err", "Receive WQE errors") \
-  m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets")
+  m(+1, u64 tx_jumbo_packets, "tx_jumbo_packets", "TX packets greater than 1518 octets") \
+  m(+1, u64 rx_steer_missed_packets, "rx_steer_missed_packets", "RX packets dropped by steering rule(s)")
 
 #define	MLX5E_VPORT_STATS_NUM (0 MLX5E_VPORT_STATS(MLX5E_STATS_COUNT))
 

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu May 16 16:14:43 2019	(r347757)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Thu May 16 16:15:20 2019	(r347758)
@@ -468,6 +468,28 @@ free_out:
 	kvfree(out);
 }
 
+static void
+mlx5e_grp_vnic_env_update_stats(struct mlx5e_priv *priv)
+{
+	u32 out[MLX5_ST_SZ_DW(query_vnic_env_out)] = {};
+	u32 in[MLX5_ST_SZ_DW(query_vnic_env_in)] = {};
+
+	if (!MLX5_CAP_GEN(priv->mdev, nic_receive_steering_discard))
+		return;
+
+	MLX5_SET(query_vnic_env_in, in, opcode,
+	    MLX5_CMD_OP_QUERY_VNIC_ENV);
+	MLX5_SET(query_vnic_env_in, in, op_mod, 0);
+	MLX5_SET(query_vnic_env_in, in, other_vport, 0);
+
+	if (mlx5_cmd_exec(priv->mdev, in, sizeof(in), out, sizeof(out)) != 0)
+		return;
+
+	priv->stats.vport.rx_steer_missed_packets =
+	    MLX5_GET64(query_vnic_env_out, out,
+	    vport_env.nic_receive_steering_discard);
+}
+
 /*
  * This function is called regularly to collect all statistics
  * counters from the firmware. The values can be viewed through the
@@ -554,6 +576,8 @@ mlx5e_update_stats_locked(struct mlx5e_priv *priv)
 	s->rx_wqe_err = rx_wqe_err;
 	s->rx_packets = rx_packets;
 	s->rx_bytes = rx_bytes;
+
+	mlx5e_grp_vnic_env_update_stats(priv);
 
 	/* HW counters */
 	memset(in, 0, sizeof(in));

Modified: stable/12/sys/dev/mlx5/mlx5_ifc.h
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 16:14:43 2019	(r347757)
+++ stable/12/sys/dev/mlx5/mlx5_ifc.h	Thu May 16 16:15:20 2019	(r347758)
@@ -151,6 +151,7 @@ enum {
 	MLX5_CMD_OP_MODIFY_HCA_VPORT_CONTEXT      = 0x763,
 	MLX5_CMD_OP_QUERY_HCA_VPORT_GID           = 0x764,
 	MLX5_CMD_OP_QUERY_HCA_VPORT_PKEY          = 0x765,
+	MLX5_CMD_OP_QUERY_VNIC_ENV                = 0x76f,
 	MLX5_CMD_OP_QUERY_VPORT_COUNTER           = 0x770,
 	MLX5_CMD_OP_ALLOC_Q_COUNTER               = 0x771,
 	MLX5_CMD_OP_DEALLOC_Q_COUNTER             = 0x772,
@@ -1222,7 +1223,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
 	u8         reserved_44[0xb];
 	u8         log_max_xrcd[0x5];
 
-	u8         reserved_45[0x10];
+	u8         nic_receive_steering_discard[0x1];
+	u8	   reserved_45[0x7];
+	u8         log_max_flow_counter_bulk[0x8];
 	u8         max_flow_counter[0x10];
 
 	u8         reserved_46[0x3];
@@ -2190,6 +2193,24 @@ struct mlx5_ifc_xrc_srqc_bits {
 	u8         reserved_9[0x80];
 };
 
+struct mlx5_ifc_vnic_diagnostic_statistics_bits {
+	u8         counter_error_queues[0x20];
+
+	u8         total_error_queues[0x20];
+
+	u8         send_queue_priority_update_flow[0x20];
+
+	u8         reserved_at_60[0x20];
+
+	u8         nic_receive_steering_discard[0x40];
+
+	u8         receive_discard_vport_down[0x40];
+
+	u8         transmit_discard_vport_down[0x40];
+
+	u8         reserved_at_140[0xec0];
+};
+
 struct mlx5_ifc_traffic_counter_bits {
 	u8         packets[0x40];
 
@@ -3964,6 +3985,35 @@ struct mlx5_ifc_query_vport_state_in_bits {
 	u8         vport_number[0x10];
 
 	u8         reserved_3[0x20];
+};
+
+struct mlx5_ifc_query_vnic_env_out_bits {
+	u8         status[0x8];
+	u8         reserved_at_8[0x18];
+
+	u8         syndrome[0x20];
+
+	u8         reserved_at_40[0x40];
+
+	struct mlx5_ifc_vnic_diagnostic_statistics_bits vport_env;
+};
+
+enum {
+	MLX5_QUERY_VNIC_ENV_IN_OP_MOD_VPORT_DIAG_STATISTICS  = 0x0,
+};
+
+struct mlx5_ifc_query_vnic_env_in_bits {
+	u8         opcode[0x10];
+	u8         reserved_at_10[0x10];
+
+	u8         reserved_at_20[0x10];
+	u8         op_mod[0x10];
+
+	u8         other_vport[0x1];
+	u8         reserved_at_41[0xf];
+	u8         vport_number[0x10];
+
+	u8         reserved_at_60[0x20];
 };
 
 struct mlx5_ifc_query_vport_counter_out_bits {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905161615.x4GGFK1T064766>