int
wldev_set_apsta(struct net_device *dev, bool enable)
{
   	int res = 0;
   	int mpc = 0;
   	int concr_mode = 0;
	int roam_off;
   	char smbuf[WLC_IOCTL_SMLEN];
	bss_setbuf_t bss_setbuf;
	int frameburst;

        memset(smbuf, 0, sizeof(smbuf));

	printf("%s: enter\n", __FUNCTION__);

   	if (!dev) {
                  WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__));
                  return -1;
   	}

	if (enable){
		/* wait for interface ready */
		wait_for_ap_ready(1);

		if ( ap_net_dev == NULL ) {
                        WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__));
                        goto fail;
		}

		concr_mode = 1;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
			printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
		}


        rxglom_fail_count = RXGLOM_CONCUR_MODE_FAIL_COUNT;
        max_cntl_timeout =  MAX_CONCUR_MODE_CNTL_TIMEOUT;


		roam_off = 1;
		if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
			printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);
		
   		mpc = 0;
		if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
			WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
			goto fail;
		}	

		if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) {
			WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res));
			goto fail;
		} 

		if(wl_get_drv_status(wlcfg_drv_priv,CONNECTED,dev))
		{
			u32 chanspec = 0;
			int err;
			if(wldev_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK)
			{
				printf("%s get Chanspec [%0x]\n",__func__ ,chanspec);
				if((err = wldev_iovar_setint(ap_net_dev, "chanspec", chanspec)) == BCME_BADCHAN) {
					printf("%s set Chanspec failed\n",__func__);
				} else
					printf("%s set Chanspec OK\n",__func__);
			}
			else
				printf("%s get Chanspec failed\n",__func__);

		}
		else
			printf("%s Sta is not connected with any AP\n",__func__);

			bss_setbuf.cfg = 1;
			bss_setbuf.val = 1;  /* up the interface */

			if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){
				WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res));
				goto fail;
        	}

	        bcm_mdelay(500);

            printf("prepare set frameburst \n");
            frameburst = 1;
            if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
                printf("%s fail to set frameburst !!\n", __FUNCTION__);
            }

		if ((res = wldev_iovar_setint(dev, "allmulti", 1))) {
            		WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res));
            		goto fail;
		}

#if !defined(WLCREDALL)
		if ((res = wldev_iovar_setint(dev, "bus:credall", 1))) {
			WLDEV_ERROR(("%s: ERROR:%d, set credall failed\n", __FUNCTION__, res));
			goto fail;
		}
#endif


		set_ap_channel(dev,&ap_cfg);
		ap_net_dev->operstate = IF_OPER_UP;
	} else {
		if ((res = wl_softap_stop(ap_net_dev))){
           		WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res));
           		goto fail;
		}

		concr_mode = 0;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
				printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
			}


        rxglom_fail_count = RXGLOM_FAIL_COUNT;
        max_cntl_timeout =  MAX_CNTL_TIMEOUT;
        scan_suppress_flag = 0;


	/* 2012-09-21 Stop roam when start Concurrent ++++ */
	roam_off = 0;
	if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
			printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);

	mpc = 1;
	     	if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
        	   	WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           		goto fail;
	      	}

#if !defined(WLCREDALL)
		if ((res = wldev_iovar_setint(dev, "bus:credall", 0))) {
			WLDEV_ERROR(("%s fail to set credall\n", __FUNCTION__));
			goto fail;
		}
#endif

        printf("prepare set frameburst \n");
        frameburst = 0;
        if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
            printf("%s fail to set frameburst !!\n", __FUNCTION__);
        }


        wlcfg_drv_priv->dongle_connected = 0;
        wldev_adj_apsta_scan_param(dev,wlcfg_drv_priv->dongle_connected);
	}

fail:
    return res;
}
int
wldev_set_apsta(struct net_device *dev, bool enable)
{
   	int res = 0;
   	int mpc = 0;
	int concr_mode = 0;
   	char smbuf[WLC_IOCTL_SMLEN];
	bss_setbuf_t bss_setbuf;

        memset(smbuf, 0, sizeof(smbuf));

	printf("%s: enter\n", __FUNCTION__);

   	if (!dev) {
                  WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__));
                  return -1;
   	}

	if (enable){
		/* wait for interface ready */
		wait_for_ap_ready(1); //broacom 0405

		if ( ap_net_dev == NULL ) {
                        WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__));
                        goto fail;
		}

		//2012-09-10 CT2 set Concr_mode ++++
		concr_mode = 1;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
					printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
		}
		//2012-09-10 CT2 set Concr_mode ++++

   		mpc = 0;
      	        if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
           	        WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           	        goto fail;
      	        }	

         	if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) {
           	        WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res));
         	        goto fail;
                } 
                
                bss_setbuf.cfg = 1;
                bss_setbuf.val = 1;  /* up the interface */

                if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){
           	         WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res));
           	         goto fail;
        	}

	        bcm_mdelay(500);

		if ((res = wldev_iovar_setint(dev, "allmulti", 1))) {
            		WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res));
            		goto fail;
		}
//BRCM_APSTA_START
		set_ap_channel(dev,&ap_cfg);
		ap_net_dev->operstate = IF_OPER_UP;
//BRCM_APSTA_END
	} else {
		if ((res = wl_softap_stop(ap_net_dev))){
           		WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res));
           		goto fail;
		}

		//2012-09-10 CT2 set Concr_mode ++++
		concr_mode = 0;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
				printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
		}
		//2012-09-10 CT2 set Concr_mode ++++

    		mpc = 1;
	     	if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
        	   	WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           		goto fail;
	      	}	
	}

fail:
    return res;
}
Beispiel #3
0
int
wldev_set_apsta(struct net_device *dev, bool enable)
{
   	int res = 0;
   	int mpc = 0;
   	int concr_mode = 0;
	int roam_off;
   	char smbuf[WLC_IOCTL_SMLEN];
	bss_setbuf_t bss_setbuf;
	int frameburst;

        memset(smbuf, 0, sizeof(smbuf));

	printf("%s: enter\n", __FUNCTION__);

   	if (!dev) {
                  WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__));
                  return -1;
   	}

	if (enable){
		
		wait_for_ap_ready(1); 

		if ( ap_net_dev == NULL ) {
                        WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__));
                        goto fail;
		}

		
				concr_mode = 1;
				if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
						printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
				}
		

		
		roam_off = 1;
		if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
				printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);
		
		
   		mpc = 0;
      	        if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
           	        WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           	        goto fail;
      	        }	

         	if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) {
           	        WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res));
         	        goto fail;
                } 
                
			if(wl_get_drv_status(wlcfg_drv_priv,CONNECTED,dev))
			{
				u32 chanspec = 0;
				int err;
				if(wldev_iovar_getint(dev, "chanspec", (s32 *)&chanspec) == BCME_OK)
				{
					printf("%s get Chanspec [%0x]\n",__func__ ,chanspec);
					if((err = wldev_iovar_setint(ap_net_dev, "chanspec", chanspec)) == BCME_BADCHAN) {
						printf("%s set Chanspec failed\n",__func__);
					} else
						printf("%s set Chanspec OK\n",__func__);
				}
				else
					printf("%s get Chanspec failed\n",__func__);

			}
			else
				printf("%s Sta is not connected with any AP\n",__func__);


                bss_setbuf.cfg = 1;
                bss_setbuf.val = 1;  

                if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){
           	         WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res));
           	         goto fail;
        	}

            printf("prepare set frameburst \n");
            frameburst = 1;
            if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
                printf("%s fail to set frameburst !!\n", __FUNCTION__);
            }

		if ((res = wldev_iovar_setint(dev, "allmulti", 1))) {
            		WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res));
            		goto fail;
		}
		set_ap_channel(dev,&ap_cfg);
		ap_net_dev->operstate = IF_OPER_UP;
	} else {
		if ((res = wl_softap_stop(ap_net_dev))){
           		WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res));
           		goto fail;
		}

	
		concr_mode = 0;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
				printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
			}
	

	
	roam_off = 0;
	if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
			printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);
	

	mpc = 1;
	     	if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
        	   	WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           		goto fail;
	      	}

        printf("prepare set frameburst \n");
        frameburst = 0;
        if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
            printf("%s fail to set frameburst !!\n", __FUNCTION__);
        }
	}

fail:
    return res;
}
int
wldev_set_apsta(struct net_device *dev, bool enable)
{
   	int res = 0;
   	int mpc = 0;
   	int concr_mode = 0;
	int roam_off;
   	char smbuf[WLC_IOCTL_SMLEN];
	bss_setbuf_t bss_setbuf;
	int frameburst;

        memset(smbuf, 0, sizeof(smbuf));

	printf("%s: enter\n", __FUNCTION__);

   	if (!dev) {
                  WLDEV_ERROR(("%s: dev is null\n", __FUNCTION__));
                  return -1;
   	}

	if (enable){
		
		wait_for_ap_ready(1); 

		if ( ap_net_dev == NULL ) {
                        WLDEV_ERROR(("%s ap_net_dev == NULL\n", __FUNCTION__));
                        goto fail;
		}

		
				concr_mode = 1;
				if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
						printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
				}
		

		
		roam_off = 1;
		if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
				printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);
		
		
   		mpc = 0;
      	        if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
           	        WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           	        goto fail;
      	        }	

         	if ((res = wl_iw_set_ap_security(ap_net_dev, &ap_cfg)) != 0) {
           	        WLDEV_ERROR((" %s ERROR setting SOFTAP security in :%d\n", __FUNCTION__, res));
         	        goto fail;
                } 
                
                bss_setbuf.cfg = 1;
                bss_setbuf.val = 1;  

                if ((res = wldev_iovar_setbuf_bsscfg(dev, "bss", &bss_setbuf, sizeof(bss_setbuf), smbuf, sizeof(smbuf), 1, NULL)) < 0){
           	         WLDEV_ERROR(("%s: ERROR:%d, set bss up failed\n", __FUNCTION__, res));
           	         goto fail;
        	}

	        bcm_mdelay(500);

            printf("prepare set frameburst \n");
            frameburst = 1;
            if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
                printf("%s fail to set frameburst !!\n", __FUNCTION__);
            }

		if ((res = wldev_iovar_setint(dev, "allmulti", 1))) {
            		WLDEV_ERROR(("%s: ERROR:%d, set allmulti failed\n", __FUNCTION__, res));
            		goto fail;
		}
		set_ap_channel(dev,&ap_cfg);
		ap_net_dev->operstate = IF_OPER_UP;
	} else {
		if ((res = wl_softap_stop(ap_net_dev))){
           		WLDEV_ERROR(("%s: ERROR:%d, call wl_softap_stop failed\n", __FUNCTION__, res));
           		goto fail;
		}

	
		concr_mode = 0;
		if ((res = wldev_iovar_setint(dev, "concr_mode_set", concr_mode))) {
				printf("%s fail to set concr_mode res[%d]\n", __FUNCTION__,res);
			}
	

	
	roam_off = 0;
	if((res = wldev_iovar_setint(dev, "roam_off", roam_off)))
			printf("%s fail to set roam_off res[%d]\n", __FUNCTION__,res);
	

	mpc = 1;
	     	if ((res = wldev_iovar_setint(dev, "mpc", mpc))) {
        	   	WLDEV_ERROR(("%s fail to set mpc\n", __FUNCTION__));
           		goto fail;
	      	}

        printf("prepare set frameburst \n");
        frameburst = 0;
        if ((res = wldev_ioctl(dev, WLC_SET_FAKEFRAG, &frameburst, sizeof(frameburst), 0))) {
            printf("%s fail to set frameburst !!\n", __FUNCTION__);
        }
	}

fail:
    return res;
}