diff options
author | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-16 21:50:49 -0400 |
commit | ccc580571cf0799d0460a085a7632b77753f083e (patch) | |
tree | 018e0f83776b089b1f272694132688ac93be25b4 /drivers/net/ps3_gelic_wireless.c | |
parent | 0f5cabba49021d36e9f76bd97d7fa0f4a408063f (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/ps3_gelic_wireless.c')
-rw-r--r-- | drivers/net/ps3_gelic_wireless.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/net/ps3_gelic_wireless.c b/drivers/net/ps3_gelic_wireless.c index aa963ac1e37b..6b2dee0cf3a9 100644 --- a/drivers/net/ps3_gelic_wireless.c +++ b/drivers/net/ps3_gelic_wireless.c | |||
@@ -571,6 +571,7 @@ static void gelic_wl_parse_ie(u8 *data, size_t len, | |||
571 | * independent format | 571 | * independent format |
572 | */ | 572 | */ |
573 | static char *gelic_wl_translate_scan(struct net_device *netdev, | 573 | static char *gelic_wl_translate_scan(struct net_device *netdev, |
574 | struct iw_request_info *info, | ||
574 | char *ev, | 575 | char *ev, |
575 | char *stop, | 576 | char *stop, |
576 | struct gelic_wl_scan_info *network) | 577 | struct gelic_wl_scan_info *network) |
@@ -588,26 +589,26 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
588 | iwe.cmd = SIOCGIWAP; | 589 | iwe.cmd = SIOCGIWAP; |
589 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; | 590 | iwe.u.ap_addr.sa_family = ARPHRD_ETHER; |
590 | memcpy(iwe.u.ap_addr.sa_data, &scan->bssid[2], ETH_ALEN); | 591 | memcpy(iwe.u.ap_addr.sa_data, &scan->bssid[2], ETH_ALEN); |
591 | ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_ADDR_LEN); | 592 | ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_ADDR_LEN); |
592 | 593 | ||
593 | /* ESSID */ | 594 | /* ESSID */ |
594 | iwe.cmd = SIOCGIWESSID; | 595 | iwe.cmd = SIOCGIWESSID; |
595 | iwe.u.data.flags = 1; | 596 | iwe.u.data.flags = 1; |
596 | iwe.u.data.length = strnlen(scan->essid, 32); | 597 | iwe.u.data.length = strnlen(scan->essid, 32); |
597 | ev = iwe_stream_add_point(ev, stop, &iwe, scan->essid); | 598 | ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); |
598 | 599 | ||
599 | /* FREQUENCY */ | 600 | /* FREQUENCY */ |
600 | iwe.cmd = SIOCGIWFREQ; | 601 | iwe.cmd = SIOCGIWFREQ; |
601 | iwe.u.freq.m = be16_to_cpu(scan->channel); | 602 | iwe.u.freq.m = be16_to_cpu(scan->channel); |
602 | iwe.u.freq.e = 0; /* table value in MHz */ | 603 | iwe.u.freq.e = 0; /* table value in MHz */ |
603 | iwe.u.freq.i = 0; | 604 | iwe.u.freq.i = 0; |
604 | ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_FREQ_LEN); | 605 | ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_FREQ_LEN); |
605 | 606 | ||
606 | /* RATES */ | 607 | /* RATES */ |
607 | iwe.cmd = SIOCGIWRATE; | 608 | iwe.cmd = SIOCGIWRATE; |
608 | iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; | 609 | iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; |
609 | /* to stuff multiple values in one event */ | 610 | /* to stuff multiple values in one event */ |
610 | tmp = ev + IW_EV_LCP_LEN; | 611 | tmp = ev + iwe_stream_lcp_len(info); |
611 | /* put them in ascendant order (older is first) */ | 612 | /* put them in ascendant order (older is first) */ |
612 | i = 0; | 613 | i = 0; |
613 | j = 0; | 614 | j = 0; |
@@ -620,16 +621,16 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
620 | else | 621 | else |
621 | rate = scan->rate[i++] & 0x7f; | 622 | rate = scan->rate[i++] & 0x7f; |
622 | iwe.u.bitrate.value = rate * 500000; /* 500kbps unit */ | 623 | iwe.u.bitrate.value = rate * 500000; /* 500kbps unit */ |
623 | tmp = iwe_stream_add_value(ev, tmp, stop, &iwe, | 624 | tmp = iwe_stream_add_value(info, ev, tmp, stop, &iwe, |
624 | IW_EV_PARAM_LEN); | 625 | IW_EV_PARAM_LEN); |
625 | } | 626 | } |
626 | while (j < network->rate_ext_len) { | 627 | while (j < network->rate_ext_len) { |
627 | iwe.u.bitrate.value = (scan->ext_rate[j++] & 0x7f) * 500000; | 628 | iwe.u.bitrate.value = (scan->ext_rate[j++] & 0x7f) * 500000; |
628 | tmp = iwe_stream_add_value(ev, tmp, stop, &iwe, | 629 | tmp = iwe_stream_add_value(info, ev, tmp, stop, &iwe, |
629 | IW_EV_PARAM_LEN); | 630 | IW_EV_PARAM_LEN); |
630 | } | 631 | } |
631 | /* Check if we added any rate */ | 632 | /* Check if we added any rate */ |
632 | if (IW_EV_LCP_LEN < (tmp - ev)) | 633 | if (iwe_stream_lcp_len(info) < (tmp - ev)) |
633 | ev = tmp; | 634 | ev = tmp; |
634 | 635 | ||
635 | /* ENCODE */ | 636 | /* ENCODE */ |
@@ -639,7 +640,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
639 | else | 640 | else |
640 | iwe.u.data.flags = IW_ENCODE_DISABLED; | 641 | iwe.u.data.flags = IW_ENCODE_DISABLED; |
641 | iwe.u.data.length = 0; | 642 | iwe.u.data.length = 0; |
642 | ev = iwe_stream_add_point(ev, stop, &iwe, scan->essid); | 643 | ev = iwe_stream_add_point(info, ev, stop, &iwe, scan->essid); |
643 | 644 | ||
644 | /* MODE */ | 645 | /* MODE */ |
645 | iwe.cmd = SIOCGIWMODE; | 646 | iwe.cmd = SIOCGIWMODE; |
@@ -649,7 +650,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
649 | iwe.u.mode = IW_MODE_MASTER; | 650 | iwe.u.mode = IW_MODE_MASTER; |
650 | else | 651 | else |
651 | iwe.u.mode = IW_MODE_ADHOC; | 652 | iwe.u.mode = IW_MODE_ADHOC; |
652 | ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_UINT_LEN); | 653 | ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_UINT_LEN); |
653 | } | 654 | } |
654 | 655 | ||
655 | /* QUAL */ | 656 | /* QUAL */ |
@@ -659,7 +660,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
659 | iwe.u.qual.level = be16_to_cpu(scan->rssi); | 660 | iwe.u.qual.level = be16_to_cpu(scan->rssi); |
660 | iwe.u.qual.qual = be16_to_cpu(scan->rssi); | 661 | iwe.u.qual.qual = be16_to_cpu(scan->rssi); |
661 | iwe.u.qual.noise = 0; | 662 | iwe.u.qual.noise = 0; |
662 | ev = iwe_stream_add_event(ev, stop, &iwe, IW_EV_QUAL_LEN); | 663 | ev = iwe_stream_add_event(info, ev, stop, &iwe, IW_EV_QUAL_LEN); |
663 | 664 | ||
664 | /* RSN */ | 665 | /* RSN */ |
665 | memset(&iwe, 0, sizeof(iwe)); | 666 | memset(&iwe, 0, sizeof(iwe)); |
@@ -669,7 +670,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
669 | if (len) { | 670 | if (len) { |
670 | iwe.cmd = IWEVGENIE; | 671 | iwe.cmd = IWEVGENIE; |
671 | iwe.u.data.length = len; | 672 | iwe.u.data.length = len; |
672 | ev = iwe_stream_add_point(ev, stop, &iwe, buf); | 673 | ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); |
673 | } | 674 | } |
674 | } else { | 675 | } else { |
675 | /* this scan info has IE data */ | 676 | /* this scan info has IE data */ |
@@ -684,7 +685,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
684 | memcpy(buf, ie_info.wpa.data, ie_info.wpa.len); | 685 | memcpy(buf, ie_info.wpa.data, ie_info.wpa.len); |
685 | iwe.cmd = IWEVGENIE; | 686 | iwe.cmd = IWEVGENIE; |
686 | iwe.u.data.length = ie_info.wpa.len; | 687 | iwe.u.data.length = ie_info.wpa.len; |
687 | ev = iwe_stream_add_point(ev, stop, &iwe, buf); | 688 | ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); |
688 | } | 689 | } |
689 | 690 | ||
690 | if (ie_info.rsn.len && (ie_info.rsn.len <= sizeof(buf))) { | 691 | if (ie_info.rsn.len && (ie_info.rsn.len <= sizeof(buf))) { |
@@ -692,7 +693,7 @@ static char *gelic_wl_translate_scan(struct net_device *netdev, | |||
692 | memcpy(buf, ie_info.rsn.data, ie_info.rsn.len); | 693 | memcpy(buf, ie_info.rsn.data, ie_info.rsn.len); |
693 | iwe.cmd = IWEVGENIE; | 694 | iwe.cmd = IWEVGENIE; |
694 | iwe.u.data.length = ie_info.rsn.len; | 695 | iwe.u.data.length = ie_info.rsn.len; |
695 | ev = iwe_stream_add_point(ev, stop, &iwe, buf); | 696 | ev = iwe_stream_add_point(info, ev, stop, &iwe, buf); |
696 | } | 697 | } |
697 | } | 698 | } |
698 | 699 | ||
@@ -737,7 +738,8 @@ static int gelic_wl_get_scan(struct net_device *netdev, | |||
737 | if (wl->scan_age == 0 || | 738 | if (wl->scan_age == 0 || |
738 | time_after(scan_info->last_scanned + wl->scan_age, | 739 | time_after(scan_info->last_scanned + wl->scan_age, |
739 | this_time)) | 740 | this_time)) |
740 | ev = gelic_wl_translate_scan(netdev, ev, stop, | 741 | ev = gelic_wl_translate_scan(netdev, info, |
742 | ev, stop, | ||
741 | scan_info); | 743 | scan_info); |
742 | else | 744 | else |
743 | pr_debug("%s:entry too old\n", __func__); | 745 | pr_debug("%s:entry too old\n", __func__); |