From: Andrea Merello <andreamrl@xxxxxxxxxx> There is no need to hold lock during rts duration and plcp length calculation. Also fix missing endianness conversion for plcp length. Signed-off-by: Andrea Merello <andreamrl@xxxxxxxxxx> Signed-off-by: Michael Wu <flamingice@xxxxxxxxxxxx> --- drivers/net/wireless/rtl8180_dev.c | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c index 058f30f..3ab4922 100644 --- a/drivers/net/wireless/rtl8180_dev.c +++ b/drivers/net/wireless/rtl8180_dev.c @@ -210,6 +210,8 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb, unsigned int idx, prio; dma_addr_t mapping; u32 tx_flags; + u16 plcp_len = 0; + __le16 rts_duration = 0; prio = control->queue; ring = &priv->tx_ring[prio]; @@ -233,24 +235,26 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb, *((struct ieee80211_tx_control **) skb->cb) = kmemdup(control, sizeof(*control), GFP_ATOMIC); - spin_lock_irqsave(&priv->lock, flags); - idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; - entry = &ring->desc[idx]; - if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) - entry->rts_duration = - ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + rts_duration = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); if (!priv->r8185) { unsigned int remainder; - entry->plcp_len = - DIV_ROUND_UP(16 * (skb->len + 4), (control->rate->rate * 2) / 10); - remainder = (16 * (skb->len + 4)) % ((control->rate->rate * 2) / 10); + plcp_len = DIV_ROUND_UP(16 * (skb->len + 4), + (control->rate->rate * 2) / 10); + remainder = (16 * (skb->len + 4)) % + ((control->rate->rate * 2) / 10); if (remainder > 0 && remainder <= 6) - entry->plcp_len |= 1 << 15; + plcp_len |= 1 << 15; } + spin_lock_irqsave(&priv->lock, flags); + idx = (ring->idx + skb_queue_len(&ring->queue)) % ring->entries; + entry = &ring->desc[idx]; + + entry->rts_duration = rts_duration; + entry->plcp_len = cpu_to_le16(plcp_len); entry->tx_buf = cpu_to_le32(mapping); entry->frame_len = cpu_to_le32(skb->len); entry->flags2 = control->alt_retry_rate != -1 ? - To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html