Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5be65609 authored by Ivo van Doorn's avatar Ivo van Doorn Committed by John W. Linville
Browse files

rt2x00: Add "flush" queue command



Add a new command to the queue handlers: "flush",
this moves the flush() callback from mac80211
into rt2x00queue and adds support for flushing
the RX queue as well.

Signed-off-by: default avatarIvo van Doorn <IvDoorn@gmail.com>
Acked-by: default avatarHelmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0b7fde54
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -785,8 +785,6 @@ static void rt2500usb_stop_queue(struct data_queue *queue)
	default:
		break;
	}

	rt2x00usb_stop_queue(queue);
}

/*
@@ -1842,6 +1840,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
	.start_queue		= rt2500usb_start_queue,
	.kick_queue		= rt2x00usb_kick_queue,
	.stop_queue		= rt2500usb_stop_queue,
	.flush_queue		= rt2x00usb_flush_queue,
	.write_tx_desc		= rt2500usb_write_tx_desc,
	.write_beacon		= rt2500usb_write_beacon,
	.get_tx_data_len	= rt2500usb_get_tx_data_len,
+1 −2
Original line number Diff line number Diff line
@@ -96,8 +96,6 @@ static void rt2800usb_stop_queue(struct data_queue *queue)
	default:
		break;
	}

	rt2x00usb_stop_queue(queue);
}

/*
@@ -623,6 +621,7 @@ static const struct rt2x00lib_ops rt2800usb_rt2x00_ops = {
	.start_queue		= rt2800usb_start_queue,
	.kick_queue		= rt2x00usb_kick_queue,
	.stop_queue		= rt2800usb_stop_queue,
	.flush_queue		= rt2x00usb_flush_queue,
	.write_tx_desc		= rt2800usb_write_tx_desc,
	.write_tx_data		= rt2800usb_write_tx_data,
	.write_beacon		= rt2800_write_beacon,
+21 −0
Original line number Diff line number Diff line
@@ -575,6 +575,7 @@ struct rt2x00lib_ops {
	void (*start_queue) (struct data_queue *queue);
	void (*kick_queue) (struct data_queue *queue);
	void (*stop_queue) (struct data_queue *queue);
	void (*flush_queue) (struct data_queue *queue);

	/*
	 * TX control handlers
@@ -1108,6 +1109,16 @@ void rt2x00queue_start_queue(struct data_queue *queue);
 */
void rt2x00queue_stop_queue(struct data_queue *queue);

/**
 * rt2x00queue_flush_queue - Flush a data queue
 * @queue: Pointer to &struct data_queue.
 * @drop: True to drop all pending frames.
 *
 * This function will flush the queue. After this call
 * the queue is guarenteed to be empty.
 */
void rt2x00queue_flush_queue(struct data_queue *queue, bool drop);

/**
 * rt2x00queue_start_queues - Start all data queues
 * @rt2x00dev: Pointer to &struct rt2x00_dev.
@@ -1125,6 +1136,16 @@ void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev);
 */
void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev);

/**
 * rt2x00queue_flush_queues - Flush all data queues
 * @rt2x00dev: Pointer to &struct rt2x00_dev.
 * @drop: True to drop all pending frames.
 *
 * This function will loop through all available queues to flush
 * any pending frames.
 */
void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop);

/*
 * Debugfs handlers.
 */
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
	 */
	rt2x00link_stop_tuner(rt2x00dev);
	rt2x00queue_stop_queues(rt2x00dev);
	rt2x00queue_flush_queues(rt2x00dev, true);

	/*
	 * Disable radio.
+2 −30
Original line number Diff line number Diff line
@@ -718,36 +718,8 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop)
{
	struct rt2x00_dev *rt2x00dev = hw->priv;
	struct data_queue *queue;
	unsigned int i = 0;

	ieee80211_stop_queues(hw);

	/*
	 * Run over all queues to kick them, this will force
	 * any pending frames to be transmitted.
	 */
	tx_queue_for_each(rt2x00dev, queue) {
		rt2x00dev->ops->lib->kick_queue(queue);
	}

	/**
	 * All queues have been kicked, now wait for each queue
	 * to become empty. With a bit of luck, we only have to wait
	 * for the first queue to become empty, because while waiting
	 * for the that queue, the other queues will have transmitted
	 * all their frames as well (since they were already kicked).
	 */
	tx_queue_for_each(rt2x00dev, queue) {
		for (i = 0; i < 10; i++) {
			if (rt2x00queue_empty(queue))
				break;
			msleep(100);
		}

		if (!rt2x00queue_empty(queue))
			WARNING(rt2x00dev, "Failed to flush queue %d\n", queue->qid);
	}

	ieee80211_wake_queues(hw);
	tx_queue_for_each(rt2x00dev, queue)
		rt2x00queue_flush_queue(queue, drop);
}
EXPORT_SYMBOL_GPL(rt2x00mac_flush);
Loading