Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Aug 2017 14:09:36 +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-10@freebsd.org
Subject:   svn commit: r322005 - stable/10/sys/dev/mlx5/mlx5_en
Message-ID:  <201708031409.v73E9aWR054904@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu Aug  3 14:09:36 2017
New Revision: 322005
URL: https://svnweb.freebsd.org/changeset/base/322005

Log:
  MFC r312865:
  Enforce reading the consumer and producer counters once to ensure
  consistent return values from the mlx5e_sq_has_room_for()
  function. The two counters are incremented by different threads under
  different locks.
  
  Sponsored by:		Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/en.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/en.h
==============================================================================
--- stable/10/sys/dev/mlx5/mlx5_en/en.h	Thu Aug  3 14:08:39 2017	(r322004)
+++ stable/10/sys/dev/mlx5/mlx5_en/en.h	Thu Aug  3 14:09:36 2017	(r322005)
@@ -556,8 +556,10 @@ struct mlx5e_sq {
 static inline bool
 mlx5e_sq_has_room_for(struct mlx5e_sq *sq, u16 n)
 {
-	return ((sq->wq.sz_m1 & (sq->cc - sq->pc)) >= n ||
-	    sq->cc == sq->pc);
+	u16 cc = sq->cc;
+	u16 pc = sq->pc;
+
+	return ((sq->wq.sz_m1 & (cc - pc)) >= n || cc == pc);
 }
 
 struct mlx5e_channel {



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