From patchwork Sat Dec 10 12:23:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9469261 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2878160234 for ; Sat, 10 Dec 2016 12:24:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A72D2840B for ; Sat, 10 Dec 2016 12:24:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E93B285A8; Sat, 10 Dec 2016 12:24:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A0BD2840B for ; Sat, 10 Dec 2016 12:24:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753306AbcLJMYG (ORCPT ); Sat, 10 Dec 2016 07:24:06 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:34612 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbcLJMYB (ORCPT ); Sat, 10 Dec 2016 07:24:01 -0500 Received: by mail-lf0-f41.google.com with SMTP id y21so17043443lfa.1 for ; Sat, 10 Dec 2016 04:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=meVR1xa6+MjPQ0e7CwQEQ6HZCEA1D+DKrLSPVy3k2T4=; b=cE3iNS1XBQVyoKx7745iBUDVyBgnHDgG8HuzDgoqml0WHmecSz463tMEuXIGlWzSIQ 7FdirvQfbSJUH6Nko7AQyXu5R1zCKUVqPEqg5sKqZct8SivkSAbMQI5jWd8/nJ9A4Kj8 4Yc4Ze2vPFRJCH+yP54sy8TnJUFxyRNZjH/T4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=meVR1xa6+MjPQ0e7CwQEQ6HZCEA1D+DKrLSPVy3k2T4=; b=a+B5IgM9ti83T4HdtyLRPLK4JDh7pvdj3CvxZzNoEw4fcRmLioNsCGulNESQ5zjsq/ 7JEiIqmvZ6hhORutmu71P64PQo97C30vjnLn5OVGQqQsFv57B1XG7JADYc7aN+1mId4t iGzywmuLMqlkoHHfSvusfOg4L8OwAFVxiKAsEcttmbk1M91nXgiTO/cYOhjw3PYxjI5J g2OXJTPMWUPS3baeHrpz+j20XfP0Qr5mCwHG6T8G1y0XKx7ONLGx6Nj7JCBrkrAYtLVc je7mhdvnZxNo0FO9Bx94H4oZEgG/odIKWoeh0mx1hRYtZ4i9+p8gdKMF8ZA5597Jiwi/ MqdA== X-Gm-Message-State: AKaTC02mUt3HSXILFXjX5O2ZLygKYFz+U5ODDOWPhwTyBjMWMxIY/r16hFA4+/tj3bz8n0gt X-Received: by 10.46.69.11 with SMTP id s11mr36894358lja.44.1481372639444; Sat, 10 Dec 2016 04:23:59 -0800 (PST) Received: from localhost.localdomain (183-224-132-95.pool.ukrtel.net. [95.132.224.183]) by smtp.gmail.com with ESMTPSA id f14sm2507060lff.40.2016.12.10.04.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Dec 2016 04:23:59 -0800 (PST) From: Ivan Khoronzhuk To: mugunthanvnm@ti.com, grygorii.strashko@ti.com Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH 5/5] net: ethernet: ti: cpsw: sync rates for channels in dual emac mode Date: Sat, 10 Dec 2016 14:23:50 +0200 Message-Id: <1481372630-14914-6-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481372630-14914-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1481372630-14914-1-git-send-email-ivan.khoronzhuk@linaro.org> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The channels are common for both ndevs in dual emac mode. Hence, keep in sync their rates. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 7ccfa63..b203143 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -2020,9 +2020,10 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate) { struct cpsw_priv *priv = netdev_priv(ndev); struct cpsw_common *cpsw = priv->cpsw; + struct cpsw_slave *slave; u32 min_rate; u32 ch_rate; - int ret; + int i, ret; ch_rate = netdev_get_tx_queue(ndev, queue)->tx_maxrate; if (ch_rate == rate) @@ -2053,6 +2054,15 @@ static int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate) if (ret) return ret; + /* update rates for slaves tx queues */ + for (i = 0; i < cpsw->data.slaves; i++) { + slave = &cpsw->slaves[i]; + if (!slave->ndev) + continue; + + netdev_get_tx_queue(slave->ndev, queue)->tx_maxrate = rate; + } + cpsw_split_res(ndev); return ret; }