diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index c70c677b3f73..f536ff1b5c47 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1057,6 +1057,21 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1057 | rt2x00_desc_write(txd, 0, word); | 1057 | rt2x00_desc_write(txd, 0, word); |
1058 | } | 1058 | } |
1059 | 1059 | ||
1060 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | ||
1061 | int maxpacket, struct sk_buff *skb) | ||
1062 | { | ||
1063 | int length; | ||
1064 | |||
1065 | /* | ||
1066 | * The length _must_ be a multiple of 2, | ||
1067 | * but it must _not_ be a multiple of the USB packet size. | ||
1068 | */ | ||
1069 | length = roundup(skb->len, 2); | ||
1070 | length += (2 * !(length % maxpacket)); | ||
1071 | |||
1072 | return length; | ||
1073 | } | ||
1074 | |||
1060 | /* | 1075 | /* |
1061 | * TX data initialization | 1076 | * TX data initialization |
1062 | */ | 1077 | */ |
@@ -1653,6 +1668,8 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1653 | rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); | 1668 | rt2x00lib_get_ring(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); |
1654 | struct data_entry *beacon; | 1669 | struct data_entry *beacon; |
1655 | struct data_entry *guardian; | 1670 | struct data_entry *guardian; |
1671 | int pipe = usb_sndbulkpipe(usb_dev, 1); | ||
1672 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
1656 | int length; | 1673 | int length; |
1657 | 1674 | ||
1658 | /* | 1675 | /* |
@@ -1679,16 +1696,9 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1679 | ring->desc_size), | 1696 | ring->desc_size), |
1680 | skb->len - ring->desc_size, control); | 1697 | skb->len - ring->desc_size, control); |
1681 | 1698 | ||
1682 | /* | 1699 | length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); |
1683 | * Length passed to usb_fill_urb cannot be an odd number, | ||
1684 | * so add 1 byte to make it even. | ||
1685 | */ | ||
1686 | length = skb->len; | ||
1687 | if (length % 2) | ||
1688 | length++; | ||
1689 | 1700 | ||
1690 | usb_fill_bulk_urb(beacon->priv, usb_dev, | 1701 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, |
1691 | usb_sndbulkpipe(usb_dev, 1), | ||
1692 | skb->data, length, rt2500usb_beacondone, beacon); | 1702 | skb->data, length, rt2500usb_beacondone, beacon); |
1693 | 1703 | ||
1694 | beacon->skb = skb; | 1704 | beacon->skb = skb; |
@@ -1699,8 +1709,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1699 | * the 'flags' field we are not using for beacons. | 1709 | * the 'flags' field we are not using for beacons. |
1700 | */ | 1710 | */ |
1701 | guardian->flags = 0; | 1711 | guardian->flags = 0; |
1702 | usb_fill_bulk_urb(guardian->priv, usb_dev, | 1712 | usb_fill_bulk_urb(guardian->priv, usb_dev, pipe, |
1703 | usb_sndbulkpipe(usb_dev, 1), | ||
1704 | &guardian->flags, 1, rt2500usb_beacondone, guardian); | 1713 | &guardian->flags, 1, rt2500usb_beacondone, guardian); |
1705 | 1714 | ||
1706 | /* | 1715 | /* |
@@ -1741,6 +1750,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = { | |||
1741 | .link_tuner = rt2500usb_link_tuner, | 1750 | .link_tuner = rt2500usb_link_tuner, |
1742 | .write_tx_desc = rt2500usb_write_tx_desc, | 1751 | .write_tx_desc = rt2500usb_write_tx_desc, |
1743 | .write_tx_data = rt2x00usb_write_tx_data, | 1752 | .write_tx_data = rt2x00usb_write_tx_data, |
1753 | .get_tx_data_len = rt2500usb_get_tx_data_len, | ||
1744 | .kick_tx_queue = rt2500usb_kick_tx_queue, | 1754 | .kick_tx_queue = rt2500usb_kick_tx_queue, |
1745 | .fill_rxdone = rt2500usb_fill_rxdone, | 1755 | .fill_rxdone = rt2500usb_fill_rxdone, |
1746 | .config_mac_addr = rt2500usb_config_mac_addr, | 1756 | .config_mac_addr = rt2500usb_config_mac_addr, |