From patchwork Sat Aug 6 10:48:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 9266109 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 DE1A960760 for ; Sat, 6 Aug 2016 22:19:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCBF828405 for ; Sat, 6 Aug 2016 22:19:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C18C228415; Sat, 6 Aug 2016 22:19:31 +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 620D928405 for ; Sat, 6 Aug 2016 22:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbcHFWTa (ORCPT ); Sat, 6 Aug 2016 18:19:30 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33311 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbcHFWTa (ORCPT ); Sat, 6 Aug 2016 18:19:30 -0400 Received: by mail-lf0-f50.google.com with SMTP id b199so225304050lfe.0 for ; Sat, 06 Aug 2016 15:19:29 -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=azvTFrS66T1jY54bGL1ABXQYNQ4fxFKQXqUNquohMIY0KpAbIe0KNe3zJCHN8EMGpO Rf09YzHALTOYVZjeDAx2A43M3nasqiBTBsybeO/CH3Cvyvc6cdAnC+MesNr1FxF10LOJ TX0LudOcFWGAHjJ+oU4cf/yYD4vUWHzWjF3pQ= 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=PqRvz0QxV0VxNqqN3P7hmDs6KW+EfREQ3N4qBpleMvwjKWLjTBeAFJGDfsxFoH0nwv 4dIMTnQ/8sZskcFwz9+ZK/wKc4l34LKGznfuK3FjvUDE5WzbC6wNLowk/Sse4K7qwKIE RlZvVH+a4z+D8dvJGlYxeh4jrV1xi+lKqnrYuJuPYRK3/AHu9cGHPdiHmc59xvEuWh5M ditwLLBiTg6GTw/0EAXwsg0anyGIP4DWhX3UF4PXP2W/EObE3ZAfqmsKqiHG4MhQW3Il h2l2dj5+pz6q5kQoNVdAygGm/8uCVsZargUP1Y/3Fhdya7JfrS4iDit+ETCVGteDJzzU HYoQ== X-Gm-Message-State: AEkoouvbaAiyiVsUEAmgH/LN6CqgaPzR2NlBmExRxfTVl0FWwppe1uHOX+uaki97DdvL7Zh4 X-Received: by 10.25.228.203 with SMTP id x72mr1465995lfi.137.1470480539455; Sat, 06 Aug 2016 03:48:59 -0700 (PDT) Received: from localhost.localdomain (153-224-132-95.pool.ukrtel.net. [95.132.224.153]) by smtp.gmail.com with ESMTPSA id p128sm3916360lfb.32.2016.08.06.03.48.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 06 Aug 2016 03:48:58 -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 v2 01/14] net: ethernet: ti: cpsw: simplify submit routine Date: Sat, 6 Aug 2016 13:48:31 +0300 Message-Id: <1470480524-6851-2-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1470480524-6851-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1470480524-6851-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. Signed-off-by: Ivan Khoronzhuk Reviewed-by: Mugunthan V N Reviewed-by: Grygorii Strashko --- 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;