svn commit: r268718 - user/jceel/soc2014_evdev/head/sys/dev/evdev

Jakub Wojciech Klama jceel at FreeBSD.org
Tue Jul 15 22:18:25 UTC 2014


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);


More information about the svn-src-user mailing list