void enable_beacons(struct ath_softc *sc) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"Turning ON SWBA and BMISS interrupts before imask = 0x%x\n", ath_hal_intrget(sc->sc_ah)); sc->sc_imask |= (HAL_INT_SWBA | HAL_INT_BMISS); ath_hal_intrset(sc->sc_ah, sc->sc_imask); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"AFTER imask = 0x%x\n", ath_hal_intrget(sc->sc_ah)); }
void print_fft_ht40_bytes(HT40_FFT_PACKET *fft_40, struct ath_softc *sc) { int i, size_fft = sizeof(HT40_FFT_PACKET); for(i=0;i< size_fft; i++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "%3x ",*(((u_int8_t*)fft_40) + i)); } SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "%s","\n"); }
void printNoiseFloor(struct ath_softc *sc) { #ifdef DBG #define SM(_v, _f) (((_v) << _f##_S) & _f) #define MS(_v, _f) (((_v) & _f) >> _f##_S) #define AR_PHY_CCA 0x9864 #define AR_PHY_MINCCA_PWR 0x0FF80000 #define AR_PHY_MINCCA_PWR_S 19 #define AR_PHY_CCA_THRESH62 0x0007F000 #define AR_PHY_CCA_THRESH62_S 12 #define AR9280_PHY_MINCCA_PWR 0x1FF00000 #define AR9280_PHY_MINCCA_PWR_S 20 #define AR_PHY_EXT_CCA 0x99bc #define AR_PHY_EXT_MINCCA_PWR 0xFF800000 #define AR_PHY_EXT_MINCCA_PWR_S 23 #define AR9280_PHY_EXT_MINCCA_PWR 0x01FF0000 #define AR9280_PHY_EXT_MINCCA_PWR_S 16 #define AR9280_PHY_CCA_THRESH62 0x000FF000 #define AR9280_PHY_CCA_THRESH62_S 12 int16_t nf, orig_nf; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"\nthresh62=0x%x\n", (u_int8_t)MS(ath_hal_readRegister(sc->sc_ah, AR_PHY_CCA), AR9280_PHY_CCA_THRESH62)); nf = MS(ath_hal_readRegister(sc->sc_ah, AR_PHY_CCA), AR9280_PHY_MINCCA_PWR); orig_nf=nf; if (nf & 0x100) nf = 0 - ((nf ^ 0x1ff) + 1); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"NF calibrated [ctl]" " [chain 0] is %d orig_nf=%d\n", nf, orig_nf); nf = MS(ath_hal_readRegister(sc->sc_ah, AR_PHY_EXT_CCA), AR9280_PHY_EXT_MINCCA_PWR); orig_nf=nf; if (nf & 0x100) nf = 0 - ((nf ^ 0x1ff) + 1); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"NF calibrated [ext] [chain 0] is %d orig_nf=%d\n", nf, orig_nf); #undef SM #undef MS #undef AR_PHY_CCA #undef AR_PHY_MINCCA_PWR #undef AR_PHY_MINCCA_PWR_S #undef AR_PHY_CCA_THRESH62 #undef AR_PHY_CCA_THRESH62_S #undef AR9280_PHY_MINCCA_PWR #undef AR9280_PHY_MINCCA_PWR_S #undef AR_PHY_EXT_CCA #undef AR_PHY_EXT_MINCCA_PWR #undef AR_PHY_EXT_MINCCA_PWR_S #undef AR9280_PHY_EXT_MINCCA_PWR #undef AR9280_PHY_CCA_THRESH62 #undef AR9280_PHY_CCA_THRESH62_S #endif }
void print_phy_err_stats(struct ath_softc *sc) { struct ath_phy_stats *phy_stats = &sc->sc_phy_stats[sc->sc_curmode]; struct ath_spectral *spectral = sc->sc_spectral; int i; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL, "Total PHYERR = %llu\n", (long long unsigned int) phy_stats->ast_rx_phyerr); for (i=0; i < 32; i++) { if (phy_stats->ast_rx_phy[i] != 0) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL, "rx_phy[%d] = %llu\n", i, (long long unsigned int) phy_stats->ast_rx_phy[i]); } SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL, "%s total_phy_errors=%d\n", __func__, spectral->ath_spectral_stats.total_phy_errors); }
void print_fft_ht40_packet(HT40_FFT_PACKET *fft_40, struct ath_softc *sc) { HT40_BIN_MAG_DATA *bmag=NULL; MAX_MAG_INDEX_DATA *imag=NULL; u_int8_t maxval=0, maxindex=0, *bindata=NULL; SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "%s LOWER BINS\n", __func__); bmag = &(fft_40->lower_bins); print_ht40_bin_mag_data(bmag, sc); bindata = bmag->bin_magnitude; //maxval = return_max_value(bindata, SPECTRAL_HT40_NUM_BINS, &maxindex, sc); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\nLOWER BINS max_mag=0x%x max_index=%d\n",maxval, maxindex); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\n%s UPPER BINS\n", __func__); bmag = &(fft_40->upper_bins); print_ht40_bin_mag_data(bmag, sc); bindata = bmag->bin_magnitude; //maxval = return_max_value(bindata, SPECTRAL_HT40_NUM_BINS, &maxindex, sc); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\nUPPER BINS max_mag=0x%x max_index=%d\n",maxval, maxindex); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\n%s LOWER BINS MAGNITUDE\n", __func__); imag = &(fft_40->lower_bins_max); print_max_mag_index_data(imag, sc); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\n%s UPPER BINS MAGNITUDE\n", __func__); imag = &(fft_40->upper_bins_max); print_max_mag_index_data(imag, sc); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "\nmax_exp=%d\n",fft_40->max_exp); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL3, "MASK max_exp=%d\n",(fft_40->max_exp & 0x0F)); }
void start_spectral_scan(struct ath_softc *sc) { HAL_SPECTRAL_PARAM spectral_params; struct ath_spectral *spectral = sc->sc_spectral; if (spectral == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "%s: sc_spectral is NULL, HW may not be spectral capable\n", __func__); return; } OS_MEMZERO(&spectral_params, sizeof (HAL_SPECTRAL_PARAM)); spectral_params.ss_count = 128; spectral_params.ss_short_report = sc->sc_spectral->params.ss_short_report; spectral_params.ss_period = sc->sc_spectral->params.ss_period; spectral_params.ss_fft_period = sc->sc_spectral->params.ss_period; ath_hal_configure_spectral(sc->sc_ah, &spectral_params); spectral_get_thresholds(sc, &sc->sc_spectral->params); spectral->this_scan_phy_err = 0; spectral->send_single_packet = 1; spectral->spectral_sent_msg = 0; spectral->classify_scan = 0; spectral->num_spectral_data=0; spectral->eacs_this_scan_spectral_data=0; ath_hal_start_spectral_scan(sc->sc_ah); }
void spectral_unicast_msg(struct ath_softc *sc) { struct ath_spectral *spectral=sc->sc_spectral; if ((spectral==NULL) || (spectral->spectral_sock==NULL)) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"%s NULL pointers (spectral=%d) (sock=%d) (skb=%d)\n", __func__, (spectral==NULL),(spectral->spectral_sock==NULL),(spectral->spectral_skb==NULL)); dev_kfree_skb(spectral->spectral_skb); spectral->spectral_skb = NULL; return; } if (spectral->spectral_skb != NULL) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) NETLINK_CB(spectral->spectral_skb).pid = 0; /* from kernel */ NETLINK_CB(spectral->spectral_skb).dst_pid = spectral->spectral_pid; NETLINK_CB(spectral->spectral_skb).pid = 0; /* from kernel */ #endif /* VERSION - field depracated by newer kernel */ NETLINK_CB(spectral->spectral_skb).pid = 0; /* from kernel */ /* to mcast group 1<<0 */ NETLINK_CB(spectral->spectral_skb).dst_group=0;; netlink_unicast(spectral->spectral_sock, spectral->spectral_skb, spectral->spectral_pid, MSG_DONTWAIT); } }
u_int8_t *ret_byte_copied_fft_data(struct ath_softc *sc, struct ath_desc *ds, struct ath_buf *bf) { #define ALLOC_FFT_DATA_SIZE 256 struct ath_spectral *spectral=sc->sc_spectral; u_int16_t datalen = ds->ds_rxstat.rs_datalen; u_int8_t *pfft_data=NULL, *byte_ptr=NULL, bmapwt=0,maxindex=0; int i=0; pfft_data = (u_int8_t*)OS_MALLOC(sc->sc_osdev, ALLOC_FFT_DATA_SIZE, 0); if ((!pfft_data) || (datalen > spectral->spectral_data_len + 2)) return NULL; OS_MEMZERO(pfft_data, ALLOC_FFT_DATA_SIZE); for (i=0; i<datalen; i++) { byte_ptr = (u_int8_t*)(((u_int8_t*)bf->bf_vdata + i)); pfft_data[i]=((*byte_ptr) & 0xFF); } get_ht20_bmap_maxindex(sc,pfft_data,datalen,&bmapwt, &maxindex); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "%s %d HT20 bmap=%d maxindex=%d\n", __func__, __LINE__, bmapwt, maxindex); return pfft_data; #undef ALLOC_FFT_DATA_SIZE }
void spectral_bcast_msg(struct ath_softc *sc) { struct ath_spectral *spectral=sc->sc_spectral; SPECTRAL_SAMP_MSG *msg=NULL; fd_set write_set; struct nlmsghdr *nlh=NULL; int status; FD_ZERO(&write_set); if ((spectral==NULL) || (spectral->spectral_sock==NULL)) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"%s NULL pointers (spectral=%d) (sock=%d) (skb=%d)\n", __func__, (spectral==NULL),(spectral->spectral_sock==NULL),(spectral->spectral_skb==NULL)); dev_kfree_skb(spectral->spectral_skb); spectral->spectral_skb = NULL; return; } nlh = (struct nlmsghdr*)spectral->spectral_skb->data; msg = (SPECTRAL_SAMP_MSG*) NLMSG_DATA(spectral->spectral_nlh); print_samp_msg (msg, sc); status = netlink_broadcast(spectral->spectral_sock, spectral->spectral_skb, 0,1, GFP_ATOMIC); if (status == 0) { spectral->spectral_sent_msg++; //if (spectral->spectral_sent_msg % 10000 == 0) printk("sent 10000 netlink msgs\n"); } /* netlink will have freed the skb */ if (spectral->spectral_skb) { spectral->spectral_skb=NULL; } }
void init_classifier(struct ath_softc *sc) { struct ath_spectral *spectral=sc->sc_spectral; struct ss *lwrband, *uprband; lwrband = &spectral->bd_lower; uprband = &spectral->bd_upper; OS_MEMZERO(lwrband, sizeof(struct ss)); OS_MEMZERO(uprband, sizeof(struct ss)); if (spectral->sc_spectral_20_40_mode) { /* AP is in 20-40 mode so we will need to process both extension and primary channel spectral data */ if (sc->sc_extchan.channel < sc->sc_curchan.channel) { lwrband->b_chan_in_mhz = sc->sc_extchan.channel; uprband->b_chan_in_mhz = sc->sc_curchan.channel; uprband->dc_in_mhz = (uprband->b_chan_in_mhz - 10); uprband->lwr_band_data = 1; lwrband->lwr_band_data = 0; } else { lwrband->b_chan_in_mhz = sc->sc_curchan.channel; uprband->b_chan_in_mhz = sc->sc_extchan.channel; uprband->dc_in_mhz = (uprband->b_chan_in_mhz + 10); uprband->lwr_band_data = 0; lwrband->lwr_band_data = 1; } uprband->dynamic_ht2040_en = spectral->sc_spectral_20_40_mode; uprband->dc_index = spectral->spectral_dc_index; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"uprband->b_chan_in_mhz = %d\n", uprband->b_chan_in_mhz); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"uprband->dc_in_mhz = %d\n", uprband->dc_in_mhz); lwrband->dc_in_mhz = uprband->dc_in_mhz; } else { /* AP is in 20MHz mode so only primary channel spectral data counts*/ lwrband->b_chan_in_mhz = sc->sc_curchan.channel; lwrband->dc_in_mhz = lwrband->b_chan_in_mhz; lwrband->lwr_band_data = 1; } lwrband->dynamic_ht2040_en = spectral->sc_spectral_20_40_mode; lwrband->dc_index = spectral->spectral_dc_index; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"lwrband->b_chan_in_mhz = %d\n", lwrband->b_chan_in_mhz); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"lwrband->dc_in_mhz = %d\n", lwrband->dc_in_mhz); }
void process_fft_ht20_packet(HT20_FFT_PACKET *fft_20, struct ath_softc *sc, u_int16_t *max_mag, u_int8_t* max_index, int *narrowband, int8_t *rssi, int *bmap) { HT20_BIN_MAG_DATA *bmag=NULL; MAX_MAG_INDEX_DATA *imag=NULL; u_int8_t maxval=0, maxindex=0, *bindata=NULL, bmapwt; u_int16_t maxmag; int small_bitmap=0, high_rssi=0; int8_t minimum_rssi=5; u_int8_t calc_maxindex=0, calc_strongbins=0, calc_maxval=0; int one_over_wideband_min_large_bin_ratio=7, one_side_length = SPECTRAL_HT20_NUM_BINS; bmag = &(fft_20->lower_bins); bindata = bmag->bin_magnitude; maxval = return_max_value(bindata, SPECTRAL_HT20_NUM_BINS, &maxindex, sc, &calc_strongbins); calc_maxval = return_max_value(bindata, SPECTRAL_HT20_NUM_BINS, &calc_maxindex, sc, &calc_strongbins); imag = &(fft_20->lower_bins_max); //process_ht20_mag_data(imag, &maxmag, &bmapwt, &maxindex); process_mag_data(imag, &maxmag, &bmapwt, &maxindex); /* Do this only for HT20 mode */ maxindex = fix_maxindex_inv_only(sc, maxindex); maxindex += 29; *max_mag = maxmag; *max_index = maxindex; *bmap = bmapwt; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"strongbins=%d bmapwt=%d calc_maxval=%d maxmag=%d calc_maxindex=%d maxindex=%d\n",calc_strongbins, bmapwt, calc_maxval, maxmag, calc_maxindex, maxindex); small_bitmap = (bmapwt < 2); high_rssi = (*rssi > minimum_rssi); *narrowband = 0; if((bmapwt * one_over_wideband_min_large_bin_ratio) < (one_side_length - 1)){ *narrowband = 1; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3,"%s nb=%d \n",__func__, *narrowband); } else { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3,"%s nb=%d \n",__func__, *narrowband); } }
void print_ht40_bin_mag_data(HT40_BIN_MAG_DATA *bmag, struct ath_softc *sc) { int i; for (i=0; i< SPECTRAL_HT40_NUM_BINS; i++) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "[%d]=0x%x ", i,bmag->bin_magnitude[i]); } }
void print_fft_data(struct ath_softc *sc, u_int8_t *fft_data_ptr, int datalen) { int i; for (i=0; i<datalen; i++) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "fft_data[%d]=0x%x\n", i, fft_data_ptr[i]); } }
void print_compare_fft_data(struct ath_softc *sc, u_int8_t *fft_data_ptr1, u_int8_t *fft_data_ptr2, int datalen) { int i; for (i=0; i<datalen; i++) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "fft_data1[%d]=0x%x fft_data2[%d]=0x%x\n", i, fft_data_ptr1[i], i, fft_data_ptr2[i]); } }
int8_t fix_maxindex_inv_only(struct ath_softc *sc, u_int8_t val) { int8_t temp = val; int8_t inv = 0; if (val > 31) { temp = val & 0x1f; inv = ((~(temp) & 0x1F)+ 1) & 0x1f; temp = 0 - inv; } SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3," %s val = %d temp=%d\n", __func__, val, temp); return temp; }
void print_config_regs(struct ath_softc *sc) { #ifdef DBG #define NUM_REGS 9 struct ath_hal *ah = sc->sc_ah; int i,reg_addr[NUM_REGS]={0x806c, 0x9840, 0x9858, 0x9864,0x9910,0x9924, 0x9940,0x9954,0x9970}; for(i=0; i< NUM_REGS; i++) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL, "0x%x=0x%x\n", reg_addr[i], ath_hal_readRegister(ah, reg_addr[i])); } #undef NUM_REGS #endif }
int spectral_init_netlink(struct ath_softc *sc) { struct ath_spectral *spectral=sc->sc_spectral; if (spectral == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL, "%s: sc_spectral is NULL\n", __func__); return -EIO; } spectral->spectral_sent_msg=0; if (spectral_nl_sock == NULL) { #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)) spectral_nl_sock = (struct sock *)netlink_kernel_create(NETLINK_ATHEROS, 1,&spectral_nl_data_ready, THIS_MODULE); #else extern struct net init_net; spectral_nl_sock = (struct sock *)netlink_kernel_create(&init_net,NETLINK_ATHEROS, 1,&spectral_nl_data_ready, NULL, THIS_MODULE); #endif if (spectral_nl_sock == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL,"%s NETLINK_KERNEL_CREATE FAILED\n", __func__); return -ENODEV; } } atomic_inc(&spectral_nl_users); spectral->spectral_sock = spectral_nl_sock; if ((spectral==NULL) || (spectral->spectral_sock==NULL)) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"%s NULL pointers (spectral=%d) (sock=%d) \n", __func__, (spectral==NULL),(spectral->spectral_sock==NULL)); return -ENODEV; } if (spectral->spectral_skb == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"%s %d NULL SKB\n", __func__, __LINE__); } return 0; }
void print_hex_fft_ht20_packet(HT20_FFT_PACKET *fft_20, struct ath_softc *sc) { int i=0, total_bytes=0; u_int8_t *print_ptr=(u_int8_t*)&(fft_20->lower_bins); SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "BINS print_ptr=%p\n",print_ptr); for(i=0; i<SPECTRAL_HT20_NUM_BINS; i++, total_bytes++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "[%d]=%x\n",i, *print_ptr++); } SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "MAGNITUDE print_ptr=%p\n",print_ptr); for(i=0; i<sizeof(MAX_MAG_INDEX_DATA); i++, total_bytes++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "[%d]=%x\n",i,*print_ptr++); } SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "MAX_EXP print_ptr=%p\n",print_ptr); for(i=0; i<sizeof(u_int8_t); i++, total_bytes++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "[%d]=%x\n",i,*print_ptr++); } SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "DONE print_ptr=%p, sizeof(HT20_FFT_PACKET)=%d total_bytes=%d\n",print_ptr, sizeof(HT20_FFT_PACKET), total_bytes); }
void stop_current_scan(struct ath_softc *sc) { struct ath_spectral *spectral = sc->sc_spectral; if (spectral == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "%s: sc_spectral is NULL, HW may not be spectral capable\n", __func__); return; } ath_hal_stop_spectral_scan(sc->sc_ah); #ifdef SPECTRAL_CLASSIFIER_IN_KERNEL OS_CANCEL_TIMER(&spectral->classify_timer); #endif #ifdef SPECTRAL_DEBUG_TIMER OS_CANCEL_TIMER(&spectral->debug_timer); #endif if( spectral->classify_scan) { printk("%s - control chan detects=%d extension channel detects=%d above_dc_detects=%d below_dc_detects=%d\n", __func__,spectral->detects_control_channel, spectral->detects_extension_channel, spectral->detects_above_dc, spectral->detects_below_dc); spectral->detects_control_channel=0; spectral->detects_extension_channel=0; spectral->detects_above_dc=0; spectral->detects_below_dc=0; spectral->classify_scan = 0; print_detection(sc); } spectral->this_scan_phy_err = sc->sc_phy_stats[sc->sc_curmode].ast_rx_phyerr - spectral->cached_phy_err; spectral->send_single_packet = 0; spectral->ctl_eacs_avg_rssi=SPECTRAL_EACS_RSSI_THRESH; spectral->ext_eacs_avg_rssi=SPECTRAL_EACS_RSSI_THRESH; spectral->ctl_eacs_spectral_reports=0; spectral->ext_eacs_spectral_reports=0; }
void start_classify_scan(struct ath_softc *sc) { HAL_SPECTRAL_PARAM spectral_params; struct ath_spectral *spectral = sc->sc_spectral; if (spectral == NULL) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "%s: sc_spectral is NULL, HW may not be spectral capable\n", __func__); return; } SPECTRAL_LOCK(spectral); OS_MEMZERO(&spectral_params, sizeof (HAL_SPECTRAL_PARAM)); spectral_params.ss_count = 128; spectral_params.ss_short_report = sc->sc_spectral->params.ss_short_report; spectral_params.ss_period = sc->sc_spectral->params.ss_period; spectral_params.ss_fft_period = sc->sc_spectral->params.ss_period; ath_hal_configure_spectral(sc->sc_ah, &spectral_params); spectral_get_thresholds(sc, &sc->sc_spectral->params); spectral->send_single_packet = 0; spectral->spectral_sent_msg = 0; spectral->classify_scan = 1; spectral->detects_control_channel=0; spectral->detects_extension_channel=0; #ifdef SPECTRAL_CLASSIFIER_IN_KERNEL init_classifier(sc); classifier_initialize(&spectral->bd_lower, &spectral->bd_upper); #endif spectral->this_scan_phy_err = 0; spectral->num_spectral_data=0; spectral->eacs_this_scan_spectral_data=0; SPECTRAL_UNLOCK(spectral); ath_hal_start_spectral_scan(sc->sc_ah); }
void get_ht20_bmap_maxindex(struct ath_softc *sc, u_int8_t *fft_20_data, int datalen, u_int8_t *bmap_wt, u_int8_t *max_index) { int offset = (SPECTRAL_HT20_TOTAL_DATA_LEN - datalen); u_int8_t temp_maxindex=0, temp_bmapwt=0; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"%s datalen=%d\n",__func__, datalen); temp_maxindex = fft_20_data[SPECTRAL_HT20_MAXINDEX_INDEX + offset]; temp_maxindex=(temp_maxindex & 0xFC); temp_maxindex=(temp_maxindex >> 2); //temp_maxindex = ((temp_maxindex >> 2) & 0x3F); temp_maxindex = fix_maxindex_inv_only(sc, temp_maxindex); temp_maxindex += 29; temp_bmapwt=fft_20_data[SPECTRAL_HT20_BMAPWT_INDEX + offset]; temp_bmapwt &= 0x3F; *bmap_wt = temp_bmapwt; *max_index = temp_maxindex; }
void print_classifier_counts(struct ath_softc *sc, struct ss *bd, const char *print_str) { if(bd->count_mwo || bd->count_bts || bd->count_bth || bd->count_cwa || bd->count_wln) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"%s\n", print_str); if(bd->count_mwo) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "count_mwo=%d\n",bd->count_mwo); if(bd->count_bts) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "count_bts=%d ",bd->count_bts); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "bts_min_freq=%d ",bd->bts_min_freq); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "bts_max_freq=%d\n",bd->bts_max_freq); } if(bd->count_bth) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "count_bth=%d\n",bd->count_bth); if(bd->count_cph) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "count_cph=%d ",bd->count_cph); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "cph_min_freq=%d ",bd->cph_min_freq); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, "cph_max_freq=%d\n",bd->cph_max_freq); } if(bd->count_cwa){ SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "count_cwa=%d\n",bd->count_cwa); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "cwa_min_freq=%d ",bd->cwa_min_freq); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "cwa_max_freq=%d\n",bd->cwa_max_freq); } if(bd->count_wln) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "count_wln=%d\n",bd->count_wln); if(bd->count_vbr) SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "count_vbr=%d\n",bd->count_vbr); }
void spectral_create_samp_msg(struct samp_msg_params *params) { static SPECTRAL_SAMP_MSG spec_samp_msg; /* XXX non-reentrant - will be an issue with dual concurrent operation on multi-proc systems */ SPECTRAL_SAMP_MSG *msg=NULL; SPECTRAL_SAMP_DATA *data=NULL; u_int8_t *bin_pwr_data = NULL; static int samp_msg_index=0, i=0; struct ath_softc *sc = params->sc; struct ath_spectral *spectral=sc->sc_spectral; SPECTRAL_CLASSIFIER_PARAMS *cp, *pcp; //8-13-2008 Why are the last few bytes missing? Check if our samp_msg_len is screwing up. int samp_msg_len = sizeof(SPECTRAL_SAMP_MSG); int temp_samp_msg_len = sizeof(SPECTRAL_SAMP_MSG) - (MAX_NUM_BINS * sizeof(u_int8_t)); temp_samp_msg_len += (params->pwr_count * sizeof(u_int8_t)); bin_pwr_data = *(params->bin_pwr_data); memset(&spec_samp_msg, 0, sizeof(SPECTRAL_SAMP_MSG)); data = &spec_samp_msg.samp_data; spec_samp_msg.freq = params->freq; spec_samp_msg.freq_loading = params->freq_loading; spec_samp_msg.samp_data.spectral_data_len = params->datalen; spec_samp_msg.samp_data.spectral_rssi = params->rssi; spec_samp_msg.samp_data.spectral_combined_rssi = (u_int8_t)params->rssi; spec_samp_msg.samp_data.spectral_upper_rssi = params->upper_rssi; spec_samp_msg.samp_data.spectral_lower_rssi = params->lower_rssi; spec_samp_msg.samp_data.spectral_bwinfo = params->bwinfo; spec_samp_msg.samp_data.spectral_tstamp = params->tstamp; spec_samp_msg.samp_data.spectral_max_index = params->max_index; /* Classifier in user space needs access to these */ spec_samp_msg.samp_data.spectral_lower_max_index = params->max_lower_index; spec_samp_msg.samp_data.spectral_upper_max_index = params->max_upper_index; spec_samp_msg.samp_data.spectral_nb_lower= params->nb_lower; spec_samp_msg.samp_data.spectral_nb_upper = params->nb_upper; spec_samp_msg.samp_data.spectral_last_tstamp = params->last_tstamp; spec_samp_msg.samp_data.spectral_max_mag = params->max_mag; spec_samp_msg.samp_data.bin_pwr_count = params->pwr_count; spec_samp_msg.samp_data.spectral_combined_rssi = params->rssi; //Reusing max_exp as max_scale spec_samp_msg.samp_data.spectral_max_scale = params->max_exp; /* Classifier in user space needs access to these */ cp = &(spec_samp_msg.samp_data.classifier_params); pcp = &(params->classifier_params); OS_MEMCPY(cp, pcp, sizeof(SPECTRAL_CLASSIFIER_PARAMS)); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"bin_pwr_data=%p\n", bin_pwr_data); #ifdef REVERSE_ORDER OS_MEMCPY(&data->bin_pwr[0], (bin_pwr_data+64), 64); OS_MEMCPY(&data->bin_pwr[64], (bin_pwr_data), 64); #else /* 8-22 Reverse the order of the bytes being passed up */ OS_MEMCPY(&data->bin_pwr[0], bin_pwr_data, params->pwr_count); #endif for (i=0; i < params->pwr_count; i++) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"(%d)[%x:%x] ",i,*(bin_pwr_data+i), data->bin_pwr[i]); } #ifdef SPECTRAL_CLASSIFIER_IN_KERNEL if(params->interf_list.count) { OS_MEMCPY(&data->interf_list, ¶ms->interf_list, sizeof(struct INTERF_SRC_RSP)); } else #endif data->interf_list.count = 0; #ifndef WIN32 spectral_prep_skb(sc); if (spectral->spectral_skb != NULL) { spectral->spectral_nlh = (struct nlmsghdr*)spectral->spectral_skb->data; memcpy(NLMSG_DATA(spectral->spectral_nlh), &spec_samp_msg, NLMSG_SPACE(samp_msg_len)); msg = (SPECTRAL_SAMP_MSG*) NLMSG_DATA(spectral->spectral_nlh); print_samp_msg (msg, sc); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2,"nlmsg_len=%d skb->len=%d\n", spectral->spectral_nlh->nlmsg_len, spectral->spectral_skb->len); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1,"%s", "."); spectral_bcast_msg(sc); samp_msg_index++; } #else /* call the indicate function to pass the data to Windows spectral service*/ msg = (SPECTRAL_SAMP_MSG *) OS_MALLOC(sc->sc_osdev, sizeof(SPECTRAL_SAMP_MSG), GFP_KERNEL); if (msg) { OS_MEMCPY(msg, &spec_samp_msg, sizeof(SPECTRAL_SAMP_MSG)); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL2, " datalen=%d tstamp=%x last_tstamp=%x " "rssi=%d nb_lower=%d peak=%d\n", spec_samp_msg.samp_data.spectral_data_len, spec_samp_msg.samp_data.spectral_tstamp, spec_samp_msg.samp_data.spectral_last_tstamp, spec_samp_msg.samp_data.spectral_lower_rssi, spec_samp_msg.samp_data.spectral_nb_lower, spec_samp_msg.samp_data.spectral_lower_max_index); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL1, "datalen=%d sizeof(SPECTRAL_SAMP_MSG)=%d\n", params->datalen, sizeof(SPECTRAL_SAMP_MSG)); ath_spectral_indicate( params->sc, (void*)msg, sizeof(SPECTRAL_SAMP_MSG)); OS_FREE(msg); msg = NULL; } else { SPECTRAL_DPRINTK(sc, 0 /* unfiltered */, "Couldn't allocate msg buffer!\n"); } #endif }
void spectral_nl_data_ready(struct sk_buff *skb ) { SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3,"%s %d\n", __func__, __LINE__); return; }
void print_max_mag_index_data(MAX_MAG_INDEX_DATA *imag, struct ath_softc *sc) { #ifdef OLD_MAXMAG_DATA_DEF u_int16_t max_mag=0; u_int16_t temp=0; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_mag_bits01=0x%x\n", imag->max_mag_bits01); max_mag = imag->max_mag_bits01; SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_mag=0x%x\n", max_mag); //SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "MASK max_mag_bits01=0x%x max_mag=0x%x\n", (imag->max_mag_bits01 & 0xC0), max_mag); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "bmap_wt=0x%x\n", imag->bmap_wt); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "MASK bmap_wt=0x%x\n", (imag->bmap_wt & 0x3F)); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_mag_bits29=0x%x\n", imag->max_mag_bits29); temp = imag->max_mag_bits29; max_mag = ((temp << 2) | max_mag); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_mag=0x%x\n", max_mag); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_index_bits05=0x%x\n", imag->max_index_bits05); //SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "MASK max_index_bits05=0x%x\n", (imag->max_index_bits05 & 0xFC)); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_max_bits1110=0x%x\n", imag->max_mag_bits1110); //SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "MASK max_max_bits1110=0x%x\n", (imag->max_mag_bits1110 & 0x03)); temp = imag->max_mag_bits1110; max_mag = ((temp << 10) | max_mag); SPECTRAL_DPRINTK(sc, ATH_DEBUG_SPECTRAL3, "max_mag=0x%x\n", max_mag); #else int i=0, total_bytes=0; u_int8_t* print_ptr = (u_int8_t*)imag; SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "%s\n","MAGNITUDE"); for(i=0; i<sizeof(MAX_MAG_INDEX_DATA); i++, total_bytes++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "[%d]=%x\n",i,*print_ptr++); } SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "MAX_EXP print_ptr=%p\n",print_ptr); for(i=0; i<sizeof(u_int8_t); i++, total_bytes++) { SPECTRAL_DPRINTK(sc,ATH_DEBUG_SPECTRAL2, "[%d]=%x\n",i,*print_ptr++); } #endif }