From patchwork Tue Aug 9 23:22:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9272371 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 CC6AF60839 for ; Tue, 9 Aug 2016 23:27:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A79E825227 for ; Tue, 9 Aug 2016 23:27:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9CAA227FC0; Tue, 9 Aug 2016 23:27:51 +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 22D1D25227 for ; Tue, 9 Aug 2016 23:27:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932713AbcHIXX3 (ORCPT ); Tue, 9 Aug 2016 19:23:29 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37892 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbcHIXX0 (ORCPT ); Tue, 9 Aug 2016 19:23:26 -0400 Received: by mail-wm0-f43.google.com with SMTP id o80so66905290wme.1 for ; Tue, 09 Aug 2016 16:23:25 -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=9WS9/pi6V3hi7I9q2H0NnHtjFV7U2k/qhbZZe1xLuO8=; b=eYaPaqru0m2YIyAU0pjLBFv7ftXBHn5a3UC9FE8V63SepT6tyWXak6i0m3jjo9zf0b RNSWkH6Dwg41kuopQ1w7GwP1eY24A2aDkfGWzUtd9zfBNrOA9Ifp1GsANPDQg3AAx0GN H6YTFfDFAjFyS8mJtWOTIOTmbCIFDiyu0lYGA= 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=9WS9/pi6V3hi7I9q2H0NnHtjFV7U2k/qhbZZe1xLuO8=; b=dCWjKb15QJtJ6DZeyHg+W3WWmwW6+Yy8JgVQJQQjZr5JrnokWz6p6kECh2/U23YIum 8pO+OjrYDBRPLqvbxP7NLf469xIn+J2rmMr9ptnjlTBd696Nrs3L7jKap7QhCxxAtPOJ Y7b1p2pI/+bGrM8qp4fp8no128GGMl1zxmMyCcRwbuXk3pvEgQ1otRRM1nzRHo1z1kmb g572jxQbJsSojNIlVM0yfH9IWmugBu3aqPfGTnWe+X+Z0S/RYT3WyE0xfkUY8nPlslD2 HQM1fZXBVo6hOKPVdQXXT3u9PRWb2pKMomViryShS3OVoG3rcqszl3bVtfpw4SoAqfMp iYHg== X-Gm-Message-State: AEkooutPz5gPfKW5WJl57Cd+6J+X+T4lRXia7H2vROTDFnhIG10mXGSYSSi4bmcsRsmynYfY X-Received: by 10.25.87.2 with SMTP id l2mr128336lfb.170.1470785004705; Tue, 09 Aug 2016 16:23:24 -0700 (PDT) Received: from localhost.localdomain (88-203-94-178.pool.ukrtel.net. [178.94.203.88]) by smtp.gmail.com with ESMTPSA id s2sm904627lja.35.2016.08.09.16.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Aug 2016 16:23:24 -0700 (PDT) From: Ivan Khoronzhuk To: netdev@vger.kernel.org, mugunthanvnm@ti.com, grygorii.strashko@ti.com Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, dlide@ti.com, Ivan Khoronzhuk Subject: [PATCH v3 01/13] net: ethernet: ti: cpsw: simplify submit routine Date: Wed, 10 Aug 2016 02:22:32 +0300 Message-Id: <1470784964-26440-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470784964-26440-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470784964-26440-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 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. Reviewed-by: Mugunthan V N Reviewed-by: Grygorii Strashko Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) 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;