📄 prism2sta.c
字号:
} /* get all the Compatibility range, modem interface supplier fields in byte order */ hw->cap_sup_mfi.role = hfa384x2host_16(hw->cap_sup_mfi.role); hw->cap_sup_mfi.id = hfa384x2host_16(hw->cap_sup_mfi.id); hw->cap_sup_mfi.variant = hfa384x2host_16(hw->cap_sup_mfi.variant); hw->cap_sup_mfi.bottom = hfa384x2host_16(hw->cap_sup_mfi.bottom); hw->cap_sup_mfi.top = hfa384x2host_16(hw->cap_sup_mfi.top); WLAN_LOG_INFO( "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_sup_mfi.role, hw->cap_sup_mfi.id, hw->cap_sup_mfi.variant, hw->cap_sup_mfi.bottom, hw->cap_sup_mfi.top); /* Compatibility range, Controller supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE, &hw->cap_sup_cfi, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve CFISUPRANGE\n"); goto failed; } /* get all the Compatibility range, controller interface supplier fields in byte order */ hw->cap_sup_cfi.role = hfa384x2host_16(hw->cap_sup_cfi.role); hw->cap_sup_cfi.id = hfa384x2host_16(hw->cap_sup_cfi.id); hw->cap_sup_cfi.variant = hfa384x2host_16(hw->cap_sup_cfi.variant); hw->cap_sup_cfi.bottom = hfa384x2host_16(hw->cap_sup_cfi.bottom); hw->cap_sup_cfi.top = hfa384x2host_16(hw->cap_sup_cfi.top); WLAN_LOG_INFO( "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_sup_cfi.role, hw->cap_sup_cfi.id, hw->cap_sup_cfi.variant, hw->cap_sup_cfi.bottom, hw->cap_sup_cfi.top); /* Compatibility range, Primary f/w supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE, &hw->cap_sup_pri, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve PRISUPRANGE\n"); goto failed; } /* get all the Compatibility range, primary firmware supplier fields in byte order */ hw->cap_sup_pri.role = hfa384x2host_16(hw->cap_sup_pri.role); hw->cap_sup_pri.id = hfa384x2host_16(hw->cap_sup_pri.id); hw->cap_sup_pri.variant = hfa384x2host_16(hw->cap_sup_pri.variant); hw->cap_sup_pri.bottom = hfa384x2host_16(hw->cap_sup_pri.bottom); hw->cap_sup_pri.top = hfa384x2host_16(hw->cap_sup_pri.top); WLAN_LOG_INFO( "PRI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_sup_pri.role, hw->cap_sup_pri.id, hw->cap_sup_pri.variant, hw->cap_sup_pri.bottom, hw->cap_sup_pri.top); /* Compatibility range, Station f/w supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE, &hw->cap_sup_sta, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve STASUPRANGE\n"); goto failed; } /* get all the Compatibility range, station firmware supplier fields in byte order */ hw->cap_sup_sta.role = hfa384x2host_16(hw->cap_sup_sta.role); hw->cap_sup_sta.id = hfa384x2host_16(hw->cap_sup_sta.id); hw->cap_sup_sta.variant = hfa384x2host_16(hw->cap_sup_sta.variant); hw->cap_sup_sta.bottom = hfa384x2host_16(hw->cap_sup_sta.bottom); hw->cap_sup_sta.top = hfa384x2host_16(hw->cap_sup_sta.top); if ( hw->cap_sup_sta.id == 0x04 ) { WLAN_LOG_INFO( "STA:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_sup_sta.role, hw->cap_sup_sta.id, hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, hw->cap_sup_sta.top); } else { WLAN_LOG_INFO( "AP:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_sup_sta.role, hw->cap_sup_sta.id, hw->cap_sup_sta.variant, hw->cap_sup_sta.bottom, hw->cap_sup_sta.top); } /* Compatibility range, primary f/w actor, CFI supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES, &hw->cap_act_pri_cfi, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve PRI_CFIACTRANGES\n"); goto failed; } /* get all the Compatibility range, primary f/w actor, CFI supplier fields in byte order */ hw->cap_act_pri_cfi.role = hfa384x2host_16(hw->cap_act_pri_cfi.role); hw->cap_act_pri_cfi.id = hfa384x2host_16(hw->cap_act_pri_cfi.id); hw->cap_act_pri_cfi.variant = hfa384x2host_16(hw->cap_act_pri_cfi.variant); hw->cap_act_pri_cfi.bottom = hfa384x2host_16(hw->cap_act_pri_cfi.bottom); hw->cap_act_pri_cfi.top = hfa384x2host_16(hw->cap_act_pri_cfi.top); WLAN_LOG_INFO( "PRI-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_act_pri_cfi.role, hw->cap_act_pri_cfi.id, hw->cap_act_pri_cfi.variant, hw->cap_act_pri_cfi.bottom, hw->cap_act_pri_cfi.top); /* Compatibility range, sta f/w actor, CFI supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES, &hw->cap_act_sta_cfi, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve STA_CFIACTRANGES\n"); goto failed; } /* get all the Compatibility range, station f/w actor, CFI supplier fields in byte order */ hw->cap_act_sta_cfi.role = hfa384x2host_16(hw->cap_act_sta_cfi.role); hw->cap_act_sta_cfi.id = hfa384x2host_16(hw->cap_act_sta_cfi.id); hw->cap_act_sta_cfi.variant = hfa384x2host_16(hw->cap_act_sta_cfi.variant); hw->cap_act_sta_cfi.bottom = hfa384x2host_16(hw->cap_act_sta_cfi.bottom); hw->cap_act_sta_cfi.top = hfa384x2host_16(hw->cap_act_sta_cfi.top); WLAN_LOG_INFO( "STA-CFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_act_sta_cfi.role, hw->cap_act_sta_cfi.id, hw->cap_act_sta_cfi.variant, hw->cap_act_sta_cfi.bottom, hw->cap_act_sta_cfi.top); /* Compatibility range, sta f/w actor, MFI supplier */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES, &hw->cap_act_sta_mfi, sizeof(hfa384x_caplevel_t)); if ( result ) { WLAN_LOG_ERROR("Failed to retrieve STA_MFIACTRANGES\n"); goto failed; } /* get all the Compatibility range, station f/w actor, MFI supplier fields in byte order */ hw->cap_act_sta_mfi.role = hfa384x2host_16(hw->cap_act_sta_mfi.role); hw->cap_act_sta_mfi.id = hfa384x2host_16(hw->cap_act_sta_mfi.id); hw->cap_act_sta_mfi.variant = hfa384x2host_16(hw->cap_act_sta_mfi.variant); hw->cap_act_sta_mfi.bottom = hfa384x2host_16(hw->cap_act_sta_mfi.bottom); hw->cap_act_sta_mfi.top = hfa384x2host_16(hw->cap_act_sta_mfi.top); WLAN_LOG_INFO( "STA-MFI:ACT:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", hw->cap_act_sta_mfi.role, hw->cap_act_sta_mfi.id, hw->cap_act_sta_mfi.variant, hw->cap_act_sta_mfi.bottom, hw->cap_act_sta_mfi.top); /* Serial Number */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER, snum, HFA384x_RID_NICSERIALNUMBER_LEN); if ( !result ) { wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN, pstr, sizeof(pstr)); WLAN_LOG_INFO("Prism2 card SN: %s\n", pstr); } else { WLAN_LOG_ERROR("Failed to retrieve Prism2 Card SN\n"); goto failed; } /* Collect the MAC address */ result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CNFOWNMACADDR, wlandev->netdev->dev_addr, WLAN_ADDR_LEN); if ( result != 0 ) { WLAN_LOG_ERROR("Failed to retrieve mac address\n"); goto failed; } /* short preamble is always implemented */ wlandev->nsdcaps |= P80211_NSDCAP_SHORT_PREAMBLE; /* find out if hardware wep is implemented */ hfa384x_drvr_getconfig16(hw, HFA384x_RID_PRIVACYOPTIMP, &temp); if (temp) wlandev->nsdcaps |= P80211_NSDCAP_HARDWAREWEP; /* Only enable scan by default on newer firmware */ if (HFA384x_FIRMWARE_VERSION(hw->ident_sta_fw.major, hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) < HFA384x_FIRMWARE_VERSION(1,5,5)) { wlandev->nsdcaps |= P80211_NSDCAP_NOSCAN; } /* TODO: Set any internally managed config items */ goto done;failed: WLAN_LOG_ERROR("Failed, result=%d\n", result);done: DBFEXIT; return result;}/*----------------------------------------------------------------* prism2sta_globalsetup** Set any global RIDs that we want to set at device activation.** Arguments:* wlandev wlan device structure** Returns: * 0 success* >0 f/w reported error* <0 driver reported error** Side effects:** Call context:* process thread----------------------------------------------------------------*/int prism2sta_globalsetup(wlandevice_t *wlandev){ hfa384x_t *hw = (hfa384x_t *)wlandev->priv; /* Set the maximum frame size */ return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN, WLAN_DATA_MAXLEN);}int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev){ int result = 0; hfa384x_t *hw = (hfa384x_t *)wlandev->priv; UINT16 promisc; DBFENTER; /* If we're not ready, what's the point? */ if ( hw->state != HFA384x_STATE_RUNNING ) goto exit; /* If we're an AP, do nothing here */ if (hw->ap) goto exit; if ( (dev->flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0 ) promisc = P80211ENUM_truth_true; else promisc = P80211ENUM_truth_false; result = hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, promisc); /* XXX TODO: configure the multicast list */ // CLEAR_HW_MULTICAST_LIST // struct dev_mc_list element = dev->mc_list; // while (element != null) { // HW_ADD_MULTICAST_ADDR(element->dmi_addr, dmi_addrlen) // element = element->next; // } exit: DBFEXIT; return result;}/*----------------------------------------------------------------* prism2sta_inf_handover** Handles the receipt of a Handover info frame. Should only be present* in APs only.** Arguments:* wlandev wlan device structure* inf ptr to info frame (contents in hfa384x order)** Returns: * nothing** Side effects:** Call context:* interrupt----------------------------------------------------------------*/void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){ DBFENTER; WLAN_LOG_DEBUG(2,"received infoframe:HANDOVER (unhandled)\n"); DBFEXIT; return;}/*----------------------------------------------------------------* prism2sta_inf_tallies** Handles the receipt of a CommTallies info frame. ** Arguments:* wlandev wlan device structure* inf ptr to info frame (contents in hfa384x order)** Returns: * nothing** Side effects:** Call context:* interrupt----------------------------------------------------------------*/void prism2sta_inf_tallies(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){ hfa384x_t *hw = (hfa384x_t *)wlandev->priv; UINT16 *src16; UINT32 *dst; UINT32 *src32; int i; int cnt; DBFENTER; /* ** Determine if these are 16-bit or 32-bit tallies, based on the ** record length of the info record. */ cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(UINT32); if (inf->framelen > 22) { dst = (UINT32 *) &hw->tallies; src32 = (UINT32 *) &inf->info.commtallies32; for (i = 0; i < cnt; i++, dst++, src32++) *dst += hfa384x2host_32(*src32); } else { dst = (UINT32 *) &hw->tallies; src16 = (UINT16 *) &inf->info.commtallies16; for (i = 0; i < cnt; i++, dst++, src16++) *dst += hfa384x2host_16(*src16); } DBFEXIT; return;}/*----------------------------------------------------------------* prism2sta_inf_scanresults** Handles the receipt of a Scan Results info frame.** Arguments:* wlandev wlan device structure* inf ptr to info frame (contents in hfa384x order)** Returns: * nothing** Side effects:** Call context:* interrupt----------------------------------------------------------------*/void prism2sta_inf_scanresults(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){ hfa384x_t *hw = (hfa384x_t *)wlandev->priv; int nbss; hfa384x_ScanResult_t *sr = &(inf->info.scanresult); int i; hfa384x_JoinRequest_data_t joinreq; int result; DBFENTER; /* Get the number of results, first in bytes, then in results */ nbss = (inf->framelen * sizeof(UINT16)) - sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason); nbss /= sizeof(hfa384x_ScanResultSub_t); /* Print em */ WLAN_LOG_DEBUG(1,"rx scanresults, reason=%d, nbss=%d:\n", inf->info.scanresult.scanreason, nbss); for ( i = 0; i < nbss; i++) { WLAN_LOG_DEBUG(1, "chid=%d anl=%d sl=%d bcnint=%d\n", sr->result[i].chid, sr->result[i].anl, sr->result[i].sl, sr->result[i].bcnint); WLAN_LOG_DEBUG(1, " capinfo=0x%04x proberesp_rate=%d\n", sr->result[i].capinfo, sr->result[i].proberesp_rate); } /* issue a join request */ joinreq.channel = sr->result[0].chid; memcpy( joinreq.bssid, sr->result[0].bssid, WLAN_BSSID_LEN); result = hfa384x_drvr_setconfig( hw, HFA384x_RID_JOINREQUEST, &joinreq, HFA384x_RID_JOINREQUEST_LEN); if (result) { WLAN_LOG_ERROR("setconfig(joinreq) failed, result=%d\n", result); } DBFEXIT; return;}/*----------------------------------------------------------------* prism2sta_inf_hostscanresults** Handles the receipt of a Scan Results info frame.** Arguments:* wlandev wlan device structure* inf ptr to info frame (contents in hfa384x order)** Returns: * nothing** Side effects:** Call context:* interrupt----------------------------------------------------------------*/void prism2sta_inf_hostscanresults(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf){ hfa384x_t *hw = (hfa384x_t *)wlandev->priv; int nbss; DBFENTER; nbss = (inf->framelen - 3) / 32; WLAN_LOG_DEBUG(1, "Received %d hostscan results\n", nbss); if (nbss > 32) nbss = 32; if (hw->scanresults) kfree(hw->scanresults); hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC); memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t)); if (nbss == 0) nbss = -1; /* Notify/wake the sleeping caller. */ hw->scanflag = nbss; wake_up_interruptible(&hw->cmdq); DBFEXIT;};/*----------------------------------------------------------------* prism2sta_inf_chinforesults** Handles the receipt of a Channel Info Results info frame.** Arguments:* wlandev wlan device structure* inf ptr to info frame (contents in hfa384x order)** Returns: * nothing** Side effects:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -