From: Ivo van Doorn <ivdoorn@gmail.com>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH 10/24] rt2x00: Rename DEVICE_SUPPORT_ATIM to REQUIRE_BEACON_RING
Date: Sun, 16 Sep 2007 14:18:38 +0200 [thread overview]
Message-ID: <200709161418.39601.IvDoorn@gmail.com> (raw)
In-Reply-To: <200709161403.11332.IvDoorn@gmail.com>
Devices that support the ATIM ring are also the devices
which require the Beacon ring to be allocated.
So by renaming the flag we can expand the meaning by
also including the beacon ring allocation to it.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
---
drivers/net/wireless/rt2x00/rt2400pci.c | 4 +-
drivers/net/wireless/rt2x00/rt2500pci.c | 4 +-
drivers/net/wireless/rt2x00/rt2500usb.c | 4 +-
drivers/net/wireless/rt2x00/rt2x00.h | 14 ++++++---
drivers/net/wireless/rt2x00/rt2x00dev.c | 42 ++++++++++++++----------------
5 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 5a7fc18..28236dc 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -1513,9 +1513,9 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev)
rt2400pci_probe_hw_mode(rt2x00dev);
/*
- * This device supports ATIM
+ * This device requires the beacon ring
*/
- __set_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags);
+ __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
/*
* Set the rssi offset.
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index d24ea61..444e530 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1828,9 +1828,9 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev)
rt2500pci_probe_hw_mode(rt2x00dev);
/*
- * This device supports ATIM
+ * This device requires the beacon ring
*/
- __set_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags);
+ __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
/*
* Set the rssi offset.
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index f344c2a..7e8cd47 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1582,10 +1582,10 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
/*
* USB devices require scheduled packet filter toggling
- * This device supports ATIM
+ *This device requires the beacon ring
*/
__set_bit(PACKET_FILTER_SCHEDULED, &rt2x00dev->flags);
- __set_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags);
+ __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
/*
* Set the rssi offset.
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 02a5adf..5ecabc8 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -516,7 +516,7 @@ struct rt2x00_dev {
#define INTERFACE_RESET 8
#define INTERFACE_ENABLED 9
#define INTERFACE_ENABLED_MONITOR 10
-#define DEVICE_SUPPORT_ATIM 11
+#define REQUIRE_BEACON_RING 11
#define DEVICE_SUPPORT_HW_BUTTON 12
#define CONFIG_FRAME_TYPE 13
#define CONFIG_RF_SEQUENCE 14
@@ -615,6 +615,7 @@ struct rt2x00_dev {
* The Beacon array also contains the Atim ring
* if that is supported by the device.
*/
+ int data_rings;
struct data_ring *rx;
struct data_ring *tx;
struct data_ring *bcn;
@@ -630,14 +631,17 @@ struct rt2x00_dev {
* All rings have been allocated as a single array,
* this means we can create a very simply loop macro
* that is capable of looping through all rings.
- * ring_end() and ring_loop() are helper macro's which should
- * not be used directly. Instead the following should be used:
+ * ring_end(), txring_end() and ring_loop() are helper macro's which
+ * should not be used directly. Instead the following should be used:
* ring_for_each() - Loops through all rings (RX, TX, Beacon & Atim)
* txring_for_each() - Loops through TX data rings (TX only)
* txringall_for_each() - Loops through all TX rings (TX, Beacon & Atim)
*/
#define ring_end(__dev) \
- &(__dev)->bcn[1 + test_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags)]
+ &(__dev)->rx[(__dev)->data_rings]
+
+#define txring_end(__dev) \
+ &(__dev)->tx[(__dev)->hw->queues]
#define ring_loop(__entry, __start, __end) \
for ((__entry) = (__start); \
@@ -648,7 +652,7 @@ struct rt2x00_dev {
ring_loop(__entry, (__dev)->rx, ring_end(__dev))
#define txring_for_each(__dev, __entry) \
- ring_loop(__entry, (__dev)->tx, (__dev)->bcn)
+ ring_loop(__entry, (__dev)->tx, txring_end(__dev))
#define txringall_for_each(__dev, __entry) \
ring_loop(__entry, (__dev)->tx, ring_end(__dev))
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index fed2cce..81458bf 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -40,24 +40,22 @@
struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev,
const unsigned int queue)
{
- int atim = test_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags);
-
- /*
- * Check if the rings have been allocated.
- */
- if (!rt2x00dev->tx || !rt2x00dev->bcn)
- return NULL;
+ int beacon = test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags);
/*
* Check if we are requesting a reqular TX ring,
* or if we are requesting a Beacon or Atim ring.
* For Atim rings, we should check if it is supported.
*/
- if (queue < rt2x00dev->hw->queues)
+ if (queue < rt2x00dev->hw->queues && rt2x00dev->tx)
return &rt2x00dev->tx[queue];
- else if (queue == IEEE80211_TX_QUEUE_BEACON)
+
+ if (!rt2x00dev->bcn || !beacon)
+ return NULL;
+
+ if (queue == IEEE80211_TX_QUEUE_BEACON)
return &rt2x00dev->bcn[0];
- else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON && atim)
+ else if (queue == IEEE80211_TX_QUEUE_AFTER_BEACON)
return &rt2x00dev->bcn[1];
return NULL;
@@ -790,6 +788,9 @@ static int rt2x00lib_alloc_ring_entries(struct rt2x00_dev *rt2x00dev)
return -ENOMEM;
}
+ if (!test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags))
+ return 0;
+
/*
* Allocate the BEACON ring.
*/
@@ -800,9 +801,6 @@ static int rt2x00lib_alloc_ring_entries(struct rt2x00_dev *rt2x00dev)
/*
* Allocate the Atim ring.
*/
- if (!test_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags))
- return 0;
-
if (rt2x00lib_alloc_entries(&rt2x00dev->bcn[1], ATIM_ENTRIES,
DATA_FRAME_SIZE, rt2x00dev->ops->txd_size))
return -ENOMEM;
@@ -960,19 +958,18 @@ void rt2x00lib_deinit_interface(struct rt2x00_dev *rt2x00dev)
static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
{
struct data_ring *ring;
- unsigned int ring_num;
/*
* We need the following rings:
* RX: 1
* TX: hw->queues
- * Beacon: 1
- * Atim: 1 (if supported)
+ * Beacon: 1 (if required)
+ * Atim: 1 (if required)
*/
- ring_num = 2 + rt2x00dev->hw->queues +
- test_bit(DEVICE_SUPPORT_ATIM, &rt2x00dev->flags);
+ rt2x00dev->data_rings = 1 + rt2x00dev->hw->queues +
+ (2 * test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags));
- ring = kzalloc(sizeof(*ring) * ring_num, GFP_KERNEL);
+ ring = kzalloc(rt2x00dev->data_rings * sizeof(*ring), GFP_KERNEL);
if (!ring) {
ERROR(rt2x00dev, "Ring allocation failed.\n");
return -ENOMEM;
@@ -981,9 +978,10 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
/*
* Initialize pointers
*/
- rt2x00dev->rx = &ring[0];
- rt2x00dev->tx = &ring[1];
- rt2x00dev->bcn = &ring[1 + rt2x00dev->hw->queues];
+ rt2x00dev->rx = ring;
+ rt2x00dev->tx = &rt2x00dev->rx[1];
+ if (test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags))
+ rt2x00dev->bcn = &rt2x00dev->tx[rt2x00dev->hw->queues];
/*
* Initialize ring parameters.
--
1.5.3
next prev parent reply other threads:[~2007-09-16 12:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200709161403.11332.IvDoorn@gmail.com>
2007-09-16 12:17 ` [PATCH 1/24] rt2x00: Remove firmware not-NULL check Ivo van Doorn
2007-09-16 12:17 ` [PATCH 2/24] rt2x00: Don't check for IEEE80211_TXCTL_REQ_TX_STATUS Ivo van Doorn
2007-09-16 12:18 ` [PATCH 3/24] rt2x00: Cleanup rxdone Ivo van Doorn
2007-09-16 12:18 ` [PATCH 4/24] rt2x00: Don't allow configuration calls when uninitialized Ivo van Doorn
2007-09-16 12:18 ` [PATCH 5/24] rt2x00: Fix rt61pci and rt73usb beacon handling Ivo van Doorn
2007-09-16 12:18 ` [PATCH 6/24] rt2x00: Recalculate link quality Ivo van Doorn
2007-09-16 12:18 ` [PATCH 7/24] rt2x00: Cleanup entry->flags Ivo van Doorn
2007-09-16 12:18 ` [PATCH 8/24] rt2x00: Reduce LNA flags Ivo van Doorn
2007-09-16 12:18 ` [PATCH 9/24] rt2x00: Rework RT61 and RT73 Antenna handling Ivo van Doorn
2007-09-16 12:18 ` Ivo van Doorn [this message]
2007-09-16 12:18 ` [PATCH 11/24] rt2x00: Remove rt2x00mac_reset() Ivo van Doorn
2007-09-16 12:18 ` [PATCH 12/24] rt2x00: Fix system freeze on device removal Ivo van Doorn
2007-09-16 12:18 ` [PATCH 13/24] rt2x00: Reduce magic value writing to device Ivo van Doorn
2007-09-16 12:19 ` [PATCH 14/24] rt2x00: New USB ID's for rt73usb and rt2500usb Ivo van Doorn
2007-09-16 12:19 ` [PATCH 15/24] rt2x00: Beacon ring entries should have QID_MGMT Ivo van Doorn
2007-09-16 12:19 ` [PATCH 16/24] rt2x00: Fix DEV_RATEBIT_ definitions Ivo van Doorn
2007-09-16 12:19 ` [PATCH 17/24] rt2x00: Fix rfkill handling Ivo van Doorn
2007-09-16 12:19 ` [PATCH 18/24] rt2x00: Merge allocation/free register components Ivo van Doorn
2007-09-16 12:19 ` [PATCH 19/24] rt2x00: macro's shouldn't use hidden arguments Ivo van Doorn
2007-09-16 12:19 ` [PATCH 20/24] rt2x00: Fix channel initialization Ivo van Doorn
2007-09-16 12:19 ` [PATCH 21/24] rt2x00: Add better CONFIG_PM checks Ivo van Doorn
2007-09-16 12:19 ` [PATCH 22/24] rt2x00: Add start/stop handlers Ivo van Doorn
2007-09-16 12:19 ` [PATCH 23/24] rt2x00: Add additional bit to MAX_FRAME_UNIT Ivo van Doorn
2007-09-16 12:19 ` [PATCH 24/24] rt2x00: Release rt2x00 2.0.8 Ivo van Doorn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200709161418.39601.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=rt2400-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).