diff options
-rw-r--r-- | include/net/mac80211.h | 2 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 19 | ||||
-rw-r--r-- | net/mac80211/driver-ops.h | 23 | ||||
-rw-r--r-- | net/mac80211/driver-trace.h | 50 |
4 files changed, 94 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 6122e8a3297e..a7323eca08d1 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1799,6 +1799,8 @@ struct ieee80211_ops { | |||
1799 | void (*channel_switch)(struct ieee80211_hw *hw, | 1799 | void (*channel_switch)(struct ieee80211_hw *hw, |
1800 | struct ieee80211_channel_switch *ch_switch); | 1800 | struct ieee80211_channel_switch *ch_switch); |
1801 | int (*napi_poll)(struct ieee80211_hw *hw, int budget); | 1801 | int (*napi_poll)(struct ieee80211_hw *hw, int budget); |
1802 | int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | ||
1803 | int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); | ||
1802 | }; | 1804 | }; |
1803 | 1805 | ||
1804 | /** | 1806 | /** |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 3df12f7d0cfe..0c544074479e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -1628,6 +1628,23 @@ static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, | |||
1628 | ieee80211_queue_work(&local->hw, &local->reconfig_filter); | 1628 | ieee80211_queue_work(&local->hw, &local->reconfig_filter); |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | static int ieee80211_set_antenna(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant) | ||
1632 | { | ||
1633 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1634 | |||
1635 | if (local->started) | ||
1636 | return -EOPNOTSUPP; | ||
1637 | |||
1638 | return drv_set_antenna(local, tx_ant, rx_ant); | ||
1639 | } | ||
1640 | |||
1641 | static int ieee80211_get_antenna(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant) | ||
1642 | { | ||
1643 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
1644 | |||
1645 | return drv_get_antenna(local, tx_ant, rx_ant); | ||
1646 | } | ||
1647 | |||
1631 | struct cfg80211_ops mac80211_config_ops = { | 1648 | struct cfg80211_ops mac80211_config_ops = { |
1632 | .add_virtual_intf = ieee80211_add_iface, | 1649 | .add_virtual_intf = ieee80211_add_iface, |
1633 | .del_virtual_intf = ieee80211_del_iface, | 1650 | .del_virtual_intf = ieee80211_del_iface, |
@@ -1680,4 +1697,6 @@ struct cfg80211_ops mac80211_config_ops = { | |||
1680 | .mgmt_tx = ieee80211_mgmt_tx, | 1697 | .mgmt_tx = ieee80211_mgmt_tx, |
1681 | .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, | 1698 | .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, |
1682 | .mgmt_frame_register = ieee80211_mgmt_frame_register, | 1699 | .mgmt_frame_register = ieee80211_mgmt_frame_register, |
1700 | .set_antenna = ieee80211_set_antenna, | ||
1701 | .get_antenna = ieee80211_get_antenna, | ||
1683 | }; | 1702 | }; |
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h index 79019f94f621..4244554d218a 100644 --- a/net/mac80211/driver-ops.h +++ b/net/mac80211/driver-ops.h | |||
@@ -442,4 +442,27 @@ static inline void drv_channel_switch(struct ieee80211_local *local, | |||
442 | trace_drv_return_void(local); | 442 | trace_drv_return_void(local); |
443 | } | 443 | } |
444 | 444 | ||
445 | |||
446 | static inline int drv_set_antenna(struct ieee80211_local *local, | ||
447 | u32 tx_ant, u32 rx_ant) | ||
448 | { | ||
449 | int ret = -EOPNOTSUPP; | ||
450 | might_sleep(); | ||
451 | if (local->ops->set_antenna) | ||
452 | ret = local->ops->set_antenna(&local->hw, tx_ant, rx_ant); | ||
453 | trace_drv_set_antenna(local, tx_ant, rx_ant, ret); | ||
454 | return ret; | ||
455 | } | ||
456 | |||
457 | static inline int drv_get_antenna(struct ieee80211_local *local, | ||
458 | u32 *tx_ant, u32 *rx_ant) | ||
459 | { | ||
460 | int ret = -EOPNOTSUPP; | ||
461 | might_sleep(); | ||
462 | if (local->ops->get_antenna) | ||
463 | ret = local->ops->get_antenna(&local->hw, tx_ant, rx_ant); | ||
464 | trace_drv_get_antenna(local, *tx_ant, *rx_ant, ret); | ||
465 | return ret; | ||
466 | } | ||
467 | |||
445 | #endif /* __MAC80211_DRIVER_OPS */ | 468 | #endif /* __MAC80211_DRIVER_OPS */ |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index 431d65500d6a..c2772f23ac9c 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -883,6 +883,56 @@ TRACE_EVENT(drv_channel_switch, | |||
883 | ) | 883 | ) |
884 | ); | 884 | ); |
885 | 885 | ||
886 | TRACE_EVENT(drv_set_antenna, | ||
887 | TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret), | ||
888 | |||
889 | TP_ARGS(local, tx_ant, rx_ant, ret), | ||
890 | |||
891 | TP_STRUCT__entry( | ||
892 | LOCAL_ENTRY | ||
893 | __field(u32, tx_ant) | ||
894 | __field(u32, rx_ant) | ||
895 | __field(int, ret) | ||
896 | ), | ||
897 | |||
898 | TP_fast_assign( | ||
899 | LOCAL_ASSIGN; | ||
900 | __entry->tx_ant = tx_ant; | ||
901 | __entry->rx_ant = rx_ant; | ||
902 | __entry->ret = ret; | ||
903 | ), | ||
904 | |||
905 | TP_printk( | ||
906 | LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d", | ||
907 | LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret | ||
908 | ) | ||
909 | ); | ||
910 | |||
911 | TRACE_EVENT(drv_get_antenna, | ||
912 | TP_PROTO(struct ieee80211_local *local, u32 tx_ant, u32 rx_ant, int ret), | ||
913 | |||
914 | TP_ARGS(local, tx_ant, rx_ant, ret), | ||
915 | |||
916 | TP_STRUCT__entry( | ||
917 | LOCAL_ENTRY | ||
918 | __field(u32, tx_ant) | ||
919 | __field(u32, rx_ant) | ||
920 | __field(int, ret) | ||
921 | ), | ||
922 | |||
923 | TP_fast_assign( | ||
924 | LOCAL_ASSIGN; | ||
925 | __entry->tx_ant = tx_ant; | ||
926 | __entry->rx_ant = rx_ant; | ||
927 | __entry->ret = ret; | ||
928 | ), | ||
929 | |||
930 | TP_printk( | ||
931 | LOCAL_PR_FMT " tx_ant:%d rx_ant:%d ret:%d", | ||
932 | LOCAL_PR_ARG, __entry->tx_ant, __entry->rx_ant, __entry->ret | ||
933 | ) | ||
934 | ); | ||
935 | |||
886 | /* | 936 | /* |
887 | * Tracing for API calls that drivers call. | 937 | * Tracing for API calls that drivers call. |
888 | */ | 938 | */ |