Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Mar 2018 12:40:46 +0000 (UTC)
From:      "Jonathan T. Looney" <jtl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331483 - head/sys/netinet
Message-ID:  <201803241240.w2OCekNe008816@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jtl
Date: Sat Mar 24 12:40:45 2018
New Revision: 331483
URL: https://svnweb.freebsd.org/changeset/base/331483

Log:
  Fix compilation for platforms that don't support atomic_fetchadd_64()
  after r331347.
  
  Reported by:	avg, br, jhibbits
  Sponsored by:	Netflix, Inc.

Modified:
  head/sys/netinet/tcp_log_buf.c

Modified: head/sys/netinet/tcp_log_buf.c
==============================================================================
--- head/sys/netinet/tcp_log_buf.c	Sat Mar 24 09:10:50 2018	(r331482)
+++ head/sys/netinet/tcp_log_buf.c	Sat Mar 24 12:40:45 2018	(r331483)
@@ -72,8 +72,8 @@ static STAILQ_HEAD(, tcp_log_id_node) tcp_log_expireq_
     STAILQ_HEAD_INITIALIZER(tcp_log_expireq_head);
 static struct mtx tcp_log_expireq_mtx;
 static struct callout tcp_log_expireq_callout;
-static uint64_t tcp_log_auto_ratio = 0;
-static uint64_t tcp_log_auto_ratio_cur = 0;
+static u_long tcp_log_auto_ratio = 0;
+static volatile u_long tcp_log_auto_ratio_cur = 0;
 static uint32_t tcp_log_auto_mode = TCP_LOG_STATE_TAIL;
 static bool tcp_log_auto_all = false;
 
@@ -109,7 +109,7 @@ SYSCTL_UMA_CUR(_net_inet_tcp_bb, OID_AUTO, log_id_tcpc
 SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_version, CTLFLAG_RD, &tcp_log_version,
     0, "Version of log formats exported");
 
-SYSCTL_U64(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW,
+SYSCTL_ULONG(_net_inet_tcp_bb, OID_AUTO, log_auto_ratio, CTLFLAG_RW,
     &tcp_log_auto_ratio, 0, "Do auto capturing for 1 out of N sessions");
 
 SYSCTL_U32(_net_inet_tcp_bb, OID_AUTO, log_auto_mode, CTLFLAG_RW,
@@ -283,7 +283,7 @@ tcp_log_selectauto(void)
 	 * this session.
 	 */
 	if (tcp_log_auto_ratio &&
-	    (atomic_fetchadd_64(&tcp_log_auto_ratio_cur, 1) %
+	    (atomic_fetchadd_long(&tcp_log_auto_ratio_cur, 1) %
 	    tcp_log_auto_ratio) == 0)
 		return (true);
 	return (false);



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