From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.toke.dk (mail.toke.dk [52.28.52.200]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id ED27F3BA8E for ; Tue, 22 May 2018 04:44:57 -0400 (EDT) Date: Tue, 22 May 2018 10:44:53 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toke.dk; s=20161023; t=1526978695; bh=YbPMDsfsJZfi+MznO3/5sWHoc7Kq5JNH7xKrSTnIrJE=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=G8koLT4C+5v6XDWbbzJ6LTUcSEB6Q3pH3euZfn9C/tz4ZWrgXDmQzWNp99P1eUX+1 RDVWzUl1OnGzv5CcskoHOivIFQzPT5BoJKlmtmrrO9vArAaRNzyYFUQq150L6rE5qs Q6OXVBwkuYNCNNZwK9PUvmnngwi06v7XL5V5mpcDmwEWfxdeAOnMuNDtAxHg9yt0ZC RKwoQjAH9Cg5Cfpj3YwVC9m4PDsqeabfFHhHHvXPUkfA0cavhy2tlMJn+Hex9R0xPb qmIpdAt8MzNB40JTqdp+XRCJG1xEBYH+ty8Ymap6PirRl6bZGvMMa82a7iKhPXlPtH C7wwZmcv7I4Dg== In-Reply-To: <20180521234513.GH26212@localhost.localdomain> References: <152693459693.32668.4272129427997495747.stgit@alrua-kau> <152693495874.32668.11244869690098290078.stgit@alrua-kau> <20180521234513.GH26212@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: Marcelo Ricardo Leitner CC: netdev@vger.kernel.org,cake@lists.bufferbloat.net From: =?ISO-8859-1?Q?Toke_H=F8iland-J=F8rgensen?= X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <52F9132E-4FDC-495A-A020-BCD963B3E3CF@toke.dk> 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: Tue, 22 May 2018 08:44:58 -0000 On 22 May 2018 01:45:13 CEST, Marcelo Ricardo Leitner wrote: >On Mon, May 21, 2018 at 10:35:58PM +0200, Toke H=C3=B8iland-J=C3=B8rgense= n wrote: >> +static u32 cake_overhead(struct cake_sched_data *q, const struct >sk_buff *skb) >> +{ >> + const struct skb_shared_info *shinfo =3D skb_shinfo(skb); >> + unsigned int hdr_len, last_len =3D 0; >> + u32 off =3D skb_network_offset(skb); >> + u32 len =3D qdisc_pkt_len(skb); >> + u16 segs =3D 1; >> + >> + q->avg_netoff =3D 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 =3D 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 =3D skb_header_pointer(skb, skb_transport_offset(skb), >> + sizeof(_tcphdr), &_tcphdr); >> + if (likely(th)) >> + hdr_len +=3D __tcp_hdrlen(th); >> + } else { > >I didn't see some code limiting GSO packets to just TCP or UDP=2E Is it >safe to assume that this packet is an UDP one, and not SCTP or ESP, >for example? As the comment says, I nicked this from the qdisc init code=2E So I assume it's safe? :) >> + struct udphdr _udphdr; >> + >> + if (skb_header_pointer(skb, skb_transport_offset(skb), >> + sizeof(_udphdr), &_udphdr)) >> + hdr_len +=3D sizeof(struct udphdr); >> + } >> + >> + if (unlikely(shinfo->gso_type & SKB_GSO_DODGY)) >> + segs =3D DIV_ROUND_UP(skb->len - hdr_len, >> + shinfo->gso_size); >> + else >> + segs =3D shinfo->gso_segs; >> + >> + len =3D shinfo->gso_size + hdr_len; >> + last_len =3D skb->len - shinfo->gso_size * (segs - 1); >> + >> + return (cake_calc_overhead(q, len, off) * (segs - 1) + >> + cake_calc_overhead(q, last_len, off)); >> +} >> +