From: Gerrit Renker <gerrit@erg.abdn.ac.uk>
To: netdev@vger.kernel.org, Wei Yongjun <yjwei@cn.fujitsu.com>,
dccp@vger.kernel.orgu
Subject: [dccp] [RFC/RFT] [Patch 2/2]: Combine the functionality of enqeueing and cloning
Date: Thu, 5 Jun 2008 15:47:12 +0100 [thread overview]
Message-ID: <20080605144712.GD8800@gerrit.erg.abdn.ac.uk> (raw)
In-Reply-To: <20080605144609.GC8800@gerrit.erg.abdn.ac.uk>
dccp: Combine the functionality of enqeueing and cloning
Realising that there is a pattern in that
* first dccp_entail() is called to enqueue a new skb;
* then skb_clone() is called to transmit a clone of that skb,
this patch integrates these two interrelated steps into dccp_entail.
Note: the return value of skb_clone is not checked. It may be an idea to add a
warning if this occurs. In both instances, however, a timer is set for
retransmission, so that cloning is re-tried via dccp_retransmit_skb().
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
---
net/dccp/output.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -26,11 +26,13 @@ static inline void dccp_event_ack_sent(s
inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK);
}
-static void dccp_skb_entail(struct sock *sk, struct sk_buff *skb)
+/* enqueue @skb on sk_send_head for retransmission, return clone to send now */
+static struct sk_buff *dccp_skb_entail(struct sock *sk, struct sk_buff *skb)
{
skb_set_owner_w(skb, sk);
WARN_ON(sk->sk_send_head);
sk->sk_send_head = skb;
+ return skb_clone(sk->sk_send_head, gfp_any());
}
/*
@@ -536,8 +538,7 @@ int dccp_connect(struct sock *sk)
DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_REQUEST;
- dccp_skb_entail(sk, skb);
- dccp_transmit_skb(sk, skb_clone(skb, GFP_KERNEL));
+ dccp_transmit_skb(sk, dccp_skb_entail(sk, skb));
DCCP_INC_STATS(DCCP_MIB_ACTIVEOPENS);
/* Timer for repeating the REQUEST until an answer. */
@@ -662,8 +663,7 @@ void dccp_send_close(struct sock *sk, co
DCCP_SKB_CB(skb)->dccpd_type = DCCP_PKT_CLOSE;
if (active) {
- dccp_skb_entail(sk, skb);
- dccp_transmit_skb(sk, skb_clone(skb, prio));
+ skb = dccp_skb_entail(sk, skb);
/*
* Retransmission timer for active-close: RFC 4340, 8.3 requires
* to retransmit the Close/CloseReq until the CLOSING/CLOSEREQ
@@ -676,6 +676,6 @@ void dccp_send_close(struct sock *sk, co
*/
inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
DCCP_TIMEOUT_INIT, DCCP_RTO_MAX);
- } else
- dccp_transmit_skb(sk, skb);
+ }
+ dccp_transmit_skb(sk, skb);
}
next prev parent reply other threads:[~2008-06-05 14:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4846462F.3020004@cn.fujitsu.com>
[not found] ` <20080604132152.GA17595@ghostprotocols.net>
[not found] ` <20080604133849.GA5583@gerrit.erg.abdn.ac.uk>
[not found] ` <20080604154452.GB4625@ghostprotocols.net>
[not found] ` <20080604155540.GA16194@gerrit.erg.abdn.ac.uk>
2008-06-05 14:44 ` [dccp] [RFC/RFT] [Patch 0/2]: Test-tree update to handle retransmissions correctly Gerrit Renker
2008-06-05 14:45 ` [dccp] [RFC/RFT] [Patch 1/2]: Allow to distinguish original and retransmitted packets Gerrit Renker
2008-06-05 14:46 ` Gerrit Renker
2008-06-05 14:47 ` Gerrit Renker [this message]
2008-06-05 20:27 ` Arnaldo Carvalho de Melo
2008-06-06 8:51 ` Gerrit Renker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080605144712.GD8800@gerrit.erg.abdn.ac.uk \
--to=gerrit@erg.abdn.ac.uk \
--cc=dccp@vger.kernel.orgu \
--cc=netdev@vger.kernel.org \
--cc=yjwei@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).