diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-16 13:46:43 -0500 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2015-12-16 11:03:08 -0800 |
commit | 31f15ebbb463065c78c53e0db7ec35b97b5b6374 (patch) | |
tree | 4c4006baf42a372952b9dfeeddbb545441ee467e /services | |
parent | 1003c499017267bc497fc45cf8802cb933d9781b (diff) | |
download | frameworks_base-31f15ebbb463065c78c53e0db7ec35b97b5b6374.zip frameworks_base-31f15ebbb463065c78c53e0db7ec35b97b5b6374.tar.gz frameworks_base-31f15ebbb463065c78c53e0db7ec35b97b5b6374.tar.bz2 |
connectivity: Configure additional TCP parameters
* Add support for configuring TCP delayed ack segments / usercfg
via LinkProperties. This can improve performance for usecases
like WiFI display.
Change-Id: Iaf1fa7610a035ff91317544a8fc2e3f895831ad4
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index bc356da..b053c3a 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -222,6 +222,8 @@ public class ConnectivityService extends IConnectivityManager.Stub private INetworkPolicyManager mPolicyManager; private String mCurrentTcpBufferSizes; + private int mCurrentTcpDelayedAckSegments; + private int mCurrentTcpUserCfg; private static final int ENABLED = 1; private static final int DISABLED = 0; @@ -1735,6 +1737,34 @@ public class ConnectivityService extends IConnectivityManager.Stub } } + private void updateTcpDelayedAck(NetworkAgentInfo nai) { + if (isDefaultNetwork(nai) == false) { + return; + } + + int segments = nai.linkProperties.getTcpDelayedAckSegments(); + int usercfg = nai.linkProperties.getTcpUserCfg(); + + if (segments != mCurrentTcpDelayedAckSegments) { + try { + FileUtils.stringToFile("/sys/kernel/ipv4/tcp_delack_seg", + String.valueOf(segments)); + mCurrentTcpDelayedAckSegments = segments; + } catch (IOException e) { + // optional + } + } + + if (usercfg != mCurrentTcpUserCfg) { + try { + FileUtils.stringToFile("/sys/kernel/ipv4/tcp_use_usercfg", + String.valueOf(usercfg)); + mCurrentTcpUserCfg = usercfg; + } catch (IOException e) { + // optional + } + } + } private void flushVmDnsCache() { /* * Tell the VMs to toss their DNS caches @@ -3961,6 +3991,7 @@ public class ConnectivityService extends IConnectivityManager.Stub // updateMtu(lp, null); // } updateTcpBufferSizes(networkAgent); + updateTcpDelayedAck(networkAgent); // TODO: deprecate and remove mDefaultDns when we can do so safely. See http://b/18327075 // In L, we used it only when the network had Internet access but provided no DNS servers. @@ -4285,6 +4316,7 @@ public class ConnectivityService extends IConnectivityManager.Stub notifyLockdownVpn(newNetwork); handleApplyDefaultProxy(newNetwork.linkProperties.getHttpProxy()); updateTcpBufferSizes(newNetwork); + updateTcpDelayedAck(newNetwork); setDefaultDnsSystemProperties(newNetwork.linkProperties.getDnsServers()); } |