您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DHD_INFO函数代码示例

51自学网 2021-06-01 20:21:38
  C++
这篇教程C++ DHD_INFO函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DHD_INFO函数的典型用法代码示例。如果您正苦于以下问题:C++ DHD_INFO函数的具体用法?C++ DHD_INFO怎么用?C++ DHD_INFO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DHD_INFO函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: wl_android_prealloc

void* wl_android_prealloc(int section, unsigned long size){	void *alloc_ptr = NULL;	if (wifi_control_data && wifi_control_data->mem_prealloc) {		alloc_ptr = wifi_control_data->mem_prealloc(section, size);		if (alloc_ptr) {			DHD_INFO(("success alloc section %d/n", section));			if (size != 0L)				bzero(alloc_ptr, size);			return alloc_ptr;		}	}	DHD_ERROR(("can't alloc section %d/n", section));	return NULL;}
开发者ID:JoinTheRealms,项目名称:TF700-dualboot-hunds,代码行数:16,


示例2: wl_android_get_link_speed

/** * Local (static) function definitions */static int wl_android_get_link_speed(struct net_device *net, char *command, int total_len){	int link_speed;	int bytes_written;	int error;	error = wldev_get_link_speed(net, &link_speed);	if (error)		return -1;	/* Convert Kbps to Android Mbps */	link_speed = link_speed / 1000;	bytes_written = snprintf(command, total_len, "LinkSpeed %d", link_speed);	DHD_INFO(("%s: command result is %s/n", __FUNCTION__, command));	return bytes_written;}
开发者ID:AxelLin,项目名称:MTK5931,代码行数:19,


示例3: wl_android_set_ssid

static intwl_android_set_ssid(struct net_device *dev, const char* hapd_ssid){	wlc_ssid_t ssid;	s32 ret;	ssid.SSID_len = strlen(hapd_ssid);	bcm_strncpy_s(ssid.SSID, sizeof(ssid.SSID), hapd_ssid, ssid.SSID_len);	DHD_INFO(("%s: HAPD_SSID = %s/n", __FUNCTION__, ssid.SSID));	ret = wldev_ioctl(dev, WLC_SET_SSID, &ssid, sizeof(wlc_ssid_t), true);	if (ret < 0) {		DHD_ERROR(("%s : WLC_SET_SSID Error:%d/n", __FUNCTION__, ret));	}	return 1;}
开发者ID:onenonlycasper,项目名称:tf700t_kernel,代码行数:16,


示例4: wl_android_set_suspendmode

static int wl_android_set_suspendmode(struct net_device *dev, char *command, int total_len){	int ret = 0;	int suspend_flag;	suspend_flag = *(command + strlen(CMD_SETSUSPENDMODE) + 1) - '0';	if (suspend_flag != 0)		suspend_flag = 1;	if (!(ret = net_os_set_suspend(dev, suspend_flag, 0)))		DHD_INFO(("%s: Suspend Mode %d/n", __FUNCTION__, suspend_flag));	else		DHD_ERROR(("%s: failed %d/n",__FUNCTION__,ret));	return ret;}
开发者ID:alfsamsung,项目名称:LG_X3_P880_v20a,代码行数:18,


示例5: wifi_platform_prealloc

void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned long size){	void *alloc_ptr = NULL;	struct wifi_platform_data *plat_data;	if (!adapter || !adapter->wifi_plat_data)		return NULL;	plat_data = adapter->wifi_plat_data;	if (plat_data->mem_prealloc) {		alloc_ptr = plat_data->mem_prealloc(section, size);		if (alloc_ptr) {			DHD_INFO(("success alloc section %d/n", section));			if (size != 0L)				bzero(alloc_ptr, size);			return alloc_ptr;		}	}	return NULL;}
开发者ID:TeamElevate,项目名称:edison,代码行数:19,


示例6: dhd_flow_rings_deinit

/* Deinit Flow Ring specific data structures */void dhd_flow_rings_deinit(dhd_pub_t *dhdp){	uint16 idx;	uint32 flow_ring_table_sz;	uint32 if_flow_lkup_sz;	flow_ring_table_t *flow_ring_table;	DHD_INFO(("dhd_flow_rings_deinit/n"));	if (dhdp->flow_ring_table != NULL) {		ASSERT(dhdp->num_flow_rings > 0);		flow_ring_table = (flow_ring_table_t *)dhdp->flow_ring_table;		for (idx = 0; idx < dhdp->num_flow_rings; idx++) {			if (flow_ring_table[idx].active) {				dhd_bus_clean_flow_ring(dhdp->bus, idx);			}			ASSERT(flow_queue_empty(&flow_ring_table[idx].queue));			/* Deinit flow ring queue locks before destroying flow ring table */			dhd_os_spin_lock_deinit(dhdp->osh, flow_ring_table[idx].queue.lock);			flow_ring_table[idx].queue.lock = NULL;		}		/* Destruct the flow ring table */		flow_ring_table_sz = dhdp->num_flow_rings * sizeof(flow_ring_table_t);		MFREE(dhdp->osh, dhdp->flow_ring_table, flow_ring_table_sz);		dhdp->flow_ring_table = NULL;	}	/* Destruct the per interface flow lkup table */	if (dhdp->if_flow_lkup != NULL) {		if_flow_lkup_sz = sizeof(if_flow_lkup_t) * DHD_MAX_IFS;		MFREE(dhdp->osh, dhdp->if_flow_lkup, if_flow_lkup_sz);		dhdp->if_flow_lkup = NULL;	}	/* Destruct the flowid allocator */	if (dhdp->flowid_allocator != NULL)		dhdp->flowid_allocator = id16_map_fini(dhdp->osh, dhdp->flowid_allocator);	dhdp->num_flow_rings = 0U;}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:44,


示例7: dhd_hostwakeup_isr

/** * Schedules a tasklet to run when receiving an interrupt on the * <code>HOST_WAKE</code> GPIO pin. * @param irq Not used. * @param dev_id Not used. */static irqreturn_tdhd_hostwakeup_isr(int irq, void *dev_id){	int gpio = 0;	gpio = gpio_get_value(GPIO_WLAN_HOST_WAKE);	printk(KERN_ERR "[%s] HostWakeup Get GPIO %d: %d/n", 		__func__, GPIO_WLAN_HOST_WAKE, gpio);#if !defined(CONFIG_LGE_BCM432X_PATCH)	set_irq_type(dhd_wifi_sleep->host_wake_irq, gpio ? IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH);#endif /* CONFIG_LGE_BCM432X_PATCH */	if (!gpio) {		DHD_INFO(("[WiFi] complete on host-wakeup /n"));		return IRQ_HANDLED;	}	/* schedule a tasklet to handle the change in the host wake line */	return IRQ_HANDLED;}
开发者ID:venkatkamesh,项目名称:lg_ally_kernel-2.6.XX,代码行数:26,


示例8: dhd_update_interface_link_status

/* Handle a STA interface link status update */intdhd_update_interface_link_status(dhd_pub_t *dhdp, uint8 ifindex, uint8 status){	if_flow_lkup_t *if_flow_lkup;	ASSERT(ifindex < DHD_MAX_IFS);	if (ifindex >= DHD_MAX_IFS)		return BCME_BADARG;	if_flow_lkup = (if_flow_lkup_t *)dhdp->if_flow_lkup;	DHD_INFO(("%s: ifindex %d status %d/n", __FUNCTION__, ifindex, status));	if (if_flow_lkup[ifindex].role == WLC_E_IF_ROLE_STA) {		if (status)			if_flow_lkup[ifindex].status = TRUE;		else			if_flow_lkup[ifindex].status = FALSE;	}	return BCME_OK;}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:21,


示例9: wl_android_get_country_rev

static int wl_android_get_country_rev(		struct net_device *dev, char *command, int total_len){	int error;	int bytes_written;	char smbuf[WLC_IOCTL_SMLEN];	wl_country_t cspec;	error = wldev_iovar_getbuf(dev, "country", &cspec, sizeof(cspec), smbuf,		sizeof(smbuf), NULL);	if (error) {		DHD_ERROR(("%s: get country failed code %d/n",			__func__, error));		return -1;	} else {		DHD_INFO(("%s: get country '%s %d'/n", __func__, smbuf, smbuf[WLC_CNTRY_BUF_SZ]));	}	bytes_written = snprintf(command, total_len, "%s %s %d", CMD_COUNTRYREV_GET, smbuf, smbuf[WLC_CNTRY_BUF_SZ]);	return bytes_written;}
开发者ID:Jimmyk422,项目名称:android_kernel_samsung_iconvmu,代码行数:21,


示例10: dhd_flow_rings_delete

/* Delete all Flow rings assocaited with the given Interface */voiddhd_flow_rings_delete(dhd_pub_t *dhdp, uint8 ifindex){	uint32 id;	flow_ring_table_t *flow_ring_table;	DHD_INFO(("%s: ifindex %u/n", __FUNCTION__, ifindex));	ASSERT(ifindex < DHD_MAX_IFS);	if (!dhdp->flow_ring_table)		return;	flow_ring_table = (flow_ring_table_t *)dhdp->flow_ring_table;	for (id = 0; id < dhdp->num_flow_rings; id++) {		if (flow_ring_table[id].active &&		    (flow_ring_table[id].flow_info.ifindex == ifindex)) {			dhd_bus_flow_ring_delete_request(dhdp->bus,			                                 (void *) &flow_ring_table[id]);		}	}}
开发者ID:FrozenCow,项目名称:FIRE-ICE,代码行数:22,


示例11: WriteRDWR_Macaddr

int WriteRDWR_Macaddr(struct ether_addr *mac){	char* filepath			= "/data/.mac.info";	struct file *fp_mac	= NULL;	char buf[18]			= {0};	mm_segment_t oldfs		= {0};	int ret = -1;		if ((g_iMacFlag != MACADDR_COB) && (g_iMacFlag != MACADDR_MOD))		return 0;		sprintf(buf,"%02X:%02X:%02X:%02X:%02X:%02X/n",		mac->octet[0],mac->octet[1],mac->octet[2],		mac->octet[3],mac->octet[4],mac->octet[5]);		fp_mac = filp_open(filepath, O_RDWR | O_CREAT, 0666); // File is always created.	if(IS_ERR(fp_mac)) {		DHD_ERROR(("[WIFI] %s: File open error/n", filepath));		return -1;	}	else {		oldfs = get_fs();		set_fs(get_ds());				if(fp_mac->f_mode & FMODE_WRITE) {			ret = fp_mac->f_op->write(fp_mac, (const char *)buf, sizeof(buf), &fp_mac->f_pos);			if(ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s] Failed to write into File: %s/n", buf, filepath));			else				DHD_INFO(("[WIFI] Mac address [%s] written into File: %s/n", buf, filepath));		}       		set_fs(oldfs);		filp_close(fp_mac, NULL);	}		return 0;	}
开发者ID:mkannapa,项目名称:sgh-i727-kernels,代码行数:38,


示例12: pkt_frag_info

pkt_frag_t pkt_frag_info(osl_t *osh, void *p){	uint8 *frame;	int length;	uint8 *pt;			/* Pointer to type field */	uint16 ethertype;	struct ipv4_hdr *iph;		/* IP frame pointer */	int ipl;			/* IP frame length */	uint16 iph_frag;	ASSERT(osh && p);	frame = PKTDATA(osh, p);	length = PKTLEN(osh, p);	/* Process Ethernet II or SNAP-encapsulated 802.3 frames */	if (length < ETHER_HDR_LEN) {		DHD_INFO(("%s: short eth frame (%d)/n", __FUNCTION__, length));		return DHD_PKT_FRAG_NONE;	} else if (ntoh16(*(uint16 *)(frame + ETHER_TYPE_OFFSET)) >= ETHER_TYPE_MIN) {		/* Frame is Ethernet II */		pt = frame + ETHER_TYPE_OFFSET;	} else if (length >= ETHER_HDR_LEN + SNAP_HDR_LEN + ETHER_TYPE_LEN &&	           !bcmp(llc_snap_hdr, frame + ETHER_HDR_LEN, SNAP_HDR_LEN)) {		pt = frame + ETHER_HDR_LEN + SNAP_HDR_LEN;	} else {		DHD_INFO(("%s: non-SNAP 802.3 frame/n", __FUNCTION__));		return DHD_PKT_FRAG_NONE;	}	ethertype = ntoh16(*(uint16 *)pt);	/* Skip VLAN tag, if any */	if (ethertype == ETHER_TYPE_8021Q) {		pt += VLAN_TAG_LEN;		if (pt + ETHER_TYPE_LEN > frame + length) {			DHD_INFO(("%s: short VLAN frame (%d)/n", __FUNCTION__, length));			return DHD_PKT_FRAG_NONE;		}		ethertype = ntoh16(*(uint16 *)pt);	}	if (ethertype != ETHER_TYPE_IP) {		DHD_INFO(("%s: non-IP frame (ethertype 0x%x, length %d)/n",			__FUNCTION__, ethertype, length));		return DHD_PKT_FRAG_NONE;	}	iph = (struct ipv4_hdr *)(pt + ETHER_TYPE_LEN);	ipl = (uint)(length - (pt + ETHER_TYPE_LEN - frame));	/* We support IPv4 only */	if ((ipl < IPV4_OPTIONS_OFFSET) || (IP_VER(iph) != IP_VER_4)) {		DHD_INFO(("%s: short frame (%d) or non-IPv4/n", __FUNCTION__, ipl));		return DHD_PKT_FRAG_NONE;	}	iph_frag = ntoh16(iph->frag);	if (iph_frag & IPV4_FRAG_DONT) {		return DHD_PKT_FRAG_NONE;	} else if ((iph_frag & IPV4_FRAG_MORE) == 0) {		return DHD_PKT_FRAG_LAST;	} else {		return (iph_frag & IPV4_FRAG_OFFSET_MASK)? DHD_PKT_FRAG_CONT : DHD_PKT_FRAG_FIRST;	}}
开发者ID:MindShow,项目名称:amlogic_s905_kernel_merges,代码行数:69,


示例13: dhd_write_rdwr_korics_macaddr

int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac){	struct file *fp      = NULL;	char macbuffer[18]   = {0};	mm_segment_t oldfs   = {0};	char randommac[3]    = {0};	char buf[18]         = {0};	char *filepath_efs       = MACINFO_EFS;	int is_zeromac       = 0;	int ret = 0;	/* MAC address copied from efs/wifi.mac.info */	fp = filp_open(filepath_efs, O_RDONLY, 0);	if (IS_ERR(fp)) {		/* File Doesn't Exist. Create and write mac addr. */		fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);		if (IS_ERR(fp)) {			DHD_ERROR(("[WIFI] %s: File open error/n",				filepath_efs));			return -1;		}		oldfs = get_fs();		set_fs(get_ds());		/* Generating the Random Bytes for		 * 3 last octects of the MAC address		 */		get_random_bytes(randommac, 3);		sprintf(macbuffer, "%02X:%02X:%02X:%02X:%02X:%02X/n",			0x60, 0xd0, 0xa9, randommac[0],			randommac[1], randommac[2]);		DHD_ERROR(("[WIFI] The Random Generated MAC ID : %s/n",			macbuffer));		if (fp->f_mode & FMODE_WRITE) {			ret = fp->f_op->write(fp,				(const char *)macbuffer,				sizeof(macbuffer), &fp->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s]"					" Failed to write into File:"					" %s/n", macbuffer, filepath_efs));			else				DHD_ERROR(("[WIFI] Mac address [%s]"					" written into File: %s/n",					macbuffer, filepath_efs));		}		set_fs(oldfs);	} else {	/* Reading the MAC Address from .mac.info file	 * (the existed file or just created file)	 */	    ret = kernel_read(fp, 0, buf, 18);		/* to prevent abnormal string display when mac address		 * is displayed on the screen.		 */		buf[17] = '/0';		/* Remove security log */		/* DHD_ERROR(("Read MAC : [%s] [%d] /r/n", buf,		 * strncmp(buf, "00:00:00:00:00:00", 17)));		 */		if ((buf[0] == '/0') ||			(strncmp(buf, "00:00:00:00:00:00", 17) == 0)) {			is_zeromac = 1;		}	}	if (ret)		sscanf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",			(unsigned int *)&(mac->octet[0]),			(unsigned int *)&(mac->octet[1]),			(unsigned int *)&(mac->octet[2]),			(unsigned int *)&(mac->octet[3]),			(unsigned int *)&(mac->octet[4]),			(unsigned int *)&(mac->octet[5]));	else		DHD_INFO(("dhd_bus_start: Reading from the"			" '%s' returns 0 bytes/n", filepath_efs));	if (fp)		filp_close(fp, NULL);	if (!is_zeromac) {		/* Writing Newly generated MAC ID to the Dongle */		if (_dhd_set_mac_address(dhd, 0, mac) == 0)			DHD_INFO(("dhd_bus_start: MACID is overwritten/n"));		else			DHD_ERROR(("dhd_bus_start: _dhd_set_mac_address() "				"failed/n"));	} else {		DHD_ERROR(("dhd_bus_start:Is ZeroMAC BypassWrite.mac.info!/n"));	}	return 0;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:97,


示例14: dhd_check_rdwr_macaddr

int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp,	struct ether_addr *mac){	struct file *fp_mac = NULL;	struct file *fp_nvm = NULL;	char macbuffer[18]    = {0};	char randommac[3]   = {0};	char buf[18]      = {0};	char *filepath_data      = MACINFO;	char *filepath_efs      = MACINFO_EFS;#ifdef CONFIG_TARGET_LOCALE_NA	char *nvfilepath       = "/data/misc/wifi/.nvmac.info";#else	char *nvfilepath = "/efs/wifi/.nvmac.info";#endif	char cur_mac[128]   = {0};	char dummy_mac[ETHER_ADDR_LEN] = {0x00, 0x90, 0x4C, 0xC5, 0x12, 0x38};	char cur_macbuffer[18]  = {0};	int ret = -1;	g_imac_flag = MACADDR_NONE;	fp_nvm = filp_open(nvfilepath, O_RDONLY, 0);	if (IS_ERR(fp_nvm)) { /* file does not exist */		/* read MAC Address */		strcpy(cur_mac, "cur_etheraddr");		ret = dhd_wl_ioctl_cmd(dhdp, WLC_GET_VAR, cur_mac,			sizeof(cur_mac), 0, 0);		if (ret < 0) {			DHD_ERROR(("Current READ MAC error /r/n"));			memset(cur_mac, 0, ETHER_ADDR_LEN);			return -1;		} else {			DHD_ERROR(("MAC (OTP) : "			"[%02X:%02X:%02X:%02X:%02X:%02X] /r/n",			cur_mac[0], cur_mac[1], cur_mac[2], cur_mac[3],			cur_mac[4], cur_mac[5]));		}		sprintf(cur_macbuffer, "%02X:%02X:%02X:%02X:%02X:%02X/n",			cur_mac[0], cur_mac[1], cur_mac[2],			cur_mac[3], cur_mac[4], cur_mac[5]);		fp_mac = filp_open(filepath_data, O_RDONLY, 0);		if (IS_ERR(fp_mac)) { /* file does not exist */			/* read mac is the dummy mac (00:90:4C:C5:12:38) */			if (memcmp(cur_mac, dummy_mac, ETHER_ADDR_LEN) == 0)				g_imac_flag = MACADDR_MOD_RANDOM;			else if (strncmp(buf, "00:00:00:00:00:00", 17) == 0)				g_imac_flag = MACADDR_MOD_RANDOM;			else				g_imac_flag = MACADDR_MOD;		} else {			int is_zeromac;			ret = kernel_read(fp_mac, 0, buf, 18);			filp_close(fp_mac, NULL);			buf[17] = '/0';			is_zeromac = strncmp(buf, "00:00:00:00:00:00", 17);			DHD_ERROR(("MAC (FILE): [%s] [%d] /r/n",				buf, is_zeromac));			if (is_zeromac == 0) {				DHD_ERROR(("Zero MAC detected."					" Trying Random MAC./n"));				g_imac_flag = MACADDR_MOD_RANDOM;			} else {				sscanf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",					(unsigned int *)&(mac->octet[0]),					(unsigned int *)&(mac->octet[1]),					(unsigned int *)&(mac->octet[2]),					(unsigned int *)&(mac->octet[3]),					(unsigned int *)&(mac->octet[4]),					(unsigned int *)&(mac->octet[5]));			/* current MAC address is same as previous one */				if (memcmp(cur_mac, mac->octet, ETHER_ADDR_LEN) == 0) {					g_imac_flag = MACADDR_NONE;				} else { /* change MAC address */					if (_dhd_set_mac_address(dhd, 0, mac) == 0) {						DHD_INFO(("%s: MACID is"						" overwritten/n", __FUNCTION__));						g_imac_flag = MACADDR_MOD;					} else {						DHD_ERROR(("%s: "						"_dhd_set_mac_address()"						" failed/n", __FUNCTION__));						g_imac_flag = MACADDR_NONE;					}				}			}		}		fp_mac = filp_open(filepath_efs, O_RDONLY, 0);		if (IS_ERR(fp_mac)) { /* file does not exist */			/* read mac is the dummy mac (00:90:4C:C5:12:38) */			if (memcmp(cur_mac, dummy_mac, ETHER_ADDR_LEN) == 0)				g_imac_flag = MACADDR_MOD_RANDOM;			else if (strncmp(buf, "00:00:00:00:00:00", 17) == 0)				g_imac_flag = MACADDR_MOD_RANDOM;//.........这里部分代码省略.........
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:101,


示例15: dhd_write_rdwr_macaddr

int dhd_write_rdwr_macaddr(struct ether_addr *mac){	char *filepath_data = MACINFO;	char *filepath_efs = MACINFO_EFS;	struct file *fp_mac = NULL;	char buf[18]      = {0};	mm_segment_t oldfs    = {0};	int ret = -1;	if ((g_imac_flag != MACADDR_COB) && (g_imac_flag != MACADDR_MOD))		return 0;	sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X/n",		mac->octet[0], mac->octet[1], mac->octet[2],		mac->octet[3], mac->octet[4], mac->octet[5]);	/* /efs/wifi/.mac.info will be created */	fp_mac = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);	if (IS_ERR(fp_mac)) {		DHD_ERROR(("[WIFI] %s: File open error/n", filepath_data));		return -1;	}	else {		oldfs = get_fs();		set_fs(get_ds());		if (fp_mac->f_mode & FMODE_WRITE) {			ret = fp_mac->f_op->write(fp_mac, (const char *)buf,				sizeof(buf), &fp_mac->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s] Failed"				" to write into File: %s/n", buf, filepath_data));			else				DHD_INFO(("[WIFI] Mac address [%s] written"				" into File: %s/n", buf, filepath_data));		}		set_fs(oldfs);		filp_close(fp_mac, NULL);	}	/* /data/.mac.info will be created */	fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666);	if (IS_ERR(fp_mac)) {		DHD_ERROR(("[WIFI] %s: File open error/n", filepath_efs));		return -1;	}	else {		oldfs = get_fs();		set_fs(get_ds());		if (fp_mac->f_mode & FMODE_WRITE) {			ret = fp_mac->f_op->write(fp_mac, (const char *)buf,				sizeof(buf), &fp_mac->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s] Failed"				" to write into File: %s/n", buf, filepath_efs));			else				DHD_INFO(("[WIFI] Mac address [%s] written"				" into File: %s/n", buf, filepath_efs));		}		set_fs(oldfs);		filp_close(fp_mac, NULL);	}	return 0;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:64,


示例16: dhd_read_macaddr

int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac){	struct file *fp      = NULL;	char macbuffer[18]   = {0};	mm_segment_t oldfs   = {0};	char randommac[3]    = {0};	char buf[18]         = {0};	char *filepath_efs       = MACINFO_EFS;	int ret = 0;	fp = filp_open(filepath_efs, O_RDONLY, 0);	if (IS_ERR(fp)) {start_readmac:		/* File Doesn't Exist. Create and write mac addr. */		fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);		if (IS_ERR(fp)) {			DHD_ERROR(("[WIFI] %s: File open error/n", filepath_efs));			return -1;		}		oldfs = get_fs();		set_fs(get_ds());		/* Generating the Random Bytes for 3 last octects of the MAC address */		get_random_bytes(randommac, 3);		sprintf(macbuffer, "%02X:%02X:%02X:%02X:%02X:%02X/n",			0x00, 0x12, 0x34, randommac[0], randommac[1], randommac[2]);		DHD_ERROR(("[WIFI]The Random Generated MAC ID: %s/n", macbuffer));		if (fp->f_mode & FMODE_WRITE) {			ret = fp->f_op->write(fp, (const char *)macbuffer,			sizeof(macbuffer), &fp->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI]MAC address [%s] Failed to write into File: %s/n",					macbuffer, filepath_efs));			else				DHD_ERROR(("[WIFI]MAC address [%s] written into File: %s/n",					macbuffer, filepath_efs));		}		set_fs(oldfs);		/* Reading the MAC Address from .mac.info file		   ( the existed file or just created file)		 */		ret = kernel_read(fp, 0, buf, 18);	} else {		/* Reading the MAC Address from		   .mac.info file( the existed file or just created file)		 */		ret = kernel_read(fp, 0, buf, 18);		/* to prevent abnormal string display		* when mac address is displayed on the screen.		*/		buf[17] = '/0';		if (strncmp(buf, "00:00:00:00:00:00", 17) < 1) {			DHD_ERROR(("goto start_readmac /r/n"));			filp_close(fp, NULL);			goto start_readmac;		}	}	if (ret)		sscanf(buf, "%02X:%02X:%02X:%02X:%02X:%02X",			(unsigned int *)&(mac->octet[0]), (unsigned int *)&(mac->octet[1]),			(unsigned int *)&(mac->octet[2]), (unsigned int *)&(mac->octet[3]),			(unsigned int *)&(mac->octet[4]), (unsigned int *)&(mac->octet[5]));	else		DHD_ERROR(("dhd_bus_start: Reading from the '%s' returns 0 bytes/n", filepath_efs));	if (fp)		filp_close(fp, NULL);	/* Writing Newly generated MAC ID to the Dongle */	if (_dhd_set_mac_address(dhd, 0, mac) == 0)		DHD_INFO(("dhd_bus_start: MACID is overwritten/n"));	else		DHD_ERROR(("dhd_bus_start: _dhd_set_mac_address() failed/n"));	return 0;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:79,


示例17: sec_save_wlinfo

uint32 sec_save_wlinfo(char* firm_ver, char* dhd_ver, char* nvram_p){	struct file *fp = NULL;	struct file *nvfp = NULL;	char *filepath = "/data/.wifiver.info";	int min_len, str_len = 0;	int ret = 0;	char* nvram_buf;	char temp_buf[256];	DHD_TRACE(("[WIFI] %s: Entered./n", __FUNCTION__));	DHD_INFO(("[WIFI] firmware version   : %s/n", firm_ver));	DHD_INFO(("[WIFI] dhd driver version : %s/n", dhd_ver));	DHD_INFO(("[WIFI] nvram path : %s/n", nvram_p));	memset(version_info,0,sizeof(version_info));	if(strlen(dhd_ver)){		min_len = min(strlen(dhd_ver) ,  max_len(temp_buf, DHD_prefix));		min_len += strlen(DHD_prefix) + 3;		DHD_INFO(("[WIFI] DHD ver length : %d/n", min_len));		snprintf(version_info+str_len, min_len, DHD_prefix " %s/n",dhd_ver);		str_len = strlen(version_info);		DHD_INFO(("[WIFI] version_info len : %d/n", str_len));		DHD_INFO(("[WIFI] version_info : %s/n", version_info));	}else{		DHD_ERROR(("[WIFI] Driver version is missing./n"));	}	if(strlen(firm_ver)){		min_len = min(strlen(firm_ver) ,  max_len(temp_buf, Firm_prefix));		min_len += strlen(Firm_prefix) + 3;		DHD_INFO(("[WIFI] firmware ver length : %d/n", min_len));		snprintf(version_info+str_len, min_len, Firm_prefix " %s/n",firm_ver);		str_len = strlen(version_info);		DHD_INFO(("[WIFI] version_info len : %d/n", str_len));		DHD_INFO(("[WIFI] version_info : %s/n", version_info));	}else{		DHD_ERROR(("[WIFI] Firmware version is missing./n"));	}	if(nvram_p){		memset(temp_buf,0,sizeof(temp_buf));		nvfp = filp_open(nvram_p, O_RDONLY, 0);		if (IS_ERR(nvfp) || (nvfp == NULL)) {			DHD_ERROR(("[WIFI] %s: Nvarm File open failed./n", __FUNCTION__));			return -1;		} else {			ret = kernel_read(nvfp, nvfp->f_pos, temp_buf, sizeof(temp_buf));			filp_close(nvfp, NULL);		}		if(strlen(temp_buf)){			nvram_buf = temp_buf;			bcmstrtok(&nvram_buf, "/n", 0);			DHD_INFO(("[WIFI] nvram tolkening : %s(%d) /n", temp_buf, strlen(temp_buf)));			snprintf(version_info+str_len, tstr_len(temp_buf, Nv_prefix), Nv_prefix " %s/n", temp_buf);			str_len = strlen(version_info);			DHD_INFO(("[WIFI] version_info : %s/n", version_info));			DHD_INFO(("[WIFI] version_info len : %d, nvram len : %d/n", str_len, strlen(temp_buf)));		}else{			DHD_ERROR(("[WIFI] No info is missing./n"));		}	}else{		DHD_ERROR(("[WIFI] No nvram path/n"));	}	DHD_INFO(("[WIFI] version_info : %s, strlen : %d/n", version_info,strlen(version_info)));	fp = filp_open(filepath, O_RDONLY, 0);	if (fp != NULL) {		if (IS_ERR(fp) || (fp == NULL)) {			DHD_INFO(("[WIFI] %s: File open failed./n", __FUNCTION__));		} else {			memset(version_old_info, 0, sizeof(version_old_info));			ret = kernel_read(fp, fp->f_pos, version_old_info, sizeof(version_info));			filp_close(fp, NULL);			DHD_INFO(("[WIFI] kernel_read ret : %d./n", ret));			if(strcmp(version_info,version_old_info) == 0){				DHD_ERROR(("[WIFI] %s: : already saved./n", __FUNCTION__));				return 0;			}		}	}	fp = filp_open(filepath, O_RDWR | O_CREAT, 0666);	if (IS_ERR(fp) || (fp == NULL)) {		DHD_ERROR(("[WIFI] %s: File open failed./n",			__FUNCTION__));	} else {		ret = write_filesystem(fp, fp->f_pos, version_info, sizeof(version_info));		DHD_INFO(("[WIFI] sec_save_wlinfo done. ret : %d/n",ret));		DHD_ERROR(("[WIFI] save .wifiver.info file./n"));		filp_close(fp, NULL);	}	return ret;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:100,


示例18: sec_get_param

int sec_get_param(dhd_pub_t *dhd, int mode){	struct file *fp = NULL;	char *filepath = NULL;	int val, ret = 0;	if (!dhd || (mode < SET_PARAM_BUS_TXGLOM_MODE) ||		(mode >= PARAM_LAST_VALUE)) {		DHD_ERROR(("[WIFI] %s: invalid argument/n", __FUNCTION__));		return -EINVAL;	}	switch (mode) {		case SET_PARAM_BUS_TXGLOM_MODE:			filepath = "/data/.bustxglom.info";			break;		case SET_PARAM_ROAMOFF:			filepath = "/data/.roamoff.info";			break;#ifdef USE_WL_FRAMEBURST		case SET_PARAM_FRAMEBURST:			filepath = "/data/.frameburst.info";			break;#endif /* USE_WL_FRAMEBURST */#ifdef USE_WL_TXBF		case SET_PARAM_TXBF:			filepath = "/data/.txbf.info";			break;#endif /* USE_WL_TXBF */		default:			return -EINVAL;	}	fp = filp_open(filepath, O_RDONLY, 0);	if (IS_ERR(fp) || (fp == NULL)) {		ret = -EIO;	} else {		ret = kernel_read(fp, fp->f_pos, (char *)&val, 4);		filp_close(fp, NULL);	}	if (ret < 0) {		/* File operation is failed so we will return default value */		switch (mode) {			case SET_PARAM_BUS_TXGLOM_MODE:				val = CUSTOM_GLOM_SETTING;				break;			case SET_PARAM_ROAMOFF:#ifdef ROAM_ENABLE				val = 0;#elif defined(DISABLE_BUILTIN_ROAM)				val = 1;#else				val = 0;#endif /* ROAM_ENABLE */				break;#ifdef USE_WL_FRAMEBURST			case SET_PARAM_FRAMEBURST:				val = 1;				break;#endif /* USE_WL_FRAMEBURST */#ifdef USE_WL_TXBF			case SET_PARAM_TXBF:				val = 1;				break;#endif /* USE_WL_TXBF */		}		DHD_INFO(("[WIFI] %s: File open failed, file path=%s,"			" default value=%d/n",			__FUNCTION__, filepath, val));		return val;	}	val = bcm_atoi((char *)&val);	DHD_INFO(("[WIFI] %s: %s = %d/n", __FUNCTION__, filepath, val));	switch (mode) {		case SET_PARAM_ROAMOFF:#ifdef USE_WL_FRAMEBURST		case SET_PARAM_FRAMEBURST:#endif /* USE_WL_FRAMEBURST */#ifdef USE_WL_TXBF		case SET_PARAM_TXBF:#endif /* USE_WL_TXBF */			val = val ? 1 : 0;			break;	}	return val;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:91,


示例19: dhd_write_macaddr

int dhd_write_macaddr(struct ether_addr *mac){	char *filepath_data      = MACINFO;	char *filepath_efs      = MACINFO_EFS;	struct file *fp_mac = NULL;	char buf[18]      = {0};	mm_segment_t oldfs    = {0};	int ret = -1;	int retry_count = 0;startwrite:	sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X/n",		mac->octet[0], mac->octet[1], mac->octet[2],		mac->octet[3], mac->octet[4], mac->octet[5]);	/* File will be created /data/.mac.info. */	fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666);	if (IS_ERR(fp_mac)) {		DHD_ERROR(("[WIFI] %s: File open error/n", filepath_data));		return -1;	} else {		oldfs = get_fs();		set_fs(get_ds());		if (fp_mac->f_mode & FMODE_WRITE) {			ret = fp_mac->f_op->write(fp_mac, (const char *)buf,				sizeof(buf), &fp_mac->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s] Failed to"				" write into File: %s/n", buf, filepath_data));			else				DHD_INFO(("[WIFI] Mac address [%s] written"				" into File: %s/n", buf, filepath_data));		}		set_fs(oldfs);		filp_close(fp_mac, NULL);	}	/* check .mac.info file is 0 byte */	fp_mac = filp_open(filepath_data, O_RDONLY, 0);	ret = kernel_read(fp_mac, 0, buf, 18);	if ((ret == 0) && (retry_count++ < 3)) {		filp_close(fp_mac, NULL);		goto startwrite;	}	filp_close(fp_mac, NULL);	/* end of /data/.mac.info */	if (filepath_efs == NULL) {		DHD_ERROR(("[WIFI]%s : no efs filepath", __func__));		return 0;	}	/* File will be created /efs/wifi/.mac.info. */	fp_mac = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666);	if (IS_ERR(fp_mac)) {		DHD_ERROR(("[WIFI] %s: File open error/n", filepath_efs));		return -1;	} else {		oldfs = get_fs();		set_fs(get_ds());		if (fp_mac->f_mode & FMODE_WRITE) {			ret = fp_mac->f_op->write(fp_mac, (const char *)buf,				sizeof(buf), &fp_mac->f_pos);			if (ret < 0)				DHD_ERROR(("[WIFI] Mac address [%s] Failed to"				" write into File: %s/n", buf, filepath_efs));			else				DHD_INFO(("[WIFI] Mac address [%s] written"				" into File: %s/n", buf, filepath_efs));		}		set_fs(oldfs);		filp_close(fp_mac, NULL);	}	/* check .mac.info file is 0 byte */	fp_mac = filp_open(filepath_efs, O_RDONLY, 0);	ret = kernel_read(fp_mac, 0, buf, 18);	if ((ret == 0) && (retry_count++ < 3)) {		filp_close(fp_mac, NULL);		goto startwrite;	}	filp_close(fp_mac, NULL);	return 0;}
开发者ID:ShinySide,项目名称:HispAsian_Kernel_NH7,代码行数:94,


示例20: dhd_flowid_alloc

/* Allocate Flow ID */static INLINE uint16dhd_flowid_alloc(dhd_pub_t *dhdp, uint8 ifindex, uint8 prio, char *sa, char *da){	flow_hash_info_t *fl_hash_node, *cur;	if_flow_lkup_t *if_flow_lkup;	int hash;	uint16 flowid;	unsigned long flags;	fl_hash_node = (flow_hash_info_t *) MALLOC(dhdp->osh, sizeof(flow_hash_info_t));	memcpy(fl_hash_node->flow_info.da, da, sizeof(fl_hash_node->flow_info.da));	DHD_FLOWID_LOCK(dhdp->flowid_lock, flags);	ASSERT(dhdp->flowid_allocator != NULL);	flowid = id16_map_alloc(dhdp->flowid_allocator);	DHD_FLOWID_UNLOCK(dhdp->flowid_lock, flags);	if (flowid == FLOWID_INVALID) {		MFREE(dhdp->osh, fl_hash_node,  sizeof(flow_hash_info_t));		DHD_ERROR(("%s: cannot get free flowid /n", __FUNCTION__));		return FLOWID_INVALID;	}	fl_hash_node->flowid = flowid;	fl_hash_node->flow_info.tid = prio;	fl_hash_node->flow_info.ifindex = ifindex;	fl_hash_node->next = NULL;	DHD_FLOWID_LOCK(dhdp->flowid_lock, flags);	if_flow_lkup = (if_flow_lkup_t *)dhdp->if_flow_lkup;	if (DHD_IF_ROLE_STA(if_flow_lkup[ifindex].role)) {		/* For STA non TDLS dest we allocate entry based on prio only */#ifdef WLTDLS		if (dhdp->peer_tbl.tdls_peer_count &&			(is_tdls_destination(dhdp, da))) {			hash = DHD_FLOWRING_HASHINDEX(da, prio);			cur = if_flow_lkup[ifindex].fl_hash[hash];			if (cur) {				while (cur->next) {					cur = cur->next;				}				cur->next = fl_hash_node;			} else {				if_flow_lkup[ifindex].fl_hash[hash] = fl_hash_node;			}		} else#endif /* WLTDLS */			if_flow_lkup[ifindex].fl_hash[prio] = fl_hash_node;	} else {		/* For bcast/mcast assign first slot in in interface */		hash = ETHER_ISMULTI(da) ? 0 : DHD_FLOWRING_HASHINDEX(da, prio);		cur = if_flow_lkup[ifindex].fl_hash[hash];		if (cur) {			while (cur->next) {				cur = cur->next;			}			cur->next = fl_hash_node;		} else			if_flow_lkup[ifindex].fl_hash[hash] = fl_hash_node;	}	DHD_FLOWID_UNLOCK(dhdp->flowid_lock, flags);	DHD_INFO(("%s: allocated flowid %d/n", __FUNCTION__, fl_hash_node->flowid));	return fl_hash_node->flowid;}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:68,


示例21: dhd_flow_rings_init

/* Init Flow Ring specific data structures */intdhd_flow_rings_init(dhd_pub_t *dhdp, uint32 num_flow_rings){	uint32 idx;	uint32 flow_ring_table_sz;	uint32 if_flow_lkup_sz;	void * flowid_allocator;	flow_ring_table_t *flow_ring_table;	if_flow_lkup_t *if_flow_lkup = NULL;#ifdef PCIE_TX_DEFERRAL	uint32 count;#endif	void *lock = NULL;	unsigned long flags;	DHD_INFO(("%s/n", __FUNCTION__));	/* Construct a 16bit flow1d allocator */	flowid_allocator = id16_map_init(dhdp->osh,	                       num_flow_rings - FLOW_RING_COMMON, FLOWID_RESERVED);	if (flowid_allocator == NULL) {		DHD_ERROR(("%s: flowid allocator init failure/n", __FUNCTION__));		return BCME_NOMEM;	}	/* Allocate a flow ring table, comprising of requested number of rings */	flow_ring_table_sz = (num_flow_rings * sizeof(flow_ring_node_t));	flow_ring_table = (flow_ring_table_t *)MALLOC(dhdp->osh, flow_ring_table_sz);	if (flow_ring_table == NULL) {		DHD_ERROR(("%s: flow ring table alloc failure/n", __FUNCTION__));		goto fail;	}	/* Initialize flow ring table state */	bzero((uchar *)flow_ring_table, flow_ring_table_sz);	for (idx = 0; idx < num_flow_rings; idx++) {		flow_ring_table[idx].status = FLOW_RING_STATUS_CLOSED;		flow_ring_table[idx].flowid = (uint16)idx;		flow_ring_table[idx].lock = dhd_os_spin_lock_init(dhdp->osh);		if (flow_ring_table[idx].lock == NULL) {			DHD_ERROR(("%s: Failed to init spinlock for queue!/n", __FUNCTION__));			goto fail;		}		dll_init(&flow_ring_table[idx].list);		/* Initialize the per flow ring backup queue */		dhd_flow_queue_init(dhdp, &flow_ring_table[idx].queue,		                    FLOW_RING_QUEUE_THRESHOLD);	}	/* Allocate per interface hash table */	if_flow_lkup_sz = sizeof(if_flow_lkup_t) * DHD_MAX_IFS;	if_flow_lkup = (if_flow_lkup_t *)DHD_OS_PREALLOC(dhdp,		DHD_PREALLOC_IF_FLOW_LKUP, if_flow_lkup_sz);	if (if_flow_lkup == NULL) {		DHD_ERROR(("%s: if flow lkup alloc failure/n", __FUNCTION__));		goto fail;	}	/* Initialize per interface hash table */	bzero((uchar *)if_flow_lkup, if_flow_lkup_sz);	for (idx = 0; idx < DHD_MAX_IFS; idx++) {		int hash_ix;		if_flow_lkup[idx].status = 0;		if_flow_lkup[idx].role = 0;		for (hash_ix = 0; hash_ix < DHD_FLOWRING_HASH_SIZE; hash_ix++)			if_flow_lkup[idx].fl_hash[hash_ix] = NULL;	}#ifdef PCIE_TX_DEFERRAL	count = BITS_TO_LONGS(num_flow_rings);	dhdp->bus->delete_flow_map = kzalloc(count, GFP_ATOMIC);	if  (!dhdp->bus->delete_flow_map) {		DHD_ERROR(("%s: delete_flow_map alloc failure/n", __FUNCTION__));		goto fail;	}#endif	lock = dhd_os_spin_lock_init(dhdp->osh);	if (lock == NULL)		goto fail;	dhdp->flow_prio_map_type = DHD_FLOW_PRIO_AC_MAP;	bcopy(prio2ac, dhdp->flow_prio_map, sizeof(uint8) * NUMPRIO);	/* Now populate into dhd pub */	DHD_FLOWID_LOCK(lock, flags);	dhdp->num_flow_rings = num_flow_rings;	dhdp->flowid_allocator = (void *)flowid_allocator;	dhdp->flow_ring_table = (void *)flow_ring_table;	dhdp->if_flow_lkup = (void *)if_flow_lkup;	dhdp->flowid_lock = lock;	DHD_FLOWID_UNLOCK(lock, flags);	DHD_INFO(("%s done/n", __FUNCTION__));	return BCME_OK;fail://.........这里部分代码省略.........
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:101,


示例22: dhd_flow_rings_deinit

/* Deinit Flow Ring specific data structures */void dhd_flow_rings_deinit(dhd_pub_t *dhdp){	uint16 idx;	uint32 flow_ring_table_sz;	uint32 if_flow_lkup_sz;	flow_ring_table_t *flow_ring_table;	unsigned long flags;	void *lock;	DHD_INFO(("dhd_flow_rings_deinit/n"));	if (dhdp->flow_ring_table != NULL) {		ASSERT(dhdp->num_flow_rings > 0);		DHD_FLOWID_LOCK(dhdp->flowid_lock, flags);		flow_ring_table = (flow_ring_table_t *)dhdp->flow_ring_table;		dhdp->flow_ring_table = NULL;		DHD_FLOWID_UNLOCK(dhdp->flowid_lock, flags);		for (idx = 0; idx < dhdp->num_flow_rings; idx++) {			if (flow_ring_table[idx].active) {				dhd_bus_clean_flow_ring(dhdp->bus, &flow_ring_table[idx]);			}			ASSERT(flow_queue_empty(&flow_ring_table[idx].queue));			/* Deinit flow ring queue locks before destroying flow ring table */			dhd_os_spin_lock_deinit(dhdp->osh, flow_ring_table[idx].lock);			flow_ring_table[idx].lock = NULL;		}		/* Destruct the flow ring table */		flow_ring_table_sz = dhdp->num_flow_rings * sizeof(flow_ring_table_t);		MFREE(dhdp->osh, flow_ring_table, flow_ring_table_sz);	}	DHD_FLOWID_LOCK(dhdp->flowid_lock, flags);	/* Destruct the per interface flow lkup table */	if (dhdp->if_flow_lkup != NULL) {		if_flow_lkup_sz = sizeof(if_flow_lkup_t) * DHD_MAX_IFS;		bzero(dhdp->if_flow_lkup, sizeof(if_flow_lkup_sz));		DHD_OS_PREFREE(dhdp, dhdp->if_flow_lkup, if_flow_lkup_sz);		dhdp->if_flow_lkup = NULL;	}#ifdef PCIE_TX_DEFERRAL	if (dhdp->bus->delete_flow_map)		kfree(dhdp->bus->delete_flow_map);#endif	/* Destruct the flowid allocator */	if (dhdp->flowid_allocator != NULL)		dhdp->flowid_allocator = id16_map_fini(dhdp->osh, dhdp->flowid_allocator);	dhdp->num_flow_rings = 0U;	lock = dhdp->flowid_lock;	dhdp->flowid_lock = NULL;	DHD_FLOWID_UNLOCK(lock, flags);	dhd_os_spin_lock_deinit(dhdp->osh, lock);}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:62,


示例23: dhd_flowid_lookup

/* Get flow ring ID, if not present try to create one */static INLINE intdhd_flowid_lookup(dhd_pub_t *dhdp, uint8 ifindex,                  uint8 prio, char *sa, char *da, uint16 *flowid){	uint16 id;	flow_ring_node_t *flow_ring_node;	flow_ring_table_t *flow_ring_table;	unsigned long flags;	DHD_INFO(("%s/n", __FUNCTION__));	if (!dhdp->flow_ring_table)		return BCME_ERROR;	flow_ring_table = (flow_ring_table_t *)dhdp->flow_ring_table;	id = dhd_flowid_find(dhdp, ifindex, prio, sa, da);	if (id == FLOWID_INVALID) {		if_flow_lkup_t *if_flow_lkup;		if_flow_lkup = (if_flow_lkup_t *)dhdp->if_flow_lkup;		if (!if_flow_lkup[ifindex].status)			return BCME_ERROR;		id = dhd_flowid_alloc(dhdp, ifindex, prio, sa, da);		if (id == FLOWID_INVALID) {			DHD_ERROR(("%s: alloc flowid ifindex %u status %u/n",			           __FUNCTION__, ifindex, if_flow_lkup[ifindex].status));			return BCME_ERROR;		}		/* register this flowid in dhd_pub */		dhd_add_flowid(dhdp, ifindex, prio, da, id);	}	ASSERT(id < dhdp->num_flow_rings);	flow_ring_node = (flow_ring_node_t *) &flow_ring_table[id];	DHD_FLOWRING_LOCK(flow_ring_node->lock, flags);	if (flow_ring_node->active) {		DHD_FLOWRING_UNLOCK(flow_ring_node->lock, flags);		*flowid = id;		return BCME_OK;	}	/* Init Flow info */	memcpy(flow_ring_node->flow_info.sa, sa, sizeof(flow_ring_node->flow_info.sa));	memcpy(flow_ring_node->flow_info.da, da, sizeof(flow_ring_node->flow_info.da));	flow_ring_node->flow_info.tid = prio;	flow_ring_node->flow_info.ifindex = ifindex;	flow_ring_node->active = TRUE;	flow_ring_node->status = FLOW_RING_STATUS_PENDING;	DHD_FLOWRING_UNLOCK(flow_ring_node->lock, flags);	DHD_FLOWID_LOCK(dhdp->flowid_lock, flags);	dll_prepend(&dhdp->bus->const_flowring, &flow_ring_node->list);	DHD_FLOWID_UNLOCK(dhdp->flowid_lock, flags);	/* Create and inform device about the new flow */	if (dhd_bus_flow_ring_create_request(dhdp->bus, (void *)flow_ring_node)	        != BCME_OK) {		DHD_ERROR(("%s: create error %d/n", __FUNCTION__, id));		return BCME_ERROR;	}	*flowid = id;	return BCME_OK;}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:69,



注:本文中的DHD_INFO函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DHD_TRACE函数代码示例
C++ DHD_ERROR函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。