From patchwork Sun Oct 20 18:13:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tino Reichardt X-Patchwork-Id: 285023 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DF4B12C00A8 for ; Mon, 21 Oct 2013 05:13:35 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341Ab3JTSNb (ORCPT ); Sun, 20 Oct 2013 14:13:31 -0400 Received: from lotte.svc-box.de ([80.252.109.10]:45364 "EHLO lotte.svc-box.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949Ab3JTSNa (ORCPT ); Sun, 20 Oct 2013 14:13:30 -0400 Received: from localhost (unknown [127.0.0.1]) by lotte.svc-box.de (Postfix) with ESMTP id 6F49D1480B9F; Sun, 20 Oct 2013 18:13:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at lotte.svc-box.de Received: from lotte.svc-box.de ([127.0.0.1]) by localhost (lotte.svc-box.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z4tpihwISbeC; Sun, 20 Oct 2013 20:13:27 +0200 (CEST) Received: from vostro (p4FDD511F.dip0.t-ipconnect.de [79.221.81.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: tino@internethauptknotenpunkt.de) by lotte.svc-box.de (Postfix) with ESMTPSA id DF2B81480B9D; Sun, 20 Oct 2013 20:13:25 +0200 (CEST) Received: by vostro (sSMTP sendmail emulation); Sun, 20 Oct 2013 20:13:25 +0200 From: Tino Reichardt To: netdev@vger.kernel.org, "David S. Miller" , Joe Perches , Jiri Pirko , Bill Pemberton , Greg Kroah-Hartman Subject: [PATCH net-next v2 01/07] 8139too: Support for byte queue limits Date: Sun, 20 Oct 2013 20:13:17 +0200 Message-Id: <1382292803-18875-2-git-send-email-milky-kernel@mcmilk.de> X-Mailer: git-send-email 1.8.4.1 In-Reply-To: <1382292803-18875-1-git-send-email-milky-kernel@mcmilk.de> References: <1382292803-18875-1-git-send-email-milky-kernel@mcmilk.de> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Changes to 8139too driver to use byte queue limits. Signed-off-by: Tino Reichardt --- drivers/net/ethernet/realtek/8139too.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c index 3ccedeb..c17c12f 100644 --- a/drivers/net/ethernet/realtek/8139too.c +++ b/drivers/net/ethernet/realtek/8139too.c @@ -160,6 +160,8 @@ static int multicast_filter_limit = 32; /* bitmapped message enable number */ static int debug = -1; +static bool bql_disable; + /* * Receive ring size * Warning: 64K ring has hardware issues and may lock up. @@ -626,10 +628,12 @@ module_param(multicast_filter_limit, int, 0); module_param_array(media, int, NULL, 0); module_param_array(full_duplex, int, NULL, 0); module_param(debug, int, 0); -MODULE_PARM_DESC (debug, "8139too bitmapped message enable number"); -MODULE_PARM_DESC (multicast_filter_limit, "8139too maximum number of filtered multicast addresses"); -MODULE_PARM_DESC (media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps"); -MODULE_PARM_DESC (full_duplex, "8139too: Force full duplex for board(s) (1)"); +module_param(bql_disable, bool, 0); +MODULE_PARM_DESC(debug, "8139too bitmapped message enable number"); +MODULE_PARM_DESC(multicast_filter_limit, "8139too maximum number of filtered multicast addresses"); +MODULE_PARM_DESC(media, "8139too: Bits 4+9: force full duplex, bit 5: 100Mbps"); +MODULE_PARM_DESC(full_duplex, "8139too: Force full duplex for board(s) (1)"); +MODULE_PARM_DESC(bql_disable, "8139too: Disable Byte Queue Limits functionality (default: false)"); static int read_eeprom (void __iomem *ioaddr, int location, int addr_len); static int rtl8139_open (struct net_device *dev); @@ -1409,6 +1413,8 @@ static void rtl8139_hw_start (struct net_device *dev) } netdev_dbg(dev, "init buffer addresses\n"); + if (likely(bql_disable == false)) + netdev_reset_queue(dev); /* Lock Config[01234] and BMCR register writes */ RTL_W8 (Cfg9346, Cfg9346_Lock); @@ -1639,6 +1645,9 @@ static inline void rtl8139_tx_clear (struct rtl8139_private *tp) tp->cur_tx = 0; tp->dirty_tx = 0; + if (likely(bql_disable == false)) + netdev_reset_queue(tp->dev); + /* XXX account for unsent Tx packets in tp->stats.tx_dropped */ } @@ -1729,10 +1738,13 @@ static netdev_tx_t rtl8139_start_xmit (struct sk_buff *skb, * to make sure that the device sees the updated data. */ wmb(); + len = max_t(unsigned int, len, (unsigned int)ETH_ZLEN); RTL_W32_F (TxStatus0 + (entry * sizeof (u32)), - tp->tx_flag | max(len, (unsigned int)ETH_ZLEN)); + tp->tx_flag | len); tp->cur_tx++; + if (likely(bql_disable == false)) + netdev_sent_queue(dev, len); if ((tp->cur_tx - NUM_TX_DESC) == tp->dirty_tx) netif_stop_queue (dev); @@ -1750,6 +1762,7 @@ static void rtl8139_tx_interrupt (struct net_device *dev, void __iomem *ioaddr) { unsigned long dirty_tx, tx_left; + unsigned bytes_compl = 0, pkts_compl = 0; assert (dev != NULL); assert (ioaddr != NULL); @@ -1792,6 +1805,8 @@ static void rtl8139_tx_interrupt (struct net_device *dev, u64_stats_update_begin(&tp->tx_stats.syncp); tp->tx_stats.packets++; tp->tx_stats.bytes += txstatus & 0x7ff; + pkts_compl++; + bytes_compl += txstatus & 0x7ff; u64_stats_update_end(&tp->tx_stats.syncp); } @@ -1807,6 +1822,9 @@ static void rtl8139_tx_interrupt (struct net_device *dev, } #endif /* RTL8139_NDEBUG */ + if (likely(bql_disable == false)) + netdev_completed_queue(dev, pkts_compl, bytes_compl); + /* only wake the queue if we did work, and the queue is stopped */ if (tp->dirty_tx != dirty_tx) { tp->dirty_tx = dirty_tx;