Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/734/?format=api
{ "id": 734, "url": "http://patchwork.ozlabs.org/api/patches/734/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1221933153-11874-12-git-send-email-ilpo.jarvinen@helsinki.fi/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<1221933153-11874-12-git-send-email-ilpo.jarvinen@helsinki.fi>", "list_archive_url": null, "date": "2008-09-20T17:52:29", "name": "[net-next,11/15] tcp: reorganize retransmit code loops", "commit_ref": null, "pull_url": null, "state": "rejected", "archived": true, "hash": "739b5ec1da1933bb83502fbdf18883a245dd54a3", "submitter": { "id": 255, "url": "http://patchwork.ozlabs.org/api/people/255/?format=api", "name": "Ilpo Järvinen", "email": "ilpo.jarvinen@helsinki.fi" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1221933153-11874-12-git-send-email-ilpo.jarvinen@helsinki.fi/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/734/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/734/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.176.167])\n\tby ozlabs.org (Postfix) with ESMTP id 3CB75DDEED\n\tfor <patchwork-incoming@ozlabs.org>;\n\tSun, 21 Sep 2008 03:53:15 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751549AbYITRxG (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSat, 20 Sep 2008 13:53:06 -0400", "(majordomo@vger.kernel.org) by vger.kernel.org id S1751535AbYITRxD\n\t(ORCPT <rfc822; netdev-outgoing>); Sat, 20 Sep 2008 13:53:03 -0400", "from courier.cs.helsinki.fi ([128.214.9.1]:49080 \"EHLO\n\tmail.cs.helsinki.fi\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751316AbYITRwl (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Sat, 20 Sep 2008 13:52:41 -0400", "from wrl-59.cs.helsinki.fi (wrl-59.cs.helsinki.fi\n\t[128.214.166.179])\n\t(AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA)\n\tby mail.cs.helsinki.fi with esmtp; Sat, 20 Sep 2008 20:52:34 +0300\n\tid 0005BEDF.48D53862.00002DB2", "by wrl-59.cs.helsinki.fi (Postfix, from userid 50795)\n\tid 909C9A00AB; Sat, 20 Sep 2008 20:52:34 +0300 (EEST)" ], "From": "\"=?ISO-8859-1?Q?Ilpo_J=E4rvinen?=\" <ilpo.jarvinen@helsinki.fi>", "To": "David Miller <davem@davemloft.net>", "Cc": "netdev@vger.kernel.org,\n\t\"=?utf-8?q?Ilpo=20J=E4rvinen?=\" <ilpo.jarvinen@helsinki.fi>", "Subject": "[PATCH net-next 11/15] tcp: reorganize retransmit code loops", "Date": "Sat, 20 Sep 2008 20:52:29 +0300", "Message-Id": "<1221933153-11874-12-git-send-email-ilpo.jarvinen@helsinki.fi>", "X-Mailer": "git-send-email 1.5.4.2.156.ge3c5", "In-Reply-To": "<1221933153-11874-11-git-send-email-ilpo.jarvinen@helsinki.fi>", "References": "<1221933153-11874-1-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-2-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-3-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-4-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-5-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-6-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-7-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-8-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-9-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-10-git-send-email-ilpo.jarvinen@helsinki.fi>\n\t<1221933153-11874-11-git-send-email-ilpo.jarvinen@helsinki.fi>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=ISO-8859-1", "Content-Transfer-Encoding": "8bit", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "Both loops are quite similar, so they can be combined\nwith little effort. As a result, forward_skb_hint becomes\nobsolete as well.\n\nSince non-fwd rexmissions have priority over the fwd-rexmits\n(not that this is written to some stone that it should be so,\nit's just the current behavior and I currently see no reason\nto change that), some trickery had to implemented to keep skb\nhint never going past a hole so that we can return there if\nthat becomes later on necessary.\n\nSigned-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>\n---\n include/linux/tcp.h | 1 -\n include/net/tcp.h | 1 -\n net/ipv4/tcp_output.c | 79 ++++++++++++++++++++----------------------------\n 3 files changed, 33 insertions(+), 48 deletions(-)", "diff": "diff --git a/include/linux/tcp.h b/include/linux/tcp.h\nindex d7637c4..7672906 100644\n--- a/include/linux/tcp.h\n+++ b/include/linux/tcp.h\n@@ -342,7 +342,6 @@ struct tcp_sock {\n \tstruct sk_buff* lost_skb_hint;\n \tstruct sk_buff *scoreboard_skb_hint;\n \tstruct sk_buff *retransmit_skb_hint;\n-\tstruct sk_buff *forward_skb_hint;\n \n \tstruct sk_buff_head\tout_of_order_queue; /* Out of order segments go here */\n \ndiff --git a/include/net/tcp.h b/include/net/tcp.h\nindex 9be41c9..10f838e 100644\n--- a/include/net/tcp.h\n+++ b/include/net/tcp.h\n@@ -1041,7 +1041,6 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)\n \ttp->lost_skb_hint = NULL;\n \ttp->scoreboard_skb_hint = NULL;\n \ttp->retransmit_skb_hint = NULL;\n-\ttp->forward_skb_hint = NULL;\n }\n \n extern void tcp_verify_retransmit_hint(struct tcp_sock *tp,\ndiff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c\nindex fc7bfd6..0234b6f 100644\n--- a/net/ipv4/tcp_output.c\n+++ b/net/ipv4/tcp_output.c\n@@ -2034,7 +2034,9 @@ void tcp_xmit_retransmit_queue(struct sock *sk)\n \tconst struct inet_connection_sock *icsk = inet_csk(sk);\n \tstruct tcp_sock *tp = tcp_sk(sk);\n \tstruct sk_buff *skb;\n+\tstruct sk_buff *hole = NULL;\n \tint mib_idx;\n+\tint fwd_rexmitting = 0;\n \n \tif (!tp->lost_out)\n \t\ttp->retransmit_high = tp->snd_una;\n@@ -2051,7 +2053,8 @@ void tcp_xmit_retransmit_queue(struct sock *sk)\n \t\tif (skb == tcp_send_head(sk))\n \t\t\tbreak;\n \t\t/* we could do better than to assign each time */\n-\t\ttp->retransmit_skb_hint = skb;\n+\t\tif (hole == NULL)\n+\t\t\ttp->retransmit_skb_hint = skb;\n \n \t\t/* Assume this retransmit will generate\n \t\t * only one packet for congestion window\n@@ -2062,65 +2065,49 @@ void tcp_xmit_retransmit_queue(struct sock *sk)\n \t\t */\n \t\tif (tcp_packets_in_flight(tp) >= tp->snd_cwnd)\n \t\t\treturn;\n-\t\tif (!before(TCP_SKB_CB(skb)->seq, tp->retransmit_high))\n-\t\t\tbreak;\n-\t\tif (sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))\n-\t\t\tcontinue;\n-\n-\t\tif (!(sacked & TCPCB_LOST))\n-\t\t\tcontinue;\n-\n-\t\tif (tcp_retransmit_skb(sk, skb)) {\n-\t\t\ttp->retransmit_skb_hint = NULL;\n-\t\t\treturn;\n-\t\t}\n-\t\tif (icsk->icsk_ca_state != TCP_CA_Loss)\n-\t\t\tmib_idx = LINUX_MIB_TCPFASTRETRANS;\n-\t\telse\n-\t\t\tmib_idx = LINUX_MIB_TCPSLOWSTARTRETRANS;\n-\t\tNET_INC_STATS_BH(sock_net(sk), mib_idx);\n-\n-\t\tif (skb == tcp_write_queue_head(sk))\n-\t\t\tinet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,\n-\t\t\t\t\t\t inet_csk(sk)->icsk_rto,\n-\t\t\t\t\t\t TCP_RTO_MAX);\n-\t}\n-\n-\t/* OK, demanded retransmission is finished. */\n-\tif (!tcp_can_forward_retransmit(sk))\n-\t\treturn;\n \n-\tif (tp->forward_skb_hint)\n-\t\tskb = tp->forward_skb_hint;\n-\telse\n-\t\tskb = tcp_write_queue_head(sk);\n+\t\tif (fwd_rexmitting) {\n+begin_fwd:\n+\t\t\tif (!before(TCP_SKB_CB(skb)->seq, tcp_highest_sack_seq(tp)))\n+\t\t\t\tbreak;\n+\t\t\tmib_idx = LINUX_MIB_TCPFORWARDRETRANS;\n \n-\ttcp_for_write_queue_from(skb, sk) {\n-\t\tif (skb == tcp_send_head(sk))\n-\t\t\tbreak;\n-\t\ttp->forward_skb_hint = skb;\n+\t\t} else if (!before(TCP_SKB_CB(skb)->seq, tp->retransmit_high)) {\n+\t\t\tif (!tcp_can_forward_retransmit(sk))\n+\t\t\t\tbreak;\n+\t\t\t/* Backtrack if necessary to non-L'ed skb */\n+\t\t\tif (hole != NULL) {\n+\t\t\t\tskb = hole;\n+\t\t\t\thole = NULL;\n+\t\t\t}\n+\t\t\tfwd_rexmitting = 1;\n+\t\t\tgoto begin_fwd;\n \n-\t\tif (!before(TCP_SKB_CB(skb)->seq, tcp_highest_sack_seq(tp)))\n-\t\t\tbreak;\n+\t\t} else if (!(sacked & TCPCB_LOST)) {\n+\t\t\tif (hole == NULL && !(sacked & TCPCB_SACKED_RETRANS))\n+\t\t\t\thole = skb;\n+\t\t\tcontinue;\n \n-\t\tif (tcp_packets_in_flight(tp) >= tp->snd_cwnd)\n-\t\t\tbreak;\n+\t\t} else {\n+\t\t\tif (icsk->icsk_ca_state != TCP_CA_Loss)\n+\t\t\t\tmib_idx = LINUX_MIB_TCPFASTRETRANS;\n+\t\t\telse\n+\t\t\t\tmib_idx = LINUX_MIB_TCPSLOWSTARTRETRANS;\n+\t\t}\n \n-\t\tif (TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS)\n+\t\tif (sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))\n \t\t\tcontinue;\n \n-\t\t/* Ok, retransmit it. */\n \t\tif (tcp_retransmit_skb(sk, skb)) {\n-\t\t\ttp->forward_skb_hint = NULL;\n-\t\t\tbreak;\n+\t\t\ttp->retransmit_skb_hint = NULL;\n+\t\t\treturn;\n \t\t}\n+\t\tNET_INC_STATS_BH(sock_net(sk), mib_idx);\n \n \t\tif (skb == tcp_write_queue_head(sk))\n \t\t\tinet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,\n \t\t\t\t\t\t inet_csk(sk)->icsk_rto,\n \t\t\t\t\t\t TCP_RTO_MAX);\n-\n-\t\tNET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPFORWARDRETRANS);\n \t}\n }\n \n", "prefixes": [ "net-next", "11/15" ] }