diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c index a43b3daa76ae..891826197f96 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | |||
@@ -65,6 +65,26 @@ struct msgtrace_hdr { | |||
65 | because of trace overflow */ | 65 | because of trace overflow */ |
66 | } __packed; | 66 | } __packed; |
67 | 67 | ||
68 | |||
69 | uint | ||
70 | brcmf_c_mkiovar(char *name, char *data, uint datalen, char *buf, uint buflen) | ||
71 | { | ||
72 | uint len; | ||
73 | |||
74 | len = strlen(name) + 1; | ||
75 | |||
76 | if ((len + datalen) > buflen) | ||
77 | return 0; | ||
78 | |||
79 | strncpy(buf, name, buflen); | ||
80 | |||
81 | /* append data onto the end of the name string */ | ||
82 | memcpy(&buf[len], data, datalen); | ||
83 | len += datalen; | ||
84 | |||
85 | return len; | ||
86 | } | ||
87 | |||
68 | void brcmf_c_init(void) | 88 | void brcmf_c_init(void) |
69 | { | 89 | { |
70 | /* Init global variables at run-time, not as part of the declaration. | 90 | /* Init global variables at run-time, not as part of the declaration. |
@@ -607,7 +627,7 @@ brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable, | |||
607 | 627 | ||
608 | /* Contorl the master mode */ | 628 | /* Contorl the master mode */ |
609 | mmode_le = cpu_to_le32(master_mode); | 629 | mmode_le = cpu_to_le32(master_mode); |
610 | brcmu_mkiovar("pkt_filter_mode", (char *)&mmode_le, 4, buf, | 630 | brcmf_c_mkiovar("pkt_filter_mode", (char *)&mmode_le, 4, buf, |
611 | sizeof(buf)); | 631 | sizeof(buf)); |
612 | rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, | 632 | rc = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, buf, |
613 | sizeof(buf)); | 633 | sizeof(buf)); |
@@ -756,7 +776,7 @@ static void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode) | |||
756 | char iovbuf[32]; | 776 | char iovbuf[32]; |
757 | int retcode; | 777 | int retcode; |
758 | 778 | ||
759 | brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); | 779 | brcmf_c_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); |
760 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 780 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
761 | iovbuf, sizeof(iovbuf)); | 781 | iovbuf, sizeof(iovbuf)); |
762 | retcode = retcode >= 0 ? 0 : retcode; | 782 | retcode = retcode >= 0 ? 0 : retcode; |
@@ -773,7 +793,8 @@ static void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) | |||
773 | char iovbuf[32]; | 793 | char iovbuf[32]; |
774 | int retcode; | 794 | int retcode; |
775 | 795 | ||
776 | brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf)); | 796 | brcmf_c_mkiovar("arpoe", (char *)&arp_enable, 4, |
797 | iovbuf, sizeof(iovbuf)); | ||
777 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, | 798 | retcode = brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, |
778 | iovbuf, sizeof(iovbuf)); | 799 | iovbuf, sizeof(iovbuf)); |
779 | retcode = retcode >= 0 ? 0 : retcode; | 800 | retcode = retcode >= 0 ? 0 : retcode; |
@@ -812,33 +833,33 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
812 | /* query for 'ver' to get version info from firmware */ | 833 | /* query for 'ver' to get version info from firmware */ |
813 | memset(buf, 0, sizeof(buf)); | 834 | memset(buf, 0, sizeof(buf)); |
814 | ptr = buf; | 835 | ptr = buf; |
815 | brcmu_mkiovar("ver", NULL, 0, buf, sizeof(buf)); | 836 | brcmf_c_mkiovar("ver", NULL, 0, buf, sizeof(buf)); |
816 | brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf)); | 837 | brcmf_proto_cdc_query_dcmd(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf)); |
817 | strsep(&ptr, "\n"); | 838 | strsep(&ptr, "\n"); |
818 | /* Print fw version info */ | 839 | /* Print fw version info */ |
819 | brcmf_dbg(ERROR, "Firmware version = %s\n", buf); | 840 | brcmf_dbg(ERROR, "Firmware version = %s\n", buf); |
820 | 841 | ||
821 | /* Match Host and Dongle rx alignment */ | 842 | /* Match Host and Dongle rx alignment */ |
822 | brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, | 843 | brcmf_c_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, |
823 | sizeof(iovbuf)); | 844 | sizeof(iovbuf)); |
824 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 845 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
825 | sizeof(iovbuf)); | 846 | sizeof(iovbuf)); |
826 | 847 | ||
827 | /* disable glom option per default */ | 848 | /* disable glom option per default */ |
828 | brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); | 849 | brcmf_c_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); |
829 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 850 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
830 | sizeof(iovbuf)); | 851 | sizeof(iovbuf)); |
831 | 852 | ||
832 | /* Setup timeout if Beacons are lost and roam is off to report | 853 | /* Setup timeout if Beacons are lost and roam is off to report |
833 | link down */ | 854 | link down */ |
834 | brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | 855 | brcmf_c_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, |
835 | sizeof(iovbuf)); | 856 | sizeof(iovbuf)); |
836 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 857 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
837 | sizeof(iovbuf)); | 858 | sizeof(iovbuf)); |
838 | 859 | ||
839 | /* Enable/Disable build-in roaming to allowed ext supplicant to take | 860 | /* Enable/Disable build-in roaming to allowed ext supplicant to take |
840 | of romaing */ | 861 | of romaing */ |
841 | brcmu_mkiovar("roam_off", (char *)&roaming, 4, | 862 | brcmf_c_mkiovar("roam_off", (char *)&roaming, 4, |
842 | iovbuf, sizeof(iovbuf)); | 863 | iovbuf, sizeof(iovbuf)); |
843 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 864 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
844 | sizeof(iovbuf)); | 865 | sizeof(iovbuf)); |
@@ -847,7 +868,7 @@ int brcmf_c_preinit_dcmds(struct brcmf_pub *drvr) | |||
847 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up)); | 868 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_UP, (char *)&up, sizeof(up)); |
848 | 869 | ||
849 | /* Setup event_msgs */ | 870 | /* Setup event_msgs */ |
850 | brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, | 871 | brcmf_c_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, |
851 | iovbuf, sizeof(iovbuf)); | 872 | iovbuf, sizeof(iovbuf)); |
852 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | 873 | brcmf_proto_cdc_set_dcmd(drvr, 0, BRCMF_C_SET_VAR, iovbuf, |
853 | sizeof(iovbuf)); | 874 | sizeof(iovbuf)); |