From: Vinicius Costa Gomes <vinicius.gomes@intel.com>
To: Zh-yuan Ye <ye.zh-yuan@socionext.com>, netdev@vger.kernel.org
Cc: okamoto.satoru@socionext.com, kojima.masahisa@socionext.com,
kuba@kernel.org, Zh-yuan Ye <ye.zh-yuan@socionext.com>
Subject: Re: [PATCH net v3] net: cbs: Fix software cbs to consider packet sending time
Date: Tue, 24 Mar 2020 12:38:22 -0700 [thread overview]
Message-ID: <87k139czm9.fsf@intel.com> (raw)
In-Reply-To: <20200324082825.3095-1-ye.zh-yuan@socionext.com>
Zh-yuan Ye <ye.zh-yuan@socionext.com> writes:
> Currently the software CBS does not consider the packet sending time
> when depleting the credits. It caused the throughput to be
> Idleslope[kbps] * (Port transmit rate[kbps] / |Sendslope[kbps]|) where
> Idleslope * (Port transmit rate / (Idleslope + |Sendslope|)) = Idleslope
> is expected. In order to fix the issue above, this patch takes the time
> when the packet sending completes into account by moving the anchor time
> variable "last" ahead to the send completion time upon transmission and
> adding wait when the next dequeue request comes before the send
> completion time of the previous packet.
>
> changelog:
> V2->V3:
> - remove unnecessary whitespace cleanup
> - add the checks if port_rate is 0 before division
>
> V1->V2:
> - combine variable "send_completed" into "last"
> - add the comment for estimate of the packet sending
>
> Fixes: 585d763af09c ("net/sched: Introduce Credit Based Shaper (CBS) qdisc")
> Signed-off-by: Zh-yuan Ye <ye.zh-yuan@socionext.com>
> Reviewed-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
> ---
> net/sched/sch_cbs.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
> index b2905b03a432..2eaac2ff380f 100644
> --- a/net/sched/sch_cbs.c
> +++ b/net/sched/sch_cbs.c
> @@ -181,6 +181,11 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
> s64 credits;
> int len;
>
> + /* The previous packet is still being sent */
> + if (now < q->last) {
> + qdisc_watchdog_schedule_ns(&q->watchdog, q->last);
> + return NULL;
> + }
> if (q->credits < 0) {
> credits = timediff_to_credits(now - q->last, q->idleslope);
>
> @@ -212,7 +217,12 @@ static struct sk_buff *cbs_dequeue_soft(struct Qdisc *sch)
> credits += q->credits;
>
> q->credits = max_t(s64, credits, q->locredit);
> - q->last = now;
> + /* Estimate of the transmission of the last byte of the packet in ns */
> + if (unlikely(atomic64_read(&q->port_rate) == 0))
Minor suggestion. I would only move 'atomic64_read()' to outside the
condition, so reading 'q->port_rate' is done only once.
It's looking good. When I saw the problems that the software mode
had with larger packets I should have thought of something like this.
Thanks for solving this.
Cheers,
--
Vinicius
next prev parent reply other threads:[~2020-03-24 19:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 8:28 [PATCH net v3] net: cbs: Fix software cbs to consider packet sending time Zh-yuan Ye
2020-03-24 19:38 ` Vinicius Costa Gomes [this message]
2020-03-24 23:15 ` David Miller
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=87k139czm9.fsf@intel.com \
--to=vinicius.gomes@intel.com \
--cc=kojima.masahisa@socionext.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=okamoto.satoru@socionext.com \
--cc=ye.zh-yuan@socionext.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).