aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ray_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ray_cs.c')
-rw-r--r--drivers/net/wireless/ray_cs.c73
1 files changed, 42 insertions, 31 deletions
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index f3858ee36f32..963960dc30f2 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -34,6 +34,7 @@
34#include <linux/kernel.h> 34#include <linux/kernel.h>
35#include <linux/proc_fs.h> 35#include <linux/proc_fs.h>
36#include <linux/ptrace.h> 36#include <linux/ptrace.h>
37#include <linux/seq_file.h>
37#include <linux/slab.h> 38#include <linux/slab.h>
38#include <linux/string.h> 39#include <linux/string.h>
39#include <linux/timer.h> 40#include <linux/timer.h>
@@ -2582,7 +2583,7 @@ static char *nettype[] = {"Adhoc", "Infra "};
2582static char *framing[] = {"Encapsulation", "Translation"} 2583static char *framing[] = {"Encapsulation", "Translation"}
2583; 2584;
2584/*===========================================================================*/ 2585/*===========================================================================*/
2585static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len) 2586static int ray_cs_proc_show(struct seq_file *m, void *v)
2586{ 2587{
2587/* Print current values which are not available via other means 2588/* Print current values which are not available via other means
2588 * eg ifconfig 2589 * eg ifconfig
@@ -2606,83 +2607,93 @@ static int ray_cs_proc_read(char *buf, char **start, off_t offset, int len)
2606 if (!local) 2607 if (!local)
2607 return 0; 2608 return 0;
2608 2609
2609 len = 0; 2610 seq_puts(m, "Raylink Wireless LAN driver status\n");
2610 2611 seq_printf(m, "%s\n", rcsid);
2611 len += sprintf(buf + len, "Raylink Wireless LAN driver status\n");
2612 len += sprintf(buf + len, "%s\n", rcsid);
2613 /* build 4 does not report version, and field is 0x55 after memtest */ 2612 /* build 4 does not report version, and field is 0x55 after memtest */
2614 len += sprintf(buf + len, "Firmware version = "); 2613 seq_puts(m, "Firmware version = ");
2615 if (local->fw_ver == 0x55) 2614 if (local->fw_ver == 0x55)
2616 len += sprintf(buf + len, "4 - Use dump_cis for more details\n"); 2615 seq_puts(m, "4 - Use dump_cis for more details\n");
2617 else 2616 else
2618 len += sprintf(buf + len, "%2d.%02d.%02d\n", 2617 seq_printf(m, "%2d.%02d.%02d\n",
2619 local->fw_ver, local->fw_bld, local->fw_var); 2618 local->fw_ver, local->fw_bld, local->fw_var);
2620 2619
2621 for (i=0; i<32; i++) c[i] = local->sparm.b5.a_current_ess_id[i]; 2620 for (i=0; i<32; i++) c[i] = local->sparm.b5.a_current_ess_id[i];
2622 c[32] = 0; 2621 c[32] = 0;
2623 len += sprintf(buf + len, "%s network ESSID = \"%s\"\n", 2622 seq_printf(m, "%s network ESSID = \"%s\"\n",
2624 nettype[local->sparm.b5.a_network_type], c); 2623 nettype[local->sparm.b5.a_network_type], c);
2625 2624
2626 p = local->bss_id; 2625 p = local->bss_id;
2627 len += sprintf(buf + len, "BSSID = %s\n", 2626 seq_printf(m, "BSSID = %s\n",
2628 print_mac(mac, p)); 2627 print_mac(mac, p));
2629 2628
2630 len += sprintf(buf + len, "Country code = %d\n", 2629 seq_printf(m, "Country code = %d\n",
2631 local->sparm.b5.a_curr_country_code); 2630 local->sparm.b5.a_curr_country_code);
2632 2631
2633 i = local->card_status; 2632 i = local->card_status;
2634 if (i < 0) i = 10; 2633 if (i < 0) i = 10;
2635 if (i > 16) i = 10; 2634 if (i > 16) i = 10;
2636 len += sprintf(buf + len, "Card status = %s\n", card_status[i]); 2635 seq_printf(m, "Card status = %s\n", card_status[i]);
2637 2636
2638 len += sprintf(buf + len, "Framing mode = %s\n",framing[translate]); 2637 seq_printf(m, "Framing mode = %s\n",framing[translate]);
2639 2638
2640 len += sprintf(buf + len, "Last pkt signal lvl = %d\n", local->last_rsl); 2639 seq_printf(m, "Last pkt signal lvl = %d\n", local->last_rsl);
2641 2640
2642 if (local->beacon_rxed) { 2641 if (local->beacon_rxed) {
2643 /* Pull some fields out of last beacon received */ 2642 /* Pull some fields out of last beacon received */
2644 len += sprintf(buf + len, "Beacon Interval = %d Kus\n", 2643 seq_printf(m, "Beacon Interval = %d Kus\n",
2645 local->last_bcn.beacon_intvl[0] 2644 local->last_bcn.beacon_intvl[0]
2646 + 256 * local->last_bcn.beacon_intvl[1]); 2645 + 256 * local->last_bcn.beacon_intvl[1]);
2647 2646
2648 p = local->last_bcn.elements; 2647 p = local->last_bcn.elements;
2649 if (p[0] == C_ESSID_ELEMENT_ID) p += p[1] + 2; 2648 if (p[0] == C_ESSID_ELEMENT_ID) p += p[1] + 2;
2650 else { 2649 else {
2651 len += sprintf(buf + len, "Parse beacon failed at essid element id = %d\n",p[0]); 2650 seq_printf(m, "Parse beacon failed at essid element id = %d\n",p[0]);
2652 return len; 2651 return 0;
2653 } 2652 }
2654 2653
2655 if (p[0] == C_SUPPORTED_RATES_ELEMENT_ID) { 2654 if (p[0] == C_SUPPORTED_RATES_ELEMENT_ID) {
2656 len += sprintf(buf + len, "Supported rate codes = "); 2655 seq_puts(m, "Supported rate codes = ");
2657 for (i=2; i<p[1] + 2; i++) 2656 for (i=2; i<p[1] + 2; i++)
2658 len += sprintf(buf + len, "0x%02x ", p[i]); 2657 seq_printf(m, "0x%02x ", p[i]);
2659 len += sprintf(buf + len, "\n"); 2658 seq_putc(m, '\n');
2660 p += p[1] + 2; 2659 p += p[1] + 2;
2661 } 2660 }
2662 else { 2661 else {
2663 len += sprintf(buf + len, "Parse beacon failed at rates element\n"); 2662 seq_puts(m, "Parse beacon failed at rates element\n");
2664 return len; 2663 return 0;
2665 } 2664 }
2666 2665
2667 if (p[0] == C_FH_PARAM_SET_ELEMENT_ID) { 2666 if (p[0] == C_FH_PARAM_SET_ELEMENT_ID) {
2668 pfh = (struct freq_hop_element *)p; 2667 pfh = (struct freq_hop_element *)p;
2669 len += sprintf(buf + len, "Hop dwell = %d Kus\n", 2668 seq_printf(m, "Hop dwell = %d Kus\n",
2670 pfh->dwell_time[0] + 256 * pfh->dwell_time[1]); 2669 pfh->dwell_time[0] + 256 * pfh->dwell_time[1]);
2671 len += sprintf(buf + len, "Hop set = %d \n", pfh->hop_set); 2670 seq_printf(m, "Hop set = %d \n", pfh->hop_set);
2672 len += sprintf(buf + len, "Hop pattern = %d \n", pfh->hop_pattern); 2671 seq_printf(m, "Hop pattern = %d \n", pfh->hop_pattern);
2673 len += sprintf(buf + len, "Hop index = %d \n", pfh->hop_index); 2672 seq_printf(m, "Hop index = %d \n", pfh->hop_index);
2674 p += p[1] + 2; 2673 p += p[1] + 2;
2675 } 2674 }
2676 else { 2675 else {
2677 len += sprintf(buf + len, "Parse beacon failed at FH param element\n"); 2676 seq_puts(m, "Parse beacon failed at FH param element\n");
2678 return len; 2677 return 0;
2679 } 2678 }
2680 } else { 2679 } else {
2681 len += sprintf(buf + len, "No beacons received\n"); 2680 seq_puts(m, "No beacons received\n");
2682 } 2681 }
2683 return len; 2682 return 0;
2684} 2683}
2685 2684
2685static int ray_cs_proc_open(struct inode *inode, struct file *file)
2686{
2687 return single_open(file, ray_cs_proc_show, NULL);
2688}
2689
2690static const struct file_operations ray_cs_proc_fops = {
2691 .owner = THIS_MODULE,
2692 .open = ray_cs_proc_open,
2693 .read = seq_read,
2694 .llseek = seq_lseek,
2695 .release = single_release,
2696};
2686#endif 2697#endif
2687/*===========================================================================*/ 2698/*===========================================================================*/
2688static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) 2699static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type)
@@ -2815,7 +2826,7 @@ static int __init init_ray_cs(void)
2815#ifdef CONFIG_PROC_FS 2826#ifdef CONFIG_PROC_FS
2816 proc_mkdir("driver/ray_cs", NULL); 2827 proc_mkdir("driver/ray_cs", NULL);
2817 2828
2818 create_proc_info_entry("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_read); 2829 proc_create("driver/ray_cs/ray_cs", 0, NULL, &ray_cs_proc_fops);
2819 raycs_write("driver/ray_cs/essid", write_essid, NULL); 2830 raycs_write("driver/ray_cs/essid", write_essid, NULL);
2820 raycs_write("driver/ray_cs/net_type", write_int, &net_type); 2831 raycs_write("driver/ray_cs/net_type", write_int, &net_type);
2821 raycs_write("driver/ray_cs/translate", write_int, &translate); 2832 raycs_write("driver/ray_cs/translate", write_int, &translate);