svn commit: r347264 - head/sys/dev/mlx5/mlx5_en

Hans Petter Selasky hselasky at FreeBSD.org
Wed May 8 10:35:57 UTC 2019


Author: hselasky
Date: Wed May  8 10:35:55 2019
New Revision: 347264
URL: https://svnweb.freebsd.org/changeset/base/347264

Log:
  Configure firmware to use RX hash format in mini CQE in mlx5en(4).
  
  When using CQE zipping, one can choose between RX hash and Checksum.
  This will indicate the parameter on which a zipping session should be
  stopped.
  
  While porting the Linux code, Checksum was chosen. However, the value
  of Checksum is not being used anywhere.
  For the FreeBSD driver, we prefer to use the RX hash format which will
  guarantee the RX hash value for all the mini CQEs.
  While at it, make sure to initialize the Checksum value in the
  decompressed CQE.
  
  Submitted by:	slavash@
  MFC after:	3 days
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Wed May  8 10:35:35 2019	(r347263)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c	Wed May  8 10:35:55 2019	(r347264)
@@ -1955,13 +1955,15 @@ mlx5e_build_rx_cq_param(struct mlx5e_priv *priv,
 	struct net_dim_cq_moder curr;
 	void *cqc = param->cqc;
 
-
 	/*
-	 * TODO The sysctl to control on/off is a bool value for now, which means
-	 * we only support CSUM, once HASH is implemnted we'll need to address that.
+	 * We use MLX5_CQE_FORMAT_HASH because the RX hash mini CQE
+	 * format is more beneficial for FreeBSD use case.
+	 *
+	 * Adding support for MLX5_CQE_FORMAT_CSUM will require changes
+	 * in mlx5e_decompress_cqe.
 	 */
 	if (priv->params.cqe_zipping_en) {
-		MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_CSUM);
+		MLX5_SET(cqc, cqc, mini_cqe_res_format, MLX5_CQE_FORMAT_HASH);
 		MLX5_SET(cqc, cqc, cqe_compression_en, 1);
 	}
 

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed May  8 10:35:35 2019	(r347263)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c	Wed May  8 10:35:55 2019	(r347264)
@@ -385,7 +385,12 @@ mlx5e_decompress_cqe(struct mlx5e_cq *cq, struct mlx5_
 	 */
 	title->byte_cnt = mini->byte_cnt;
 	title->wqe_counter = cpu_to_be16((wqe_counter + i) & cq->wq.sz_m1);
-	title->check_sum = mini->checksum;
+	title->rss_hash_result = mini->rx_hash_result;
+	/*
+	 * Since we use MLX5_CQE_FORMAT_HASH when creating the RX CQ,
+	 * the value of the checksum should be ignored.
+	 */
+	title->check_sum = 0;
 	title->op_own = (title->op_own & 0xf0) |
 	    (((cq->wq.cc + i) >> cq->wq.log_sz) & 1);
 }


More information about the svn-src-head mailing list