From patchwork Mon Apr 8 18:06:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Pedersen X-Patchwork-Id: 2410731 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 531323FC71 for ; Mon, 8 Apr 2013 18:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934944Ab3DHSH5 (ORCPT ); Mon, 8 Apr 2013 14:07:57 -0400 Received: from mail-da0-f45.google.com ([209.85.210.45]:55628 "EHLO mail-da0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934675Ab3DHSH4 (ORCPT ); Mon, 8 Apr 2013 14:07:56 -0400 Received: by mail-da0-f45.google.com with SMTP id v40so2711272dad.18 for ; Mon, 08 Apr 2013 11:07:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=JPRa1lV4YW38VHB9+1+Bd+dRRS0KL3/gLhm81RllG38=; b=ShSunvAzzzHVYxAriQorcvaE/BPKIc28juwARlAin6a/crcSvyPA6NUeAgJpbYMh3t sjWiLWEHLo82fyatfvv7Uno0f0LF2tbc6N14FO30fnlJCHqCVXlvXNbUTtZ833F0u4Q1 zOZxv4t+0czoQx1nAqpSQE5RuFviQkGHwRonHFhlZrf20AhwlQraPxofa9NJxIUs8Dgf wjqAleWbJlTJQCuizoS7ZzpZRwjnko2GqY1ggNOkxCTXz8xglna2IVDN9i4zn+tmt1UL Hxn6Nc37wZW4FvtPMAN+W45fOd40Fri78stFfK1NFL1fi5ljst7pkTjfYD4iTDec5w/8 1n4g== X-Received: by 10.66.144.69 with SMTP id sk5mr39673009pab.69.1365444475457; Mon, 08 Apr 2013 11:07:55 -0700 (PDT) Received: from cable.lan (70-35-43-50.static.wiline.com. [70.35.43.50]) by mx.google.com with ESMTPS id pa2sm40603095pac.9.2013.04.08.11.07.53 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 11:07:54 -0700 (PDT) From: Thomas Pedersen To: Johannes Berg Cc: linux-wirelss , open80211s , Thomas Pedersen Subject: [PATCH 3/6] mac80211: ieee80211_queue_stopped returns reasons Date: Mon, 8 Apr 2013 11:06:14 -0700 Message-Id: <1365444377-9959-3-git-send-email-thomas@cozybit.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1365444377-9959-1-git-send-email-thomas@cozybit.com> References: <1365444377-9959-1-git-send-email-thomas@cozybit.com> X-Gm-Message-State: ALoCoQk2J6CO/I1CpWSIfTSvcijuQ+Xqkzavd9YBtJWv8e18Wgh5gQS7Tly+NhqTpl9iA/36c/ij Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Have ieee80211_queue_stopped() return a bitmap of enum queue_stop_reasons while checking queue status. This is handy when we care about the queue stop reason codes. Signed-off-by: Thomas Pedersen --- include/net/mac80211.h | 10 +++++++--- net/mac80211/util.c | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 64faf01..8bbe799 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -3589,15 +3589,19 @@ void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue); /** * ieee80211_queue_stopped - test status of the queue + * * @hw: pointer as obtained from ieee80211_alloc_hw(). * @queue: queue number (counted from zero). * * Drivers should use this function instead of netif_stop_queue. * - * Return: %true if the queue is stopped. %false otherwise. + * Return 0 if queue not stopped, or else a bitmap of + * queue_stop_reasons. + * + * If @queue doesn't exist, return -1UL. + * */ - -int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); +unsigned long ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue); /** * ieee80211_stop_queues - stop all queues diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 447e665..739cddb 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -475,17 +475,17 @@ void ieee80211_stop_queues(struct ieee80211_hw *hw) } EXPORT_SYMBOL(ieee80211_stop_queues); -int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue) +unsigned long ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue) { struct ieee80211_local *local = hw_to_local(hw); unsigned long flags; - int ret; + unsigned long ret; if (WARN_ON(queue >= hw->queues)) - return true; + return -1UL; spin_lock_irqsave(&local->queue_stop_reason_lock, flags); - ret = !!local->queue_stop_reasons[queue]; + ret = local->queue_stop_reasons[queue]; spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); return ret; }