From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id D70BE3BA8E for ; Mon, 21 May 2018 19:45:17 -0400 (EDT) Received: by mail-qt0-x242.google.com with SMTP id j42-v6so21141997qtj.12 for ; Mon, 21 May 2018 16:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=nGVVgDenzjKcoGZpbVH8HtGGK6xB8QPDORQ20SvMKD4=; b=dXlqDaz7DGyxTtkteBE86YAgZnY9qGgmc4tYr7V6QwOO04trdPcORmszs5TOHD9SZA 7NeU/RHvHcwlRsiThpVpkTzuT6ZhnbWqzoiBalpAw2Anvg+PIJSuGSpFexOJgEo4/NSA FSkGGC4Lx2pd2F2J+UWuFDIobAnb7/6TRojdwGo1Ps4HQFD/nQ0nBIJFEI0r19+cp/B/ 0hFTSMncKxVhafhAqDp8x6bsEKsDJP2UgifnVSaAT58UuVllKX0+XfbIqVeeSLGmrcYH haxbLVLstOOax9VVtYXCgaJrbTscpMsQxHZ1TxX+f2CKuVHlMuWeLH9+1AKSsuSYtC7j F5lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=nGVVgDenzjKcoGZpbVH8HtGGK6xB8QPDORQ20SvMKD4=; b=Xql0aVBxVZdGe/nEEDSAr3FrikduYTD1gg+d4rXUJN2XWu3GSHIkEq/JFYyCf3At4w 3QqpvCOHfTS8cr73VOolHfo8Lih64Tx8jU/FvcGMsRLKRdi7DxyK5cLl0tNnYLkZhYV4 05BPgo/C9gj8tLoY+zgIA+DsjcgPyjOuoTuU06mKk0GlXt20KZMAeQ1il4QhphQQTbZS oPXWEMkPFjlDuGeB9KiuOX7/SiHjI4ObWhMImECy74AS031XAn8VcXA3okos//whJzK7 SUCUoLfSfXJV8qzoxrrdEgzIODedVxU7b7R2JAeUAGOD5qJcQSGPtBp7NTYVRXDXj9Wc yapA== X-Gm-Message-State: ALKqPweH/aWnOphserrUc0i6RF68zuJAx2r4HdSFAaeKHS+9p2gzpF86 dgnDlyiNYFjVut7JAmPIwqS3a/RD X-Google-Smtp-Source: AB8JxZp6ncRnLVAzjlybHGu9HzMjksKsfMauPeIayI0Rq4eSqN1g0d+KsHS+HeAlIyEP6ibTTQ1zTA== X-Received: by 2002:aed:3595:: with SMTP id c21-v6mr20583223qte.203.1526946317105; Mon, 21 May 2018 16:45:17 -0700 (PDT) Received: from localhost.localdomain ([45.4.239.227]) by smtp.gmail.com with ESMTPSA id y13-v6sm10638485qti.85.2018.05.21.16.45.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 May 2018 16:45:16 -0700 (PDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 9AE92181111; Mon, 21 May 2018 20:45:13 -0300 (-03) Date: Mon, 21 May 2018 20:45:13 -0300 From: Marcelo Ricardo Leitner To: Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= Cc: netdev@vger.kernel.org, cake@lists.bufferbloat.net Message-ID: <20180521234513.GH26212@localhost.localdomain> References: <152693459693.32668.4272129427997495747.stgit@alrua-kau> <152693495874.32668.11244869690098290078.stgit@alrua-kau> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <152693495874.32668.11244869690098290078.stgit@alrua-kau> User-Agent: Mutt/1.9.2 (2017-12-15) Subject: Re: [Cake] [PATCH net-next v14 6/7] sch_cake: Add overhead compensation support to the rate shaper X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 23:45:17 -0000 On Mon, May 21, 2018 at 10:35:58PM +0200, Toke Høiland-Jørgensen wrote: > +static u32 cake_overhead(struct cake_sched_data *q, const struct sk_buff *skb) > +{ > + const struct skb_shared_info *shinfo = skb_shinfo(skb); > + unsigned int hdr_len, last_len = 0; > + u32 off = skb_network_offset(skb); > + u32 len = qdisc_pkt_len(skb); > + u16 segs = 1; > + > + q->avg_netoff = cake_ewma(q->avg_netoff, off << 16, 8); > + > + if (!shinfo->gso_size) > + return cake_calc_overhead(q, len, off); > + > + /* borrowed from qdisc_pkt_len_init() */ > + hdr_len = skb_transport_header(skb) - skb_mac_header(skb); > + > + /* + transport layer */ > + if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | > + SKB_GSO_TCPV6))) { > + const struct tcphdr *th; > + struct tcphdr _tcphdr; > + > + th = skb_header_pointer(skb, skb_transport_offset(skb), > + sizeof(_tcphdr), &_tcphdr); > + if (likely(th)) > + hdr_len += __tcp_hdrlen(th); > + } else { I didn't see some code limiting GSO packets to just TCP or UDP. Is it safe to assume that this packet is an UDP one, and not SCTP or ESP, for example? > + struct udphdr _udphdr; > + > + if (skb_header_pointer(skb, skb_transport_offset(skb), > + sizeof(_udphdr), &_udphdr)) > + hdr_len += sizeof(struct udphdr); > + } > + > + if (unlikely(shinfo->gso_type & SKB_GSO_DODGY)) > + segs = DIV_ROUND_UP(skb->len - hdr_len, > + shinfo->gso_size); > + else > + segs = shinfo->gso_segs; > + > + len = shinfo->gso_size + hdr_len; > + last_len = skb->len - shinfo->gso_size * (segs - 1); > + > + return (cake_calc_overhead(q, len, off) * (segs - 1) + > + cake_calc_overhead(q, last_len, off)); > +} > +