Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mac80211: make tx() operation return void

The return value of the tx operation is commonly
misused by drivers, leading to errors. All drivers
will drop frames if they fail to TX the frame, and
they must also properly manage the queues (if they
didn't, mac80211 would already warn).

Removing the ability for drivers to return a BUSY
value also allows significant cleanups of the TX
TX handling code in mac80211.

Note that this also fixes a bug in ath9k_htc, the
old "return -1" there was wrong.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Tested-by: Sedat Dilek <sedat.dilek@googlemail.com> [ath5k]
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> [rt2x00]
Acked-by: Larry Finger <Larry.Finger@lwfinger.net> [b43, rtl8187, rtlwifi]
Acked-by: Luciano Coelho <coelho@ti.com> [wl12xx]
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Johannes Berg and committed by
John W. Linville
7bb45683 43f12d47

+122 -237
+1 -3
drivers/net/wireless/adm8211.c
··· 1658 1658 } 1659 1659 1660 1660 /* Put adm8211_tx_hdr on skb and transmit */ 1661 - static int adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 1661 + static void adm8211_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 1662 1662 { 1663 1663 struct adm8211_tx_hdr *txhdr; 1664 1664 size_t payload_len, hdrlen; ··· 1707 1707 txhdr->retry_limit = info->control.rates[0].count; 1708 1708 1709 1709 adm8211_tx_raw(dev, skb, plcp_signal, hdrlen); 1710 - 1711 - return NETDEV_TX_OK; 1712 1710 } 1713 1711 1714 1712 static int adm8211_alloc_rings(struct ieee80211_hw *dev)
+3 -4
drivers/net/wireless/at76c50x-usb.c
··· 1728 1728 ieee80211_wake_queues(priv->hw); 1729 1729 } 1730 1730 1731 - static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1731 + static void at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1732 1732 { 1733 1733 struct at76_priv *priv = hw->priv; 1734 1734 struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer; ··· 1741 1741 if (priv->tx_urb->status == -EINPROGRESS) { 1742 1742 wiphy_err(priv->hw->wiphy, 1743 1743 "%s called while tx urb is pending\n", __func__); 1744 - return NETDEV_TX_BUSY; 1744 + dev_kfree_skb_any(skb); 1745 + return; 1745 1746 } 1746 1747 1747 1748 /* The following code lines are important when the device is going to ··· 1796 1795 priv->tx_urb, 1797 1796 priv->tx_urb->hcpriv, priv->tx_urb->complete); 1798 1797 } 1799 - 1800 - return 0; 1801 1798 } 1802 1799 1803 1800 static int at76_mac80211_start(struct ieee80211_hw *hw)
+1 -1
drivers/net/wireless/ath/ar9170/ar9170.h
··· 224 224 int ar9170_nag_limiter(struct ar9170 *ar); 225 225 226 226 /* MAC */ 227 - int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 227 + void ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 228 228 int ar9170_init_mac(struct ar9170 *ar); 229 229 int ar9170_set_qos(struct ar9170 *ar); 230 230 int ar9170_update_multicast(struct ar9170 *ar, const u64 mc_hast);
+2 -3
drivers/net/wireless/ath/ar9170/main.c
··· 1475 1475 msecs_to_jiffies(AR9170_JANITOR_DELAY)); 1476 1476 } 1477 1477 1478 - int ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1478 + void ar9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1479 1479 { 1480 1480 struct ar9170 *ar = hw->priv; 1481 1481 struct ieee80211_tx_info *info; ··· 1493 1493 skb_queue_tail(&ar->tx_pending[queue], skb); 1494 1494 1495 1495 ar9170_tx(ar); 1496 - return NETDEV_TX_OK; 1496 + return; 1497 1497 1498 1498 err_free: 1499 1499 dev_kfree_skb_any(skb); 1500 - return NETDEV_TX_OK; 1501 1500 } 1502 1501 1503 1502 static int ar9170_op_add_interface(struct ieee80211_hw *hw,
+2 -2
drivers/net/wireless/ath/ath5k/ath5k.h
··· 1164 1164 1165 1165 void set_beacon_filter(struct ieee80211_hw *hw, bool enable); 1166 1166 bool ath_any_vif_assoc(struct ath5k_softc *sc); 1167 - int ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, 1168 - struct ath5k_txq *txq); 1167 + void ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, 1168 + struct ath5k_txq *txq); 1169 1169 int ath5k_init_hw(struct ath5k_softc *sc); 1170 1170 int ath5k_stop_hw(struct ath5k_softc *sc); 1171 1171 void ath5k_mode_setup(struct ath5k_softc *sc, struct ieee80211_vif *vif);
+2 -3
drivers/net/wireless/ath/ath5k/base.c
··· 1518 1518 * TX Handling * 1519 1519 \*************/ 1520 1520 1521 - int 1521 + void 1522 1522 ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, 1523 1523 struct ath5k_txq *txq) 1524 1524 { ··· 1567 1567 spin_unlock_irqrestore(&sc->txbuflock, flags); 1568 1568 goto drop_packet; 1569 1569 } 1570 - return NETDEV_TX_OK; 1570 + return; 1571 1571 1572 1572 drop_packet: 1573 1573 dev_kfree_skb_any(skb); 1574 - return NETDEV_TX_OK; 1575 1574 } 1576 1575 1577 1576 static void
+3 -3
drivers/net/wireless/ath/ath5k/mac80211-ops.c
··· 52 52 * Mac80211 functions * 53 53 \********************/ 54 54 55 - static int 55 + static void 56 56 ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 57 57 { 58 58 struct ath5k_softc *sc = hw->priv; ··· 60 60 61 61 if (WARN_ON(qnum >= sc->ah->ah_capabilities.cap_queues.q_tx_num)) { 62 62 dev_kfree_skb_any(skb); 63 - return 0; 63 + return; 64 64 } 65 65 66 - return ath5k_tx_queue(hw, skb, &sc->txqs[qnum]); 66 + ath5k_tx_queue(hw, skb, &sc->txqs[qnum]); 67 67 } 68 68 69 69
+3 -4
drivers/net/wireless/ath/ath9k/htc_drv_main.c
··· 1036 1036 /* mac80211 Callbacks */ 1037 1037 /**********************/ 1038 1038 1039 - static int ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1039 + static void ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1040 1040 { 1041 1041 struct ieee80211_hdr *hdr; 1042 1042 struct ath9k_htc_priv *priv = hw->priv; ··· 1049 1049 padsize = padpos & 3; 1050 1050 if (padsize && skb->len > padpos) { 1051 1051 if (skb_headroom(skb) < padsize) 1052 - return -1; 1052 + goto fail_tx; 1053 1053 skb_push(skb, padsize); 1054 1054 memmove(skb->data, skb->data + padsize, padpos); 1055 1055 } ··· 1070 1070 goto fail_tx; 1071 1071 } 1072 1072 1073 - return 0; 1073 + return; 1074 1074 1075 1075 fail_tx: 1076 1076 dev_kfree_skb_any(skb); 1077 - return 0; 1078 1077 } 1079 1078 1080 1079 static int ath9k_htc_start(struct ieee80211_hw *hw)
+2 -4
drivers/net/wireless/ath/ath9k/main.c
··· 1142 1142 return r; 1143 1143 } 1144 1144 1145 - static int ath9k_tx(struct ieee80211_hw *hw, 1146 - struct sk_buff *skb) 1145 + static void ath9k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1147 1146 { 1148 1147 struct ath_softc *sc = hw->priv; 1149 1148 struct ath_common *common = ath9k_hw_common(sc->sc_ah); ··· 1199 1200 goto exit; 1200 1201 } 1201 1202 1202 - return 0; 1203 + return; 1203 1204 exit: 1204 1205 dev_kfree_skb_any(skb); 1205 - return 0; 1206 1206 } 1207 1207 1208 1208 static void ath9k_stop(struct ieee80211_hw *hw)
+1 -1
drivers/net/wireless/ath/carl9170/carl9170.h
··· 534 534 void carl9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len); 535 535 536 536 /* TX */ 537 - int carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 537 + void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 538 538 void carl9170_tx_janitor(struct work_struct *work); 539 539 void carl9170_tx_process_status(struct ar9170 *ar, 540 540 const struct carl9170_rsp *cmd);
+2 -3
drivers/net/wireless/ath/carl9170/tx.c
··· 1339 1339 return false; 1340 1340 } 1341 1341 1342 - int carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1342 + void carl9170_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1343 1343 { 1344 1344 struct ar9170 *ar = hw->priv; 1345 1345 struct ieee80211_tx_info *info; ··· 1373 1373 } 1374 1374 1375 1375 carl9170_tx(ar); 1376 - return NETDEV_TX_OK; 1376 + return; 1377 1377 1378 1378 err_free: 1379 1379 ar->tx_dropped++; 1380 1380 dev_kfree_skb_any(skb); 1381 - return NETDEV_TX_OK; 1382 1381 } 1383 1382 1384 1383 void carl9170_tx_scheduler(struct ar9170 *ar)
+2 -4
drivers/net/wireless/b43/main.c
··· 3203 3203 mutex_unlock(&wl->mutex); 3204 3204 } 3205 3205 3206 - static int b43_op_tx(struct ieee80211_hw *hw, 3206 + static void b43_op_tx(struct ieee80211_hw *hw, 3207 3207 struct sk_buff *skb) 3208 3208 { 3209 3209 struct b43_wl *wl = hw_to_b43_wl(hw); ··· 3211 3211 if (unlikely(skb->len < 2 + 2 + 6)) { 3212 3212 /* Too short, this can't be a valid frame. */ 3213 3213 dev_kfree_skb_any(skb); 3214 - return NETDEV_TX_OK; 3214 + return; 3215 3215 } 3216 3216 B43_WARN_ON(skb_shinfo(skb)->nr_frags); 3217 3217 3218 3218 skb_queue_tail(&wl->tx_queue, skb); 3219 3219 ieee80211_queue_work(wl->hw, &wl->tx_work); 3220 - 3221 - return NETDEV_TX_OK; 3222 3220 } 3223 3221 3224 3222 static void b43_qos_params_upload(struct b43_wldev *dev,
+2 -3
drivers/net/wireless/b43legacy/main.c
··· 2442 2442 return err; 2443 2443 } 2444 2444 2445 - static int b43legacy_op_tx(struct ieee80211_hw *hw, 2446 - struct sk_buff *skb) 2445 + static void b43legacy_op_tx(struct ieee80211_hw *hw, 2446 + struct sk_buff *skb) 2447 2447 { 2448 2448 struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); 2449 2449 struct b43legacy_wldev *dev = wl->current_dev; ··· 2466 2466 /* Drop the packet. */ 2467 2467 dev_kfree_skb_any(skb); 2468 2468 } 2469 - return NETDEV_TX_OK; 2470 2469 } 2471 2470 2472 2471 static int b43legacy_op_conf_tx(struct ieee80211_hw *hw, u16 queue,
+1 -1
drivers/net/wireless/iwlegacy/iwl-4965.h
··· 253 253 int iwl4965_eeprom_check_version(struct iwl_priv *priv); 254 254 255 255 /* mac80211 handlers (for 4965) */ 256 - int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 256 + void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 257 257 int iwl4965_mac_start(struct ieee80211_hw *hw); 258 258 void iwl4965_mac_stop(struct ieee80211_hw *hw); 259 259 void iwl4965_configure_filter(struct ieee80211_hw *hw,
+1 -2
drivers/net/wireless/iwlegacy/iwl3945-base.c
··· 3170 3170 IWL_DEBUG_MAC80211(priv, "leave\n"); 3171 3171 } 3172 3172 3173 - static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3173 + static void iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3174 3174 { 3175 3175 struct iwl_priv *priv = hw->priv; 3176 3176 ··· 3183 3183 dev_kfree_skb_any(skb); 3184 3184 3185 3185 IWL_DEBUG_MAC80211(priv, "leave\n"); 3186 - return NETDEV_TX_OK; 3187 3186 } 3188 3187 3189 3188 void iwl3945_config_ap(struct iwl_priv *priv)
+1 -2
drivers/net/wireless/iwlegacy/iwl4965-base.c
··· 2631 2631 IWL_DEBUG_MAC80211(priv, "leave\n"); 2632 2632 } 2633 2633 2634 - int iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2634 + void iwl4965_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 2635 2635 { 2636 2636 struct iwl_priv *priv = hw->priv; 2637 2637 ··· 2644 2644 dev_kfree_skb_any(skb); 2645 2645 2646 2646 IWL_DEBUG_MACDUMP(priv, "leave\n"); 2647 - return NETDEV_TX_OK; 2648 2647 } 2649 2648 2650 2649 void iwl4965_mac_update_tkip_key(struct ieee80211_hw *hw,
+1 -2
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 3330 3330 IWL_DEBUG_MAC80211(priv, "leave\n"); 3331 3331 } 3332 3332 3333 - int iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3333 + void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3334 3334 { 3335 3335 struct iwl_priv *priv = hw->priv; 3336 3336 ··· 3343 3343 dev_kfree_skb_any(skb); 3344 3344 3345 3345 IWL_DEBUG_MACDUMP(priv, "leave\n"); 3346 - return NETDEV_TX_OK; 3347 3346 } 3348 3347 3349 3348 void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw,
+1 -1
drivers/net/wireless/iwlwifi/iwl-agn.h
··· 356 356 struct iwl_notification_wait *wait_entry); 357 357 358 358 /* mac80211 handlers (for 4965) */ 359 - int iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 359 + void iwlagn_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 360 360 int iwlagn_mac_start(struct ieee80211_hw *hw); 361 361 void iwlagn_mac_stop(struct ieee80211_hw *hw); 362 362 void iwlagn_configure_filter(struct ieee80211_hw *hw,
+1 -2
drivers/net/wireless/libertas_tf/main.c
··· 225 225 lbtf_deb_leave(LBTF_DEB_MAIN); 226 226 } 227 227 228 - static int lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 228 + static void lbtf_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 229 229 { 230 230 struct lbtf_private *priv = hw->priv; 231 231 ··· 236 236 * there are no buffered multicast frames to send 237 237 */ 238 238 ieee80211_stop_queues(priv->hw); 239 - return NETDEV_TX_OK; 240 239 } 241 240 242 241 static void lbtf_tx_work(struct work_struct *work)
+2 -3
drivers/net/wireless/mac80211_hwsim.c
··· 541 541 } 542 542 543 543 544 - static int mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 544 + static void mac80211_hwsim_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 545 545 { 546 546 bool ack; 547 547 struct ieee80211_tx_info *txi; ··· 551 551 if (skb->len < 10) { 552 552 /* Should not happen; just a sanity check for addr1 use */ 553 553 dev_kfree_skb(skb); 554 - return NETDEV_TX_OK; 554 + return; 555 555 } 556 556 557 557 ack = mac80211_hwsim_tx_frame(hw, skb); ··· 571 571 if (!(txi->flags & IEEE80211_TX_CTL_NO_ACK) && ack) 572 572 txi->flags |= IEEE80211_TX_STAT_ACK; 573 573 ieee80211_tx_status_irqsafe(hw, skb); 574 - return NETDEV_TX_OK; 575 574 } 576 575 577 576
+5 -10
drivers/net/wireless/mwl8k.c
··· 1573 1573 txq->txd = NULL; 1574 1574 } 1575 1575 1576 - static int 1576 + static void 1577 1577 mwl8k_txq_xmit(struct ieee80211_hw *hw, int index, struct sk_buff *skb) 1578 1578 { 1579 1579 struct mwl8k_priv *priv = hw->priv; ··· 1635 1635 wiphy_debug(hw->wiphy, 1636 1636 "failed to dma map skb, dropping TX frame.\n"); 1637 1637 dev_kfree_skb(skb); 1638 - return NETDEV_TX_OK; 1638 + return; 1639 1639 } 1640 1640 1641 1641 spin_lock_bh(&priv->tx_lock); ··· 1672 1672 mwl8k_tx_start(priv); 1673 1673 1674 1674 spin_unlock_bh(&priv->tx_lock); 1675 - 1676 - return NETDEV_TX_OK; 1677 1675 } 1678 1676 1679 1677 ··· 3740 3742 /* 3741 3743 * Core driver operations. 3742 3744 */ 3743 - static int mwl8k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3745 + static void mwl8k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 3744 3746 { 3745 3747 struct mwl8k_priv *priv = hw->priv; 3746 3748 int index = skb_get_queue_mapping(skb); 3747 - int rc; 3748 3749 3749 3750 if (!priv->radio_on) { 3750 3751 wiphy_debug(hw->wiphy, 3751 3752 "dropped TX frame since radio disabled\n"); 3752 3753 dev_kfree_skb(skb); 3753 - return NETDEV_TX_OK; 3754 + return; 3754 3755 } 3755 3756 3756 - rc = mwl8k_txq_xmit(hw, index, skb); 3757 - 3758 - return rc; 3757 + mwl8k_txq_xmit(hw, index, skb); 3759 3758 } 3760 3759 3761 3760 static int mwl8k_start(struct ieee80211_hw *hw)
+1 -1
drivers/net/wireless/p54/lmac.h
··· 526 526 void p54_unregister_leds(struct p54_common *priv); 527 527 528 528 /* xmit functions */ 529 - int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb); 529 + void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb); 530 530 int p54_tx_cancel(struct p54_common *priv, __le32 req_id); 531 531 void p54_tx(struct p54_common *priv, struct sk_buff *skb); 532 532
+1 -1
drivers/net/wireless/p54/main.c
··· 157 157 * to cancel the old beacon template by hand, instead the firmware 158 158 * will release the previous one through the feedback mechanism. 159 159 */ 160 - WARN_ON(p54_tx_80211(priv->hw, beacon)); 160 + p54_tx_80211(priv->hw, beacon); 161 161 priv->tsf_high32 = 0; 162 162 priv->tsf_low32 = 0; 163 163
+3 -8
drivers/net/wireless/p54/txrx.c
··· 696 696 } 697 697 } 698 698 699 - int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) 699 + void p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb) 700 700 { 701 701 struct p54_common *priv = dev->priv; 702 702 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 717 717 &hdr_flags, &aid, &burst_allowed); 718 718 719 719 if (p54_tx_qos_accounting_alloc(priv, skb, queue)) { 720 - if (!IS_QOS_QUEUE(queue)) { 721 - dev_kfree_skb_any(skb); 722 - return NETDEV_TX_OK; 723 - } else { 724 - return NETDEV_TX_BUSY; 725 - } 720 + dev_kfree_skb_any(skb); 721 + return; 726 722 } 727 723 728 724 padding = (unsigned long)(skb->data - (sizeof(*hdr) + sizeof(*txhdr))) & 3; ··· 861 865 p54info->extra_len = extra_len; 862 866 863 867 p54_tx(priv, skb); 864 - return NETDEV_TX_OK; 865 868 }
+1 -1
drivers/net/wireless/rt2x00/rt2x00.h
··· 1185 1185 /* 1186 1186 * mac80211 handlers. 1187 1187 */ 1188 - int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 1188 + void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 1189 1189 int rt2x00mac_start(struct ieee80211_hw *hw); 1190 1190 void rt2x00mac_stop(struct ieee80211_hw *hw); 1191 1191 int rt2x00mac_add_interface(struct ieee80211_hw *hw,
+2 -3
drivers/net/wireless/rt2x00/rt2x00mac.c
··· 99 99 return retval; 100 100 } 101 101 102 - int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 102 + void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 103 103 { 104 104 struct rt2x00_dev *rt2x00dev = hw->priv; 105 105 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); ··· 155 155 if (rt2x00queue_threshold(queue)) 156 156 rt2x00queue_pause_queue(queue); 157 157 158 - return NETDEV_TX_OK; 158 + return; 159 159 160 160 exit_fail: 161 161 ieee80211_stop_queue(rt2x00dev->hw, qid); 162 162 dev_kfree_skb_any(skb); 163 - return NETDEV_TX_OK; 164 163 } 165 164 EXPORT_SYMBOL_GPL(rt2x00mac_tx); 166 165
+2 -6
drivers/net/wireless/rtl818x/rtl8180/dev.c
··· 240 240 return IRQ_HANDLED; 241 241 } 242 242 243 - static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 243 + static void rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 244 244 { 245 245 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 246 246 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; ··· 321 321 spin_unlock_irqrestore(&priv->lock, flags); 322 322 323 323 rtl818x_iowrite8(priv, &priv->map->TX_DMA_POLLING, (1 << (prio + 4))); 324 - 325 - return 0; 326 324 } 327 325 328 326 void rtl8180_set_anaparam(struct rtl8180_priv *priv, u32 anaparam) ··· 685 687 struct ieee80211_hw *dev = vif_priv->dev; 686 688 struct ieee80211_mgmt *mgmt; 687 689 struct sk_buff *skb; 688 - int err = 0; 689 690 690 691 /* don't overflow the tx ring */ 691 692 if (ieee80211_queue_stopped(dev, 0)) ··· 705 708 /* TODO: use actual beacon queue */ 706 709 skb_set_queue_mapping(skb, 0); 707 710 708 - err = rtl8180_tx(dev, skb); 709 - WARN_ON(err); 711 + rtl8180_tx(dev, skb); 710 712 711 713 resched: 712 714 /*
+2 -4
drivers/net/wireless/rtl818x/rtl8187/dev.c
··· 227 227 } 228 228 } 229 229 230 - static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 230 + static void rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 231 231 { 232 232 struct rtl8187_priv *priv = dev->priv; 233 233 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 241 241 urb = usb_alloc_urb(0, GFP_ATOMIC); 242 242 if (!urb) { 243 243 kfree_skb(skb); 244 - return NETDEV_TX_OK; 244 + return; 245 245 } 246 246 247 247 flags = skb->len; ··· 309 309 kfree_skb(skb); 310 310 } 311 311 usb_free_urb(urb); 312 - 313 - return NETDEV_TX_OK; 314 312 } 315 313 316 314 static void rtl8187_rx_cb(struct urb *urb)
+2 -3
drivers/net/wireless/rtlwifi/core.c
··· 82 82 mutex_unlock(&rtlpriv->locks.conf_mutex); 83 83 } 84 84 85 - static int rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 85 + static void rtl_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 86 86 { 87 87 struct rtl_priv *rtlpriv = rtl_priv(hw); 88 88 struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw)); ··· 97 97 98 98 rtlpriv->intf_ops->adapter_tx(hw, skb); 99 99 100 - return NETDEV_TX_OK; 100 + return; 101 101 102 102 err_free: 103 103 dev_kfree_skb_any(skb); 104 - return NETDEV_TX_OK; 105 104 } 106 105 107 106 static int rtl_op_add_interface(struct ieee80211_hw *hw,
+1 -3
drivers/net/wireless/wl1251/main.c
··· 375 375 mutex_unlock(&wl->mutex); 376 376 } 377 377 378 - static int wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 378 + static void wl1251_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 379 379 { 380 380 struct wl1251 *wl = hw->priv; 381 381 unsigned long flags; ··· 401 401 wl->tx_queue_stopped = true; 402 402 spin_unlock_irqrestore(&wl->wl_lock, flags); 403 403 } 404 - 405 - return NETDEV_TX_OK; 406 404 } 407 405 408 406 static int wl1251_op_start(struct ieee80211_hw *hw)
+1 -3
drivers/net/wireless/wl12xx/main.c
··· 1034 1034 return ret; 1035 1035 } 1036 1036 1037 - static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1037 + static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 1038 1038 { 1039 1039 struct wl1271 *wl = hw->priv; 1040 1040 unsigned long flags; ··· 1073 1073 1074 1074 if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) 1075 1075 ieee80211_queue_work(wl->hw, &wl->tx_work); 1076 - 1077 - return NETDEV_TX_OK; 1078 1076 } 1079 1077 1080 1078 static struct notifier_block wl1271_dev_notifier = {
+2 -3
drivers/net/wireless/zd1211rw/zd_mac.c
··· 850 850 * control block of the skbuff will be initialized. If necessary the incoming 851 851 * mac80211 queues will be stopped. 852 852 */ 853 - static int zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 853 + static void zd_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 854 854 { 855 855 struct zd_mac *mac = zd_hw_mac(hw); 856 856 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); ··· 865 865 r = zd_usb_tx(&mac->chip.usb, skb); 866 866 if (r) 867 867 goto fail; 868 - return 0; 868 + return; 869 869 870 870 fail: 871 871 dev_kfree_skb(skb); 872 - return 0; 873 872 } 874 873 875 874 /**
+3 -25
drivers/staging/brcm80211/sys/wl_mac80211.c
··· 104 104 static void wl_release_fw(struct wl_info *wl); 105 105 106 106 /* local prototypes */ 107 - static int wl_start(struct sk_buff *skb, struct wl_info *wl); 108 - static int wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw, 109 - struct sk_buff *skb); 110 107 static void wl_dpc(unsigned long data); 111 108 112 109 MODULE_AUTHOR("Broadcom Corporation"); ··· 132 135 133 136 #define HW_TO_WL(hw) (hw->priv) 134 137 #define WL_TO_HW(wl) (wl->pub->ieee_hw) 135 - static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb); 136 138 static int wl_ops_start(struct ieee80211_hw *hw); 137 139 static void wl_ops_stop(struct ieee80211_hw *hw); 138 140 static int wl_ops_add_interface(struct ieee80211_hw *hw, ··· 169 173 enum ieee80211_ampdu_mlme_action action, 170 174 struct ieee80211_sta *sta, u16 tid, u16 *ssn); 171 175 172 - static int wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 176 + static void wl_ops_tx(struct ieee80211_hw *hw, struct sk_buff *skb) 173 177 { 174 - int status; 175 178 struct wl_info *wl = hw->priv; 176 179 WL_LOCK(wl); 177 180 if (!wl->pub->up) { 178 181 WL_ERROR("ops->tx called while down\n"); 179 - status = -ENETDOWN; 182 + kfree_skb(skb); 180 183 goto done; 181 184 } 182 - status = wl_start(skb, wl); 185 + wlc_sendpkt_mac80211(wl->wlc, skb, hw); 183 186 done: 184 187 WL_UNLOCK(wl); 185 - return status; 186 188 } 187 189 188 190 static int wl_ops_start(struct ieee80211_hw *hw) ··· 1308 1314 1309 1315 1310 1316 osl_detach(osh); 1311 - } 1312 - 1313 - /* transmit a packet */ 1314 - static int BCMFASTPATH wl_start(struct sk_buff *skb, struct wl_info *wl) 1315 - { 1316 - if (!wl) 1317 - return -ENETDOWN; 1318 - 1319 - return wl_start_int(wl, WL_TO_HW(wl), skb); 1320 - } 1321 - 1322 - static int BCMFASTPATH 1323 - wl_start_int(struct wl_info *wl, struct ieee80211_hw *hw, struct sk_buff *skb) 1324 - { 1325 - wlc_sendpkt_mac80211(wl->wlc, skb, hw); 1326 - return NETDEV_TX_OK; 1327 1317 } 1328 1318 1329 1319 void wl_txflowcontrol(struct wl_info *wl, struct wl_if *wlif, bool state,
+3 -4
drivers/staging/winbond/wbusb.c
··· 118 118 *total_flags = new_flags; 119 119 } 120 120 121 - static int wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 121 + static void wbsoft_tx(struct ieee80211_hw *dev, struct sk_buff *skb) 122 122 { 123 123 struct wbsoft_priv *priv = dev->priv; 124 124 125 125 if (priv->sMlmeFrame.IsInUsed != PACKET_FREE_TO_USE) { 126 126 priv->sMlmeFrame.wNumTxMMPDUDiscarded++; 127 - return NETDEV_TX_BUSY; 127 + kfree_skb(skb); 128 + return; 128 129 } 129 130 130 131 priv->sMlmeFrame.IsInUsed = PACKET_COME_FROM_MLME; ··· 141 140 */ 142 141 143 142 Mds_Tx(priv); 144 - 145 - return NETDEV_TX_OK; 146 143 } 147 144 148 145 static int wbsoft_start(struct ieee80211_hw *dev)
+1 -1
include/net/mac80211.h
··· 1801 1801 * aborted before it expires. This callback may sleep. 1802 1802 */ 1803 1803 struct ieee80211_ops { 1804 - int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1804 + void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); 1805 1805 int (*start)(struct ieee80211_hw *hw); 1806 1806 void (*stop)(struct ieee80211_hw *hw); 1807 1807 int (*add_interface)(struct ieee80211_hw *hw,
+2 -2
net/mac80211/driver-ops.h
··· 5 5 #include "ieee80211_i.h" 6 6 #include "driver-trace.h" 7 7 8 - static inline int drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 8 + static inline void drv_tx(struct ieee80211_local *local, struct sk_buff *skb) 9 9 { 10 - return local->ops->tx(&local->hw, skb); 10 + local->ops->tx(&local->hw, skb); 11 11 } 12 12 13 13 static inline int drv_start(struct ieee80211_local *local)
+56 -108
net/mac80211/tx.c
··· 33 33 #include "wme.h" 34 34 #include "rate.h" 35 35 36 - #define IEEE80211_TX_OK 0 37 - #define IEEE80211_TX_AGAIN 1 38 - #define IEEE80211_TX_PENDING 2 39 - 40 36 /* misc utils */ 41 37 42 38 static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, ··· 1281 1285 return TX_CONTINUE; 1282 1286 } 1283 1287 1284 - static int __ieee80211_tx(struct ieee80211_local *local, 1285 - struct sk_buff **skbp, 1286 - struct sta_info *sta, 1287 - bool txpending) 1288 + /* 1289 + * Returns false if the frame couldn't be transmitted but was queued instead. 1290 + */ 1291 + static bool __ieee80211_tx(struct ieee80211_local *local, struct sk_buff **skbp, 1292 + struct sta_info *sta, bool txpending) 1288 1293 { 1289 1294 struct sk_buff *skb = *skbp, *next; 1290 1295 struct ieee80211_tx_info *info; 1291 1296 struct ieee80211_sub_if_data *sdata; 1292 1297 unsigned long flags; 1293 - int ret, len; 1298 + int len; 1294 1299 bool fragm = false; 1295 1300 1296 1301 while (skb) { ··· 1299 1302 __le16 fc; 1300 1303 1301 1304 spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 1302 - ret = IEEE80211_TX_OK; 1303 1305 if (local->queue_stop_reasons[q] || 1304 - (!txpending && !skb_queue_empty(&local->pending[q]))) 1305 - ret = IEEE80211_TX_PENDING; 1306 + (!txpending && !skb_queue_empty(&local->pending[q]))) { 1307 + /* 1308 + * Since queue is stopped, queue up frames for later 1309 + * transmission from the tx-pending tasklet when the 1310 + * queue is woken again. 1311 + */ 1312 + 1313 + do { 1314 + next = skb->next; 1315 + skb->next = NULL; 1316 + /* 1317 + * NB: If txpending is true, next must already 1318 + * be NULL since we must've gone through this 1319 + * loop before already; therefore we can just 1320 + * queue the frame to the head without worrying 1321 + * about reordering of fragments. 1322 + */ 1323 + if (unlikely(txpending)) 1324 + __skb_queue_head(&local->pending[q], 1325 + skb); 1326 + else 1327 + __skb_queue_tail(&local->pending[q], 1328 + skb); 1329 + } while ((skb = next)); 1330 + 1331 + spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1332 + flags); 1333 + return false; 1334 + } 1306 1335 spin_unlock_irqrestore(&local->queue_stop_reason_lock, flags); 1307 - if (ret != IEEE80211_TX_OK) 1308 - return ret; 1309 1336 1310 1337 info = IEEE80211_SKB_CB(skb); 1311 1338 ··· 1364 1343 info->control.sta = NULL; 1365 1344 1366 1345 fc = ((struct ieee80211_hdr *)skb->data)->frame_control; 1367 - ret = drv_tx(local, skb); 1368 - if (WARN_ON(ret != NETDEV_TX_OK && skb->len != len)) { 1369 - dev_kfree_skb(skb); 1370 - ret = NETDEV_TX_OK; 1371 - } 1372 - if (ret != NETDEV_TX_OK) { 1373 - info->control.vif = &sdata->vif; 1374 - return IEEE80211_TX_AGAIN; 1375 - } 1346 + drv_tx(local, skb); 1376 1347 1377 1348 ieee80211_tpt_led_trig_tx(local, fc, len); 1378 1349 *skbp = skb = next; ··· 1372 1359 fragm = true; 1373 1360 } 1374 1361 1375 - return IEEE80211_TX_OK; 1362 + return true; 1376 1363 } 1377 1364 1378 1365 /* ··· 1432 1419 return 0; 1433 1420 } 1434 1421 1435 - static void ieee80211_tx(struct ieee80211_sub_if_data *sdata, 1422 + /* 1423 + * Returns false if the frame couldn't be transmitted but was queued instead. 1424 + */ 1425 + static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, 1436 1426 struct sk_buff *skb, bool txpending) 1437 1427 { 1438 1428 struct ieee80211_local *local = sdata->local; 1439 1429 struct ieee80211_tx_data tx; 1440 1430 ieee80211_tx_result res_prepare; 1441 1431 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1442 - struct sk_buff *next; 1443 - unsigned long flags; 1444 - int ret, retries; 1445 1432 u16 queue; 1433 + bool result = true; 1446 1434 1447 1435 queue = skb_get_queue_mapping(skb); 1448 1436 1449 1437 if (unlikely(skb->len < 10)) { 1450 1438 dev_kfree_skb(skb); 1451 - return; 1439 + return true; 1452 1440 } 1453 1441 1454 1442 rcu_read_lock(); ··· 1459 1445 1460 1446 if (unlikely(res_prepare == TX_DROP)) { 1461 1447 dev_kfree_skb(skb); 1462 - rcu_read_unlock(); 1463 - return; 1448 + goto out; 1464 1449 } else if (unlikely(res_prepare == TX_QUEUED)) { 1465 - rcu_read_unlock(); 1466 - return; 1450 + goto out; 1467 1451 } 1468 1452 1469 1453 tx.channel = local->hw.conf.channel; 1470 1454 info->band = tx.channel->band; 1471 1455 1472 - if (invoke_tx_handlers(&tx)) 1473 - goto out; 1474 - 1475 - retries = 0; 1476 - retry: 1477 - ret = __ieee80211_tx(local, &tx.skb, tx.sta, txpending); 1478 - switch (ret) { 1479 - case IEEE80211_TX_OK: 1480 - break; 1481 - case IEEE80211_TX_AGAIN: 1482 - /* 1483 - * Since there are no fragmented frames on A-MPDU 1484 - * queues, there's no reason for a driver to reject 1485 - * a frame there, warn and drop it. 1486 - */ 1487 - if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) 1488 - goto drop; 1489 - /* fall through */ 1490 - case IEEE80211_TX_PENDING: 1491 - skb = tx.skb; 1492 - 1493 - spin_lock_irqsave(&local->queue_stop_reason_lock, flags); 1494 - 1495 - if (local->queue_stop_reasons[queue] || 1496 - !skb_queue_empty(&local->pending[queue])) { 1497 - /* 1498 - * if queue is stopped, queue up frames for later 1499 - * transmission from the tasklet 1500 - */ 1501 - do { 1502 - next = skb->next; 1503 - skb->next = NULL; 1504 - if (unlikely(txpending)) 1505 - __skb_queue_head(&local->pending[queue], 1506 - skb); 1507 - else 1508 - __skb_queue_tail(&local->pending[queue], 1509 - skb); 1510 - } while ((skb = next)); 1511 - 1512 - spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1513 - flags); 1514 - } else { 1515 - /* 1516 - * otherwise retry, but this is a race condition or 1517 - * a driver bug (which we warn about if it persists) 1518 - */ 1519 - spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1520 - flags); 1521 - 1522 - retries++; 1523 - if (WARN(retries > 10, "tx refused but queue active\n")) 1524 - goto drop; 1525 - goto retry; 1526 - } 1527 - } 1456 + if (!invoke_tx_handlers(&tx)) 1457 + result = __ieee80211_tx(local, &tx.skb, tx.sta, txpending); 1528 1458 out: 1529 1459 rcu_read_unlock(); 1530 - return; 1531 - 1532 - drop: 1533 - rcu_read_unlock(); 1534 - 1535 - skb = tx.skb; 1536 - while (skb) { 1537 - next = skb->next; 1538 - dev_kfree_skb(skb); 1539 - skb = next; 1540 - } 1460 + return result; 1541 1461 } 1542 1462 1543 1463 /* device xmit handlers */ ··· 2018 2070 skb_queue_purge(&local->pending[i]); 2019 2071 } 2020 2072 2073 + /* 2074 + * Returns false if the frame couldn't be transmitted but was queued instead, 2075 + * which in this case means re-queued -- take as an indication to stop sending 2076 + * more pending frames. 2077 + */ 2021 2078 static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, 2022 2079 struct sk_buff *skb) 2023 2080 { ··· 2030 2077 struct ieee80211_sub_if_data *sdata; 2031 2078 struct sta_info *sta; 2032 2079 struct ieee80211_hdr *hdr; 2033 - int ret; 2034 - bool result = true; 2080 + bool result; 2035 2081 2036 2082 sdata = vif_to_sdata(info->control.vif); 2037 2083 2038 2084 if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { 2039 - ieee80211_tx(sdata, skb, true); 2085 + result = ieee80211_tx(sdata, skb, true); 2040 2086 } else { 2041 2087 hdr = (struct ieee80211_hdr *)skb->data; 2042 2088 sta = sta_info_get(sdata, hdr->addr1); 2043 2089 2044 - ret = __ieee80211_tx(local, &skb, sta, true); 2045 - if (ret != IEEE80211_TX_OK) 2046 - result = false; 2090 + result = __ieee80211_tx(local, &skb, sta, true); 2047 2091 } 2048 2092 2049 2093 return result; ··· 2082 2132 flags); 2083 2133 2084 2134 txok = ieee80211_tx_pending_skb(local, skb); 2085 - if (!txok) 2086 - __skb_queue_head(&local->pending[i], skb); 2087 2135 spin_lock_irqsave(&local->queue_stop_reason_lock, 2088 2136 flags); 2089 2137 if (!txok)