{"action":"created","comment":{"url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/comments/23053539","id":23053539,"diff_hunk":"@@ -104,6 +119,94 @@ static int mptcp_dont_reinject_skb(const struct tcp_sock *tp, const struct sk_bu\n \t\tmptcp_pi_to_flag(tp->mptcp->path_index) & TCP_SKB_CB(skb)->path_mask;\n }\n \n+static bool subflow_is_backup(const struct tcp_sock *tp)\n+{\n+\treturn tp->mptcp->rcv_low_prio || tp->mptcp->low_prio;\n+}\n+\n+static bool subflow_is_active(const struct tcp_sock *tp)\n+{\n+\treturn !tp->mptcp->rcv_low_prio && !tp->mptcp->low_prio;\n+}\n+\n+/* Generic function to iterate over used and unused subflows and to select the\n+ * best one\n+ */\n+static struct sock\n+*get_subflow_from_selectors(struct mptcp_cb *mpcb, struct sk_buff *skb,\n+\t\t\t    bool (*selector)(const struct tcp_sock *),\n+\t\t\t    bool zero_wnd_test, bool *force)\n+{\n+\tstruct sock *bestsk = NULL;\n+\tu32 min_srtt = 0xffffffff;\n+\tbool found_unused = false;\n+\tbool found_unused_una = false;\n+\tstruct sock *sk;\n+\n+\tmptcp_for_each_sk(mpcb, sk) {\n+\t\tstruct tcp_sock *tp = tcp_sk(sk);\n+\t\tbool unused = false;\n+\n+\t\t/* First, we choose only the wanted sks */\n+\t\tif (!(*selector)(tp))\n+\t\t\tcontinue;\n+\n+\t\tif (!mptcp_dont_reinject_skb(tp, skb))\n+\t\t\tunused = true;\n+\t\telse if (found_unused)\n+\t\t\t/* If a unused sk was found previously, we continue -\n+\t\t\t * no need to check used sks anymore.\n+\t\t\t */\n+\t\t\tcontinue;\n+\n+\t\tif (mptcp_is_def_unavailable(sk))\n+\t\t\tcontinue;\n+\n+\t\tif (mptcp_is_temp_unavailable(sk, skb, zero_wnd_test)) {\n+\t\t\tif (unused)\n+\t\t\t\tfound_unused_una = true;","path":"net/mptcp/mptcp_sched.c","position":162,"original_position":162,"commit_id":"cc8638fe333be3d10325c6795fc1678bfeebede0","original_commit_id":"cc8638fe333be3d10325c6795fc1678bfeebede0","user":{"login":"chrpinedo","id":2324630,"avatar_url":"https://avatars.githubusercontent.com/u/2324630?v=3","gravatar_id":"","url":"https://api.github.com/users/chrpinedo","html_url":"https://github.com/chrpinedo","followers_url":"https://api.github.com/users/chrpinedo/followers","following_url":"https://api.github.com/users/chrpinedo/following{/other_user}","gists_url":"https://api.github.com/users/chrpinedo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrpinedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrpinedo/subscriptions","organizations_url":"https://api.github.com/users/chrpinedo/orgs","repos_url":"https://api.github.com/users/chrpinedo/repos","events_url":"https://api.github.com/users/chrpinedo/events{/privacy}","received_events_url":"https://api.github.com/users/chrpinedo/received_events","type":"User","site_admin":false},"body":"Improvement: we only take care of temporally unavailable \"unused\" sks.\r\n\r\nBecause it isn't worth waiting for a used sk because we want to send the skb only through unused sks.","created_at":"2015-01-15T23:39:02Z","updated_at":"2015-01-15T23:39:02Z","html_url":"https://github.com/multipath-tcp/mptcp/pull/70#discussion_r23053539","pull_request_url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70","_links":{"self":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/comments/23053539"},"html":{"href":"https://github.com/multipath-tcp/mptcp/pull/70#discussion_r23053539"},"pull_request":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70"}}},"pull_request":{"url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70","id":27472588,"html_url":"https://github.com/multipath-tcp/mptcp/pull/70","diff_url":"https://github.com/multipath-tcp/mptcp/pull/70.diff","patch_url":"https://github.com/multipath-tcp/mptcp/pull/70.patch","issue_url":"https://api.github.com/repos/multipath-tcp/mptcp/issues/70","number":70,"state":"open","locked":false,"title":"mptcp: sched: Improve active/backup subflow selection","user":{"login":"chrpinedo","id":2324630,"avatar_url":"https://avatars.githubusercontent.com/u/2324630?v=3","gravatar_id":"","url":"https://api.github.com/users/chrpinedo","html_url":"https://github.com/chrpinedo","followers_url":"https://api.github.com/users/chrpinedo/followers","following_url":"https://api.github.com/users/chrpinedo/following{/other_user}","gists_url":"https://api.github.com/users/chrpinedo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrpinedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrpinedo/subscriptions","organizations_url":"https://api.github.com/users/chrpinedo/orgs","repos_url":"https://api.github.com/users/chrpinedo/repos","events_url":"https://api.github.com/users/chrpinedo/events{/privacy}","received_events_url":"https://api.github.com/users/chrpinedo/received_events","type":"User","site_admin":false},"body":"The selection of the subflow in the default scheduler has been improved to\r\nguarantee that firstly the active subflows are considered and then the backup\r\n(lowprio) subflows. Furthermore, in case of reinjection previously unused\r\nsubflows are selected by starting with active subflows and finishing with\r\nbackup subflows. In every case the subflow with best RTT is selected.","created_at":"2015-01-15T23:35:52Z","updated_at":"2015-01-15T23:39:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4e893e94113b82cb1a5dd42e6baaee95f47cef9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70/commits","review_comments_url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70/comments","review_comment_url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/comments/{number}","comments_url":"https://api.github.com/repos/multipath-tcp/mptcp/issues/70/comments","statuses_url":"https://api.github.com/repos/multipath-tcp/mptcp/statuses/cc8638fe333be3d10325c6795fc1678bfeebede0","head":{"label":"chrpinedo:patch_sched","ref":"patch_sched","sha":"cc8638fe333be3d10325c6795fc1678bfeebede0","user":{"login":"chrpinedo","id":2324630,"avatar_url":"https://avatars.githubusercontent.com/u/2324630?v=3","gravatar_id":"","url":"https://api.github.com/users/chrpinedo","html_url":"https://github.com/chrpinedo","followers_url":"https://api.github.com/users/chrpinedo/followers","following_url":"https://api.github.com/users/chrpinedo/following{/other_user}","gists_url":"https://api.github.com/users/chrpinedo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrpinedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrpinedo/subscriptions","organizations_url":"https://api.github.com/users/chrpinedo/orgs","repos_url":"https://api.github.com/users/chrpinedo/repos","events_url":"https://api.github.com/users/chrpinedo/events{/privacy}","received_events_url":"https://api.github.com/users/chrpinedo/received_events","type":"User","site_admin":false},"repo":{"id":27765968,"name":"mptcp","full_name":"chrpinedo/mptcp","owner":{"login":"chrpinedo","id":2324630,"avatar_url":"https://avatars.githubusercontent.com/u/2324630?v=3","gravatar_id":"","url":"https://api.github.com/users/chrpinedo","html_url":"https://github.com/chrpinedo","followers_url":"https://api.github.com/users/chrpinedo/followers","following_url":"https://api.github.com/users/chrpinedo/following{/other_user}","gists_url":"https://api.github.com/users/chrpinedo/gists{/gist_id}","starred_url":"https://api.github.com/users/chrpinedo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrpinedo/subscriptions","organizations_url":"https://api.github.com/users/chrpinedo/orgs","repos_url":"https://api.github.com/users/chrpinedo/repos","events_url":"https://api.github.com/users/chrpinedo/events{/privacy}","received_events_url":"https://api.github.com/users/chrpinedo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrpinedo/mptcp","description":"Linux Kernel implementation of MultiPath TCP","fork":true,"url":"https://api.github.com/repos/chrpinedo/mptcp","forks_url":"https://api.github.com/repos/chrpinedo/mptcp/forks","keys_url":"https://api.github.com/repos/chrpinedo/mptcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrpinedo/mptcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrpinedo/mptcp/teams","hooks_url":"https://api.github.com/repos/chrpinedo/mptcp/hooks","issue_events_url":"https://api.github.com/repos/chrpinedo/mptcp/issues/events{/number}","events_url":"https://api.github.com/repos/chrpinedo/mptcp/events","assignees_url":"https://api.github.com/repos/chrpinedo/mptcp/assignees{/user}","branches_url":"https://api.github.com/repos/chrpinedo/mptcp/branches{/branch}","tags_url":"https://api.github.com/repos/chrpinedo/mptcp/tags","blobs_url":"https://api.github.com/repos/chrpinedo/mptcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrpinedo/mptcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrpinedo/mptcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrpinedo/mptcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrpinedo/mptcp/statuses/{sha}","languages_url":"https://api.github.com/repos/chrpinedo/mptcp/languages","stargazers_url":"https://api.github.com/repos/chrpinedo/mptcp/stargazers","contributors_url":"https://api.github.com/repos/chrpinedo/mptcp/contributors","subscribers_url":"https://api.github.com/repos/chrpinedo/mptcp/subscribers","subscription_url":"https://api.github.com/repos/chrpinedo/mptcp/subscription","commits_url":"https://api.github.com/repos/chrpinedo/mptcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrpinedo/mptcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrpinedo/mptcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrpinedo/mptcp/issues/comments/{number}","contents_url":"https://api.github.com/repos/chrpinedo/mptcp/contents/{+path}","compare_url":"https://api.github.com/repos/chrpinedo/mptcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrpinedo/mptcp/merges","archive_url":"https://api.github.com/repos/chrpinedo/mptcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrpinedo/mptcp/downloads","issues_url":"https://api.github.com/repos/chrpinedo/mptcp/issues{/number}","pulls_url":"https://api.github.com/repos/chrpinedo/mptcp/pulls{/number}","milestones_url":"https://api.github.com/repos/chrpinedo/mptcp/milestones{/number}","notifications_url":"https://api.github.com/repos/chrpinedo/mptcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrpinedo/mptcp/labels{/name}","releases_url":"https://api.github.com/repos/chrpinedo/mptcp/releases{/id}","created_at":"2014-12-09T12:41:15Z","updated_at":"2014-12-09T12:45:09Z","pushed_at":"2015-01-15T23:33:35Z","git_url":"git://github.com/chrpinedo/mptcp.git","ssh_url":"git@github.com:chrpinedo/mptcp.git","clone_url":"https://github.com/chrpinedo/mptcp.git","svn_url":"https://github.com/chrpinedo/mptcp","homepage":"http://multipath-tcp.org","size":1004453,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"mptcp_v0.89"}},"base":{"label":"multipath-tcp:mptcp_trunk","ref":"mptcp_trunk","sha":"f9edddd40fc5c59cd7ba93f739517dd0340111df","user":{"login":"multipath-tcp","id":2630482,"avatar_url":"https://avatars.githubusercontent.com/u/2630482?v=3","gravatar_id":"","url":"https://api.github.com/users/multipath-tcp","html_url":"https://github.com/multipath-tcp","followers_url":"https://api.github.com/users/multipath-tcp/followers","following_url":"https://api.github.com/users/multipath-tcp/following{/other_user}","gists_url":"https://api.github.com/users/multipath-tcp/gists{/gist_id}","starred_url":"https://api.github.com/users/multipath-tcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multipath-tcp/subscriptions","organizations_url":"https://api.github.com/users/multipath-tcp/orgs","repos_url":"https://api.github.com/users/multipath-tcp/repos","events_url":"https://api.github.com/users/multipath-tcp/events{/privacy}","received_events_url":"https://api.github.com/users/multipath-tcp/received_events","type":"Organization","site_admin":false},"repo":{"id":4749289,"name":"mptcp","full_name":"multipath-tcp/mptcp","owner":{"login":"multipath-tcp","id":2630482,"avatar_url":"https://avatars.githubusercontent.com/u/2630482?v=3","gravatar_id":"","url":"https://api.github.com/users/multipath-tcp","html_url":"https://github.com/multipath-tcp","followers_url":"https://api.github.com/users/multipath-tcp/followers","following_url":"https://api.github.com/users/multipath-tcp/following{/other_user}","gists_url":"https://api.github.com/users/multipath-tcp/gists{/gist_id}","starred_url":"https://api.github.com/users/multipath-tcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/multipath-tcp/subscriptions","organizations_url":"https://api.github.com/users/multipath-tcp/orgs","repos_url":"https://api.github.com/users/multipath-tcp/repos","events_url":"https://api.github.com/users/multipath-tcp/events{/privacy}","received_events_url":"https://api.github.com/users/multipath-tcp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/multipath-tcp/mptcp","description":"Linux Kernel implementation of MultiPath TCP","fork":false,"url":"https://api.github.com/repos/multipath-tcp/mptcp","forks_url":"https://api.github.com/repos/multipath-tcp/mptcp/forks","keys_url":"https://api.github.com/repos/multipath-tcp/mptcp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/multipath-tcp/mptcp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/multipath-tcp/mptcp/teams","hooks_url":"https://api.github.com/repos/multipath-tcp/mptcp/hooks","issue_events_url":"https://api.github.com/repos/multipath-tcp/mptcp/issues/events{/number}","events_url":"https://api.github.com/repos/multipath-tcp/mptcp/events","assignees_url":"https://api.github.com/repos/multipath-tcp/mptcp/assignees{/user}","branches_url":"https://api.github.com/repos/multipath-tcp/mptcp/branches{/branch}","tags_url":"https://api.github.com/repos/multipath-tcp/mptcp/tags","blobs_url":"https://api.github.com/repos/multipath-tcp/mptcp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/multipath-tcp/mptcp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/multipath-tcp/mptcp/git/refs{/sha}","trees_url":"https://api.github.com/repos/multipath-tcp/mptcp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/multipath-tcp/mptcp/statuses/{sha}","languages_url":"https://api.github.com/repos/multipath-tcp/mptcp/languages","stargazers_url":"https://api.github.com/repos/multipath-tcp/mptcp/stargazers","contributors_url":"https://api.github.com/repos/multipath-tcp/mptcp/contributors","subscribers_url":"https://api.github.com/repos/multipath-tcp/mptcp/subscribers","subscription_url":"https://api.github.com/repos/multipath-tcp/mptcp/subscription","commits_url":"https://api.github.com/repos/multipath-tcp/mptcp/commits{/sha}","git_commits_url":"https://api.github.com/repos/multipath-tcp/mptcp/git/commits{/sha}","comments_url":"https://api.github.com/repos/multipath-tcp/mptcp/comments{/number}","issue_comment_url":"https://api.github.com/repos/multipath-tcp/mptcp/issues/comments/{number}","contents_url":"https://api.github.com/repos/multipath-tcp/mptcp/contents/{+path}","compare_url":"https://api.github.com/repos/multipath-tcp/mptcp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/multipath-tcp/mptcp/merges","archive_url":"https://api.github.com/repos/multipath-tcp/mptcp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/multipath-tcp/mptcp/downloads","issues_url":"https://api.github.com/repos/multipath-tcp/mptcp/issues{/number}","pulls_url":"https://api.github.com/repos/multipath-tcp/mptcp/pulls{/number}","milestones_url":"https://api.github.com/repos/multipath-tcp/mptcp/milestones{/number}","notifications_url":"https://api.github.com/repos/multipath-tcp/mptcp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/multipath-tcp/mptcp/labels{/name}","releases_url":"https://api.github.com/repos/multipath-tcp/mptcp/releases{/id}","created_at":"2012-06-22T08:58:15Z","updated_at":"2015-01-13T16:38:07Z","pushed_at":"2015-01-13T16:34:56Z","git_url":"git://github.com/multipath-tcp/mptcp.git","ssh_url":"git@github.com:multipath-tcp/mptcp.git","clone_url":"https://github.com/multipath-tcp/mptcp.git","svn_url":"https://github.com/multipath-tcp/mptcp","homepage":"http://multipath-tcp.org","size":1321584,"stargazers_count":179,"watchers_count":179,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":71,"mirror_url":null,"open_issues_count":17,"forks":71,"open_issues":17,"watchers":179,"default_branch":"mptcp_v0.89"}},"_links":{"self":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70"},"html":{"href":"https://github.com/multipath-tcp/mptcp/pull/70"},"issue":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/issues/70"},"comments":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/issues/70/comments"},"review_comments":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70/comments"},"review_comment":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/pulls/70/commits"},"statuses":{"href":"https://api.github.com/repos/multipath-tcp/mptcp/statuses/cc8638fe333be3d10325c6795fc1678bfeebede0"}}}}