From patchwork Thu Aug 4 21:14:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 73322 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1600772qga; Thu, 4 Aug 2016 14:15:42 -0700 (PDT) X-Received: by 10.66.86.170 with SMTP id q10mr129208136paz.105.1470345328949; Thu, 04 Aug 2016 14:15:28 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si16382542pfk.77.2016.08.04.14.15.28; Thu, 04 Aug 2016 14:15:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966820AbcHDVPY (ORCPT + 27 others); Thu, 4 Aug 2016 17:15:24 -0400 Received: from mail-lf0-f47.google.com ([209.85.215.47]:34064 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966700AbcHDVOs (ORCPT ); Thu, 4 Aug 2016 17:14:48 -0400 Received: by mail-lf0-f47.google.com with SMTP id l69so190481778lfg.1 for ; Thu, 04 Aug 2016 14:14:47 -0700 (PDT) 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=fVi+lXO/Zz5aqJXoh6qUxwJGzevzn1AlonqcD9ox5k4=; b=NoZnJowfcOeyg0EOqPN0s1KFuXwHhS/uHQMQcNywQqe+MPO5J8XY7ykdiWdPLBpFQe kMEG8bMJxLDFCHxn05Dx/QwyzVLk+9gKfGdLYEqWtc+Gs/fi9l9G8h9/ymr6MSL+oco9 pbmlPJRPS0UJIa4VVWfGIUGCiO6fefp8X3vps= 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=fVi+lXO/Zz5aqJXoh6qUxwJGzevzn1AlonqcD9ox5k4=; b=mapyFMpNGFZpukPWZRnMuVcDuyZmjz7wM1Fhv99UFeni2F9uMDYgCAu3mS74ioXI1s iqhuinT12eH9b3/flnROkrDIc9wwnMAlRLNVzUZ087rmdsuu7IP6YDPVAVfLRfSE8oak vT9g8sFPgegmRBnntM4xsNjdsjxqd1DAv0PUpJtZ3mqMRw7CFqNfz7qtwet5Ts6fqm+t 5LpZT7yu85ebqdt6vC5mdGzqi7Uc2P6B98ush76g8BhqiTR/GLzAfM1lR7xN5jOOBX1R FfMHyU4WJiYXvsRa9TCN9Jj5BUIEvKQWu0tLIjUEaFGE6+D0roXWZNBH96QAg6aONupE TPtg== X-Gm-Message-State: AEkooutGr7DFb0+p1ueBDTtrOWXxjC3bt021S5FJ09SsqHbK1wTVLRW1LuFEKh9YPBx/kHBv X-Received: by 10.25.18.227 with SMTP id 96mr19297662lfs.183.1470345281280; Thu, 04 Aug 2016 14:14:41 -0700 (PDT) Received: from localhost.localdomain ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id g74sm2697427ljg.24.2016.08.04.14.14.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Aug 2016 14:14:38 -0700 (PDT) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com Cc: linux-omap@vger.kernel.org, grygorii.strashko@ti.com, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH 1/3] net: ethernet: ti: cpsw: simplify submit routine Date: Fri, 5 Aug 2016 00:14:30 +0300 Message-Id: <1470345272-874-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470345272-874-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470345272-874-1-git-send-email-ivan.khoronzhuk@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As second net dev is created only in case of dual_emac mode, port number can be figured out in simpler way. Also no need to pass redundant ndev struct. Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) -- 1.9.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index c51f346..8972bf6 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -1065,19 +1065,11 @@ static int cpsw_common_res_usage_state(struct cpsw_priv *priv) return usage_count; } -static inline int cpsw_tx_packet_submit(struct net_device *ndev, - struct cpsw_priv *priv, struct sk_buff *skb) +static inline int cpsw_tx_packet_submit(struct cpsw_priv *priv, + struct sk_buff *skb) { - if (!priv->data.dual_emac) - return cpdma_chan_submit(priv->txch, skb, skb->data, - skb->len, 0); - - if (ndev == cpsw_get_slave_ndev(priv, 0)) - return cpdma_chan_submit(priv->txch, skb, skb->data, - skb->len, 1); - else - return cpdma_chan_submit(priv->txch, skb, skb->data, - skb->len, 2); + return cpdma_chan_submit(priv->txch, skb, skb->data, skb->len, + priv->emac_port + priv->data.dual_emac); } static inline void cpsw_add_dual_emac_def_ale_entries( @@ -1406,7 +1398,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff *skb, skb_tx_timestamp(skb); - ret = cpsw_tx_packet_submit(ndev, priv, skb); + ret = cpsw_tx_packet_submit(priv, skb); if (unlikely(ret != 0)) { cpsw_err(priv, tx_err, "desc submit failed\n"); goto fail;