cfg.c (bba9525520b6028ecbe7486e13216e9ede8636be) cfg.c (0fdf1493b41eb64fc7e8c8e1b8830a4bd8c4bbca)
1/*
2 * mac80211 configuration hooks for cfg80211
3 *
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
5 * Copyright 2013-2015 Intel Mobile Communications GmbH
6 * Copyright (C) 2015-2017 Intel Deutschland GmbH
7 * Copyright (C) 2018 Intel Corporation
8 *

--- 681 unchanged lines hidden (view full) ---

690 int ret = -ENOENT;
691
692 mutex_lock(&local->sta_mtx);
693
694 sta = sta_info_get_by_idx(sdata, idx);
695 if (sta) {
696 ret = 0;
697 memcpy(mac, sta->sta.addr, ETH_ALEN);
1/*
2 * mac80211 configuration hooks for cfg80211
3 *
4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
5 * Copyright 2013-2015 Intel Mobile Communications GmbH
6 * Copyright (C) 2015-2017 Intel Deutschland GmbH
7 * Copyright (C) 2018 Intel Corporation
8 *

--- 681 unchanged lines hidden (view full) ---

690 int ret = -ENOENT;
691
692 mutex_lock(&local->sta_mtx);
693
694 sta = sta_info_get_by_idx(sdata, idx);
695 if (sta) {
696 ret = 0;
697 memcpy(mac, sta->sta.addr, ETH_ALEN);
698 sta_set_sinfo(sta, sinfo);
698 sta_set_sinfo(sta, sinfo, true);
699 }
700
701 mutex_unlock(&local->sta_mtx);
702
703 return ret;
704}
705
706static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,

--- 12 unchanged lines hidden (view full) ---

719 struct sta_info *sta;
720 int ret = -ENOENT;
721
722 mutex_lock(&local->sta_mtx);
723
724 sta = sta_info_get_bss(sdata, mac);
725 if (sta) {
726 ret = 0;
699 }
700
701 mutex_unlock(&local->sta_mtx);
702
703 return ret;
704}
705
706static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev,

--- 12 unchanged lines hidden (view full) ---

719 struct sta_info *sta;
720 int ret = -ENOENT;
721
722 mutex_lock(&local->sta_mtx);
723
724 sta = sta_info_get_bss(sdata, mac);
725 if (sta) {
726 ret = 0;
727 sta_set_sinfo(sta, sinfo);
727 sta_set_sinfo(sta, sinfo, true);
728 }
729
730 mutex_unlock(&local->sta_mtx);
731
732 return ret;
733}
734
735static int ieee80211_set_monitor_channel(struct wiphy *wiphy,

--- 1635 unchanged lines hidden (view full) ---

2371 if (wiphy->retry_long > IEEE80211_MAX_TX_RETRY)
2372 return -EINVAL;
2373 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
2374 }
2375 if (changed &
2376 (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
2377 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
2378
728 }
729
730 mutex_unlock(&local->sta_mtx);
731
732 return ret;
733}
734
735static int ieee80211_set_monitor_channel(struct wiphy *wiphy,

--- 1635 unchanged lines hidden (view full) ---

2371 if (wiphy->retry_long > IEEE80211_MAX_TX_RETRY)
2372 return -EINVAL;
2373 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
2374 }
2375 if (changed &
2376 (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
2377 ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
2378
2379 if (changed & (WIPHY_PARAM_TXQ_LIMIT |
2380 WIPHY_PARAM_TXQ_MEMORY_LIMIT |
2381 WIPHY_PARAM_TXQ_QUANTUM))
2382 ieee80211_txq_set_params(local);
2383
2379 return 0;
2380}
2381
2382static int ieee80211_set_tx_power(struct wiphy *wiphy,
2383 struct wireless_dev *wdev,
2384 enum nl80211_tx_power_setting type, int mbm)
2385{
2386 struct ieee80211_local *local = wiphy_priv(wiphy);

--- 1313 unchanged lines hidden (view full) ---

3700{
3701 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3702
3703 sdata->u.ap.multicast_to_unicast = enabled;
3704
3705 return 0;
3706}
3707
2384 return 0;
2385}
2386
2387static int ieee80211_set_tx_power(struct wiphy *wiphy,
2388 struct wireless_dev *wdev,
2389 enum nl80211_tx_power_setting type, int mbm)
2390{
2391 struct ieee80211_local *local = wiphy_priv(wiphy);

--- 1313 unchanged lines hidden (view full) ---

3705{
3706 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
3707
3708 sdata->u.ap.multicast_to_unicast = enabled;
3709
3710 return 0;
3711}
3712
3713void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
3714 struct txq_info *txqi)
3715{
3716 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_BACKLOG_BYTES))) {
3717 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_BYTES);
3718 txqstats->backlog_bytes = txqi->tin.backlog_bytes;
3719 }
3720
3721 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS))) {
3722 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS);
3723 txqstats->backlog_packets = txqi->tin.backlog_packets;
3724 }
3725
3726 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_FLOWS))) {
3727 txqstats->filled |= BIT(NL80211_TXQ_STATS_FLOWS);
3728 txqstats->flows = txqi->tin.flows;
3729 }
3730
3731 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_DROPS))) {
3732 txqstats->filled |= BIT(NL80211_TXQ_STATS_DROPS);
3733 txqstats->drops = txqi->cstats.drop_count;
3734 }
3735
3736 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_ECN_MARKS))) {
3737 txqstats->filled |= BIT(NL80211_TXQ_STATS_ECN_MARKS);
3738 txqstats->ecn_marks = txqi->cstats.ecn_mark;
3739 }
3740
3741 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_OVERLIMIT))) {
3742 txqstats->filled |= BIT(NL80211_TXQ_STATS_OVERLIMIT);
3743 txqstats->overlimit = txqi->tin.overlimit;
3744 }
3745
3746 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_COLLISIONS))) {
3747 txqstats->filled |= BIT(NL80211_TXQ_STATS_COLLISIONS);
3748 txqstats->collisions = txqi->tin.collisions;
3749 }
3750
3751 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_TX_BYTES))) {
3752 txqstats->filled |= BIT(NL80211_TXQ_STATS_TX_BYTES);
3753 txqstats->tx_bytes = txqi->tin.tx_bytes;
3754 }
3755
3756 if (!(txqstats->filled & BIT(NL80211_TXQ_STATS_TX_PACKETS))) {
3757 txqstats->filled |= BIT(NL80211_TXQ_STATS_TX_PACKETS);
3758 txqstats->tx_packets = txqi->tin.tx_packets;
3759 }
3760}
3761
3762static int ieee80211_get_txq_stats(struct wiphy *wiphy,
3763 struct wireless_dev *wdev,
3764 struct cfg80211_txq_stats *txqstats)
3765{
3766 struct ieee80211_local *local = wiphy_priv(wiphy);
3767 struct ieee80211_sub_if_data *sdata;
3768 int ret = 0;
3769
3770 if (!local->ops->wake_tx_queue)
3771 return 1;
3772
3773 spin_lock_bh(&local->fq.lock);
3774 rcu_read_lock();
3775
3776 if (wdev) {
3777 sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
3778 if (!sdata->vif.txq) {
3779 ret = 1;
3780 goto out;
3781 }
3782 ieee80211_fill_txq_stats(txqstats, to_txq_info(sdata->vif.txq));
3783 } else {
3784 /* phy stats */
3785 txqstats->filled |= BIT(NL80211_TXQ_STATS_BACKLOG_PACKETS) |
3786 BIT(NL80211_TXQ_STATS_BACKLOG_BYTES) |
3787 BIT(NL80211_TXQ_STATS_OVERLIMIT) |
3788 BIT(NL80211_TXQ_STATS_OVERMEMORY) |
3789 BIT(NL80211_TXQ_STATS_COLLISIONS) |
3790 BIT(NL80211_TXQ_STATS_MAX_FLOWS);
3791 txqstats->backlog_packets = local->fq.backlog;
3792 txqstats->backlog_bytes = local->fq.memory_usage;
3793 txqstats->overlimit = local->fq.overlimit;
3794 txqstats->overmemory = local->fq.overmemory;
3795 txqstats->collisions = local->fq.collisions;
3796 txqstats->max_flows = local->fq.flows_cnt;
3797 }
3798
3799out:
3800 rcu_read_unlock();
3801 spin_unlock_bh(&local->fq.lock);
3802
3803 return ret;
3804}
3805
3708const struct cfg80211_ops mac80211_config_ops = {
3709 .add_virtual_intf = ieee80211_add_iface,
3710 .del_virtual_intf = ieee80211_del_iface,
3711 .change_virtual_intf = ieee80211_change_iface,
3712 .start_p2p_device = ieee80211_start_p2p_device,
3713 .stop_p2p_device = ieee80211_stop_p2p_device,
3714 .add_key = ieee80211_add_key,
3715 .del_key = ieee80211_del_key,

--- 77 unchanged lines hidden (view full) ---

3793 .del_tx_ts = ieee80211_del_tx_ts,
3794 .start_nan = ieee80211_start_nan,
3795 .stop_nan = ieee80211_stop_nan,
3796 .nan_change_conf = ieee80211_nan_change_conf,
3797 .add_nan_func = ieee80211_add_nan_func,
3798 .del_nan_func = ieee80211_del_nan_func,
3799 .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
3800 .tx_control_port = ieee80211_tx_control_port,
3806const struct cfg80211_ops mac80211_config_ops = {
3807 .add_virtual_intf = ieee80211_add_iface,
3808 .del_virtual_intf = ieee80211_del_iface,
3809 .change_virtual_intf = ieee80211_change_iface,
3810 .start_p2p_device = ieee80211_start_p2p_device,
3811 .stop_p2p_device = ieee80211_stop_p2p_device,
3812 .add_key = ieee80211_add_key,
3813 .del_key = ieee80211_del_key,

--- 77 unchanged lines hidden (view full) ---

3891 .del_tx_ts = ieee80211_del_tx_ts,
3892 .start_nan = ieee80211_start_nan,
3893 .stop_nan = ieee80211_stop_nan,
3894 .nan_change_conf = ieee80211_nan_change_conf,
3895 .add_nan_func = ieee80211_add_nan_func,
3896 .del_nan_func = ieee80211_del_nan_func,
3897 .set_multicast_to_unicast = ieee80211_set_multicast_to_unicast,
3898 .tx_control_port = ieee80211_tx_control_port,
3899 .get_txq_stats = ieee80211_get_txq_stats,
3801};
3900};