lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130521203945.GA1634@minipsycho.orion>
Date:	Tue, 21 May 2013 22:39:45 +0200
From:	Jiri Pirko <jiri@...nulli.us>
To:	Eric Dumazet <eric.dumazet@...il.com>
Cc:	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>,
	Ben Hutchings <ben@...adent.org.uk>
Subject: Re: [PATCH net-next] sch_tbf: segment too big GSO packets

Tue, May 21, 2013 at 08:16:46PM CEST, eric.dumazet@...il.com wrote:
>From: Eric Dumazet <edumazet@...gle.com>
>
>If a GSO packet has a length above tbf burst limit, the packet
>is currently silently dropped.
>
>Current way to handle this is to set the device in non GSO/TSO mode, or
>setting high bursts, and its sub optimal.
>
>We can actually segment too big GSO packets, and send individual
>segments as tbf parameters allow, allowing for better interoperability.
>
>Signed-off-by: Eric Dumazet <edumazet@...gle.com>
>Cc: Ben Hutchings <ben@...adent.org.uk>
>Cc: Jiri Pirko <jiri@...nulli.us>
>Cc: Jamal Hadi Salim <jhs@...atatu.com>

Reviewed-by: Jiri Pirko <jiri@...nulli.us>


>---
> net/sched/sch_tbf.c |   47 ++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 45 insertions(+), 2 deletions(-)
>
>diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
>index c8388f3..38008b0 100644
>--- a/net/sched/sch_tbf.c
>+++ b/net/sched/sch_tbf.c
>@@ -116,14 +116,57 @@ struct tbf_sched_data {
> 	struct qdisc_watchdog watchdog;	/* Watchdog timer */
> };
> 
>+
>+/* GSO packet is too big, segment it so that tbf can transmit
>+ * each segment in time
>+ */
>+static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch)
>+{
>+	struct tbf_sched_data *q = qdisc_priv(sch);
>+	struct sk_buff *segs, *nskb;
>+	netdev_features_t features = netif_skb_features(skb);
>+	int ret, nb;
>+
>+	segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);
>+
>+	if (IS_ERR_OR_NULL(segs))
>+		return qdisc_reshape_fail(skb, sch);
>+
>+	nb = 0;
>+	while (segs) {
>+		nskb = segs->next;
>+		segs->next = NULL;
>+		if (likely(segs->len <= q->max_size)) {
>+			qdisc_skb_cb(segs)->pkt_len = segs->len;
>+			ret = qdisc_enqueue(segs, q->qdisc);
>+		} else {
>+			ret = qdisc_reshape_fail(skb, sch);
>+		}
>+		if (ret != NET_XMIT_SUCCESS) {
>+			if (net_xmit_drop_count(ret))
>+				sch->qstats.drops++;
>+		} else {
>+			nb++;
>+		}
>+		segs = nskb;
>+	}
>+	sch->q.qlen += nb;
>+	if (nb > 1)
>+		qdisc_tree_decrease_qlen(sch, 1 - nb);
>+	consume_skb(skb);
>+	return nb > 0 ? NET_XMIT_SUCCESS : NET_XMIT_DROP;
>+}
>+
> static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch)
> {
> 	struct tbf_sched_data *q = qdisc_priv(sch);
> 	int ret;
> 
>-	if (qdisc_pkt_len(skb) > q->max_size)
>+	if (qdisc_pkt_len(skb) > q->max_size) {
>+		if (skb_is_gso(skb))
>+			return tbf_segment(skb, sch);
> 		return qdisc_reshape_fail(skb, sch);
>-
>+	}
> 	ret = qdisc_enqueue(skb, q->qdisc);
> 	if (ret != NET_XMIT_SUCCESS) {
> 		if (net_xmit_drop_count(ret))
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ