From patchwork Wed Sep 2 02:44:45 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ivo Calado X-Patchwork-Id: 32784 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 3DD41B7B9E for ; Wed, 2 Sep 2009 12:45:18 +1000 (EST) Received: by ozlabs.org (Postfix) id 31D65DDD0B; Wed, 2 Sep 2009 12:45:18 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9F58FDDD04 for ; Wed, 2 Sep 2009 12:45:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755574AbZIBCpF (ORCPT ); Tue, 1 Sep 2009 22:45:05 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755570AbZIBCpF (ORCPT ); Tue, 1 Sep 2009 22:45:05 -0400 Received: from mail-yx0-f181.google.com ([209.85.210.181]:49427 "EHLO mail-yx0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755569AbZIBCpC convert rfc822-to-8bit (ORCPT ); Tue, 1 Sep 2009 22:45:02 -0400 Received: by mail-yx0-f181.google.com with SMTP id 11so1664366yxe.4 for ; Tue, 01 Sep 2009 19:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=URti3z+v6/08FVl+09AaQh45xSpGW9ANp9kvBfhyVDw=; b=smntCB02wM3SAtJRjDEMZpS20T54JyXQjJQgKAp/9MVpScNz24wPDHml3nQprEXupW C1j3c4WX8YPy7EJ1i0C97MYI9+3Q37b/21HB+K0UZ4MOO3v55IeHPN1FkrrCHzEw5BQg hYZLsC8+sDgdVCpQq3on1jgO0cINBp+WRc3Vw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=GV89CkREZrCm8dyXB03TlnitaukrJ0hHySQ2gXkWcNjDdvzRlWrxGH7LPdDZ9YJ2gG 05u12SoUdg8VxxLd82hYIPYXk8N/4qDQATdhZKYU5VxY57lHmmsmnJIiw6P7swFAKXaZ /0Jn+HLB2r7ubsQFJEtY1lEZNNLryINKjJ1KI= MIME-Version: 1.0 Received: by 10.150.103.8 with SMTP id a8mr11632369ybc.181.1251859505160; Tue, 01 Sep 2009 19:45:05 -0700 (PDT) In-Reply-To: References: From: Ivo Calado Date: Tue, 1 Sep 2009 23:44:45 -0300 X-Google-Sender-Auth: ff8fe92c717b5205 Message-ID: Subject: [PATCH 2/5] Implement loss counting on TFRC-SP receiver To: dccp Cc: netdev Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Implement loss counting on TFRC-SP receiver. Consider transmission's hole size as loss count. Changes:  - Adds field li_losses to tfrc_loss_interval to track loss count per interval  - Adds field num_losses to tfrc_rx_hist, used to store loss count per loss event  - Adds dccp_loss_count function to net/dccp/dccp.h, responsible for loss count using sequence numbers Signed-off-by: Ivo Calado, Erivaldo Xavier, Leandro Sales , , Index: b/net/dccp/ccids/lib/loss_interval_sp.c =================================================================== --- a/net/dccp/ccids/lib/loss_interval_sp.c     2009-08-26 21:50:23.000000000 -0300 +++ b/net/dccp/ccids/lib/loss_interval_sp.c     2009-08-26 22:51:32.000000000 -0300 @@ -184,6 +184,7 @@                s64 len = dccp_delta_seqno(cur->li_seqno, cong_evt_seqno);                if ((len <= 0)||(!tfrc_lh_closed_check(cur, cong_evt->tfrchrx_ccval)))                { +                       cur->li_losses += rh->num_losses;                        return false;                } @@ -201,6 +202,7 @@        cur->li_seqno     = cong_evt_seqno;        cur->li_ccval     = cong_evt->tfrchrx_ccval;        cur->li_is_closed = false; +       cur->li_losses    = rh->num_losses;        if (++lh->counter == 1)                lh->i_mean = cur->li_length = (*calc_first_li)(sk); Index: b/net/dccp/ccids/lib/loss_interval_sp.h =================================================================== --- a/net/dccp/ccids/lib/loss_interval_sp.h     2009-08-26 21:30:11.000000000 -0300 +++ b/net/dccp/ccids/lib/loss_interval_sp.h     2009-08-26 22:52:20.000000000 -0300 @@ -30,12 +30,14 @@  *  @li_ccval:         The CCVal belonging to @li_seqno  *  @li_is_closed:     Whether @li_seqno is older than 1 RTT  *  @li_length:                Loss interval sequence length + *  @li_losses:        Number of losses counted on this interval  */  struct tfrc_loss_interval {        u64              li_seqno:48,                         li_ccval:4,                         li_is_closed:1;        u32              li_length; +       u32              li_losses;  };  /** Index: b/net/dccp/ccids/lib/packet_history_sp.c =================================================================== --- a/net/dccp/ccids/lib/packet_history_sp.c    2009-08-26 21:46:36.000000000 -0300 +++ b/net/dccp/ccids/lib/packet_history_sp.c    2009-08-26 22:55:01.000000000 -0300 @@ -236,6 +236,7 @@        if (likely(dccp_delta_seqno(s2, s3) > 0)) {     /* S2  <  S3 */                h->loss_count = 3;                tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 3), skb, n3); +               h->num_losses = dccp_loss_count(s2, s3, n3);                return 1;        } @@ -248,6 +249,7 @@                tfrc_rx_hist_swap(h, 2, 3);                tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 2), skb, n3);                h->loss_count = 3; +               h->num_losses = dccp_loss_count(s1, s3, n3);                return 1;        } @@ -283,6 +285,7 @@        h->loss_start = tfrc_rx_hist_index(h, 3);        tfrc_sp_rx_hist_entry_from_skb(tfrc_rx_hist_entry(h, 1), skb, n3);        h->loss_count = 3; +       h->num_losses = dccp_loss_count(s0, s3, n3);        return 1;  } Index: b/net/dccp/ccids/lib/packet_history_sp.h =================================================================== --- a/net/dccp/ccids/lib/packet_history_sp.h    2009-08-26 21:40:55.000000000 -0300 +++ b/net/dccp/ccids/lib/packet_history_sp.h    2009-08-26 22:55:58.000000000 -0300 @@ -101,6 +101,7 @@  * @packet_size:       Packet size in bytes (as per RFC 3448, 3.1)  * @bytes_recvd:       Number of bytes received since @bytes_start  * @bytes_start:       Start time for counting @bytes_recvd + * @num_losses:        Number of losses contained on this loss event  */  struct tfrc_rx_hist {        struct tfrc_rx_hist_entry *ring[TFRC_NDUPACK + 1]; @@ -113,6 +114,7 @@        u32                       packet_size,                                  bytes_recvd;        ktime_t                   bytes_start; +       u8                        num_losses;  };  /** --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: b/net/dccp/dccp.h =================================================================== --- a/net/dccp/dccp.h   2009-08-25 20:21:45.000000000 -0300 +++ b/net/dccp/dccp.h   2009-08-26 22:59:10.000000000 -0300 @@ -168,6 +168,21 @@        return (u64)delta <= ndp + 1;  } +static inline u64 dccp_loss_count(const u64 s1, const u64 s2, const u64 ndp) +{ +       s64 delta, count; + +       delta = dccp_delta_seqno(s1, s2); +       WARN_ON(delta < 0); + +       count = ndp + 1; +       count -= delta; + +       count = (count > 0)? count: 0; + +       return (u64) count; +} +  enum {        DCCP_MIB_NUM = 0,        DCCP_MIB_ACTIVEOPENS,                   /* ActiveOpens */