aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
committerDavid S. Miller <davem@davemloft.net>2008-06-16 21:50:49 -0400
commitccc580571cf0799d0460a085a7632b77753f083e (patch)
tree018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/wireless/libertas
parent0f5cabba49021d36e9f76bd97d7fa0f4a408063f (diff)
wext: Emit event stream entries correctly when compat.
Three major portions to this change: 1) Add IW_EV_COMPAT_LCP_LEN, IW_EV_COMPAT_POINT_OFF, and IW_EV_COMPAT_POINT_LEN helper defines. 2) Delete iw_stream_check_add_*(), they are unused. 3) Add iw_request_info argument to iwe_stream_add_*(), and use it to size the event and pointer lengths correctly depending upon whether IW_REQUEST_FLAG_COMPAT is set or not. 4) The mechanical transformations to the drivers and wireless stack bits to get the iw_request_info passed down into the routines modified in #3. Also, explicit references to IW_EV_LCP_LEN are replaced with iwe_stream_lcp_len(info). With a lot of help and bug fixes from Masakazu Mokuno. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r--drivers/net/wireless/libertas/scan.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index d448c9702a0f..343ed38f772d 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -776,8 +776,9 @@ out:
776#define MAX_CUSTOM_LEN 64 776#define MAX_CUSTOM_LEN 64
777 777
778static inline char *lbs_translate_scan(struct lbs_private *priv, 778static inline char *lbs_translate_scan(struct lbs_private *priv,
779 char *start, char *stop, 779 struct iw_request_info *info,
780 struct bss_descriptor *bss) 780 char *start, char *stop,
781 struct bss_descriptor *bss)
781{ 782{
782 struct chan_freq_power *cfp; 783 struct chan_freq_power *cfp;
783 char *current_val; /* For rates */ 784 char *current_val; /* For rates */
@@ -801,24 +802,24 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
801 iwe.cmd = SIOCGIWAP; 802 iwe.cmd = SIOCGIWAP;
802 iwe.u.ap_addr.sa_family = ARPHRD_ETHER; 803 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
803 memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN); 804 memcpy(iwe.u.ap_addr.sa_data, &bss->bssid, ETH_ALEN);
804 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_ADDR_LEN); 805 start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_ADDR_LEN);
805 806
806 /* SSID */ 807 /* SSID */
807 iwe.cmd = SIOCGIWESSID; 808 iwe.cmd = SIOCGIWESSID;
808 iwe.u.data.flags = 1; 809 iwe.u.data.flags = 1;
809 iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE); 810 iwe.u.data.length = min((uint32_t) bss->ssid_len, (uint32_t) IW_ESSID_MAX_SIZE);
810 start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); 811 start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid);
811 812
812 /* Mode */ 813 /* Mode */
813 iwe.cmd = SIOCGIWMODE; 814 iwe.cmd = SIOCGIWMODE;
814 iwe.u.mode = bss->mode; 815 iwe.u.mode = bss->mode;
815 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_UINT_LEN); 816 start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_UINT_LEN);
816 817
817 /* Frequency */ 818 /* Frequency */
818 iwe.cmd = SIOCGIWFREQ; 819 iwe.cmd = SIOCGIWFREQ;
819 iwe.u.freq.m = (long)cfp->freq * 100000; 820 iwe.u.freq.m = (long)cfp->freq * 100000;
820 iwe.u.freq.e = 1; 821 iwe.u.freq.e = 1;
821 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_FREQ_LEN); 822 start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_FREQ_LEN);
822 823
823 /* Add quality statistics */ 824 /* Add quality statistics */
824 iwe.cmd = IWEVQUAL; 825 iwe.cmd = IWEVQUAL;
@@ -852,7 +853,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
852 nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE; 853 nf = priv->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE;
853 iwe.u.qual.level = CAL_RSSI(snr, nf); 854 iwe.u.qual.level = CAL_RSSI(snr, nf);
854 } 855 }
855 start = iwe_stream_add_event(start, stop, &iwe, IW_EV_QUAL_LEN); 856 start = iwe_stream_add_event(info, start, stop, &iwe, IW_EV_QUAL_LEN);
856 857
857 /* Add encryption capability */ 858 /* Add encryption capability */
858 iwe.cmd = SIOCGIWENCODE; 859 iwe.cmd = SIOCGIWENCODE;
@@ -862,9 +863,9 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
862 iwe.u.data.flags = IW_ENCODE_DISABLED; 863 iwe.u.data.flags = IW_ENCODE_DISABLED;
863 } 864 }
864 iwe.u.data.length = 0; 865 iwe.u.data.length = 0;
865 start = iwe_stream_add_point(start, stop, &iwe, bss->ssid); 866 start = iwe_stream_add_point(info, start, stop, &iwe, bss->ssid);
866 867
867 current_val = start + IW_EV_LCP_LEN; 868 current_val = start + iwe_stream_lcp_len(info);
868 869
869 iwe.cmd = SIOCGIWRATE; 870 iwe.cmd = SIOCGIWRATE;
870 iwe.u.bitrate.fixed = 0; 871 iwe.u.bitrate.fixed = 0;
@@ -874,19 +875,19 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
874 for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) { 875 for (j = 0; bss->rates[j] && (j < sizeof(bss->rates)); j++) {
875 /* Bit rate given in 500 kb/s units */ 876 /* Bit rate given in 500 kb/s units */
876 iwe.u.bitrate.value = bss->rates[j] * 500000; 877 iwe.u.bitrate.value = bss->rates[j] * 500000;
877 current_val = iwe_stream_add_value(start, current_val, 878 current_val = iwe_stream_add_value(info, start, current_val,
878 stop, &iwe, IW_EV_PARAM_LEN); 879 stop, &iwe, IW_EV_PARAM_LEN);
879 } 880 }
880 if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate 881 if ((bss->mode == IW_MODE_ADHOC) && priv->adhoccreate
881 && !lbs_ssid_cmp(priv->curbssparams.ssid, 882 && !lbs_ssid_cmp(priv->curbssparams.ssid,
882 priv->curbssparams.ssid_len, 883 priv->curbssparams.ssid_len,
883 bss->ssid, bss->ssid_len)) { 884 bss->ssid, bss->ssid_len)) {
884 iwe.u.bitrate.value = 22 * 500000; 885 iwe.u.bitrate.value = 22 * 500000;
885 current_val = iwe_stream_add_value(start, current_val, 886 current_val = iwe_stream_add_value(info, start, current_val,
886 stop, &iwe, IW_EV_PARAM_LEN); 887 stop, &iwe, IW_EV_PARAM_LEN);
887 } 888 }
888 /* Check if we added any event */ 889 /* Check if we added any event */
889 if((current_val - start) > IW_EV_LCP_LEN) 890 if ((current_val - start) > iwe_stream_lcp_len(info))
890 start = current_val; 891 start = current_val;
891 892
892 memset(&iwe, 0, sizeof(iwe)); 893 memset(&iwe, 0, sizeof(iwe));
@@ -895,7 +896,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
895 memcpy(buf, bss->wpa_ie, bss->wpa_ie_len); 896 memcpy(buf, bss->wpa_ie, bss->wpa_ie_len);
896 iwe.cmd = IWEVGENIE; 897 iwe.cmd = IWEVGENIE;
897 iwe.u.data.length = bss->wpa_ie_len; 898 iwe.u.data.length = bss->wpa_ie_len;
898 start = iwe_stream_add_point(start, stop, &iwe, buf); 899 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
899 } 900 }
900 901
901 memset(&iwe, 0, sizeof(iwe)); 902 memset(&iwe, 0, sizeof(iwe));
@@ -904,7 +905,7 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
904 memcpy(buf, bss->rsn_ie, bss->rsn_ie_len); 905 memcpy(buf, bss->rsn_ie, bss->rsn_ie_len);
905 iwe.cmd = IWEVGENIE; 906 iwe.cmd = IWEVGENIE;
906 iwe.u.data.length = bss->rsn_ie_len; 907 iwe.u.data.length = bss->rsn_ie_len;
907 start = iwe_stream_add_point(start, stop, &iwe, buf); 908 start = iwe_stream_add_point(info, start, stop, &iwe, buf);
908 } 909 }
909 910
910 if (bss->mesh) { 911 if (bss->mesh) {
@@ -915,7 +916,8 @@ static inline char *lbs_translate_scan(struct lbs_private *priv,
915 p += snprintf(p, MAX_CUSTOM_LEN, "mesh-type: olpc"); 916 p += snprintf(p, MAX_CUSTOM_LEN, "mesh-type: olpc");
916 iwe.u.data.length = p - custom; 917 iwe.u.data.length = p - custom;
917 if (iwe.u.data.length) 918 if (iwe.u.data.length)
918 start = iwe_stream_add_point(start, stop, &iwe, custom); 919 start = iwe_stream_add_point(info, start, stop,
920 &iwe, custom);
919 } 921 }
920 922
921out: 923out:
@@ -1036,7 +1038,7 @@ int lbs_get_scan(struct net_device *dev, struct iw_request_info *info,
1036 } 1038 }
1037 1039
1038 /* Translate to WE format this entry */ 1040 /* Translate to WE format this entry */
1039 next_ev = lbs_translate_scan(priv, ev, stop, iter_bss); 1041 next_ev = lbs_translate_scan(priv, info, ev, stop, iter_bss);
1040 if (next_ev == NULL) 1042 if (next_ev == NULL)
1041 continue; 1043 continue;
1042 ev = next_ev; 1044 ev = next_ev;