if_bwn.c (300076) | if_bwn.c (300079) |
---|---|
1/*- 2 * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2009-2010 Weongyo Jeong <weongyo@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/bwn/if_bwn.c 300076 2016-05-17 20:21:39Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/bwn/if_bwn.c 300079 2016-05-17 21:24:10Z adrian $"); |
32 33/* 34 * The Broadcom Wireless LAN controller driver. 35 */ 36 37#include "opt_bwn.h" 38#include "opt_wlan.h" 39 --- 5725 unchanged lines hidden (view full) --- 5765 !! (phystat3 & BWN_RX_PHYST3_TRSTATE)); 5766 break; 5767 case BWN_PHYTYPE_N: 5768 /* Broadcom has code for min/avg, but always used max */ 5769 if (rxhdr->phy.n.power0 == 16 || rxhdr->phy.n.power0 == 32) 5770 rssi = max(rxhdr->phy.n.power1, rxhdr->ps2.n.power2); 5771 else 5772 rssi = max(rxhdr->phy.n.power0, rxhdr->phy.n.power1); | 32 33/* 34 * The Broadcom Wireless LAN controller driver. 35 */ 36 37#include "opt_bwn.h" 38#include "opt_wlan.h" 39 --- 5725 unchanged lines hidden (view full) --- 5765 !! (phystat3 & BWN_RX_PHYST3_TRSTATE)); 5766 break; 5767 case BWN_PHYTYPE_N: 5768 /* Broadcom has code for min/avg, but always used max */ 5769 if (rxhdr->phy.n.power0 == 16 || rxhdr->phy.n.power0 == 32) 5770 rssi = max(rxhdr->phy.n.power1, rxhdr->ps2.n.power2); 5771 else 5772 rssi = max(rxhdr->phy.n.power0, rxhdr->phy.n.power1); |
5773#if 0 5774 DPRINTF(mac->mac_sc, BWN_DEBUG_RECV, 5775 "%s: power0=%d, power1=%d, power2=%d\n", 5776 __func__, 5777 rxhdr->phy.n.power0, 5778 rxhdr->phy.n.power1, 5779 rxhdr->ps2.n.power2); 5780#endif |
|
5773 break; 5774 default: 5775 /* XXX TODO: implement rssi for other PHYs */ 5776 break; 5777 } 5778 | 5781 break; 5782 default: 5783 /* XXX TODO: implement rssi for other PHYs */ 5784 break; 5785 } 5786 |
5787 /* 5788 * RSSI here is absolute, not relative to the noise floor. 5789 */ |
|
5779 noise = mac->mac_stats.link_noise; | 5790 noise = mac->mac_stats.link_noise; |
5791 rssi = rssi - noise; |
|
5780 5781 /* RX radio tap */ 5782 if (ieee80211_radiotap_active(ic)) 5783 bwn_rx_radiotap(mac, m, rxhdr, plcp, rate, rssi, noise); 5784 m_adj(m, -IEEE80211_CRC_LEN); 5785 5786 BWN_UNLOCK(sc); 5787 --- 1525 unchanged lines hidden --- | 5792 5793 /* RX radio tap */ 5794 if (ieee80211_radiotap_active(ic)) 5795 bwn_rx_radiotap(mac, m, rxhdr, plcp, rate, rssi, noise); 5796 m_adj(m, -IEEE80211_CRC_LEN); 5797 5798 BWN_UNLOCK(sc); 5799 --- 1525 unchanged lines hidden --- |