- struct rt2x00_dev *rt2x00dev = hw->priv;
- struct usb_device *usb_dev =
- interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
- struct data_ring *ring =
- rt2x00_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON);
- struct data_entry *beacon;
- struct data_entry *guardian;
- int length;
-
- /*
- * Just in case the ieee80211 doesn't set this,
- * but we need this queue set for the descriptor
- * initialization.
- */
- control->queue = IEEE80211_TX_QUEUE_BEACON;
-
- /*
- * Obtain 2 entries, one for the guardian byte,
- * the second for the actual beacon.
- */
- guardian = rt2x00_get_data_entry(ring);
- rt2x00_ring_index_inc(ring);
- beacon = rt2x00_get_data_entry(ring);
-
- /*
- * First we create the beacon.
- */
- skb_push(skb, ring->desc_size);
- rt2x00lib_write_tx_desc(rt2x00dev, beacon,
- (struct data_desc*)skb->data,
- (struct ieee80211_hdr*)(skb->data + ring->desc_size),
- skb->len - ring->desc_size,
- control);
-
- /*
- * Length passed to usb_fill_urb cannot be an odd number,
- * so add 1 byte to make it even.
- */
- length = skb->len;
- if (length % 2)
- length++;
-
- usb_fill_bulk_urb(
- beacon->priv,
- usb_dev,
- usb_sndbulkpipe(usb_dev, 1),
- skb->data,
- length,
- rt2x00usb_beacondone,
- beacon);
-
- beacon->skb = skb;
-
- /*
- * Second we need to create the guardian byte.
- * We only need a single byte, so lets recycle
- * the 'flags' field we are not using for beacons.
- */
- guardian->flags = 0;
- usb_fill_bulk_urb(
- guardian->priv,
- usb_dev,
- usb_sndbulkpipe(usb_dev, 1),
- &guardian->flags,
- 1,
- rt2x00usb_beacondone,
- guardian);
-
- /*
- * Send out the guardian byte.
- */
- usb_submit_urb(guardian->priv, GFP_ATOMIC);