epping_adapter_t *epping_add_adapter(epping_context_t *pEpping_ctx, tSirMacAddr macAddr, tCDF_CON_MODE device_mode) { struct net_device *dev; epping_adapter_t *pAdapter; dev = alloc_netdev(sizeof(epping_adapter_t), "wifi%d", #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) NET_NAME_UNKNOWN, #endif ether_setup); if (dev == NULL) { EPPING_LOG(CDF_TRACE_LEVEL_FATAL, "%s: Cannot allocate epping_adapter_t\n", __func__); return NULL; } pAdapter = netdev_priv(dev); cdf_mem_zero(pAdapter, sizeof(*pAdapter)); pAdapter->dev = dev; pAdapter->pEpping_ctx = pEpping_ctx; pAdapter->device_mode = device_mode; /* station, SAP, etc */ cdf_mem_copy(dev->dev_addr, (void *)macAddr, sizeof(tSirMacAddr)); cdf_mem_copy(pAdapter->macAddressCurrent.bytes, macAddr, sizeof(tSirMacAddr)); cdf_spinlock_init(&pAdapter->data_lock); cdf_nbuf_queue_init(&pAdapter->nodrop_queue); pAdapter->epping_timer_state = EPPING_TX_TIMER_STOPPED; cdf_softirq_timer_init(epping_get_cdf_ctx(), &pAdapter->epping_timer, epping_timer_expire, dev, CDF_TIMER_TYPE_SW); dev->type = ARPHRD_IEEE80211; dev->netdev_ops = &epping_drv_ops; dev->watchdog_timeo = 5 * HZ; /* XXX */ dev->tx_queue_len = EPPING_TXBUF - 1; /* 1 for mgmt frame */ if (epping_register_adapter(pAdapter) == 0) { EPPING_LOG(LOG1, FL("Disabling queues")); netif_tx_disable(dev); netif_carrier_off(dev); return pAdapter; } else { epping_destroy_adapter(pAdapter); return NULL; } }
void epping_exit(v_CONTEXT_t pVosContext) { epping_context_t *pEpping_ctx; VosContextType *gpVosContext; pEpping_ctx = vos_get_context(VOS_MODULE_ID_HDD, pVosContext); if (pEpping_ctx == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: error: pEpping_ctx = NULL", __func__); return; } gpVosContext = pEpping_ctx->pVosContext; if (pVosContext == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: error: pVosContext = NULL", __func__); return; } if (pEpping_ctx->epping_adapter) { epping_destroy_adapter(pEpping_ctx->epping_adapter); pEpping_ctx->epping_adapter = NULL; } hif_disable_isr(gpVosContext->pHIFContext); hif_reset_soc(gpVosContext->pHIFContext); HTCStop(gpVosContext->htc_ctx); HTCDestroy(gpVosContext->htc_ctx); gpVosContext->htc_ctx = NULL; #ifdef HIF_PCI { int i; for (i = 0; i < EPPING_MAX_NUM_EPIDS; i++) { epping_unregister_tx_copier(i, pEpping_ctx); } } #endif /* HIF_PCI */ epping_cookie_cleanup(pEpping_ctx); }