5.19.2-rc1 review
Subsystems (12)
Greg Kroah-Hartman
maintainerPATCH 475/1157 wifi: mac80211: move some future per-link data to bss_conf
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit d0a9123ef548def5c8880e83e5df948eb5b55c62 ]
To add MLD, reuse the bss_conf structure later for per-link information, so move some things into it that are per link.
Most transformations were done with the following spatch:
@@
expression sdata;
identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color };
@@
-sdata->vif.var
+sdata->vif.bss_conf.var
@@
struct ieee80211_vif *vif;
identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color };
@@
-vif->var
+vif->bss_conf.var--- drivers/net/wireless/ath/ath10k/htt_rx.c | 2 +- drivers/net/wireless/ath/ath10k/mac.c | 8 ++-- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 +- drivers/net/wireless/ath/ath10k/wmi.c | 2 +- drivers/net/wireless/ath/ath11k/mac.c | 12 +++--- drivers/net/wireless/ath/ath11k/wmi.c | 4 +- drivers/net/wireless/ath/ath9k/beacon.c | 2 +- .../net/wireless/ath/ath9k/htc_drv_beacon.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/coex.c | 6 +-- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 2 +- .../wireless/intel/iwlwifi/mvm/debugfs-vif.c | 4 +- .../intel/iwlwifi/mvm/ftm-responder.c | 4 +- .../net/wireless/intel/iwlwifi/mvm/mac-ctxt.c | 10 ++--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 ++--- .../net/wireless/intel/iwlwifi/mvm/power.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/rs.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/tdls.c | 4 +- .../wireless/intel/iwlwifi/mvm/time-event.c | 4 +- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 2 +- drivers/net/wireless/mac80211_hwsim.c | 22 ++++++---- drivers/net/wireless/mediatek/mt76/mac80211.c | 4 +- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 10 ++--- drivers/net/wireless/ti/wlcore/main.c | 2 +- include/net/mac80211.h | 40 +++++++++--------- net/mac80211/airtime.c | 4 +- net/mac80211/cfg.c | 40 +++++++++--------- net/mac80211/chan.c | 39 ++++++++--------- net/mac80211/driver-ops.h | 2 +- net/mac80211/ethtool.c | 4 +- net/mac80211/ibss.c | 10 ++--- net/mac80211/ieee80211_i.h | 6 +-- net/mac80211/iface.c | 8 ++-- net/mac80211/main.c | 4 +- net/mac80211/mesh.c | 14 +++---- net/mac80211/mlme.c | 42 +++++++++---------- net/mac80211/ocb.c | 3 +- net/mac80211/offchannel.c | 6 +-- net/mac80211/rate.c | 5 ++- net/mac80211/rx.c | 2 +- net/mac80211/sta_info.c | 2 +- net/mac80211/tdls.c | 6 +-- net/mac80211/tx.c | 28 ++++++------- net/mac80211/util.c | 16 +++---- net/mac80211/vht.c | 6 +-- 45 files changed, 209 insertions(+), 202 deletions(-)
drivers/net/wireless/ath/ath10k/htt_rx.c +1 -1
@@ -3840,7 +3840,7 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar,switch (txrate.flags) {case WMI_RATE_PREAMBLE_OFDM :if (arsta->arvif && arsta->arvif->vif) - conf =rcu_dereference (arsta->arvif->vif->chanctx_conf); + conf =rcu_dereference (arsta->arvif->vif->bss_conf.chanctx_conf);if (conf && conf->def.chan->band ==NL80211_BAND_5GHZ ) arsta->tx_info.status.rates[0 ].idx = rate_idx -4 ;break ;
drivers/net/wireless/ath/ath10k/mac.c +4 -4
@@ -659,7 +659,7 @@ int ath10k_mac_vif_chan(struct ieee80211_vif *vif,struct ieee80211_chanctx_conf *conf;rcu_read_lock (); - conf =rcu_dereference (vif->chanctx_conf); + conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (!conf) {rcu_read_unlock ();return -ENOENT ;
@@ -2028,7 +2028,7 @@ static void ath10k_mac_vif_ap_csa_count_down(struct ath10k_vif *arvif)if (arvif->vdev_type !=WMI_VDEV_TYPE_AP )return ; -if (!vif->csa_active) +if (!vif->bss_conf.csa_active)return ;if (!arvif->is_up)
@@ -8798,7 +8798,7 @@ ath10k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, {struct ath10k_mac_change_chanctx_arg *arg = data; -if (rcu_access_pointer (vif->chanctx_conf) != arg->ctx) +if (rcu_access_pointer (vif->bss_conf.chanctx_conf) != arg->ctx)return ; arg->n_vifs++;
@@ -8811,7 +8811,7 @@ ath10k_mac_change_chanctx_fill_iter(void *data, u8 *mac,struct ath10k_mac_change_chanctx_arg *arg = data;struct ieee80211_chanctx_conf *ctx; - ctx =rcu_access_pointer (vif->chanctx_conf); + ctx =rcu_access_pointer (vif->bss_conf.chanctx_conf);if (ctx != arg->ctx)return ;
drivers/net/wireless/ath/ath10k/wmi-tlv.c +1 -1
@@ -205,7 +205,7 @@ static int ath10k_wmi_tlv_event_bcn_tx_status(struct ath10k *ar, } arvif =ath10k_get_arvif (ar, vdev_id); -if (arvif && arvif->is_up && arvif->vif->csa_active) +if (arvif && arvif->is_up && arvif->vif->bss_conf.csa_active)ieee80211_queue_work (ar->hw, &arvif->ap_csa_work);kfree (tb);
drivers/net/wireless/ath/ath10k/wmi.c +1 -1
@@ -3882,7 +3882,7 @@ void ath10k_wmi_event_host_swba(struct ath10k *ar, struct sk_buff *skb)* Once CSA counter is completed stop sending beacons until * actual channel switch is done */ -if (arvif->vif->csa_active && +if (arvif->vif->bss_conf.csa_active &&ieee80211_beacon_cntdwn_is_complete (arvif->vif)) {ieee80211_csa_finish (arvif->vif);continue ;
drivers/net/wireless/ath/ath11k/mac.c +6 -6
@@ -505,7 +505,7 @@ static int ath11k_mac_vif_chan(struct ieee80211_vif *vif,struct ieee80211_chanctx_conf *conf;rcu_read_lock (); - conf =rcu_dereference (vif->chanctx_conf); + conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (!conf) {rcu_read_unlock ();return -ENOENT ;
@@ -1398,10 +1398,10 @@ void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) {struct ieee80211_vif *vif = arvif->vif; -if (!vif->color_change_active && !arvif->bcca_zero_sent) +if (!vif->bss_conf.color_change_active && !arvif->bcca_zero_sent)return ; -if (vif->color_change_active &&ieee80211_beacon_cntdwn_is_complete (vif)) { +if (vif->bss_conf.color_change_active &&ieee80211_beacon_cntdwn_is_complete (vif)) { arvif->bcca_zero_sent = true;ieee80211_color_change_finish (vif);return ;
@@ -1409,7 +1409,7 @@ void ath11k_mac_bcn_tx_event(struct ath11k_vif *arvif) arvif->bcca_zero_sent = false; -if (vif->color_change_active) +if (vif->bss_conf.color_change_active)ieee80211_beacon_update_cntdwn (vif);ath11k_mac_setup_bcn_tmpl (arvif); }
@@ -6848,7 +6848,7 @@ ath11k_mac_change_chanctx_cnt_iter(void *data, u8 *mac, {struct ath11k_mac_change_chanctx_arg *arg = data; -if (rcu_access_pointer (vif->chanctx_conf) != arg->ctx) +if (rcu_access_pointer (vif->bss_conf.chanctx_conf) != arg->ctx)return ; arg->n_vifs++;
@@ -6861,7 +6861,7 @@ ath11k_mac_change_chanctx_fill_iter(void *data, u8 *mac,struct ath11k_mac_change_chanctx_arg *arg = data;struct ieee80211_chanctx_conf *ctx; - ctx =rcu_access_pointer (vif->chanctx_conf); + ctx =rcu_access_pointer (vif->bss_conf.chanctx_conf);if (ctx != arg->ctx)return ;
drivers/net/wireless/ath/ath11k/wmi.c +2 -2
@@ -1700,7 +1700,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id, cmd->vdev_id = vdev_id; cmd->tim_ie_offset = offs->tim_offset; -if (vif->csa_active) { +if (vif->bss_conf.csa_active) { cmd->csa_switch_count_offset = offs->cntdwn_counter_offs[0 ]; cmd->ext_csa_switch_count_offset = offs->cntdwn_counter_offs[1 ]; }
@@ -7476,7 +7476,7 @@ ath11k_wmi_process_csa_switch_count_event(struct ath11k_base *ab,continue ; } -if (arvif->is_up && arvif->vif->csa_active) +if (arvif->is_up && arvif->vif->bss_conf.csa_active)ieee80211_csa_finish (arvif->vif); }rcu_read_unlock ();
drivers/net/wireless/ath/ath9k/beacon.c +1 -1
@@ -362,7 +362,7 @@ static void ath9k_set_tsfadjust(struct ath_softc *sc,bool ath9k_csa_is_finished (struct ath_softc *sc,struct ieee80211_vif *vif) { -if (!vif || !vif->csa_active) +if (!vif || !vif->bss_conf.csa_active)return false;if (!ieee80211_beacon_cntdwn_is_complete (vif))
drivers/net/wireless/ath/ath9k/htc_drv_beacon.c +1 -1
@@ -511,7 +511,7 @@ bool ath9k_htc_csa_is_finished(struct ath9k_htc_priv *priv)struct ieee80211_vif *vif; vif = priv->csa_vif; -if (!vif || !vif->csa_active) +if (!vif || !vif->bss_conf.csa_active)return false;if (!ieee80211_beacon_cntdwn_is_complete (vif))
drivers/net/wireless/intel/iwlwifi/mvm/coex.c +3 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2013-2014, 2018-2020 Intel Corporation +* Copyright (C) 2013-2014, 2018-2020, 2022 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH */ #include <linux/ieee80211.h>
@@ -106,7 +106,7 @@ iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (!chanctx_conf || chanctx_conf->def.chan->band !=NL80211_BAND_2GHZ ) {
@@ -283,7 +283,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,return ; } - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);/* If channel context is invalid or not on 2.4GHz .. */ if ((!chanctx_conf ||
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +1 -1
@@ -731,7 +731,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,return -EINVAL ;rcu_read_lock (); - ctx =rcu_dereference (vif->chanctx_conf); + ctx =rcu_dereference (vif->bss_conf.chanctx_conf);if (WARN_ON (!ctx)) {rcu_read_unlock ();return -EINVAL ;
drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c +2 -2
@@ -234,7 +234,7 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file, }rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (chanctx_conf) pos += scnprintf(buf+pos, bufsz-pos, "idle rx chains %d, active rx chains: %d\n",
@@ -597,7 +597,7 @@ static ssize_t iwl_dbgfs_rx_phyinfo_write(struct ieee80211_vif *vif, char *buf,mutex_lock (&mvm->mutex);rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);/* make sure the channel context is assigned */ if (!chanctx_conf) {rcu_read_unlock ();
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c +2 -2
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* * Copyright (C) 2015-2017 Intel Deutschland GmbH -* Copyright (C) 2018-2021 Intel Corporation +* Copyright (C) 2018-2022 Intel Corporation */ #include <net/cfg80211.h> #include <linux/etherdevice.h>
@@ -398,7 +398,7 @@ int iwl_mvm_ftm_start_responder(struct iwl_mvm *mvm, struct ieee80211_vif *vif) }rcu_read_lock (); - pctx =rcu_dereference (vif->chanctx_conf); + pctx =rcu_dereference (vif->bss_conf.chanctx_conf);/* Copy the ctx to unlock the rcu and send the phy ctxt. We don't care * about changes in the ctx after releasing the lock because the driver * is still protected by the mutex. */
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c +5 -5
@@ -481,7 +481,7 @@ static void iwl_mvm_mac_ctxt_cmd_common(struct iwl_mvm *mvm,eth_broadcast_addr (cmd->bssid_addr);rcu_read_lock (); - chanctx =rcu_dereference (vif->chanctx_conf); + chanctx =rcu_dereference (vif->bss_conf.chanctx_conf);iwl_mvm_ack_rates (mvm, vif, chanctx ? chanctx->def.chan->band :NL80211_BAND_2GHZ , &cck_ack_rates, &ofdm_ack_rates);
@@ -934,7 +934,7 @@ static int iwl_mvm_mac_ctxt_send_beacon_v9(struct iwl_mvm *mvm,/* Enable FILS on PSC channels only */ rcu_read_lock (); - ctx =rcu_dereference (vif->chanctx_conf); + ctx =rcu_dereference (vif->bss_conf.chanctx_conf); channel =ieee80211_frequency_to_channel (ctx->def.chan->center_freq);WARN_ON (channel ==0 ); if (cfg80211_channel_is_psc(ctx->def.chan) &&
@@ -1335,7 +1335,7 @@ void iwl_mvm_rx_beacon_notif(struct iwl_mvm *mvm, csa_vif =rcu_dereference_protected (mvm->csa_vif,lockdep_is_held (&mvm->mutex)); -if (unlikely (csa_vif && csa_vif->csa_active)) +if (unlikely (csa_vif && csa_vif->bss_conf.csa_active))iwl_mvm_csa_count_down (mvm, csa_vif, mvm->ap_last_beacon_gp2, (status ==TX_STATUS_SUCCESS ));
@@ -1558,7 +1558,7 @@ void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,switch (vif->type) {case NL80211_IFTYPE_AP : csa_vif =rcu_dereference (mvm->csa_vif); -if (WARN_ON (!csa_vif || !csa_vif->csa_active || +if (WARN_ON (!csa_vif || !csa_vif->bss_conf.csa_active || csa_vif != vif)) goto out_unlock;
@@ -1587,7 +1587,7 @@ void iwl_mvm_channel_switch_start_notif(struct iwl_mvm *mvm,*/ if (iwl_fw_lookup_notif_ver (mvm->fw,MAC_CONF_GROUP ,CHANNEL_SWITCH_ERROR_NOTIF , -0 ) && !vif->csa_active) { +0 ) && !vif->bss_conf.csa_active) {IWL_DEBUG_INFO (mvm,"Channel Switch was canceled\n" );iwl_mvm_cancel_channel_switch (mvm, vif, mac_id);break ;
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +5 -5
@@ -1768,7 +1768,7 @@ static int iwl_mvm_update_mu_groups(struct iwl_mvm *mvm,static void iwl_mvm_mu_mimo_iface_iterator (void *_data,u8 *mac,struct ieee80211_vif *vif) { -if (vif->mu_mimo_owner) { +if (vif->bss_conf.mu_mimo_owner) {struct iwl_mu_group_mgmt_notif *notif = _data;/*
@@ -1965,7 +1965,7 @@ static void iwl_mvm_cfg_he_sta(struct iwl_mvm *mvm,rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return ;
@@ -2337,7 +2337,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,* However, on HW restart we should restore this data. */ if (test_bit (IWL_MVM_STATUS_IN_HW_RESTART , &mvm->status) && - (changes &BSS_CHANGED_MU_GROUPS ) && vif->mu_mimo_owner) { + (changes &BSS_CHANGED_MU_GROUPS ) && vif->bss_conf.mu_mimo_owner) { ret =iwl_mvm_update_mu_groups (mvm, vif);if (ret) IWL_ERR(mvm,
@@ -4004,7 +4004,7 @@ static void iwl_mvm_ftm_responder_chanctx_iter(void *_data, u8 *mac, {struct iwl_mvm_ftm_responder_iter_data *data = _data; -if (rcu_access_pointer (vif->chanctx_conf) == data->ctx && +if (rcu_access_pointer (vif->bss_conf.chanctx_conf) == data->ctx && vif->type ==NL80211_IFTYPE_AP && vif->bss_conf.ftmr_params) data->responder = true; }
@@ -4631,7 +4631,7 @@ static int iwl_mvm_pre_channel_switch(struct ieee80211_hw *hw, csa_vif =rcu_dereference_protected (mvm->csa_vif,lockdep_is_held (&mvm->mutex)); -if (WARN_ONCE (csa_vif && csa_vif->csa_active, +if (WARN_ONCE (csa_vif && csa_vif->bss_conf.csa_active,"Another CSA is already in progress" )) { ret = -EBUSY ; goto out_unlock;
drivers/net/wireless/intel/iwlwifi/mvm/power.c +1 -1
@@ -283,7 +283,7 @@ static bool iwl_mvm_power_is_radar(struct ieee80211_vif *vif)bool radar_detect = false;rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);WARN_ON (!chanctx_conf);if (chanctx_conf) { chan = chanctx_conf->def.chan;
drivers/net/wireless/intel/iwlwifi/mvm/rs.c +1 -1
@@ -1980,7 +1980,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,#endif rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) band =NUM_NL80211_BANDS ;else
drivers/net/wireless/intel/iwlwifi/mvm/tdls.c +2 -2
@@ -2,7 +2,7 @@/* * Copyright (C) 2014 Intel Mobile Communications GmbH * Copyright (C) 2017 Intel Deutschland GmbH -* Copyright (C) 2018-2020 Intel Corporation +* Copyright (C) 2018-2020, 2022 Intel Corporation */ #include <linux/etherdevice.h> #include "mvm.h"
@@ -380,7 +380,7 @@ iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, type == TDLS_MOVE_CH) {/* we need to return to base channel */ struct ieee80211_chanctx_conf *chanctx = -rcu_dereference (vif->chanctx_conf); +rcu_dereference (vif->bss_conf.chanctx_conf);if (WARN_ON_ONCE (!chanctx)) {rcu_read_unlock ();
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +2 -2
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2012-2014, 2018-2021 Intel Corporation +* Copyright (C) 2012-2014, 2018-2022 Intel Corporation * Copyright (C) 2013-2015 Intel Mobile Communications GmbH * Copyright (C) 2017 Intel Deutschland GmbH */
@@ -123,7 +123,7 @@ static void iwl_mvm_csa_noa_start(struct iwl_mvm *mvm)rcu_read_lock (); csa_vif =rcu_dereference (mvm->csa_vif); -if (!csa_vif || !csa_vif->csa_active) +if (!csa_vif || !csa_vif->bss_conf.csa_active) goto out_unlock;IWL_DEBUG_TE (mvm,"CSA NOA started\n" );
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +1 -1
@@ -1959,7 +1959,7 @@ static void iwl_mvm_tx_reclaim(struct iwl_mvm *mvm, int sta_id, int tid,if (mvmsta->vif) chanctx_conf = -rcu_dereference (mvmsta->vif->chanctx_conf); +rcu_dereference (mvmsta->vif->bss_conf.chanctx_conf);if (WARN_ON_ONCE (!chanctx_conf)) goto out;
drivers/net/wireless/mac80211_hwsim.c +13 -9
@@ -889,7 +889,7 @@ static void hwsim_send_ps_poll(void *dat, u8 *mac, struct ieee80211_vif *vif)rcu_read_lock ();mac80211_hwsim_tx_frame (data->hw, skb, -rcu_dereference (vif->chanctx_conf)->def.chan); +rcu_dereference (vif->bss_conf.chanctx_conf)->def.chan);rcu_read_unlock (); }
@@ -922,7 +922,7 @@ static void hwsim_send_nullfunc(struct mac80211_hwsim_data *data, u8 *mac,rcu_read_lock ();mac80211_hwsim_tx_frame (data->hw, skb, -rcu_dereference (vif->chanctx_conf)->def.chan); +rcu_dereference (vif->bss_conf.chanctx_conf)->def.chan);rcu_read_unlock (); }
@@ -1464,11 +1464,11 @@ static void mac80211_hwsim_tx_iter(void *_data, u8 *addr, {struct tx_iter_data *data = _data; -if (!vif->chanctx_conf) +if (!vif->bss_conf.chanctx_conf)return ;if (!hwsim_chans_compat (data->channel, -rcu_dereference (vif->chanctx_conf)->def.chan)) +rcu_dereference (vif->bss_conf.chanctx_conf)->def.chan))return ; data->receive = true;
@@ -1686,7 +1686,11 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw, }else if (txi->hw_queue ==4 ) { channel = data->tmp_chan; }else { - chanctx_conf =rcu_dereference (txi->control.vif->chanctx_conf); +struct ieee80211_bss_conf *bss_conf; + + bss_conf = &txi->control.vif->bss_conf; + + chanctx_conf =rcu_dereference (bss_conf->chanctx_conf);if (chanctx_conf) { channel = chanctx_conf->def.chan; confbw = chanctx_conf->def.width;
@@ -1935,14 +1939,14 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, }mac80211_hwsim_tx_frame (hw, skb, -rcu_dereference (vif->chanctx_conf)->def.chan); +rcu_dereference (vif->bss_conf.chanctx_conf)->def.chan);while ((skb =ieee80211_get_buffered_bc (hw, vif)) !=NULL ) {mac80211_hwsim_tx_frame (hw, skb, -rcu_dereference (vif->chanctx_conf)->def.chan); +rcu_dereference (vif->bss_conf.chanctx_conf)->def.chan); } -if (vif->csa_active &&ieee80211_beacon_cntdwn_is_complete (vif)) +if (vif->bss_conf.csa_active &&ieee80211_beacon_cntdwn_is_complete (vif))ieee80211_csa_finish (vif); }
@@ -2204,7 +2208,7 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,struct ieee80211_chanctx_conf *chanctx_conf;rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (!WARN_ON (!chanctx_conf)) confbw = chanctx_conf->def.width;
drivers/net/wireless/mediatek/mt76/mac80211.c +2 -2
@@ -1459,7 +1459,7 @@ EXPORT_SYMBOL_GPL(mt76_get_sar_power);static void __mt76_csa_finish (void *priv,u8 *mac,struct ieee80211_vif *vif) { -if (vif->csa_active &&ieee80211_beacon_cntdwn_is_complete (vif)) +if (vif->bss_conf.csa_active &&ieee80211_beacon_cntdwn_is_complete (vif))ieee80211_csa_finish (vif); }
@@ -1481,7 +1481,7 @@ __mt76_csa_check(void *priv, u8 *mac, struct ieee80211_vif *vif) {struct mt76_dev *dev = priv; -if (!vif->csa_active) +if (!vif->bss_conf.csa_active)return ; dev->csa_complete |=ieee80211_beacon_cntdwn_is_complete (vif);
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +1 -1
@@ -363,7 +363,7 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *dev)static void mt7615_mcu_csa_finish (void *priv,u8 *mac,struct ieee80211_vif *vif) { -if (vif->csa_active) +if (vif->bss_conf.csa_active)ieee80211_csa_finish (vif); }
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +5 -5
@@ -322,7 +322,7 @@ int mt7915_mcu_wa_cmd(struct mt7915_dev *dev, int cmd, u32 a1, u32 a2, u32 a3)static void mt7915_mcu_csa_finish (void *priv,u8 *mac,struct ieee80211_vif *vif) { -if (vif->csa_active) +if (vif->bss_conf.csa_active)ieee80211_csa_finish (vif); }
@@ -409,7 +409,7 @@ mt7915_mcu_rx_log_message(struct mt7915_dev *dev, struct sk_buff *skb)static void mt7915_mcu_cca_finish (void *priv,u8 *mac,struct ieee80211_vif *vif) { -if (!vif->color_change_active) +if (!vif->bss_conf.color_change_active)return ;ieee80211_color_change_finish (vif);
@@ -1818,7 +1818,7 @@ mt7915_mcu_beacon_cntdwn(struct ieee80211_vif *vif, struct sk_buff *rskb,if (!offs->cntdwn_counter_offs[0 ])return ; - sub_tag = vif->csa_active ?BSS_INFO_BCN_CSA :BSS_INFO_BCN_BCC ; + sub_tag = vif->bss_conf.csa_active ?BSS_INFO_BCN_CSA :BSS_INFO_BCN_BCC ; tlv =mt7915_mcu_add_nested_subtlv (rskb, sub_tag,sizeof (*info), &bcn->sub_ntlv, &bcn->len); info = (struct bss_info_bcn_cntdwn *)tlv;
@@ -1903,9 +1903,9 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif,if (offs->cntdwn_counter_offs[0 ]) {u16 offset = offs->cntdwn_counter_offs[0 ]; -if (vif->csa_active) +if (vif->bss_conf.csa_active) cont->csa_ofs =cpu_to_le16 (offset -4 ); -if (vif->color_change_active) +if (vif->bss_conf.color_change_active) cont->bcc_ofs =cpu_to_le16 (offset -3 ); }
drivers/net/wireless/ti/wlcore/main.c +1 -1
@@ -4675,7 +4675,7 @@ static void wlcore_op_change_chanctx(struct ieee80211_hw *hw,struct ieee80211_vif *vif =wl12xx_wlvif_to_vif (wlvif);rcu_read_lock (); -if (rcu_access_pointer (vif->chanctx_conf) != ctx) { +if (rcu_access_pointer (vif->bss_conf.chanctx_conf) != ctx) {rcu_read_unlock ();continue ; }
include/net/mac80211.h +20 -20
@@ -636,6 +636,19 @@ struct ieee80211_fils_discovery {* @tx_pwr_env_num: number of @tx_pwr_env. * @pwr_reduction: power constraint of BSS. * @eht_support: does this BSS support EHT +* @csa_active: marks whether a channel switch is going on. Internally it is +* write-protected by sdata_lock and local->mtx so holding either is fine +* for read access. +* @mu_mimo_owner: indicates interface owns MU-MIMO capability +* @chanctx_conf: The channel context this interface is assigned to, or %NULL +* when it is not assigned. This pointer is RCU-protected due to the TX +* path needing to access it; even though the netdev carrier will always +* be off when it is %NULL there can still be races and packets could be +* processed after it switches back to %NULL. +* @color_change_active: marks whether a color change is ongoing. Internally it is +* write-protected by sdata_lock and local->mtx so holding either is fine +* for read access. +* @color_change_color: the bss color that will be used after the change. */ struct ieee80211_bss_conf {const u8 *bssid;
@@ -711,6 +724,13 @@ struct ieee80211_bss_conf {u8 tx_pwr_env_num;u8 pwr_reduction;bool eht_support; + +bool csa_active; +bool mu_mimo_owner; +struct ieee80211_chanctx_conf __rcu *chanctx_conf; + +bool color_change_active; +u8 color_change_color; };/**
@@ -1713,10 +1733,6 @@ enum ieee80211_offload_flags {* @addr: address of this interface * @p2p: indicates whether this AP or STA interface is a p2p * interface, i.e. a GO or p2p-sta respectively -* @csa_active: marks whether a channel switch is going on. Internally it is -* write-protected by sdata_lock and local->mtx so holding either is fine -* for read access. -* @mu_mimo_owner: indicates interface owns MU-MIMO capability * @driver_flags: flags/capabilities the driver has for this interface, * these need to be set (or cleared) when the interface is added * or, if supported by the driver, the interface type is changed
@@ -1728,11 +1744,6 @@ enum ieee80211_offload_flags {* restrictions. * @hw_queue: hardware queue for each AC * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only -* @chanctx_conf: The channel context this interface is assigned to, or %NULL -* when it is not assigned. This pointer is RCU-protected due to the TX -* path needing to access it; even though the netdev carrier will always -* be off when it is %NULL there can still be races and packets could be -* processed after it switches back to %NULL. * @debugfs_dir: debugfs dentry, can be used by drivers to create own per * interface debug files. Note that it will be NULL for the virtual * monitor interface (if that is requested.)
@@ -1747,10 +1758,6 @@ enum ieee80211_offload_flags {* protected by fq->lock. * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see * &enum ieee80211_offload_flags. -* @color_change_active: marks whether a color change is ongoing. Internally it is -* write-protected by sdata_lock and local->mtx so holding either is fine -* for read access. -* @color_change_color: the bss color that will be used after the change. * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled. */ struct ieee80211_vif {
@@ -1758,16 +1765,12 @@ struct ieee80211_vif {struct ieee80211_bss_conf bss_conf;u8 addr[ETH_ALEN ]__aligned(2) ;bool p2p; -bool csa_active; -bool mu_mimo_owner;u8 cab_queue;u8 hw_queue[IEEE80211_NUM_ACS ];struct ieee80211_txq *txq; -struct ieee80211_chanctx_conf __rcu *chanctx_conf; -u32 driver_flags;u32 offload_flags;
@@ -1780,9 +1783,6 @@ struct ieee80211_vif {bool txqs_stopped[IEEE80211_NUM_ACS ]; -bool color_change_active; -u8 color_change_color; -struct ieee80211_vif *mbssid_tx_vif;/* must be last */
net/mac80211/airtime.c +2 -2
@@ -1,7 +1,7 @@// SPDX-License-Identifier: ISC /* * Copyright (C) 2019 Felix Fietkau <[email protected]> -* Copyright (C) 2021 Intel Corporation +* Copyright (C) 2021-2022 Intel Corporation */ #include <net/mac80211.h>
@@ -637,7 +637,7 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, len +=38 ;/* Ethernet header length */ - conf =rcu_dereference (vif->chanctx_conf); + conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (conf) { band = conf->def.chan->band; shift =ieee80211_chandef_get_shift (&conf->def);
net/mac80211/cfg.c +20 -20
@@ -53,7 +53,7 @@ static void ieee80211_set_mu_mimo_follow(struct ieee80211_sub_if_data *sdata, params->vht_mumimo_follow_addr); } - sdata->vif.mu_mimo_owner = mu_mimo_groups || mu_mimo_follow; + sdata->vif.bss_conf.mu_mimo_owner = mu_mimo_groups || mu_mimo_follow; } static int ieee80211_set_mon_options(struct ieee80211_sub_if_data *sdata,
@@ -1326,7 +1326,7 @@ static int ieee80211_change_beacon(struct wiphy *wiphy, struct net_device *dev,/* don't allow changing the beacon while a countdown is in place - offset * of channel switch counter may change */ -if (sdata->vif.csa_active || sdata->vif.color_change_active) +if (sdata->vif.bss_conf.csa_active || sdata->vif.bss_conf.color_change_active)return -EBUSY ; old =sdata_dereference (sdata->u.ap.beacon, sdata);
@@ -1384,7 +1384,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,/* abort any running channel switch */ mutex_lock (&local->mtx); - sdata->vif.csa_active = false; + sdata->vif.bss_conf.csa_active = false;if (sdata->csa_block_tx) {ieee80211_wake_vif_queues (local, sdata,IEEE80211_QUEUE_STOP_REASON_CSA );
@@ -3083,7 +3083,7 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,* to send something, and if we're an AP we have to be able to do * so at a basic rate so that all clients can receive it. */ -if (rcu_access_pointer (sdata->vif.chanctx_conf) && +if (rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) && sdata->vif.bss_conf.chandef.chan) {u32 basic_rates = sdata->vif.bss_conf.basic_rates;enum nl80211_band band = sdata->vif.bss_conf.chandef.chan->band;
@@ -3390,7 +3390,7 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) &sdata->csa_chandef))return -EINVAL ; - sdata->vif.csa_active = false; + sdata->vif.bss_conf.csa_active = false; err =ieee80211_set_after_csa_beacon (sdata, &changed);if (err)
@@ -3434,7 +3434,7 @@ void ieee80211_csa_finalize_work(struct work_struct *work)mutex_lock (&local->chanctx_mtx);/* AP might have been stopped while waiting for the lock. */ -if (!sdata->vif.csa_active) +if (!sdata->vif.bss_conf.csa_active) goto unlock;if (!ieee80211_sdata_running (sdata))
@@ -3586,7 +3586,7 @@ static int ieee80211_set_csa_beacon(struct ieee80211_sub_if_data *sdata,static void ieee80211_color_change_abort (struct ieee80211_sub_if_data *sdata) { - sdata->vif.color_change_active = false; + sdata->vif.bss_conf.color_change_active = false;ieee80211_free_next_beacon (sdata);
@@ -3619,11 +3619,11 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,return -EINVAL ;/* don't allow another channel switch if one is already active. */ -if (sdata->vif.csa_active) +if (sdata->vif.bss_conf.csa_active)return -EBUSY ;mutex_lock (&local->chanctx_mtx); - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (!conf) { err = -EBUSY ;
@@ -3662,7 +3662,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, }/* if there is a color change in progress, abort it */ -if (sdata->vif.color_change_active) +if (sdata->vif.bss_conf.color_change_active)ieee80211_color_change_abort (sdata); err =ieee80211_set_csa_beacon (sdata, params, &changed);
@@ -3673,7 +3673,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, sdata->csa_chandef = params->chandef; sdata->csa_block_tx = params->block_tx; - sdata->vif.csa_active = true; + sdata->vif.bss_conf.csa_active = true;if (sdata->csa_block_tx) ieee80211_stop_vif_queues(local, sdata,
@@ -3842,7 +3842,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,mutex_lock (&local->mtx);rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) { ret = -EINVAL ; goto unlock;
@@ -3925,7 +3925,7 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy,int ret = -ENODATA ;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (chanctx_conf) { *chandef = sdata->vif.bss_conf.chandef; ret =0 ;
@@ -4421,7 +4421,7 @@ static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata)sdata_assert_lock (sdata);lockdep_assert_held (&local->mtx); - sdata->vif.color_change_active = false; + sdata->vif.bss_conf.color_change_active = false; err =ieee80211_set_after_color_change_beacon (sdata, &changed);if (err) {
@@ -4430,7 +4430,7 @@ static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata) }ieee80211_color_change_bss_config_notify (sdata, - sdata->vif.color_change_color, + sdata->vif.bss_conf.color_change_color,1 , changed);cfg80211_color_change_notify (sdata->dev);
@@ -4448,7 +4448,7 @@ void ieee80211_color_change_finalize_work(struct work_struct *work)mutex_lock (&local->mtx);/* AP might have been stopped while waiting for the lock. */ -if (!sdata->vif.color_change_active) +if (!sdata->vif.bss_conf.color_change_active) goto unlock;if (!ieee80211_sdata_running (sdata))
@@ -4476,7 +4476,7 @@ ieeee80211_obss_color_collision_notify(struct ieee80211_vif *vif, {struct ieee80211_sub_if_data *sdata =vif_to_sdata (vif); -if (sdata->vif.color_change_active || sdata->vif.csa_active) +if (sdata->vif.bss_conf.color_change_active || sdata->vif.bss_conf.csa_active)return ;cfg80211_obss_color_collision_notify (sdata->dev, color_bitmap, gfp);
@@ -4502,7 +4502,7 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,/* don't allow another color change if one is already active or if csa * is active */ -if (sdata->vif.color_change_active || sdata->vif.csa_active) { +if (sdata->vif.bss_conf.color_change_active || sdata->vif.bss_conf.csa_active) { err = -EBUSY ; goto out; }
@@ -4511,8 +4511,8 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,if (err) goto out; - sdata->vif.color_change_active = true; - sdata->vif.color_change_color = params->color; + sdata->vif.bss_conf.color_change_active = true; + sdata->vif.bss_conf.color_change_color = params->color;cfg80211_color_change_started_notify (sdata->dev, params->count);
net/mac80211/chan.c +20 -19
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * mac80211 - channel management -* Copyright 2020 - 2021 Intel Corporation +* Copyright 2020 - 2022 Intel Corporation */ #include <linux/nl80211.h>
@@ -72,7 +72,7 @@ ieee80211_vif_get_chanctx(struct ieee80211_sub_if_data *sdata)struct ieee80211_local *local__maybe_unused = sdata->local;struct ieee80211_chanctx_conf *conf; - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (!conf)return NULL ;
@@ -260,7 +260,7 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,if (!ieee80211_sdata_running (sdata))continue ; -if (rcu_access_pointer (sdata->vif.chanctx_conf) != conf) +if (rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) != conf)continue ;switch (vif->type) {
@@ -298,7 +298,7 @@ ieee80211_get_chanctx_max_required_bw(struct ieee80211_local *local,/* use the configured bandwidth in case of monitor interface */ sdata =rcu_dereference (local->monitor_sdata); -if (sdata &&rcu_access_pointer (sdata->vif.chanctx_conf) == conf) +if (sdata &&rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) == conf) max_bw =max (max_bw, conf->def.width);rcu_read_unlock ();
@@ -368,7 +368,7 @@ static void ieee80211_chan_bw_change(struct ieee80211_local *local,if (!ieee80211_sdata_running (sta->sdata))continue ; -if (rcu_access_pointer (sta->sdata->vif.chanctx_conf) != +if (rcu_access_pointer (sta->sdata->vif.bss_conf.chanctx_conf) != &ctx->conf)continue ;
@@ -533,7 +533,7 @@ ieee80211_chanctx_radar_required(struct ieee80211_local *local,list_for_each_entry_rcu (sdata, &local->interfaces, list) {if (!ieee80211_sdata_running (sdata))continue ; -if (rcu_access_pointer (sdata->vif.chanctx_conf) != conf) +if (rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) != conf)continue ;if (!sdata->radar_required)continue ;
@@ -689,7 +689,7 @@ void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,if (!ieee80211_sdata_running (sdata))continue ; -if (rcu_access_pointer (sdata->vif.chanctx_conf) != conf) +if (rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) != conf)continue ;if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN )continue ;
@@ -759,7 +759,7 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,if (WARN_ON (sdata->vif.type ==NL80211_IFTYPE_NAN ))return -ENOTSUPP ; - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (conf) {
@@ -781,7 +781,7 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, } out: -rcu_assign_pointer (sdata->vif.chanctx_conf, conf); +rcu_assign_pointer (sdata->vif.bss_conf.chanctx_conf, conf); sdata->vif.bss_conf.idle = !conf;
@@ -825,7 +825,7 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,if (!ieee80211_sdata_running (sdata))continue ; -if (rcu_access_pointer (sdata->vif.chanctx_conf) != +if (rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) != &chanctx->conf)continue ;
@@ -874,7 +874,7 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,/* Disable SMPS for the monitor interface */ sdata =rcu_dereference (local->monitor_sdata);if (sdata && -rcu_access_pointer (sdata->vif.chanctx_conf) == &chanctx->conf) +rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf) == &chanctx->conf) rx_chains_dynamic = rx_chains_static = local->rx_chains;rcu_read_unlock ();
@@ -917,7 +917,7 @@ __ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,* channel context pointer for a while, possibly pointing * to a channel context that has already been freed. */ - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));WARN_ON (!conf);
@@ -925,7 +925,7 @@ __ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, conf =NULL ;list_for_each_entry (vlan, &sdata->u.ap.vlans, u.vlan.list) -rcu_assign_pointer (vlan->vif.chanctx_conf, conf); +rcu_assign_pointer (vlan->vif.bss_conf.chanctx_conf, conf); } void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
@@ -1173,7 +1173,7 @@ ieee80211_vif_use_reserved_reassign(struct ieee80211_sub_if_data *sdata) }list_move (&sdata->assigned_chanctx_list, &new_ctx->assigned_vifs); -rcu_assign_pointer (sdata->vif.chanctx_conf, &new_ctx->conf); +rcu_assign_pointer (sdata->vif.bss_conf.chanctx_conf, &new_ctx->conf);if (sdata->vif.type ==NL80211_IFTYPE_AP )__ieee80211_vif_copy_chanctx_to_vlans (sdata, false);
@@ -1515,7 +1515,8 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)if (!ieee80211_vif_has_in_place_reservation (sdata))continue ; -rcu_assign_pointer (sdata->vif.chanctx_conf, &ctx->conf); +rcu_assign_pointer (sdata->vif.bss_conf.chanctx_conf, + &ctx->conf);if (sdata->vif.type ==NL80211_IFTYPE_AP ) __ieee80211_vif_copy_chanctx_to_vlans(sdata,
@@ -1634,7 +1635,7 @@ static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata)lockdep_assert_held (&local->chanctx_mtx); - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (!conf)return ;
@@ -1809,7 +1810,7 @@ int ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, goto out; } - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (!conf) { ret = -EINVAL ;
@@ -1879,9 +1880,9 @@ void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata)mutex_lock (&local->chanctx_mtx); - conf =rcu_dereference_protected (ap->vif.chanctx_conf, + conf =rcu_dereference_protected (ap->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx)); -rcu_assign_pointer (sdata->vif.chanctx_conf, conf); +rcu_assign_pointer (sdata->vif.bss_conf.chanctx_conf, conf);mutex_unlock (&local->chanctx_mtx); }
net/mac80211/driver-ops.h +1 -1
@@ -165,7 +165,7 @@ static inline void drv_bss_info_changed(struct ieee80211_local *local,if (WARN_ON_ONCE (sdata->vif.type ==NL80211_IFTYPE_P2P_DEVICE || sdata->vif.type ==NL80211_IFTYPE_NAN || (sdata->vif.type ==NL80211_IFTYPE_MONITOR && - !sdata->vif.mu_mimo_owner && + !sdata->vif.bss_conf.mu_mimo_owner && !(changed &BSS_CHANGED_TXPOWER ))))return ;
net/mac80211/ethtool.c +2 -2
@@ -5,7 +5,7 @@* Copied from cfg.c - originally * Copyright 2006-2010 Johannes Berg <[email protected]> * Copyright 2014 Intel Corporation (Author: Johannes Berg) -* Copyright (C) 2018 Intel Corporation +* Copyright (C) 2018, 2022 Intel Corporation */ #include <linux/types.h> #include <net/cfg80211.h>
@@ -150,7 +150,7 @@ static void ieee80211_get_stats(struct net_device *dev, survey.filled =0 ;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (chanctx_conf) channel = chanctx_conf->def.chan;else
net/mac80211/ibss.c +5 -5
@@ -9,7 +9,7 @@* Copyright 2009, Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright(c) 2016 Intel Deutschland GmbH -* Copyright(c) 2018-2021 Intel Corporation +* Copyright(c) 2018-2022 Intel Corporation */ #include <linux/delay.h>
@@ -622,7 +622,7 @@ ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, const u8 *bssid, }rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON_ONCE (!chanctx_conf))return NULL ; band = chanctx_conf->def.chan->band;
@@ -923,7 +923,7 @@ ieee80211_rx_mgmt_spectrum_mgmt(struct ieee80211_sub_if_data *sdata,if (len < required_len)return ; -if (!sdata->vif.csa_active) +if (!sdata->vif.bss_conf.csa_active)ieee80211_ibss_process_chanswitch (sdata, elems, false); }
@@ -1143,7 +1143,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, goto put_bss;/* process channel switch */ -if (sdata->vif.csa_active || +if (sdata->vif.bss_conf.csa_active ||ieee80211_ibss_process_chanswitch (sdata, elems, true)) goto put_bss;
@@ -1220,7 +1220,7 @@ void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,return ;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON_ONCE (!chanctx_conf)) {rcu_read_unlock ();return ;
net/mac80211/ieee80211_i.h +3 -3
@@ -1077,7 +1077,7 @@ ieee80211_vif_get_shift(struct ieee80211_vif *vif)int shift =0 ;rcu_read_lock (); - chanctx_conf =rcu_dereference (vif->chanctx_conf); + chanctx_conf =rcu_dereference (vif->bss_conf.chanctx_conf);if (chanctx_conf) shift =ieee80211_chandef_get_shift (&chanctx_conf->def);rcu_read_unlock ();
@@ -1528,7 +1528,7 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)enum nl80211_band band;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) {rcu_read_unlock ();
@@ -2225,7 +2225,7 @@ static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,struct ieee80211_chanctx_conf *chanctx_conf;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();kfree_skb (skb);
net/mac80211/iface.c +4 -4
@@ -51,7 +51,7 @@ bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata)int power;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) {rcu_read_unlock ();return false;
@@ -275,7 +275,7 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,* will not add another interface while any channel * switch is active. */ -if (nsdata->vif.csa_active) +if (nsdata->vif.bss_conf.csa_active)return -EBUSY ;/*
@@ -451,7 +451,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_docancel_work_sync (&sdata->recalc_smps);sdata_lock (sdata);mutex_lock (&local->mtx); - sdata->vif.csa_active = false; + sdata->vif.bss_conf.csa_active = false;if (sdata->vif.type ==NL80211_IFTYPE_STATION ) sdata->u.mgd.csa_waiting_bcn = false;if (sdata->csa_block_tx) {
@@ -503,7 +503,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_domutex_lock (&local->mtx);list_del (&sdata->u.vlan.list);mutex_unlock (&local->mtx); -RCU_INIT_POINTER (sdata->vif.chanctx_conf,NULL ); +RCU_INIT_POINTER (sdata->vif.bss_conf.chanctx_conf,NULL );/* see comment in the default case below */ ieee80211_free_keys (sdata, true);/* no need to tell driver */
net/mac80211/main.c +2 -2
@@ -147,7 +147,7 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)rcu_read_lock ();list_for_each_entry_rcu (sdata, &local->interfaces, list) { -if (!rcu_access_pointer (sdata->vif.chanctx_conf)) +if (!rcu_access_pointer (sdata->vif.bss_conf.chanctx_conf))continue ;if (sdata->vif.type ==NL80211_IFTYPE_AP_VLAN )continue ;
@@ -284,7 +284,7 @@ static void ieee80211_restart_work(struct work_struct *work)* Then we can have a race... */ cancel_work_sync (&sdata->u.mgd.csa_connection_drop_work); -if (sdata->vif.csa_active) { +if (sdata->vif.bss_conf.csa_active) {sdata_lock (sdata); ieee80211_sta_connection_lost(sdata, WLAN_REASON_UNSPECIFIED,
net/mac80211/mesh.c +7 -7
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2008, 2009 open80211s Ltd. -* Copyright (C) 2018 - 2021 Intel Corporation +* Copyright (C) 2018 - 2022 Intel Corporation * Authors: Luis Carlos Cobo <[email protected]> * Javier Cardona <[email protected]> */
@@ -399,7 +399,7 @@ static int mesh_add_ds_params_ie(struct ieee80211_sub_if_data *sdata,return -ENOMEM ;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return -EINVAL ;
@@ -455,7 +455,7 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,u8 *pos;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return -EINVAL ;
@@ -527,7 +527,7 @@ int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata,u8 *pos;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return -EINVAL ;
@@ -820,7 +820,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh) sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf); band = chanctx_conf->def.chan->band;rcu_read_unlock ();
@@ -1357,7 +1357,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata, rx_status);if (ifmsh->csa_role !=IEEE80211_MESH_CSA_ROLE_INIT && - !sdata->vif.csa_active) + !sdata->vif.bss_conf.csa_active)ieee80211_mesh_process_chnswitch (sdata, elems, true); }
@@ -1488,7 +1488,7 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata, ifmsh->pre_value = pre_value; -if (!sdata->vif.csa_active && +if (!sdata->vif.bss_conf.csa_active && !ieee80211_mesh_process_chnswitch (sdata, elems, false)) {mcsa_dbg (sdata,"Failed to process CSA action frame" ); goto free;
net/mac80211/mlme.c +21 -21
167 lines not on this page · raw message
net/mac80211/ocb.c +2 -1
@@ -4,6 +4,7 @@* * Copyright: (c) 2014 Czech Technical University in Prague * (c) 2014 Volkswagen Group Research +* Copyright (C) 2022 Intel Corporation * Author: Rostislav Lisovy <[email protected]> * Funded by: Volkswagen Group Research */
@@ -59,7 +60,7 @@ void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,ocb_dbg (sdata,"Adding new OCB station %pM\n" , addr);rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON_ONCE (!chanctx_conf)) {rcu_read_unlock ();return ;
net/mac80211/offchannel.c +3 -3
@@ -8,7 +8,7 @@* Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2007, Michael Wu <[email protected]> * Copyright 2009 Johannes Berg <[email protected]> -* Copyright (C) 2019 Intel Corporation +* Copyright (C) 2019, 2022 Intel Corporation */ #include <linux/export.h> #include <net/mac80211.h>
@@ -845,7 +845,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,struct ieee80211_chanctx_conf *chanctx_conf;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (chanctx_conf) { need_offchan = params->chan &&
@@ -876,7 +876,7 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, data =skb_put_data (skb, params->buf, params->len);/* Update CSA counters */ - if (sdata->vif.csa_active && + if (sdata->vif.bss_conf.csa_active && (sdata->vif.type == NL80211_IFTYPE_AP || sdata->vif.type == NL80211_IFTYPE_MESH_POINT || sdata->vif.type == NL80211_IFTYPE_ADHOC) &&
net/mac80211/rate.c +3 -2
@@ -4,6 +4,7 @@* Copyright 2005-2006, Devicescape Software, Inc. * Copyright (c) 2006 Jiri Benc <[email protected]> * Copyright 2017 Intel Deutschland GmbH +* Copyright (C) 2022 Intel Corporation */ #include <linux/kernel.h>
@@ -43,7 +44,7 @@ void rate_control_rate_init(struct sta_info *sta)rcu_read_lock (); - chanctx_conf =rcu_dereference (sta->sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sta->sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return ;
@@ -100,7 +101,7 @@ void rate_control_rate_update(struct ieee80211_local *local,if (ref && ref->ops->rate_update) {rcu_read_lock (); - chanctx_conf =rcu_dereference (sta->sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sta->sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();return ;
net/mac80211/rx.c +1 -1
@@ -3192,7 +3192,7 @@ ieee80211_rx_check_bss_color_collision(struct ieee80211_rx_data *rx)if (ieee80211_hw_check (&rx->local->hw,DETECTS_COLOR_COLLISION ))return ; -if (rx->sdata->vif.csa_active) +if (rx->sdata->vif.bss_conf.csa_active)return ; baselen = mgmt->u.beacon.variable - rx->skb->data;
net/mac80211/sta_info.c +1 -1
@@ -1469,7 +1469,7 @@ static void ieee80211_send_null_response(struct sta_info *sta, int tid, skb->dev = sdata->dev;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (WARN_ON (!chanctx_conf)) {rcu_read_unlock ();kfree_skb (skb);
net/mac80211/tdls.c +3 -3
@@ -6,7 +6,7 @@* Copyright 2014, Intel Corporation * Copyright 2014 Intel Mobile Communications GmbH * Copyright 2015 - 2016 Intel Deutschland GmbH -* Copyright (C) 2019, 2021 Intel Corporation +* Copyright (C) 2019, 2021-2022 Intel Corporation */ #include <linux/ieee80211.h>
@@ -1254,7 +1254,7 @@ static void iee80211_tdls_recalc_chanctx(struct ieee80211_sub_if_data *sdata,struct ieee80211_supported_band *sband;mutex_lock (&local->chanctx_mtx); - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (conf) { width = conf->def.width;
@@ -1372,7 +1372,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,switch (oper) {case NL80211_TDLS_ENABLE_LINK : -if (sdata->vif.csa_active) { +if (sdata->vif.bss_conf.csa_active) {tdls_dbg (sdata,"TDLS: disallow link during CSA\n" ); ret = -EBUSY ;break ;
net/mac80211/tx.c +14 -14
@@ -57,7 +57,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,return 0 ;rcu_read_lock (); - chanctx_conf =rcu_dereference (tx->sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (tx->sdata->vif.bss_conf.chanctx_conf);if (chanctx_conf) { shift =ieee80211_chandef_get_shift (&chanctx_conf->def); rate_flags =ieee80211_chandef_rate_flags (&chanctx_conf->def);
@@ -2347,12 +2347,12 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, } } - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { tmp_sdata =rcu_dereference (local->monitor_sdata);if (tmp_sdata) chanctx_conf = -rcu_dereference (tmp_sdata->vif.chanctx_conf); +rcu_dereference (tmp_sdata->vif.bss_conf.chanctx_conf); }if (chanctx_conf)
@@ -2601,7 +2601,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, } ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, u.ap); - chanctx_conf =rcu_dereference (ap_sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (ap_sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2612,7 +2612,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, fallthrough;case NL80211_IFTYPE_AP :if (sdata->vif.type ==NL80211_IFTYPE_AP ) - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2691,7 +2691,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, skb->data + ETH_ALEN); } - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2734,7 +2734,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,memcpy (hdr.addr3, skb->data,ETH_ALEN ); hdrlen =24 ; } - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2747,7 +2747,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,memcpy (hdr.addr2, skb->data +ETH_ALEN ,ETH_ALEN );eth_broadcast_addr (hdr.addr3); hdrlen =24 ; - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2760,7 +2760,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,memcpy (hdr.addr2, skb->data +ETH_ALEN ,ETH_ALEN );memcpy (hdr.addr3, sdata->u.ibss.bssid,ETH_ALEN ); hdrlen =24 ; - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) { ret = -ENOTCONN ; goto free;
@@ -2974,7 +2974,7 @@ void ieee80211_check_fast_xmit(struct sta_info *sta) goto out;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) {rcu_read_unlock (); goto out;
@@ -4605,7 +4605,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, sdata =vif_to_sdata (info->control.vif);if (info->control.flags &IEEE80211_TX_INTCFL_NEED_TXPROCESSING ) { - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (unlikely (!chanctx_conf)) {dev_kfree_skb (skb);return true;
@@ -4809,7 +4809,7 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, bcn_offsets = beacon->cntdwn_counter_offsets; count = beacon->cntdwn_current_counter; -if (sdata->vif.csa_active) +if (sdata->vif.bss_conf.csa_active) max_count =IEEE80211_MAX_CNTDWN_COUNTERS_NUM ;for (i =0 ; i < max_count; ++i) {
@@ -5120,7 +5120,7 @@ __ieee80211_beacon_get(struct ieee80211_hw *hw,rcu_read_lock (); sdata =vif_to_sdata (vif); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!ieee80211_sdata_running (sdata) || !chanctx_conf) goto out;
@@ -5537,7 +5537,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, sdata =vif_to_sdata (vif);rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (!chanctx_conf) goto out;
net/mac80211/util.c +8 -8
@@ -1569,7 +1569,7 @@ void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,return ;rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf);if (chanctx_conf) center_freq = chanctx_conf->def.chan->center_freq;
@@ -1616,7 +1616,7 @@ void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,memset (&qparam,0 ,sizeof (qparam));rcu_read_lock (); - chanctx_conf =rcu_dereference (sdata->vif.chanctx_conf); + chanctx_conf =rcu_dereference (sdata->vif.bss_conf.chanctx_conf); use_11b = (chanctx_conf && chanctx_conf->def.chan->band ==NL80211_BAND_2GHZ ) && !(sdata->flags &IEEE80211_SDATA_OPERATING_GMODE );
@@ -2267,7 +2267,7 @@ static void ieee80211_assign_chanctx(struct ieee80211_local *local,return ;mutex_lock (&local->chanctx_mtx); - conf =rcu_dereference_protected (sdata->vif.chanctx_conf, + conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf,lockdep_is_held (&local->chanctx_mtx));if (conf) { ctx = container_of(conf, struct ieee80211_chanctx, conf);
@@ -2526,7 +2526,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)BSS_CHANGED_TXPOWER |BSS_CHANGED_MCAST_RATE ; -if (sdata->vif.mu_mimo_owner) +if (sdata->vif.bss_conf.mu_mimo_owner) changed |=BSS_CHANGED_MU_GROUPS ;switch (sdata->vif.type) {
@@ -2809,8 +2809,8 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata)mutex_lock (&local->chanctx_mtx); - chanctx_conf =rcu_dereference_protected (sdata->vif.chanctx_conf, -lockdep_is_held (&local->chanctx_mtx)); + chanctx_conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf, +lockdep_is_held (&local->chanctx_mtx));/* * This function can be called from a work, thus it may be possible
@@ -2835,8 +2835,8 @@ void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata)mutex_lock (&local->chanctx_mtx); - chanctx_conf =rcu_dereference_protected (sdata->vif.chanctx_conf, -lockdep_is_held (&local->chanctx_mtx)); + chanctx_conf =rcu_dereference_protected (sdata->vif.bss_conf.chanctx_conf, +lockdep_is_held (&local->chanctx_mtx));if (WARN_ON_ONCE (!chanctx_conf)) goto unlock;
net/mac80211/vht.c +3 -3
@@ -4,7 +4,7 @@* * Portions of this file * Copyright(c) 2015 - 2016 Intel Deutschland GmbH -* Copyright (C) 2018 - 2021 Intel Corporation +* Copyright (C) 2018 - 2022 Intel Corporation */ #include <linux/ieee80211.h>
@@ -649,7 +649,7 @@ void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata, { struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf; - if (!sdata->vif.mu_mimo_owner) + if (!sdata->vif.bss_conf.mu_mimo_owner) return; if (!memcmp(mgmt->u.action.u.vht_group_notif.position,
@@ -673,7 +673,7 @@ void ieee80211_update_mu_groups(struct ieee80211_vif *vif, {struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; -if (WARN_ON_ONCE (!vif->mu_mimo_owner)) +if (WARN_ON_ONCE (!vif->bss_conf.mu_mimo_owner))return ;memcpy (bss_conf->mu_group.membership, membership,WLAN_MEMBERSHIP_LEN );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 476/1157 mt76: mt7615: do not update pm stats in case of error
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 79717c4eeeae9dec894794fbe8af72f08f03ebdd ]
Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error.
--- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +5 -4
@@ -350,10 +350,11 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *dev) }mt7622_trigger_hif_int (dev, false); - - pm->stats.last_doze_event = jiffies; - pm->stats.awake_time += pm->stats.last_doze_event - - pm->stats.last_wake_event; +if (!err) { + pm->stats.last_doze_event = jiffies; + pm->stats.awake_time += pm->stats.last_doze_event - + pm->stats.last_wake_event; + } out:mutex_unlock (&pm->mutex);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 477/1157 mt76: mt7921: do not update pm states in case of error
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit f4a92547fb9818ff272e1e2f0c79cd6b0bc99ce8 ]
Do not update pm stats if mt7921e_mcu_fw_pmctrl routine returns an error.
--- drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +3 -3
@@ -102,7 +102,7 @@ int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev) {struct mt76_phy *mphy = &dev->mt76.phy;struct mt76_connac_pm *pm = &dev->pm; -int i, err =0 ; +int i;for (i =0 ; i <MT7921_DRV_OWN_RETRY_COUNT ; i++) {mt76_wr (dev,MT_CONN_ON_LPCTL ,PCIE_LPCR_HOST_SET_OWN );
@@ -114,12 +114,12 @@ int mt7921e_mcu_fw_pmctrl(struct mt7921_dev *dev)if (i ==MT7921_DRV_OWN_RETRY_COUNT ) {dev_err (dev->mt76.dev,"firmware own failed\n" );clear_bit (MT76_STATE_PM , &mphy->state); - err = -EIO ; +return -EIO ; } pm->stats.last_doze_event = jiffies; pm->stats.awake_time += pm->stats.last_doze_event - pm->stats.last_wake_event; -return err; +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 478/1157 mt76: mt7921s: fix possible sdio deadlock in command fail
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 364718c94ac2ea4e51958ac0aa15c9092c785a3a ]
Move sdio_release_host() to final resource handing
--- drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +5 -5
@@ -136,8 +136,8 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev)struct sdio_func *func = dev->mt76.sdio.func;struct mt76_phy *mphy = &dev->mt76.phy;struct mt76_connac_pm *pm = &dev->pm; -int err =0 ;u32 status; +int err;sdio_claim_host (func);
@@ -148,7 +148,7 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) 2000, 1000000);if (err <0 ) {dev_err (dev->mt76.dev,"mailbox ACK not cleared\n" ); - goto err; + goto out; } }
@@ -156,18 +156,18 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev) err =readx_poll_timeout (mt76s_read_pcr, &dev->mt76, status, !(status &WHLPCR_IS_DRIVER_OWN ),2000 ,1000000 ); +out:sdio_release_host (func); -err:if (err <0 ) {dev_err (dev->mt76.dev,"firmware own failed\n" );clear_bit (MT76_STATE_PM , &mphy->state); - err = -EIO ; +return -EIO ; } pm->stats.last_doze_event = jiffies; pm->stats.awake_time += pm->stats.last_doze_event - pm->stats.last_wake_event; -return err; +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 479/1157 mt76: mt7921: fix aggregation subframes setting to HE max
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit d5a50e6bd1972c481f82befa846dce0b9866f025 ]
mt7921/mt7922 support HE max aggregation subframes 256 for both tx/rx. Get better throughput then before.
--- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +2 -2
@@ -53,8 +53,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw)struct wiphy *wiphy = hw->wiphy; hw->queues =4 ; - hw->max_rx_aggregation_subframes =64 ; - hw->max_tx_aggregation_subframes =128 ; + hw->max_rx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF_HE ; + hw->max_tx_aggregation_subframes =IEEE80211_MAX_AMPDU_BUF_HE ; hw->netdev_features =NETIF_F_RXCSUM ; hw->radiotap_timestamp.units_pos =
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 480/1157 mt76: mt7921: enlarge maximum VHT MPDU length to 11454
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 31f3248a75932b111bc90c66b1f6c7d89eedca8e ]
Enlarge maximum MPDU length to 11454 that both mt7921/mt7922 can support. After this fixing, we can get better performance.
--- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/init.c +1 -1
@@ -304,7 +304,7 @@ int mt7921_register_device(struct mt7921_dev *dev)IEEE80211_HT_CAP_LDPC_CODING |IEEE80211_HT_CAP_MAX_AMSDU ; dev->mphy.sband_5g.sband.vht_cap.cap |= -IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | +IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 481/1157 mt76: mt7921: rely on mt76_dev in mt7921_mac_write_txwi signature
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit e00b3e407efeed81dc30a72e4041ff57bf7068d5 ]
This is a preliminary patch to share txwi configuration code.
--- .../net/wireless/mediatek/mt76/mt7921/mac.c | 23 +++++++++---------- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 2 +- .../wireless/mediatek/mt76/mt7921/mt7921.h | 2 +- .../wireless/mediatek/mt76/mt7921/pci_mac.c | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +11 -12
@@ -809,8 +809,8 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) }static void -mt7921_mac_write_txwi_8023 (struct mt7921_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct mt76_wcid *wcid) +mt7921_mac_write_txwi_8023 (__le32 *txwi,struct sk_buff *skb, +struct mt76_wcid *wcid) {u8 tid = skb->priority &IEEE80211_QOS_CTL_TID_MASK ;u8 fc_type, fc_stype;
@@ -848,7 +848,7 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le32 *txwi, }static void -mt7921_mac_write_txwi_80211 (struct mt7921_dev *dev,__le32 *txwi, +mt7921_mac_write_txwi_80211 (struct mt76_dev *dev,__le32 *txwi,struct sk_buff *skb,struct ieee80211_key_conf *key) {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
@@ -920,7 +920,7 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi, txwi[7 ] &= ~cpu_to_le32 (MT_TXD7_HW_AMSDU ); } -if (mt76_is_mmio (&dev->mt76)) { +if (mt76_is_mmio (dev)) { val =FIELD_PREP (MT_TXD7_TYPE , fc_type) |FIELD_PREP (MT_TXD7_SUB_TYPE , fc_stype); txwi[7 ] |=cpu_to_le32 (val);
@@ -931,17 +931,16 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi, } } -void mt7921_mac_write_txwi (struct mt7921_dev *dev,__le32 *txwi, +void mt7921_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi,struct sk_buff *skb,struct mt76_wcid *wcid,struct ieee80211_key_conf *key,int pid,bool beacon) {struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_vif *vif = info->control.vif; -struct mt76_phy *mphy = &dev->mphy; +struct mt76_phy *mphy = &dev->phy;u8 p_fmt, q_idx, omac_idx =0 , wmm_idx =0 ; -bool is_mmio =mt76_is_mmio (&dev->mt76); -u32 sz_txd = is_mmio ?MT_TXD_SIZE :MT_SDIO_TXD_SIZE ; +u32 sz_txd =mt76_is_mmio (dev) ?MT_TXD_SIZE :MT_SDIO_TXD_SIZE ;bool is_8023 = info->flags &IEEE80211_TX_CTL_HW_80211_ENCAP ;u16 tx_count =15 ;u32 val;
@@ -957,10 +956,10 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi, p_fmt =MT_TX_TYPE_FW ; q_idx =MT_LMAC_BCN0 ; }else if (skb_get_queue_mapping (skb) >=MT_TXQ_PSD ) { - p_fmt = is_mmio ?MT_TX_TYPE_CT :MT_TX_TYPE_SF ; + p_fmt =mt76_is_mmio (dev) ?MT_TX_TYPE_CT :MT_TX_TYPE_SF ; q_idx =MT_LMAC_ALTX0 ; }else { - p_fmt = is_mmio ?MT_TX_TYPE_CT :MT_TX_TYPE_SF ; + p_fmt =mt76_is_mmio (dev) ?MT_TX_TYPE_CT :MT_TX_TYPE_SF ; q_idx = wmm_idx *MT7921_MAX_WMM_SETS +mt76_connac_lmac_mapping (skb_get_queue_mapping (skb)); }
@@ -995,7 +994,7 @@ void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi, txwi[7 ] = wcid->amsdu ?cpu_to_le32 (MT_TXD7_HW_AMSDU ) :0 ;if (is_8023) -mt7921_mac_write_txwi_8023 (dev, txwi, skb, wcid); +mt7921_mac_write_txwi_8023 (txwi, skb, wcid);else mt7921_mac_write_txwi_80211 (dev, txwi, skb, key);
@@ -1646,7 +1645,7 @@ mt7921_usb_sdio_write_txwi(struct mt7921_dev *dev, struct mt76_wcid *wcid,__le32 *txwi = (__le32 *)(skb->data -MT_SDIO_TXD_SIZE );memset (txwi,0 ,MT_SDIO_TXD_SIZE ); -mt7921_mac_write_txwi (dev, txwi, skb, wcid, key, pid, false); +mt7921_mac_write_txwi (&dev->mt76, txwi, skb, wcid, key, pid, false);skb_push (skb,MT_SDIO_TXD_SIZE ); }
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +1 -1
@@ -1272,7 +1272,7 @@ mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,return -EINVAL ; } -mt7921_mac_write_txwi (dev, (__le32 *)(req.beacon_tlv.pkt), skb, +mt7921_mac_write_txwi (&dev->mt76, (__le32 *)(req.beacon_tlv.pkt), skb, wcid,NULL ,0 , true);memcpy (req.beacon_tlv.pkt +MT_TXD_SIZE , skb->data, skb->len); req.beacon_tlv.pkt_len =cpu_to_le16 (MT_TXD_SIZE + skb->len);
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +1 -1
@@ -424,7 +424,7 @@ int mt7921_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void *data, int len);int mt7921_testmode_dump (struct ieee80211_hw *hw,struct sk_buff *msg,struct netlink_callback *cb,void *data,int len); -void mt7921_mac_write_txwi (struct mt7921_dev *dev,__le32 *txwi, +void mt7921_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi,struct sk_buff *skb,struct mt76_wcid *wcid,struct ieee80211_key_conf *key,int pid,bool beacon);
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c +1 -1
@@ -72,7 +72,7 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, } pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb); -mt7921_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, key, +mt7921_mac_write_txwi (mdev, txwi_ptr, tx_info->skb, wcid, key, pid, false); txp = (struct mt7921_txp_common *)(txwi +MT_TXD_SIZE );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 482/1157 mt76: mt7915: rely on mt76_dev in mt7915_mac_write_txwi signature
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit d502e30020b85857ead0f9d392d24dba8c0f44cb ]
This is a preliminary patch to share txwi configuration code.
--- .../net/wireless/mediatek/mt76/mt7915/mac.c | 23 +++++++++---------- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 4 ++-- .../wireless/mediatek/mt76/mt7915/mt7915.h | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +11 -12
@@ -1010,8 +1010,8 @@ mt7915_mac_write_txwi_tm(struct mt7915_phy *phy, __le32 *txwi, }static void -mt7915_mac_write_txwi_8023 (struct mt7915_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct mt76_wcid *wcid) +mt7915_mac_write_txwi_8023 (__le32 *txwi,struct sk_buff *skb, +struct mt76_wcid *wcid) {u8 tid = skb->priority &IEEE80211_QOS_CTL_TID_MASK ;
@@ -1050,9 +1050,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, }static void -mt7915_mac_write_txwi_80211 (struct mt7915_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct ieee80211_key_conf *key, -bool *mcast) +mt7915_mac_write_txwi_80211 (__le32 *txwi,struct sk_buff *skb, +struct ieee80211_key_conf *key,bool *mcast) {struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data;
@@ -1175,13 +1174,13 @@ mt7915_mac_tx_rate_val(struct mt76_phy *mphy, struct ieee80211_vif *vif,FIELD_PREP (MT_TX_RATE_MODE , mode); } -void mt7915_mac_write_txwi (struct mt7915_dev *dev,__le32 *txwi, +void mt7915_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi,struct sk_buff *skb,struct mt76_wcid *wcid,int pid,struct ieee80211_key_conf *key,u32 changed) {struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_vif *vif = info->control.vif; -struct mt76_phy *mphy = &dev->mphy; +struct mt76_phy *mphy = &dev->phy;bool ext_phy = info->hw_queue &MT_TX_HW_QUEUE_EXT_PHY ;u8 p_fmt, q_idx, omac_idx =0 , wmm_idx =0 , band_idx =0 ;bool is_8023 = info->flags &IEEE80211_TX_CTL_HW_80211_ENCAP ;
@@ -1201,8 +1200,8 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, band_idx = mvif->mt76.band_idx; } -if (ext_phy && dev->mt76.phy2) - mphy = dev->mt76.phy2; +if (ext_phy && dev->phy2) + mphy = dev->phy2;if (inband_disc) { p_fmt =MT_TX_TYPE_FW ;
@@ -1254,9 +1253,9 @@ void mt7915_mac_write_txwi(struct mt7915_dev *dev, __le32 *txwi, txwi[7 ] = wcid->amsdu ?cpu_to_le32 (MT_TXD7_HW_AMSDU ) :0 ;if (is_8023) -mt7915_mac_write_txwi_8023 (dev, txwi, skb, wcid); +mt7915_mac_write_txwi_8023 (txwi, skb, wcid);else -mt7915_mac_write_txwi_80211 (dev, txwi, skb, key, &mcast); +mt7915_mac_write_txwi_80211 (txwi, skb, key, &mcast);if (txwi[2 ] &cpu_to_le32 (MT_TXD2_FIX_RATE )) {u16 rate =mt7915_mac_tx_rate_val (mphy, vif, beacon, mcast);
@@ -1315,7 +1314,7 @@ int mt7915_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,return id; pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb); -mt7915_mac_write_txwi (dev, txwi_ptr, tx_info->skb, wcid, pid, key,0 ); +mt7915_mac_write_txwi (mdev, txwi_ptr, tx_info->skb, wcid, pid, key,0 ); txp = (struct mt7915_txp *)(txwi +MT_TXD_SIZE );for (i =0 ; i < nbuf; i++) {
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +2 -2
@@ -1910,7 +1910,7 @@ mt7915_mcu_beacon_cont(struct mt7915_dev *dev, struct ieee80211_vif *vif, } buf = (u8 *)tlv +sizeof (*cont); -mt7915_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,0 ,NULL , +mt7915_mac_write_txwi (&dev->mt76, (__le32 *)buf, skb, wcid,0 ,NULL ,BSS_CHANGED_BEACON );memcpy (buf +MT_TXD_SIZE , skb->data, skb->len); }
@@ -2049,7 +2049,7 @@ mt7915_mcu_beacon_inband_discov(struct mt7915_dev *dev, struct ieee80211_vif *vi buf = (u8 *)tlv +sizeof (*discov); -mt7915_mac_write_txwi (dev, (__le32 *)buf, skb, wcid,0 ,NULL , +mt7915_mac_write_txwi (&dev->mt76, (__le32 *)buf, skb, wcid,0 ,NULL , changed);memcpy (buf +MT_TXD_SIZE , skb->data, skb->len);
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +1 -1
@@ -557,7 +557,7 @@ bool mt7915_mac_wtbl_update(struct mt7915_dev *dev, int idx, u32 mask);void mt7915_mac_reset_counters (struct mt7915_phy *phy);void mt7915_mac_cca_stats_reset (struct mt7915_phy *phy);void mt7915_mac_enable_nf (struct mt7915_dev *dev,bool ext_phy); -void mt7915_mac_write_txwi (struct mt7915_dev *dev,__le32 *txwi, +void mt7915_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi,struct sk_buff *skb,struct mt76_wcid *wcid,int pid,struct ieee80211_key_conf *key,u32 changed);void mt7915_mac_set_timing (struct mt7915_phy *phy);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 483/1157 mt76: connac: move mac connac2 defs in mt76_connac2_mac.h
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 90211957a640e6933b236e06728578d252f7374f ]
This is a preliminary patch to share connac2 mac txwi code.
--- .../wireless/mediatek/mt76/mt76_connac2_mac.h | 167 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mac.h | 142 +-------------- .../wireless/mediatek/mt76/mt7915/mt7915.h | 14 -- .../net/wireless/mediatek/mt76/mt7921/mac.h | 123 +------------ .../wireless/mediatek/mt76/mt7921/mt7921.h | 10 -- 5 files changed, 171 insertions(+), 285 deletions(-) create mode 100644 drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h
drivers/net/wireless/mediatek/mt76/mt76_connac2_mac.h new file +167 -0
@@ -0,0 +1,167 @@ +/* SPDX-License-Identifier: ISC */ +/* Copyright (C) 2022 MediaTek Inc. */ + +#ifndef __MT76_CONNAC2_MAC_H +#define __MT76_CONNAC2_MAC_H + +enum tx_header_format { +MT_HDR_FORMAT_802_3 , +MT_HDR_FORMAT_CMD , +MT_HDR_FORMAT_802_11 , +MT_HDR_FORMAT_802_11_EXT , +}; + +enum tx_pkt_type { +MT_TX_TYPE_CT , +MT_TX_TYPE_SF , +MT_TX_TYPE_CMD , +MT_TX_TYPE_FW , +}; + +enum { +MT_CTX0 , +MT_HIF0 =0x0 , + +MT_LMAC_AC00 =0x0 , +MT_LMAC_AC01 , +MT_LMAC_AC02 , +MT_LMAC_AC03 , +MT_LMAC_ALTX0 =0x10 , +MT_LMAC_BMC0 , +MT_LMAC_BCN0 , +MT_LMAC_PSMP0 , +}; + +#define MT_TXD_SIZE (8 * 4) +#define MT_SDIO_TXD_SIZE (MT_TXD_SIZE + 8 * 4) +#define MT_SDIO_TAIL_SIZE 8 +#define MT_SDIO_HDR_SIZE 4 +#define MT_USB_TAIL_SIZE 4 + +#define MT_TXD0_Q_IDX GENMASK(31, 25) +#define MT_TXD0_PKT_FMT GENMASK(24, 23) +#define MT_TXD0_ETH_TYPE_OFFSET GENMASK(22, 16) +#define MT_TXD0_TX_BYTES GENMASK(15, 0) + +#define MT_TXD1_LONG_FORMAT BIT(31) +#define MT_TXD1_TGID BIT(30) +#define MT_TXD1_OWN_MAC GENMASK(29, 24) +#define MT_TXD1_AMSDU BIT(23) +#define MT_TXD1_TID GENMASK(22, 20) +#define MT_TXD1_HDR_PAD GENMASK(19, 18) +#define MT_TXD1_HDR_FORMAT GENMASK(17, 16) +#define MT_TXD1_HDR_INFO GENMASK(15, 11) +#define MT_TXD1_ETH_802_3 BIT(15) +#define MT_TXD1_VTA BIT(10) +#define MT_TXD1_WLAN_IDX GENMASK(9, 0) + +#define MT_TXD2_FIX_RATE BIT(31) +#define MT_TXD2_FIXED_RATE BIT(30) +#define MT_TXD2_POWER_OFFSET GENMASK(29, 24) +#define MT_TXD2_MAX_TX_TIME GENMASK(23, 16) +#define MT_TXD2_FRAG GENMASK(15, 14) +#define MT_TXD2_HTC_VLD BIT(13) +#define MT_TXD2_DURATION BIT(12) +#define MT_TXD2_BIP BIT(11) +#define MT_TXD2_MULTICAST BIT(10) +#define MT_TXD2_RTS BIT(9) +#define MT_TXD2_SOUNDING BIT(8) +#define MT_TXD2_NDPA BIT(7) +#define MT_TXD2_NDP BIT(6) +#define MT_TXD2_FRAME_TYPE GENMASK(5, 4) +#define MT_TXD2_SUB_TYPE GENMASK(3, 0) + +#define MT_TXD3_SN_VALID BIT(31) +#define MT_TXD3_PN_VALID BIT(30) +#define MT_TXD3_SW_POWER_MGMT BIT(29) +#define MT_TXD3_BA_DISABLE BIT(28) +#define MT_TXD3_SEQ GENMASK(27, 16) +#define MT_TXD3_REM_TX_COUNT GENMASK(15, 11) +#define MT_TXD3_TX_COUNT GENMASK(10, 6) +#define MT_TXD3_TIMING_MEASURE BIT(5) +#define MT_TXD3_DAS BIT(4) +#define MT_TXD3_EEOSP BIT(3) +#define MT_TXD3_EMRD BIT(2) +#define MT_TXD3_PROTECT_FRAME BIT(1) +#define MT_TXD3_NO_ACK BIT(0) + +#define MT_TXD4_PN_LOW GENMASK(31, 0) + +#define MT_TXD5_PN_HIGH GENMASK(31, 16) +#define MT_TXD5_MD BIT(15) +#define MT_TXD5_ADD_BA BIT(14) +#define MT_TXD5_TX_STATUS_HOST BIT(10) +#define MT_TXD5_TX_STATUS_MCU BIT(9) +#define MT_TXD5_TX_STATUS_FMT BIT(8) +#define MT_TXD5_PID GENMASK(7, 0) + +#define MT_TXD6_TX_IBF BIT(31) +#define MT_TXD6_TX_EBF BIT(30) +#define MT_TXD6_TX_RATE GENMASK(29, 16) +#define MT_TXD6_SGI GENMASK(15, 14) +#define MT_TXD6_HELTF GENMASK(13, 12) +#define MT_TXD6_LDPC BIT(11) +#define MT_TXD6_SPE_ID_IDX BIT(10) +#define MT_TXD6_ANT_ID GENMASK(7, 4) +#define MT_TXD6_DYN_BW BIT(3) +#define MT_TXD6_FIXED_BW BIT(2) +#define MT_TXD6_BW GENMASK(1, 0) + +#define MT_TXD7_TXD_LEN GENMASK(31, 30) +#define MT_TXD7_UDP_TCP_SUM BIT(29) +#define MT_TXD7_IP_SUM BIT(28) +#define MT_TXD7_TYPE GENMASK(21, 20) +#define MT_TXD7_SUB_TYPE GENMASK(19, 16) + +#define MT_TXD7_PSE_FID GENMASK(27, 16) +#define MT_TXD7_SPE_IDX GENMASK(15, 11) +#define MT_TXD7_HW_AMSDU BIT(10) +#define MT_TXD7_TX_TIME GENMASK(9, 0) + +#define MT_TXD8_L_TYPE GENMASK(5, 4) +#define MT_TXD8_L_SUB_TYPE GENMASK(3, 0) + +#define MT_TX_RATE_STBC BIT(13) +#define MT_TX_RATE_NSS GENMASK(12, 10) +#define MT_TX_RATE_MODE GENMASK(9, 6) +#define MT_TX_RATE_SU_EXT_TONE BIT(5) +#define MT_TX_RATE_DCM BIT(4) +/* VHT/HE only use bits 0-3 */ +#define MT_TX_RATE_IDX GENMASK(5, 0) + +#define MT_TXS0_FIXED_RATE BIT(31) +#define MT_TXS0_BW GENMASK(30, 29) +#define MT_TXS0_TID GENMASK(28, 26) +#define MT_TXS0_AMPDU BIT(25) +#define MT_TXS0_TXS_FORMAT GENMASK(24, 23) +#define MT_TXS0_BA_ERROR BIT(22) +#define MT_TXS0_PS_FLAG BIT(21) +#define MT_TXS0_TXOP_TIMEOUT BIT(20) +#define MT_TXS0_BIP_ERROR BIT(19) + +#define MT_TXS0_QUEUE_TIMEOUT BIT(18) +#define MT_TXS0_RTS_TIMEOUT BIT(17) +#define MT_TXS0_ACK_TIMEOUT BIT(16) +#define MT_TXS0_ACK_ERROR_MASK GENMASK(18, 16) + +#define MT_TXS0_TX_STATUS_HOST BIT(15) +#define MT_TXS0_TX_STATUS_MCU BIT(14) +#define MT_TXS0_TX_RATE GENMASK(13, 0) + +#define MT_TXS1_SEQNO GENMASK(31, 20) +#define MT_TXS1_RESP_RATE GENMASK(19, 16) +#define MT_TXS1_RXV_SEQNO GENMASK(15, 8) +#define MT_TXS1_TX_POWER_DBM GENMASK(7, 0) + +#define MT_TXS2_BF_STATUS GENMASK(31, 30) +#define MT_TXS2_LAST_TX_RATE GENMASK(29, 27) +#define MT_TXS2_SHARED_ANTENNA BIT(26) +#define MT_TXS2_WCID GENMASK(25, 16) +#define MT_TXS2_TX_DELAY GENMASK(15, 0) + +#define MT_TXS3_PID GENMASK(31, 24) +#define MT_TXS3_ANT_ID GENMASK(23, 0) + +#define MT_TXS4_TIMESTAMP GENMASK(31, 0) + +#endif /* __MT76_CONNAC2_MAC_H */
drivers/net/wireless/mediatek/mt76/mt7915/mac.h +2 -140
166 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +0 -14
@@ -341,20 +341,6 @@ enum { __MT_WFDMA_MAX, }; -enum { -MT_CTX0 , -MT_HIF0 =0x0 , - -MT_LMAC_AC00 =0x0 , -MT_LMAC_AC01 , -MT_LMAC_AC02 , -MT_LMAC_AC03 , -MT_LMAC_ALTX0 =0x10 , -MT_LMAC_BMC0 , -MT_LMAC_BCN0 , -MT_LMAC_PSMP0 , -}; -enum {MT_RX_SEL0 ,MT_RX_SEL1 ,
drivers/net/wireless/mediatek/mt76/mt7921/mac.h +2 -121
147 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +0 -10
@@ -247,16 +247,6 @@ struct mt7921_txpwr { } data[TXPWR_MAX_NUM ]; }; -enum { -MT_LMAC_AC00 , -MT_LMAC_AC01 , -MT_LMAC_AC02 , -MT_LMAC_AC03 , -MT_LMAC_ALTX0 =0x10 , -MT_LMAC_BMC0 , -MT_LMAC_BCN0 , -}; -static inline struct mt7921_phy *mt7921_hw_phy (struct ieee80211_hw *hw) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 484/1157 mt76: connac: move connac2_mac_write_txwi in mt76_connac module
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 182071cdd594bc79f42899c85afa995c370ef82d ]
mac_write_txwi code is shared between connac2 devices (mt7915 and mt7921). Move it in connac module.
--- .../net/wireless/mediatek/mt76/mt76_connac.h | 6 + .../wireless/mediatek/mt76/mt76_connac_mac.c | 284 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7915/mac.c | 251 +--------------- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 2 +- .../wireless/mediatek/mt76/mt7915/mt7915.h | 1 - .../net/wireless/mediatek/mt76/mt7921/mac.c | 212 +------------ .../net/wireless/mediatek/mt76/mt7921/main.c | 2 +- .../net/wireless/mediatek/mt76/mt7921/mcu.c | 4 +- .../wireless/mediatek/mt76/mt7921/mt7921.h | 5 - .../wireless/mediatek/mt76/mt7921/pci_mac.c | 4 +- 10 files changed, 299 insertions(+), 472 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac.h +6 -0
@@ -12,6 +12,8 @@#define MT76_CONNAC_MAX_SCHED_SCAN_SSID 10#define MT76_CONNAC_MAX_SCAN_MATCH 16 +#define MT76_CONNAC_MAX_WMM_SETS 4 +#define MT76_CONNAC_COREDUMP_TIMEOUT (HZ / 20)#define MT76_CONNAC_COREDUMP_SZ (1300 * 1024)
@@ -244,5 +246,9 @@ void mt76_connac_pm_queue_skb(struct ieee80211_hw *hw, struct sk_buff *skb);void mt76_connac_pm_dequeue_skbs (struct mt76_phy *phy,struct mt76_connac_pm *pm); +void mt76_connac2_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi, +struct sk_buff *skb,struct mt76_wcid *wcid, +struct ieee80211_key_conf *key,int pid, +u32 changed);#endif /* __MT76_CONNAC_H */
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +284 -0
293 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2 -249
267 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
@@ -2685,7 +2685,7 @@ int mt7915_mcu_set_tx(struct mt7915_dev *dev, struct ieee80211_vif *vif)struct edca *e = &req.edca[ac]; e->set =WMM_PARAM_SET ; - e->queue = ac + mvif->mt76.wmm_idx *MT7915_MAX_WMM_SETS ; + e->queue = ac + mvif->mt76.wmm_idx *MT76_CONNAC_MAX_WMM_SETS ; e->aifs = q->aifs; e->txop =cpu_to_le16 (q->txop);
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +0 -1
@@ -10,7 +10,6 @@#include "regs.h" #define MT7915_MAX_INTERFACES 19 -#define MT7915_MAX_WMM_SETS 4#define MT7915_WTBL_SIZE 288#define MT7916_WTBL_SIZE 544#define MT7915_WTBL_RESERVED (mt7915_wtbl_size(dev) - 1)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -211
224 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -1
@@ -322,7 +322,7 @@ static int mt7921_add_interface(struct ieee80211_hw *hw, mvif->mt76.omac_idx = mvif->mt76.idx; mvif->phy = phy; mvif->mt76.band_idx =0 ; - mvif->mt76.wmm_idx = mvif->mt76.idx %MT7921_MAX_WMM_SETS ; + mvif->mt76.wmm_idx = mvif->mt76.idx %MT76_CONNAC_MAX_WMM_SETS ; ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, vif, &mvif->sta.wcid, true);
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +2 -2
@@ -1272,8 +1272,8 @@ mt7921_mcu_uni_add_beacon_offload(struct mt7921_dev *dev,return -EINVAL ; } -mt7921_mac_write_txwi (&dev->mt76, (__le32 *)(req.beacon_tlv.pkt), skb, - wcid,NULL ,0 , true); +mt76_connac2_mac_write_txwi (&dev->mt76, (__le32 *)(req.beacon_tlv.pkt), + skb, wcid,NULL ,0 ,BSS_CHANGED_BEACON );memcpy (req.beacon_tlv.pkt +MT_TXD_SIZE , skb->data, skb->len); req.beacon_tlv.pkt_len =cpu_to_le16 (MT_TXD_SIZE + skb->len); req.beacon_tlv.tim_ie_pos =cpu_to_le16 (MT_TXD_SIZE + offs.tim_offset);
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +0 -5
@@ -10,7 +10,6 @@#include "regs.h" #define MT7921_MAX_INTERFACES 4 -#define MT7921_MAX_WMM_SETS 4#define MT7921_WTBL_SIZE 20#define MT7921_WTBL_RESERVED (MT7921_WTBL_SIZE - 1)#define MT7921_WTBL_STA (MT7921_WTBL_RESERVED - \
@@ -414,10 +413,6 @@ int mt7921_testmode_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif, void *data, int len);int mt7921_testmode_dump (struct ieee80211_hw *hw,struct sk_buff *msg,struct netlink_callback *cb,void *data,int len); -void mt7921_mac_write_txwi (struct mt76_dev *dev,__le32 *txwi, -struct sk_buff *skb,struct mt76_wcid *wcid, -struct ieee80211_key_conf *key,int pid, -bool beacon);void mt7921_tx_check_aggr (struct ieee80211_sta *sta,__le32 *txwi);void mt7921_mac_sta_poll (struct mt7921_dev *dev); int mt7921_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c +2 -2
@@ -72,8 +72,8 @@ int mt7921e_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, } pid =mt76_tx_status_skb_add (mdev, wcid, tx_info->skb); -mt7921_mac_write_txwi (mdev, txwi_ptr, tx_info->skb, wcid, key, - pid, false); +mt76_connac2_mac_write_txwi (mdev, txwi_ptr, tx_info->skb, wcid, key, + pid,0 ); txp = (struct mt7921_txp_common *)(txwi +MT_TXD_SIZE );memset (txp,0 ,sizeof (struct mt7921_txp_common ));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 485/1157 mt76: mt7915: fix incorrect testmode ipg on band 1 caused by wmm_idx
In reply to Greg Kroah-HartmanFrom: Shayne Chen <[email protected]>
[ Upstream commit 6e744cfeee02c2d8676eb55d5b3720808812f41f ]
Fix the issue that the measured inter packet gap didn't fit its setting value.
--- drivers/net/wireless/mediatek/mt76/mt7915/testmode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/testmode.c +5 -4
@@ -168,13 +168,14 @@ mt7915_tm_set_tam_arb(struct mt7915_phy *phy, bool enable, bool mu) }static int -mt7915_tm_set_wmm_qid (struct mt7915_dev *dev,u8 qid,u8 aifs,u8 cw_min, +mt7915_tm_set_wmm_qid (struct mt7915_phy *phy,u8 qid,u8 aifs,u8 cw_min,u16 cw_max,u16 txop) { +struct mt7915_vif *mvif = (struct mt7915_vif *)phy->monitor_vif->drv_priv;struct mt7915_mcu_tx req = { .total =1 };struct edca *e = &req.edca[0 ]; - e->queue = qid; + e->queue = qid + mvif->mt76.wmm_idx *MT76_CONNAC_MAX_WMM_SETS ; e->set =WMM_PARAM_SET ; e->aifs = aifs;
@@ -182,7 +183,7 @@ mt7915_tm_set_wmm_qid(struct mt7915_dev *dev, u8 qid, u8 aifs, u8 cw_min, e->cw_max =cpu_to_le16 (cw_max); e->txop =cpu_to_le16 (txop); -return mt7915_mcu_update_edca (dev, &req); +return mt7915_mcu_update_edca (phy->dev, &req); } static int
@@ -244,7 +245,7 @@ mt7915_tm_set_ipg_params(struct mt7915_phy *phy, u32 ipg, u8 mode)mt7915_tm_set_slot_time (phy, slot_time, sifs); -return mt7915_tm_set_wmm_qid (dev, +return mt7915_tm_set_wmm_qid (phy,mt76_connac_lmac_mapping (IEEE80211_AC_BE ), aifsn, cw, cw,0 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 486/1157 mt76: mt7615: fix throughput regression on DFS channels
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit aac86cebb4a09e3fa2c07589f79f7d0e07e8c9a4 ]
For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar detector without also switching the channel.
This results in very bad throughput on DFS channels, because hw->conf.radar_enabled can get toggled a few times after CAC ends. Fix this by always leaving the DFS detector enabled on DFS channels and instead suppress unwanted detection events.
--- .../net/wireless/mediatek/mt76/mt7615/mac.c | 7 ++++--- .../net/wireless/mediatek/mt76/mt7615/main.c | 21 ------------------- .../net/wireless/mediatek/mt76/mt7615/mcu.c | 3 +++ .../wireless/mediatek/mt76/mt7615/mt7615.h | 1 - 4 files changed, 7 insertions(+), 25 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +4 -3
@@ -2282,6 +2282,7 @@ mt7615_dfs_init_radar_specs(struct mt7615_phy *phy)int mt7615_dfs_init_radar_detector (struct mt7615_phy *phy) { +struct cfg80211_chan_def *chandef = &phy->mt76->chandef;struct mt7615_dev *dev = phy->dev;bool ext_phy = phy != &dev->phy;enum mt76_dfs_state dfs_state, prev_state;
@@ -2292,13 +2293,13 @@ int mt7615_dfs_init_radar_detector(struct mt7615_phy *phy) prev_state = phy->mt76->dfs_state; dfs_state =mt76_phy_dfs_state (phy->mt76); +if ((chandef->chan->flags &IEEE80211_CHAN_RADAR ) && + dfs_state <MT_DFS_STATE_CAC ) + dfs_state =MT_DFS_STATE_ACTIVE ;if (prev_state == dfs_state)return 0 ; -if (prev_state ==MT_DFS_STATE_UNKNOWN ) -mt7615_dfs_stop_radar_detector (phy); -if (dfs_state ==MT_DFS_STATE_DISABLED ) goto stop;
drivers/net/wireless/mediatek/mt76/mt7615/main.c +0 -21
@@ -282,26 +282,6 @@ static void mt7615_remove_interface(struct ieee80211_hw *hw,mt76_packet_id_flush (&dev->mt76, &mvif->sta.wcid); } -static void mt7615_init_dfs_state (struct mt7615_phy *phy) -{ -struct mt76_phy *mphy = phy->mt76; -struct ieee80211_hw *hw = mphy->hw; -struct cfg80211_chan_def *chandef = &hw->conf.chandef; - -if (hw->conf.flags &IEEE80211_CONF_OFFCHANNEL ) -return ; - -if (!(chandef->chan->flags &IEEE80211_CHAN_RADAR ) && - !(mphy->chandef.chan->flags &IEEE80211_CHAN_RADAR )) -return ; - -if (mphy->chandef.chan->center_freq == chandef->chan->center_freq && - mphy->chandef.width == chandef->width) -return ; - - phy->dfs_state =-1 ; -} -int mt7615_set_channel (struct mt7615_phy *phy) {struct mt7615_dev *dev = phy->dev;
@@ -314,7 +294,6 @@ int mt7615_set_channel(struct mt7615_phy *phy)set_bit (MT76_RESET , &phy->mt76->state); -mt7615_init_dfs_state (phy);mt76_set_channel (phy->mt76);if (is_mt7615 (&dev->mt76) && dev->flash_eeprom) {
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +3 -0
@@ -403,6 +403,9 @@ mt7615_mcu_rx_radar_detected(struct mt7615_dev *dev, struct sk_buff *skb)if (r->band_idx && dev->mt76.phy2) mphy = dev->mt76.phy2; +if (mt76_phy_dfs_state (mphy) <MT_DFS_STATE_CAC ) +return ; +ieee80211_radar_detected (mphy->hw); dev->hw_pattern++; }
drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +0 -1
@@ -177,7 +177,6 @@ struct mt7615_phy {u8 chfreq;u8 rdd_state; -int dfs_state;u32 rx_ampdu_ts;u32 ampdu_ref;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 487/1157 mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 0a14c1d0113f121151edf34333cdf212dd209190 ]
We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt76/mac80211.c +1 -0
@@ -210,6 +210,7 @@ static int mt76_led_init(struct mt76_dev *dev)if (!of_property_read_u32 (np,"led-sources" , &led_pin)) dev->led_pin = led_pin; dev->led_al =of_property_read_bool (np,"led-active-low" ); +of_node_put (np); }return led_classdev_register (dev->dev, &dev->led_cdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 488/1157 mediatek: mt76: eeprom: fix missing of_node_put() in mt76_find_power_limits_node()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 3bd53ea02d77917c2314ec7be9e2d05be22f87d3 ]
We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount.
--- drivers/net/wireless/mediatek/mt76/eeprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +4 -1
@@ -162,10 +162,13 @@ mt76_find_power_limits_node(struct mt76_dev *dev) }if (mt76_string_prop_find (country, dev->alpha2) || -mt76_string_prop_find (regd, region_name)) +mt76_string_prop_find (regd, region_name)) { +of_node_put (np);return cur; + } } +of_node_put (np);return fallback; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 489/1157 skmsg: Fix invalid last sg check in sk_msg_recvmsg()
In reply to Greg Kroah-HartmanFrom: Liu Jian <[email protected]>
[ Upstream commit 9974d37ea75f01b47d16072b5dad305bd8d23fcc ]
In sk_psock_skb_ingress_enqueue function, if the linear area + nr_frags + frag_list of the SKB has NR_MSG_FRAG_IDS blocks in total, skb_to_sgvec will return NR_MSG_FRAG_IDS, then msg->sg.end will be set to NR_MSG_FRAG_IDS, and in addition, (NR_MSG_FRAG_IDS - 1) is set to the last SG of msg. Recv the msg in sk_msg_recvmsg, when i is (NR_MSG_FRAG_IDS - 1), the sk_msg_iter_var_next(i) will change i to 0 (not NR_MSG_FRAG_IDS), the judgment condition "msg_rx->sg.start==msg_rx->sg.end" and
"i != msg_rx->sg.end" can not work.
As a result, the processed msg cannot be deleted from ingress_msg list. But the length of all the sge of the msg has changed to 0. Then the next recvmsg syscall will process the msg repeatedly, because the length of sge is 0, the -EFAULT error is always returned.
--- net/core/skmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/skmsg.c +2 -2
@@ -462,7 +462,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg,if (copied == len)break ; - }while (i != msg_rx->sg.end); + }while (!sg_is_last (sge));if (unlikely (peek)) { msg_rx =sk_psock_next_msg (psock, msg_rx);
@@ -472,7 +472,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *psock, struct msghdr *msg, } msg_rx->sg.start = i; -if (!sge->length && msg_rx->sg.start == msg_rx->sg.end) { +if (!sge->length &&sg_is_last (sge)) { msg_rx =sk_psock_dequeue_msg (psock);kfree_sk_msg (msg_rx); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 490/1157 drm/exynos/exynos7_drm_decon: free resources when clk_set_parent() failed.
In reply to Greg Kroah-HartmanFrom: Jian Zhang <[email protected]>
[ Upstream commit 48b927770f8ad3f8cf4a024a552abf272af9f592 ]
In exynos7_decon_resume, When it fails, we must use clk_disable_unprepare() to free resource that have been used.
message")
--- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos7_drm_decon.c +13 -4
@@ -800,31 +800,40 @@ static int exynos7_decon_resume(struct device *dev)if (ret <0 ) {DRM_DEV_ERROR (dev,"Failed to prepare_enable the pclk [%d]\n" , ret); -return ret; + goto err_pclk_enable; } ret =clk_prepare_enable (ctx->aclk);if (ret <0 ) {DRM_DEV_ERROR (dev,"Failed to prepare_enable the aclk [%d]\n" , ret); -return ret; + goto err_aclk_enable; } ret =clk_prepare_enable (ctx->eclk);if (ret <0 ) {DRM_DEV_ERROR (dev,"Failed to prepare_enable the eclk [%d]\n" , ret); -return ret; + goto err_eclk_enable; } ret =clk_prepare_enable (ctx->vclk);if (ret <0 ) {DRM_DEV_ERROR (dev,"Failed to prepare_enable the vclk [%d]\n" , ret); -return ret; + goto err_vclk_enable; }return 0 ; + +err_vclk_enable: +clk_disable_unprepare (ctx->eclk); +err_eclk_enable: +clk_disable_unprepare (ctx->aclk); +err_aclk_enable: +clk_disable_unprepare (ctx->pclk); +err_pclk_enable: + return ret; }#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 491/1157 bpf, x64: Add predicate for bpf2bpf with tailcalls support in JIT
In reply to Greg Kroah-HartmanFrom: Tony Ambardar <[email protected]>
[ Upstream commit 95acd8817e66d031d2e6ee7def3f1e1874819317 ]
The BPF core/verifier is hard-coded to permit mixing bpf2bpf and tail calls for only x86-64. Change the logic to instead rely on a new weak function 'bool bpf_jit_supports_subprog_tailcalls(void)', which a capable JIT backend can override.
Update the x86-64 eBPF JIT to reflect this.
--- arch/x86/net/bpf_jit_comp.c | 6 ++++++ include/linux/filter.h | 1 + kernel/bpf/core.c | 6 ++++++ kernel/bpf/verifier.c | 3 ++- 4 files changed, 15 insertions(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +6 -0
@@ -2506,3 +2506,9 @@ void *bpf_arch_text_copy(void *dst, void *src, size_t len)return ERR_PTR (-EINVAL );return dst; } + +/* Indicate the JIT backend supports mixing bpf2bpf and tailcalls. */ +bool bpf_jit_supports_subprog_tailcalls (void ) +{ +return true; +}
include/linux/filter.h +1 -0
@@ -948,6 +948,7 @@ u64 __bpf_call_base(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5);struct bpf_prog *bpf_int_jit_compile (struct bpf_prog *prog);void bpf_jit_compile (struct bpf_prog *prog);bool bpf_jit_needs_zext (void ); +bool bpf_jit_supports_subprog_tailcalls (void );bool bpf_jit_supports_kfunc_call (void );bool bpf_helper_changes_pkt_data (void *func);
kernel/bpf/core.c +6 -0
@@ -2716,6 +2716,12 @@ bool __weak bpf_jit_needs_zext(void)return false; } +/* Return TRUE if the JIT backend supports mixing bpf2bpf and tailcalls. */ +bool __weak bpf_jit_supports_subprog_tailcalls (void ) +{ +return false; +} +bool __weak bpf_jit_supports_kfunc_call (void ) {return false;
kernel/bpf/verifier.c +2 -1
@@ -6143,7 +6143,8 @@ static bool may_update_sockmap(struct bpf_verifier_env *env, int func_id)static bool allow_tail_call_in_subprogs (struct bpf_verifier_env *env) { -return env->prog->jit_requested &&IS_ENABLED (CONFIG_X86_64 ); +return env->prog->jit_requested && +bpf_jit_supports_subprog_tailcalls (); } static int check_map_func_compatibility(struct bpf_verifier_env *env,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 492/1157 bpf, x86: fix freeing of not-finalized bpf_prog_pack
In reply to Greg Kroah-HartmanFrom: Song Liu <[email protected]>
[ Upstream commit 1d5f82d9dd477d5c66e0214a68c3e4f308eadd6d ]
syzbot reported a few issues with bpf_prog_pack [1], [2]. This only happens with multiple subprogs. In jit_subprogs(), we first call bpf_int_jit_compile() on each sub program. And then, we call it on each sub program again. jit_data is not freed in the first call of bpf_int_jit_compile(). Similarly we don't call bpf_jit_binary_pack_finalize() in the first call of bpf_int_jit_compile().
If bpf_int_jit_compile() failed for one sub program, we will call bpf_jit_binary_pack_finalize() for this sub program. However, we don't have a chance to call it for other sub programs. Then we will hit "goto out_free" in jit_subprogs(), and call bpf_jit_free on some subprograms that haven't got bpf_jit_binary_pack_finalize() yet.
At this point, bpf_jit_binary_pack_free() is called and the whole 2MB page is freed erroneously.
Fix this with a custom bpf_jit_free() for x86_64, which calls bpf_jit_binary_pack_finalize() if necessary. Also, with custom bpf_jit_free(), bpf_prog_aux->use_bpf_prog_pack is not needed any more, remove it.
[1] https://syzkaller.appspot.com/bug?extid=2f649ec6d2eea1495a8f
[2] https://syzkaller.appspot.com/bug?extid=87f65c75f4a72db05445
--- arch/x86/net/bpf_jit_comp.c | 25 +++++++++++++++++++++++++ include/linux/bpf.h | 1 - include/linux/filter.h | 8 ++++++++ kernel/bpf/core.c | 29 ++++++++++++----------------- 4 files changed, 45 insertions(+), 18 deletions(-)
arch/x86/net/bpf_jit_comp.c +25 -0
@@ -2512,3 +2512,28 @@ bool bpf_jit_supports_subprog_tailcalls(void) {return true; } + +void bpf_jit_free (struct bpf_prog *prog) +{ +if (prog->jited) { +struct x64_jit_data *jit_data = prog->aux->jit_data; +struct bpf_binary_header *hdr; + +/* +* If we fail the final pass of JIT (from jit_subprogs), +* the program may not be finalized yet. Call finalize here +* before freeing it. +*/ +if (jit_data) { +bpf_jit_binary_pack_finalize (prog, jit_data->header, + jit_data->rw_header); +kvfree (jit_data->addrs); +kfree (jit_data); + } + hdr =bpf_jit_binary_pack_hdr (prog); +bpf_jit_binary_pack_free (hdr,NULL ); +WARN_ON_ONCE (!bpf_prog_kallsyms_verify_off (prog)); + } + +bpf_prog_unlock_free (prog); +}
include/linux/bpf.h +0 -1
@@ -1025,7 +1025,6 @@ struct bpf_prog_aux {bool sleepable;bool tail_call_reachable;bool xdp_has_frags; -bool use_bpf_prog_pack;/* BTF_KIND_FUNC_PROTO for valid attach_btf_id */ const struct btf_type *attach_func_proto;/* function name for valid attach_btf_id */
include/linux/filter.h +8 -0
@@ -1061,6 +1061,14 @@ u64 bpf_jit_alloc_exec_limit(void);void *bpf_jit_alloc_exec (unsigned long size);void bpf_jit_free_exec (void *addr);void bpf_jit_free (struct bpf_prog *fp); +struct bpf_binary_header * +bpf_jit_binary_pack_hdr (const struct bpf_prog *fp); + +static inline bool bpf_prog_kallsyms_verify_off (const struct bpf_prog *fp) +{ +return list_empty (&fp->aux->ksym.lnode) || + fp->aux->ksym.lnode.prev ==LIST_POISON2 ; +}struct bpf_binary_header * bpf_jit_binary_pack_alloc(unsigned int proglen, u8 **ro_image,
kernel/bpf/core.c +12 -17
@@ -649,12 +649,6 @@ static bool bpf_prog_kallsyms_candidate(const struct bpf_prog *fp)return fp->jited && !bpf_prog_was_classic (fp); } -static bool bpf_prog_kallsyms_verify_off (const struct bpf_prog *fp) -{ -return list_empty (&fp->aux->ksym.lnode) || - fp->aux->ksym.lnode.prev ==LIST_POISON2 ; -} -void bpf_prog_kallsyms_add (struct bpf_prog *fp) { if (!bpf_prog_kallsyms_candidate(fp) ||
@@ -1152,7 +1146,6 @@ int bpf_jit_binary_pack_finalize(struct bpf_prog *prog,bpf_prog_pack_free (ro_header);return PTR_ERR (ptr); } - prog->aux->use_bpf_prog_pack = true;return 0 ; }
@@ -1176,17 +1169,23 @@ void bpf_jit_binary_pack_free(struct bpf_binary_header *ro_header,bpf_jit_uncharge_modmem (size); } +struct bpf_binary_header * +bpf_jit_binary_pack_hdr (const struct bpf_prog *fp) +{ +unsigned long real_start = (unsigned long )fp->bpf_func; +unsigned long addr; + + addr = real_start &BPF_PROG_CHUNK_MASK ; +return (void *)addr; +} +static inline struct bpf_binary_header *bpf_jit_binary_hdr (const struct bpf_prog *fp) {unsigned long real_start = (unsigned long )fp->bpf_func;unsigned long addr; -if (fp->aux->use_bpf_prog_pack) - addr = real_start &BPF_PROG_CHUNK_MASK ; -else - addr = real_start &PAGE_MASK ; - + addr = real_start &PAGE_MASK ;return (void *)addr; }
@@ -1199,11 +1198,7 @@ void __weak bpf_jit_free(struct bpf_prog *fp)if (fp->jited) {struct bpf_binary_header *hdr =bpf_jit_binary_hdr (fp); -if (fp->aux->use_bpf_prog_pack) -bpf_jit_binary_pack_free (hdr,NULL /* rw_buffer */ ); -else -bpf_jit_binary_free (hdr); - +bpf_jit_binary_free (hdr);WARN_ON_ONCE (!bpf_prog_kallsyms_verify_off (fp)); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 493/1157 tcp: make retransmitted SKB fit into the send window
In reply to Greg Kroah-HartmanFrom: Yonglong Li <[email protected]>
[ Upstream commit 536a6c8e05f95e3d1118c40ae8b3022ee2d05d52 ]
current code of __tcp_retransmit_skb only check TCP_SKB_CB(skb)->seq in send window, and TCP_SKB_CB(skb)->seq_end maybe out of send window. If receiver has shrunk his window, and skb is out of new window, it should retransmit a smaller portion of the payload.
test packetdrill script:
0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR)
+0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
+0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) +0 > S 0:0(0) win 65535 <mss 1460,sackOK,TS val 100 ecr 0,nop,wscale 8>
+.05 < S. 0:0(0) ack 1 win 6000 <mss 1000,nop,nop,sackOK>
+0 > . 1:1(0) ack 1
+0 write(3, ..., 10000) = 10000
+0 > . 1:2001(2000) ack 1 win 65535
+0 > . 2001:4001(2000) ack 1 win 65535
+0 > . 4001:6001(2000) ack 1 win 65535
+.05 < . 1:1(0) ack 4001 win 1001
and tcpdump show:
192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 1:2001, ack 1, win 65535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 2001:4001, ack 1, win 65535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 65535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65535, length 1000 192.0.2.1.8080 > 192.168.226.67.55: Flags [.], ack 4001, win 1001, length 0 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 65535, length 1000
when cient retract window to 1001, send window is [4001,5002], but TLP send 5001-6001 packet which is out of send window.
--- net/ipv4/tcp_output.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
net/ipv4/tcp_output.c +16 -7
@@ -3142,7 +3142,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)struct tcp_sock *tp =tcp_sk (sk);unsigned int cur_mss;int diff, len, err; - +int avail_wnd;/* Inconclusive MTU probe */ if (icsk->icsk_mtup.probe_size)
@@ -3164,17 +3164,25 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs)return -EHOSTUNREACH ;/* Routing failure or similar. */ cur_mss =tcp_current_mss (sk); + avail_wnd =tcp_wnd_end (tp) -TCP_SKB_CB (skb)->seq;/* If receiver has shrunk his window, and skb is out of * new window, do not retransmit it. The exception is the * case, when window is shrunk to zero. In this case -* our retransmit serves as a zero window probe. +* our retransmit of one segment serves as a zero window probe. */ -if (!before (TCP_SKB_CB (skb)->seq,tcp_wnd_end (tp)) && -TCP_SKB_CB (skb)->seq != tp->snd_una) -return -EAGAIN ; +if (avail_wnd <=0 ) { +if (TCP_SKB_CB (skb)->seq != tp->snd_una) +return -EAGAIN ; + avail_wnd = cur_mss; + } len = cur_mss * segs; +if (len > avail_wnd) { + len =rounddown (avail_wnd, cur_mss); +if (!len) + len = avail_wnd; + }if (skb->len > len) {if (tcp_fragment (sk,TCP_FRAG_IN_RTX_QUEUE , skb, len, cur_mss,GFP_ATOMIC ))
@@ -3188,8 +3196,9 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb, int segs) diff -=tcp_skb_pcount (skb);if (diff)tcp_adjust_pcount (sk, skb, diff); -if (skb->len < cur_mss) -tcp_retrans_try_collapse (sk, skb, cur_mss); + avail_wnd =min_t (int, avail_wnd, cur_mss); +if (skb->len < avail_wnd) +tcp_retrans_try_collapse (sk, skb, avail_wnd); }/* RFC3168, section 6.1.1.1. ECN fallback */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 494/1157 libbpf: Fix the name of a reused map
In reply to Greg Kroah-HartmanFrom: Anquan Wu <[email protected]>
[ Upstream commit bf3f00378524adae16628cbadbd11ba7211863bb ]
BPF map name is limited to BPF_OBJ_NAME_LEN.
A map name is defined as being longer than BPF_OBJ_NAME_LEN, it will be truncated to BPF_OBJ_NAME_LEN when a userspace program calls libbpf to create the map. A pinned map also generates a path in the /sys. If the previous program wanted to reuse the map, it can not get bpf_map by name, because the name of the map is only partially the same as the name which get from pinned path.
The syscall information below show that map name "process_pinned_map" is truncated to "process_pinned_".
bpf(BPF_OBJ_GET, {pathname="/sys/fs/bpf/process_pinned_map",
bpf_fd=0, file_flags=0}, 144) = -1 ENOENT (No such file or directory)
bpf(BPF_MAP_CREATE, {map_type=BPF_MAP_TYPE_HASH, key_size=4,
value_size=4,max_entries=1024, map_flags=0, inner_map_fd=0,
map_name="process_pinned_",map_ifindex=0, btf_fd=3, btf_key_type_id=6,
btf_value_type_id=10,btf_vmlinux_value_type_id=0}, 72) = 4This patch check that if the name of pinned map are the same as the actual name for the first (BPF_OBJ_NAME_LEN - 1),
bpf map still uses the name which is included in bpf object.
--- tools/lib/bpf/libbpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/lib/bpf/libbpf.c +7 -2
@@ -4327,7 +4327,7 @@ int bpf_map__set_autocreate(struct bpf_map *map, bool autocreate)int bpf_map__reuse_fd (struct bpf_map *map,int fd) {struct bpf_map_info info = {}; -__u32 len =sizeof (info); +__u32 len =sizeof (info), name_len;int new_fd, err;char *new_name;
@@ -4337,7 +4337,12 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd)if (err)return libbpf_err (err); - new_name =strdup (info.name); + name_len =strlen (info.name); +if (name_len ==BPF_OBJ_NAME_LEN -1 &&strncmp (map->name, info.name, name_len) ==0 ) + new_name =strdup (map->name); +else + new_name =strdup (info.name); +if (!new_name)return libbpf_err (-errno);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 495/1157 kunit: executor: Fix a memory leak on failure in kunit_filter_tests
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 94681e289bf5d10c9db9db143d1a22d8717205c5 ]
It's possible that memory allocation for 'filtered' will fail, but for the copy of the suite to succeed. In this case, the copy could be leaked.
Properly free 'copy' in the error case for the allocation of 'filtered' failing.
Note that there may also have been a similar issue in kunit_filter_subsuites, before it was removed in "kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites".
This was reported by clang-analyzer via the kernel test robot, here:
https://lore.kernel.org/all/[email protected]/
And by smatch via Dan Carpenter and the kernel test robot:
https://lore.kernel.org/all/[email protected]/
--- lib/kunit/executor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
lib/kunit/executor.c +3 -1
@@ -76,8 +76,10 @@ kunit_filter_tests(struct kunit_suite *const suite, const char *test_glob)memcpy (copy, suite,sizeof (*copy)); filtered =kcalloc (n +1 ,sizeof (*filtered),GFP_KERNEL ); -if (!filtered) +if (!filtered) { +kfree (copy);return ERR_PTR (-ENOMEM ); + } n =0 ;kunit_suite_for_each_test_case (suite, test_case) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 496/1157 selftests: timers: valid-adjtimex: build fix for newer toolchains
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 9a162977d20436be5678a8e21a8e58eb4616d86a ]
Toolchains with an include file 'sys/timex.h' based on 3.18 will have a 'clock_adjtime' definition added, so it can't be static in the code:
valid-adjtimex.c:43:12: error: static declaration of ‘clock_adjtime’ follows non-static declaration
--- tools/testing/selftests/timers/valid-adjtimex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/timers/valid-adjtimex.c +1 -1
@@ -40,7 +40,7 @@#define ADJ_SETOFFSET 0x0100#include <sys/syscall.h> -static int clock_adjtime (clockid_t id,struct timex *tx) +int clock_adjtime (clockid_t id,struct timex *tx) {return syscall (__NR_clock_adjtime, id, tx); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 497/1157 selftests: timers: clocksource-switch: fix passing errors from child
In reply to Greg Kroah-HartmanFrom: Wolfram Sang <[email protected]>
[ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ]
The return value from system() is a waitpid-style integer. Do not return it directly because with the implicit masking in exit() it will always return 0. Access it with appropriate macros to really pass on errors.
--- tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/timers/clocksource-switch.c +3 -3
@@ -110,10 +110,10 @@ int run_tests(int secs)sprintf (buf,"./inconsistency-check -t %i" , secs); ret =system (buf); -if (ret) -return ret; +if (WIFEXITED (ret) &&WEXITSTATUS (ret)) +return WEXITSTATUS (ret); ret =system ("./nanosleep" ); -return ret; +return WIFEXITED (ret) ?WEXITSTATUS (ret) :0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 498/1157 bpf: Fix subprog names in stack traces.
In reply to Greg Kroah-HartmanFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 9c7c48d6a1e2eb5192ad5294c1c4dbd42a88e88b ]
The commit 7337224fc150 ("bpf: Improve the info.func_info and info.func_info_rec_size behavior") accidently made bpf_prog_ksym_set_name() conservative for bpf subprograms.
Fixed it so instead of "bpf_prog_tag_F" the stack traces print "bpf_prog_tag_full_subprog_name".
--- kernel/bpf/verifier.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/bpf/verifier.c +1 -3
@@ -13526,6 +13526,7 @@ static int jit_subprogs(struct bpf_verifier_env *env)/* Below members will be freed only at prog->aux */ func[i]->aux->btf = prog->aux->btf; func[i]->aux->func_info = prog->aux->func_info; + func[i]->aux->func_info_cnt = prog->aux->func_info_cnt; func[i]->aux->poke_tab = prog->aux->poke_tab; func[i]->aux->size_poke_tab = prog->aux->size_poke_tab;
@@ -13538,9 +13539,6 @@ static int jit_subprogs(struct bpf_verifier_env *env) poke->aux = func[i]->aux; } -/* Use bpf_prog_F_tag to indicate functions in stack traces. -* Long term would need debug info to populate names -*/ func[i]->aux->name[0 ] ='F' ; func[i]->aux->stack_depth = env->subprog_info[i].stack_depth; func[i]->jit_requested =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 499/1157 wifi: nl80211: acquire wdev mutex for dump_survey
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 284b38b6902a7154e3675482418a7b6df47808fe ]
At least the quantenna driver calls wdev_chandef() here which now requires the lock, so acquire it.
--- net/wireless/nl80211.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/nl80211.c +2 -0
@@ -10126,7 +10126,9 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb) }while (1 ) { +wdev_lock (wdev); res =rdev_dump_survey (rdev, wdev->netdev, survey_idx, &survey); +wdev_unlock (wdev);if (res == -ENOENT )break ;if (res)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 500/1157 media: v4l: async: Also match secondary fwnode endpoints
In reply to Greg Kroah-HartmanFrom: Sakari Ailus <[email protected]>
[ Upstream commit 46347e3ec61660562d4a4a933713e2c2b74598e2 ]
For camera sensor devices the firmware information of which comes from non-DT (or some ACPI variants), the kernel makes the information visible to the drivers in a form similar to DT. This takes place through device's secondary fwnodes, in which case also the secondary fwnode needs to be heterogenously (endpoint vs. device) matched.
--- drivers/media/v4l2-core/v4l2-async.c | 35 +++++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +21 -14
@@ -66,8 +66,10 @@ static bool match_i2c(struct v4l2_async_notifier *notifier,#endif } -static bool match_fwnode (struct v4l2_async_notifier *notifier, -struct v4l2_subdev *sd,struct v4l2_async_subdev *asd) +static bool +match_fwnode_one (struct v4l2_async_notifier *notifier, +struct v4l2_subdev *sd,struct fwnode_handle *sd_fwnode, +struct v4l2_async_subdev *asd) {struct fwnode_handle *other_fwnode;struct fwnode_handle *dev_fwnode;
@@ -80,15 +82,7 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,* fwnode or a device fwnode. Start with the simple case of direct * fwnode matching. */ -if (sd->fwnode == asd->match.fwnode) -return true; - -/* -* Check the same situation for any possible secondary assigned to the -* subdev's fwnode -*/ -if (!IS_ERR_OR_NULL (sd->fwnode->secondary) && - sd->fwnode->secondary == asd->match.fwnode) +if (sd_fwnode == asd->match.fwnode)return true;/*
@@ -99,7 +93,7 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,* ACPI. This won't make a difference, as drivers should not try to * match unconnected endpoints. */ - sd_fwnode_is_ep =fwnode_graph_is_endpoint (sd->fwnode); + sd_fwnode_is_ep =fwnode_graph_is_endpoint (sd_fwnode); asd_fwnode_is_ep =fwnode_graph_is_endpoint (asd->match.fwnode);if (sd_fwnode_is_ep == asd_fwnode_is_ep)
@@ -110,11 +104,11 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,* parent of the endpoint fwnode, and compare it with the other fwnode. */ if (sd_fwnode_is_ep) { - dev_fwnode =fwnode_graph_get_port_parent (sd->fwnode); + dev_fwnode =fwnode_graph_get_port_parent (sd_fwnode); other_fwnode = asd->match.fwnode; }else { dev_fwnode =fwnode_graph_get_port_parent (asd->match.fwnode); - other_fwnode = sd->fwnode; + other_fwnode = sd_fwnode; }fwnode_handle_put (dev_fwnode);
@@ -143,6 +137,19 @@ static bool match_fwnode(struct v4l2_async_notifier *notifier,return true; } +static bool match_fwnode (struct v4l2_async_notifier *notifier, +struct v4l2_subdev *sd,struct v4l2_async_subdev *asd) +{ +if (match_fwnode_one (notifier, sd, sd->fwnode, asd)) +return true; + +/* Also check the secondary fwnode. */ +if (IS_ERR_OR_NULL (sd->fwnode->secondary)) +return false; + +return match_fwnode_one (notifier, sd, sd->fwnode->secondary, asd); +} +static LIST_HEAD (subdev_list);static LIST_HEAD (notifier_list);static DEFINE_MUTEX (list_lock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 501/1157 media: ov7251: add missing disable functions on error in ov7251_set_power_on()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 7a9795b31049b7e233d050a82b00094155a695c7 ]
Add the missing gpiod_set_value_cansleep() and clk_disable_unprepare() before return from ov7251_set_power_on() in the error handling case.
--- drivers/media/i2c/ov7251.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/ov7251.c +2 -0
@@ -934,6 +934,8 @@ static int ov7251_set_power_on(struct device *dev) ARRAY_SIZE(ov7251_global_init_setting));if (ret <0 ) {dev_err (ov7251->dev,"error during global init\n" ); +gpiod_set_value_cansleep (ov7251->enable_gpio,0 ); +clk_disable_unprepare (ov7251->xclk);ov7251_regulators_disable (ov7251);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 502/1157 fs: check FMODE_LSEEK to control internal pipe splicing
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 97ef77c52b789ec1411d360ed99dca1efe4b2c81 ]
The original direct splicing mechanism from Jens required the input to be a regular file because it was avoiding the special socket case. It also recognized blkdevs as being close enough to a regular file. But it forgot about chardevs, which behave the same way and work fine here.
This is an okayish heuristic, but it doesn't totally work. For example, a few chardevs should be spliceable here. And a few regular files shouldn't. This patch fixes this by instead checking whether FMODE_LSEEK is set, which represents decently enough what we need rewinding for when splicing to internal pipes.
--- fs/splice.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
fs/splice.c +4 -6
@@ -814,17 +814,15 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, {struct pipe_inode_info *pipe;long ret, bytes; -umode_t i_mode;size_t len;int i, flags, more;/* -* We require the input being a regular file, as we don't want to -* randomly drop data for eg socket -> socket splicing. Use the -* piped splicing for that! +* We require the input to be seekable, as we don't want to randomly +* drop data for eg socket -> socket splicing. Use the piped splicing +* for that! */ - i_mode =file_inode (in)->i_mode; -if (unlikely (!S_ISREG (i_mode) && !S_ISBLK (i_mode))) +if (unlikely (!(in->f_mode &FMODE_LSEEK )))return -EINVAL ;/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 503/1157 media: cedrus: h265: Fix flag name
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 104a70e1d0bcef28db13c4192b8729086089651c ]
Bit 21 in register 0x24 (slice header info 1) actually represents negated version of low delay flag. This can be seen in vendor Cedar library source code. While this flag is not part of the standard, it can be found in reference HEVC implementation.
Fix macro name and change it to flag.
--- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 +++- drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +3 -1
@@ -559,7 +559,6 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, reg =VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2 (slice_params->slice_tc_offset_div2) |VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2 (slice_params->slice_beta_offset_div2) | -VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST (decode_params->num_poc_st_curr_after ==0 ) |VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET (slice_params->slice_cr_qp_offset) |VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET (slice_params->slice_cb_qp_offset) |VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_QP_DELTA (slice_params->slice_qp_delta);
@@ -572,6 +571,9 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED , slice_params->flags); +if (decode_params->num_poc_st_curr_after ==0 ) + reg |=VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY ; +cedrus_write (dev,VE_DEC_H265_DEC_SLICE_HDR_INFO1 , reg); chroma_log2_weight_denom = pred_weight_table->luma_log2_weight_denom +
drivers/staging/media/sunxi/cedrus/cedrus_regs.h +1 -2
@@ -377,13 +377,12 @@#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_DEBLOCKING_FILTER_DISABLED BIT(23)#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED BIT(22) +#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY BIT(21)#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2 (v) \ SHIFT_AND_MASK_BITS(v, 31, 28)#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2 (v) \ SHIFT_AND_MASK_BITS(v, 27, 24) -#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST (v) \ - ((v) ? BIT(21) : 0)#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET (v) \ SHIFT_AND_MASK_BITS(v, 20, 16)#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET (v) \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 504/1157 media: uapi: HEVC: Change pic_order_cnt definition in v4l2_hevc_dpb_entry
In reply to Greg Kroah-HartmanFrom: Benjamin Gaignard <[email protected]>
[ Upstream commit c4a179c7167ee16aad1267f9c99bc1ecff475585 ]
The HEVC specification describes the following:
"PicOrderCntVal is derived as follows:
PicOrderCntVal = PicOrderCntMsb + slice_pic_order_cnt_lsb The value of PicOrderCntVal shall be in the range of −2^31 to 2^31 − 1, inclusive."
To match with these definitions change __u16 pic_order_cnt[2] into __s32 pic_order_cnt_val.
Change v4l2_ctrl_hevc_slice_params->slice_pic_order_cnt to __s32 too.
--- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 2 +- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 7 +++---- drivers/staging/media/hantro/hantro_hevc.c | 2 +- drivers/staging/media/hantro/hantro_hw.h | 4 ++-- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 ++-- include/media/hevc-ctrls.h | 4 ++-- 6 files changed, 11 insertions(+), 12 deletions(-)
Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +1 -1
@@ -2997,7 +2997,7 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``colour_plane_id`` - - * - __u16 + * - __s32 - ``slice_pic_order_cnt`` - * - __u8
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +3 -4
@@ -390,11 +390,10 @@ static int set_ref(struct hantro_ctx *ctx) !!(pps->flags & V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED));/* -* Write POC count diff from current pic. For frame decoding only compute -* pic_order_cnt[0] and ignore pic_order_cnt[1] used in field-coding. +* Write POC count diff from current pic. */ for (i =0 ; i < decode_params->num_active_dpb_entries && i <ARRAY_SIZE (cur_poc); i++) { -char poc_diff = decode_params->pic_order_cnt_val - dpb[i].pic_order_cnt[0 ]; +char poc_diff = decode_params->pic_order_cnt_val - dpb[i].pic_order_cnt_val;hantro_reg_write (vpu, &cur_poc[i], poc_diff); }
@@ -421,7 +420,7 @@ static int set_ref(struct hantro_ctx *ctx) dpb_longterm_e =0 ;for (i =0 ; i < decode_params->num_active_dpb_entries && i < (V4L2_HEVC_DPB_ENTRIES_NUM_MAX -1 ); i++) { - luma_addr =hantro_hevc_get_ref_buf (ctx, dpb[i].pic_order_cnt[0 ]); + luma_addr =hantro_hevc_get_ref_buf (ctx, dpb[i].pic_order_cnt_val);if (!luma_addr)return -ENOMEM ;
drivers/staging/media/hantro/hantro_hevc.c +1 -1
@@ -33,7 +33,7 @@ void hantro_hevc_ref_init(struct hantro_ctx *ctx) }dma_addr_t hantro_hevc_get_ref_buf (struct hantro_ctx *ctx, -int poc) +s32 poc) {struct hantro_hevc_dec_hw_ctx *hevc_dec = &ctx->hevc_dec;int i;
drivers/staging/media/hantro/hantro_hw.h +2 -2
@@ -145,7 +145,7 @@ struct hantro_hevc_dec_hw_ctx {struct hantro_aux_buf tile_bsd;struct hantro_aux_buf ref_bufs[NUM_REF_PICTURES ];struct hantro_aux_buf scaling_lists; -int ref_bufs_poc[NUM_REF_PICTURES ]; +s32 ref_bufs_poc[NUM_REF_PICTURES ];u32 ref_bufs_used;struct hantro_hevc_dec_ctrls ctrls;unsigned int num_tile_cols_allocated;
@@ -357,7 +357,7 @@ void hantro_hevc_dec_exit(struct hantro_ctx *ctx);int hantro_g2_hevc_dec_run (struct hantro_ctx *ctx);int hantro_hevc_dec_prepare_run (struct hantro_ctx *ctx);void hantro_hevc_ref_init (struct hantro_ctx *ctx); -dma_addr_t hantro_hevc_get_ref_buf (struct hantro_ctx *ctx,int poc); +dma_addr_t hantro_hevc_get_ref_buf (struct hantro_ctx *ctx,s32 poc);int hantro_hevc_add_ref_buf (struct hantro_ctx *ctx,int poc,dma_addr_t addr);int hantro_hevc_validate_sps (struct hantro_ctx *ctx,const struct v4l2_ctrl_hevc_sps *sps);
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +2 -2
@@ -143,8 +143,8 @@ static void cedrus_h265_frame_info_write_dpb(struct cedrus_ctx *ctx,for (i =0 ; i < num_active_dpb_entries; i++) {int buffer_index =vb2_find_timestamp (vq, dpb[i].timestamp,0 );u32 pic_order_cnt[2 ] = { - dpb[i].pic_order_cnt[0 ], - dpb[i].pic_order_cnt[1 ] + dpb[i].pic_order_cnt_val, + dpb[i].pic_order_cnt_val }; cedrus_h265_frame_info_write_single(ctx, i, dpb[i].field_pic,
include/media/hevc-ctrls.h +2 -2
@@ -135,7 +135,7 @@ struct v4l2_hevc_dpb_entry {__u64 timestamp;__u8 flags;__u8 field_pic; -__u16 pic_order_cnt[2 ]; +__s32 pic_order_cnt_val;__u8 padding[2 ]; };
@@ -178,7 +178,7 @@ struct v4l2_ctrl_hevc_slice_params {/* ISO/IEC 23008-2, ITU-T Rec. H.265: General slice segment header */ __u8 slice_type;__u8 colour_plane_id; -__u16 slice_pic_order_cnt; +__s32 slice_pic_order_cnt;__u8 num_ref_idx_l0_active_minus1;__u8 num_ref_idx_l1_active_minus1;__u8 collocated_ref_idx;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 505/1157 media: cedrus: h265: Fix logic for not low delay flag
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit f1a413902aa71044b6ec41265e5e28ebaf29a9ce ]
Now that we know real purpose of "not low delay" flag, logic for applying this flag should be fixed too. According to vendor and reference implementation, low delay is signaled when POC of current frame is lower than POC of at least one reference of a slice.
Implement mentioned logic and invert it to conform to flag meaning. Also don't apply flag for I frames. They don't have any reference.
This fixes decoding of 3 reference bitstreams.
--- .../staging/media/sunxi/cedrus/cedrus_h265.c | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +26 -1
@@ -301,6 +301,31 @@ static void cedrus_h265_write_scaling_list(struct cedrus_ctx *ctx, } } +static int cedrus_h265_is_low_delay (struct cedrus_run *run) +{ +const struct v4l2_ctrl_hevc_slice_params *slice_params; +const struct v4l2_hevc_dpb_entry *dpb; +s32 poc; +int i; + + slice_params = run->h265.slice_params; + poc = run->h265.decode_params->pic_order_cnt_val; + dpb = run->h265.decode_params->dpb; + +for (i =0 ; i < slice_params->num_ref_idx_l0_active_minus1 +1 ; i++) +if (dpb[slice_params->ref_idx_l0[i]].pic_order_cnt_val > poc) +return 1 ; + +if (slice_params->slice_type !=V4L2_HEVC_SLICE_TYPE_B ) +return 0 ; + +for (i =0 ; i < slice_params->num_ref_idx_l1_active_minus1 +1 ; i++) +if (dpb[slice_params->ref_idx_l1[i]].pic_order_cnt_val > poc) +return 1 ; + +return 0 ; +} +static void cedrus_h265_setup (struct cedrus_ctx *ctx,struct cedrus_run *run) {
@@ -571,7 +596,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED , slice_params->flags); -if (decode_params->num_poc_st_curr_after ==0 ) +if (slice_params->slice_type !=V4L2_HEVC_SLICE_TYPE_I && !cedrus_h265_is_low_delay (run)) reg |=VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY ;cedrus_write (dev,VE_DEC_H265_DEC_SLICE_HDR_INFO1 , reg);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 506/1157 wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 7a4836560a6198d245d5732e26f94898b12eb760 ]
The simple_write_to_buffer() function will succeed if even a single byte is initialized. However, we need to initialize the whole buffer to prevent information leaks. Just use memdup_user().
--- drivers/net/wireless/ath/wil6210/debugfs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +4 -10
@@ -1012,18 +1012,12 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,u16 cmdid;int rc, rc1; -if (cmdlen <0 ) +if (cmdlen <0 || *ppos !=0 )return -EINVAL ; - wmi =kmalloc (len,GFP_KERNEL ); -if (!wmi) -return -ENOMEM ; - - rc =simple_write_to_buffer (wmi, len, ppos, buf, len); -if (rc <0 ) { -kfree (wmi); -return rc; - } + wmi =memdup_user (buf, len); +if (IS_ERR (wmi)) +return PTR_ERR (wmi); cmd = (cmdlen >0 ) ? &wmi[1 ] :NULL ; cmdid =le16_to_cpu (wmi->command_id);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 507/1157 wifi: p54: Fix an error handling path in p54spi_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 83781f0162d080fec7dcb911afd1bc2f5ad04471 ]
If an error occurs after a successful call to p54spi_request_firmware(), it must be undone by a corresponding release_firmware() as already done in the error handling path of p54spi_request_firmware() and in the .remove() function.
Add the missing call in the error handling path and remove it from p54spi_request_firmware() now that it is the responsibility of the caller to release the firmware
--- drivers/net/wireless/intersil/p54/p54spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intersil/p54/p54spi.c +2 -1
@@ -164,7 +164,7 @@ static int p54spi_request_firmware(struct ieee80211_hw *dev) ret =p54_parse_firmware (dev, priv->firmware);if (ret) { -release_firmware (priv->firmware); +/* the firmware is released by the caller */ return ret; }
@@ -659,6 +659,7 @@ static int p54spi_probe(struct spi_device *spi)return 0 ; err_free_common: +release_firmware (priv->firmware);free_irq (gpio_to_irq (p54spi_gpio_irq), spi); err_free_gpio_irq:gpio_free (p54spi_gpio_irq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 508/1157 wifi: p54: add missing parentheses in p54_flush()
In reply to Greg Kroah-HartmanFrom: Rustam Subkhankulov <[email protected]>
[ Upstream commit bcfd9d7f6840b06d5988c7141127795cf405805e ]
The assignment of the value to the variable total in the loop condition must be enclosed in additional parentheses, since otherwise, in accordance with the precedence of the operators, the conjunction will be performed first, and only then the assignment.
Due to this error, a warning later in the function after the loop may not occur in the situation when it should.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/intersil/p54/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intersil/p54/main.c +1 -1
@@ -682,7 +682,7 @@ static void p54_flush(struct ieee80211_hw *dev, struct ieee80211_vif *vif,* queues have already been stopped and no new frames can sneak * up from behind. */ -while ((total =p54_flush_count (priv) && i--)) { +while ((total =p54_flush_count (priv)) && i--) {/* waste time */ msleep (20 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 509/1157 drm/amdgpu: use the same HDP flush registers for all nbio 7.4.x
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 912db6a58738e8be502838eb6a88f207ba356cd7 ]
Align aldebaran with all other asics. One HDP bit per
SDMA instance, aligned with firmware. This is effectively
a revert of
commit a0f9f8546668 ("drm/amdgpu/nbio7.4: don't use GPU_HDP_FLUSH bit 12"). On further discussions with the relevant hardware teams, re-align the bits for SDMA.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +---- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 21 ------------------- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -4
@@ -2194,12 +2194,9 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)break ;case IP_VERSION (7 ,4 ,0 ):case IP_VERSION (7 ,4 ,1 ): - adev->nbio.funcs = &nbio_v7_4_funcs; - adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg; -break ;case IP_VERSION (7 ,4 ,4 ): adev->nbio.funcs = &nbio_v7_4_funcs; - adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg_ald; + adev->nbio.hdp_flush_reg = &nbio_v7_4_hdp_flush_reg;break ;case IP_VERSION (7 ,2 ,0 ):case IP_VERSION (7 ,2 ,1 ):
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +0 -21
@@ -339,27 +339,6 @@ const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg = { .ref_and_mask_sdma1 = GPU_HDP_FLUSH_DONE__SDMA1_MASK, }; -const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg_ald = { - .ref_and_mask_cp0 =GPU_HDP_FLUSH_DONE__CP0_MASK , - .ref_and_mask_cp1 =GPU_HDP_FLUSH_DONE__CP1_MASK , - .ref_and_mask_cp2 =GPU_HDP_FLUSH_DONE__CP2_MASK , - .ref_and_mask_cp3 =GPU_HDP_FLUSH_DONE__CP3_MASK , - .ref_and_mask_cp4 =GPU_HDP_FLUSH_DONE__CP4_MASK , - .ref_and_mask_cp5 =GPU_HDP_FLUSH_DONE__CP5_MASK , - .ref_and_mask_cp6 =GPU_HDP_FLUSH_DONE__CP6_MASK , - .ref_and_mask_cp7 =GPU_HDP_FLUSH_DONE__CP7_MASK , - .ref_and_mask_cp8 =GPU_HDP_FLUSH_DONE__CP8_MASK , - .ref_and_mask_cp9 =GPU_HDP_FLUSH_DONE__CP9_MASK , - .ref_and_mask_sdma0 =GPU_HDP_FLUSH_DONE__RSVD_ENG1_MASK , - .ref_and_mask_sdma1 =GPU_HDP_FLUSH_DONE__RSVD_ENG2_MASK , - .ref_and_mask_sdma2 =GPU_HDP_FLUSH_DONE__RSVD_ENG3_MASK , - .ref_and_mask_sdma3 =GPU_HDP_FLUSH_DONE__RSVD_ENG4_MASK , - .ref_and_mask_sdma4 =GPU_HDP_FLUSH_DONE__RSVD_ENG5_MASK , - .ref_and_mask_sdma5 =GPU_HDP_FLUSH_DONE__RSVD_ENG6_MASK , - .ref_and_mask_sdma6 =GPU_HDP_FLUSH_DONE__RSVD_ENG7_MASK , - .ref_and_mask_sdma7 =GPU_HDP_FLUSH_DONE__RSVD_ENG8_MASK , -}; -static void nbio_v7_4_init_registers (struct amdgpu_device *adev) {uint32_t baco_cntl;
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.h +0 -1
@@ -27,7 +27,6 @@#include "soc15_common.h" extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg; -extern const struct nbio_hdp_flush_reg nbio_v7_4_hdp_flush_reg_ald;extern const struct amdgpu_nbio_funcs nbio_v7_4_funcs;extern struct amdgpu_nbio_ras nbio_v7_4_ras;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 510/1157 drm/amdgpu: use the same HDP flush registers for all nbio 2.3.x
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 98a90f1f0fdd112b85b16ef6ceee69f319ab9311 ]
Align RDNA2.x with other asics. One HDP bit per SDMA instance, aligned with firmware. This is effectively a revert of
commit 369b7d04baf3 ("drm/amdgpu/nbio2.3: don't use GPU_HDP_FLUSH bit 12"). On further discussions with the relevant hardware teams, re-align the bits for SDMA.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +---- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c | 21 ------------------- drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h | 1 - 3 files changed, 1 insertion(+), 26 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -4
@@ -2210,15 +2210,12 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (2 ,3 ,0 ):case IP_VERSION (2 ,3 ,1 ):case IP_VERSION (2 ,3 ,2 ): - adev->nbio.funcs = &nbio_v2_3_funcs; - adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; -break ;case IP_VERSION (3 ,3 ,0 ):case IP_VERSION (3 ,3 ,1 ):case IP_VERSION (3 ,3 ,2 ):case IP_VERSION (3 ,3 ,3 ): adev->nbio.funcs = &nbio_v2_3_funcs; - adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg_sc; + adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg;break ;case IP_VERSION (4 ,3 ,0 ):case IP_VERSION (4 ,3 ,1 ):
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c +0 -21
@@ -328,27 +328,6 @@ const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg = { .ref_and_mask_sdma1 = BIF_BX_PF_GPU_HDP_FLUSH_DONE__SDMA1_MASK, }; -const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg_sc = { - .ref_and_mask_cp0 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP0_MASK , - .ref_and_mask_cp1 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP1_MASK , - .ref_and_mask_cp2 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP2_MASK , - .ref_and_mask_cp3 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP3_MASK , - .ref_and_mask_cp4 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP4_MASK , - .ref_and_mask_cp5 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP5_MASK , - .ref_and_mask_cp6 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP6_MASK , - .ref_and_mask_cp7 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP7_MASK , - .ref_and_mask_cp8 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP8_MASK , - .ref_and_mask_cp9 =BIF_BX_PF_GPU_HDP_FLUSH_DONE__CP9_MASK , - .ref_and_mask_sdma0 =GPU_HDP_FLUSH_DONE__RSVD_ENG1_MASK , - .ref_and_mask_sdma1 =GPU_HDP_FLUSH_DONE__RSVD_ENG2_MASK , - .ref_and_mask_sdma2 =GPU_HDP_FLUSH_DONE__RSVD_ENG3_MASK , - .ref_and_mask_sdma3 =GPU_HDP_FLUSH_DONE__RSVD_ENG4_MASK , - .ref_and_mask_sdma4 =GPU_HDP_FLUSH_DONE__RSVD_ENG5_MASK , - .ref_and_mask_sdma5 =GPU_HDP_FLUSH_DONE__RSVD_ENG6_MASK , - .ref_and_mask_sdma6 =GPU_HDP_FLUSH_DONE__RSVD_ENG7_MASK , - .ref_and_mask_sdma7 =GPU_HDP_FLUSH_DONE__RSVD_ENG8_MASK , -}; -static void nbio_v2_3_init_registers (struct amdgpu_device *adev) {uint32_t def, data;
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.h +0 -1
@@ -27,7 +27,6 @@#include "soc15_common.h" extern const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg; -extern const struct nbio_hdp_flush_reg nbio_v2_3_hdp_flush_reg_sc;extern const struct amdgpu_nbio_funcs nbio_v2_3_funcs;#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 511/1157 drm/amdgpu: restore original stable pstate on ctx fini
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 958afce98c2c86732483458c03540d3c6ef45254 ]
Save the original stable pstate on ctx init and restore it on ctx fini so that we restore a manually selected stable pstate on ctx exit.
v2: fix init order (Alex)
v3: don't add new variable to ctx struct (Evan)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 60 ++++++++++++++----------- 1 file changed, 33 insertions(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +33 -27
@@ -271,32 +271,6 @@ static ktime_t amdgpu_ctx_fini_entity(struct amdgpu_ctx_entity *entity)return res; } -static int amdgpu_ctx_init (struct amdgpu_ctx_mgr *mgr,int32_t priority, -struct drm_file *filp,struct amdgpu_ctx *ctx) -{ -int r; - - r =amdgpu_ctx_priority_permit (filp, priority); -if (r) -return r; - -memset (ctx,0 ,sizeof (*ctx)); - -kref_init (&ctx->refcount); - ctx->mgr = mgr; -spin_lock_init (&ctx->ring_lock); -mutex_init (&ctx->lock); - - ctx->reset_counter =atomic_read (&mgr->adev->gpu_reset_counter); - ctx->reset_counter_query = ctx->reset_counter; - ctx->vram_lost_counter =atomic_read (&mgr->adev->vram_lost_counter); - ctx->init_priority = priority; - ctx->override_priority =AMDGPU_CTX_PRIORITY_UNSET ; - ctx->stable_pstate =AMDGPU_CTX_STABLE_PSTATE_NONE ; - -return 0 ; -} -static int amdgpu_ctx_get_stable_pstate (struct amdgpu_ctx *ctx,u32 *stable_pstate) {
@@ -325,6 +299,38 @@ static int amdgpu_ctx_get_stable_pstate(struct amdgpu_ctx *ctx,return 0 ; } +static int amdgpu_ctx_init (struct amdgpu_ctx_mgr *mgr,int32_t priority, +struct drm_file *filp,struct amdgpu_ctx *ctx) +{ +u32 current_stable_pstate; +int r; + + r =amdgpu_ctx_priority_permit (filp, priority); +if (r) +return r; + +memset (ctx,0 ,sizeof (*ctx)); + +kref_init (&ctx->refcount); + ctx->mgr = mgr; +spin_lock_init (&ctx->ring_lock); +mutex_init (&ctx->lock); + + ctx->reset_counter =atomic_read (&mgr->adev->gpu_reset_counter); + ctx->reset_counter_query = ctx->reset_counter; + ctx->vram_lost_counter =atomic_read (&mgr->adev->vram_lost_counter); + ctx->init_priority = priority; + ctx->override_priority =AMDGPU_CTX_PRIORITY_UNSET ; + + r =amdgpu_ctx_get_stable_pstate (ctx, ¤t_stable_pstate); +if (r) +return r; + + ctx->stable_pstate = current_stable_pstate; + +return 0 ; +} +static int amdgpu_ctx_set_stable_pstate (struct amdgpu_ctx *ctx,u32 stable_pstate) {
@@ -396,7 +402,7 @@ static void amdgpu_ctx_fini(struct kref *ref) }if (drm_dev_enter (&adev->ddev, &idx)) { -amdgpu_ctx_set_stable_pstate (ctx,AMDGPU_CTX_STABLE_PSTATE_NONE ); +amdgpu_ctx_set_stable_pstate (ctx, ctx->stable_pstate);drm_dev_exit (idx); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 512/1157 bpf: fix potential 32-bit overflow when accessing ARRAY map element
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 87ac0d600943994444e24382a87aa19acc4cd3d4 ]
If BPF array map is bigger than 4GB, element pointer calculation can overflow because both index and elem_size are u32. Fix this everywhere by forcing 64-bit multiplication. Extract this formula into separate small helper and use it consistently in various places.
Speculative-preventing formula utilizing index_mask trick is left as is, but explicit u64 casts are added in both places.
--- kernel/bpf/arraymap.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
kernel/bpf/arraymap.c +12 -8
@@ -156,6 +156,11 @@ static struct bpf_map *array_map_alloc(union bpf_attr *attr)return &array->map; } +static void *array_map_elem_ptr (struct bpf_array * array,u32 index) +{ +return array->value + (u64 )array->elem_size * index; +} +/* Called from syscall or from eBPF program */ static void *array_map_lookup_elem (struct bpf_map *map,void *key) {
@@ -165,7 +170,7 @@ static void *array_map_lookup_elem(struct bpf_map *map, void *key)if (unlikely (index >= array->map.max_entries))return NULL ; -return array->value + array->elem_size * (index & array->index_mask); +return array->value + (u64 )array->elem_size * (index & array->index_mask); } static int array_map_direct_value_addr(const struct bpf_map *map, u64 *imm,
@@ -339,7 +344,7 @@ static int array_map_update_elem(struct bpf_map *map, void *key, void *value, value, map->value_size); }else { val = array->value + - array->elem_size * (index & array->index_mask); + (u64 )array->elem_size * (index & array->index_mask);if (map_flags &BPF_F_LOCK )copy_map_value_locked (map, val, value, false);else
@@ -408,8 +413,7 @@ static void array_map_free_timers(struct bpf_map *map)return ;for (i =0 ; i < array->map.max_entries; i++) -bpf_timer_cancel_and_free (array->value + array->elem_size * i + - map->timer_off); +bpf_timer_cancel_and_free (array_map_elem_ptr (array, i) + map->timer_off); }/* Called when map->refcnt goes to zero, either from workqueue or from syscall */
@@ -420,7 +424,7 @@ static void array_map_free(struct bpf_map *map)if (map_value_has_kptrs (map)) {for (i =0 ; i < array->map.max_entries; i++) -bpf_map_free_kptrs (map, array->value + array->elem_size * i); +bpf_map_free_kptrs (map,array_map_elem_ptr (array, i));bpf_map_free_kptr_off_tab (map); }
@@ -556,7 +560,7 @@ static void *bpf_array_map_seq_start(struct seq_file *seq, loff_t *pos) index = info->index & array->index_mask;if (info->percpu_value_buf)return array->pptrs[index]; -return array->value + array->elem_size * index; +return array_map_elem_ptr (array, index); }static void *bpf_array_map_seq_next (struct seq_file *seq,void *v,loff_t *pos)
@@ -575,7 +579,7 @@ static void *bpf_array_map_seq_next(struct seq_file *seq, void *v, loff_t *pos) index = info->index & array->index_mask;if (info->percpu_value_buf)return array->pptrs[index]; -return array->value + array->elem_size * index; +return array_map_elem_ptr (array, index); }static int __bpf_array_map_seq_show (struct seq_file *seq,void *v)
@@ -690,7 +694,7 @@ static int bpf_for_each_array_elem(struct bpf_map *map, bpf_callback_t callback_if (is_percpu) val =this_cpu_ptr (array->pptrs[i]);else - val = array->value + array->elem_size * i; + val =array_map_elem_ptr (array, i); num_elems++; key = i; ret = callback_fn((u64)(long)map, (u64)(long)&key,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 513/1157 libbpf: make RINGBUF map size adjustments more eagerly
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 597fbc4682969361dd141aaa58b8cc73a80da85d ]
Make libbpf adjust RINGBUF map size (rounding it up to closest power-of-2 of page_size) more eagerly: during open phase when initializing the map and on explicit calls to bpf_map__set_max_entries().
Such approach allows user to check actual size of BPF ringbuf even before it's created in the kernel, but also it prevents various edge case scenarios where BPF ringbuf size can get out of sync with what it would be in kernel. One of them (reported in [0]) is during an attempt to pin/reuse BPF ringbuf.
Move adjust_ringbuf_sz() helper closer to its first actual use. The implementation of the helper is unchanged.
Also make detection of whether bpf_object is already loaded more robust by checking obj->loaded explicitly, given that map->fd can be < 0 even if bpf_object is already loaded due to ability to disable map creation with bpf_map__set_autocreate(map, false).
[0] Closes: https://github.com/libbpf/libbpf/pull/530
--- tools/lib/bpf/libbpf.c | 77 +++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 35 deletions(-)
tools/lib/bpf/libbpf.c +42 -35
@@ -2398,6 +2398,37 @@ int parse_btf_map_def(const char *map_name, struct btf *btf,return 0 ; } +static size_t adjust_ringbuf_sz (size_t sz) +{ +__u32 page_sz =sysconf (_SC_PAGE_SIZE); +__u32 mul; + +/* if user forgot to set any size, make sure they see error */ +if (sz ==0 ) +return 0 ; +/* Kernel expects BPF_MAP_TYPE_RINGBUF's max_entries to be +* a power-of-2 multiple of kernel's page size. If user diligently +* satisified these conditions, pass the size through. +*/ +if ((sz % page_sz) ==0 &&is_pow_of_2 (sz / page_sz)) +return sz; + +/* Otherwise find closest (page_sz * power_of_2) product bigger than +* user-set size to satisfy both user size request and kernel +* requirements and substitute correct max_entries for map creation. +*/ +for (mul =1 ; mul <=UINT_MAX / page_sz; mul <<=1 ) { +if (mul * page_sz > sz) +return mul * page_sz; + } + +/* if it's impossible to satisfy the conditions (i.e., user size is +* very close to UINT_MAX but is not a power-of-2 multiple of +* page_size) then just return original size and let kernel reject it +*/ +return sz; +} +static void fill_map_from_def (struct bpf_map *map,const struct btf_map_def *def) { map->def.type = def->map_type;
@@ -2411,6 +2442,10 @@ static void fill_map_from_def(struct bpf_map *map, const struct btf_map_def *def map->btf_key_type_id = def->key_type_id; map->btf_value_type_id = def->value_type_id; +/* auto-adjust BPF ringbuf map max_entries to be a multiple of page size */ +if (map->def.type ==BPF_MAP_TYPE_RINGBUF ) + map->def.max_entries =adjust_ringbuf_sz (map->def.max_entries); +if (def->parts &MAP_DEF_MAP_TYPE )pr_debug ("map '%s': found type = %u.\n" , map->name, def->map_type);
@@ -4401,9 +4436,15 @@ struct bpf_map *bpf_map__inner_map(struct bpf_map *map)int bpf_map__set_max_entries (struct bpf_map *map,__u32 max_entries) { -if (map->fd >=0 ) +if (map->obj->loaded)return libbpf_err (-EBUSY ); + map->def.max_entries = max_entries; + +/* auto-adjust BPF ringbuf map max_entries to be a multiple of page size */ +if (map->def.type ==BPF_MAP_TYPE_RINGBUF ) + map->def.max_entries =adjust_ringbuf_sz (map->def.max_entries); +return 0 ; }
@@ -4948,37 +4989,6 @@ bpf_object__populate_internal_map(struct bpf_object *obj, struct bpf_map *map)static void bpf_map__destroy (struct bpf_map *map); -static size_t adjust_ringbuf_sz (size_t sz) -{ -__u32 page_sz =sysconf (_SC_PAGE_SIZE); -__u32 mul; - -/* if user forgot to set any size, make sure they see error */ -if (sz ==0 ) -return 0 ; -/* Kernel expects BPF_MAP_TYPE_RINGBUF's max_entries to be -* a power-of-2 multiple of kernel's page size. If user diligently -* satisified these conditions, pass the size through. -*/ -if ((sz % page_sz) ==0 &&is_pow_of_2 (sz / page_sz)) -return sz; - -/* Otherwise find closest (page_sz * power_of_2) product bigger than -* user-set size to satisfy both user size request and kernel -* requirements and substitute correct max_entries for map creation. -*/ -for (mul =1 ; mul <=UINT_MAX / page_sz; mul <<=1 ) { -if (mul * page_sz > sz) -return mul * page_sz; - } - -/* if it's impossible to satisfy the conditions (i.e., user size is -* very close to UINT_MAX but is not a power-of-2 multiple of -* page_size) then just return original size and let kernel reject it -*/ -return sz; -} -static int bpf_object__create_map (struct bpf_object *obj,struct bpf_map *map,bool is_inner) {LIBBPF_OPTS (bpf_map_create_opts, create_attr);
@@ -5017,9 +5027,6 @@ static int bpf_object__create_map(struct bpf_object *obj, struct bpf_map *map, b }switch (def->type) { -case BPF_MAP_TYPE_RINGBUF : - map->def.max_entries =adjust_ringbuf_sz (map->def.max_entries); -/* fallthrough */ case BPF_MAP_TYPE_PERF_EVENT_ARRAY :case BPF_MAP_TYPE_CGROUP_ARRAY :case BPF_MAP_TYPE_STACK_TRACE :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 514/1157 selftests/bpf: fix a test for snprintf() overflow
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit c5d22f4cfe8dfb93f1db0a1e7e2e7ebc41395d98 ]
The snprintf() function returns the number of bytes which *would* have been copied if there were space. In other words, it can be
Quoted 1 line
sizeof(pin_path).
--- tools/testing/selftests/bpf/prog_tests/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/prog_tests/btf.c +1 -1
@@ -5324,7 +5324,7 @@ static void do_test_pprint(int test_num) ret =snprintf (pin_path,sizeof (pin_path),"%s/%s" ,"/sys/fs/bpf" , test->map_name); -if (CHECK (ret ==sizeof (pin_path),"pin_path %s/%s is too long" , +if (CHECK (ret >=sizeof (pin_path),"pin_path %s/%s is too long" ,"/sys/fs/bpf" , test->map_name)) { err =-1 ; goto done;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 515/1157 libbpf: fix an snprintf() overflow check
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b77ffb30cfc5f58e957571d8541c6a7e3da19221 ]
The snprintf() function returns the number of bytes it *would* have copied if there were enough space. So it can return > the sizeof(gen->attach_target).
--- tools/lib/bpf/gen_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/gen_loader.c +1 -1
@@ -533,7 +533,7 @@ void bpf_gen__record_attach_target(struct bpf_gen *gen, const char *attach_name, gen->attach_kind = kind; ret =snprintf (gen->attach_target,sizeof (gen->attach_target),"%s%s" , prefix, attach_name); -if (ret ==sizeof (gen->attach_target)) +if (ret >=sizeof (gen->attach_target)) gen->error = -ENOSPC ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 516/1157 can: pch_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 3a5c7e4611ddcf0ef37a3a17296b964d986161a6 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/pch_can.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/can/pch_can.c +3 -3
@@ -496,6 +496,9 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->can_id |=CAN_ERR_BUSOFF ; priv->can.can_stats.bus_off++;can_bus_off (ndev); + }else { + cf->data[6 ] = errc &PCH_TEC ; + cf->data[7 ] = (errc &PCH_REC ) >>8 ; } errc =ioread32 (&priv->regs->errc);
@@ -556,9 +559,6 @@ static void pch_can_error(struct net_device *ndev, u32 status)break ; } - cf->data[6 ] = errc &PCH_TEC ; - cf->data[7 ] = (errc &PCH_REC ) >>8 ; - priv->can.state = state;netif_receive_skb (skb); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 517/1157 can: rcar_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a37b7245e831a641df360ca41db6a71c023d3746 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/rcar/rcar_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/can/rcar/rcar_can.c +4 -4
@@ -232,11 +232,8 @@ static void rcar_can_error(struct net_device *ndev)if (eifr & (RCAR_CAN_EIFR_EWIF |RCAR_CAN_EIFR_EPIF )) { txerr =readb (&priv->regs->tecr); rxerr =readb (&priv->regs->recr); -if (skb) { +if (skb) cf->can_id |=CAN_ERR_CRTL ; - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; - } }if (eifr &RCAR_CAN_EIFR_BEIF ) {int rx_errors =0 , tx_errors =0 ;
@@ -336,6 +333,9 @@ static void rcar_can_error(struct net_device *ndev)can_bus_off (ndev);if (skb) cf->can_id |=CAN_ERR_BUSOFF ; + }else if (skb) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; }if (eifr &RCAR_CAN_EIFR_ORIF ) {netdev_dbg (priv->ndev,"Receive overrun error interrupt\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 518/1157 can: sja1000: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 164d7cb2d5a30f1b3a5ab4fab1a27731fb1494a8 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/sja1000/sja1000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/can/sja1000/sja1000.c +4 -3
@@ -402,9 +402,6 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) txerr = priv->read_reg (priv,SJA1000_TXERR ); rxerr = priv->read_reg (priv,SJA1000_RXERR ); - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; -if (isrc &IRQ_DOI ) {/* data overrun interrupt */ netdev_dbg (dev,"data overrun interrupt\n" );
@@ -426,6 +423,10 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)else state =CAN_STATE_ERROR_ACTIVE ; } +if (state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + }if (isrc &IRQ_BEI ) {/* bus error interrupt */ priv->can.can_stats.bus_error++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 519/1157 can: hi311x: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a22bd630cfff496b270211745536e50e98eb3a45 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/spi/hi311x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/can/spi/hi311x.c +3 -2
@@ -667,8 +667,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) txerr =hi3110_read (spi,HI3110_READ_TEC ); rxerr =hi3110_read (spi,HI3110_READ_REC ); - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; tx_state = txerr >= rxerr ? new_state :0 ; rx_state = txerr <= rxerr ? new_state :0 ;can_change_state (net, cf, tx_state, rx_state);
@@ -681,6 +679,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id)hi3110_hw_sleep (spi);break ; } + }else { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 520/1157 can: sun4i_can: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 0ac15a8f661b941519379831d09bfb12271b23ee ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/sun4i_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/can/sun4i_can.c +4 -5
@@ -535,11 +535,6 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) rxerr = (errc >>16 ) &0xFF ; txerr = errc &0xFF ; -if (skb) { - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; - } -if (isrc &SUN4I_INT_DATA_OR ) {/* data overrun interrupt */ netdev_dbg (dev,"data overrun interrupt\n" );
@@ -570,6 +565,10 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)else state =CAN_STATE_ERROR_ACTIVE ; } +if (skb && state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + }if (isrc &SUN4I_INT_BUS_ERR ) {/* bus error interrupt */ netdev_dbg (dev,"bus error interrupt\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 521/1157 can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 936e90595376e64b6247c72d3ea8b8b164b7ac96 ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +8 -4
@@ -917,8 +917,10 @@ static void kvaser_usb_hydra_update_state(struct kvaser_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; - cf->data[6 ] = bec->txerr; - cf->data[7 ] = bec->rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = bec->txerr; + cf->data[7 ] = bec->rxerr; + }netif_rx (skb); }
@@ -1069,8 +1071,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_priv *priv, shhwtstamps->hwtstamp = hwtstamp; cf->can_id |=CAN_ERR_BUSERROR ; - cf->data[6 ] = bec.txerr; - cf->data[7 ] = bec.rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = bec.txerr; + cf->data[7 ] = bec.rxerr; + }netif_rx (skb);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 522/1157 can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit a57732084e06791d37ea1ea447cca46220737abd ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +4 -2
@@ -853,8 +853,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvaser_usb *dev,break ; } - cf->data[6 ] = es->txerr; - cf->data[7 ] = es->rxerr; +if (new_state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = es->txerr; + cf->data[7 ] = es->rxerr; + }netif_rx (skb); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 523/1157 can: usb_8dev: do not report txerr and rxerr during bus-off
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit aebe8a2433cd090ccdc222861f44bddb75eb01de ]
During bus off, the error count is greater than 255 and can not fit in a u8.
--- drivers/net/can/usb/usb_8dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/can/usb/usb_8dev.c +4 -3
@@ -438,9 +438,10 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv,if (rx_errors) stats->rx_errors++; - - cf->data[6 ] = txerr; - cf->data[7 ] = rxerr; +if (priv->can.state !=CAN_STATE_BUS_OFF ) { + cf->data[6 ] = txerr; + cf->data[7 ] = rxerr; + } priv->bec.txerr = txerr; priv->bec.rxerr = rxerr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 524/1157 can: error: specify the values of data[5..7] of CAN error frames
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit e70a3263a7eed768d5f947b8f2aff8d2a79c9d97 ]
Currently, data[5..7] of struct can_frame, when used as a CAN error frame, are defined as being "controller specific". Device specific behaviours are problematic because it prevents someone from writing code which is portable between devices.
As a matter of fact, data[5] is never used, data[6] is always used to report TX error counter and data[7] is always used to report RX error counter. can-utils also relies on this.
This patch updates the comment in the uapi header to specify that data[5] is reserved (and thus should not be used) and that data[6..7] are used for error counters.
--- include/uapi/linux/can/error.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/uapi/linux/can/error.h +4 -1
@@ -120,6 +120,9 @@#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70/* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80/* 1000 0000 */ -/* controller specific additional information / data[5..7] */ +/* data[5] is reserved (do not use) */ + +/* TX error counter / data[6] */ +/* RX error counter / data[7] */ #endif /* _UAPI_CAN_ERROR_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 525/1157 libbpf: Fix str_has_sfx()s return value
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 14229b8153a3ca51d97a22a18c68deeae64afce0 ]
The return from strcmp() is inverted so it wrongly returns true instead of false and vice versa.
--- tools/lib/bpf/libbpf_internal.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lib/bpf/libbpf_internal.h +3 -3
@@ -109,9 +109,9 @@ static inline bool str_has_sfx(const char *str, const char *sfx)size_t str_len =strlen (str);size_t sfx_len =strlen (sfx); -if (sfx_len <= str_len) -return strcmp (str + str_len - sfx_len, sfx); -return false; +if (sfx_len > str_len) +return false; +return strcmp (str + str_len - sfx_len, sfx) ==0 ; }/* Symbol versioning is different between static and shared library.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 526/1157 can: pch_can: pch_can_error(): initialize errc before using it
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 9950f11211331180269867aef848c7cf56861742 ]
After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=2 warning:
| In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitialized [-Wmaybe-uninitialized] | 501 | cf->data[6] = errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~
Moving errc initialization up solves this issue.
--- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/pch_can.c +1 -1
@@ -489,6 +489,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)if (!skb)return ; + errc =ioread32 (&priv->regs->errc);if (status &PCH_BUS_OFF ) {pch_can_set_tx_all (priv,0 );pch_can_set_rx_all (priv,0 );
@@ -501,7 +502,6 @@ static void pch_can_error(struct net_device *ndev, u32 status) cf->data[7 ] = (errc &PCH_REC ) >>8 ; } - errc =ioread32 (&priv->regs->errc);/* Warning interrupt. */ if (status &PCH_EWARN ) { state =CAN_STATE_ERROR_WARNING ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 527/1157 Bluetooth: hci_intel: Add check for platform_driver_register
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit ab2d2a982ff721f4b029282d9a40602ea46a745e ]
As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency.
--- drivers/bluetooth/hci_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_intel.c +5 -1
@@ -1217,7 +1217,11 @@ static struct platform_driver intel_driver = {int __init intel_init (void ) { -platform_driver_register (&intel_driver); +int err; + + err =platform_driver_register (&intel_driver); +if (err) +return err;return hci_uart_register_proto (&intel_proto); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 528/1157 Bluetooth: When HCI work queue is drained, only queue chained work
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit 877afadad2dce8aae1f2aad8ce47e072d4f6165e ]
The HCI command, event, and data packet processing workqueue is drained to avoid deadlock in commit76727c02c1e1 ("Bluetooth: Call drain_workqueue() before resetting state").
There is another delayed work, which will queue command to this drained workqueue. Which results in the following error report:
Bluetooth: hci2: command 0x040f tx timeout
WARNING: CPU: 1 PID: 18374 at kernel/workqueue.c:1438 __queue_work+0xdad/0x1140 Workqueue: events hci_cmd_timeout RIP: 0010:__queue_work+0xdad/0x1140 RSP: 0000:ffffc90002cffc60 EFLAGS: 00010093 RAX: 0000000000000000 RBX: ffff8880b9d3ec00 RCX: 0000000000000000 RDX: ffff888024ba0000 RSI: ffffffff814e048d RDI: ffff8880b9d3ec08 RBP: 0000000000000008 R08: 0000000000000000 R09: 00000000b9d39700 R10: ffffffff814f73c6 R11: 0000000000000000 R12: ffff88807cce4c60 R13: 0000000000000000 R14: ffff8880796d8800 R15: ffff8880796d8800 FS: 0000000000000000(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000c0174b4000 CR3: 000000007cae9000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ? queue_work_on+0xcb/0x110 ? lockdep_hardirqs_off+0x90/0xd0 queue_work_on+0xee/0x110 process_one_work+0x996/0x1610 ? pwq_dec_nr_in_flight+0x2a0/0x2a0 ? rwlock_bug.part.0+0x90/0x90 ? _raw_spin_lock_irq+0x41/0x50 worker_thread+0x665/0x1080 ? process_one_work+0x1610/0x1610 kthread+0x2e9/0x3a0 ? kthread_complete_and_exit+0x40/0x40 ret_from_fork+0x1f/0x30 </TASK>
To fix this, we can add a new HCI_DRAIN_WQ flag, and don't queue the timeout workqueue while command workqueue is draining.
--- include/net/bluetooth/hci.h | 1 + net/bluetooth/hci_core.c | 10 +++++++++- net/bluetooth/hci_event.c | 5 +++-- 3 files changed, 13 insertions(+), 3 deletions(-)
include/net/bluetooth/hci.h +1 -0
@@ -361,6 +361,7 @@ enum {HCI_QUALITY_REPORT ,HCI_OFFLOAD_CODECS_ENABLED ,HCI_LE_SIMULTANEOUS_ROLES , +HCI_CMD_DRAIN_WORKQUEUE , __HCI_NUM_FLAGS, };
net/bluetooth/hci_core.c +9 -1
@@ -594,6 +594,11 @@ static int hci_dev_do_reset(struct hci_dev *hdev)skb_queue_purge (&hdev->rx_q);skb_queue_purge (&hdev->cmd_q); +/* Cancel these to avoid queueing non-chained pending work */ +hci_dev_set_flag (hdev,HCI_CMD_DRAIN_WORKQUEUE ); +cancel_delayed_work (&hdev->cmd_timer); +cancel_delayed_work (&hdev->ncmd_timer); +/* Avoid potential lockdep warnings from the *_flush() calls by * ensuring the workqueue is empty up front. */
@@ -607,6 +612,8 @@ static int hci_dev_do_reset(struct hci_dev *hdev)if (hdev->flush) hdev->flush (hdev); +hci_dev_clear_flag (hdev,HCI_CMD_DRAIN_WORKQUEUE ); +atomic_set (&hdev->cmd_cnt,1 ); hdev->acl_cnt =0 ; hdev->sco_cnt =0 ; hdev->le_cnt =0 ;
@@ -3864,7 +3871,8 @@ static void hci_cmd_work(struct work_struct *work)if (res <0 )__hci_cmd_sync_cancel (hdev, -res); -if (test_bit (HCI_RESET , &hdev->flags)) +if (test_bit (HCI_RESET , &hdev->flags) || +hci_dev_test_flag (hdev,HCI_CMD_DRAIN_WORKQUEUE ))cancel_delayed_work (&hdev->cmd_timer);else schedule_delayed_work(&hdev->cmd_timer,
net/bluetooth/hci_event.c +3 -2
@@ -3768,8 +3768,9 @@ static inline void handle_cmd_cnt_and_timer(struct hci_dev *hdev, u8 ncmd)cancel_delayed_work (&hdev->ncmd_timer);atomic_set (&hdev->cmd_cnt,1 ); }else { -schedule_delayed_work (&hdev->ncmd_timer, -HCI_NCMD_TIMEOUT ); +if (!hci_dev_test_flag (hdev,HCI_CMD_DRAIN_WORKQUEUE )) +schedule_delayed_work (&hdev->ncmd_timer, +HCI_NCMD_TIMEOUT ); } } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 529/1157 Bluetooth: mgmt: Fix refresh cached connection info
In reply to Greg Kroah-HartmanFrom: Zhengping Jiang <[email protected]>
[ Upstream commit d7b2fdfb53ea09382941c0a4950dc9b00d51d1c7 ]
Set the connection data before calling get_conn_info_sync, so it can be verified the connection is still connected, before refreshing cached values.
--- net/bluetooth/mgmt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/bluetooth/mgmt.c +5 -5
@@ -6820,11 +6820,14 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data, cmd =mgmt_pending_new (sk,MGMT_OP_GET_CONN_INFO , hdev, data, len); -if (!cmd) +if (!cmd) { err = -ENOMEM ; -else + }else { +hci_conn_hold (conn); + cmd->user_data =hci_conn_get (conn); err =hci_cmd_sync_queue (hdev, get_conn_info_sync, cmd, get_conn_info_complete); + }if (err <0 ) { mgmt_cmd_complete(sk, hdev->id, MGMT_OP_GET_CONN_INFO,
@@ -6836,9 +6839,6 @@ static int get_conn_info(struct sock *sk, struct hci_dev *hdev, void *data, goto unlock; } -hci_conn_hold (conn); - cmd->user_data =hci_conn_get (conn); - conn->conn_info_timestamp = jiffies; }else {/* Cache is valid, just reply with values cached in hci_conn */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 530/1157 Bluetooth: hci_sync: Fix resuming scan after suspend resume
In reply to Greg Kroah-HartmanFrom: Zhengping Jiang <[email protected]>
[ Upstream commit 68253f3cd715e819bc4bff2b0e6b21234e259d56 ]
After resuming, remove setting scanning_paused to false, because it is checked and set to false in hci_resume_scan_sync. Also move setting the value to false before updating passive scan, because the value is used when resuming passive scan.
unfiltered passive scan)
--- net/bluetooth/hci_sync.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
net/bluetooth/hci_sync.c +2 -3
@@ -5039,13 +5039,13 @@ static int hci_resume_scan_sync(struct hci_dev *hdev)if (!hdev->scanning_paused)return 0 ; + hdev->scanning_paused = false; +hci_update_scan_sync (hdev);/* Reset passive scanning to normal */ hci_update_passive_scan_sync (hdev); - hdev->scanning_paused = false; -return 0 ; }
@@ -5064,7 +5064,6 @@ int hci_resume_sync(struct hci_dev *hdev)return 0 ; hdev->suspended = false; - hdev->scanning_paused = false;/* Restore event mask */ hci_set_event_mask_sync (hdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 531/1157 Bluetooth: hci_sync: Fix not updating privacy_mode
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 0900b1c62f43e495d04ca4bebdf80b34f3c12432 ]
When programming a new entry into the resolving list it shall default to network mode since the params may contain the mode programmed when the device was last added to the resolving list.
--- net/bluetooth/hci_sync.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_sync.c +3 -0
@@ -1612,6 +1612,9 @@ static int hci_le_add_resolve_list_sync(struct hci_dev *hdev,bacpy (&cp.bdaddr, ¶ms->addr);memcpy (cp.peer_irk, irk->val,16 ); +/* Default privacy mode is always Network */ + params->privacy_mode =HCI_NETWORK_PRIVACY ; + done:if (hci_dev_test_flag (hdev,HCI_PRIVACY ))memcpy (cp.local_irk, hdev->irk,16 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 532/1157 Bluetooth: Add default wakeup callback for HCI UART driver
In reply to Greg Kroah-HartmanFrom: Ying Hsu <[email protected]>
[ Upstream commit bee5395ced44c5a312348557eb2dfb0c2a7bfaa2 ]
Bluetooth HCI devices indicate if they are able to wakeup in the wakeup callback since 'commit 4539ca67fe8e ("Bluetooth: Rename driver .prevent_wake to .wakeup")'. This patch adds a default wakeup callback for Bluetooth HCI UAR devices. It assumes Bluetooth HCI UART devices are wakeable for backward compatibility. For those who need a customized behavior, one can override it before calling hci_uart_register_device().
--- drivers/bluetooth/hci_serdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/bluetooth/hci_serdev.c +11 -0
@@ -231,6 +231,15 @@ static int hci_uart_setup(struct hci_dev *hdev)return 0 ; } +/* Check if the device is wakeable */ +static bool hci_uart_wakeup (struct hci_dev *hdev) +{ +/* HCI UART devices are assumed to be wakeable by default. +* Implement wakeup callback to override this behavior. +*/ +return true; +} +/** hci_uart_write_wakeup - transmit buffer wakeup * @serdev: serial device *
@@ -342,6 +351,8 @@ int hci_uart_register_device(struct hci_uart *hu, hdev->flush = hci_uart_flush; hdev->send = hci_uart_send_frame; hdev->setup = hci_uart_setup; +if (!hdev->wakeup) + hdev->wakeup = hci_uart_wakeup;SET_HCIDEV_DEV (hdev, &hu->serdev->dev);if (test_bit (HCI_UART_NO_SUSPEND_NOTIFIER , &hu->flags))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 533/1157 i2c: cadence: Support PEC for SMBus block read
In reply to Greg Kroah-HartmanFrom: Lars-Peter Clausen <[email protected]>
[ Upstream commit 9fdf6d97f03035ad5298e2d1635036c74c2090ed ]
SMBus packet error checking (PEC) is implemented by appending one additional byte of checksum data at the end of the message. This provides additional protection and allows to detect data corruption on the I2C bus.
SMBus block reads support variable length reads. The first byte in the read message is the number of available data bytes.
The combination of PEC and block read is currently not supported by the Cadence I2C driver.
* When PEC is enabled the maximum transfer length for block reads increases from 33 to 34 bytes.
* The I2C core smbus emulation layer relies on the driver updating the i2c_msg len field with the number of received bytes. The updated length is used when checking the PEC.
Add support to the Cadence I2C driver for handling SMBus block reads with PEC. To determine the maximum transfer length uses the initial len value of the i2c_msg. When PEC is enabled this will be 2, when it is disabled it will be 1.
Once a read transfer is done also increment the len field by the amount of received data bytes.
This change has been tested with a UCM90320 PMBus power monitor, which requires block reads to access certain data fields, but also has PEC enabled by default.
--- drivers/i2c/busses/i2c-cadence.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-cadence.c +9 -1
@@ -573,8 +573,13 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ctrl_reg =cdns_i2c_readreg (CDNS_I2C_CR_OFFSET ); ctrl_reg |=CDNS_I2C_CR_RW |CDNS_I2C_CR_CLR_FIFO ; +/* +* Receive up to I2C_SMBUS_BLOCK_MAX data bytes, plus one message length +* byte, plus one checksum byte if PEC is enabled. p_msg->len will be 2 if +* PEC is enabled, otherwise 1. +*/ if (id->p_msg->flags &I2C_M_RECV_LEN ) - id->recv_count =I2C_SMBUS_BLOCK_MAX +1 ; + id->recv_count =I2C_SMBUS_BLOCK_MAX + id->p_msg->len; id->curr_recv_count = id->recv_count;
@@ -789,6 +794,9 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg,if (id->err_status &CDNS_I2C_IXR_ARB_LOST )return -EAGAIN ; +if (msg->flags &I2C_M_RECV_LEN ) + msg->len += min_t(unsigned int, msg->buf[0], I2C_SMBUS_BLOCK_MAX); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 534/1157 i2c: qcom-geni: Use the correct return value
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit b3f0ceb7c2037c6e3affd7d9c84ac5f97af7a5b5 ]
The introduction of GPI support moved things around and instead of returning the result from geni_i2c_xfer() the number of messages in the request was returned, ignoring the actual result. Fix this.
--- drivers/i2c/busses/i2c-qcom-geni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +1 -1
@@ -688,7 +688,7 @@ static int geni_i2c_xfer(struct i2c_adapter *adap,pm_runtime_put_autosuspend (gi2c->se.dev); gi2c->cur =NULL ; gi2c->err =0 ; -return num; +return ret; }static u32 geni_i2c_func (struct i2c_adapter *adap)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 535/1157 btrfs: update stripe_sectors::uptodate in steal_rbio
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
[ Upstream commit 4d10046613333508d31fe926c545c8c0b620508a ]
[BUG]
With added debugging, it turns out the following write sequence would cause extra read which is unnecessary:
# xfs_io -f -s -c "pwrite -b 32k 0 32k" -c "pwrite -b 32k 32k 32k" \ -c "pwrite -b 32k 64k 32k" -c "pwrite -b 32k 96k 32k" \ $mnt/file
The debug message looks like this (btrfs header skipped):
partial rmw, full stripe=389152768 opf=0x0 devid=3 type=1 offset=32768 physical=323059712 len=32768 partial rmw, full stripe=389152768 opf=0x0 devid=1 type=2 offset=0 physical=67174400 len=65536 full stripe rmw, full stripe=389152768 opf=0x1 devid=3 type=1 offset=0 physical=323026944 len=32768 full stripe rmw, full stripe=389152768 opf=0x1 devid=2 type=-1 offset=0 physical=323026944 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=1 type=1 offset=32768 physical=22052864 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=2 type=2 offset=0 physical=277872640 len=65536 full stripe rmw, full stripe=298844160 opf=0x1 devid=1 type=1 offset=0 physical=22020096 len=32768 full stripe rmw, full stripe=298844160 opf=0x1 devid=3 type=-1 offset=0 physical=277872640 len=32768 partial rmw, full stripe=389152768 opf=0x0 devid=3 type=1 offset=0 physical=323026944 len=32768 partial rmw, full stripe=389152768 opf=0x0 devid=1 type=2 offset=0 physical=67174400 len=65536 ^^^^
Still partial read, even 389152768 is already cached by the first.
write.
full stripe rmw, full stripe=389152768 opf=0x1 devid=3 type=1 offset=32768 physical=323059712 len=32768 full stripe rmw, full stripe=389152768 opf=0x1 devid=2 type=-1 offset=32768 physical=323059712 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=1 type=1 offset=0 physical=22020096 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=2 type=2 offset=0 physical=277872640 len=65536 ^^^^
Still partial read for 298844160.
full stripe rmw, full stripe=298844160 opf=0x1 devid=1 type=1 offset=32768 physical=22052864 len=32768 full stripe rmw, full stripe=298844160 opf=0x1 devid=3 type=-1 offset=32768 physical=277905408 len=32768
This means every 32K writes, even they are in the same full stripe, still trigger read for previously cached data.
This would cause extra RAID56 IO, making the btrfs raid56 cache useless.
[CAUSE]
Commit d4e28d9b5f04 ("btrfs: raid56: make steal_rbio() subpage compatible") tries to make steal_rbio() subpage compatible, but during that conversion, there is one thing missing.
We no longer rely on PageUptodate(rbio->stripe_pages[i]), but rbio->stripe_nsectors[i].uptodate to determine if a sector is uptodate.
This means, previously if we switch the pointer, everything is done, as the PageUptodate flag is still bound to that page.
But now we have to manually mark the involved sectors uptodate, or later raid56_rmw_stripe() will find the stolen sector is not uptodate, and assemble the read bio for it, wasting IO.
[FIX]
We can easily fix the bug, by also update the
rbio->stripe_sectors[].uptodate in steal_rbio().
With this fixed, now the same write pattern no longer leads to the same unnecessary read:
partial rmw, full stripe=389152768 opf=0x0 devid=3 type=1 offset=32768 physical=323059712 len=32768 partial rmw, full stripe=389152768 opf=0x0 devid=1 type=2 offset=0 physical=67174400 len=65536 full stripe rmw, full stripe=389152768 opf=0x1 devid=3 type=1 offset=0 physical=323026944 len=32768 full stripe rmw, full stripe=389152768 opf=0x1 devid=2 type=-1 offset=0 physical=323026944 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=1 type=1 offset=32768 physical=22052864 len=32768 partial rmw, full stripe=298844160 opf=0x0 devid=2 type=2 offset=0 physical=277872640 len=65536 full stripe rmw, full stripe=298844160 opf=0x1 devid=1 type=1 offset=0 physical=22020096 len=32768 full stripe rmw, full stripe=298844160 opf=0x1 devid=3 type=-1 offset=0 physical=277872640 len=32768 ^^^ No more partial read, directly into the write path.
full stripe rmw, full stripe=389152768 opf=0x1 devid=3 type=1 offset=32768 physical=323059712 len=32768 full stripe rmw, full stripe=389152768 opf=0x1 devid=2 type=-1 offset=32768 physical=323059712 len=32768 full stripe rmw, full stripe=298844160 opf=0x1 devid=1 type=1 offset=32768 physical=22052864 len=32768 full stripe rmw, full stripe=298844160 opf=0x1 devid=3 type=-1 offset=32768 physical=277905408 len=32768
--- fs/btrfs/raid56.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
fs/btrfs/raid56.c +19 -7
@@ -347,6 +347,24 @@ static void index_stripe_sectors(struct btrfs_raid_bio *rbio) } } +static void steal_rbio_page (struct btrfs_raid_bio *src, +struct btrfs_raid_bio *dest,int page_nr) +{ +const u32 sectorsize = src->bioc->fs_info->sectorsize; +const u32 sectors_per_page =PAGE_SIZE / sectorsize; +int i; + +if (dest->stripe_pages[page_nr]) +__free_page (dest->stripe_pages[page_nr]); + dest->stripe_pages[page_nr] = src->stripe_pages[page_nr]; + src->stripe_pages[page_nr] =NULL ; + +/* Also update the sector->uptodate bits. */ +for (i = sectors_per_page * page_nr; + i < sectors_per_page * page_nr + sectors_per_page; i++) + dest->stripe_sectors[i].uptodate = true; +} +/* * Stealing an rbio means taking all the uptodate pages from the stripe array * in the source rbio and putting them into the destination rbio.
@@ -358,7 +376,6 @@ static void steal_rbio(struct btrfs_raid_bio *src, struct btrfs_raid_bio *dest) {int i;struct page *s; -struct page *d;if (!test_bit (RBIO_CACHE_READY_BIT , &src->flags))return ;
@@ -368,12 +385,7 @@ static void steal_rbio(struct btrfs_raid_bio *src, struct btrfs_raid_bio *dest)if (!s || !full_page_sectors_uptodate (src, i))continue ; - d = dest->stripe_pages[i]; -if (d) -__free_page (d); - - dest->stripe_pages[i] = s; - src->stripe_pages[i] =NULL ; +steal_rbio_page (src, dest, i); }index_stripe_sectors (dest);index_stripe_sectors (src);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 536/1157 ip_tunnels: Add new flow flags field to ip_tunnel_key
In reply to Greg Kroah-HartmanFrom: Paul Chaignon <[email protected]>
[ Upstream commit 451ef36bd229f8aa329cb2258a859b4c636d08ef ]
This commit extends the ip_tunnel_key struct with a new field for the flow flags, to pass them to the route lookups. This new field will be populated and used in subsequent commits.
--- include/net/ip_tunnels.h | 1 + 1 file changed, 1 insertion(+)
include/net/ip_tunnels.h +1 -0
@@ -54,6 +54,7 @@ struct ip_tunnel_key {__be32 label;/* Flow Label for IPv6 */ __be16 tp_src;__be16 tp_dst; +__u8 flow_flags; };/* Flags for ip_tunnel_info mode. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 537/1157 bpf: Set flow flag to allow any source IP in bpf_tunnel_key
In reply to Greg Kroah-HartmanFrom: Paul Chaignon <[email protected]>
[ Upstream commit b8fff748521c7178b9a7d32b5a34a81cec8396f3 ]
Commit 26101f5ab6bd ("bpf: Add source ip in "struct bpf_tunnel_key"") added support for getting and setting the outer source IP of encapsulated packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change allows BPF programs to set any IP address as the source, including for example the IP address of a container running on the same host.
In that last case, however, the encapsulated packets are dropped when looking up the route because the source IP address isn't assigned to any interface on the host. To avoid this, we need to set the FLOWI_FLAG_ANYSRC flag.
--- net/core/filter.c | 1 + 1 file changed, 1 insertion(+)
net/core/filter.c +1 -0
@@ -4653,6 +4653,7 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb, }else { info->key.u.ipv4.dst =cpu_to_be32 (from->remote_ipv4); info->key.u.ipv4.src =cpu_to_be32 (from->local_ipv4); + info->key.flow_flags =FLOWI_FLAG_ANYSRC ; }return 0 ;
Signature · 1 line
2.35.1
Re: [PATCH 5.19 0537/1157] bpf: Set flow flag to allow any source IP in bpf_tunnel_key
Quoted 10 lines · Greg Kroah-Hartman
From: Paul Chaignon <[email protected]>
[ Upstream commit
b8fff748521c7178b9a7d32b5a34a81cec8396f3]Commit
26101f5ab6bd("bpf: Add source ip in "structbpf_tunnel_key"") added support for getting and setting the outer source IP of encapsulated packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change allows BPF programs to set any IP address as the source, including for example the IP address of a container running on the same host.
Quoted 4 lines
In that last case, however, the encapsulated packets are dropped when looking up the route because the source IP address isn't assigned to any interface on the host. To avoid this, we need to set the
FLOWI_FLAG_ANYSRCflag.
This fix will also require upstream commits 861396ac0b47 ("geneve: Use ip_tunnel_key flow flags in route lookups") and 7e2fb8bc7ef6 ("vxlan:
Use ip_tunnel_key flow flags in route lookups") to have the intended effect. In short, these two commits "consume" the new field introduced in 451ef36bd229 ("ip_tunnels: Add new flow flags field to ip_tunnel_key") and populated in the present commit.
Quoted 29 lines
Fixes 26101f5ab6bd ("bpf: Add source ip in "struct bpf_tunnel_key"")Signed-off-by Paul Chaignon <[email protected]>Signed-off-by Daniel Borkmann <[email protected]>Reviewed-by Nikolay Aleksandrov <[email protected]>Acked-by Martin KaFai Lau <[email protected]>Link https://lore.kernel.org/bpf/76873d384e21288abe5767551a0799ac93ec07fb.1658759380.git.paul@isovalent.com open hereSigned-off-by Sasha Levin <[email protected]>--- net/core/filter.c | 1 + 1 file changed, 1 insertion(+)net/core/filter.c +1
-0@@ -4653,6 +4653,7 @@ BPF_CALL_4(bpf_skb_set_tunnel_key, struct sk_buff *, skb, }else { info->key.u.ipv4.dst =cpu_to_be32 (from->remote_ipv4); info->key.u.ipv4.src =cpu_to_be32 (from->local_ipv4); + info->key.flow_flags =FLOWI_FLAG_ANYSRC ; }return 0 ;Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerRe: [PATCH 5.19 0537/1157] bpf: Set flow flag to allow any source IP in bpf_tunnel_key
Quoted 16 lines · Paul Chaignon
Quoted 10 lines · Greg Kroah-Hartman
From: Paul Chaignon <[email protected]>
[ Upstream commit
b8fff748521c7178b9a7d32b5a34a81cec8396f3]Commit
26101f5ab6bd("bpf: Add source ip in "structbpf_tunnel_key"") added support for getting and setting the outer source IP of encapsulated packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change allows BPF programs to set any IP address as the source, including for example the IP address of a container running on the same host.Quoted 4 lines
In that last case, however, the encapsulated packets are dropped when looking up the route because the source IP address isn't assigned to any interface on the host. To avoid this, we need to set the
FLOWI_FLAG_ANYSRCflag.
Quoted 6 lines
This fix will also require upstream commits
861396ac0b47("geneve: Useip_tunnel_keyflow flags in route lookups") and7e2fb8bc7ef6("vxlan:
Useip_tunnel_keyflow flags in route lookups") to have the intended effect. In short, these two commits "consume" the new field introduced in451ef36bd229("ip_tunnels: Add new flow flags field toip_tunnel_key") and populated in the present commit.
Ick. Is it better to just drop this commit instead? Or is it ok to also backport those 2 patches to 5.19.y?
thanks,
greg k-h
Re: [PATCH 5.19 0537/1157] bpf: Set flow flag to allow any source IP in bpf_tunnel_key
Quoted 24 lines · Greg Kroah-Hartman
Quoted 16 lines · Paul Chaignon
Quoted 10 lines · Greg Kroah-Hartman
From: Paul Chaignon <[email protected]>
[ Upstream commit
b8fff748521c7178b9a7d32b5a34a81cec8396f3]Commit
26101f5ab6bd("bpf: Add source ip in "structbpf_tunnel_key"") added support for getting and setting the outer source IP of encapsulated packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change allows BPF programs to set any IP address as the source, including for example the IP address of a container running on the same host.Quoted 4 lines
In that last case, however, the encapsulated packets are dropped when looking up the route because the source IP address isn't assigned to any interface on the host. To avoid this, we need to set the
FLOWI_FLAG_ANYSRCflag.Quoted 6 lines
This fix will also require upstream commits
861396ac0b47("geneve: Useip_tunnel_keyflow flags in route lookups") and7e2fb8bc7ef6("vxlan:
Useip_tunnel_keyflow flags in route lookups") to have the intended effect. In short, these two commits "consume" the new field introduced in451ef36bd229("ip_tunnels: Add new flow flags field toip_tunnel_key") and populated in the present commit.
Quoted 2 lines
Ick. Is it better to just drop this commit instead? Or is it ok to also backport those 2 patches to 5.19.y?
It should be okay to backport those additional 2 patches to 5.19.y.
Thank you,
--
Paul
Greg Kroah-Hartman
maintainerRe: [PATCH 5.19 0537/1157] bpf: Set flow flag to allow any source IP in bpf_tunnel_key
Quoted 25 lines · Paul Chaignon
Quoted 24 lines · Greg Kroah-Hartman
Quoted 22 lines · Paul Chaignon
Quoted 10 lines · Greg Kroah-Hartman
From: Paul Chaignon <[email protected]>
[ Upstream commit
b8fff748521c7178b9a7d32b5a34a81cec8396f3]Commit
26101f5ab6bd("bpf: Add source ip in "structbpf_tunnel_key"") added support for getting and setting the outer source IP of encapsulated packets via the bpf_skb_{get,set}_tunnel_key BPF helper. This change allows BPF programs to set any IP address as the source, including for example the IP address of a container running on the same host.Quoted 4 lines
In that last case, however, the encapsulated packets are dropped when looking up the route because the source IP address isn't assigned to any interface on the host. To avoid this, we need to set the
FLOWI_FLAG_ANYSRCflag.This fix will also require upstream commits
861396ac0b47("geneve: Useip_tunnel_keyflow flags in route lookups") and7e2fb8bc7ef6("vxlan:
Useip_tunnel_keyflow flags in route lookups") to have the intended effect. In short, these two commits "consume" the new field introduced in451ef36bd229("ip_tunnels: Add new flow flags field toip_tunnel_key") and populated in the present commit.
Quoted 4 lines
Quoted 2 lines
Ick. Is it better to just drop this commit instead? Or is it ok to also backport those 2 patches to 5.19.y?
It should be okay to backport those additional 2 patches to 5.19.y.
Thanks, both queued up now.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 538/1157 bpf: Fix bpf_xdp_pointer return pointer
In reply to Greg Kroah-HartmanFrom: Joanne Koong <[email protected]>
[ Upstream commit bbd52178e249fe893ef4a9b87cde5b6c473b0a7c ]
For the case where offset + len == size, bpf_xdp_pointer should return a valid pointer to the addr because that access is permitted. We should only return NULL in the case where offset + len exceeds size.
--- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/filter.c +1 -1
@@ -3918,7 +3918,7 @@ static void *bpf_xdp_pointer(struct xdp_buff *xdp, u32 offset, u32 len) offset -= frag_size; } out: -return offset + len < size ? addr + offset :NULL ; +return offset + len <= size ? addr + offset :NULL ; } BPF_CALL_4(bpf_xdp_load_bytes, struct xdp_buff *, xdp, u32, offset,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 539/1157 i2c: mux-gpmux: Add of_node_put() when breaking out of loop
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 6435319c34704994e19b0767f6a4e6f37439867b ]
In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount.
--- drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-mux-gpmux.c +1 -0
@@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev)return 0 ; err_children: +of_node_put (child);i2c_mux_del_adapters (muxc); err_parent:i2c_put_adapter (parent);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 540/1157 wifi: ath11k: Fix register write failure on QCN9074
In reply to Greg Kroah-HartmanFrom: Manikanta Pubbisetty <[email protected]>
[ Upstream commit 867f4eeee862d6568a0f142d6a38f8bb724ff80e ]
Commit 56c8ccf331bd ("ath11k: Add register access logic for WCN6750") regressed QCN9074. With the above mentioned commit, writes are failing for some registers on QCN9074 although the device seems to work normally.
ath11k_pci 0000:03:00.0: failed to set pcie link register0x01e0e0a8: 0xffffffff != 0x00000010 ath11k_pci 0000:03:00.0: failed to set sysclk: -110
PCIe devices in ath11k (QCA6390, WCN6855, QCN9074, WCN6750) use window concept for register accesses. There are two schemes, dynamic & static window.
In dynamic window scheme, a single window(region in the BAR) is mapped either to CE or DP register windows at any give time. QCA6390 & WCN6855 follow this scheme for register accesses.
In static window scheme, CE & DP register windows are statically mapped to separate regions with in the BAR so that there is no switching of register windows between CE & DP register accesses. QCN9074 & WCN6750 follow this scheme although the window start offsets are different for QCN9074 & WCN6750.
QCN9074 uses 3rd & 2nd window for DP & CE register accesses respectively whereas WCN6750 uses 1st & 2nd window for DP & CE. In QCN9074, along with 2nd & 3rd windows, 1st window is also used for certain configurations which commit 56c8ccf331bd ("ath11k: Add register access logic for WCN6750") did not account for and hence the regression.
Fix this by going back to the original way of accessing the registers on QCN9074. Since this diverges from WCN6750 way of accessing registers, it is required to register window_read32/window_write32() pci_ops for WCN6750. We can also get rid of dp_window_idx & ce_window_idx members in hw_params, so remove them.
Also add a new API ath11k_pcic_register_pci_ops() for registering pci_ops to the ath11k core. This API checks for mandatory pci_ops() and reports error if those are missing. Also initialize unused pci_ops to NULL.
Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.6.0.1-00861-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/ahb.c | 52 ++++++++++++++++++- drivers/net/wireless/ath/ath11k/core.c | 14 ------ drivers/net/wireless/ath/ath11k/hw.h | 2 - drivers/net/wireless/ath/ath11k/pci.c | 70 ++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/pcic.c | 57 ++++++++------------- drivers/net/wireless/ath/ath11k/pcic.h | 2 + 6 files changed, 128 insertions(+), 69 deletions(-)
drivers/net/wireless/ath/ath11k/ahb.c +51 -1
@@ -140,8 +140,53 @@ ath11k_ahb_get_msi_irq_wcn6750(struct ath11k_base *ab, unsigned int vector)return ab->pci.msi.irqs[vector]; } +static inline u32 +ath11k_ahb_get_window_start_wcn6750 (struct ath11k_base *ab,u32 offset) +{ +u32 window_start =0 ; + +/* If offset lies within DP register range, use 1st window */ +if ((offset ^HAL_SEQ_WCSS_UMAC_OFFSET ) <ATH11K_PCI_WINDOW_RANGE_MASK ) + window_start =ATH11K_PCI_WINDOW_START ; +/* If offset lies within CE register range, use 2nd window */ +else if ((offset ^HAL_SEQ_WCSS_UMAC_CE0_SRC_REG (ab)) < +ATH11K_PCI_WINDOW_RANGE_MASK ) + window_start =2 *ATH11K_PCI_WINDOW_START ; + +return window_start; +} + +static void +ath11k_ahb_window_write32_wcn6750 (struct ath11k_base *ab,u32 offset,u32 value) +{ +u32 window_start; + +/* WCN6750 uses static window based register access*/ + window_start =ath11k_ahb_get_window_start_wcn6750 (ab, offset); + +iowrite32 (value, ab->mem + window_start + + (offset &ATH11K_PCI_WINDOW_RANGE_MASK )); +} + +static u32 ath11k_ahb_window_read32_wcn6750 (struct ath11k_base *ab,u32 offset) +{ +u32 window_start; +u32 val; + +/* WCN6750 uses static window based register access */ + window_start =ath11k_ahb_get_window_start_wcn6750 (ab, offset); + + val =ioread32 (ab->mem + window_start + + (offset &ATH11K_PCI_WINDOW_RANGE_MASK )); +return val; +} +static const struct ath11k_pci_ops ath11k_ahb_pci_ops_wcn6750 = { + .wakeup =NULL , + .release =NULL , .get_msi_irq = ath11k_ahb_get_msi_irq_wcn6750, + .window_write32 = ath11k_ahb_window_write32_wcn6750, + .window_read32 = ath11k_ahb_window_read32_wcn6750, };static inline u32 ath11k_ahb_read32 (struct ath11k_base *ab,u32 offset)
@@ -971,11 +1016,16 @@ static int ath11k_ahb_probe(struct platform_device *pdev) } ab->hif.ops = hif_ops; - ab->pci.ops = pci_ops; ab->pdev = pdev; ab->hw_rev = hw_rev;platform_set_drvdata (pdev, ab); + ret =ath11k_pcic_register_pci_ops (ab, pci_ops); +if (ret) { +ath11k_err (ab,"failed to register PCI ops: %d\n" , ret); + goto err_core_free; + } + ret =ath11k_core_pre_init (ab);if (ret) goto err_core_free;
drivers/net/wireless/ath/ath11k/core.c +0 -14
@@ -107,8 +107,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = true, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = false, },
@@ -183,8 +181,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = true, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = false, },
@@ -258,8 +254,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, },
@@ -333,8 +327,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = true, .hybrid_bus_type = false, - .dp_window_idx = 3, - .ce_window_idx = 2, .fixed_fw_mem = false, .support_off_channel_tx = false, },
@@ -408,8 +400,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, },
@@ -482,8 +472,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = false, .hybrid_bus_type = false, - .dp_window_idx = 0, - .ce_window_idx = 0, .fixed_fw_mem = false, .support_off_channel_tx = true, },
@@ -556,8 +544,6 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { .fixed_mem_region = false, .static_window_map = true, .hybrid_bus_type = true, - .dp_window_idx = 1, - .ce_window_idx = 2, .fixed_fw_mem = true, .support_off_channel_tx = false, },
drivers/net/wireless/ath/ath11k/hw.h +0 -2
@@ -201,8 +201,6 @@ struct ath11k_hw_params {bool fixed_mem_region;bool static_window_map;bool hybrid_bus_type; -u8 dp_window_idx; -u8 ce_window_idx;bool fixed_fw_mem;bool support_off_channel_tx; };
drivers/net/wireless/ath/ath11k/pci.c +54 -16
121 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/pcic.c +21 -36
97 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/pcic.h +2 -0
@@ -43,4 +43,6 @@ int ath11k_pcic_map_service_to_pipe(struct ath11k_base *ab, u16 service_id,void ath11k_pcic_ce_irqs_enable (struct ath11k_base *ab);void ath11k_pcic_ce_irq_disable_sync (struct ath11k_base *ab);int ath11k_pcic_init_msi_config (struct ath11k_base *ab); +int ath11k_pcic_register_pci_ops (struct ath11k_base *ab, +const struct ath11k_pci_ops *pci_ops);#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 541/1157 wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()`
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit d578e0af3a003736f6c440188b156483d451b329 ]
Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user() but it forgets to change the value to be returned that came from simple_write_to_buffer() call. It results in the following warning:
warning: variable 'rc' is uninitialized when used here [-Wuninitialized]
return rc;
^~Remove rc variable and just return the passed in length if the memdup_user() succeeds.
--- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/wil6210/debugfs.c +2 -2
@@ -1010,7 +1010,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,void *cmd;int cmdlen = len -sizeof (struct wmi_cmd_hdr );u16 cmdid; -int rc, rc1; +int rc1;if (cmdlen <0 || *ppos !=0 )return -EINVAL ;
@@ -1027,7 +1027,7 @@ static ssize_t wil_write_file_wmi(struct file *file, const char __user *buf,wil_info (wil,"0x%04x[%d] -> %d\n" , cmdid, cmdlen, rc1); -return rc; +return len; }static const struct file_operations fops_wmi = {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 542/1157 wifi: iwlwifi: mvm: fix double list_add at iwl_mvm_mac_wake_tx_queue
In reply to Greg Kroah-HartmanFrom: Jose Ignacio Tornos Martinez <[email protected]>
[ Upstream commit 14a3aacf517a9de725dd3219dbbcf741e31763c4 ]
After successfull station association, if station queues are disabled for some reason, the related lists are not emptied. So if some new element is added to the list in iwl_mvm_mac_wake_tx_queue, it can match with the old one and produce a BUG like this:
[ 46.535263] list_add corruption. prev->next should be next (ffff94c1c318a360), but was 0000000000000000. (prev=ffff94c1d02d3388). [ 46.535283] ------------[ cut here ]------------ [ 46.535284] kernel BUG at lib/list_debug.c:26! [ 46.535290] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 46.585304] CPU: 0 PID: 623 Comm: wpa_supplicant Not tainted 5.19.0-rc3+ #1 [ 46.592380] Hardware name: Dell Inc. Inspiron 660s/0478VN , BIOS A07 08/24/2012 [ 46.600336] RIP: 0010:__list_add_valid.cold+0x3d/0x3f [ 46.605475] Code: f2 4c 89 c1 48 89 fe 48 c7 c7 c8 40 67 93 e8 20 cc fd ff 0f 0b 48 89 d1 4c 89 c6 4c 89 ca 48 c7 c7 70 40 67 93 e8 09 cc fd ff <0f> 0b 48 89 fe 48 c7 c7 00 41 67 93 e8 f8 cb fd ff 0f 0b 48 89 d1 [ 46.624469] RSP: 0018:ffffb20800ab76d8 EFLAGS: 00010286 [ 46.629854] RAX: 0000000000000075 RBX: ffff94c1c318a0e0 RCX: 0000000000000000 [ 46.637105] RDX: 0000000000000201 RSI: ffffffff9365e100 RDI: 00000000ffffffff [ 46.644356] RBP: ffff94c1c5f43370 R08: 0000000000000075 R09: 3064316334396666 [ 46.651607] R10: 3364323064316334 R11: 39666666663d7665 R12: ffff94c1c5f43388 [ 46.658857] R13: ffff94c1d02d3388 R14: ffff94c1c318a360 R15: ffff94c1cf2289c0 [ 46.666108] FS: 00007f65634ff7c0(0000) GS:ffff94c1da200000(0000) knlGS:0000000000000000 [ 46.674331] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 46.680170] CR2: 00007f7dfe984460 CR3: 000000010e894003 CR4: 00000000000606f0 [ 46.687422] Call Trace: [ 46.689906] <TASK> [ 46.691950] iwl_mvm_mac_wake_tx_queue+0xec/0x15c [iwlmvm] [ 46.697601] ieee80211_queue_skb+0x4b3/0x720 [mac80211] [ 46.702973] ? sta_info_get+0x46/0x60 [mac80211] [ 46.707703] ieee80211_tx+0xad/0x110 [mac80211] [ 46.712355] __ieee80211_tx_skb_tid_band+0x71/0x90 [mac80211]
...
In order to avoid this problem, we must also remove the related lists when station queues are disabled.
--- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/intel/iwlwifi/mvm/sta.c +1 -0
@@ -1861,6 +1861,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm,iwl_mvm_txq_from_mac80211 (sta->txq[i]); mvmtxq->txq_id =IWL_MVM_INVALID_QUEUE ; +list_del_init (&mvmtxq->list); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 543/1157 wifi: libertas: Fix possible refcount leak in if_usb_probe()
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 ]
usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails.
--- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/marvell/libertas/if_usb.c +1 -0
@@ -287,6 +287,7 @@ static int if_usb_probe(struct usb_interface *intf,return 0 ; err_get_fw: +usb_put_dev (udev);lbs_remove_card (priv); err_add_card:if_usb_reset_device (cardp);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 544/1157 media: cedrus: hevc: Add check for invalid timestamp
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 143201a6435bf65f0115435e9dc6d95c66b908e9 ]
Not all DPB entries will be used most of the time. Unused entries will thus have invalid timestamps. They will produce negative buffer index which is not specifically handled. This works just by chance in current code. It will even produce bogus pointer, but since it's not used, it won't do any harm.
Let's fix that brittle design by skipping writing DPB entry altogether if timestamp is invalid.
--- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/media/sunxi/cedrus/cedrus_h265.c +3 -0
@@ -147,6 +147,9 @@ static void cedrus_h265_frame_info_write_dpb(struct cedrus_ctx *ctx, dpb[i].pic_order_cnt_val }; +if (buffer_index <0 ) +continue ; +cedrus_h265_frame_info_write_single (ctx, i, dpb[i].field_pic, pic_order_cnt, buffer_index);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 545/1157 hantro: Remove incorrect HEVC SPS validation
In reply to Greg Kroah-HartmanFrom: Ezequiel Garcia <[email protected]>
[ Upstream commit df9ec2fc8e70e01532fd9161cd98711969561ff6 ]
Currently, the driver tries to validat the HEVC SPS against the CAPTURE queue format (i.e. the decoded format). This is not correct, because typically the SPS control is set before the CAPTURE queue is negotiated.
--- drivers/staging/media/hantro/hantro_drv.c | 12 ++++++------ drivers/staging/media/hantro/hantro_hevc.c | 9 +-------- drivers/staging/media/hantro/hantro_hw.h | 1 - 3 files changed, 7 insertions(+), 15 deletions(-)
drivers/staging/media/hantro/hantro_drv.c +6 -6
@@ -253,11 +253,6 @@ queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)static int hantro_try_ctrl (struct v4l2_ctrl *ctrl) { -struct hantro_ctx *ctx; - - ctx =container_of (ctrl->handler, - struct hantro_ctx, ctrl_handler); -if (ctrl->id ==V4L2_CID_STATELESS_H264_SPS ) {const struct v4l2_ctrl_h264_sps *sps = ctrl->p_new.p_h264_sps;
@@ -273,7 +268,12 @@ static int hantro_try_ctrl(struct v4l2_ctrl *ctrl) }else if (ctrl->id ==V4L2_CID_MPEG_VIDEO_HEVC_SPS ) {const struct v4l2_ctrl_hevc_sps *sps = ctrl->p_new.p_hevc_sps; -return hantro_hevc_validate_sps (ctx, sps); +if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) +/* Luma and chroma bit depth mismatch */ +return -EINVAL ; +if (sps->bit_depth_luma_minus8 !=0 ) +/* Only 8-bit is supported */ +return -EINVAL ; }else if (ctrl->id ==V4L2_CID_STATELESS_VP9_FRAME ) {const struct v4l2_ctrl_vp9_frame *dec_params = ctrl->p_new.p_vp9_frame;
drivers/staging/media/hantro/hantro_hevc.c +1 -8
@@ -154,15 +154,8 @@ static int tile_buffer_reallocate(struct hantro_ctx *ctx)return -ENOMEM ; } -int hantro_hevc_validate_sps (struct hantro_ctx *ctx,const struct v4l2_ctrl_hevc_sps *sps) +static int hantro_hevc_validate_sps (struct hantro_ctx *ctx,const struct v4l2_ctrl_hevc_sps *sps) { -if (sps->bit_depth_luma_minus8 != sps->bit_depth_chroma_minus8) -/* Luma and chroma bit depth mismatch */ -return -EINVAL ; -if (sps->bit_depth_luma_minus8 !=0 ) -/* Only 8-bit is supported */ -return -EINVAL ; -/* * for tile pixel format check if the width and height match * hardware constraints
drivers/staging/media/hantro/hantro_hw.h +0 -1
@@ -359,7 +359,6 @@ int hantro_hevc_dec_prepare_run(struct hantro_ctx *ctx);void hantro_hevc_ref_init (struct hantro_ctx *ctx);dma_addr_t hantro_hevc_get_ref_buf (struct hantro_ctx *ctx,s32 poc);int hantro_hevc_add_ref_buf (struct hantro_ctx *ctx,int poc,dma_addr_t addr); -int hantro_hevc_validate_sps (struct hantro_ctx *ctx,const struct v4l2_ctrl_hevc_sps *sps);static inline unsigned short hantro_vp9_num_sbs (unsigned short dimension)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 546/1157 drm/amd/display: fix signedness bug in execute_synaptics_rc_command()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 06ac561fb0edf868f7b292fb4a3c8ffbbb1e14bb ]
The "ret" variable needs to be signed for the error handling to work.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +1 -1
@@ -571,7 +571,7 @@ static bool execute_synaptics_rc_command(struct drm_dp_aux *aux,unsigned char rc_cmd =0 ;unsigned char rc_result =0xFF ;unsigned char i =0 ; -uint8_t ret =0 ; +int ret;if (is_write_cmd) {// write rc data
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 547/1157 net/mlx5e: Remove WARN_ON when trying to offload an unsupported TLS cipher/version
In reply to Greg Kroah-HartmanFrom: Gal Pressman <[email protected]>
[ Upstream commit 115d9f95ea7ab780ef315dc356bebba2e07cb731 ]
The driver reports whether TX/RX TLS device offloads are supported, but not which ciphers/versions, these should be handled by returning -EOPNOTSUPP when .tls_dev_add() is called.
Remove the WARN_ON kernel trace when the driver gets a request to offload a cipher/version that is not supported as it is expected.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +1 -1
@@ -54,7 +54,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, struct sock *sk,struct mlx5_core_dev *mdev = priv->mdev;int err; -if (WARN_ON (!mlx5e_ktls_type_check (mdev, crypto_info))) +if (!mlx5e_ktls_type_check (mdev, crypto_info))return -EOPNOTSUPP ;if (direction ==TLS_OFFLOAD_CTX_DIR_TX )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 548/1157 net/mlx5e: TC, Fix post_act to not match on in_port metadata
In reply to Greg Kroah-HartmanFrom: Maor Dickman <[email protected]>
[ Upstream commit 903f2194f74bbd289f3170114035d472a36a8ab4 ]
The cited commit changed CT to use multi table actions post act infrastructure instead of using it own post act infrastructure, this broke decap during VF tunnel offload (Stack devices) with CT due to wrong match on in_port metadata in the post act table. This changed only broke VF tunnel offload because it modify the packet in_port metadata to be VF metadata and it isn't propagate the post act creation.
Fixed by modify post act rules to match only on fte_id and not match on in_port metadata which isn't needed.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c +1 -0
@@ -128,6 +128,7 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *at post_attr->inner_match_level =MLX5_MATCH_NONE ; post_attr->outer_match_level =MLX5_MATCH_NONE ; post_attr->action &= ~MLX5_FLOW_CONTEXT_ACTION_DECAP ; + post_attr->flags |=MLX5_ATTR_FLAG_NO_IN_PORT ; handle->ns_type = post_act->ns_type;/* Splits were handled before post action */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 549/1157 net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 562696c3c62c7c23dd896e9447252ce9268cb812 ]
MLX5E_MAX_RQ_NUM_MTTS should be the maximum value, so that MLX5_MTT_OCTW(MLX5E_MAX_RQ_NUM_MTTS) fits into u16. The current value of 1 << 17 results in MLX5_MTT_OCTW(1 << 17) = 1 << 16, which doesn't fit into u16. This commit replaces it with the maximum value that still fits u16.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +1 -1
@@ -109,7 +109,7 @@ struct page_pool;#define MLX5E_REQUIRED_WQE_MTTS (MLX5_ALIGN_MTTS(MLX5_MPWRQ_PAGES_PER_WQE + 1))#define MLX5E_REQUIRED_MTTS (wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS)#define MLX5E_MAX_RQ_NUM_MTTS \ - ((1 << 16) * 2)/* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ + (ALIGN_DOWN(U16_MAX, 4) * 2)/* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ #define MLX5E_ORDER2_MAX_PACKET_MTU (order_base_2(10 * 1024))#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW \ (ilog2(MLX5E_MAX_RQ_NUM_MTTS / MLX5E_REQUIRED_WQE_MTTS))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 550/1157 net/mlx5e: xsk: Account for XSK RQ UMRs when calculating ICOSQ size
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 52586d2f56b3e4f528ca7268d65074e92c936681 ]
ICOSQ is used to post UMR WQEs for both regular RQ and XSK RQ. However, space in ICOSQ is reserved only for the regular RQ, which may cause ICOSQ overflows when using XSK (the most risk is on activating channels).
This commit fixes the issue by reserving space for XSK UMR WQEs as well. As XSK may be enabled without restarting the channel and recreating the ICOSQ, this space is reserved unconditionally.
--- drivers/net/ethernet/mellanox/mlx5/core/en/params.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/params.c +12 -0
@@ -790,8 +790,20 @@ static u8 mlx5e_build_icosq_log_wq_sz(struct mlx5_core_dev *mdev,return MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE ; wqebbs =MLX5E_UMR_WQEBBS *BIT (mlx5e_get_rq_log_wq_sz (rqp->rqc)); + +/* If XDP program is attached, XSK may be turned on at any time without +* restarting the channel. ICOSQ must be big enough to fit UMR WQEs of +* both regular RQ and XSK RQ. +* Although mlx5e_mpwqe_get_log_rq_size accepts mlx5e_xsk_param, it +* doesn't affect its return value, as long as params->xdp_prog != NULL, +* so we can just multiply by 2. +*/ +if (params->xdp_prog) + wqebbs *=2 ; +if (params->packet_merge.type ==MLX5E_PACKET_MERGE_SHAMPO ) wqebbs +=mlx5e_shampo_icosq_sz (mdev, params, rqp); +return max_t (u8,MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE ,order_base_2 (wqebbs)); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 551/1157 net/mlx5e: Fix calculations related to max MPWQE size
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 677e78c8d44f326a73a77d71acf3a49ea562c1d9 ]
Before commit 76c31e5f7585 ("net/mlx5e: Use FW limitation for max MPW WQEBBs"), the maximum size of MPWQE in WQEBBs was hardcoded as a driver constant. That commit started using the firmware capability that can further limit the size, however, it unintentionally changed a few things:
1. The calculation of MLX5E_MAX_KLM_PER_WQE used the size in DS, which was replaced by the size in WQEBBs, making the resulting value 4 times smaller.
2. MLX5E_TX_MPW_MAX_WQEBBS used to be aligned to the cache line size (either 64 or 128 bytes, i.e. 1 or 2 WQEBBs), but it's no longer the case if the firmware capability is smaller than the driver maximum.
Fix both issues by using the correct units for MLX5E_MAX_KLM_PER_WQE and by aligning mlx5e_get_sw_max_sq_mpw_wqebbs after taking the minimum.
Besides fixing the arithmetics in calculation of MLX5E_MAX_KLM_PER_WQE, also use appropriate constants: size of BSF * num of DS per WQEBB * number of WQEBBs (the calculation before the blamed commit) doesn't make much sense to calculate the WQE size in bytes, so just use size of WQEBB * number of WQEBBs.
While at it, replace the types that hold the number of WQEBBs by u8. These values don't exceed 16, and it allows to fill holes in two structs.
--- drivers/net/ethernet/mellanox/mlx5/core/en.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en.h +10 -9
@@ -174,8 +174,8 @@ struct page_pool; ALIGN_DOWN(MLX5E_KLM_MAX_ENTRIES_PER_WQE(wqe_size), MLX5_UMR_KLM_ALIGNMENT)#define MLX5E_MAX_KLM_PER_WQE (mdev) \ - MLX5E_KLM_ENTRIES_PER_WQE(mlx5e_get_sw_max_sq_mpw_wqebbs(mlx5e_get_max_sq_wqebbs(mdev)) \ - << MLX5_MKEY_BSF_OCTO_SIZE) + MLX5E_KLM_ENTRIES_PER_WQE(MLX5_SEND_WQE_BB * \ + mlx5e_get_sw_max_sq_mpw_wqebbs(mlx5e_get_max_sq_wqebbs(mdev)))#define MLX5E_MSG_LEVEL NETIF_MSG_LINK
@@ -233,7 +233,7 @@ static inline u16 mlx5e_get_max_sq_wqebbs(struct mlx5_core_dev *mdev) MLX5_CAP_GEN(mdev, max_wqe_sz_sq) / MLX5_SEND_WQE_BB); } -static inline u16 mlx5e_get_sw_max_sq_mpw_wqebbs (u16 max_sq_wqebbs) +static inline u8 mlx5e_get_sw_max_sq_mpw_wqebbs (u8 max_sq_wqebbs) {/* The return value will be multiplied by MLX5_SEND_WQEBB_NUM_DS. * Since max_sq_wqebbs may be up to MLX5_SEND_WQE_MAX_WQEBBS == 16,
@@ -242,11 +242,12 @@ static inline u16 mlx5e_get_sw_max_sq_mpw_wqebbs(u16 max_sq_wqebbs)* than MLX5_SEND_WQE_MAX_WQEBBS to let a full-session WQE be * cache-aligned. */ -#if L1_CACHE_BYTES <128 -return min_t (u16, max_sq_wqebbs,MLX5_SEND_WQE_MAX_WQEBBS -1 ); -#else -return min_t (u16, max_sq_wqebbs,MLX5_SEND_WQE_MAX_WQEBBS -2 ); +u8 wqebbs =min_t (u8, max_sq_wqebbs,MLX5_SEND_WQE_MAX_WQEBBS -1 ); + +#if L1_CACHE_BYTES >=128 + wqebbs =ALIGN_DOWN (wqebbs,2 );#endif +return wqebbs; }struct mlx5e_tx_wqe {
@@ -455,7 +456,7 @@ struct mlx5e_txqsq {struct netdev_queue *txq;u32 sqn;u16 stop_room; -u16 max_sq_mpw_wqebbs; +u8 max_sq_mpw_wqebbs;u8 min_inline_mode;struct device *pdev;__be32 mkey_be;
@@ -570,7 +571,7 @@ struct mlx5e_xdpsq {struct device *pdev;__be32 mkey_be;u16 stop_room; -u16 max_sq_mpw_wqebbs; +u8 max_sq_mpw_wqebbs;u8 min_inline_mode;unsigned long state;unsigned int hw_mtu;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 552/1157 net/mlx5e: Modify slow path rules to go to slow fdb
In reply to Greg Kroah-HartmanFrom: Vlad Buslov <[email protected]>
[ Upstream commit c0063a43700fa8c98cac2637aa1afcf40bb9e403 ]
While extending available range of supported chains/prios referenced commit also modified slow path rules to go to FT chain instead of actual slow FDB. However neither of existing users of the MLX5_ATTR_FLAG_SLOW_PATH flag (tunnel encap entries with invalid encap and flows with trap action) need to match on FT chain. After bridge offload was implemented packets of such flows can also be matched by bridge priority tables which is undesirable. Restore slow path flows implementation to redirect packets to slow_fdb.
--- .../mellanox/mlx5/core/eswitch_offloads.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +17 -6
@@ -230,10 +230,8 @@ esw_setup_ft_dest(struct mlx5_flow_destination *dest, }static void -esw_setup_slow_path_dest (struct mlx5_flow_destination *dest, -struct mlx5_flow_act *flow_act, -struct mlx5_fs_chains *chains, -int i) +esw_setup_accept_dest (struct mlx5_flow_destination *dest,struct mlx5_flow_act *flow_act, +struct mlx5_fs_chains *chains,int i) {if (mlx5_chains_ignore_flow_level_supported (chains)) flow_act->flags |=FLOW_ACT_IGNORE_FLOW_LEVEL ;
@@ -241,6 +239,16 @@ esw_setup_slow_path_dest(struct mlx5_flow_destination *dest, dest[i].ft =mlx5_chains_get_tc_end_ft (chains); } +static void +esw_setup_slow_path_dest (struct mlx5_flow_destination *dest,struct mlx5_flow_act *flow_act, +struct mlx5_eswitch *esw,int i) +{ +if (MLX5_CAP_ESW_FLOWTABLE_FDB (esw->dev, ignore_flow_level)) + flow_act->flags |=FLOW_ACT_IGNORE_FLOW_LEVEL ; + dest[i].type =MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE ; + dest[i].ft = esw->fdb_table.offloads.slow_fdb; +} + static int esw_setup_chain_dest(struct mlx5_flow_destination *dest, struct mlx5_flow_act *flow_act,
@@ -475,8 +483,11 @@ esw_setup_dests(struct mlx5_flow_destination *dest, }else if (attr->dest_ft) {esw_setup_ft_dest (dest, flow_act, esw, attr, spec, *i); (*i)++; - }else if (mlx5e_tc_attr_flags_skip (attr->flags)) { -esw_setup_slow_path_dest (dest, flow_act, chains, *i); + }else if (attr->flags &MLX5_ATTR_FLAG_SLOW_PATH ) { +esw_setup_slow_path_dest (dest, flow_act, esw, *i); + (*i)++; + }else if (attr->flags &MLX5_ATTR_FLAG_ACCEPT ) { +esw_setup_accept_dest (dest, flow_act, chains, *i); (*i)++; }else if (attr->dest_chain) { err = esw_setup_chain_dest(dest, flow_act, chains, attr->dest_chain,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 553/1157 net/mlx5: Adjust log_max_qp to be 18 at most
In reply to Greg Kroah-HartmanFrom: Maher Sanalla <[email protected]>
[ Upstream commit a6e9085d791f8306084fd5bc44dd3fdd4e1ac27b ]
The cited commit limited log_max_qp to be 17 due to FW capabilities. Recently, it turned out that there are old FW versions that supported more than 17, so the cited commit caused a degradation.
Thus, set the maximum log_max_qp back to 18 as it was before the cited commit.
--- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -524,7 +524,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, void *set_ctx)/* Check log_max_qp from HCA caps to set in current profile */ if (prof->log_max_qp ==LOG_MAX_SUPPORTED_QPS ) { - prof->log_max_qp =min_t (u8,17 ,MLX5_CAP_GEN_MAX (dev, log_max_qp)); + prof->log_max_qp =min_t (u8,18 ,MLX5_CAP_GEN_MAX (dev, log_max_qp)); }else if (MLX5_CAP_GEN_MAX (dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing it to HCA capability limit (%d)\n", prof->log_max_qp,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 554/1157 net/mlx5: DR, Fix SMFS steering info dump format
In reply to Greg Kroah-HartmanFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 62d2664351ef37da34f6f3a3fd8ab34257d6fe30 ]
Fix several issues in SMFS steering info dump:
- Fix outdated macro value for matcher mask in the SMFS debug dump format. The existing value denotes the old format of the matcher mask, as it was used during the early stages of development, and it results in wrong parsing by the steering dump parser - wrong fields are shown in the parsed output.
- Add the missing destination table to the dumped action.
The missing dest table handle breaks the ability to associate between the "go to table" action and the actual table in the steering info.
--- .../ethernet/mellanox/mlx5/core/steering/dr_dbg.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_dbg.c +8 -5
@@ -21,10 +21,11 @@ enum dr_dump_rec_type {DR_DUMP_REC_TYPE_TABLE_TX =3102 ,DR_DUMP_REC_TYPE_MATCHER =3200 , -DR_DUMP_REC_TYPE_MATCHER_MASK =3201 , +DR_DUMP_REC_TYPE_MATCHER_MASK_DEPRECATED =3201 ,DR_DUMP_REC_TYPE_MATCHER_RX =3202 ,DR_DUMP_REC_TYPE_MATCHER_TX =3203 ,DR_DUMP_REC_TYPE_MATCHER_BUILDER =3204 , +DR_DUMP_REC_TYPE_MATCHER_MASK =3205 ,DR_DUMP_REC_TYPE_RULE =3300 , DR_DUMP_REC_TYPE_RULE_RX_ENTRY_V0 = 3301,
@@ -114,13 +115,15 @@ dr_dump_rule_action_mem(struct seq_file *file, const u64 rule_id,break ;case DR_ACTION_TYP_FT :if (action->dest_tbl->is_fw_tbl) -seq_printf (file,"%d,0x%llx,0x%llx,0x%x\n" , +seq_printf (file,"%d,0x%llx,0x%llx,0x%x,0x%x\n" ,DR_DUMP_REC_TYPE_ACTION_FT , action_id, - rule_id, action->dest_tbl->fw_tbl.id); + rule_id, action->dest_tbl->fw_tbl.id, +-1 );else -seq_printf (file,"%d,0x%llx,0x%llx,0x%x\n" , +seq_printf (file,"%d,0x%llx,0x%llx,0x%x,0x%llx\n" ,DR_DUMP_REC_TYPE_ACTION_FT , action_id, - rule_id, action->dest_tbl->tbl->table_id); + rule_id, action->dest_tbl->tbl->table_id, +DR_DBG_PTR_TO_ID (action->dest_tbl->tbl));break ;case DR_ACTION_TYP_CTR :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 555/1157 net/mlx5: Fix driver use of uninitialized timeout
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
[ Upstream commit 42b4f7f66a43cdb9216e76e595c8a9af154806da ]
Currently, driver is setting default values to all timeouts during
function setup. The offending commit is using a timeout before
function setup, meaning: the timeout is 0 (or garbage), since no
value have been set.
This may result in failure to probe the driver:
mlx5_function_setup:1034:(pid 69850): Firmware over 4294967296 MS in pre-initializing state, aborting probe_one:1591:(pid 69850): mlx5_init_one failed with error code -16
Hence, set default values to timeouts during tout_init()
--- drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c | 11 ++++------- drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h | 1 - drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 -- 3 files changed, 4 insertions(+), 10 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c +4 -7
@@ -32,20 +32,17 @@ static void tout_set(struct mlx5_core_dev *dev, u64 val, enum mlx5_timeouts_type dev->timeouts->to[type] = val; } -void mlx5_tout_set_def_val (struct mlx5_core_dev *dev) +int mlx5_tout_init (struct mlx5_core_dev *dev) {int i; -for (i =0 ; i <MAX_TIMEOUT_TYPES ; i++) -tout_set (dev, tout_def_sw_val[i], i); -} - -int mlx5_tout_init (struct mlx5_core_dev *dev) -{ dev->timeouts =kmalloc (sizeof (*dev->timeouts),GFP_KERNEL );if (!dev->timeouts)return -ENOMEM ; +for (i =0 ; i <MAX_TIMEOUT_TYPES ; i++) +tout_set (dev, tout_def_sw_val[i], i); +return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h +0 -1
@@ -35,7 +35,6 @@ int mlx5_tout_init(struct mlx5_core_dev *dev);void mlx5_tout_cleanup (struct mlx5_core_dev *dev);void mlx5_tout_query_iseg (struct mlx5_core_dev *dev);int mlx5_tout_query_dtor (struct mlx5_core_dev *dev); -void mlx5_tout_set_def_val (struct mlx5_core_dev *dev);u64 _mlx5_tout_ms (struct mlx5_core_dev *dev,enum mlx5_timeouts_types type);#define mlx5_tout_ms (dev, type) _mlx5_tout_ms(dev, MLX5_TO_##type##_MS)
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -2
@@ -1023,8 +1023,6 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, u64 timeout)if (mlx5_core_is_pf (dev))pcie_print_link_status (dev->pdev); -mlx5_tout_set_def_val (dev); -/* wait for firmware to accept initialization segments configurations */ err = wait_fw_init(dev, timeout,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 556/1157 ax25: fix incorrect dev_tracker usage
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d7c4c9e075f8cc6d88d277bc24e5d99297f03c06 ]
While investigating a separate rose issue [1], and enabling CONFIG_NET_DEV_REFCNT_TRACKER=y, Bernard reported an orthogonal ax25 issue [2]
An ax25_dev can be used by one (or many) struct ax25_cb. We thus need different dev_tracker, one per struct ax25_cb.
After this patch is applied, we are able to focus on rose.
[1] https://lore.kernel.org/netdev/[email protected]/
[2]
[ 205.798723] reference already released. [ 205.798732] allocated in: [ 205.798734] ax25_bind+0x1a2/0x230 [ax25] [ 205.798747] __sys_bind+0xea/0x110 [ 205.798753] __x64_sys_bind+0x18/0x20 [ 205.798758] do_syscall_64+0x5c/0x80 [ 205.798763] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.798768] freed in: [ 205.798770] ax25_release+0x115/0x370 [ax25] [ 205.798778] __sock_release+0x42/0xb0 [ 205.798782] sock_close+0x15/0x20 [ 205.798785] __fput+0x9f/0x260 [ 205.798789] ____fput+0xe/0x10 [ 205.798792] task_work_run+0x64/0xa0 [ 205.798798] exit_to_user_mode_prepare+0x18b/0x190 [ 205.798804] syscall_exit_to_user_mode+0x26/0x40 [ 205.798808] do_syscall_64+0x69/0x80 [ 205.798812] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.798827] ------------[ cut here ]------------ [ 205.798829] WARNING: CPU: 2 PID: 2605 at lib/ref_tracker.c:136 ref_tracker_free.cold+0x60/0x81 [ 205.798837] Modules linked in: rose netrom mkiss ax25 rfcomm cmac algif_hash algif_skcipher af_alg bnep snd_hda_codec_hdmi nls_iso8859_1 i915 rtw88_8821ce rtw88_8821c x86_pkg_temp_thermal rtw88_pci intel_powerclamp rtw88_core snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio coretemp snd_hda_intel kvm_intel snd_intel_dspcfg mac80211 snd_hda_codec kvm i2c_algo_bit drm_buddy drm_dp_helper btusb drm_kms_helper snd_hwdep btrtl snd_hda_core btbcm joydev crct10dif_pclmul btintel crc32_pclmul ghash_clmulni_intel mei_hdcp btmtk intel_rapl_msr aesni_intel bluetooth input_leds snd_pcm crypto_simd syscopyarea processor_thermal_device_pci_legacy sysfillrect cryptd intel_soc_dts_iosf snd_seq sysimgblt ecdh_generic fb_sys_fops rapl libarc4 processor_thermal_device intel_cstate processor_thermal_rfim cec snd_timer ecc snd_seq_device cfg80211 processor_thermal_mbox mei_me processor_thermal_rapl mei rc_core at24 snd intel_pch_thermal intel_rapl_common ttm soundcore int340x_thermal_zone video [ 205.798948] mac_hid acpi_pad sch_fq_codel ipmi_devintf ipmi_msghandler drm msr parport_pc ppdev lp parport ramoops pstore_blk reed_solomon pstore_zone efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid i2c_i801 i2c_smbus r8169 xhci_pci ahci libahci realtek lpc_ich xhci_pci_renesas [last unloaded: ax25] [ 205.798992] CPU: 2 PID: 2605 Comm: ax25ipd Not tainted 5.18.11-F6BVP #3 [ 205.798996] Hardware name: To be filled by O.E.M. To be filled by O.E.M./CK3, BIOS 5.011 09/16/2020 [ 205.798999] RIP: 0010:ref_tracker_free.cold+0x60/0x81 [ 205.799005] Code: e8 d2 01 9b ff 83 7b 18 00 74 14 48 c7 c7 2f d7 ff 98 e8 10 6e fc ff 8b 7b 18 e8 b8 01 9b ff 4c 89 ee 4c 89 e7 e8 5d fd 07 00 <0f> 0b b8 ea ff ff ff e9 30 05 9b ff 41 0f b6 f7 48 c7 c7 a0 fa 4e [ 205.799008] RSP: 0018:ffffaf5281073958 EFLAGS: 00010286 [ 205.799011] RAX: 0000000080000000 RBX: ffff9a0bd687ebe0 RCX: 0000000000000000 [ 205.799014] RDX: 0000000000000001 RSI: 0000000000000282 RDI: 00000000ffffffff [ 205.799016] RBP: ffffaf5281073a10 R08: 0000000000000003 R09: fffffffffffd5618 [ 205.799019] R10: 0000000000ffff10 R11: 000000000000000f R12: ffff9a0bc53384d0 [ 205.799022] R13: 0000000000000282 R14: 00000000ae000001 R15: 0000000000000001 [ 205.799024] FS: 0000000000000000(0000) GS:ffff9a0d0f300000(0000) knlGS:0000000000000000 [ 205.799028] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 205.799031] CR2: 00007ff6b8311554 CR3: 000000001ac10004 CR4: 00000000001706e0 [ 205.799033] Call Trace: [ 205.799035] <TASK> [ 205.799038] ? ax25_dev_device_down+0xd9/0x1b0 [ax25] [ 205.799047] ? ax25_device_event+0x9f/0x270 [ax25] [ 205.799055] ? raw_notifier_call_chain+0x49/0x60 [ 205.799060] ? call_netdevice_notifiers_info+0x52/0xa0 [ 205.799065] ? dev_close_many+0xc8/0x120 [ 205.799070] ? unregister_netdevice_many+0x13d/0x890 [ 205.799073] ? unregister_netdevice_queue+0x90/0xe0 [ 205.799076] ? unregister_netdev+0x1d/0x30 [ 205.799080] ? mkiss_close+0x7c/0xc0 [mkiss] [ 205.799084] ? tty_ldisc_close+0x2e/0x40 [ 205.799089] ? tty_ldisc_hangup+0x137/0x210 [ 205.799092] ? __tty_hangup.part.0+0x208/0x350 [ 205.799098] ? tty_vhangup+0x15/0x20 [ 205.799103] ? pty_close+0x127/0x160 [ 205.799108] ? tty_release+0x139/0x5e0 [ 205.799112] ? __fput+0x9f/0x260 [ 205.799118] ax25_dev_device_down+0xd9/0x1b0 [ax25] [ 205.799126] ax25_device_event+0x9f/0x270 [ax25] [ 205.799135] raw_notifier_call_chain+0x49/0x60 [ 205.799140] call_netdevice_notifiers_info+0x52/0xa0 [ 205.799146] dev_close_many+0xc8/0x120 [ 205.799152] unregister_netdevice_many+0x13d/0x890 [ 205.799157] unregister_netdevice_queue+0x90/0xe0 [ 205.799161] unregister_netdev+0x1d/0x30 [ 205.799165] mkiss_close+0x7c/0xc0 [mkiss] [ 205.799170] tty_ldisc_close+0x2e/0x40 [ 205.799173] tty_ldisc_hangup+0x137/0x210 [ 205.799178] __tty_hangup.part.0+0x208/0x350 [ 205.799184] tty_vhangup+0x15/0x20 [ 205.799188] pty_close+0x127/0x160 [ 205.799193] tty_release+0x139/0x5e0 [ 205.799199] __fput+0x9f/0x260 [ 205.799203] ____fput+0xe/0x10 [ 205.799208] task_work_run+0x64/0xa0 [ 205.799213] do_exit+0x33b/0xab0 [ 205.799217] ? __handle_mm_fault+0xc4f/0x15f0 [ 205.799224] do_group_exit+0x35/0xa0 [ 205.799228] __x64_sys_exit_group+0x18/0x20 [ 205.799232] do_syscall_64+0x5c/0x80 [ 205.799238] ? handle_mm_fault+0xba/0x290 [ 205.799242] ? debug_smp_processor_id+0x17/0x20 [ 205.799246] ? fpregs_assert_state_consistent+0x26/0x50 [ 205.799251] ? exit_to_user_mode_prepare+0x49/0x190 [ 205.799256] ? irqentry_exit_to_user_mode+0x9/0x20 [ 205.799260] ? irqentry_exit+0x33/0x40 [ 205.799263] ? exc_page_fault+0x87/0x170 [ 205.799268] ? asm_exc_page_fault+0x8/0x30 [ 205.799273] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 205.799277] RIP: 0033:0x7ff6b80eaca1 [ 205.799281] Code: Unable to access opcode bytes at RIP 0x7ff6b80eac77. [ 205.799283] RSP: 002b:00007fff6dfd4738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 [ 205.799287] RAX: ffffffffffffffda RBX: 00007ff6b8215a00 RCX: 00007ff6b80eaca1 [ 205.799290] RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000001 [ 205.799293] RBP: 0000000000000001 R08: ffffffffffffff80 R09: 0000000000000028 [ 205.799295] R10: 0000000000000000 R11: 0000000000000246 R12: 00007ff6b8215a00 [ 205.799298] R13: 0000000000000000 R14: 00007ff6b821aee8 R15: 00007ff6b821af00 [ 205.799304] </TASK>
--- include/net/ax25.h | 1 + net/ax25/af_ax25.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-)
include/net/ax25.h +1 -0
@@ -236,6 +236,7 @@ typedef struct ax25_cb {ax25_address source_addr, dest_addr;ax25_digi *digipeat;ax25_dev *ax25_dev; +netdevice_tracker dev_tracker;unsigned char iamdigi;unsigned char state, modulus, pidincl;unsigned short vs, vr, va;
net/ax25/af_ax25.c +2 -2
@@ -1065,7 +1065,7 @@ static int ax25_release(struct socket *sock)del_timer_sync (&ax25->t3timer);del_timer_sync (&ax25->idletimer); } -dev_put_track (ax25_dev->dev, &ax25_dev->dev_tracker); +dev_put_track (ax25_dev->dev, &ax25->dev_tracker);ax25_dev_put (ax25_dev); }
@@ -1146,7 +1146,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if (ax25_dev) {ax25_fillin_cb (ax25, ax25_dev); -dev_hold_track (ax25_dev->dev, &ax25_dev->dev_tracker,GFP_ATOMIC ); +dev_hold_track (ax25_dev->dev, &ax25->dev_tracker,GFP_ATOMIC ); } done:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 557/1157 crypto: hisilicon/hpre - dont use GFP_KERNEL to alloc mem during softirq
In reply to Greg Kroah-HartmanFrom: Zhengchao Shao <[email protected]>
[ Upstream commit 98dfa9343f37bdd4112966292751e3a93aaf2e56 ]
The hpre encryption driver may be used to encrypt and decrypt packets during the rx softirq, it is not allowed to use GFP_KERNEL.
--- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/hisilicon/hpre/hpre_crypto.c +1 -1
@@ -252,7 +252,7 @@ static int hpre_prepare_dma_buf(struct hpre_asym_request *hpre_req,if (unlikely (shift <0 ))return -EINVAL ; - ptr =dma_alloc_coherent (dev, ctx->key_sz, tmp,GFP_KERNEL ); + ptr =dma_alloc_coherent (dev, ctx->key_sz, tmp,GFP_ATOMIC );if (unlikely (!ptr))return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 558/1157 crypto: inside-secure - Add missing MODULE_DEVICE_TABLE for of
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit fa4d57b85786ec0e16565c75a51c208834b0c24d ]
Without MODULE_DEVICE_TABLE, crypto_safexcel.ko module is not automatically loaded on platforms where inside-secure crypto HW is specified in device tree (e.g. Armada 3720). So add missing MODULE_DEVICE_TABLE for of.
--- drivers/crypto/inside-secure/safexcel.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/inside-secure/safexcel.c +2 -0
@@ -1831,6 +1831,8 @@ static const struct of_device_id safexcel_of_match_table[] = { {}, }; +MODULE_DEVICE_TABLE (of, safexcel_of_match_table); +static struct platform_driver crypto_safexcel = { .probe = safexcel_probe, .remove = safexcel_remove,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 559/1157 crypto: hisilicon/sec - fix auth key size error
In reply to Greg Kroah-HartmanFrom: Kai Ye <[email protected]>
[ Upstream commit 45f5d0176d8426cc1ab0bab84fbd8ef5c57526c6 ]
The authentication algorithm supports a maximum of 128-byte keys. The allocated key memory is insufficient.
--- drivers/crypto/hisilicon/sec2/sec_crypto.c | 6 +++--- drivers/crypto/hisilicon/sec2/sec_crypto.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/hisilicon/sec2/sec_crypto.c +3 -3
@@ -620,7 +620,7 @@ static int sec_auth_init(struct sec_ctx *ctx) {struct sec_auth_ctx *a_ctx = &ctx->a_ctx; - a_ctx->a_key =dma_alloc_coherent (ctx->dev,SEC_MAX_KEY_SIZE , + a_ctx->a_key =dma_alloc_coherent (ctx->dev,SEC_MAX_AKEY_SIZE , &a_ctx->a_key_dma,GFP_KERNEL );if (!a_ctx->a_key)return -ENOMEM ;
@@ -632,8 +632,8 @@ static void sec_auth_uninit(struct sec_ctx *ctx) {struct sec_auth_ctx *a_ctx = &ctx->a_ctx; -memzero_explicit (a_ctx->a_key,SEC_MAX_KEY_SIZE ); -dma_free_coherent (ctx->dev,SEC_MAX_KEY_SIZE , +memzero_explicit (a_ctx->a_key,SEC_MAX_AKEY_SIZE ); +dma_free_coherent (ctx->dev,SEC_MAX_AKEY_SIZE , a_ctx->a_key, a_ctx->a_key_dma); }
drivers/crypto/hisilicon/sec2/sec_crypto.h +1 -0
@@ -7,6 +7,7 @@#define SEC_AIV_SIZE 12#define SEC_IV_SIZE 24#define SEC_MAX_KEY_SIZE 64 +#define SEC_MAX_AKEY_SIZE 128#define SEC_COMM_SCENE 0#define SEC_MIN_BLOCK_SZ 1
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 560/1157 net: allow unbound socket for packets in VRF when tcp_l3mdev_accept set
In reply to Greg Kroah-HartmanFrom: Mike Manning <[email protected]>
[ Upstream commit 944fd1aeacb627fa617f85f8e5a34f7ae8ea4d8e ]
The commit 3c82a21f4320 ("net: allow binding socket in a VRF when there's an unbound socket") changed the inet socket lookup to avoid packets in a VRF from matching an unbound socket. This is to ensure the necessary isolation between the default and other VRFs for routing and forwarding. VRF-unaware processes running in the default VRF cannot access another VRF and have to be run with 'ip vrf exec <vrf>'. This is to be expected with tcp_l3mdev_accept disabled, but could be reallowed when this sysctl option is enabled. So instead of directly checking dif and sdif in inet[6]_match, here call inet_sk_bound_dev_eq(). This allows a match on unbound socket for non-zero sdif i.e. for packets in a VRF, if tcp_l3mdev_accept is enabled.
--- include/net/inet6_hashtables.h | 7 +++---- include/net/inet_hashtables.h | 19 +++---------------- include/net/inet_sock.h | 11 +++++++++++ 3 files changed, 17 insertions(+), 20 deletions(-)
include/net/inet6_hashtables.h +3 -4
@@ -110,8 +110,6 @@ static inline bool inet6_match(struct net *net, const struct sock *sk,const __portpair ports, const int dif, const int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_family != AF_INET6 || sk->sk_portpair != ports ||
@@ -119,8 +117,9 @@ static inline bool inet6_match(struct net *net, const struct sock *sk, !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr))return false; - bound_dev_if =READ_ONCE (sk->sk_bound_dev_if); - return bound_dev_if == dif || bound_dev_if == sdif; +/* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ +return inet_sk_bound_dev_eq (net,READ_ONCE (sk->sk_bound_dev_if), dif, + sdif); }#endif /* IS_ENABLED(CONFIG_IPV6) */
include/net/inet_hashtables.h +3 -16
@@ -175,17 +175,6 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo) hashinfo->ehash_locks =NULL ; } -static inline bool inet_sk_bound_dev_eq (struct net *net,int bound_dev_if, -int dif,int sdif) -{ -#if IS_ENABLED (CONFIG_NET_L3_MASTER_DEV ) -return inet_bound_dev_eq (!!READ_ONCE (net->ipv4.sysctl_tcp_l3mdev_accept), - bound_dev_if, dif, sdif); -#else -return inet_bound_dev_eq (true, bound_dev_if, dif, sdif); -#endif -} -struct inet_bind_bucket * inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net, struct inet_bind_hashbucket *head,
@@ -271,16 +260,14 @@ static inline bool inet_match(struct net *net, const struct sock *sk, const __addrpair cookie, const __portpair ports, int dif, int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_portpair != ports || sk->sk_addrpair != cookie) return false; -/* Paired with WRITE_ONCE() from sock_bindtoindex_locked() */ - bound_dev_if =READ_ONCE (sk->sk_bound_dev_if); -return bound_dev_if == dif || bound_dev_if == sdif; +/* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ +return inet_sk_bound_dev_eq (net,READ_ONCE (sk->sk_bound_dev_if), dif, + sdif); }/* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we need
include/net/inet_sock.h +11 -0
@@ -149,6 +149,17 @@ static inline bool inet_bound_dev_eq(bool l3mdev_accept, int bound_dev_if,return bound_dev_if == dif || bound_dev_if == sdif; } +static inline bool inet_sk_bound_dev_eq (struct net *net,int bound_dev_if, +int dif,int sdif) +{ +#if IS_ENABLED (CONFIG_NET_L3_MASTER_DEV ) +return inet_bound_dev_eq (!!READ_ONCE (net->ipv4.sysctl_tcp_l3mdev_accept), + bound_dev_if, dif, sdif); +#else +return inet_bound_dev_eq (true, bound_dev_if, dif, sdif); +#endif +} +struct inet_cork {unsigned int flags;__be32 addr;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 561/1157 netdevsim: fib: Fix reference count leak on route deletion failure
In reply to Greg Kroah-HartmanFrom: Ido Schimmel <[email protected]>
[ Upstream commit 180a6a3ee60a7cb69ed1232388460644f6a21f00 ]
As part of FIB offload simulation, netdevsim stores IPv4 and IPv6 routes and holds a reference on FIB info structures that in turn hold a reference on the associated nexthop device(s).
In the unlikely case where we are unable to allocate memory to process a route deletion request, netdevsim will not release the reference from the associated FIB info structure, thereby preventing the associated nexthop device(s) from ever being removed [1].
Fix this by scheduling a work item that will flush netdevsim's FIB table upon route deletion failure. This will cause netdevsim to release its reference from all the FIB info structures in its table.
Reported by Lucas Leong of Trend Micro Zero Day Initiative.
--- drivers/net/netdevsim/fib.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/net/netdevsim/fib.c +26 -1
@@ -54,6 +54,7 @@ struct nsim_fib_data {struct rhashtable nexthop_ht;struct devlink *devlink;struct work_struct fib_event_work; +struct work_struct fib_flush_work;struct list_head fib_event_queue;spinlock_t fib_event_queue_lock;/* Protects fib event queue list */ struct mutex nh_lock;/* Protects NH HT */
@@ -978,7 +979,7 @@ static int nsim_fib_event_schedule_work(struct nsim_fib_data *data, fib_event =kzalloc (sizeof (*fib_event),GFP_ATOMIC );if (!fib_event) -return NOTIFY_BAD ; + goto err_fib_event_alloc; fib_event->data = data; fib_event->event = event;
@@ -1006,6 +1007,9 @@ static int nsim_fib_event_schedule_work(struct nsim_fib_data *data, err_fib_prepare_event:kfree (fib_event); +err_fib_event_alloc: +if (event ==FIB_EVENT_ENTRY_DEL ) +schedule_work (&data->fib_flush_work);return NOTIFY_BAD ; }
@@ -1483,6 +1487,24 @@ static void nsim_fib_event_work(struct work_struct *work)mutex_unlock (&data->fib_lock); } +static void nsim_fib_flush_work (struct work_struct *work) +{ + struct nsim_fib_data *data = container_of(work, struct nsim_fib_data, + fib_flush_work); +struct nsim_fib_rt *fib_rt, *fib_rt_tmp; + +/* Process pending work. */ +flush_work (&data->fib_event_work); + +mutex_lock (&data->fib_lock); +list_for_each_entry_safe (fib_rt, fib_rt_tmp, &data->fib_rt_list, list) { +rhashtable_remove_fast (&data->fib_rt_ht, &fib_rt->ht_node, + nsim_fib_rt_ht_params); +nsim_fib_rt_free (fib_rt, data); + } +mutex_unlock (&data->fib_lock); +} +static int nsim_fib_debugfs_init (struct nsim_fib_data *data,struct nsim_dev *nsim_dev) {
@@ -1541,6 +1563,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink, goto err_rhashtable_nexthop_destroy;INIT_WORK (&data->fib_event_work, nsim_fib_event_work); +INIT_WORK (&data->fib_flush_work, nsim_fib_flush_work);INIT_LIST_HEAD (&data->fib_event_queue);spin_lock_init (&data->fib_event_queue_lock);
@@ -1587,6 +1610,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink *devlink, err_nexthop_nb_unregister:unregister_nexthop_notifier (devlink_net (devlink), &data->nexthop_nb); err_rhashtable_fib_destroy: +cancel_work_sync (&data->fib_flush_work);flush_work (&data->fib_event_work);rhashtable_free_and_destroy (&data->fib_rt_ht, nsim_fib_rt_free, data);
@@ -1616,6 +1640,7 @@ void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data) NSIM_RESOURCE_IPV4_FIB);unregister_fib_notifier (devlink_net (devlink), &data->fib_nb);unregister_nexthop_notifier (devlink_net (devlink), &data->nexthop_nb); +cancel_work_sync (&data->fib_flush_work);flush_work (&data->fib_event_work);rhashtable_free_and_destroy (&data->fib_rt_ht, nsim_fib_rt_free, data);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 562/1157 wifi: rtw88: check the return value of alloc_workqueue()
In reply to Greg Kroah-HartmanFrom: William Dean <[email protected]>
[ Upstream commit 42bbf810e155efc6129a3a648ae5300f00b79d7b ]
The function alloc_workqueue() in rtw_core_init() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code.
--- drivers/net/wireless/realtek/rtw88/main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/realtek/rtw88/main.c +4 -0
@@ -1984,6 +1984,10 @@ int rtw_core_init(struct rtw_dev *rtwdev)timer_setup (&rtwdev->tx_report.purge_timer, rtw_tx_report_purge_timer,0 ); rtwdev->tx_wq =alloc_workqueue ("rtw_tx_wq" ,WQ_UNBOUND |WQ_HIGHPRI ,0 ); +if (!rtwdev->tx_wq) { +rtw_warn (rtwdev,"alloc_workqueue rtw_tx_wq failed\n" ); +return -ENOMEM ; + }INIT_DELAYED_WORK (&rtwdev->watch_dog_work, rtw_watch_dog_work);INIT_DELAYED_WORK (&coex->bt_relink_work, rtw_coex_bt_relink_work);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 563/1157 iavf: Fix max_rate limiting
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
[ Upstream commit ec60d54cb9a3d43a02c5612a03093c18233e6601 ]
Fix max_rate option in TC, check for proper quanta boundaries. Check for minimum value provided and if it fits expected 50Mbps quanta.
Without this patch, iavf could send settings for max_rate limiting that would be accepted from by PF even the max_rate option is less than expected 50Mbps quanta. It results in no rate limiting on traffic as rate limiting will be floored to 0.
Example:
tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \
2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \max_rate 50Mbps 500Mbps 500Mbps
Should limit TC0 to circa 50 Mbps
tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \
2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \max_rate 0Mbps 100Kbit 500Mbps
Should return error
--- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
@@ -92,6 +92,7 @@ struct iavf_vsi {#define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4)#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)#define IAVF_MBPS_DIVISOR 125000/* divisor to convert to Mbps */ +#define IAVF_MBPS_QUANTA 50#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ (IAVF_MAX_VF_VSI * \
drivers/net/ethernet/intel/iavf/iavf_main.c +23 -2
@@ -3322,6 +3322,7 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter, struct tc_mqprio_qopt_offload *mqprio_qopt) {u64 total_max_rate =0 ; +u32 tx_rate_rem =0 ;int i, num_qps =0 ;u64 tx_rate =0 ;int ret =0 ;
@@ -3336,12 +3337,32 @@ static int iavf_validate_ch_config(struct iavf_adapter *adapter,return -EINVAL ;if (mqprio_qopt->min_rate[i]) {dev_err (&adapter->pdev->dev, -"Invalid min tx rate (greater than 0) specified\n" ); +"Invalid min tx rate (greater than 0) specified for TC%d\n" , + i);return -EINVAL ; } -/*convert to Mbps */ + +/* convert to Mbps */ tx_rate =div_u64 (mqprio_qopt->max_rate[i],IAVF_MBPS_DIVISOR ); + +if (mqprio_qopt->max_rate[i] && + tx_rate <IAVF_MBPS_QUANTA ) { +dev_err (&adapter->pdev->dev, +"Invalid max tx rate for TC%d, minimum %dMbps\n" , + i,IAVF_MBPS_QUANTA ); +return -EINVAL ; + } + + (void )div_u64_rem (tx_rate,IAVF_MBPS_QUANTA , &tx_rate_rem); + +if (tx_rate_rem !=0 ) { +dev_err (&adapter->pdev->dev, +"Invalid max tx rate for TC%d, not divisible by %d\n" , + i,IAVF_MBPS_QUANTA ); +return -EINVAL ; + } + total_max_rate += tx_rate; num_qps += mqprio_qopt->qopt.count[i]; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 564/1157 iavf: Fix tc qdisc show listing too many queues
In reply to Greg Kroah-HartmanFrom: Przemyslaw Patynowski <[email protected]>
[ Upstream commit 93cb804edab1b9a5bb7bb7b6824012dbb20abf22 ]
Fix tc qdisc show dev <ethX> root displaying too many fq_codel qdiscs.tc_modify_qdisc, which is caller of ndo_setup_tc, expects driver to callnetif_set_real_num_tx_queues, which prepares qdiscs.
Without this patch, fq_codel qdiscs would not be adjusted to number of
queues on VF.
e.g.:
tc qdisc show dev <ethX>
qdisc mq 0: root
qdisc fq_codel 0: parent :4 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :3 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :1 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 tc qdisc add dev <ethX> root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev <ethX>
qdisc mqprio 8003: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
queues:(0:0) (1:1)
mode:channel
shaper:bw_rlimit max_rate:5Gbit 150Mbit
qdisc fq_codel 0: parent 8003:4 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:3 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:1 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
While after fix:
tc qdisc add dev <ethX> root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev <ethX> #should show 2, shows 4
qdisc mqprio 8004: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
queues:(0:0) (1:1)
mode:channel
shaper:bw_rlimit max_rate:5Gbit 150Mbit
qdisc fq_codel 0: parent 8004:2 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8004:1 limit 10240p flows 1024 quantum 1514 target 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64
--- drivers/net/ethernet/intel/iavf/iavf.h | 5 +++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+)
drivers/net/ethernet/intel/iavf/iavf.h +5 -0
@@ -431,6 +431,11 @@ struct iavf_adapter {/* lock to protect access to the cloud filter list */ spinlock_t cloud_filter_list_lock;u16 num_cloud_filters; +/* snapshot of "num_active_queues" before setup_tc for qdisc add +* is invoked. This information is useful during qdisc del flow, +* to restore correct number of queues +*/ +int orig_num_active_queues;#define IAVF_MAX_FDIR_FILTERS 128/* max allowed Flow Director filters */ u16 fdir_active_fltr;
drivers/net/ethernet/intel/iavf/iavf_main.c +21 -0
@@ -3429,6 +3429,7 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data)netif_tx_disable (netdev);iavf_del_all_cloud_filters (adapter); adapter->aq_required =IAVF_FLAG_AQ_DISABLE_CHANNELS ; + total_qps = adapter->orig_num_active_queues; goto exit; }else {return -EINVAL ;
@@ -3472,7 +3473,21 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data) adapter->ch_config.ch_info[i].offset =0 ; } } + +/* Take snapshot of original config such as "num_active_queues" +* It is used later when delete ADQ flow is exercised, so that +* once delete ADQ flow completes, VF shall go back to its +* original queue configuration +*/ + + adapter->orig_num_active_queues = adapter->num_active_queues; + +/* Store queue info based on TC so that VF gets configured +* with correct number of queues when VF completes ADQ config +* flow +*/ adapter->ch_config.total_qps = total_qps; +netif_tx_stop_all_queues (netdev);netif_tx_disable (netdev); adapter->aq_required |=IAVF_FLAG_AQ_ENABLE_CHANNELS ;
@@ -3489,6 +3504,12 @@ static int __iavf_setup_tc(struct net_device *netdev, void *type_data) } } exit: +if (test_bit (__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) +return 0 ; + +netif_set_real_num_rx_queues (netdev, total_qps); +netif_set_real_num_tx_queues (netdev, total_qps); +return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 565/1157 netdevsim: Avoid allocation warnings triggered from user space
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit d0b80a9edb1a029ff913e81b47540e57ad034329 ]
We need to suppress warnings from sily map sizes. Also switch from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code.
--- drivers/net/netdevsim/bpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/netdevsim/bpf.c +5 -3
@@ -351,10 +351,12 @@ nsim_map_alloc_elem(struct bpf_offloaded_map *offmap, unsigned int idx) {struct nsim_bpf_bound_map *nmap = offmap->dev_priv; - nmap->entry[idx].key =kmalloc (offmap->map.key_size,GFP_USER ); + nmap->entry[idx].key =kmalloc (offmap->map.key_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].key)return -ENOMEM ; - nmap->entry[idx].value =kmalloc (offmap->map.value_size,GFP_USER ); + nmap->entry[idx].value =kmalloc (offmap->map.value_size, +GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (!nmap->entry[idx].value) {kfree (nmap->entry[idx].key); nmap->entry[idx].key =NULL ;
@@ -496,7 +498,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap)if (offmap->map.map_flags)return -EINVAL ; - nmap =kzalloc (sizeof (*nmap),GFP_USER ); + nmap =kzalloc (sizeof (*nmap),GFP_KERNEL_ACCOUNT );if (!nmap)return -ENOMEM ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 566/1157 net: rose: fix netdev reference changes
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 931027820e4dafabc78aff82af59f8c1c4bd3128 ]
Bernard reported that trying to unload rose module would lead to infamous messages:
unregistered_netdevice: waiting for rose0 to become free. Usage count = xx
This patch solves the issue, by making sure each socket referring to a netdevice holds a reference count on it, and properly releases it in rose_release().
rose_dev_first() is also fixed to take a device reference before leaving the rcu_read_locked section.
Following patch will add ref_tracker annotations to ease future bug hunting.
--- net/rose/af_rose.c | 11 +++++++++-- net/rose/rose_route.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-)
net/rose/af_rose.c +9 -2
@@ -192,6 +192,7 @@ static void rose_kill_by_device(struct net_device *dev)rose_disconnect (s,ENETUNREACH ,ROSE_OUT_OF_ORDER ,0 );if (rose->neighbour) rose->neighbour->use--; +dev_put (rose->device); rose->device =NULL ; } }
@@ -592,6 +593,8 @@ static struct sock *rose_make_new(struct sock *osk) rose->idle = orose->idle; rose->defer = orose->defer; rose->device = orose->device; +if (rose->device) +dev_hold (rose->device); rose->qbitincl = orose->qbitincl;return sk;
@@ -645,6 +648,7 @@ static int rose_release(struct socket *sock)break ; } +dev_put (rose->device); sock->sk =NULL ;release_sock (sk);sock_put (sk);
@@ -721,7 +725,6 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_lestruct rose_sock *rose =rose_sk (sk);struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr;unsigned char cause, diagnostic; -struct net_device *dev;ax25_uid_assoc *user;int n, err =0 ;
@@ -778,9 +781,12 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le }if (sock_flag (sk,SOCK_ZAPPED )) {/* Must bind first - autobinding in this may or may not work */ +struct net_device *dev; +sock_reset_flag (sk,SOCK_ZAPPED ); -if ((dev =rose_dev_first ()) ==NULL ) { + dev =rose_dev_first (); +if (!dev) { err = -ENETUNREACH ; goto out_release; }
@@ -788,6 +794,7 @@ static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_le user =ax25_findbyuid (current_euid ());if (!user) { err = -EINVAL ; +dev_put (dev); goto out_release; }
net/rose/rose_route.c +2 -0
@@ -615,6 +615,8 @@ struct net_device *rose_dev_first(void)if (first ==NULL ||strncmp (dev->name, first->name,3 ) <0 ) first = dev; } +if (first) +dev_hold (first);rcu_read_unlock ();return first;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 567/1157 net: ice: fix error NETIF_F_HW_VLAN_CTAG_FILTER check in ice_vsi_sync_fltr()
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit 7dc839fe47611e6995f370cae37b9797cf7d2672 ]
vsi->current_netdev_flags is used store the current net device flags, not the active netdevice features. So it should use vsi->netdev->featurs, rather than vsi->current_netdev_flags to check NETIF_F_HW_VLAN_CTAG_FILTER.
--- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_main.c +1 -1
@@ -433,7 +433,7 @@ static int ice_vsi_sync_fltr(struct ice_vsi *vsi)IFF_PROMISC ; goto out_promisc; } -if (vsi->current_netdev_flags & +if (vsi->netdev->features &NETIF_F_HW_VLAN_CTAG_FILTER ) vlan_ops->ena_rx_filtering (vsi); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 568/1157 net: ionic: fix error check for vlan flags in ionic_set_nic_features()
In reply to Greg Kroah-HartmanFrom: Jian Shen <[email protected]>
[ Upstream commit a86e86db5e6d72c82724a63ca1c5293409a21518 ]
The prototype of input features of ionic_set_nic_features() is netdev_features_t, but the vlan_flags is using the private definition of ionic drivers. It should use the variable ctx.cmd.lif_setattr.features, rather than features to check the vlan flags. So fixes it.
--- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -1
@@ -1437,7 +1437,7 @@ static int ionic_set_nic_features(struct ionic_lif *lif,if ((old_hw_features ^ lif->hw_features) &IONIC_ETH_HW_RX_HASH )ionic_lif_rss_config (lif, lif->rss_types,NULL ,NULL ); -if ((vlan_flags & features) && +if ((vlan_flags &le64_to_cpu (ctx.cmd.lif_setattr.features)) && !(vlan_flags &le64_to_cpu (ctx.comp.lif_setattr.features)))dev_info_once (lif->ionic->dev,"NIC is not supporting vlan offload, likely in SmartNIC mode\n" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 569/1157 dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit a41b17ff9dacd22f5f118ee53d82da0f3e52d5e3 ]
In the case of sk->dccps_qpolicy == DCCPQ_POLICY_PRIO, dccp_qpolicy_full will drop a skb when qpolicy is full. And the lock in dccp_sendmsg is released before sock_alloc_send_skb and then relocked after sock_alloc_send_skb. The following conditions may lead dccp_qpolicy_push to add skb to an already full sk_write_queue:
thread1--->lock
thread1--->dccp_qpolicy_full: queue is full. drop a skb thread1--->unlock
thread2--->lock
thread2--->dccp_qpolicy_full: queue is not full. no need to drop. thread2--->unlock
thread1--->lock
thread1--->dccp_qpolicy_push: add a skb. queue is full. thread1--->unlock
thread2--->lock
thread2--->dccp_qpolicy_push: add a skb! thread2--->unlock
Fix this by moving dccp_qpolicy_full.
--- net/dccp/proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/dccp/proto.c +5 -5
@@ -736,11 +736,6 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)lock_sock (sk); -if (dccp_qpolicy_full (sk)) { - rc = -EAGAIN ; - goto out_release; - } - timeo =sock_sndtimeo (sk, noblock);/*
@@ -759,6 +754,11 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)if (skb ==NULL ) goto out_release; +if (dccp_qpolicy_full (sk)) { + rc = -EAGAIN ; + goto out_discard; + } +if (sk->sk_state ==DCCP_CLOSED ) { rc = -ENOTCONN ; goto out_discard;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 570/1157 net: usb: make USB_RTL8153_ECM non user configurable
In reply to Greg Kroah-HartmanFrom: Maciej Żenczykowski <[email protected]>
[ Upstream commit f56530dcdb0684406661ac9f1accf48319d07600 ]
This refixes:
commit 7da17624e7948d5d9660b910f8079d26d26ce453
nt: usb: USB_RTL8153_ECM should not default to y
In general, device drivers should not be enabled by default.
which basically broke the commit it claimed to fix, ie:
commit 657bc1d10bfc23ac06d5d687ce45826c760744f9
r8153_ecm: avoid to be prior to r8152 driver
Avoid r8153_ecm is compiled as built-in, if r8152 driver is compiled as modules. Otherwise, the r8153_ecm would be used, even though the device is supported by r8152 driver.
this commit amounted to:
drivers/net/usb/Kconfig:
+config USB_RTL8153_ECM
+ tristate "RTL8153 ECM support" + depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=n) + default y + help + This option supports ECM mode for RTL8153 ethernet adapter, when + CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not + supported by r8152 driver.
drivers/net/usb/Makefile:
-obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o r8153_ecm.o +obj-$(CONFIG_USB_NET_CDCETHER) += cdc_ether.o +obj-$(CONFIG_USB_RTL8153_ECM) += r8153_ecm.o
And as can be seen it pulls a piece of the cdc_ether driver out into a separate config option to be able to make this piece modular in case cdc_ether is builtin, while r8152 is modular.
While in general, device drivers should indeed not be enabled by default:
this isn't a device driver per say, but rather this is support code for the CDCETHER (ECM) driver, and should thus be enabled if it is enabled.
See also email thread at:
https://www.spinics.net/lists/netdev/msg767649.html
In:
https://www.spinics.net/lists/netdev/msg768284.html
Jakub wrote:
And when we say "removed" we can just hide it from what's prompted to the user (whatever such internal options are called)? I believe this way we don't bring back Marek's complaint.
Side note: these incorrect defaults will result in Android 13 on 5.15 GKI kernels lacking USB_RTL8153_ECM support while having USB_NET_CDCETHER (luckily we also have USB_RTL8150 and USB_RTL8152, so it's probably only an issue for very new RTL815x hardware with no native 5.15 driver).
--- drivers/net/usb/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/Kconfig +2 -1
@@ -637,8 +637,9 @@ config USB_NET_AQC111 * Aquantia AQtion USB to 5GbE config USB_RTL8153_ECM - tristate "RTL8153 ECM support" + tristate depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=n) + default y help This option supports ECM mode for RTL8153 ethernet adapter, when CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 571/1157 net/mlx5e: xsk: Discard unaligned XSK frames on striding RQ
In reply to Greg Kroah-HartmanFrom: Maxim Mikityanskiy <[email protected]>
[ Upstream commit 8eaa1d110800fac050bab44001732747a1c39894 ]
Striding RQ uses MTT page mapping, where each page corresponds to an XSK frame. MTT pages have alignment requirements, and XSK frames don't have any alignment guarantees in the unaligned mode. Frames with improper alignment must be discarded, otherwise the packet data will be written at a wrong address.
--- .../net/ethernet/mellanox/mlx5/core/en/xsk/rx.h | 14 ++++++++++++++ include/net/xdp_sock_drv.h | 11 +++++++++++ 2 files changed, 25 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.h +14 -0
@@ -7,6 +7,8 @@#include "en.h" #include <net/xdp_sock_drv.h> +#define MLX5E_MTT_PTAG_MASK 0xfffffffffffffff8ULL +/* RX data path */ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
@@ -21,6 +23,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,static inline int mlx5e_xsk_page_alloc_pool (struct mlx5e_rq *rq,struct mlx5e_dma_info *dma_info) { +retry: dma_info->xsk =xsk_buff_alloc (rq->xsk_pool);if (!dma_info->xsk)return -ENOMEM ;
@@ -32,6 +35,17 @@ static inline int mlx5e_xsk_page_alloc_pool(struct mlx5e_rq *rq,*/ dma_info->addr =xsk_buff_xdp_get_frame_dma (dma_info->xsk); +/* MTT page mapping has alignment requirements. If they are not +* satisfied, leak the descriptor so that it won't come again, and try +* to allocate a new one. +*/ +if (rq->wq_type ==MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ ) { +if (unlikely (dma_info->addr & ~MLX5E_MTT_PTAG_MASK )) { +xsk_buff_discard (dma_info->xsk); + goto retry; + } + } +return 0 ; }
include/net/xdp_sock_drv.h +11 -0
@@ -95,6 +95,13 @@ static inline void xsk_buff_free(struct xdp_buff *xdp)xp_free (xskb); } +static inline void xsk_buff_discard (struct xdp_buff *xdp) +{ + struct xdp_buff_xsk *xskb = container_of(xdp, struct xdp_buff_xsk, xdp); + +xp_release (xskb); +} +static inline void xsk_buff_set_size (struct xdp_buff *xdp,u32 size) { xdp->data = xdp->data_hard_start +XDP_PACKET_HEADROOM ;
@@ -238,6 +245,10 @@ static inline void xsk_buff_free(struct xdp_buff *xdp) { } +static inline void xsk_buff_discard (struct xdp_buff *xdp) +{ +} +static inline void xsk_buff_set_size (struct xdp_buff *xdp,u32 size) { }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 572/1157 wireguard: ratelimiter: use hrtimer in selftest
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 151c8e499f4705010780189377f85b57400ccbf5 ]
Using msleep() is problematic because it's compared against ratelimiter.c's ktime_get_coarse_boottime_ns(), which means on systems with slow jiffies (such as UML's forced HZ=100), the result is inaccurate. So switch to using schedule_hrtimeout().
However, hrtimer gives us access only to the traditional posix timers, and none of the _COARSE variants. So now, rather than being too imprecise like jiffies, it's too precise.
One solution would be to give it a large "range" value, but this will still fire early on a loaded system. A better solution is to align the timeout to the actual coarse timer, and then round up to the nearest tick, plus change.
So add the timeout to the current coarse time, and then schedule_hrtimer() until the absolute computed time.
This should hopefully reduce flakes in CI as well. Note that we keep the retry loop in case the entire function is running behind, because the test could still be scheduled out, by either the kernel or by the hypervisor's kernel, in which case restarting the test and hoping to not be scheduled out still helps.
--- drivers/net/wireguard/selftest/ratelimiter.c | 25 +++++++++++--------- kernel/time/hrtimer.c | 1 + 2 files changed, 15 insertions(+), 11 deletions(-)
drivers/net/wireguard/selftest/ratelimiter.c +14 -11
@@ -6,28 +6,29 @@#ifdef DEBUG #include <linux/jiffies.h> +#include <linux/hrtimer.h> static const struct {bool result; -unsigned int msec_to_sleep_before; +u64 nsec_to_sleep_before; } expected_results[]__initconst = { [0 ...PACKETS_BURSTABLE -1 ] = { true,0 }, [PACKETS_BURSTABLE ] = { false,0 }, - [PACKETS_BURSTABLE +1 ] = { true,MSEC_PER_SEC /PACKETS_PER_SECOND }, + [PACKETS_BURSTABLE +1 ] = { true,NSEC_PER_SEC /PACKETS_PER_SECOND }, [PACKETS_BURSTABLE +2 ] = { false,0 }, - [PACKETS_BURSTABLE +3 ] = { true, (MSEC_PER_SEC /PACKETS_PER_SECOND ) *2 }, + [PACKETS_BURSTABLE +3 ] = { true, (NSEC_PER_SEC /PACKETS_PER_SECOND ) *2 }, [PACKETS_BURSTABLE +4 ] = { true,0 }, [PACKETS_BURSTABLE +5 ] = { false,0 } };static __init unsigned int maximum_jiffies_at_index (int index) { -unsigned int total_msecs =2 *MSEC_PER_SEC /PACKETS_PER_SECOND /3 ; +u64 total_nsecs =2 *NSEC_PER_SEC /PACKETS_PER_SECOND /3 ;int i;for (i =0 ; i <= index; ++i) - total_msecs += expected_results[i].msec_to_sleep_before; -return msecs_to_jiffies (total_msecs); + total_nsecs += expected_results[i].nsec_to_sleep_before; +return nsecs_to_jiffies (total_nsecs); } static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4,
@@ -42,8 +43,12 @@ static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, loop_start_time = jiffies;for (i =0 ; i <ARRAY_SIZE (expected_results); ++i) { -if (expected_results[i].msec_to_sleep_before) -msleep (expected_results[i].msec_to_sleep_before); +if (expected_results[i].nsec_to_sleep_before) { +ktime_t timeout =ktime_add (ktime_add_ns (ktime_get_coarse_boottime (),TICK_NSEC *4 /3 ), +ns_to_ktime (expected_results[i].nsec_to_sleep_before)); +set_current_state (TASK_UNINTERRUPTIBLE ); +schedule_hrtimeout_range_clock (&timeout,0 ,HRTIMER_MODE_ABS ,CLOCK_BOOTTIME ); + }if (time_is_before_jiffies (loop_start_time +maximum_jiffies_at_index (i)))
@@ -127,7 +132,7 @@ bool __init wg_ratelimiter_selftest(void)if (IS_ENABLED (CONFIG_KASAN ) ||IS_ENABLED (CONFIG_UBSAN ))return true; -BUILD_BUG_ON (MSEC_PER_SEC %PACKETS_PER_SECOND !=0 ); +BUILD_BUG_ON (NSEC_PER_SEC %PACKETS_PER_SECOND !=0 );if (wg_ratelimiter_init ()) goto out;
@@ -176,7 +181,6 @@ bool __init wg_ratelimiter_selftest(void) test += test_count; goto err; } -msleep (500 );continue ; }else if (ret <0 ) { test += test_count;
@@ -195,7 +199,6 @@ bool __init wg_ratelimiter_selftest(void) test += test_count; goto err; } -msleep (50 );continue ; } test += test_count;
kernel/time/hrtimer.c +1 -0
@@ -2311,6 +2311,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,return !t.task ?0 : -EINTR ; } +EXPORT_SYMBOL_GPL (schedule_hrtimeout_range_clock);/** * schedule_hrtimeout_range - sleep until timeout
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 573/1157 wireguard: allowedips: dont corrupt stack when detecting overflow
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit c31b14d86dfe7174361e8c6e5df6c2c3a4d5918c ]
In case push_rcu() and related functions are buggy, there's a WARN_ON(len >= 128), which the selftest tries to hit by being tricky. In case it is hit, we shouldn't corrupt the kernel's stack, though; otherwise it may be hard to even receive the report that it's buggy. So conditionalize the stack write based on that WARN_ON()'s return value.
Note that this never *actually* happens anyway. The WARN_ON() in the first place is bounded by IS_ENABLED(DEBUG), and isn't expected to ever actually hit. This is just a debugging sanity check.
Additionally, hoist the constant 128 into a named enum, MAX_ALLOWEDIPS_BITS, so that it's clear why this value is chosen.
--- drivers/net/wireguard/allowedips.c | 9 ++++++--- drivers/net/wireguard/selftest/allowedips.c | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/net/wireguard/allowedips.c +6 -3
@@ -6,6 +6,8 @@#include "allowedips.h" #include "peer.h" +enum {MAX_ALLOWEDIPS_BITS =128 }; +static struct kmem_cache *node_cache;static void swap_endian (u8 *dst,const u8 *src,u8 bits)
@@ -40,7 +42,8 @@ static void push_rcu(struct allowedips_node **stack, struct allowedips_node __rcu *p, unsigned int *len) { if (rcu_access_pointer(p)) { - WARN_ON(IS_ENABLED(DEBUG) && *len >= 128); + if (WARN_ON(IS_ENABLED(DEBUG) && *len >= MAX_ALLOWEDIPS_BITS)) + return; stack[(*len)++] =rcu_dereference_raw (p); } }
@@ -52,7 +55,7 @@ static void node_free_rcu(struct rcu_head *rcu)static void root_free_rcu (struct rcu_head *rcu) { -struct allowedips_node *node, *stack[128 ] = { +struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS ] = { container_of(rcu, struct allowedips_node, rcu) };unsigned int len =1 ;
@@ -65,7 +68,7 @@ static void root_free_rcu(struct rcu_head *rcu)static void root_remove_peer_lists (struct allowedips_node *root) { -struct allowedips_node *node, *stack[128 ] = { root }; +struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS ] = { root };unsigned int len =1 ;while (len >0 && (node = stack[--len])) {
drivers/net/wireguard/selftest/allowedips.c +3 -3
@@ -593,10 +593,10 @@ bool __init wg_allowedips_selftest(void)wg_allowedips_remove_by_peer (&t, a, &mutex);test_negative (4 , a,192 ,168 ,0 ,1 ); -/* These will hit the WARN_ON(len >= 128) in free_node if something -* goes wrong. +/* These will hit the WARN_ON(len >= MAX_ALLOWEDIPS_BITS) in free_node +* if something goes wrong. */ -for (i =0 ; i <128 ; ++i) { +for (i =0 ; i <MAX_ALLOWEDIPS_BITS ; ++i) { part =cpu_to_be64 (~(1LLU << (i %64 )));memset (&ip,0xff ,16 );memcpy ((u8 *)&ip + (i <64 ) *8 , &part,8 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 574/1157 HID: amd_sfh: Dont show client init failed as error when discovery fails
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit e51d8d3ea3d773334d2c047c8d1623dba66f592a ]
When sensor discovery fails, this means that the system doesn't have any sensors connected and a user should only be notified at most one time. A message is already displayed at WARN level of "failed to discover, sensors not enabled". It's pointless to show that the client init failed at ERR level for the same condition.
Check the return code and don't display this message in those conditions.
--- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +2 -1
@@ -327,7 +327,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i rc =amd_sfh_hid_client_init (privdata);if (rc) {amd_sfh_clear_intr (privdata); -dev_err (&pdev->dev,"amd_sfh_hid_client_init failed\n" ); +if (rc != -EOPNOTSUPP ) +dev_err (&pdev->dev,"amd_sfh_hid_client_init failed\n" );return rc; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 575/1157 clk: renesas: r9a06g032: Fix UART clkgrp bitsel
In reply to Greg Kroah-HartmanFrom: Ralph Siemsen <[email protected]>
[ Upstream commit 2dee50ab9e72a3cae75b65e5934c8dd3e9bf01bc ]
There are two UART clock groups, each having a mux to select its upstream clock source. The register/bit definitions for accessing these two muxes appear to have been reversed since introduction. Correct them so as to match the hardware manual.
--- drivers/clk/renesas/r9a06g032-clocks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/r9a06g032-clocks.c +4 -4
@@ -290,8 +290,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] = { .name = "uart_group_012", .type = K_BITSEL, .source = 1 + R9A06G032_DIV_UART, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ - .dual.sel = ((0xec / 4) << 5) | 24, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ + .dual.sel = ((0x34 / 4) << 5) | 30, .dual.group = 0, }, {
@@ -299,8 +299,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[] = { .name = "uart_group_34567", .type = K_BITSEL, .source = 1 + R9A06G032_DIV_P2_PG, -/* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ - .dual.sel = ((0x34 / 4) << 5) | 30, +/* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ + .dual.sel = ((0xec / 4) << 5) | 24, .dual.group =1 , }, D_UGATE(CLK_UART0, "clk_uart0", UART_GROUP_012, 0, 0, 0x1b2, 0x1b3, 0x1b4, 0x1b5),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 576/1157 mtd: maps: Fix refcount leak in of_flash_probe_versatile
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ]
of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap-versatile.c +1 -0
@@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, versatile_flashprot = (enum versatile_flashprot )devid->data; rmap =syscon_node_to_regmap (sysnp); +of_node_put (sysnp);if (IS_ERR (rmap))return PTR_ERR (rmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 577/1157 mtd: maps: Fix refcount leak in ap_flash_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 77087a04c8fd554134bddcb8a9ff87b21f357926 ]
of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak.
--- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/maps/physmap-versatile.c +1 -0
@@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev)return -ENODEV ; } ebi_base =of_iomap (ebi,0 ); +of_node_put (ebi);if (!ebi_base)return -ENODEV ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 578/1157 mtd: rawnand: meson: Fix a potential double free issue
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ec0da06337751b18f6dee06b6526e0f0d6e80369 ]
When meson_nfc_nand_chip_cleanup() is called, it will call:
meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand);
nand_cleanup() in turn will call nand_detach() which calls the .detach_chip() which is here meson_nand_detach_chip().
meson_nand_detach_chip() already calls meson_nfc_free_buffer(), so we could double free some memory.
Fix it by removing the unneeded explicit call to meson_nfc_free_buffer().
--- drivers/mtd/nand/raw/meson_nand.c | 1 - 1 file changed, 1 deletion(-)
drivers/mtd/nand/raw/meson_nand.c +0 -1
@@ -1307,7 +1307,6 @@ static int meson_nfc_nand_chip_cleanup(struct meson_nfc *nfc)if (ret)return ret; -meson_nfc_free_buffer (&meson_chip->nand);nand_cleanup (&meson_chip->nand);list_del (&meson_chip->node); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 579/1157 clk: renesas: rzg2l: Fix reset status function
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 02c96ed9e4cd1f47bfcd10296fec6b0b69d6b3c6 ]
As per RZ/G2L HW(Rev.1.10) manual, reset monitor register value 0 means reset signal is not applied (deassert state) and 1 means reset signal is applied (assert state).
reset_control_status() expects a positive value if the reset line is asserted. But rzg2l_cpg_status function returns zero for asserted state.
This patch fixes the issue by adding double inverted logic, so that reset_control_status returns a positive value if the reset line is asserted.
--- drivers/clk/renesas/rzg2l-cpg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/renesas/rzg2l-cpg.c +1 -1
@@ -1180,7 +1180,7 @@ static int rzg2l_cpg_status(struct reset_controller_dev *rcdev,s8 monbit = info->resets[id].monbit;if (info->has_clk_mon_regs) { -return !(readl (priv->base +CLK_MRST_R (reg)) & bitmask); +return !!(readl (priv->base +CLK_MRST_R (reg)) & bitmask); }else if (monbit >=0 ) {u32 monbitmask =BIT (monbit);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 580/1157 of: check previous kernels ima-kexec-buffer against memory bounds
In reply to Greg Kroah-HartmanFrom: Vaibhav Jain <[email protected]>
[ Upstream commit cbf9c4b9617b6767886a913705ca14b7600c77db ]
Presently ima_get_kexec_buffer() doesn't check if the previous kernel's ima-kexec-buffer lies outside the addressable memory range. This can result in a kernel panic if the new kernel is booted with 'mem=X' arg and the ima-kexec-buffer was allocated beyond that range by the previous kernel. The panic is usually of the form below:
$ sudo kexec --initrd initrd vmlinux --append='mem=16G'
<snip>
BUG: Unable to handle kernel data access on read at 0xc000c01fff7f0000 Faulting instruction address: 0xc000000000837974 Oops: Kernel access of bad area, sig: 11 [#1] <snip> NIP [c000000000837974] ima_restore_measurement_list+0x94/0x6c0 LR [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 Call Trace: [c00000000371fa80] [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 [c00000000371fb00] [c0000000020512c4] ima_init+0x80/0x108 [c00000000371fb70] [c0000000020514dc] init_ima+0x4c/0x120 [c00000000371fbf0] [c000000000012240] do_one_initcall+0x60/0x2c0 [c00000000371fcc0] [c000000002004ad0] kernel_init_freeable+0x344/0x3ec [c00000000371fda0] [c0000000000128a4] kernel_init+0x34/0x1b0 [c00000000371fe10] [c00000000000ce64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: f92100b8 f92100c0 90e10090 910100a0 4182050c 282a0017 3bc00000 40810330 7c0802a6 fb610198 7c9b2378 f80101d0 <a1240000> 2c090001 40820614 e9240010 ---[ end trace 0000000000000000 ]---
Fix this issue by checking returned PFN range of previous kernel's ima-kexec-buffer with page_is_ram() to ensure correct memory bounds.
--- drivers/of/kexec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/of/kexec.c +17 -0
@@ -126,6 +126,7 @@ int ima_get_kexec_buffer(void **addr, size_t *size) {int ret, len;unsigned long tmp_addr; +unsigned long start_pfn, end_pfn;size_t tmp_size;const void *prop;
@@ -140,6 +141,22 @@ int ima_get_kexec_buffer(void **addr, size_t *size)if (ret)return ret; +/* Do some sanity on the returned size for the ima-kexec buffer */ +if (!tmp_size) +return -ENOENT ; + +/* +* Calculate the PFNs for the buffer and ensure +* they are with in addressable memory. +*/ + start_pfn =PHYS_PFN (tmp_addr); + end_pfn =PHYS_PFN (tmp_addr + tmp_size -1 ); +if (!page_is_ram (start_pfn) || !page_is_ram (end_pfn)) { +pr_warn ("IMA buffer at 0x%lx, size = 0x%zx beyond memory\n" , + tmp_addr, tmp_size); +return -EINVAL ; + } + *addr =__va (tmp_addr); *size = tmp_size;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 581/1157 scsi: qla2xxx: edif: Reduce Initiator-Initiator thrashing
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 9c40c36e75ffd49952cd4ead0672defc4b4dbdf7 ]
This patch uses GFFID switch command to scan whether remote device is Target or Initiator mode. Based on that info, driver will not pass up Initiator info to authentication application. This helps reduce unnecessary stress for authentication application to deal with unused connections.
--- drivers/scsi/qla2xxx/qla_def.h | 2 + drivers/scsi/qla2xxx/qla_edif.c | 32 ++++++++- drivers/scsi/qla2xxx/qla_gbl.h | 3 +- drivers/scsi/qla2xxx/qla_gs.c | 118 +++++++++++++++++++++++--------- drivers/scsi/qla2xxx/qla_iocb.c | 2 +- 5 files changed, 120 insertions(+), 37 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
@@ -3204,6 +3204,8 @@ struct ct_sns_rsp {#define GFF_NVME_OFFSET 23/* type = 28h */ struct {uint8_t fc4_features[128 ]; +#define FC4_FF_TARGET BIT_0 +#define FC4_FF_INITIATOR BIT_1 } gff_id;struct {uint8_t reserved;
drivers/scsi/qla2xxx/qla_edif.c +29 -3
@@ -517,16 +517,28 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job)if (atomic_read (&vha->loop_state) ==LOOP_DOWN )break ; - fcport->edif.app_started =1 ; fcport->login_retry = vha->hw->login_retry_count; -/* no activity */ fcport->edif.app_stop =0 ; + fcport->edif.app_sess_online =0 ; + fcport->edif.app_started =1 ; + +if (fcport->scan_state !=QLA_FCPORT_FOUND ) +continue ; + +if (fcport->port_type ==FCT_UNKNOWN && + !fcport->fc4_features) + rval =qla24xx_async_gffid (vha, fcport, true); + +if (!rval && !(fcport->fc4_features &FC4_FF_TARGET || + fcport->port_type & (FCT_TARGET |FCT_NVME_TARGET ))) +continue ; + + rval =0 ;ql_dbg (ql_dbg_edif, vha,0x911e ,"%s wwpn %8phC calling qla_edif_reset_auth_wait\n" , __func__, fcport->port_name); - fcport->edif.app_sess_online =0 ;qlt_schedule_sess_for_deletion (fcport);qla_edif_sa_ctl_init (vha, fcport); }
@@ -883,6 +895,20 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job) app_reply->ports[pcnt].rekey_count = fcport->edif.rekey_cnt; +if (fcport->scan_state !=QLA_FCPORT_FOUND ) +continue ; + +if (fcport->port_type ==FCT_UNKNOWN && !fcport->fc4_features) + rval =qla24xx_async_gffid (vha, fcport, true); + +if (!rval && + !(fcport->fc4_features &FC4_FF_TARGET || + fcport->port_type & + (FCT_TARGET |FCT_NVME_TARGET ))) +continue ; + + rval =0 ; + app_reply->ports[pcnt].remote_type =VND_CMD_RTYPE_UNKNOWN ;if (fcport->port_type & (FCT_NVME_TARGET |FCT_TARGET ))
drivers/scsi/qla2xxx/qla_gbl.h +2 -1
@@ -335,6 +335,7 @@ extern int qla24xx_configure_prot_mode(srb_t *, uint16_t *);extern int qla24xx_issue_sa_replace_iocb (scsi_qla_host_t *vha,struct qla_work_evt *e);void qla2x00_sp_release (struct kref *kref); +void qla2x00_els_dcmd2_iocb_timeout (void *data);/* * Global Function Prototypes in qla_mbx.c source file.
@@ -727,7 +728,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);void qla24xx_handle_gpsc_event (scsi_qla_host_t *,struct event_arg *);int qla2x00_mgmt_svr_login (scsi_qla_host_t *);void qla24xx_handle_gffid_event (scsi_qla_host_t *vha,struct event_arg *ea); -int qla24xx_async_gffid (scsi_qla_host_t *vha,fc_port_t *fcport); +int qla24xx_async_gffid (scsi_qla_host_t *vha,fc_port_t *fcport,bool );int qla24xx_async_gpnft (scsi_qla_host_t *,u8 ,srb_t *);void qla24xx_async_gpnft_done (scsi_qla_host_t *,srb_t *);void qla24xx_async_gnnft_done (scsi_qla_host_t *,srb_t *);
drivers/scsi/qla2xxx/qla_gs.c +86 -32
182 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_iocb.c +1 -1
@@ -2819,7 +2819,7 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) sp->vha->qla_stats.control_requests++; } -static void +void qla2x00_els_dcmd2_iocb_timeout (void *data) {srb_t *sp = data;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 582/1157 scsi: qla2xxx: edif: bsg refactor
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 7a7b0b4865d3490f62d6ef1a3aa39fa2b47859a4 ]
- Add version field to edif bsg for future enhancement.
- Add version edif bsg version check
- Remove unused interfaces and fields.
--- drivers/scsi/qla2xxx/qla_edif.c | 32 +++++++--- drivers/scsi/qla2xxx/qla_edif_bsg.h | 90 ++++++++++++++++++----------- 2 files changed, 79 insertions(+), 43 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +23 -9
@@ -280,14 +280,19 @@ qla_edif_app_check(scsi_qla_host_t *vha, struct app_id appid) {/* check that the app is allow/known to the driver */ -if (appid.app_vid ==EDIF_APP_ID ) { -ql_dbg (ql_dbg_edif + ql_dbg_verbose, vha,0x911d ,"%s app id ok\n" , __func__); -return true; +if (appid.app_vid !=EDIF_APP_ID ) { +ql_dbg (ql_dbg_edif, vha,0x911d ,"%s app id not ok (%x)" , + __func__, appid.app_vid); +return false; + } + +if (appid.version !=EDIF_VERSION1 ) { +ql_dbg (ql_dbg_edif, vha,0x911d ,"%s app version is not ok (%x)" , + __func__, appid.version); +return false; } -ql_dbg (ql_dbg_edif, vha,0x911d ,"%s app id not ok (%x)" , - __func__, appid.app_vid); -return false; +return true; } static void
@@ -555,6 +560,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job) appreply.host_support_edif = vha->hw->flags.edif_enabled; appreply.edif_enode_active = vha->pur_cinfo.enode_flags; appreply.edif_edb_active = vha->e_dbell.db_flags; + appreply.version =EDIF_VERSION1 ; bsg_job->reply_len =sizeof (struct fc_bsg_reply );
@@ -684,6 +690,7 @@ qla_edif_app_authok(scsi_qla_host_t *vha, struct bsg_job *bsg_job) portid.b.area = appplogiok.u.d_id.b.area; portid.b.al_pa = appplogiok.u.d_id.b.al_pa; + appplogireply.version =EDIF_VERSION1 ;switch (appplogiok.type) {case PL_TYPE_WWPN : fcport = qla2x00_find_fcport_by_wwpn(vha,
@@ -876,6 +883,8 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job) }else {struct fc_port *fcport =NULL , *tf; + app_reply->version =EDIF_VERSION1 ; +list_for_each_entry_safe (fcport, tf, &vha->vp_fcports, list) {if (!(fcport->flags &FCF_FCSP_DEVICE ))continue ;
@@ -892,9 +901,6 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)if (tdid.b24 !=0 && tdid.b24 != fcport->d_id.b24)continue ; - app_reply->ports[pcnt].rekey_count = - fcport->edif.rekey_cnt; -if (fcport->scan_state !=QLA_FCPORT_FOUND )continue ;
@@ -909,6 +915,7 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job) rval =0 ; + app_reply->ports[pcnt].version =EDIF_VERSION1 ; app_reply->ports[pcnt].remote_type =VND_CMD_RTYPE_UNKNOWN ;if (fcport->port_type & (FCT_NVME_TARGET |FCT_TARGET ))
@@ -1005,6 +1012,8 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, struct bsg_job *bsg_job) }else {struct fc_port *fcport =NULL , *tf; + app_reply->version =EDIF_VERSION1 ; +list_for_each_entry_safe (fcport, tf, &vha->vp_fcports, list) {if (fcport->edif.enable) {if (pcnt > app_req.num_ports)
@@ -2036,6 +2045,7 @@ qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t dbtype, edbnode->u.sa_aen.port_id = fcport->d_id; edbnode->u.sa_aen.status = data; edbnode->u.sa_aen.key_type = data2; + edbnode->u.sa_aen.version =EDIF_VERSION1 ;break ;default : ql_dbg(ql_dbg_edif, vha, 0x09102,
@@ -3379,6 +3389,10 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job)port_id_t d_id;struct qla_bsg_auth_els_request *p = (struct qla_bsg_auth_els_request *)bsg_job->request; +struct qla_bsg_auth_els_reply *rpl = + (struct qla_bsg_auth_els_reply *)bsg_job->reply; + + rpl->version =EDIF_VERSION1 ; d_id.b.al_pa = bsg_request->rqst_data.h_els.port_id[2 ]; d_id.b.area = bsg_request->rqst_data.h_els.port_id[1 ];
drivers/scsi/qla2xxx/qla_edif_bsg.h +56 -34
192 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 583/1157 scsi: qla2xxx: edif: Wait for app to ack on sess down
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit df648afa39da9c4d3af99c6c03dc3e9c7dfa99b0 ]
On session deletion, wait for app to acknowledge before moving on. This allows both app and driver to stay in sync. In addition, this gives a chance for authentication app to do any type of cleanup before moving on.
--- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/scsi/qla2xxx/qla_edif.c | 66 +++++++++++++++++++++++++------ drivers/scsi/qla2xxx/qla_init.c | 4 -- drivers/scsi/qla2xxx/qla_target.c | 35 ++++++++-------- 4 files changed, 74 insertions(+), 33 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -1
@@ -2626,7 +2626,6 @@ typedef struct fc_port {struct {uint32_t enable:1 ;/* device is edif enabled/req'd */ uint32_t app_stop:2 ; -uint32_t app_started:1 ;uint32_t aes_gmac:1 ;uint32_t app_sess_online:1 ;uint32_t tx_sa_set:1 ;
@@ -2637,6 +2636,7 @@ typedef struct fc_port {uint32_t rx_rekey_cnt;uint64_t tx_bytes;uint64_t rx_bytes; +uint8_t sess_down_acked;uint8_t auth_state; uint16_t authok:1;uint16_t rekey_cnt;
drivers/scsi/qla2xxx/qla_edif.c +54 -12
110 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_init.c +0 -4
@@ -1480,7 +1480,6 @@ static int qla_chk_secure_login(scsi_qla_host_t *vha, fc_port_t *fcport,ql_dbg (ql_dbg_disc, vha,0x20ef ,"%s %d %8phC EDIF: post DB_AUTH: AUTH needed\n" , __func__, __LINE__, fcport->port_name); - fcport->edif.app_started =1 ; fcport->edif.app_sess_online =1 ; qla_edb_eventcreate(vha, VND_CMD_AUTH_STATE_NEEDED,
@@ -5275,9 +5274,6 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)INIT_LIST_HEAD (&fcport->edif.tx_sa_list);INIT_LIST_HEAD (&fcport->edif.rx_sa_list); -if (vha->e_dbell.db_flags ==EDB_ACTIVE ) - fcport->edif.app_started =1 ; -spin_lock_init (&fcport->edif.indx_list_lock);INIT_LIST_HEAD (&fcport->edif.edif_indx_list);
drivers/scsi/qla2xxx/qla_target.c +19 -16
@@ -981,22 +981,6 @@ void qlt_free_session_done(struct work_struct *work) sess->send_els_logo);if (!IS_SW_RESV_ADDR (sess->d_id)) { -if (ha->flags.edif_enabled && - (!own || own->iocb.u.isp24.status_subcode ==ELS_PLOGI )) { - sess->edif.authok =0 ; -if (!ha->flags.host_shutting_down) { -ql_dbg (ql_dbg_edif, vha,0x911e , -"%s wwpn %8phC calling qla2x00_release_all_sadb\n" , - __func__, sess->port_name); -qla2x00_release_all_sadb (vha, sess); - }else { -ql_dbg (ql_dbg_edif, vha,0x911e , -"%s bypassing release_all_sadb\n" , - __func__); - } -qla_edif_clear_appdata (vha, sess); -qla_edif_sess_down (vha, sess); - }qla2x00_mark_device_lost (vha, sess,0 );if (sess->send_els_logo) {
@@ -1042,6 +1026,25 @@ void qlt_free_session_done(struct work_struct *work) sess->nvme_flag |=NVME_FLAG_DELETING ;qla_nvme_unregister_remote_port (sess); } + +if (ha->flags.edif_enabled && + (!own || (own && + own->iocb.u.isp24.status_subcode ==ELS_PLOGI ))) { + sess->edif.authok =0 ; +if (!ha->flags.host_shutting_down) { +ql_dbg (ql_dbg_edif, vha,0x911e , +"%s wwpn %8phC calling qla2x00_release_all_sadb\n" , + __func__, sess->port_name); +qla2x00_release_all_sadb (vha, sess); + }else { +ql_dbg (ql_dbg_edif, vha,0x911e , +"%s bypassing release_all_sadb\n" , + __func__); + } + +qla_edif_clear_appdata (vha, sess); +qla_edif_sess_down (vha, sess); + } }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 584/1157 scsi: qla2xxx: edif: Add bsg interface to read doorbell events
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit 5ecd241bd7b1088a189581c0b560a13fe93621f6 ]
Add bsg interface for app to read doorbell events. This interface lets driver know how much app can read based on return buffer size. When the next event(s) occur, driver will return the bsg_job with the event(s) in the return buffer.
If there is no event to read, driver will hold on to the bsg_job up to few seconds as a way to control the polling interval.
--- drivers/scsi/qla2xxx/qla_dbg.h | 2 +- drivers/scsi/qla2xxx/qla_edif.c | 249 ++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_edif.h | 3 +- drivers/scsi/qla2xxx/qla_edif_bsg.h | 14 ++ 4 files changed, 195 insertions(+), 73 deletions(-)
drivers/scsi/qla2xxx/qla_dbg.h +1 -1
@@ -383,5 +383,5 @@ ql_mask_match(uint level)if (ql2xextended_error_logging ==1 ) ql2xextended_error_logging =QL_DBG_DEFAULT1_MASK ; -return (level & ql2xextended_error_logging) == level; +return level && ((level & ql2xextended_error_logging) == level); }
drivers/scsi/qla2xxx/qla_edif.c +178 -71
345 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_edif.h +2 -1
@@ -51,7 +51,8 @@ struct edif_dbell {enum db_flags_t db_flags;spinlock_t db_lock;struct list_head head; -struct completion dbell; +struct bsg_job *dbell_bsg_job; +unsigned long bsg_expire; };#define SA_UPDATE_IOCB_TYPE 0x71/* Security Association Update IOCB entry */
drivers/scsi/qla2xxx/qla_edif_bsg.h +14 -0
@@ -183,6 +183,20 @@ struct qla_sa_update_frame {#define QL_VND_SC_GET_FCINFO 7#define QL_VND_SC_GET_STATS 8#define QL_VND_SC_AEN_COMPLETE 9 +#define QL_VND_SC_READ_DBELL 10 + +/* +* bsg caller to provide empty buffer for doorbell events. +* +* sg_io_v4.din_xferp = empty buffer for door bell events +* sg_io_v4.dout_xferp = struct edif_read_dbell *buf +*/ +struct edif_read_dbell { +struct app_id app_info; +uint8_t version; +uint8_t pad[VND_CMD_PAD_SIZE ]; +uint8_t reserved[VND_CMD_APP_RESERVED_SIZE ]; +};/* Application interface data structure for rtn data */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 585/1157 scsi: qla2xxx: edif: Fix potential stuck session in sa update
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit e0fb8ce2bb9e52c846e54ad2c58b5b7beb13eb09 ]
When a thread is in the process of reestablish a session, a flag is set to prevent multiple threads/triggers from doing the same task. This flag was left on, and any attempt to relogin was locked out. Clear this flag if the attempt has failed.
--- drivers/scsi/qla2xxx/qla_edif.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +14 -3
@@ -2331,6 +2331,7 @@ edif_doorbell_show(struct device *dev, struct device_attribute *attr,static void qla_noop_sp_done (srb_t *sp,int res) { + sp->fcport->flags &= ~(FCF_ASYNC_SENT |FCF_ASYNC_ACTIVE );/* ref: INIT */ kref_put (&sp->cmd_kref, qla2x00_sp_release); }
@@ -2355,7 +2356,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)if (!sa_ctl) {ql_dbg (ql_dbg_edif, vha,0x70e6 ,"sa_ctl allocation failed\n" ); -return -ENOMEM ; + rval = -ENOMEM ; + goto done; } fcport = sa_ctl->fcport;
@@ -2365,7 +2367,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)if (!sp) {ql_dbg (ql_dbg_edif, vha,0x70e6 ,"SRB allocation failed\n" ); -return -ENOMEM ; + rval = -ENOMEM ; + goto done; } fcport->flags |=FCF_ASYNC_SENT ;
@@ -2394,9 +2397,17 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e) rval =qla2x00_start_sp (sp); -if (rval !=QLA_SUCCESS ) +if (rval !=QLA_SUCCESS ) { rval =QLA_FUNCTION_FAILED ; + goto done_free_sp; + } +return rval; +done_free_sp: +kref_put (&sp->cmd_kref, qla2x00_sp_release); + fcport->flags &= ~FCF_ASYNC_SENT ; +done: + fcport->flags &= ~FCF_ASYNC_ACTIVE ;return rval; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 586/1157 scsi: qla2xxx: edif: Synchronize NPIV deletion with authentication application
In reply to Greg Kroah-HartmanFrom: Quinn Tran <[email protected]>
[ Upstream commit cf79716e6636400ae38c37bc8a652b1e522abbba ]
Notify authentication application of a NPIV deletion event is about to occur. This allows app to perform cleanup.
--- drivers/scsi/qla2xxx/qla_edif_bsg.h | 2 ++ drivers/scsi/qla2xxx/qla_mid.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_edif_bsg.h +2 -0
@@ -253,4 +253,6 @@ struct aen_complete_cmd {#define RX_DELAY_DELETE_TIMEOUT 20 +#define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN 1 +#endif /* QLA_EDIF_BSG_H */
drivers/scsi/qla2xxx/qla_mid.c +5 -1
@@ -166,9 +166,13 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)int ret =QLA_SUCCESS ;fc_port_t *fcport; -if (vha->hw->flags.edif_enabled) +if (vha->hw->flags.edif_enabled) { +if (DBELL_ACTIVE (vha)) +qla2x00_post_aen_work (vha,FCH_EVT_VENDOR_UNIQUE , +FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN );/* delete sessions and flush sa_indexes */ qla2x00_wait_for_sess_deletion (vha); + }if (vha->hw->flags.fw_started) ret =qla24xx_control_vp (vha,VCE_COMMAND_DISABLE_VPS_LOGO_ALL );
Signature · 1 line
2.35.1