From patchwork Wed Apr 3 14:00:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Ott X-Patchwork-Id: 233488 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 9D7D32C0099 for ; Thu, 4 Apr 2013 01:03:01 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761954Ab3DCOBL (ORCPT ); Wed, 3 Apr 2013 10:01:11 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50014 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758424Ab3DCOBI (ORCPT ); Wed, 3 Apr 2013 10:01:08 -0400 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 504562111D; Wed, 3 Apr 2013 10:01:08 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute3.internal (MEProxy); Wed, 03 Apr 2013 10:01:08 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=signal11.us; h= from:to:cc:subject:date:message-id:in-reply-to:references; s= mesmtp; bh=1yL1qEvFmop2S7m4xgTTS1H8DoA=; b=QCSaMxhe/5t2AEgSj4ZaO bnrqjLidHOSXu0w7dEMCuDzyTXyRLAx7XdzkxsAaTHa3GKea/GWmFWuqhUdu6P5E R3woU7lkxT0Jnt+FSO1T5Jdpvxo06nH/QlYJLACl/kOr6ZteB9bD5c6nUNHTPfHU xNs/dHd06bNakkc7RhHhiM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:cc:subject:date:message-id :in-reply-to:references; s=smtpout; bh=1yL1qEvFmop2S7m4xgTTS1H8D oA=; b=o9c9bNSDyeYV8mG+uTrZIHSBno8GKvAd3AZdZtxsCbJqDejp+orkNJhTY mDT0j1WOeDLmoDrI/NesaCAeAkW2DmsgUH1y2Oc/tISNFp5sUK4saIUFbz2DbMiE 2JO1qqfqCKwoCwSgkonZs+gwoa5hj5Y1LACwYFp8oFymZeFVm4= X-Sasl-enc: xzMiD5JA4Yi5hfguQuXFya+9EmKLUvWixnU8ShrEwh5n 1364997668 Received: from ato.hsd1.fl.comcast.net. (unknown [68.62.254.211]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C79F200176; Wed, 3 Apr 2013 10:01:07 -0400 (EDT) From: Alan Ott To: Alexander Smirnov , Dmitry Eremin-Solenikov , "David S. Miller" Cc: linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Alan Ott Subject: [PATCH v2 2/4] mac802154: Use netif flow control Date: Wed, 3 Apr 2013 10:00:56 -0400 Message-Id: <1364997658-16498-3-git-send-email-alan@signal11.us> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1364997658-16498-1-git-send-email-alan@signal11.us> References: <1364928481-1813-1-git-send-email-alan@signal11.us> <1364997658-16498-1-git-send-email-alan@signal11.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use netif_stop_queue() and netif_wake_queue() to control the flow of packets to mac802154 devices. Since many IEEE 802.15.4 devices have no output buffer, and since the mac802154 xmit() function is designed to block, netif_stop_queue() is called after each packet. Signed-off-by: Alan Ott --- net/mac802154/tx.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 7264874..3fd3e07 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -44,6 +45,7 @@ struct xmit_work { static void mac802154_xmit_worker(struct work_struct *work) { struct xmit_work *xw = container_of(work, struct xmit_work, work); + struct mac802154_sub_if_data *sdata; int res; mutex_lock(&xw->priv->phy->pib_lock); @@ -65,6 +67,11 @@ static void mac802154_xmit_worker(struct work_struct *work) out: mutex_unlock(&xw->priv->phy->pib_lock); + /* Restart the netif queue on each sub_if_data object. */ + rcu_read_lock(); + list_for_each_entry_rcu(sdata, &xw->priv->slaves, list) + netif_wake_queue(sdata->dev); + rcu_read_unlock(); dev_kfree_skb(xw->skb); @@ -75,6 +82,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, u8 page, u8 chan) { struct xmit_work *work; + struct mac802154_sub_if_data *sdata; if (!(priv->phy->channels_supported[page] & (1 << chan))) { WARN_ON(1); @@ -102,6 +110,12 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct sk_buff *skb, return NETDEV_TX_BUSY; } + /* Stop the netif queue on each sub_if_data object. */ + rcu_read_lock(); + list_for_each_entry_rcu(sdata, &priv->slaves, list) + netif_stop_queue(sdata->dev); + rcu_read_unlock(); + INIT_WORK(&work->work, mac802154_xmit_worker); work->skb = skb; work->priv = priv;