{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/9183","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/9183/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/9183/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/9183/events","html_url":"https://github.com/ARMmbed/mbed-os/pull/9183","id":393464217,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNDc4MDg2","number":9183,"title":" Allow LwIP TCP retransmissions to be configured and tune those smaller.","user":{"login":"SeppoTakalo","id":3104794,"node_id":"MDQ6VXNlcjMxMDQ3OTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3104794?v=4","gravatar_id":"","url":"https://api.github.com/users/SeppoTakalo","html_url":"https://github.com/SeppoTakalo","followers_url":"https://api.github.com/users/SeppoTakalo/followers","following_url":"https://api.github.com/users/SeppoTakalo/following{/other_user}","gists_url":"https://api.github.com/users/SeppoTakalo/gists{/gist_id}","starred_url":"https://api.github.com/users/SeppoTakalo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeppoTakalo/subscriptions","organizations_url":"https://api.github.com/users/SeppoTakalo/orgs","repos_url":"https://api.github.com/users/SeppoTakalo/repos","events_url":"https://api.github.com/users/SeppoTakalo/events{/privacy}","received_events_url":"https://api.github.com/users/SeppoTakalo/received_events","type":"User","site_admin":false},"labels":[{"id":144902129,"node_id":"MDU6TGFiZWwxNDQ5MDIxMjk=","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/needs:%20work","name":"needs: work","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-21T13:46:07Z","updated_at":"2019-01-02T17:12:42Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/pulls/9183","html_url":"https://github.com/ARMmbed/mbed-os/pull/9183","diff_url":"https://github.com/ARMmbed/mbed-os/pull/9183.diff","patch_url":"https://github.com/ARMmbed/mbed-os/pull/9183.patch"},"body":"### Description\r\n\r\nAllow LwIP TCP retransmissions to be configured and tune those smaller.\r\n    \r\nCurrently, LwIP segment retransmission time is 12, which is very long\r\ntime as each timeout doubles the retransmission timeout.\r\nMake that to 6 as that is same what we use in Nanostack.\r\n\r\nLwIP TCP engine uses 500 ms slow timer and each retransmit will double the previous timeout.\r\n```\r\n          /* Double retransmission time-out unless we are trying to\r\n           * connect to somebody (i.e., we are in SYN_SENT). */\r\n          if (pcb->state != SYN_SENT) {\r\n            u8_t backoff_idx = LWIP_MIN(pcb->nrtx, sizeof(tcp_backoff)-1);\r\n            pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[backoff_idx];\r\n          }\r\n```\r\n\r\nTCP timeouts come from table:\r\n```\r\nstatic const u8_t tcp_backoff[13] =\r\n    { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7};\r\n```\r\n\r\nAnd to my best understanding, this `pcb->sv` is 6. so `6 << tcp_backoff[7]` will already lead to 6 minutes. Going through all timeouts will eventually take something like 40 minutes, unless I'm mistaken by values of `pcb->sa` and `pcb->sv`\r\n\r\nThis will fix the issue where Client+HTTP update stops into DNS queries not going through because timeouted TCP sessions have already eaten the full heap.\r\n\r\n\r\nAlso change the number of Freescale EMAC driver ring buffers down to 3. Earlier it was using 16+8 buffers, each 1500 bytes. This was the biggest consumer of LwIP heap.\r\n\r\n\r\n### Pull request type\r\n\r\n    [X] Fix\r\n    [ ] Refactor\r\n    [ ] Target update\r\n    [ ] Functionality change\r\n    [ ] Docs update\r\n    [ ] Test update\r\n    [ ] Breaking change\r\n\r\n### Reviewers\r\n\r\n@kjbracey-arm \r\n@teetak01 \r\n@yogpan01 \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/450924016","html_url":"https://github.com/ARMmbed/mbed-os/pull/9183#issuecomment-450924016","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/9183","id":450924016,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MDkyNDAxNg==","user":{"login":"SeppoTakalo","id":3104794,"node_id":"MDQ6VXNlcjMxMDQ3OTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3104794?v=4","gravatar_id":"","url":"https://api.github.com/users/SeppoTakalo","html_url":"https://github.com/SeppoTakalo","followers_url":"https://api.github.com/users/SeppoTakalo/followers","following_url":"https://api.github.com/users/SeppoTakalo/following{/other_user}","gists_url":"https://api.github.com/users/SeppoTakalo/gists{/gist_id}","starred_url":"https://api.github.com/users/SeppoTakalo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeppoTakalo/subscriptions","organizations_url":"https://api.github.com/users/SeppoTakalo/orgs","repos_url":"https://api.github.com/users/SeppoTakalo/repos","events_url":"https://api.github.com/users/SeppoTakalo/events{/privacy}","received_events_url":"https://api.github.com/users/SeppoTakalo/received_events","type":"User","site_admin":false},"created_at":"2019-01-02T17:12:42Z","updated_at":"2019-01-02T17:12:42Z","author_association":"CONTRIBUTOR","body":"Updated the PR based on review feedback.\r\n\r\nShould now be ready for testing.\r\n"}}
{"actor":{"display_login":"SeppoTakalo"}}