From patchwork Thu Jan 16 03:09:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 311551 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id BDB162C0098 for ; Thu, 16 Jan 2014 14:09:51 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752751AbaAPDJq (ORCPT ); Wed, 15 Jan 2014 22:09:46 -0500 Received: from szxga02-in.huawei.com ([119.145.14.65]:20689 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752522AbaAPDJo (ORCPT ); Wed, 15 Jan 2014 22:09:44 -0500 Received: from 172.24.2.119 (EHLO szxeml212-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BOP64576; Thu, 16 Jan 2014 11:09:41 +0800 (CST) Received: from SZXEML453-HUB.china.huawei.com (10.82.67.196) by szxeml212-edg.china.huawei.com (172.24.2.181) with Microsoft SMTP Server (TLS) id 14.3.158.1; Thu, 16 Jan 2014 11:09:16 +0800 Received: from localhost (10.177.18.231) by SZXEML453-HUB.china.huawei.com (10.82.67.196) with Microsoft SMTP Server id 14.3.158.1; Thu, 16 Jan 2014 11:09:15 +0800 From: Yang Yingliang To: CC: , Subject: [PATCH iproute2 v2 1/2] tbf: support sending burst/mtu to kernel directly Date: Thu, 16 Jan 2014 11:09:13 +0800 Message-ID: <1389841754-22008-2-git-send-email-yangyingliang@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 In-Reply-To: <1389841754-22008-1-git-send-email-yangyingliang@huawei.com> References: <1389841754-22008-1-git-send-email-yangyingliang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.18.231] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org To avoid loss when transforming burst to buffer in userspace, send burst/mtu to kernel directly. Kernel commit 2e04ad424b("sch_tbf: add TBF_BURST/TBF_PBURST attribute") make it can handle burst/mtu. Cc: Eric Dumazet Signed-off-by: Yang Yingliang --- tc/q_tbf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tc/q_tbf.c b/tc/q_tbf.c index 2fbfd3b..f3022b6 100644 --- a/tc/q_tbf.c +++ b/tc/q_tbf.c @@ -232,12 +232,14 @@ static int tbf_parse_opt(struct qdisc_util *qu, int argc, char **argv, struct nl tail = NLMSG_TAIL(n); addattr_l(n, 1024, TCA_OPTIONS, NULL, 0); addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt)); + addattr_l(n, 2124, TCA_TBF_BURST, &buffer, sizeof(buffer)); if (rate64 >= (1ULL << 32)) addattr_l(n, 2124, TCA_TBF_RATE64, &rate64, sizeof(rate64)); addattr_l(n, 3024, TCA_TBF_RTAB, rtab, 1024); if (opt.peakrate.rate) { if (prate64 >= (1ULL << 32)) addattr_l(n, 3124, TCA_TBF_PRATE64, &prate64, sizeof(prate64)); + addattr_l(n, 3224, TCA_TBF_PBURST, &mtu, sizeof(mtu)); addattr_l(n, 4096, TCA_TBF_PTAB, ptab, 1024); } tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;