Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jul 2014 22:18:25 +0000 (UTC)
From:      Jakub Wojciech Klama <jceel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r268718 - user/jceel/soc2014_evdev/head/sys/dev/evdev
Message-ID:  <201407152218.s6FMIPoG037513@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jceel
Date: Tue Jul 15 22:18:25 2014
New Revision: 268718
URL: http://svnweb.freebsd.org/changeset/base/268718

Log:
  Don't overwrite SYN_DROPPED packets by following actual packets to let
  userspace know that some packets were lost in the meantime.

Modified:
  user/jceel/soc2014_evdev/head/sys/dev/evdev/evdev.c

Modified: user/jceel/soc2014_evdev/head/sys/dev/evdev/evdev.c
==============================================================================
--- user/jceel/soc2014_evdev/head/sys/dev/evdev/evdev.c	Tue Jul 15 22:17:17 2014	(r268717)
+++ user/jceel/soc2014_evdev/head/sys/dev/evdev/evdev.c	Tue Jul 15 22:18:25 2014	(r268718)
@@ -487,9 +487,17 @@ evdev_client_push(struct evdev_client *c
 		debugf("client %p for device %s: buffer overflow", client,
 		    client->ec_evdev->ev_shortname);
 
-		microtime(&client->ec_buffer[tail].time);
-		client->ec_buffer[tail].type = EV_SYN;
-		client->ec_buffer[tail].code = SYN_DROPPED;
+		/* Check whether we placed SYN_DROPPED packet already */
+		if (client->ec_buffer[tail - 2 % count].type == EV_SYN &&
+		    client->ec_buffer[tail - 2 % count].code == SYN_DROPPED) {
+			wakeup(client);
+			EVDEV_CLIENT_UNLOCKQ(client);
+			return;
+		}
+
+		microtime(&client->ec_buffer[tail - 1].time);
+		client->ec_buffer[tail - 1].type = EV_SYN;
+		client->ec_buffer[tail - 1].code = SYN_DROPPED;
 
 		wakeup(client);
 		EVDEV_CLIENT_UNLOCKQ(client);



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