From patchwork Wed Apr 6 02:25:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 8757571 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4A52DC0554 for ; Wed, 6 Apr 2016 02:31:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3C7EA2034E for ; Wed, 6 Apr 2016 02:31:15 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56BF8202A1 for ; Wed, 6 Apr 2016 02:31:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1andDf-00086I-1G; Wed, 06 Apr 2016 02:29:23 +0000 Received: from mail-pf0-x22f.google.com ([2607:f8b0:400e:c00::22f]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1andCu-0007jJ-7y for linux-arm-kernel@lists.infradead.org; Wed, 06 Apr 2016 02:28:37 +0000 Received: by mail-pf0-x22f.google.com with SMTP id e128so23105220pfe.3 for ; Tue, 05 Apr 2016 19:28:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=boundarydevices-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sMfGrmVxUHaGMs41rYGi71FaJ0fkQn9w3CRFR2i4sOc=; b=Dv/WtSxCv3vIYK52n96i1i0APQzIq/P2TAFNY1uXP3NLIx0+FZ7G00XFFrBvj4Gqqh 0SZ+DOZDRxDcUInjraBZ1kTdeHUac3nJoPzuy+NBeP9XSbHYEiWbMNwgMgN8xqwfyScd eQmIO2YB4jF18UrTK5tibHkP2nb0YyJsC8SSvx3PyPMWgXutEr/Ogym1YXbgf+soElaj gXGLpA1ePa4QVX5CBzAhA3Uoh27Ae6x4S9V5zs9s6tDsB6dl3gYk+T94P4t2EL+bfF8l i86FZg28Mo4HKHuHPWhcGag7IoXlL/jDEGARR2TKakH/h1wzjyGsIsUWSox4fSA522gz PTPA== 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=sMfGrmVxUHaGMs41rYGi71FaJ0fkQn9w3CRFR2i4sOc=; b=H7MaXOtC2bLE/f36AhB6vM8JAO/uCmLrwB06xfTUjoYon5KNgYuOUJfH4zDIUVtyDB ZD90/oYZAuhnw/urtHBpB4UEJd0+ORI6jdSGeiWx2u523tdQMmZ5RHo3DR5fTlcrHlj7 D0YU8oVTYoSSfR8K6TefjxBYrOJCbuX1YRXGyClvuruw8Ta1jDMDLvf2TaIJUeDyP+0R l5/NKUJ8C0CFyRy1CbzDVdwlDu5H9R/a/knZtCXXG69t32fCUqD1OqXLXHYrn3TQwa9O n6kNSTbWtyggc8zX4SxkqtvNOZ8RfnYc3TBPiilSssV+KM6SGWZfzLIHmrf+uxmnD0c7 F3vw== X-Gm-Message-State: AD7BkJIXwKbgx/2ajtac0kE1gziKZuJohd935E1jzKU8/KGecLvzUMvbQmlM58/V8MaIYA== X-Received: by 10.98.44.73 with SMTP id s70mr34679747pfs.2.1459909695411; Tue, 05 Apr 2016 19:28:15 -0700 (PDT) Received: from localhost.localdomain (wsip-70-184-93-199.ph.ph.cox.net. [70.184.93.199]) by smtp.googlemail.com with ESMTPSA id l14sm528682pfi.23.2016.04.05.19.28.13 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 19:28:14 -0700 (PDT) From: Troy Kisky To: netdev@vger.kernel.org, davem@davemloft.net, fugang.duan@nxp.com, lznuaa@gmail.com Subject: [PATCH net-next V3 04/16] net: fec: pass rxq/txq to fec_enet_rx/tx_queue instead of queue_id Date: Tue, 5 Apr 2016 19:25:50 -0700 Message-Id: <1459909562-22865-5-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> References: <1459909562-22865-1-git-send-email-troy.kisky@boundarydevices.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_192836_410020_0683ECD7 X-CRM114-Status: GOOD ( 14.65 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, stillcompiling@gmail.com, arnd@arndb.de, sergei.shtylyov@cogentembedded.com, Troy Kisky , gerg@uclinux.org, fabio.estevam@nxp.com, johannes@sipsolutions.net, l.stach@pengutronix.de, linux-arm-kernel@lists.infradead.org, tremyfr@gmail.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The queue_id is the qid member of struct bufdesc_prop. Passing rxq/txq will allow the macro FEC_ENET_GET_QUQUE to be removed in the next patch. Signed-off-by: Troy Kisky Acked-by: Fugang Duan --- v3: add Acked-by combine with "net: fec: pass txq to fec_enet_tx_queue instead of queue_id" reverted change that passed fep as a parameter --- drivers/net/ethernet/freescale/fec_main.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 7993040..b4d46f8 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1156,25 +1156,18 @@ fec_enet_hwtstamp(struct fec_enet_private *fep, unsigned ts, hwtstamps->hwtstamp = ns_to_ktime(ns); } -static void -fec_enet_tx_queue(struct net_device *ndev, u16 queue_id) +static void fec_txq(struct net_device *ndev, struct fec_enet_priv_tx_q *txq) { - struct fec_enet_private *fep; + struct fec_enet_private *fep = netdev_priv(ndev); struct bufdesc *bdp; unsigned short status; struct sk_buff *skb; - struct fec_enet_priv_tx_q *txq; struct netdev_queue *nq; int index = 0; int entries_free; - fep = netdev_priv(ndev); - - queue_id = FEC_ENET_GET_QUQUE(queue_id); - - txq = fep->tx_queue[queue_id]; /* get next bdp of dirty_tx */ - nq = netdev_get_tx_queue(ndev, queue_id); + nq = netdev_get_tx_queue(ndev, txq->bd.qid); bdp = txq->dirty_tx; /* get next bdp of dirty_tx */ @@ -1268,11 +1261,13 @@ static void fec_enet_tx(struct net_device *ndev) { struct fec_enet_private *fep = netdev_priv(ndev); + struct fec_enet_priv_tx_q *txq; u16 queue_id; /* First process class A queue, then Class B and Best Effort queue */ for_each_set_bit(queue_id, &fep->work_tx, FEC_ENET_MAX_TX_QS) { clear_bit(queue_id, &fep->work_tx); - fec_enet_tx_queue(ndev, queue_id); + txq = fep->tx_queue[FEC_ENET_GET_QUQUE(queue_id)]; + fec_txq(ndev, txq); } return; } @@ -1328,11 +1323,10 @@ static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, * not been given to the system, we just set the empty indicator, * effectively tossing the packet. */ -static int -fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) +static int fec_rxq(struct net_device *ndev, struct fec_enet_priv_rx_q *rxq, + int budget) { struct fec_enet_private *fep = netdev_priv(ndev); - struct fec_enet_priv_rx_q *rxq; struct bufdesc *bdp; unsigned short status; struct sk_buff *skb_new = NULL; @@ -1350,8 +1344,6 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) #ifdef CONFIG_M532x flush_cache_all(); #endif - queue_id = FEC_ENET_GET_QUQUE(queue_id); - rxq = fep->rx_queue[queue_id]; /* First, grab all of the stats for the incoming packet. * These get messed up if we get called due to a busy condition. @@ -1519,11 +1511,12 @@ fec_enet_rx(struct net_device *ndev, int budget) int pkt_received = 0; u16 queue_id; struct fec_enet_private *fep = netdev_priv(ndev); + struct fec_enet_priv_rx_q *rxq; for_each_set_bit(queue_id, &fep->work_rx, FEC_ENET_MAX_RX_QS) { clear_bit(queue_id, &fep->work_rx); - pkt_received += fec_enet_rx_queue(ndev, - budget - pkt_received, queue_id); + rxq = fep->rx_queue[FEC_ENET_GET_QUQUE(queue_id)]; + pkt_received += fec_rxq(ndev, rxq, budget - pkt_received); } return pkt_received; }