~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to ubuntu/rtl8192se/rtl_wx.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************************************
2
 
 * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved.
3
 
 *
4
 
 * This program is distributed in the hope that it will be useful, but WITHOUT
5
 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6
 
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
7
 
 * more details.
8
 
 *
9
 
 * You should have received a copy of the GNU General Public License along with
10
 
 * this program; if not, write to the Free Software Foundation, Inc.,
11
 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
12
 
 *
13
 
 * The full GNU General Public License is included in this distribution in the
14
 
 * file called LICENSE.
15
 
 *
16
 
 * Contact Information:
17
 
 * wlanfae <wlanfae@realtek.com>
18
 
******************************************************************************/
19
 
 
20
 
#include <linux/string.h>
21
 
#include "rtl_core.h"
22
 
#ifdef ENABLE_DOT11D
23
 
#include "rtllib/dot11d.h"
24
 
#endif
25
 
#ifdef _RTL8192_EXT_PATCH_
26
 
#include "../../mshclass/msh_class.h"
27
 
#endif
28
 
 
29
 
#ifdef CONFIG_MP
30
 
#include "r8192S_mp.h"
31
 
#endif
32
 
 
33
 
#define RATE_COUNT 12
34
 
u32 rtl8192_rates[] = {1000000,2000000,5500000,11000000,
35
 
        6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000};
36
 
        
37
 
 
38
 
#ifndef ENETDOWN
39
 
#define ENETDOWN 1
40
 
#endif
41
 
extern int  hwwep;
42
 
#ifdef _RTL8192_EXT_PATCH_
43
 
int r8192_wx_set_channel(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
44
 
static int r8192_wx_mesh_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
45
 
static int r8192_wx_get_mesh_list(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);
46
 
#endif
47
 
 
48
 
static int r8192_wx_get_freq(struct net_device *dev,
49
 
                             struct iw_request_info *a,
50
 
                             union iwreq_data *wrqu, char *b)
51
 
{
52
 
        struct r8192_priv *priv = rtllib_priv(dev);
53
 
        
54
 
#ifdef _RTL8192_EXT_PATCH_
55
 
        return rtllib_wx_get_freq(priv->rtllib,a,wrqu,b,0);
56
 
#else
57
 
        return rtllib_wx_get_freq(priv->rtllib,a,wrqu,b);
58
 
#endif
59
 
}
60
 
 
61
 
 
62
 
#if 0
63
 
 
64
 
static int r8192_wx_set_beaconinterval(struct net_device *dev, struct iw_request_info *aa,
65
 
                          union iwreq_data *wrqu, char *b)
66
 
{
67
 
        int *parms = (int *)b;
68
 
        int bi = parms[0];
69
 
        
70
 
        struct r8192_priv *priv = rtllib_priv(dev);
71
 
        
72
 
        down(&priv->wx_sem);
73
 
        DMESG("setting beacon interval to %x",bi);
74
 
        
75
 
        priv->rtllib->beacon_interval=bi;
76
 
        rtl8192_commit(dev);
77
 
        up(&priv->wx_sem);
78
 
                
79
 
        return 0;       
80
 
}
81
 
 
82
 
 
83
 
static int r8192_wx_set_forceassociate(struct net_device *dev, struct iw_request_info *aa,
84
 
                          union iwreq_data *wrqu, char *extra)
85
 
{
86
 
        struct r8192_priv *priv=rtllib_priv(dev);       
87
 
        int *parms = (int *)extra;
88
 
        
89
 
        priv->rtllib->force_associate = (parms[0] > 0);
90
 
        
91
 
 
92
 
        return 0;
93
 
}
94
 
 
95
 
#endif
96
 
static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
97
 
                             union iwreq_data *wrqu, char *b)
98
 
{
99
 
        struct r8192_priv *priv=rtllib_priv(dev);       
100
 
 
101
 
        return rtllib_wx_get_mode(priv->rtllib,a,wrqu,b);
102
 
}
103
 
 
104
 
static int r8192_wx_get_rate(struct net_device *dev, 
105
 
                             struct iw_request_info *info, 
106
 
                             union iwreq_data *wrqu, char *extra)
107
 
{
108
 
        struct r8192_priv *priv = rtllib_priv(dev);
109
 
        return rtllib_wx_get_rate(priv->rtllib,info,wrqu,extra);
110
 
}
111
 
 
112
 
 
113
 
 
114
 
static int r8192_wx_set_rate(struct net_device *dev, 
115
 
                             struct iw_request_info *info, 
116
 
                             union iwreq_data *wrqu, char *extra)
117
 
{
118
 
        int ret;
119
 
        struct r8192_priv *priv = rtllib_priv(dev);     
120
 
        
121
 
        if(priv->bHwRadioOff == true)
122
 
                return 0;       
123
 
        
124
 
        down(&priv->wx_sem);
125
 
 
126
 
        ret = rtllib_wx_set_rate(priv->rtllib,info,wrqu,extra);
127
 
        
128
 
        up(&priv->wx_sem);
129
 
        
130
 
        return ret;
131
 
}
132
 
 
133
 
 
134
 
static int r8192_wx_set_rts(struct net_device *dev, 
135
 
                             struct iw_request_info *info, 
136
 
                             union iwreq_data *wrqu, char *extra)
137
 
{
138
 
        int ret;
139
 
        struct r8192_priv *priv = rtllib_priv(dev);     
140
 
        
141
 
        if(priv->bHwRadioOff == true)
142
 
                return 0;       
143
 
        
144
 
        down(&priv->wx_sem);
145
 
 
146
 
        ret = rtllib_wx_set_rts(priv->rtllib,info,wrqu,extra);
147
 
        
148
 
        up(&priv->wx_sem);
149
 
        
150
 
        return ret;
151
 
}
152
 
 
153
 
static int r8192_wx_get_rts(struct net_device *dev, 
154
 
                             struct iw_request_info *info, 
155
 
                             union iwreq_data *wrqu, char *extra)
156
 
{
157
 
        struct r8192_priv *priv = rtllib_priv(dev);
158
 
        return rtllib_wx_get_rts(priv->rtllib,info,wrqu,extra);
159
 
}
160
 
 
161
 
static int r8192_wx_set_power(struct net_device *dev, 
162
 
                             struct iw_request_info *info, 
163
 
                             union iwreq_data *wrqu, char *extra)
164
 
{
165
 
        int ret;
166
 
        struct r8192_priv *priv = rtllib_priv(dev);     
167
 
        
168
 
        if(priv->bHwRadioOff == true){
169
 
                RT_TRACE(COMP_ERR,"%s():Hw is Radio Off, we can't set Power,return\n",__FUNCTION__);
170
 
                return 0;
171
 
        }
172
 
        down(&priv->wx_sem);
173
 
 
174
 
        ret = rtllib_wx_set_power(priv->rtllib,info,wrqu,extra);
175
 
        
176
 
        up(&priv->wx_sem);
177
 
        
178
 
        return ret;
179
 
}
180
 
 
181
 
static int r8192_wx_get_power(struct net_device *dev, 
182
 
                             struct iw_request_info *info, 
183
 
                             union iwreq_data *wrqu, char *extra)
184
 
{
185
 
        struct r8192_priv *priv = rtllib_priv(dev);
186
 
        return rtllib_wx_get_power(priv->rtllib,info,wrqu,extra);
187
 
}
188
 
 
189
 
static int r8192_wx_set_rawtx(struct net_device *dev, 
190
 
                               struct iw_request_info *info, 
191
 
                               union iwreq_data *wrqu, char *extra)
192
 
{
193
 
        struct r8192_priv *priv = rtllib_priv(dev);
194
 
        int ret;
195
 
        
196
 
        if(priv->bHwRadioOff == true)
197
 
                return 0;
198
 
        
199
 
        down(&priv->wx_sem);
200
 
        
201
 
        ret = rtllib_wx_set_rawtx(priv->rtllib, info, wrqu, extra);
202
 
        
203
 
        up(&priv->wx_sem);
204
 
        
205
 
        return ret;
206
 
         
207
 
}
208
 
 
209
 
static int r8192_wx_force_reset(struct net_device *dev,
210
 
                struct iw_request_info *info,
211
 
                union iwreq_data *wrqu, char *extra)
212
 
{
213
 
        struct r8192_priv *priv = rtllib_priv(dev);
214
 
        
215
 
        down(&priv->wx_sem);
216
 
 
217
 
        printk("%s(): force reset ! extra is %d\n",__FUNCTION__, *extra);
218
 
        priv->force_reset = *extra;
219
 
        up(&priv->wx_sem);
220
 
        return 0;
221
 
 
222
 
}
223
 
 
224
 
static int r8192_wx_force_mic_error(struct net_device *dev,
225
 
                struct iw_request_info *info,
226
 
                union iwreq_data *wrqu, char *extra)
227
 
{
228
 
        struct r8192_priv *priv = rtllib_priv(dev);
229
 
        struct rtllib_device* ieee = priv->rtllib;
230
 
        
231
 
        down(&priv->wx_sem);
232
 
 
233
 
        printk("%s(): force mic error ! \n",__FUNCTION__);
234
 
        ieee->force_mic_error = true;
235
 
        up(&priv->wx_sem);
236
 
        return 0;
237
 
 
238
 
}
239
 
 
240
 
#define MAX_ADHOC_PEER_NUM 64 
241
 
typedef struct 
242
 
{
243
 
        unsigned char MacAddr[ETH_ALEN];
244
 
        unsigned char WirelessMode;
245
 
        unsigned char bCurTxBW40MHz;            
246
 
} adhoc_peer_entry_t, *p_adhoc_peer_entry_t;
247
 
typedef struct 
248
 
{
249
 
        adhoc_peer_entry_t Entry[MAX_ADHOC_PEER_NUM];
250
 
        unsigned char num;
251
 
} adhoc_peers_info_t, *p_adhoc_peers_info_t;
252
 
int r8192_wx_get_adhoc_peers(struct net_device *dev, 
253
 
                               struct iw_request_info *info, 
254
 
                               union iwreq_data *wrqu, char *extra)
255
 
{
256
 
#ifndef RTL8192SE 
257
 
        return 0;
258
 
#else
259
 
        struct r8192_priv *priv = rtllib_priv(dev);
260
 
        struct sta_info * psta = NULL;
261
 
        adhoc_peers_info_t adhoc_peers_info;
262
 
        p_adhoc_peers_info_t  padhoc_peers_info = &adhoc_peers_info; 
263
 
        p_adhoc_peer_entry_t padhoc_peer_entry = NULL;
264
 
        int k=0;
265
 
 
266
 
 
267
 
        memset(extra, 0, 2047);
268
 
        padhoc_peers_info->num = 0;
269
 
 
270
 
        down(&priv->wx_sem);
271
 
 
272
 
        for(k=0; k<PEER_MAX_ASSOC; k++)
273
 
        {
274
 
                psta = priv->rtllib->peer_assoc_list[k];
275
 
                if(NULL != psta)
276
 
                {
277
 
                        padhoc_peer_entry = &padhoc_peers_info->Entry[padhoc_peers_info->num];
278
 
                        memset(padhoc_peer_entry,0, sizeof(adhoc_peer_entry_t));
279
 
                        memcpy(padhoc_peer_entry->MacAddr, psta->macaddr, ETH_ALEN);
280
 
                        padhoc_peer_entry->WirelessMode = psta->wireless_mode;
281
 
                        padhoc_peer_entry->bCurTxBW40MHz = psta->htinfo.bCurTxBW40MHz;
282
 
                        padhoc_peers_info->num ++;
283
 
                        printk("[%d] MacAddr:"MAC_FMT" \tWirelessMode:%d \tBW40MHz:%d \n", \
284
 
                                k, MAC_ARG(padhoc_peer_entry->MacAddr), padhoc_peer_entry->WirelessMode, padhoc_peer_entry->bCurTxBW40MHz);
285
 
                        sprintf(extra, "[%d] MacAddr:"MAC_FMT" \tWirelessMode:%d \tBW40MHz:%d \n",  \
286
 
                                k, MAC_ARG(padhoc_peer_entry->MacAddr), padhoc_peer_entry->WirelessMode, padhoc_peer_entry->bCurTxBW40MHz);
287
 
                }
288
 
        }
289
 
 
290
 
        up(&priv->wx_sem);
291
 
 
292
 
        wrqu->data.length = strlen(extra);
293
 
        wrqu->data.flags = 0;
294
 
        return 0;
295
 
 
296
 
#endif
297
 
}
298
 
 
299
 
 
300
 
static int r8191se_wx_get_firm_version(struct net_device *dev,
301
 
                struct iw_request_info *info,
302
 
                struct iw_param *wrqu, char *extra)
303
 
{
304
 
#if defined RTL8192SE || defined RTL8192CE
305
 
        struct r8192_priv *priv = rtllib_priv(dev);
306
 
        u16 firmware_version;
307
 
 
308
 
        down(&priv->wx_sem);
309
 
        printk("%s(): Just Support 92SE tmp\n", __FUNCTION__);
310
 
#ifdef RTL8192CE
311
 
        firmware_version = priv->firmware_version;
312
 
#else
313
 
        firmware_version = priv->pFirmware->FirmwareVersion;
314
 
#endif
315
 
        wrqu->value = firmware_version;
316
 
        wrqu->fixed = 1;
317
 
 
318
 
        up(&priv->wx_sem);
319
 
#endif
320
 
        return 0;
321
 
}
322
 
 
323
 
static int r8192_wx_adapter_power_status(struct net_device *dev,
324
 
                struct iw_request_info *info,
325
 
                union iwreq_data *wrqu, char *extra)
326
 
{
327
 
#ifdef ENABLE_LPS
328
 
        struct r8192_priv *priv = rtllib_priv(dev);
329
 
        PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
330
 
        struct rtllib_device* ieee = priv->rtllib;
331
 
 
332
 
        down(&priv->wx_sem);
333
 
 
334
 
        RT_TRACE(COMP_POWER, "%s(): %s\n",__FUNCTION__, (*extra ==  6)?"DC power":"AC power");
335
 
        if(*extra || priv->force_lps) {
336
 
                priv->ps_force = false;
337
 
                pPSC->bLeisurePs = true;
338
 
        } else {        
339
 
                if(priv->rtllib->state == RTLLIB_LINKED)
340
 
                        LeisurePSLeave(dev);
341
 
        
342
 
                priv->ps_force = true;
343
 
                pPSC->bLeisurePs = false;
344
 
                ieee->ps = *extra;      
345
 
        }
346
 
 
347
 
        up(&priv->wx_sem);
348
 
#endif
349
 
 
350
 
        return 0;
351
 
 
352
 
}
353
 
 
354
 
#ifdef _RTL8192_EXT_PATCH_
355
 
static int r8192_wx_print_reg(struct net_device *dev,
356
 
                struct iw_request_info *info,
357
 
                union iwreq_data *wrqu, char *extra)
358
 
{
359
 
        u8 reg1=0,reg2=0,reg3=0,reg4=0;
360
 
        u32 reg5 = 0, len = 0;
361
 
        
362
 
        memset(extra, 0, 512);
363
 
        sprintf(extra,"\nStart Log: Set 0x08000000 to 0x230\n");
364
 
        write_nic_dword(dev, 0x230 , 0x08000000);
365
 
        reg1 = read_nic_byte(dev, 0xf0);
366
 
        reg2 = read_nic_byte(dev, 0xf4);
367
 
        reg3 = read_nic_byte(dev, 0x140);
368
 
        reg4 = read_nic_byte(dev, 0x124);
369
 
        mdelay(10);
370
 
        reg5 = read_nic_dword(dev, 0x230);
371
 
        len = strlen(extra);
372
 
        sprintf(extra+len, "0xf0: %2.2x\n0xf4: %2.2x\n0x140: %2.2x\n0x124: %2.2x\n", reg1,reg2,reg3,reg4);
373
 
        len = strlen(extra);
374
 
        sprintf(extra+len,"After delay 10ms, read 0x230: %8.8x\n", reg5);
375
 
 
376
 
        write_nic_dword(dev, 0x230 , 0x40000000);
377
 
        reg5 = read_nic_dword(dev, 0x230);
378
 
        len = strlen(extra);
379
 
        sprintf(extra+len,"Set 0x40000000 to 0x230. Read 0x230: %8.8x\n", reg5);
380
 
 
381
 
        write_nic_dword(dev, 0x230 , 0x80000000);
382
 
        reg5 = read_nic_dword(dev, 0x230);
383
 
        len = strlen(extra);
384
 
        sprintf(extra+len,"Set 0x80000000 to 0x230. Read 0x230: %8.8x\n", reg5);
385
 
 
386
 
        wrqu->data.length = strlen(extra);
387
 
        return 0;
388
 
}
389
 
 
390
 
static int r8192_wx_resume_firm(struct net_device *dev,
391
 
                struct iw_request_info *info,
392
 
                union iwreq_data *wrqu, char *extra)
393
 
{
394
 
 
395
 
        write_nic_byte(dev, 0x42, 0xFF);
396
 
        write_nic_word(dev, 0x40, 0x77FC);
397
 
        write_nic_word(dev, 0x40, 0x57FC);
398
 
        write_nic_word(dev, 0x40, 0x37FC);
399
 
        write_nic_word(dev, 0x40, 0x77FC);
400
 
        
401
 
        udelay(100);
402
 
 
403
 
        write_nic_word(dev, 0x40, 0x57FC);
404
 
        write_nic_word(dev, 0x40, 0x37FC);
405
 
        write_nic_byte(dev, 0x42, 0x00);
406
 
 
407
 
        return 0;
408
 
}
409
 
#endif
410
 
static int r8192se_wx_set_radio(struct net_device *dev,
411
 
        struct iw_request_info *info,
412
 
        union iwreq_data *wrqu, char *extra)
413
 
{
414
 
    struct r8192_priv *priv = rtllib_priv(dev);
415
 
 
416
 
    down(&priv->wx_sem);
417
 
 
418
 
    printk("%s(): set radio ! extra is %d\n",__FUNCTION__, *extra);
419
 
    if((*extra != 0) && (*extra != 1))
420
 
    {
421
 
        RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n",__FUNCTION__);
422
 
        return -1;
423
 
    }
424
 
    priv->sw_radio_on = *extra;
425
 
    up(&priv->wx_sem);
426
 
    return 0;
427
 
 
428
 
}
429
 
 
430
 
static int r8192se_wx_set_lps_awake_interval(struct net_device *dev,
431
 
        struct iw_request_info *info,
432
 
        union iwreq_data *wrqu, char *extra)
433
 
{
434
 
    struct r8192_priv *priv = rtllib_priv(dev);
435
 
    PRT_POWER_SAVE_CONTROL      pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl));
436
 
 
437
 
    down(&priv->wx_sem);
438
 
 
439
 
    printk("%s(): set lps awake interval ! extra is %d\n",__FUNCTION__, *extra);
440
 
 
441
 
    pPSC->RegMaxLPSAwakeIntvl = *extra;
442
 
    up(&priv->wx_sem);
443
 
    return 0;
444
 
 
445
 
}
446
 
 
447
 
static int r8192se_wx_set_force_lps(struct net_device *dev,
448
 
                struct iw_request_info *info,
449
 
                union iwreq_data *wrqu, char *extra)
450
 
{
451
 
        struct r8192_priv *priv = rtllib_priv(dev);
452
 
        
453
 
        down(&priv->wx_sem);
454
 
 
455
 
        printk("%s(): force LPS ! extra is %d (1 is open 0 is close)\n",__FUNCTION__, *extra);
456
 
        priv->force_lps = *extra;
457
 
        up(&priv->wx_sem);
458
 
        return 0;
459
 
 
460
 
}
461
 
 
462
 
#ifdef _RTL8192_EXT_PATCH_
463
 
static int r8192_wx_get_drv_version(struct net_device *dev,
464
 
                struct iw_request_info *info,
465
 
                union iwreq_data *wrqu, char *extra)
466
 
{
467
 
        memset(extra, 0, 64);
468
 
        sprintf(extra, "Support Mesh");
469
 
 
470
 
        ((struct iw_point *)wrqu)->length = strlen(extra);
471
 
        return 0;
472
 
}
473
 
#endif
474
 
 
475
 
static int r8192_wx_set_debugflag(struct net_device *dev, 
476
 
                               struct iw_request_info *info, 
477
 
                               union iwreq_data *wrqu, char *extra)
478
 
{
479
 
        struct r8192_priv *priv = rtllib_priv(dev);
480
 
        u8 c = *extra;
481
 
        
482
 
        if(priv->bHwRadioOff == true)
483
 
                return 0;
484
 
        
485
 
        printk("=====>%s(), *extra:%x, debugflag:%x\n", __FUNCTION__, *extra, rt_global_debug_component);
486
 
        if (c > 0)  {
487
 
                rt_global_debug_component |= (1<<c);
488
 
        } else {
489
 
                rt_global_debug_component &= BIT31; 
490
 
        }
491
 
        return 0;
492
 
}
493
 
 
494
 
static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
495
 
                             union iwreq_data *wrqu, char *b)
496
 
{
497
 
        struct r8192_priv *priv = rtllib_priv(dev);
498
 
#ifdef ENABLE_IPS       
499
 
        struct rtllib_device* ieee = netdev_priv_rsl(dev);
500
 
#endif
501
 
 
502
 
        RT_RF_POWER_STATE       rtState;
503
 
        int ret;
504
 
 
505
 
        if(priv->bHwRadioOff == true)
506
 
                return 0;
507
 
#ifdef _RTL8192_EXT_PATCH_
508
 
        if (priv->mshobj && (priv->rtllib->iw_mode==IW_MODE_MESH)) {
509
 
                return 0;       
510
 
        }
511
 
#endif
512
 
        rtState = priv->rtllib->eRFPowerState;
513
 
        down(&priv->wx_sem);
514
 
#ifdef ENABLE_IPS       
515
 
        if(wrqu->mode == IW_MODE_ADHOC || wrqu->mode == IW_MODE_MONITOR
516
 
                || ieee->bNetPromiscuousMode )
517
 
        {
518
 
                if(priv->rtllib->PowerSaveControl.bInactivePs){ 
519
 
                        if(rtState == eRfOff){
520
 
                                if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
521
 
                                {
522
 
                                        RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
523
 
                                        up(&priv->wx_sem);
524
 
                                        return -1;
525
 
                                } else {
526
 
                                        printk("=========>%s(): IPSLeave\n",__FUNCTION__);
527
 
                                        down(&priv->rtllib->ips_sem);
528
 
                                        IPSLeave(dev);
529
 
                                        up(&priv->rtllib->ips_sem);                             
530
 
                                }
531
 
                        }
532
 
                }
533
 
        }
534
 
#endif
535
 
        ret = rtllib_wx_set_mode(priv->rtllib,a,wrqu,b);
536
 
 
537
 
        up(&priv->wx_sem);
538
 
        return ret;
539
 
}
540
 
#if defined (RTL8192S_WAPI_SUPPORT)
541
 
int wapi_ioctl_set_mode(struct net_device *dev, struct iw_request_info *a,
542
 
                             union iwreq_data *wrqu, char *b)
543
 
{
544
 
        struct r8192_priv *priv = rtllib_priv(dev);
545
 
        RT_RF_POWER_STATE       rtState;
546
 
        int ret;
547
 
 
548
 
        printk("===============================>%s\n", __FUNCTION__);   
549
 
        if(priv->bHwRadioOff == true)
550
 
                return 0;
551
 
#ifdef _RTL8192_EXT_PATCH_
552
 
        if (priv->mshobj && (priv->rtllib->iw_mode==IW_MODE_MESH)) {
553
 
                return 0;       
554
 
        }
555
 
#endif
556
 
        rtState = priv->rtllib->eRFPowerState;
557
 
#ifdef ENABLE_IPS       
558
 
        if(wrqu->mode == IW_MODE_ADHOC){
559
 
                if(priv->rtllib->PowerSaveControl.bInactivePs){ 
560
 
                        if(rtState == eRfOff){
561
 
                                if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
562
 
                                {
563
 
                                        RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
564
 
                                        up(&priv->wx_sem);
565
 
                                        return -1;
566
 
                                } else {
567
 
                                        printk("=========>%s(): IPSLeave\n",__FUNCTION__);
568
 
                                        down(&priv->rtllib->ips_sem);
569
 
                                        IPSLeave(dev);
570
 
                                        up(&priv->rtllib->ips_sem);                             
571
 
                                }
572
 
                        }
573
 
                }
574
 
        }
575
 
#endif
576
 
        ret = rtllib_wx_set_mode(priv->rtllib,a,wrqu,b);
577
 
 
578
 
        return ret;
579
 
}
580
 
#endif
581
 
struct  iw_range_with_scan_capa
582
 
{
583
 
        /* Informative stuff (to choose between different interface) */
584
 
        __u32           throughput;     /* To give an idea... */
585
 
        /* In theory this value should be the maximum benchmarked
586
 
         * TCP/IP throughput, because with most of these devices the
587
 
         * bit rate is meaningless (overhead an co) to estimate how
588
 
         * fast the connection will go and pick the fastest one.
589
 
         * I suggest people to play with Netperf or any benchmark...
590
 
         */
591
 
 
592
 
        /* NWID (or domain id) */
593
 
        __u32           min_nwid;       /* Minimal NWID we are able to set */
594
 
        __u32           max_nwid;       /* Maximal NWID we are able to set */
595
 
 
596
 
        /* Old Frequency (backward compat - moved lower ) */
597
 
        __u16           old_num_channels;
598
 
        __u8            old_num_frequency;
599
 
 
600
 
        /* Scan capabilities */
601
 
        __u8            scan_capa;       
602
 
};
603
 
 
604
 
static int rtl8192_wx_get_range(struct net_device *dev, 
605
 
                                struct iw_request_info *info, 
606
 
                                union iwreq_data *wrqu, char *extra)
607
 
{
608
 
        struct iw_range *range = (struct iw_range *)extra;
609
 
        struct r8192_priv *priv = rtllib_priv(dev);
610
 
        u16 val;
611
 
        int i;
612
 
 
613
 
        wrqu->data.length = sizeof(*range);
614
 
        memset(range, 0, sizeof(*range));
615
 
 
616
 
        /* ~130 Mb/s real (802.11n) */
617
 
        range->throughput = 130 * 1000 * 1000;     
618
 
 
619
 
        if(priv->rf_set_sens != NULL)
620
 
                range->sensitivity = priv->max_sens;    /* signal level threshold range */
621
 
        
622
 
        range->max_qual.qual = 100;
623
 
        range->max_qual.level = 0;
624
 
        range->max_qual.noise = 0;
625
 
        range->max_qual.updated = 7; /* Updated all three */
626
 
 
627
 
        range->avg_qual.qual = 70; /* > 8% missed beacons is 'bad' */
628
 
        range->avg_qual.level = 0;
629
 
        range->avg_qual.noise = 0;
630
 
        range->avg_qual.updated = 7; /* Updated all three */
631
 
 
632
 
        range->num_bitrates = min(RATE_COUNT, IW_MAX_BITRATES);
633
 
        
634
 
        for (i = 0; i < range->num_bitrates; i++) {
635
 
                range->bitrate[i] = rtl8192_rates[i];
636
 
        }
637
 
        
638
 
        range->max_rts = DEFAULT_RTS_THRESHOLD;
639
 
        range->min_frag = MIN_FRAG_THRESHOLD;
640
 
        range->max_frag = MAX_FRAG_THRESHOLD;
641
 
        
642
 
        range->min_pmp = 0;
643
 
        range->max_pmp = 5000000;
644
 
        range->min_pmt = 0;
645
 
        range->max_pmt = 65535*1000;    
646
 
        range->pmp_flags = IW_POWER_PERIOD;
647
 
        range->pmt_flags = IW_POWER_TIMEOUT;
648
 
        range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
649
 
        range->we_version_compiled = WIRELESS_EXT;
650
 
        range->we_version_source = 18;
651
 
 
652
 
        for (i = 0, val = 0; i < 14; i++) {
653
 
                if ((priv->rtllib->active_channel_map)[i+1]) {
654
 
                        range->freq[val].i = i + 1;
655
 
                        range->freq[val].m = rtllib_wlan_frequencies[i] * 100000;
656
 
                        range->freq[val].e = 1;
657
 
                        val++;
658
 
                } else {
659
 
                }
660
 
                
661
 
                if (val == IW_MAX_FREQUENCIES)
662
 
                break;
663
 
        }
664
 
        range->num_frequency = val;
665
 
        range->num_channels = val;
666
 
#if WIRELESS_EXT > 17
667
 
        range->enc_capa = IW_ENC_CAPA_WPA|IW_ENC_CAPA_WPA2|
668
 
                          IW_ENC_CAPA_CIPHER_TKIP|IW_ENC_CAPA_CIPHER_CCMP;
669
 
#endif
670
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)
671
 
        {
672
 
                struct iw_range_with_scan_capa* tmp = (struct iw_range_with_scan_capa*)range;
673
 
                tmp->scan_capa = 0x01;
674
 
        }
675
 
#else
676
 
        range->scan_capa = IW_SCAN_CAPA_ESSID | IW_SCAN_CAPA_TYPE;
677
 
#endif
678
 
 
679
 
        /* Event capability (kernel + driver) */ 
680
 
 
681
 
        return 0;
682
 
}
683
 
 
684
 
static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
685
 
                             union iwreq_data *wrqu, char *b)
686
 
{
687
 
        struct r8192_priv *priv = rtllib_priv(dev);
688
 
        struct rtllib_device* ieee = priv->rtllib;
689
 
        RT_RF_POWER_STATE       rtState;
690
 
        int ret;
691
 
        
692
 
#ifdef CONFIG_MP
693
 
        printk("######################%s(): In MP Test Can not Scan\n",__FUNCTION__);
694
 
        return 0;
695
 
#endif
696
 
        if (!(ieee->softmac_features & IEEE_SOFTMAC_SCAN)){
697
 
                if((ieee->state >= RTLLIB_ASSOCIATING) && (ieee->state <= RTLLIB_ASSOCIATING_AUTHENTICATED)){
698
 
                        return 0;
699
 
                }
700
 
                if((priv->rtllib->state == RTLLIB_LINKED) && (priv->rtllib->CntAfterLink<2)){
701
 
                        return 0;
702
 
                }
703
 
        }
704
 
 
705
 
        if(priv->bHwRadioOff == true){
706
 
                printk("================>%s(): hwradio off\n",__FUNCTION__);
707
 
                return 0;
708
 
        }
709
 
        rtState = priv->rtllib->eRFPowerState;
710
 
        if(!priv->up) return -ENETDOWN;
711
 
        if (priv->rtllib->LinkDetectInfo.bBusyTraffic == true)
712
 
                return -EAGAIN;
713
 
 
714
 
#ifdef _RTL8192_EXT_PATCH_      
715
 
        if((ieee->iw_mode == IW_MODE_MESH)&&(ieee->mesh_state == RTLLIB_MESH_LINKED))
716
 
        {
717
 
                return 0;
718
 
        }
719
 
#endif
720
 
#if WIRELESS_EXT > 17
721
 
        if (wrqu->data.flags & IW_SCAN_THIS_ESSID)
722
 
        {
723
 
                struct iw_scan_req* req = (struct iw_scan_req*)b;
724
 
                if (req->essid_len)
725
 
                {
726
 
                        ieee->current_network.ssid_len = req->essid_len;
727
 
                        memcpy(ieee->current_network.ssid, req->essid, req->essid_len); 
728
 
                }
729
 
        }
730
 
#endif  
731
 
 
732
 
        down(&priv->wx_sem);
733
 
 
734
 
        priv->rtllib->FirstIe_InScan = true;
735
 
 
736
 
        if(priv->rtllib->state != RTLLIB_LINKED){
737
 
#ifdef ENABLE_IPS
738
 
                if(priv->rtllib->PowerSaveControl.bInactivePs){ 
739
 
                        if(rtState == eRfOff){
740
 
                                if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS){
741
 
                                        RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
742
 
                                        up(&priv->wx_sem);
743
 
                                        return -1;
744
 
                                }else{
745
 
                                        RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n",__FUNCTION__);
746
 
                                        down(&priv->rtllib->ips_sem);
747
 
                                        IPSLeave(dev);
748
 
                                        up(&priv->rtllib->ips_sem);                             
749
 
                                }
750
 
                        }
751
 
                }
752
 
#endif
753
 
                rtllib_stop_scan(priv->rtllib);
754
 
                if(priv->rtllib->LedControlHandler)
755
 
                        priv->rtllib->LedControlHandler(dev, LED_CTL_SITE_SURVEY);
756
 
                
757
 
                if(priv->rtllib->eRFPowerState != eRfOff){
758
 
                        priv->rtllib->actscanning = true;
759
 
 
760
 
                        if(ieee->ScanOperationBackupHandler)
761
 
                                ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_BACKUP);
762
 
        
763
 
                        rtllib_start_scan_syncro(priv->rtllib, 0);
764
 
 
765
 
                        if(ieee->ScanOperationBackupHandler)
766
 
                                ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_RESTORE);
767
 
                }
768
 
                ret = 0;
769
 
        } else {
770
 
                priv->rtllib->actscanning = true;
771
 
                ret = rtllib_wx_set_scan(priv->rtllib,a,wrqu,b);
772
 
        }
773
 
        
774
 
        up(&priv->wx_sem);
775
 
        return ret;
776
 
}
777
 
 
778
 
 
779
 
static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
780
 
                             union iwreq_data *wrqu, char *b)
781
 
{
782
 
 
783
 
        int ret;
784
 
        struct r8192_priv *priv = rtllib_priv(dev);
785
 
        
786
 
        if(!priv->up) return -ENETDOWN;
787
 
                        
788
 
        if(priv->bHwRadioOff == true)
789
 
                return 0;
790
 
        
791
 
                        
792
 
        down(&priv->wx_sem);
793
 
 
794
 
        ret = rtllib_wx_get_scan(priv->rtllib,a,wrqu,b);
795
 
                
796
 
        up(&priv->wx_sem);
797
 
        
798
 
        return ret;
799
 
}
800
 
 
801
 
static int r8192_wx_set_essid(struct net_device *dev, 
802
 
                              struct iw_request_info *a,
803
 
                              union iwreq_data *wrqu, char *b)
804
 
{
805
 
        struct r8192_priv *priv = rtllib_priv(dev);
806
 
        int ret;
807
 
                
808
 
        if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){
809
 
                ;
810
 
        }
811
 
#ifdef CONFIG_MP
812
 
        printk("######################%s(): In MP Test Can not Set Essid\n",__FUNCTION__);
813
 
        return 0;
814
 
#endif
815
 
        if(priv->bHwRadioOff == true){
816
 
                printk("=========>%s():hw radio off,or Rf state is eRfOff, return\n",__FUNCTION__);
817
 
                return 0;
818
 
        }
819
 
        down(&priv->wx_sem);
820
 
        ret = rtllib_wx_set_essid(priv->rtllib,a,wrqu,b);
821
 
 
822
 
        up(&priv->wx_sem);
823
 
 
824
 
        return ret;
825
 
}
826
 
 
827
 
static int r8192_wx_get_essid(struct net_device *dev, 
828
 
                              struct iw_request_info *a,
829
 
                              union iwreq_data *wrqu, char *b)
830
 
{
831
 
        int ret;
832
 
        struct r8192_priv *priv = rtllib_priv(dev);
833
 
        
834
 
        down(&priv->wx_sem);
835
 
        
836
 
        ret = rtllib_wx_get_essid(priv->rtllib, a, wrqu, b);
837
 
 
838
 
        up(&priv->wx_sem);
839
 
        
840
 
        return ret;
841
 
}
842
 
 
843
 
static int r8192_wx_set_nick(struct net_device *dev,
844
 
                           struct iw_request_info *info,
845
 
                           union iwreq_data *wrqu, char *extra)
846
 
{
847
 
        struct r8192_priv *priv = rtllib_priv(dev);
848
 
 
849
 
        if (wrqu->data.length > IW_ESSID_MAX_SIZE)
850
 
                return -E2BIG;
851
 
        down(&priv->wx_sem);
852
 
        wrqu->data.length = min((size_t) wrqu->data.length, sizeof(priv->nick));
853
 
        memset(priv->nick, 0, sizeof(priv->nick));
854
 
        memcpy(priv->nick, extra, wrqu->data.length);
855
 
        up(&priv->wx_sem);
856
 
        return 0;
857
 
 
858
 
}
859
 
 
860
 
static int r8192_wx_get_nick(struct net_device *dev,
861
 
                             struct iw_request_info *info, 
862
 
                             union iwreq_data *wrqu, char *extra)
863
 
{
864
 
        struct r8192_priv *priv = rtllib_priv(dev);
865
 
 
866
 
        down(&priv->wx_sem);
867
 
        wrqu->data.length = strlen(priv->nick);
868
 
        memcpy(extra, priv->nick, wrqu->data.length);
869
 
        wrqu->data.flags = 1;   /* active */
870
 
        up(&priv->wx_sem);
871
 
        return 0;
872
 
}
873
 
 
874
 
static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a,
875
 
                             union iwreq_data *wrqu, char *b)
876
 
{
877
 
        int ret;
878
 
        struct r8192_priv *priv = rtllib_priv(dev);
879
 
        
880
 
        if(priv->bHwRadioOff == true)
881
 
                return 0;
882
 
        
883
 
        down(&priv->wx_sem);
884
 
        
885
 
        ret = rtllib_wx_set_freq(priv->rtllib, a, wrqu, b);
886
 
        
887
 
        up(&priv->wx_sem);
888
 
        return ret;
889
 
}
890
 
 
891
 
static int r8192_wx_get_name(struct net_device *dev, 
892
 
                             struct iw_request_info *info, 
893
 
                             union iwreq_data *wrqu, char *extra)
894
 
{
895
 
        struct r8192_priv *priv = rtllib_priv(dev);
896
 
        return rtllib_wx_get_name(priv->rtllib, info, wrqu, extra);
897
 
}
898
 
 
899
 
 
900
 
static int r8192_wx_set_frag(struct net_device *dev, 
901
 
                             struct iw_request_info *info, 
902
 
                             union iwreq_data *wrqu, char *extra)
903
 
{
904
 
        struct r8192_priv *priv = rtllib_priv(dev);
905
 
 
906
 
        if(priv->bHwRadioOff == true)
907
 
                return 0;
908
 
        
909
 
        if (wrqu->frag.disabled)
910
 
                priv->rtllib->fts = DEFAULT_FRAG_THRESHOLD;
911
 
        else {
912
 
                if (wrqu->frag.value < MIN_FRAG_THRESHOLD ||
913
 
                    wrqu->frag.value > MAX_FRAG_THRESHOLD)
914
 
                        return -EINVAL;
915
 
                
916
 
                priv->rtllib->fts = wrqu->frag.value & ~0x1;
917
 
        }
918
 
 
919
 
        return 0;
920
 
}
921
 
 
922
 
 
923
 
static int r8192_wx_get_frag(struct net_device *dev, 
924
 
                             struct iw_request_info *info, 
925
 
                             union iwreq_data *wrqu, char *extra)
926
 
{
927
 
        struct r8192_priv *priv = rtllib_priv(dev);
928
 
 
929
 
        wrqu->frag.value = priv->rtllib->fts;
930
 
        wrqu->frag.fixed = 0;   /* no auto select */
931
 
        wrqu->frag.disabled = (wrqu->frag.value == DEFAULT_FRAG_THRESHOLD);
932
 
 
933
 
        return 0;
934
 
}
935
 
 
936
 
 
937
 
static int r8192_wx_set_wap(struct net_device *dev,
938
 
                         struct iw_request_info *info,
939
 
                         union iwreq_data *awrq,
940
 
                         char *extra)
941
 
{
942
 
 
943
 
        int ret;
944
 
        struct r8192_priv *priv = rtllib_priv(dev);
945
 
        
946
 
        if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){
947
 
                ;
948
 
        }
949
 
 
950
 
        if(priv->bHwRadioOff == true)
951
 
                return 0;
952
 
        
953
 
#ifdef _RTL8192_EXT_PATCH_
954
 
        if (priv->mshobj && (priv->rtllib->iw_mode==IW_MODE_MESH)){
955
 
                return 0;
956
 
        }
957
 
#endif
958
 
        down(&priv->wx_sem);
959
 
        
960
 
        ret = rtllib_wx_set_wap(priv->rtllib,info,awrq,extra);
961
 
 
962
 
        up(&priv->wx_sem);
963
 
 
964
 
        return ret;
965
 
        
966
 
}
967
 
        
968
 
 
969
 
static int r8192_wx_get_wap(struct net_device *dev, 
970
 
                            struct iw_request_info *info, 
971
 
                            union iwreq_data *wrqu, char *extra)
972
 
{
973
 
        struct r8192_priv *priv = rtllib_priv(dev);
974
 
        
975
 
        return rtllib_wx_get_wap(priv->rtllib,info,wrqu,extra);
976
 
}
977
 
 
978
 
 
979
 
static int r8192_wx_get_enc(struct net_device *dev, 
980
 
                            struct iw_request_info *info, 
981
 
                            union iwreq_data *wrqu, char *key)
982
 
{
983
 
        struct r8192_priv *priv = rtllib_priv(dev);
984
 
        
985
 
#ifdef _RTL8192_EXT_PATCH_
986
 
        return rtllib_wx_get_encode(priv->rtllib, info, wrqu, key,0);
987
 
#else
988
 
        return rtllib_wx_get_encode(priv->rtllib, info, wrqu, key);
989
 
#endif
990
 
}
991
 
 
992
 
static int r8192_wx_set_enc(struct net_device *dev, 
993
 
                            struct iw_request_info *info, 
994
 
                            union iwreq_data *wrqu, char *key)
995
 
{
996
 
        struct r8192_priv *priv = rtllib_priv(dev);
997
 
        int ret;
998
 
 
999
 
        struct rtllib_device *ieee = priv->rtllib;
1000
 
        u32 hwkey[4]={0,0,0,0};
1001
 
        u8 mask=0xff;
1002
 
        u32 key_idx=0;
1003
 
        u8 zero_addr[4][6] ={   {0x00,0x00,0x00,0x00,0x00,0x00},
1004
 
                                {0x00,0x00,0x00,0x00,0x00,0x01}, 
1005
 
                                {0x00,0x00,0x00,0x00,0x00,0x02}, 
1006
 
                                {0x00,0x00,0x00,0x00,0x00,0x03} };
1007
 
        int i;
1008
 
 
1009
 
        if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){
1010
 
                ;
1011
 
        }
1012
 
#ifdef CONFIG_MP
1013
 
        printk("######################%s(): In MP Test Can not Set Enc\n",__FUNCTION__);
1014
 
        return 0;
1015
 
#endif
1016
 
        if(priv->bHwRadioOff == true)
1017
 
                return 0;
1018
 
        
1019
 
       if(!priv->up) return -ENETDOWN;
1020
 
 
1021
 
        priv->rtllib->wx_set_enc = 1;
1022
 
#ifdef ENABLE_IPS
1023
 
        down(&priv->rtllib->ips_sem);
1024
 
        IPSLeave(dev);
1025
 
        up(&priv->rtllib->ips_sem);                     
1026
 
#endif
1027
 
        down(&priv->wx_sem);
1028
 
        
1029
 
        RT_TRACE(COMP_SEC, "Setting SW wep key");
1030
 
#ifdef _RTL8192_EXT_PATCH_
1031
 
        ret = rtllib_wx_set_encode(priv->rtllib,info,wrqu,key,0);
1032
 
#else   
1033
 
        ret = rtllib_wx_set_encode(priv->rtllib,info,wrqu,key);
1034
 
#endif
1035
 
        up(&priv->wx_sem);
1036
 
 
1037
 
 
1038
 
        if (wrqu->encoding.flags & IW_ENCODE_DISABLED) {
1039
 
                ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA;
1040
 
                CamResetAllEntry(dev);
1041
 
#ifdef _RTL8192_EXT_PATCH_
1042
 
                CamRestoreEachIFEntry(dev,1);
1043
 
                reset_IFswcam(dev,0);
1044
 
                priv->rtllib->wx_set_enc = 0;
1045
 
#else
1046
 
                memset(priv->rtllib->swcamtable,0,sizeof(SW_CAM_TABLE)*32);
1047
 
#endif
1048
 
                goto end_hw_sec;
1049
 
        }
1050
 
        if(wrqu->encoding.length!=0){
1051
 
 
1052
 
                for(i=0 ; i<4 ; i++){
1053
 
                        hwkey[i] |=  key[4*i+0]&mask;
1054
 
                        if(i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00;
1055
 
                        if(i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00;
1056
 
                        hwkey[i] |= (key[4*i+1]&mask)<<8;
1057
 
                        hwkey[i] |= (key[4*i+2]&mask)<<16;
1058
 
                        hwkey[i] |= (key[4*i+3]&mask)<<24;
1059
 
                }
1060
 
 
1061
 
                #define CONF_WEP40  0x4
1062
 
                #define CONF_WEP104 0x14
1063
 
 
1064
 
                switch(wrqu->encoding.flags & IW_ENCODE_INDEX){
1065
 
                        case 0: key_idx = ieee->tx_keyidx; break;
1066
 
                        case 1: key_idx = 0; break;
1067
 
                        case 2: key_idx = 1; break;
1068
 
                        case 3: key_idx = 2; break;
1069
 
                        case 4: key_idx = 3; break;
1070
 
                        default: break;
1071
 
                }
1072
 
                if(wrqu->encoding.length==0x5){
1073
 
                ieee->pairwise_key_type = KEY_TYPE_WEP40;
1074
 
                        EnableHWSecurityConfig8192(dev);
1075
 
#ifndef _RTL8192_EXT_PATCH_
1076
 
                        setKey( dev,
1077
 
                                key_idx,                
1078
 
                                key_idx,                
1079
 
                                KEY_TYPE_WEP40,         
1080
 
                                zero_addr[key_idx],
1081
 
                                0,                      
1082
 
                                hwkey);                 
1083
 
 
1084
 
                        set_swcam( dev,
1085
 
                                key_idx,                
1086
 
                                key_idx,                
1087
 
                                KEY_TYPE_WEP40,         
1088
 
                                zero_addr[key_idx],
1089
 
                                0,                      
1090
 
                                hwkey,                 
1091
 
                                0);
1092
 
 
1093
 
#endif
1094
 
                }
1095
 
 
1096
 
                else if(wrqu->encoding.length==0xd){
1097
 
                        ieee->pairwise_key_type = KEY_TYPE_WEP104;
1098
 
                                EnableHWSecurityConfig8192(dev);
1099
 
#ifndef _RTL8192_EXT_PATCH_
1100
 
                        setKey( dev,
1101
 
                                key_idx,                
1102
 
                                key_idx,                
1103
 
                                KEY_TYPE_WEP104,        
1104
 
                                zero_addr[key_idx],
1105
 
                                0,                      
1106
 
                                hwkey);                 
1107
 
                        set_swcam( dev,
1108
 
                                key_idx,                
1109
 
                                key_idx,                
1110
 
                                KEY_TYPE_WEP104,        
1111
 
                                zero_addr[key_idx],
1112
 
                                0,                      
1113
 
                                hwkey,                 
1114
 
                                0);
1115
 
#endif
1116
 
                }
1117
 
                else printk("wrong type in WEP, not WEP40 and WEP104\n");
1118
 
#ifdef _RTL8192_EXT_PATCH_
1119
 
                if(ieee->state == RTLLIB_LINKED){
1120
 
                        if(ieee->iw_mode == IW_MODE_ADHOC)
1121
 
                        {
1122
 
                                
1123
 
                                setKey( dev,
1124
 
                                                key_idx,                      
1125
 
                                                key_idx,                      
1126
 
                                                ieee->pairwise_key_type,        
1127
 
                                                zero_addr[key_idx],             
1128
 
                                                0,                      
1129
 
                                                hwkey);                 
1130
 
                                set_swcam( dev,
1131
 
                                                key_idx,                      
1132
 
                                                key_idx,                      
1133
 
                                                ieee->pairwise_key_type,        
1134
 
                                                zero_addr[key_idx],             
1135
 
                                                0,                      
1136
 
                                                hwkey,               
1137
 
                                                0);
1138
 
                        }
1139
 
                        else{
1140
 
                        setKey( dev,
1141
 
                                        31,                      
1142
 
                                        key_idx,                      
1143
 
                                                ieee->pairwise_key_type,        
1144
 
                                        ieee->ap_mac_addr,         
1145
 
                                        0,                      
1146
 
                                        hwkey);                 
1147
 
                        set_swcam( dev,
1148
 
                                        31,                      
1149
 
                                        key_idx,                      
1150
 
                                                ieee->pairwise_key_type,        
1151
 
                                        ieee->ap_mac_addr,         
1152
 
                                        0,                      
1153
 
                                        hwkey,               
1154
 
                                        0);
1155
 
                }
1156
 
        }
1157
 
#endif
1158
 
        }
1159
 
 
1160
 
#if 0
1161
 
        if(wrqu->encoding.length==0 && (wrqu->encoding.flags >>8) == 0x8 ){
1162
 
                printk("===>1\n");              
1163
 
                EnableHWSecurityConfig8192(dev);
1164
 
                key_idx = (wrqu->encoding.flags & 0xf)-1 ;
1165
 
                write_cam(dev, (4*6),   0xffff0000|read_cam(dev, key_idx*6) );
1166
 
                write_cam(dev, (4*6)+1, 0xffffffff);
1167
 
                write_cam(dev, (4*6)+2, read_cam(dev, (key_idx*6)+2) );
1168
 
                write_cam(dev, (4*6)+3, read_cam(dev, (key_idx*6)+3) );
1169
 
                write_cam(dev, (4*6)+4, read_cam(dev, (key_idx*6)+4) );
1170
 
                write_cam(dev, (4*6)+5, read_cam(dev, (key_idx*6)+5) );
1171
 
        }
1172
 
#endif
1173
 
#ifdef _RTL8192_EXT_PATCH_
1174
 
        priv->rtllib->wx_set_enc = 0;
1175
 
        printk("===================>%s():set ieee->wx_set_enc 0\n",__FUNCTION__);
1176
 
end_hw_sec:
1177
 
#else
1178
 
end_hw_sec:
1179
 
        priv->rtllib->wx_set_enc = 0;
1180
 
#endif
1181
 
        return ret;
1182
 
}
1183
 
 
1184
 
 
1185
 
static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union
1186
 
 iwreq_data *wrqu, char *p){
1187
 
  
1188
 
        struct r8192_priv *priv = rtllib_priv(dev);
1189
 
        int *parms=(int*)p;
1190
 
        int mode=parms[0];
1191
 
        
1192
 
        if(priv->bHwRadioOff == true)
1193
 
                return 0;
1194
 
        
1195
 
        priv->rtllib->active_scan = mode;
1196
 
        
1197
 
        return 1;
1198
 
}
1199
 
 
1200
 
 
1201
 
 
1202
 
#define R8192_MAX_RETRY 255
1203
 
static int r8192_wx_set_retry(struct net_device *dev, 
1204
 
                                struct iw_request_info *info, 
1205
 
                                union iwreq_data *wrqu, char *extra)
1206
 
{
1207
 
        struct r8192_priv *priv = rtllib_priv(dev);
1208
 
        int err = 0;
1209
 
        
1210
 
        if(priv->bHwRadioOff == true)
1211
 
                return 0;
1212
 
        
1213
 
        down(&priv->wx_sem);
1214
 
        
1215
 
        if (wrqu->retry.flags & IW_RETRY_LIFETIME || 
1216
 
            wrqu->retry.disabled){
1217
 
                err = -EINVAL;
1218
 
                goto exit;
1219
 
        }
1220
 
        if (!(wrqu->retry.flags & IW_RETRY_LIMIT)){
1221
 
                err = -EINVAL;
1222
 
                goto exit;
1223
 
        }
1224
 
 
1225
 
        if(wrqu->retry.value > R8192_MAX_RETRY){
1226
 
                err= -EINVAL;
1227
 
                goto exit;
1228
 
        }
1229
 
        if (wrqu->retry.flags & IW_RETRY_MAX) {
1230
 
                priv->retry_rts = wrqu->retry.value;
1231
 
                DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value);
1232
 
        
1233
 
        }else {
1234
 
                priv->retry_data = wrqu->retry.value;
1235
 
                DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value);
1236
 
        }
1237
 
        
1238
 
 
1239
 
        rtl8192_commit(dev);
1240
 
        /*
1241
 
        if(priv->up){
1242
 
                rtl8180_halt_adapter(dev);
1243
 
                rtl8180_rx_enable(dev);
1244
 
                rtl8180_tx_enable(dev);
1245
 
                        
1246
 
        }
1247
 
        */
1248
 
exit:
1249
 
        up(&priv->wx_sem);
1250
 
        
1251
 
        return err;
1252
 
}
1253
 
 
1254
 
static int r8192_wx_get_retry(struct net_device *dev, 
1255
 
                                struct iw_request_info *info, 
1256
 
                                union iwreq_data *wrqu, char *extra)
1257
 
{
1258
 
        struct r8192_priv *priv = rtllib_priv(dev);
1259
 
        
1260
 
 
1261
 
        wrqu->retry.disabled = 0; /* can't be disabled */
1262
 
 
1263
 
        if ((wrqu->retry.flags & IW_RETRY_TYPE) == 
1264
 
            IW_RETRY_LIFETIME) 
1265
 
                return -EINVAL;
1266
 
        
1267
 
        if (wrqu->retry.flags & IW_RETRY_MAX) {
1268
 
                wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MAX;
1269
 
                wrqu->retry.value = priv->retry_rts;
1270
 
        } else {
1271
 
                wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN;
1272
 
                wrqu->retry.value = priv->retry_data;
1273
 
        }
1274
 
        
1275
 
 
1276
 
        return 0;
1277
 
}
1278
 
 
1279
 
static int r8192_wx_get_sens(struct net_device *dev, 
1280
 
                                struct iw_request_info *info, 
1281
 
                                union iwreq_data *wrqu, char *extra)
1282
 
{
1283
 
        struct r8192_priv *priv = rtllib_priv(dev);
1284
 
        if(priv->rf_set_sens == NULL) 
1285
 
                return -1; /* we have not this support for this radio */
1286
 
        wrqu->sens.value = priv->sens;
1287
 
        return 0;
1288
 
}
1289
 
 
1290
 
 
1291
 
static int r8192_wx_set_sens(struct net_device *dev, 
1292
 
                                struct iw_request_info *info, 
1293
 
                                union iwreq_data *wrqu, char *extra)
1294
 
{
1295
 
        
1296
 
        struct r8192_priv *priv = rtllib_priv(dev);
1297
 
        
1298
 
        short err = 0;
1299
 
        
1300
 
        if(priv->bHwRadioOff == true)
1301
 
                return 0;
1302
 
        
1303
 
        down(&priv->wx_sem);
1304
 
        if(priv->rf_set_sens == NULL) {
1305
 
                err= -1; /* we have not this support for this radio */
1306
 
                goto exit;
1307
 
        }
1308
 
        if(priv->rf_set_sens(dev, wrqu->sens.value) == 0)
1309
 
                priv->sens = wrqu->sens.value;
1310
 
        else
1311
 
                err= -EINVAL;
1312
 
 
1313
 
exit:
1314
 
        up(&priv->wx_sem);
1315
 
        
1316
 
        return err;
1317
 
}
1318
 
 
1319
 
#if (WIRELESS_EXT >= 18)
1320
 
#if 0
1321
 
static int r8192_wx_get_enc_ext(struct net_device *dev,
1322
 
                                        struct iw_request_info *info,
1323
 
                                        union iwreq_data *wrqu, char *extra)
1324
 
{
1325
 
        struct r8192_priv *priv = rtllib_priv(dev);
1326
 
        int ret = 0;
1327
 
#ifdef _RTL8192_EXT_PATCH_
1328
 
        ret = rtllib_wx_get_encode_ext(priv->rtllib, info, wrqu, extra,0);
1329
 
#else
1330
 
        ret = rtllib_wx_get_encode_ext(priv->rtllib, info, wrqu, extra);
1331
 
#endif
1332
 
        return ret;
1333
 
}
1334
 
#endif
1335
 
 
1336
 
#ifdef _RTL8192_EXT_PATCH_      
1337
 
static int meshdev_set_key_for_linked_peers(struct net_device *dev, u8 KeyIndex,u16 KeyType, u32 *KeyContent );
1338
 
static int r8192_set_hw_enc(struct net_device *dev,
1339
 
                                        struct iw_request_info *info,
1340
 
                                        union iwreq_data *wrqu, char *extra, u8 is_mesh)
1341
 
{
1342
 
        int ret=0;
1343
 
        struct r8192_priv *priv = rtllib_priv(dev);
1344
 
        struct rtllib_device* ieee = priv->rtllib;
1345
 
        u32 key[4] = {0};
1346
 
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1347
 
        struct iw_point *encoding = &wrqu->encoding;
1348
 
        u8 idx = 0, alg = 0, group = 0;
1349
 
        u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
1350
 
        u8 zero[6] = {0};
1351
 
        priv->rtllib->wx_set_enc = 1;
1352
 
#ifdef ENABLE_IPS
1353
 
        down(&priv->rtllib->ips_sem);
1354
 
        IPSLeave(dev);
1355
 
        up(&priv->rtllib->ips_sem);                     
1356
 
#endif
1357
 
#if 0
1358
 
        static u8 CAM_CONST_ADDR[4][6] = {
1359
 
                {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
1360
 
                {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
1361
 
                {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
1362
 
                {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
1363
 
#endif
1364
 
        if ((encoding->flags & IW_ENCODE_DISABLED) ||
1365
 
                ext->alg == IW_ENCODE_ALG_NONE) 
1366
 
        {
1367
 
                if(is_mesh)
1368
 
                        ieee->mesh_pairwise_key_type = ieee->mesh_pairwise_key_type = KEY_TYPE_NA;
1369
 
                else
1370
 
                        ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA;
1371
 
                CamResetAllEntry(dev);
1372
 
                if(is_mesh)
1373
 
                        CamRestoreEachIFEntry(dev,0);
1374
 
                else
1375
 
                        CamRestoreEachIFEntry(dev,1);
1376
 
                reset_IFswcam(dev,is_mesh);
1377
 
                goto end_hw_sec;
1378
 
        }
1379
 
        alg =  (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; 
1380
 
        idx = encoding->flags & IW_ENCODE_INDEX;
1381
 
        if (idx)
1382
 
                idx --;
1383
 
        group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
1384
 
        printk("====>group is %x\n",group);
1385
 
        if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg ==  KEY_TYPE_WEP40) || (IW_MODE_MESH == ieee->iw_mode))
1386
 
        {
1387
 
                if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40) )
1388
 
                        alg = KEY_TYPE_WEP104;
1389
 
                if(is_mesh)
1390
 
                        ieee->mesh_pairwise_key_type = alg;
1391
 
                else
1392
 
                        ieee->pairwise_key_type = alg;
1393
 
                EnableHWSecurityConfig8192(dev);
1394
 
        }
1395
 
        memcpy((u8*)key, ext->key, 16); 
1396
 
        if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) )
1397
 
        {
1398
 
                printk("=====>set WEP key\n");
1399
 
                if (ext->key_len == 13){
1400
 
                        if(is_mesh)
1401
 
                                ieee->mesh_pairwise_key_type = alg = KEY_TYPE_WEP104;
1402
 
                        else
1403
 
                                ieee->pairwise_key_type = alg = KEY_TYPE_WEP104;
1404
 
                }
1405
 
                if(ieee->iw_mode == IW_MODE_ADHOC){
1406
 
                        set_swcam( dev,
1407
 
                                        idx,
1408
 
                                        idx, 
1409
 
                                        alg,  
1410
 
                                        zero, 
1411
 
                                        0,              
1412
 
                                        key,               
1413
 
                                        is_mesh);
1414
 
                        setKey( dev,
1415
 
                                        idx,
1416
 
                                        idx, 
1417
 
                                        alg,  
1418
 
                                        zero, 
1419
 
                                        0,              
1420
 
                                        key);           
1421
 
                }
1422
 
                        
1423
 
                if(!is_mesh){ 
1424
 
                        if(ieee->state == RTLLIB_LINKED){
1425
 
                                setKey( dev,
1426
 
                                                31,                      
1427
 
                                                idx,                      
1428
 
                                                ieee->pairwise_key_type,        
1429
 
                                                ieee->ap_mac_addr,         
1430
 
                                                0,                      
1431
 
                                                key);                 
1432
 
                                set_swcam( dev,
1433
 
                                                31,                      
1434
 
                                                idx,                      
1435
 
                                                ieee->pairwise_key_type,        
1436
 
                                                ieee->ap_mac_addr,         
1437
 
                                                0,                      
1438
 
                                                key,               
1439
 
                                                0);
1440
 
                        }
1441
 
                }
1442
 
        }
1443
 
        else if (group)
1444
 
        {
1445
 
                printk("set group key\n");
1446
 
                if(is_mesh)
1447
 
                        ieee->mesh_group_key_type = alg;
1448
 
                else
1449
 
                        ieee->group_key_type = alg;
1450
 
                if(ieee->iw_mode == IW_MODE_ADHOC){
1451
 
                        set_swcam(  dev,
1452
 
                                        idx,
1453
 
                                        idx, 
1454
 
                                        alg,  
1455
 
                                        broadcast_addr, 
1456
 
                                        0,              
1457
 
                                        key,           
1458
 
                                        is_mesh);
1459
 
                        setKey(  dev,
1460
 
                                        idx,
1461
 
                                        idx, 
1462
 
                                        alg,  
1463
 
                                        broadcast_addr, 
1464
 
                                        0,              
1465
 
                                        key);           
1466
 
                }
1467
 
                        
1468
 
                if(is_mesh)
1469
 
                        meshdev_set_key_for_linked_peers(dev,
1470
 
                                idx, 
1471
 
                                alg,  
1472
 
                                key); 
1473
 
        }
1474
 
        else 
1475
 
        {
1476
 
                printk("=============>set pairwise key\n");
1477
 
#ifdef RTL8192E
1478
 
                if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){
1479
 
                        write_nic_byte(dev, 0x173, 1); 
1480
 
                }
1481
 
#endif
1482
 
                set_swcam( dev,
1483
 
                                31, 
1484
 
                                idx, 
1485
 
                                alg,  
1486
 
                                (u8*)ieee->ap_mac_addr, 
1487
 
                                0,              
1488
 
                                key,           
1489
 
                                is_mesh);
1490
 
                setKey( dev,
1491
 
                                31, 
1492
 
                                idx, 
1493
 
                                alg,  
1494
 
                                (u8*)ieee->ap_mac_addr, 
1495
 
                                0,              
1496
 
                                key);           
1497
 
        }
1498
 
 
1499
 
end_hw_sec:
1500
 
        priv->rtllib->wx_set_enc = 0;
1501
 
        return ret;     
1502
 
}
1503
 
        
1504
 
int rtl8192_set_key_for_AP(struct rtllib_device *ieee)
1505
 
{
1506
 
        struct rtllib_crypt_data **crypt;
1507
 
        int key_len=0;
1508
 
        char key[32]; 
1509
 
        u16 keytype = IW_ENCODE_ALG_NONE;
1510
 
#ifdef _RTL8192_EXT_PATCH_
1511
 
        crypt = &ieee->sta_crypt[ieee->tx_keyidx];
1512
 
#else
1513
 
        crypt = &ieee->crypt[ieee->tx_keyidx];
1514
 
#endif
1515
 
        if (*crypt == NULL || (*crypt)->ops == NULL)
1516
 
        {
1517
 
                printk("%s():no encrypt now\n",__FUNCTION__);
1518
 
                return 0;
1519
 
        }
1520
 
        if (!((*crypt)->ops->set_key && (*crypt)->ops->get_key)) 
1521
 
                return -1;
1522
 
        
1523
 
        key_len = (*crypt)->ops->get_key(key, 32, NULL, (*crypt)->priv);
1524
 
        if (strcmp((*crypt)->ops->name, "WEP") == 0 )
1525
 
        {
1526
 
                if(key_len == 5)
1527
 
                        keytype = KEY_TYPE_WEP40;
1528
 
                else
1529
 
                        keytype = KEY_TYPE_WEP104;
1530
 
        }
1531
 
        else if (strcmp((*crypt)->ops->name, "TKIP") == 0)
1532
 
                return 0;
1533
 
        else if (strcmp((*crypt)->ops->name, "CCMP") == 0)
1534
 
                return 0;
1535
 
 
1536
 
        set_swcam( ieee->dev,
1537
 
                                31,
1538
 
                                ieee->tx_keyidx, 
1539
 
                                keytype,  
1540
 
                                ieee->ap_mac_addr, 
1541
 
                                0,              
1542
 
                                (u32 *)key ,          
1543
 
                                0);
1544
 
        setKey( ieee->dev,
1545
 
                        31,
1546
 
                        ieee->tx_keyidx, 
1547
 
                        keytype,  
1548
 
                        ieee->ap_mac_addr, 
1549
 
                        0,              
1550
 
                        (u32 *)key);           
1551
 
        
1552
 
        
1553
 
        return 0;
1554
 
}
1555
 
 
1556
 
static int r8192_wx_set_enc_ext(struct net_device *dev,
1557
 
                                        struct iw_request_info *info,
1558
 
                                        union iwreq_data *wrqu, char *extra)
1559
 
{
1560
 
        int ret=0;
1561
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1562
 
        struct r8192_priv *priv = rtllib_priv(dev);
1563
 
        struct rtllib_device* ieee = priv->rtllib;
1564
 
 
1565
 
        if(priv->bHwRadioOff == true)
1566
 
                return 0;
1567
 
 
1568
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
1569
 
        ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra, 0);
1570
 
 
1571
 
        ret |= r8192_set_hw_enc(dev,info,wrqu,extra, 0);
1572
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
1573
 
#endif
1574
 
 
1575
 
        return ret;     
1576
 
}
1577
 
/*
1578
 
 * set key for mesh, not a wireless extension handler. 
1579
 
 * place it here because of porting from r8192_wx_set_enc_ext().  
1580
 
 */ 
1581
 
int r8192_mesh_set_enc_ext(struct net_device *dev,
1582
 
                        struct iw_point *encoding, struct iw_encode_ext *ext, u8 *addr)
1583
 
{
1584
 
        int ret=0;
1585
 
        int i=0;
1586
 
        u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
1587
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1588
 
        struct r8192_priv *priv = rtllib_priv(dev);
1589
 
        struct rtllib_device* ieee = priv->rtllib;
1590
 
        u8 entry_idx = 0;
1591
 
        down(&priv->wx_sem);
1592
 
        if(memcmp(addr,broadcast_addr,6))
1593
 
        {
1594
 
                if ((i=rtllib_find_MP(ieee, addr, 0)) < 0) 
1595
 
                {
1596
 
                        i = rtllib_find_MP(ieee, addr, 1); 
1597
 
                        if (i<0) 
1598
 
                                return -1;
1599
 
                }
1600
 
        }
1601
 
        ret = rtllib_mesh_set_encode_ext(ieee, encoding, ext, i);
1602
 
        if ((-EINVAL == ret) || (-ENOMEM == ret)) {
1603
 
                goto end_hw_sec;
1604
 
        }
1605
 
        {
1606
 
#if 0           
1607
 
                u8 zero[6] = {0};
1608
 
#endif
1609
 
                u32 key[4] = {0};
1610
 
                u8 idx = 0, alg = 0, group = 0;
1611
 
                if ((encoding->flags & IW_ENCODE_DISABLED) ||
1612
 
                        ext->alg == IW_ENCODE_ALG_NONE) 
1613
 
                {
1614
 
                        CamResetAllEntry(dev);
1615
 
                        CamRestoreEachIFEntry(dev,0);
1616
 
                        reset_IFswcam(dev,1);
1617
 
                        goto end_hw_sec;
1618
 
                }
1619
 
                alg =  (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; 
1620
 
                idx = encoding->flags & IW_ENCODE_INDEX;
1621
 
                if (idx)
1622
 
                        idx --;
1623
 
                group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
1624
 
 
1625
 
                if (!group)
1626
 
                {
1627
 
                        ieee->mesh_pairwise_key_type = alg;
1628
 
                        EnableHWSecurityConfig8192(dev);        
1629
 
                }
1630
 
                
1631
 
                memcpy((u8*)key, ext->key, 16); 
1632
 
 
1633
 
                if(group)
1634
 
                {
1635
 
                        ieee->mesh_group_key_type = alg;
1636
 
#if 0
1637
 
                        setKey( dev,
1638
 
                                        idx,
1639
 
                                        idx, 
1640
 
                                        alg,  
1641
 
                                        broadcast_addr, 
1642
 
                                        0,              
1643
 
                                        key);           
1644
 
#endif
1645
 
                }
1646
 
                else 
1647
 
                {
1648
 
#if 0   
1649
 
                        if ((ieee->mesh_pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){
1650
 
                                write_nic_byte(dev, 0x173, 1); 
1651
 
                        }
1652
 
#endif                  
1653
 
                        entry_idx = rtl8192_get_free_hwsec_cam_entry(ieee,addr);
1654
 
#if 0 
1655
 
                        printk("%s(): Can't find  free hw security cam entry\n",__FUNCTION__);
1656
 
                        ret = -1;
1657
 
#else
1658
 
                        if (entry_idx >= TOTAL_CAM_ENTRY-1) {
1659
 
                                printk("%s(): Can't find  free hw security cam entry\n",__FUNCTION__);
1660
 
                                ret = -1;
1661
 
                        } else {
1662
 
                                set_swcam( dev,
1663
 
                                        entry_idx,              
1664
 
                                        idx,            
1665
 
                                        alg,            
1666
 
                                        (u8*)addr,      
1667
 
                                        0,              
1668
 
                                        key,            
1669
 
                                        1);             
1670
 
                                setKey( dev,
1671
 
                                        entry_idx,              
1672
 
                                        idx,            
1673
 
                                        alg,            
1674
 
                                        (u8*)addr,      
1675
 
                                        0,              
1676
 
                                        key);           
1677
 
                                ret = 0;
1678
 
                        }
1679
 
#endif
1680
 
                }
1681
 
 
1682
 
 
1683
 
        }
1684
 
 
1685
 
end_hw_sec:
1686
 
        up(&priv->wx_sem);
1687
 
#endif
1688
 
        return ret;     
1689
 
 
1690
 
}
1691
 
#else
1692
 
static int r8192_wx_set_enc_ext(struct net_device *dev,
1693
 
                                        struct iw_request_info *info,
1694
 
                                        union iwreq_data *wrqu, char *extra)
1695
 
{
1696
 
        int ret=0;
1697
 
        
1698
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1699
 
        struct r8192_priv *priv = rtllib_priv(dev);
1700
 
        struct rtllib_device* ieee = priv->rtllib;
1701
 
 
1702
 
        if(priv->bHwRadioOff == true)
1703
 
                return 0;
1704
 
 
1705
 
        down(&priv->wx_sem);
1706
 
 
1707
 
        priv->rtllib->wx_set_enc = 1;
1708
 
#ifdef ENABLE_IPS
1709
 
        down(&priv->rtllib->ips_sem);
1710
 
        IPSLeave(dev);
1711
 
        up(&priv->rtllib->ips_sem);                     
1712
 
#endif
1713
 
 
1714
 
        ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra);
1715
 
 
1716
 
        {
1717
 
                u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff};
1718
 
                u8 zero[6] = {0};
1719
 
                u32 key[4] = {0};
1720
 
                struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1721
 
                struct iw_point *encoding = &wrqu->encoding;
1722
 
#if 0
1723
 
                static u8 CAM_CONST_ADDR[4][6] = {
1724
 
                        {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
1725
 
                        {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
1726
 
                        {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
1727
 
                        {0x00, 0x00, 0x00, 0x00, 0x00, 0x03}};
1728
 
#endif
1729
 
                u8 idx = 0, alg = 0, group = 0;
1730
 
                if ((encoding->flags & IW_ENCODE_DISABLED) ||
1731
 
                ext->alg == IW_ENCODE_ALG_NONE) 
1732
 
                {
1733
 
                        ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA;
1734
 
                        CamResetAllEntry(dev);
1735
 
                        memset(priv->rtllib->swcamtable,0,sizeof(SW_CAM_TABLE)*32);
1736
 
                        goto end_hw_sec;
1737
 
                }
1738
 
                alg =  (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; 
1739
 
                idx = encoding->flags & IW_ENCODE_INDEX;
1740
 
                if (idx)
1741
 
                        idx --;
1742
 
                group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
1743
 
 
1744
 
                if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg ==  KEY_TYPE_WEP40))
1745
 
                {
1746
 
                        if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40) )
1747
 
                                alg = KEY_TYPE_WEP104;
1748
 
                        ieee->pairwise_key_type = alg;
1749
 
                        EnableHWSecurityConfig8192(dev);
1750
 
                }
1751
 
                memcpy((u8*)key, ext->key, 16); 
1752
 
                
1753
 
                if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) )
1754
 
                {
1755
 
                        if (ext->key_len == 13)
1756
 
                                ieee->pairwise_key_type = alg = KEY_TYPE_WEP104;
1757
 
                        setKey( dev,
1758
 
                                        idx,
1759
 
                                        idx, 
1760
 
                                        alg,  
1761
 
                                        zero, 
1762
 
                                        0,              
1763
 
                                        key);           
1764
 
                        set_swcam( dev,
1765
 
                                        idx,
1766
 
                                        idx, 
1767
 
                                        alg,  
1768
 
                                        zero, 
1769
 
                                        0,              
1770
 
                                        key,          
1771
 
                                        0);
1772
 
                }
1773
 
                else if (group)
1774
 
                {
1775
 
                        ieee->group_key_type = alg;
1776
 
                        setKey( dev,
1777
 
                                        idx,
1778
 
                                        idx, 
1779
 
                                        alg,  
1780
 
                                        broadcast_addr, 
1781
 
                                        0,              
1782
 
                                        key);           
1783
 
                        set_swcam( dev,
1784
 
                                        idx,
1785
 
                                        idx, 
1786
 
                                        alg,  
1787
 
                                        broadcast_addr, 
1788
 
                                        0,              
1789
 
                                        key,                 
1790
 
                                        0);
1791
 
                }
1792
 
                else 
1793
 
                {
1794
 
                        #ifdef RTL8192E
1795
 
                        if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){
1796
 
                                                        write_nic_byte(dev, 0x173, 1); 
1797
 
                        }
1798
 
                        #endif
1799
 
                        setKey( dev,
1800
 
                                        4,
1801
 
                                        idx, 
1802
 
                                        alg,  
1803
 
                                        (u8*)ieee->ap_mac_addr, 
1804
 
                                        0,              
1805
 
                                        key);           
1806
 
                        set_swcam( dev,
1807
 
                                        4,
1808
 
                                        idx, 
1809
 
                                        alg,  
1810
 
                                        (u8*)ieee->ap_mac_addr, 
1811
 
                                        0,              
1812
 
                                        key,                 
1813
 
                                        0);
1814
 
                }
1815
 
 
1816
 
 
1817
 
        }
1818
 
 
1819
 
end_hw_sec:
1820
 
        priv->rtllib->wx_set_enc = 0;
1821
 
        up(&priv->wx_sem);
1822
 
#endif
1823
 
        return ret;     
1824
 
 
1825
 
}
1826
 
#endif
1827
 
static int r8192_wx_set_auth(struct net_device *dev,
1828
 
                                        struct iw_request_info *info,
1829
 
                                        union iwreq_data *data, char *extra)
1830
 
{
1831
 
        int ret=0;
1832
 
        
1833
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1834
 
        struct r8192_priv *priv = rtllib_priv(dev);
1835
 
 
1836
 
        if(priv->bHwRadioOff == true)
1837
 
                return 0;
1838
 
 
1839
 
        down(&priv->wx_sem);
1840
 
        ret = rtllib_wx_set_auth(priv->rtllib, info, &(data->param), extra);
1841
 
        up(&priv->wx_sem);
1842
 
#endif
1843
 
        return ret;
1844
 
}
1845
 
 
1846
 
static int r8192_wx_set_mlme(struct net_device *dev,
1847
 
                                        struct iw_request_info *info,
1848
 
                                        union iwreq_data *wrqu, char *extra)
1849
 
{
1850
 
 
1851
 
        int ret=0;
1852
 
        
1853
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1854
 
        struct r8192_priv *priv = rtllib_priv(dev);
1855
 
 
1856
 
        if(priv->bHwRadioOff == true)
1857
 
                return 0;
1858
 
 
1859
 
        down(&priv->wx_sem);
1860
 
        ret = rtllib_wx_set_mlme(priv->rtllib, info, wrqu, extra);
1861
 
        up(&priv->wx_sem);
1862
 
#endif
1863
 
        return ret;
1864
 
}
1865
 
#endif
1866
 
 
1867
 
static int r8192_wx_set_gen_ie(struct net_device *dev,
1868
 
                                        struct iw_request_info *info,
1869
 
                                        union iwreq_data *data, char *extra)
1870
 
{
1871
 
        int ret = 0;
1872
 
        
1873
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1874
 
        struct r8192_priv *priv = rtllib_priv(dev);
1875
 
 
1876
 
        if(priv->bHwRadioOff == true)
1877
 
                return 0;
1878
 
 
1879
 
        down(&priv->wx_sem);
1880
 
        ret = rtllib_wx_set_gen_ie(priv->rtllib, extra, data->data.length);
1881
 
        up(&priv->wx_sem);
1882
 
#endif
1883
 
        return ret;
1884
 
}
1885
 
 
1886
 
static int r8192_wx_get_gen_ie(struct net_device *dev,
1887
 
                               struct iw_request_info *info, 
1888
 
                               union iwreq_data *data, char *extra)
1889
 
{
1890
 
        int ret = 0;
1891
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
1892
 
        struct r8192_priv *priv = rtllib_priv(dev);
1893
 
        struct rtllib_device* ieee = priv->rtllib;
1894
 
 
1895
 
        if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) {
1896
 
                data->data.length = 0;
1897
 
                return 0;
1898
 
        }
1899
 
 
1900
 
        if (data->data.length < ieee->wpa_ie_len) {
1901
 
                return -E2BIG;
1902
 
        }
1903
 
 
1904
 
        data->data.length = ieee->wpa_ie_len;
1905
 
        memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len);
1906
 
#endif
1907
 
        return ret;
1908
 
}
1909
 
 
1910
 
#ifdef _RTL8192_EXT_PATCH_
1911
 
/*
1912
 
   Output:
1913
 
     (case 1) Mesh: Enable. MESHID=[%s] (max length of %s is 32 bytes). 
1914
 
     (case 2) Mesh: Disable.
1915
 
*/
1916
 
static int r8192_wx_get_meshinfo(struct net_device *dev, 
1917
 
                               struct iw_request_info *info, 
1918
 
                               union iwreq_data *wrqu, char *extra)
1919
 
{
1920
 
        struct r8192_priv *priv = rtllib_priv(dev);
1921
 
        
1922
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_get_meshinfo )
1923
 
                return 0;
1924
 
        return priv->mshobj->ext_patch_r819x_wx_get_meshinfo(dev, info, wrqu, extra);
1925
 
}
1926
 
 
1927
 
 
1928
 
static int r8192_wx_enable_mesh(struct net_device *dev, 
1929
 
                               struct iw_request_info *info, 
1930
 
                               union iwreq_data *wrqu, char *extra)
1931
 
{
1932
 
        struct r8192_priv *priv = rtllib_priv(dev);
1933
 
        struct rtllib_device *ieee = priv->rtllib;
1934
 
        RT_RF_POWER_STATE       rtState;
1935
 
        int ret = 0;
1936
 
        rtState = priv->rtllib->eRFPowerState;
1937
 
        
1938
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_enable_mesh )
1939
 
                return 0;
1940
 
 
1941
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
1942
 
        if(priv->mshobj->ext_patch_r819x_wx_enable_mesh(dev))
1943
 
        {
1944
 
                union iwreq_data tmprqu;
1945
 
#ifdef ENABLE_IPS
1946
 
                if(priv->rtllib->PowerSaveControl.bInactivePs){
1947
 
                        if(rtState == eRfOff){
1948
 
                                if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
1949
 
                                {
1950
 
                                        RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
1951
 
                                        SEM_UP_PRIV_WX(&priv->wx_sem);  
1952
 
                                        return -1;
1953
 
                                }
1954
 
                                else{
1955
 
                                        printk("=========>%s(): IPSLeave\n",__FUNCTION__);
1956
 
                                        IPSLeave(dev);
1957
 
                                }
1958
 
                        }
1959
 
                }
1960
 
#endif
1961
 
                if(ieee->only_mesh == 0) 
1962
 
                {
1963
 
                        tmprqu.mode = ieee->iw_mode;
1964
 
                        ieee->iw_mode = 0; 
1965
 
                        ret = rtllib_wx_set_mode(ieee, info, &tmprqu, extra);
1966
 
                }
1967
 
        }
1968
 
 
1969
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
1970
 
        
1971
 
        return ret;
1972
 
        
1973
 
}
1974
 
 
1975
 
static int r8192_wx_disable_mesh(struct net_device *dev, 
1976
 
                               struct iw_request_info *info, 
1977
 
                               union iwreq_data *wrqu, char *extra)
1978
 
{
1979
 
        struct r8192_priv *priv = rtllib_priv(dev);
1980
 
        struct rtllib_device *ieee = priv->rtllib;
1981
 
 
1982
 
        int ret = 0;
1983
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_disable_mesh )
1984
 
                return 0;
1985
 
 
1986
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
1987
 
        if(priv->mshobj->ext_patch_r819x_wx_disable_mesh(dev))
1988
 
        {
1989
 
                union iwreq_data tmprqu;
1990
 
                tmprqu.mode = ieee->iw_mode;
1991
 
                ieee->iw_mode = 999;
1992
 
                ret = rtllib_wx_set_mode(ieee, info, &tmprqu, extra);
1993
 
        }
1994
 
 
1995
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
1996
 
        
1997
 
        return ret;
1998
 
}
1999
 
 
2000
 
 
2001
 
int r8192_wx_set_channel(struct net_device *dev, 
2002
 
                               struct iw_request_info *info, 
2003
 
                               union iwreq_data *wrqu, char *extra)
2004
 
{
2005
 
        int ch = *extra;
2006
 
        struct r8192_priv *priv = rtllib_priv(dev);
2007
 
        struct rtllib_device *ieee = priv->rtllib;
2008
 
        
2009
 
        if (!priv->mshobj || (ieee->iw_mode != IW_MODE_MESH) || !priv->mshobj->ext_patch_r819x_wx_set_channel || !ieee->only_mesh)
2010
 
                return 0;       
2011
 
                        
2012
 
        if ( ch < 0 )   
2013
 
        {
2014
 
                rtllib_start_scan(ieee);                        
2015
 
                ieee->meshScanMode =2;
2016
 
        }
2017
 
        else    
2018
 
        {       
2019
 
                ieee->meshScanMode =0;          
2020
 
                if(priv->mshobj->ext_patch_r819x_wx_set_channel)
2021
 
                {
2022
 
                        priv->mshobj->ext_patch_r819x_wx_set_channel(ieee, ch);
2023
 
                        priv->mshobj->ext_patch_r819x_wx_set_mesh_chan(dev,ch);
2024
 
                }
2025
 
                queue_work_rsl(ieee->wq, &ieee->ext_stop_scan_wq);
2026
 
                ieee->set_chan(ieee->dev, ch);
2027
 
printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!set current mesh network channel %d\n", ch);
2028
 
                ieee->current_mesh_network.channel = ch;
2029
 
                if(ieee->only_mesh)
2030
 
                        ieee->current_network.channel = ch;
2031
 
                
2032
 
                ieee->current_network.channel = ieee->current_mesh_network.channel; 
2033
 
                if(ieee->pHTInfo->bCurBW40MHz)
2034
 
                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20_40, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
2035
 
                else
2036
 
                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
2037
 
                if(rtllib_act_scanning(ieee,true) == true)
2038
 
                        rtllib_stop_scan_syncro(ieee);
2039
 
        }
2040
 
                
2041
 
        return 0;
2042
 
}
2043
 
 
2044
 
static int r8192_wx_set_meshID(struct net_device *dev, 
2045
 
                               struct iw_request_info *info, 
2046
 
                               union iwreq_data *wrqu, char *extra)
2047
 
{       
2048
 
        struct r8192_priv *priv = rtllib_priv(dev);     
2049
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_meshID )
2050
 
                return 0;
2051
 
 
2052
 
        return priv->mshobj->ext_patch_r819x_wx_set_meshID(dev, wrqu->data.pointer);    
2053
 
}
2054
 
 
2055
 
 
2056
 
/* reserved for future
2057
 
static int r8192_wx_add_mac_deny(struct net_device *dev, 
2058
 
                               struct iw_request_info *info, 
2059
 
                               union iwreq_data *wrqu, char *extra)
2060
 
{
2061
 
        struct r8192_priv *priv = rtllib_priv(dev);
2062
 
        
2063
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_add_mac_deny )
2064
 
                return 0;
2065
 
 
2066
 
        return priv->mshobj->ext_patch_r819x_wx_set_add_mac_deny(dev, info, wrqu, extra);
2067
 
}
2068
 
 
2069
 
static int r8192_wx_del_mac_deny(struct net_device *dev, 
2070
 
                               struct iw_request_info *info, 
2071
 
                               union iwreq_data *wrqu, char *extra)
2072
 
{
2073
 
        struct r8192_priv *priv = rtllib_priv(dev);
2074
 
        
2075
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_del_mac_deny )
2076
 
                return 0;
2077
 
 
2078
 
        return priv->mshobj->ext_patch_r819x_wx_set_del_mac_deny(dev, info, wrqu, extra);
2079
 
}
2080
 
*/
2081
 
/* reserved for future
2082
 
static int r8192_wx_get_mac_deny(struct net_device *dev, 
2083
 
                               struct iw_request_info *info, 
2084
 
                               union iwreq_data *wrqu, char *extra)
2085
 
{
2086
 
        struct r8192_priv *priv = rtllib_priv(dev);
2087
 
        
2088
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_get_mac_deny )
2089
 
                return 0;
2090
 
 
2091
 
        return priv->mshobj->ext_patch_r819x_wx_get_mac_deny(dev, info, wrqu, extra);
2092
 
}
2093
 
static int r8192_wx_join_mesh(struct net_device *dev, 
2094
 
                               struct iw_request_info *info, 
2095
 
                               union iwreq_data *wrqu, char *extra)
2096
 
{       
2097
 
        struct r8192_priv *priv = rtllib_priv(dev);     
2098
 
        int ret=0;
2099
 
        char ch;
2100
 
        if(priv->rtllib->iw_mode == IW_MODE_MESH) {
2101
 
                printk("join mesh %s\n",extra);
2102
 
                if (wrqu->essid.length > IW_ESSID_MAX_SIZE){
2103
 
                        ret= -E2BIG;
2104
 
                        goto out;
2105
 
                }
2106
 
                if((wrqu->essid.length == 1) && (wrqu->essid.flags == 1)){
2107
 
                        ret = 0;
2108
 
                        goto out;
2109
 
                }
2110
 
                if (wrqu->essid.flags && wrqu->essid.length) {
2111
 
                        if(priv->mshobj->ext_patch_r819x_wx_get_selected_mesh_channel(dev, extra, &ch))
2112
 
                        {
2113
 
                                priv->mshobj->ext_patch_r819x_wx_set_meshID(dev, extra); 
2114
 
                                priv->mshobj->ext_patch_r819x_wx_set_mesh_chan(dev,ch); 
2115
 
                                r8192_wx_set_channel(dev, NULL, NULL, &ch);
2116
 
                        }
2117
 
                        else
2118
 
                                printk("invalid mesh #\n");
2119
 
                }
2120
 
        }
2121
 
out:
2122
 
        return ret;
2123
 
}
2124
 
*/
2125
 
 
2126
 
static int r8192_wx_get_mesh_list(struct net_device *dev, 
2127
 
                               struct iw_request_info *info, 
2128
 
                               union iwreq_data *wrqu, char *extra)
2129
 
{
2130
 
        struct r8192_priv *priv = rtllib_priv(dev);
2131
 
        
2132
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_get_mesh_list )
2133
 
                return 0;
2134
 
        return priv->mshobj->ext_patch_r819x_wx_get_mesh_list(dev, info, wrqu, extra);
2135
 
}
2136
 
 
2137
 
static int r8192_wx_mesh_scan(struct net_device *dev, 
2138
 
                               struct iw_request_info *info, 
2139
 
                               union iwreq_data *wrqu, char *extra)
2140
 
{
2141
 
        struct r8192_priv *priv = rtllib_priv(dev);
2142
 
        
2143
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_mesh_scan )
2144
 
                return 0;
2145
 
        return priv->mshobj->ext_patch_r819x_wx_mesh_scan(dev, info, wrqu, extra);
2146
 
}
2147
 
 
2148
 
static int r8192_wx_set_meshmode(struct net_device *dev,
2149
 
                struct iw_request_info *info,
2150
 
                union iwreq_data *wrqu, char *extra)
2151
 
{
2152
 
        struct r8192_priv *priv = rtllib_priv(dev);
2153
 
        
2154
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
2155
 
 
2156
 
        printk("%s(): set mesh mode ! extra is %d\n",__FUNCTION__, *extra);
2157
 
        if((*extra != WIRELESS_MODE_A) && (*extra != WIRELESS_MODE_B) && 
2158
 
                (*extra != WIRELESS_MODE_G) && (*extra != WIRELESS_MODE_AUTO) &&
2159
 
                (*extra != WIRELESS_MODE_N_24G) && (*extra != WIRELESS_MODE_N_5G))
2160
 
        {
2161
 
                printk("ERR!! you should input 1 | 2 | 4 | 8 | 16 | 32\n");
2162
 
                SEM_UP_PRIV_WX(&priv->wx_sem);  
2163
 
                return -1;
2164
 
        }
2165
 
        if(priv->rtllib->state == RTLLIB_LINKED)
2166
 
        {
2167
 
                if((priv->rtllib->mode != WIRELESS_MODE_N_5G) && (priv->rtllib->mode != WIRELESS_MODE_N_24G)){
2168
 
                        printk("===>wlan0 is linked,and ieee->mode is not N mode ,do not need to set mode,return\n");
2169
 
                        SEM_UP_PRIV_WX(&priv->wx_sem);  
2170
 
                        return 0;
2171
 
                }
2172
 
        }
2173
 
        priv->rtllib->mode = *extra;
2174
 
        if(priv->ResetProgress == RESET_TYPE_NORESET)
2175
 
                rtl8192_SetWirelessMode(dev, priv->rtllib->mode);
2176
 
         HTUseDefaultSetting(priv->rtllib);
2177
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
2178
 
        return 0;
2179
 
 
2180
 
}
2181
 
 
2182
 
static int r8192_wx_set_meshBW(struct net_device *dev,
2183
 
                struct iw_request_info *info,
2184
 
                union iwreq_data *wrqu, char *extra)
2185
 
{
2186
 
        struct r8192_priv *priv = rtllib_priv(dev);
2187
 
 
2188
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
2189
 
 
2190
 
        printk("%s(): set mesh BW ! extra is %d\n",__FUNCTION__, *extra);
2191
 
        priv->rtllib->pHTInfo->bRegBW40MHz = *extra;
2192
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
2193
 
        return 0;
2194
 
}
2195
 
static int r8192_wx_set_mesh_security(struct net_device *dev,
2196
 
                struct iw_request_info *info,
2197
 
                union iwreq_data *wrqu, char *extra)
2198
 
{
2199
 
        struct r8192_priv *priv = rtllib_priv(dev);
2200
 
        struct rtllib_device* ieee = priv->rtllib;
2201
 
 
2202
 
        down(&priv->wx_sem);
2203
 
 
2204
 
        printk("%s(): set mesh security! extra is %d\n",__FUNCTION__, *extra);
2205
 
        ieee->mesh_security_setting = *extra;
2206
 
 
2207
 
        if (0 == ieee->mesh_security_setting)
2208
 
        {
2209
 
                ieee->mesh_pairwise_key_type = ieee->mesh_group_key_type = KEY_TYPE_NA;
2210
 
                CamResetAllEntry(dev);
2211
 
                CamRestoreEachIFEntry(dev,0);
2212
 
                reset_IFswcam(dev,1);
2213
 
        }
2214
 
        else
2215
 
        {
2216
 
                ieee->mesh_pairwise_key_type = KEY_TYPE_CCMP;
2217
 
                ieee->mesh_group_key_type = KEY_TYPE_CCMP;
2218
 
        }
2219
 
        up(&priv->wx_sem);
2220
 
        return 0;
2221
 
 
2222
 
}
2223
 
 
2224
 
static int r8192_wx_set_mkdd_id(struct net_device *dev, 
2225
 
                               struct iw_request_info *info, 
2226
 
                               union iwreq_data *wrqu, char *extra)
2227
 
{       
2228
 
        struct r8192_priv *priv = rtllib_priv(dev);     
2229
 
        printk("===>%s()\n",__FUNCTION__);      
2230
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_mkdd_id)
2231
 
                return 0;
2232
 
 
2233
 
        return priv->mshobj->ext_patch_r819x_wx_set_mkdd_id(dev, wrqu->data.pointer);   
2234
 
}
2235
 
 
2236
 
static int r8192_wx_set_mesh_key(struct net_device *dev, 
2237
 
                               struct iw_request_info *info, 
2238
 
                               union iwreq_data *wrqu, char *extra)
2239
 
{       
2240
 
        struct r8192_priv *priv = rtllib_priv(dev);     
2241
 
        printk("===>%s()\n",__FUNCTION__);      
2242
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_mesh_key)
2243
 
                return 0;
2244
 
        return priv->mshobj->ext_patch_r819x_wx_set_mesh_key(dev, wrqu->data.pointer);  
2245
 
}
2246
 
 
2247
 
static int r8192_wx_set_mesh_sec_type(struct net_device *dev,
2248
 
                struct iw_request_info *info,
2249
 
                union iwreq_data *wrqu, char *extra)
2250
 
{
2251
 
        struct r8192_priv *priv = rtllib_priv(dev);
2252
 
        struct rtllib_device* ieee = priv->rtllib;
2253
 
 
2254
 
        printk("%s(): set mesh security type! extra is %d\n",__FUNCTION__, *extra);
2255
 
        if (ieee->mesh_sec_type == 1 && *extra != 1 && ieee->mesh_security_setting == 3) {
2256
 
                rtl8192_abbr_handshk_disable_key(ieee); 
2257
 
        
2258
 
                if(priv->mshobj->ext_patch_r819x_wx_release_sae_info)
2259
 
                        priv->mshobj->ext_patch_r819x_wx_release_sae_info(ieee);
2260
 
        }
2261
 
        down(&priv->wx_sem);
2262
 
 
2263
 
        ieee->mesh_sec_type = *extra;
2264
 
 
2265
 
        if(ieee->mesh_sec_type == 0)
2266
 
                ieee->mesh_pairwise_key_type = ieee->mesh_group_key_type = KEY_TYPE_NA;
2267
 
 
2268
 
        up(&priv->wx_sem);
2269
 
        return 0;
2270
 
}
2271
 
 
2272
 
#endif 
2273
 
 
2274
 
#define OID_RT_INTEL_PROMISCUOUS_MODE   0xFF0101F6
2275
 
 
2276
 
static int r8192_wx_set_PromiscuousMode(struct net_device *dev,
2277
 
                struct iw_request_info *info,
2278
 
                union iwreq_data *wrqu, char *extra)
2279
 
{
2280
 
        struct r8192_priv *priv = rtllib_priv(dev);
2281
 
        struct rtllib_device* ieee = priv->rtllib;
2282
 
 
2283
 
        u32 *info_buf = (u32*)(wrqu->data.pointer);
2284
 
 
2285
 
        u32 oid = info_buf[0];
2286
 
        u32 bPromiscuousOn = info_buf[1];
2287
 
        u32 bFilterSourceStationFrame = info_buf[2];
2288
 
 
2289
 
        if (OID_RT_INTEL_PROMISCUOUS_MODE == oid)
2290
 
        {
2291
 
                ieee->IntelPromiscuousModeInfo.bPromiscuousOn = 
2292
 
                                        (bPromiscuousOn)? (true) : (false);
2293
 
                ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame = 
2294
 
                                        (bFilterSourceStationFrame)? (true) : (false);
2295
 
 
2296
 
                (bPromiscuousOn) ? (rtllib_EnableIntelPromiscuousMode(dev, false)) : 
2297
 
                                (rtllib_DisableIntelPromiscuousMode(dev, false));       
2298
 
 
2299
 
                printk("=======>%s(), on = %d, filter src sta = %d\n", __FUNCTION__, 
2300
 
                        bPromiscuousOn, bFilterSourceStationFrame);
2301
 
        } else {
2302
 
                return -1;
2303
 
        }
2304
 
        
2305
 
        return 0;
2306
 
}
2307
 
 
2308
 
 
2309
 
static int r8192_wx_get_PromiscuousMode(struct net_device *dev,
2310
 
                               struct iw_request_info *info,
2311
 
                               union iwreq_data *wrqu, char *extra)
2312
 
{
2313
 
        struct r8192_priv *priv = rtllib_priv(dev);
2314
 
        struct rtllib_device* ieee = priv->rtllib;
2315
 
 
2316
 
        down(&priv->wx_sem);
2317
 
 
2318
 
        snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d",\
2319
 
                        ieee->IntelPromiscuousModeInfo.bPromiscuousOn,\
2320
 
                        ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame);
2321
 
        wrqu->data.length = strlen(extra) + 1;
2322
 
 
2323
 
        up(&priv->wx_sem);
2324
 
 
2325
 
        return 0;
2326
 
}
2327
 
 
2328
 
#ifdef CONFIG_BT_30
2329
 
static int r8192_wx_creat_physical_link(
2330
 
                struct net_device       *dev,
2331
 
                struct iw_request_info  *info,
2332
 
                union iwreq_data        *wrqu, 
2333
 
                char                    *extra)
2334
 
{
2335
 
        u32     *info_buf = (u32*)(wrqu->data.pointer);
2336
 
        
2337
 
        struct r8192_priv* priv = rtllib_priv(dev);
2338
 
        PBT30Info       pBTInfo = &priv->BtInfo;
2339
 
        PPACKET_IRP_HCICMD_DATA pHciCmd = NULL;
2340
 
        u8      joinaddr[6] = {0x00, 0xe0, 0x4c, 0x76, 0x00, 0x33};
2341
 
        u8      i = 0;
2342
 
 
2343
 
        for(i=0; i<6; i++)
2344
 
                joinaddr[i] = (u8)(info_buf[i]);
2345
 
 
2346
 
        printk("===++===++===> RemoteJoinerAddr: %02x:%02x:%02x:%02x:%02x:%02x\n", 
2347
 
                joinaddr[0],joinaddr[1],joinaddr[2],joinaddr[3],joinaddr[4],joinaddr[5]);
2348
 
 
2349
 
        pHciCmd = (PPACKET_IRP_HCICMD_DATA)kmalloc(sizeof(PACKET_IRP_HCICMD_DATA)+4, GFP_KERNEL);
2350
 
 
2351
 
        BT_HCI_RESET(dev, false);
2352
 
        BT_HCI_CREATE_PHYSICAL_LINK(dev, pHciCmd);
2353
 
        
2354
 
        memcpy(priv->BtInfo.BtAsocEntry[0].BTRemoteMACAddr, joinaddr, 6);
2355
 
 
2356
 
        bt_wifi_set_enc(dev, type_Pairwise, 0, 1);
2357
 
        BT_HCI_StartBeaconAndConnect(dev, pHciCmd, 0);
2358
 
 
2359
 
        kfree(pHciCmd);
2360
 
 
2361
 
        return 1;
2362
 
}
2363
 
 
2364
 
static int r8192_wx_accept_physical_link(
2365
 
                struct net_device       *dev,
2366
 
                struct iw_request_info  *info,
2367
 
                union iwreq_data        *wrqu, 
2368
 
                char                    *extra)
2369
 
{
2370
 
        struct r8192_priv* priv = rtllib_priv(dev);
2371
 
        PBT30Info       pBTInfo = &priv->BtInfo;
2372
 
        PPACKET_IRP_HCICMD_DATA pHciCmd = NULL;
2373
 
 
2374
 
        u8 amp_ssid[32] = {0};
2375
 
        u8 amp_len = strlen(wrqu->data.pointer);
2376
 
                        
2377
 
        memcpy(amp_ssid, wrqu->data.pointer, amp_len);
2378
 
 
2379
 
        pHciCmd = (PPACKET_IRP_HCICMD_DATA)kmalloc(sizeof(PACKET_IRP_HCICMD_DATA)+4, GFP_KERNEL);
2380
 
 
2381
 
        BT_HCI_RESET(dev, false);
2382
 
        BT_HCI_ACCEPT_PHYSICAL_LINK(dev, pHciCmd);
2383
 
 
2384
 
        snprintf(pBTInfo->BtAsocEntry[0].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", 0x00,0xe0,0x4c,0x78,0x00,0x00);
2385
 
        pBTInfo->BtAsocEntry[0].BTSsid.Octet = pBTInfo->BtAsocEntry[0].BTSsidBuf;
2386
 
        pBTInfo->BtAsocEntry[0].BTSsid.Length = 21;
2387
 
        printk("==++==++==++==>%s() AMP-SSID:%s:%s, len:%d\n", __func__, amp_ssid, pBTInfo->BtAsocEntry[0].BTSsid.Octet, amp_len);
2388
 
 
2389
 
#if 1 
2390
 
        {
2391
 
                unsigned long flags;
2392
 
                struct rtllib_network *target;
2393
 
 
2394
 
                spin_lock_irqsave(&priv->rtllib->lock, flags);
2395
 
                                
2396
 
                list_for_each_entry(target, &priv->rtllib->network_list, list) {
2397
 
 
2398
 
                        if(!CompareSSID(pBTInfo->BtAsocEntry[0].BTSsidBuf, pBTInfo->BtAsocEntry[0].BTSsid.Length, 
2399
 
                                target->ssid,target->ssid_len)){
2400
 
                                continue;
2401
 
                        }
2402
 
 
2403
 
                        printk("===++===++===> CreaterBssid:  %02x:%02x:%02x:%02x:%02x:%02x\n", 
2404
 
                                target->bssid[0],target->bssid[1],target->bssid[2],
2405
 
                                target->bssid[3],target->bssid[4],target->bssid[5]);
2406
 
                        memcpy(pBTInfo->BtAsocEntry[0].BTRemoteMACAddr, target->bssid, 6);
2407
 
                }
2408
 
                
2409
 
                spin_unlock_irqrestore(&priv->rtllib->lock, flags);
2410
 
        }
2411
 
#endif
2412
 
 
2413
 
        BT_HCI_StartBeaconAndConnect(dev, pHciCmd, 0);
2414
 
        
2415
 
 
2416
 
        mdelay(100);
2417
 
 
2418
 
        snprintf(pBTInfo->BtAsocEntry[0].BTSsidBuf, 32, "AMP-%02x-%02x-%02x-%02x-%02x-%02x", 0x00,0xe0,0x4c,0x78,0x00,0x00);
2419
 
        pBTInfo->BtAsocEntry[0].BTSsid.Octet = pBTInfo->BtAsocEntry[0].BTSsidBuf;
2420
 
        pBTInfo->BtAsocEntry[0].BTSsid.Length = 21;
2421
 
 
2422
 
        bt_wifi_set_enc(dev, type_Pairwise, 0, 1);
2423
 
        BT_ConnectProcedure(dev, 0);
2424
 
 
2425
 
        kfree(pHciCmd);
2426
 
 
2427
 
        return 1;
2428
 
}
2429
 
#endif
2430
 
 
2431
 
 
2432
 
#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
2433
 
static iw_handler r8192_wx_handlers[] =
2434
 
{
2435
 
        IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name,        
2436
 
        IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq,        
2437
 
        IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq,        
2438
 
        IW_IOCTL(SIOCSIWMODE) = r8192_wx_set_mode,        
2439
 
        IW_IOCTL(SIOCGIWMODE) = r8192_wx_get_mode,        
2440
 
        IW_IOCTL(SIOCSIWSENS) = r8192_wx_set_sens,        
2441
 
        IW_IOCTL(SIOCGIWSENS) = r8192_wx_get_sens,        
2442
 
        IW_IOCTL(SIOCGIWRANGE) = rtl8192_wx_get_range,    
2443
 
        IW_IOCTL(SIOCSIWAP) = r8192_wx_set_wap,           
2444
 
        IW_IOCTL(SIOCGIWAP) = r8192_wx_get_wap,           
2445
 
        IW_IOCTL(SIOCSIWSCAN) = r8192_wx_set_scan,        
2446
 
        IW_IOCTL(SIOCGIWSCAN) = r8192_wx_get_scan,        
2447
 
        IW_IOCTL(SIOCSIWESSID) = r8192_wx_set_essid,      
2448
 
        IW_IOCTL(SIOCGIWESSID) = r8192_wx_get_essid,      
2449
 
        IW_IOCTL(SIOCSIWNICKN) = r8192_wx_set_nick,
2450
 
                IW_IOCTL(SIOCGIWNICKN) = r8192_wx_get_nick,
2451
 
        IW_IOCTL(SIOCSIWRATE) = r8192_wx_set_rate,        
2452
 
        IW_IOCTL(SIOCGIWRATE) = r8192_wx_get_rate,        
2453
 
        IW_IOCTL(SIOCSIWRTS) = r8192_wx_set_rts,          
2454
 
        IW_IOCTL(SIOCGIWRTS) = r8192_wx_get_rts,          
2455
 
        IW_IOCTL(SIOCSIWFRAG) = r8192_wx_set_frag,        
2456
 
        IW_IOCTL(SIOCGIWFRAG) = r8192_wx_get_frag,        
2457
 
        IW_IOCTL(SIOCSIWRETRY) = r8192_wx_set_retry,      
2458
 
        IW_IOCTL(SIOCGIWRETRY) = r8192_wx_get_retry,      
2459
 
        IW_IOCTL(SIOCSIWENCODE) = r8192_wx_set_enc,       
2460
 
        IW_IOCTL(SIOCGIWENCODE) = r8192_wx_get_enc,       
2461
 
        IW_IOCTL(SIOCSIWPOWER) = r8192_wx_set_power,         
2462
 
        IW_IOCTL(SIOCGIWPOWER) = r8192_wx_get_power,         
2463
 
#if (WIRELESS_EXT >= 18)
2464
 
                IW_IOCTL(SIOCSIWGENIE) = r8192_wx_set_gen_ie,        
2465
 
                IW_IOCTL(SIOCGIWGENIE) = r8192_wx_get_gen_ie,
2466
 
                IW_IOCTL(SIOCSIWMLME) = r8192_wx_set_mlme,        
2467
 
                IW_IOCTL(SIOCSIWAUTH) = r8192_wx_set_auth,          
2468
 
                IW_IOCTL(SIOCSIWENCODEEXT) = r8192_wx_set_enc_ext,  
2469
 
#endif
2470
 
}; 
2471
 
 
2472
 
/* 
2473
 
 * the following rule need to be follwing,
2474
 
 * Odd : get (world access), 
2475
 
 * even : set (root access) 
2476
 
 * */
2477
 
static const struct iw_priv_args r8192_private_args[] = { 
2478
 
        {
2479
 
                SIOCIWFIRSTPRIV + 0x0, 
2480
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_debugflag" 
2481
 
        }, 
2482
 
        {
2483
 
                SIOCIWFIRSTPRIV + 0x1,
2484
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
2485
 
        },
2486
 
        {
2487
 
                SIOCIWFIRSTPRIV + 0x2, 
2488
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" 
2489
 
        }
2490
 
        ,
2491
 
        {
2492
 
                SIOCIWFIRSTPRIV + 0x3,
2493
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset"
2494
 
        }
2495
 
        ,
2496
 
        {
2497
 
                SIOCIWFIRSTPRIV + 0x4,
2498
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "force_mic_error"
2499
 
        }
2500
 
        ,
2501
 
        {
2502
 
                SIOCIWFIRSTPRIV + 0x5,
2503
 
                IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT|IW_PRIV_SIZE_FIXED|1, 
2504
 
                "firm_ver"
2505
 
        }
2506
 
        ,
2507
 
        {
2508
 
                SIOCIWFIRSTPRIV + 0x6,
2509
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, 
2510
 
                "set_power"
2511
 
        }
2512
 
#ifdef _RTL8192_EXT_PATCH_
2513
 
        ,
2514
 
        {
2515
 
                SIOCIWFIRSTPRIV + 0x7,
2516
 
                IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR|512, 
2517
 
                "print_reg"
2518
 
        }
2519
 
        ,
2520
 
        {
2521
 
                SIOCIWFIRSTPRIV + 0x8,
2522
 
                IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR|64, 
2523
 
                "resume_firm"
2524
 
        }
2525
 
#endif
2526
 
        ,
2527
 
        {
2528
 
                SIOCIWFIRSTPRIV + 0x9,
2529
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, 
2530
 
                "radio"
2531
 
        }
2532
 
        ,
2533
 
        {
2534
 
                SIOCIWFIRSTPRIV + 0xa,
2535
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, 
2536
 
                "lps_interv"
2537
 
        }
2538
 
        ,
2539
 
        {
2540
 
                SIOCIWFIRSTPRIV + 0xb,
2541
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, 
2542
 
                "lps_force"
2543
 
        }
2544
 
        ,
2545
 
        {
2546
 
                SIOCIWFIRSTPRIV + 0xc,
2547
 
                0, IW_PRIV_TYPE_CHAR|2047, "adhoc_peer_list"
2548
 
        }
2549
 
#ifdef _RTL8192_EXT_PATCH_
2550
 
        ,
2551
 
        {
2552
 
                SIOCIWFIRSTPRIV + 0xd,
2553
 
                IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_CHAR|64, 
2554
 
                "driverVer"
2555
 
        }
2556
 
#endif
2557
 
#ifdef CONFIG_MP        
2558
 
        ,
2559
 
        {
2560
 
                SIOCIWFIRSTPRIV + 0xe,
2561
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "SetChan"
2562
 
        }
2563
 
        ,
2564
 
        {
2565
 
                SIOCIWFIRSTPRIV + 0xf,
2566
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "SetRate"
2567
 
        }
2568
 
        ,
2569
 
        {
2570
 
                SIOCIWFIRSTPRIV + 0x10,
2571
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "SetTxPower"
2572
 
        }
2573
 
        ,
2574
 
        {
2575
 
                SIOCIWFIRSTPRIV + 0x11,
2576
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "SetBW"
2577
 
        }
2578
 
        ,
2579
 
        {
2580
 
                SIOCIWFIRSTPRIV + 0x12,
2581
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "TxStart"
2582
 
        }
2583
 
        ,
2584
 
        {
2585
 
                SIOCIWFIRSTPRIV + 0x13,
2586
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,0, "SetSingleCarrier"
2587
 
        }
2588
 
        ,
2589
 
        {
2590
 
                SIOCIWFIRSTPRIV + 0x14,
2591
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "WriteRF"
2592
 
        }
2593
 
        ,
2594
 
        {
2595
 
                SIOCIWFIRSTPRIV + 0x15,
2596
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "WriteMAC"
2597
 
        }
2598
 
#endif
2599
 
        ,
2600
 
        {
2601
 
                SIOCIWFIRSTPRIV + 0x16,
2602
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc"
2603
 
        }
2604
 
        ,
2605
 
        {
2606
 
                SIOCIWFIRSTPRIV + 0x17,
2607
 
                0,IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc"
2608
 
        }
2609
 
#ifdef CONFIG_BT_30
2610
 
        ,
2611
 
        {
2612
 
                SIOCIWFIRSTPRIV + 0x18,
2613
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 6, 0, "amp_creater"
2614
 
        }
2615
 
        ,
2616
 
        {
2617
 
                SIOCIWFIRSTPRIV + 0x19,
2618
 
                IW_PRIV_TYPE_CHAR | 64, 0, "amp_joiner"
2619
 
        }
2620
 
#endif
2621
 
};
2622
 
 
2623
 
static iw_handler r8192_private_handler[] = {
2624
 
        (iw_handler)r8192_wx_set_debugflag,   /*SIOCIWSECONDPRIV*/
2625
 
        (iw_handler)r8192_wx_set_scan_type,
2626
 
        (iw_handler)r8192_wx_set_rawtx,
2627
 
        (iw_handler)r8192_wx_force_reset,
2628
 
        (iw_handler)r8192_wx_force_mic_error,
2629
 
        (iw_handler)r8191se_wx_get_firm_version,
2630
 
        (iw_handler)r8192_wx_adapter_power_status,          
2631
 
#ifdef _RTL8192_EXT_PATCH_
2632
 
        (iw_handler)r8192_wx_print_reg,     
2633
 
        (iw_handler)r8192_wx_resume_firm,
2634
 
#else
2635
 
        (iw_handler)NULL, 
2636
 
        (iw_handler)NULL,
2637
 
#endif
2638
 
        (iw_handler)r8192se_wx_set_radio,
2639
 
        (iw_handler)r8192se_wx_set_lps_awake_interval,
2640
 
        (iw_handler)r8192se_wx_set_force_lps,
2641
 
        (iw_handler)r8192_wx_get_adhoc_peers,
2642
 
#ifdef _RTL8192_EXT_PATCH_
2643
 
        (iw_handler)r8192_wx_get_drv_version,
2644
 
#else
2645
 
        (iw_handler)NULL,
2646
 
#endif
2647
 
#ifdef CONFIG_MP
2648
 
        (iw_handler)r8192_wx_mp_set_chan,
2649
 
        (iw_handler)r8192_wx_mp_set_txrate,
2650
 
        (iw_handler)r8192_wx_mp_set_txpower,
2651
 
        (iw_handler)r8192_wx_mp_set_bw,
2652
 
        (iw_handler)r8192_wx_mp_set_txstart,
2653
 
        (iw_handler)r8192_wx_mp_set_singlecarrier,
2654
 
        (iw_handler)r8192_wx_mp_write_rf,
2655
 
        (iw_handler)r8192_wx_mp_write_mac,
2656
 
#else
2657
 
        (iw_handler)NULL,
2658
 
        (iw_handler)NULL,
2659
 
        (iw_handler)NULL,
2660
 
        (iw_handler)NULL,
2661
 
        (iw_handler)NULL,
2662
 
        (iw_handler)NULL,
2663
 
        (iw_handler)NULL,
2664
 
        (iw_handler)NULL,
2665
 
#endif
2666
 
        (iw_handler)r8192_wx_set_PromiscuousMode,
2667
 
        (iw_handler)r8192_wx_get_PromiscuousMode,
2668
 
#ifdef CONFIG_BT_30
2669
 
        (iw_handler)r8192_wx_creat_physical_link,
2670
 
        (iw_handler)r8192_wx_accept_physical_link,
2671
 
#else
2672
 
        (iw_handler)NULL,
2673
 
        (iw_handler)NULL,
2674
 
#endif
2675
 
};
2676
 
 
2677
 
struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
2678
 
{
2679
 
       struct r8192_priv *priv = rtllib_priv(dev);
2680
 
        struct rtllib_device* ieee = priv->rtllib;
2681
 
        struct iw_statistics* wstats = &priv->wstats;
2682
 
        int tmp_level = 0;
2683
 
        int tmp_qual = 0;
2684
 
        int tmp_noise = 0;
2685
 
        if(ieee->state < RTLLIB_LINKED)
2686
 
        {
2687
 
                wstats->qual.qual = 10;
2688
 
                wstats->qual.level = 0;
2689
 
                wstats->qual.noise = -100;
2690
 
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) 
2691
 
                wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
2692
 
#else
2693
 
                wstats->qual.updated = 0x0f;
2694
 
#endif
2695
 
                return wstats;
2696
 
        }
2697
 
        
2698
 
       tmp_level = (&ieee->current_network)->stats.rssi;
2699
 
        tmp_qual = (&ieee->current_network)->stats.signal;
2700
 
        tmp_noise = (&ieee->current_network)->stats.noise;                      
2701
 
 
2702
 
        wstats->qual.level = tmp_level;
2703
 
        wstats->qual.qual = tmp_qual;
2704
 
        wstats->qual.noise = tmp_noise;
2705
 
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)) 
2706
 
        wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
2707
 
#else
2708
 
        wstats->qual.updated = 0x0f;
2709
 
#endif
2710
 
        return wstats;
2711
 
}
2712
 
 
2713
 
#if defined RTL8192SE || defined RTL8192CE
2714
 
u8 SS_Rate_Map_G[6][2] = {{40, MGN_54M}, {30, MGN_48M}, {20, MGN_36M},
2715
 
        {12, MGN_24M}, {7, MGN_18M}, {0, MGN_12M}};
2716
 
u8 SS_Rate_Map_G_MRC_OFF[6][2]= {{17, MGN_54M}, {15, MGN_48M}, 
2717
 
        {13, MGN_36M}, {10, MGN_24M}, {3, MGN_18M}, {0, MGN_12M}};
2718
 
u8 MSI_SS_Rate_Map_G[6][2] = {{40, MGN_54M}, {30, MGN_54M}, {20, MGN_54M},
2719
 
        {12, MGN_48M}, {7, MGN_36M}, {0, MGN_24M}};
2720
 
u8 SS_Rate_Map_B[2][2] = {{7, MGN_11M}, {0, MGN_5_5M}};
2721
 
u8 SS_Rate_Map_N_MCS7[7][2] = {{40, MGN_MCS7}, {30, MGN_MCS5}, {25, MGN_MCS4},
2722
 
        {23, MGN_MCS3}, {19, MGN_MCS2}, {8, MGN_MCS1}, {0, MGN_MCS0}};
2723
 
u8 SS_Rate_Map_N_MCS15[7][2] = {{40, MGN_MCS15}, {35, MGN_MCS14}, {31, MGN_MCS12},
2724
 
        {28, MGN_MCS7}, {25, MGN_MCS5}, {23, MGN_MCS3}, {20, MGN_MCS0}};
2725
 
#define TxRateTypeNormal        0
2726
 
#define TxRateTypeCurrent       1
2727
 
#define TxRateTypeStartRate     2
2728
 
 
2729
 
u8 rtl8192_decorate_txrate_by_singalstrength(u32 SignalStrength, u8 *SS_Rate_Map, u8 MapSize)
2730
 
{
2731
 
        u8 index = 0;
2732
 
 
2733
 
        for (index = 0; index < (MapSize * 2); index += 2) {
2734
 
                if (SignalStrength > SS_Rate_Map[index])
2735
 
                        return SS_Rate_Map[index+1];
2736
 
        }
2737
 
 
2738
 
        return MGN_1M;
2739
 
}
2740
 
 
2741
 
u16 rtl8192_11n_user_show_rates(struct net_device* dev)
2742
 
{
2743
 
        struct r8192_priv  *priv = rtllib_priv(dev);
2744
 
        static u8  TimesForReportingFullRxSpeedAfterConnected = 100;
2745
 
        u8  rate = MGN_1M;
2746
 
        u32  Sgstrength;
2747
 
        bool TxorRx = priv->rtllib->bForcedShowRxRate;          
2748
 
        u8 bCurrentMRC = 0;
2749
 
 
2750
 
        priv->rtllib->GetHwRegHandler(dev, HW_VAR_MRC, (u8*)(&bCurrentMRC));
2751
 
 
2752
 
 
2753
 
        if (!TxorRx) {
2754
 
                {
2755
 
                        return CONVERT_RATE(priv->rtllib, priv->rtllib->softmac_stats.CurrentShowTxate);
2756
 
                }
2757
 
        }
2758
 
 
2759
 
        if(priv->rtllib->bForcedShowRateStill) {
2760
 
                Sgstrength = 100;
2761
 
        } else {
2762
 
                Sgstrength = priv->undecorated_smoothed_pwdb;
2763
 
        }
2764
 
 
2765
 
        if (priv->rtllib->mode == WIRELESS_MODE_A ||
2766
 
                        priv->rtllib->mode == WIRELESS_MODE_G ||
2767
 
                        priv->rtllib->mode == (WIRELESS_MODE_G | WIRELESS_MODE_B )) {
2768
 
                if (priv->CustomerID == RT_CID_819x_MSI) {
2769
 
                        rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength,
2770
 
                                        (u8*)MSI_SS_Rate_Map_G, sizeof(MSI_SS_Rate_Map_G)/2);
2771
 
                } else {
2772
 
                        if(!bCurrentMRC) 
2773
 
                                rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength, 
2774
 
                                        (u8*)SS_Rate_Map_G_MRC_OFF, sizeof(SS_Rate_Map_G_MRC_OFF)/2);
2775
 
                        else                            
2776
 
                        rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength,
2777
 
                                        (u8*)SS_Rate_Map_G, sizeof(SS_Rate_Map_G)/2);
2778
 
                }
2779
 
        } else if (priv->rtllib->mode == WIRELESS_MODE_B) {
2780
 
                rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength, (u8*)SS_Rate_Map_B,
2781
 
                                sizeof(SS_Rate_Map_B)/2);
2782
 
        } else if(priv->rtllib->mode == WIRELESS_MODE_N_24G) {
2783
 
                bool  bMaxRateMcs15;
2784
 
                bool  b1SSSupport = priv->rtllib->b1x1RecvCombine;
2785
 
                u8    rftype = priv->rf_type;
2786
 
                if (((!TxorRx) && (rftype==RF_1T1R || rftype==RF_1T2R)) ||
2787
 
                                (TxorRx && (rftype==RF_1T1R || (rftype==RF_1T2R && b1SSSupport))) ||
2788
 
                                (rftype==RF_2T2R && priv->rtllib->HTHighestOperaRate<=MGN_MCS7))
2789
 
                        bMaxRateMcs15 = false;
2790
 
                else
2791
 
                        bMaxRateMcs15 = true;
2792
 
 
2793
 
                if((priv->rtllib->state == RTLLIB_LINKED) && !(priv->rtllib->pHTInfo->bCurBW40MHz))
2794
 
                        bMaxRateMcs15 = false;
2795
 
 
2796
 
                if(priv->rtllib->state != RTLLIB_LINKED)
2797
 
                        priv->rtllib->SystemQueryDataRateCount = 0;
2798
 
                if (TimesForReportingFullRxSpeedAfterConnected > priv->rtllib->SystemQueryDataRateCount) {
2799
 
                        priv->rtllib->SystemQueryDataRateCount++;
2800
 
                        if(bMaxRateMcs15)
2801
 
                                return 600;
2802
 
                        else
2803
 
                                return 270;
2804
 
                }
2805
 
 
2806
 
                if (bMaxRateMcs15)
2807
 
                        rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength, (u8*)SS_Rate_Map_N_MCS15,
2808
 
                                        sizeof(SS_Rate_Map_N_MCS15)/2);
2809
 
                else
2810
 
                        rate = rtl8192_decorate_txrate_by_singalstrength(Sgstrength, (u8*)SS_Rate_Map_N_MCS7,
2811
 
                                        sizeof(SS_Rate_Map_N_MCS7)/2);
2812
 
        } else if (priv->rtllib->mode == WIRELESS_MODE_N_5G) {
2813
 
                return 580;
2814
 
        } else {
2815
 
                return 2;
2816
 
        }
2817
 
 
2818
 
        if (priv->rtllib->GetHalfNmodeSupportByAPsHandler(dev)) {
2819
 
                if (rate < 0x80)
2820
 
                        return rate;
2821
 
                else
2822
 
                        return HTHalfMcsToDataRate(priv->rtllib, rate);
2823
 
        } else {
2824
 
                return CONVERT_RATE(priv->rtllib, rate);
2825
 
        }
2826
 
}
2827
 
#endif
2828
 
 
2829
 
struct iw_handler_def  r8192_wx_handlers_def={
2830
 
        .standard = r8192_wx_handlers,
2831
 
        .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler),
2832
 
        .private = r8192_private_handler,
2833
 
        .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler),
2834
 
        .num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args),
2835
 
#if WIRELESS_EXT >= 17  
2836
 
        .get_wireless_stats = r8192_get_wireless_stats,
2837
 
#endif
2838
 
        .private_args = (struct iw_priv_args *)r8192_private_args,      
2839
 
};
2840
 
 
2841
 
#ifdef _RTL8192_EXT_PATCH_
2842
 
#define OID_802_11_MESH_SECURITY_INFO 0x0651
2843
 
#define OID_802_11_MESH_ID 0x0652
2844
 
#define OID_802_11_MESH_AUTO_LINK 0x0653
2845
 
#define OID_802_11_MESH_LINK_STATUS 0x0654
2846
 
#define OID_802_11_MESH_LIST 0x0655
2847
 
#define OID_802_11_MESH_ROUTE_LIST 0x0656
2848
 
#define OID_802_11_MESH_ADD_LINK 0x0657
2849
 
#define OID_802_11_MESH_DEL_LINK 0x0658
2850
 
#define OID_802_11_MESH_MAX_TX_RATE 0x0659
2851
 
#define OID_802_11_MESH_CHANNEL 0x065A
2852
 
#define OID_802_11_MESH_HOSTNAME        0x065B
2853
 
#define OID_802_11_MESH_ONLY_MODE  0x065C
2854
 
 
2855
 
#define OID_GET_SET_TOGGLE 0x8000
2856
 
#define RTL_OID_802_11_MESH_SECURITY_INFO (OID_GET_SET_TOGGLE + OID_802_11_MESH_SECURITY_INFO)
2857
 
#define RTL_OID_802_11_MESH_ID (OID_GET_SET_TOGGLE + OID_802_11_MESH_ID)
2858
 
#define RTL_OID_802_11_MESH_AUTO_LINK (OID_GET_SET_TOGGLE + OID_802_11_MESH_AUTO_LINK)
2859
 
#define RTL_OID_802_11_MESH_ADD_LINK (OID_GET_SET_TOGGLE + OID_802_11_MESH_ADD_LINK)
2860
 
#define RTL_OID_802_11_MESH_DEL_LINK (OID_GET_SET_TOGGLE + OID_802_11_MESH_DEL_LINK)
2861
 
#define RTL_OID_802_11_MESH_MAX_TX_RATE (OID_GET_SET_TOGGLE + OID_802_11_MESH_MAX_TX_RATE)
2862
 
#define RTL_OID_802_11_MESH_CHANNEL (OID_GET_SET_TOGGLE + OID_802_11_MESH_CHANNEL)
2863
 
#define RTL_OID_802_11_MESH_HOSTNAME            (OID_GET_SET_TOGGLE + OID_802_11_MESH_HOSTNAME)
2864
 
#define RTL_OID_802_11_MESH_ONLY_MODE    (OID_GET_SET_TOGGLE + OID_802_11_MESH_ONLY_MODE)
2865
 
 
2866
 
#define MAX_NEIGHBOR_NUM 64 
2867
 
typedef struct _MESH_NEIGHBOR_ENTRY
2868
 
{
2869
 
        char Rssi;
2870
 
        unsigned char HostName[MAX_HOST_NAME_LENGTH];
2871
 
        unsigned char MacAddr[ETH_ALEN];
2872
 
        unsigned char MeshId[MAX_MESH_ID_LEN];
2873
 
        unsigned char Channel;
2874
 
        unsigned char Status; 
2875
 
        unsigned char MeshEncrypType;           
2876
 
} MESH_NEIGHBOR_ENTRY, *PMESH_NEIGHBOR_ENTRY;
2877
 
typedef struct _MESH_NEIGHBOR_INFO
2878
 
{
2879
 
        MESH_NEIGHBOR_ENTRY Entry[MAX_NEIGHBOR_NUM];
2880
 
        unsigned char num;
2881
 
} MESH_NEIGHBOR_INFO, *PMESH_NEIGHBOR_INFO;
2882
 
 
2883
 
static int meshdev_set_key_for_linked_peers(struct net_device *dev, u8 KeyIndex, 
2884
 
                                            u16 KeyType, u32 *KeyContent )
2885
 
{
2886
 
        struct r8192_priv *priv = rtllib_priv(dev);
2887
 
        struct rtllib_device* ieee = priv->rtllib;
2888
 
        struct mshclass *mshobj = priv->mshobj;
2889
 
        PMESH_NEIGHBOR_INFO  pmesh_neighbor = NULL;
2890
 
        PMESH_NEIGHBOR_ENTRY pneighbor_entry = NULL;
2891
 
        u8 entry_idx = 0;
2892
 
        int i = 0;
2893
 
        int found_idx = MAX_MP-1;
2894
 
        pmesh_neighbor = (PMESH_NEIGHBOR_INFO)kmalloc(sizeof(MESH_NEIGHBOR_INFO), GFP_KERNEL);
2895
 
        if(NULL == pmesh_neighbor)
2896
 
                return -1;
2897
 
        
2898
 
        if(mshobj->ext_patch_r819x_get_peers)
2899
 
                mshobj->ext_patch_r819x_get_peers(dev, (void*)pmesh_neighbor);
2900
 
        
2901
 
        for (i=0; i<pmesh_neighbor->num; i++) {
2902
 
                pneighbor_entry = (PMESH_NEIGHBOR_ENTRY)&pmesh_neighbor->Entry[i];
2903
 
                if (mshobj->ext_patch_r819x_insert_linking_crypt_peer_queue)
2904
 
                        found_idx = mshobj->ext_patch_r819x_insert_linking_crypt_peer_queue(ieee,pneighbor_entry->MacAddr);
2905
 
                if (found_idx == -1) {
2906
 
                        printk("%s(): found_idx is -1 , something is wrong, return\n",__FUNCTION__);
2907
 
                        return -1;
2908
 
                } else if (found_idx == (MAX_MP - 1)) {
2909
 
                        printk("%s(): found_idx is MAX_MP-1, peer entry is full, return\n",__FUNCTION__);
2910
 
                        return -1;
2911
 
                }
2912
 
                if ((((ieee->LinkingPeerBitMap>>found_idx) & (BIT0)) == BIT0) && ((ieee->LinkingPeerSecState[found_idx] == USED) )) {
2913
 
                        entry_idx = rtl8192_get_free_hwsec_cam_entry(ieee, pneighbor_entry->MacAddr);
2914
 
#if 0
2915
 
                        printk("%s: Can not find free hw security cam entry, use software encryption entry(%d)\n", __FUNCTION__,entry_idx);
2916
 
                        if (mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info)
2917
 
                                mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info(ieee,pneighbor_entry->MacAddr,SW_SEC);
2918
 
                        ieee->LinkingPeerSecState[found_idx] = SW_SEC; 
2919
 
#else
2920
 
                        if (entry_idx >=  TOTAL_CAM_ENTRY-1) {
2921
 
                                printk("%s: Can not find free hw security cam entry, use software encryption entry(%d)\n", __FUNCTION__,entry_idx);
2922
 
                                if (mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info)
2923
 
                                        mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info(ieee,pneighbor_entry->MacAddr,SW_SEC);
2924
 
                                ieee->LinkingPeerSecState[found_idx] = SW_SEC; 
2925
 
                        } else {
2926
 
                                printk("==========>%s():entry_idx is %d,set HW CAM\n",__FUNCTION__,entry_idx);
2927
 
                                set_swcam( dev,
2928
 
                                                entry_idx,
2929
 
                                                KeyIndex, 
2930
 
                                                KeyType,  
2931
 
                                                pneighbor_entry->MacAddr, 
2932
 
                                                0,              
2933
 
                                                KeyContent,           
2934
 
                                                1);
2935
 
                                setKey( dev,
2936
 
                                                entry_idx,
2937
 
                                                KeyIndex, 
2938
 
                                                KeyType,  
2939
 
                                                pneighbor_entry->MacAddr, 
2940
 
                                                0,              
2941
 
                                                KeyContent);           
2942
 
                                                if (mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info)
2943
 
                                                        mshobj->ext_patch_r819x_set_msh_peer_entry_sec_info(ieee,pneighbor_entry->MacAddr,HW_SEC);
2944
 
                                                ieee->LinkingPeerSecState[found_idx] = HW_SEC; 
2945
 
                        }
2946
 
#endif
2947
 
                }
2948
 
        }
2949
 
        if(pmesh_neighbor)
2950
 
                kfree(pmesh_neighbor);
2951
 
        return 0;
2952
 
}
2953
 
 
2954
 
int meshdev_set_key_for_peer(struct net_device *dev, 
2955
 
                                                                u8 *Addr,
2956
 
                                                                u8 KeyIndex, 
2957
 
                                                                u16 KeyType, 
2958
 
                                                                u32 *KeyContent )
2959
 
{
2960
 
        struct r8192_priv *priv = rtllib_priv(dev);
2961
 
        struct rtllib_device* ieee = priv->rtllib;
2962
 
        u8 entry_idx = 0;
2963
 
        
2964
 
        entry_idx = rtl8192_get_free_hwsec_cam_entry(ieee, Addr);
2965
 
#if 0
2966
 
        printk("%s: Can not find free hw security cam entry\n", __FUNCTION__);
2967
 
        return -1;
2968
 
#else
2969
 
        if (entry_idx >=  TOTAL_CAM_ENTRY-1) {
2970
 
                printk("%s: Can not find free hw security cam entry\n", __FUNCTION__);
2971
 
                return -1;
2972
 
        } else {
2973
 
                set_swcam(dev,
2974
 
                        entry_idx,
2975
 
                        KeyIndex, 
2976
 
                        KeyType,  
2977
 
                        Addr, 
2978
 
                        0,              
2979
 
                        KeyContent,           
2980
 
                        1);
2981
 
                setKey(dev,
2982
 
                        entry_idx,
2983
 
                        KeyIndex, 
2984
 
                        KeyType,  
2985
 
                        Addr, 
2986
 
                        0,              
2987
 
                        KeyContent);           
2988
 
        }
2989
 
        return 0;
2990
 
#endif
2991
 
}
2992
 
 
2993
 
static struct net_device_stats *meshdev_stats(struct net_device *meshdev)
2994
 
{
2995
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
2996
 
        return &((struct meshdev_priv*)netdev_priv(meshdev))->stats;
2997
 
#else
2998
 
        return &((struct meshdev_priv*)meshdev->priv)->stats;
2999
 
#endif
3000
 
}
3001
 
 
3002
 
static int meshdev_wx_get_name(struct net_device *meshdev, 
3003
 
                             struct iw_request_info *info, 
3004
 
                             union iwreq_data *wrqu, char *extra)
3005
 
{
3006
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3007
 
        struct rtllib_device *ieee = mpriv->rtllib;
3008
 
        struct net_device *dev = ieee->dev;
3009
 
 
3010
 
        return r8192_wx_get_name(dev, info, wrqu, extra);
3011
 
}
3012
 
static int meshdev_wx_get_freq(struct net_device *meshdev, 
3013
 
                             struct iw_request_info *info, 
3014
 
                             union iwreq_data *wrqu, char *extra)
3015
 
{
3016
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3017
 
        struct rtllib_device *ieee = mpriv->rtllib;
3018
 
        struct net_device *dev = ieee->dev;
3019
 
        struct r8192_priv *priv = rtllib_priv(dev);
3020
 
 
3021
 
        return rtllib_wx_get_freq(priv->rtllib,info,wrqu,extra,1);
3022
 
}
3023
 
static int meshdev_wx_get_mode(struct net_device *meshdev, 
3024
 
                             struct iw_request_info *info, 
3025
 
                             union iwreq_data *wrqu, char *extra)
3026
 
{
3027
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3028
 
        struct rtllib_device *ieee = mpriv->rtllib;
3029
 
        struct net_device *dev = ieee->dev;
3030
 
 
3031
 
        if(0)
3032
 
                return r8192_wx_get_mode(dev, info, wrqu, extra);
3033
 
        else
3034
 
                return -1;
3035
 
}       
3036
 
static int meshdev_wx_get_sens(struct net_device *meshdev, 
3037
 
                             struct iw_request_info *info, 
3038
 
                             union iwreq_data *wrqu, char *extra)
3039
 
{
3040
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3041
 
        struct rtllib_device *ieee = mpriv->rtllib;
3042
 
        struct net_device *dev = ieee->dev;
3043
 
        
3044
 
        return r8192_wx_get_sens(dev, info, wrqu, extra);
3045
 
}
3046
 
static int meshdev_wx_get_range(struct net_device *meshdev, 
3047
 
                             struct iw_request_info *info, 
3048
 
                             union iwreq_data *wrqu, char *extra)
3049
 
{
3050
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3051
 
        struct rtllib_device *ieee = mpriv->rtllib;
3052
 
        struct net_device *dev = ieee->dev;
3053
 
 
3054
 
        return rtl8192_wx_get_range(dev, info, wrqu, extra);
3055
 
}
3056
 
static int meshdev_wx_get_wap(struct net_device *meshdev, 
3057
 
                             struct iw_request_info *info, 
3058
 
                             union iwreq_data *wrqu, char *extra)
3059
 
{
3060
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3061
 
        struct rtllib_device *ieee = mpriv->rtllib;
3062
 
        struct net_device *dev = ieee->dev;
3063
 
 
3064
 
        return r8192_wx_get_wap(dev, info, wrqu, extra);
3065
 
}
3066
 
static int meshdev_wx_get_essid(struct net_device *meshdev, 
3067
 
                             struct iw_request_info *info, 
3068
 
                             union iwreq_data *wrqu, char *extra)
3069
 
{
3070
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3071
 
        struct rtllib_device *ieee = mpriv->rtllib;
3072
 
        struct net_device *dev = ieee->dev;
3073
 
        struct r8192_priv *priv = rtllib_priv(dev);
3074
 
        struct mshclass *mshobj = priv->mshobj;
3075
 
        int ret = 0;    
3076
 
 
3077
 
        if(mshobj->ext_patch_r819x_wx_get_meshid)
3078
 
                ret = mshobj->ext_patch_r819x_wx_get_meshid(dev, info, wrqu, extra);
3079
 
 
3080
 
        return ret;
3081
 
}
3082
 
static int meshdev_wx_get_rate(struct net_device *meshdev, 
3083
 
                             struct iw_request_info *info, 
3084
 
                             union iwreq_data *wrqu, char *extra)
3085
 
{
3086
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3087
 
        struct rtllib_device *ieee = mpriv->rtllib;
3088
 
        struct net_device *dev = ieee->dev;
3089
 
 
3090
 
        return r8192_wx_get_rate(dev, info, wrqu, extra);
3091
 
}
3092
 
#if 0
3093
 
static int meshdev_wx_set_freq(struct net_device *meshdev, 
3094
 
                             struct iw_request_info *info, 
3095
 
                             union iwreq_data *wrqu, char *extra)
3096
 
{
3097
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3098
 
        struct rtllib_device *ieee = mpriv->rtllib;
3099
 
        struct net_device *dev = ieee->dev;
3100
 
        
3101
 
        return r8192_wx_set_freq(dev, info, wrqu, extra);
3102
 
}
3103
 
static int meshdev_wx_set_rate(struct net_device *meshdev, 
3104
 
                             struct iw_request_info *info, 
3105
 
                             union iwreq_data *wrqu, char *extra)
3106
 
{
3107
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3108
 
        struct rtllib_device *ieee = mpriv->rtllib;
3109
 
        struct net_device *dev = ieee->dev;
3110
 
        
3111
 
        return r8192_wx_set_rate(dev, info, wrqu, extra);
3112
 
}
3113
 
static int meshdev_wx_set_sens(struct net_device *meshdev, 
3114
 
                             struct iw_request_info *info, 
3115
 
                             union iwreq_data *wrqu, char *extra)
3116
 
{
3117
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3118
 
        struct rtllib_device *ieee = mpriv->rtllib;
3119
 
        struct net_device *dev = ieee->dev;
3120
 
 
3121
 
        return r8192_wx_set_sens(dev, info, wrqu, extra);
3122
 
}
3123
 
static int meshdev_wx_set_scan(struct net_device *meshdev, 
3124
 
                             struct iw_request_info *info, 
3125
 
                             union iwreq_data *wrqu, char *extra)
3126
 
{
3127
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3128
 
        struct rtllib_device *ieee = mpriv->rtllib;
3129
 
        struct net_device *dev = ieee->dev;
3130
 
 
3131
 
        return r8192_wx_set_scan(dev, info, wrqu, extra);
3132
 
}
3133
 
static int meshdev_wx_get_scan(struct net_device *meshdev, 
3134
 
                             struct iw_request_info *info, 
3135
 
                             union iwreq_data *wrqu, char *extra)
3136
 
{
3137
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3138
 
        struct rtllib_device *ieee = mpriv->rtllib;
3139
 
        struct net_device *dev = ieee->dev;
3140
 
 
3141
 
        return r8192_wx_get_scan(dev, info, wrqu, extra);
3142
 
}
3143
 
#endif
3144
 
static int meshdev_wx_set_enc(struct net_device *meshdev, 
3145
 
                             struct iw_request_info *info, 
3146
 
                             union iwreq_data *wrqu, char *key)
3147
 
{
3148
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3149
 
        struct rtllib_device *ieee = mpriv->rtllib;
3150
 
        struct net_device *dev = ieee->dev;
3151
 
        struct r8192_priv *priv = (struct r8192_priv *)ieee->priv;
3152
 
        int ret;
3153
 
        u32 hwkey[4]={0,0,0,0};
3154
 
        u8 mask=0xff;
3155
 
        u32 key_idx=0;
3156
 
#if 0
3157
 
        u8 zero_addr[4][6] ={   {0x00,0x00,0x00,0x00,0x00,0x00},
3158
 
                                {0x00,0x00,0x00,0x00,0x00,0x01}, 
3159
 
                                {0x00,0x00,0x00,0x00,0x00,0x02}, 
3160
 
                                {0x00,0x00,0x00,0x00,0x00,0x03} };
3161
 
#endif
3162
 
        int i;
3163
 
 
3164
 
       if(!priv->mesh_up) return -ENETDOWN;
3165
 
 
3166
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
3167
 
        
3168
 
        RT_TRACE(COMP_SEC, "Setting SW wep key");
3169
 
        ret = rtllib_wx_set_encode(priv->rtllib,info,wrqu,key,1);
3170
 
 
3171
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
3172
 
 
3173
 
 
3174
 
        if(wrqu->encoding.length!=0){
3175
 
 
3176
 
                for(i=0 ; i<4 ; i++){
3177
 
                        hwkey[i] |=  key[4*i+0]&mask;
3178
 
                        if(i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00;
3179
 
                        if(i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00;
3180
 
                        hwkey[i] |= (key[4*i+1]&mask)<<8;
3181
 
                        hwkey[i] |= (key[4*i+2]&mask)<<16;
3182
 
                        hwkey[i] |= (key[4*i+3]&mask)<<24;
3183
 
                }
3184
 
 
3185
 
                #define CONF_WEP40  0x4
3186
 
                #define CONF_WEP104 0x14
3187
 
 
3188
 
                switch(wrqu->encoding.flags & IW_ENCODE_INDEX){
3189
 
                        case 0: key_idx = ieee->mesh_txkeyidx; break;
3190
 
                        case 1: key_idx = 0; break;
3191
 
                        case 2: key_idx = 1; break;
3192
 
                        case 3: key_idx = 2; break;
3193
 
                        case 4: key_idx = 3; break;
3194
 
                        default: break;
3195
 
                }
3196
 
 
3197
 
                if(wrqu->encoding.length==0x5){
3198
 
                ieee->mesh_pairwise_key_type = KEY_TYPE_WEP40;
3199
 
                        EnableHWSecurityConfig8192(dev);
3200
 
                }
3201
 
 
3202
 
                else if(wrqu->encoding.length==0xd){
3203
 
                        ieee->mesh_pairwise_key_type = KEY_TYPE_WEP104;
3204
 
                                EnableHWSecurityConfig8192(dev);
3205
 
                }
3206
 
                else 
3207
 
                        printk("wrong type in WEP, not WEP40 and WEP104\n");
3208
 
 
3209
 
                meshdev_set_key_for_linked_peers(dev,
3210
 
                                                key_idx, 
3211
 
                                                ieee->mesh_pairwise_key_type,  
3212
 
                                                hwkey); 
3213
 
 
3214
 
        }
3215
 
 
3216
 
#if 0
3217
 
        if(wrqu->encoding.length==0 && (wrqu->encoding.flags >>8) == 0x8 ){
3218
 
                printk("===>1\n");              
3219
 
                EnableHWSecurityConfig8192(dev);
3220
 
                key_idx = (wrqu->encoding.flags & 0xf)-1 ;
3221
 
                write_cam(dev, (4*6),   0xffff0000|read_cam(dev, key_idx*6) );
3222
 
                write_cam(dev, (4*6)+1, 0xffffffff);
3223
 
                write_cam(dev, (4*6)+2, read_cam(dev, (key_idx*6)+2) );
3224
 
                write_cam(dev, (4*6)+3, read_cam(dev, (key_idx*6)+3) );
3225
 
                write_cam(dev, (4*6)+4, read_cam(dev, (key_idx*6)+4) );
3226
 
                write_cam(dev, (4*6)+5, read_cam(dev, (key_idx*6)+5) );
3227
 
        }
3228
 
#endif
3229
 
 
3230
 
        return ret;
3231
 
}
3232
 
static int meshdev_wx_get_enc(struct net_device *meshdev, 
3233
 
                             struct iw_request_info *info, 
3234
 
                             union iwreq_data *wrqu, char *extra)
3235
 
{
3236
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3237
 
        struct rtllib_device *ieee = mpriv->rtllib;
3238
 
        struct net_device * dev = ieee->dev;
3239
 
        struct r8192_priv* priv = rtllib_priv(dev);
3240
 
 
3241
 
        if(!priv->mesh_up){
3242
 
                return -ENETDOWN;
3243
 
        }
3244
 
        return rtllib_wx_get_encode(ieee, info, wrqu, extra,1);
3245
 
}
3246
 
#if 0
3247
 
static int meshdev_wx_set_frag(struct net_device *meshdev, 
3248
 
                             struct iw_request_info *info, 
3249
 
                             union iwreq_data *wrqu, char *extra)
3250
 
{
3251
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3252
 
        struct rtllib_device *ieee = mpriv->rtllib;
3253
 
        struct net_device *dev = ieee->dev;
3254
 
 
3255
 
        return r8192_wx_set_frag(dev, info, wrqu, extra);
3256
 
}
3257
 
static int meshdev_wx_get_frag(struct net_device *meshdev, 
3258
 
                             struct iw_request_info *info, 
3259
 
                             union iwreq_data *wrqu, char *extra)
3260
 
{
3261
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3262
 
        struct rtllib_device *ieee = mpriv->rtllib;
3263
 
        struct net_device *dev = ieee->dev;
3264
 
 
3265
 
        return r8192_wx_get_frag(dev, info, wrqu, extra);
3266
 
}
3267
 
static int meshdev_wx_set_retry(struct net_device *meshdev, 
3268
 
                             struct iw_request_info *info, 
3269
 
                             union iwreq_data *wrqu, char *extra)
3270
 
{
3271
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3272
 
        struct rtllib_device *ieee = mpriv->rtllib;
3273
 
        struct net_device *dev = ieee->dev;
3274
 
 
3275
 
        return r8192_wx_set_retry(dev, info, wrqu, extra);
3276
 
}
3277
 
static int meshdev_wx_get_retry(struct net_device *meshdev, 
3278
 
                             struct iw_request_info *info, 
3279
 
                             union iwreq_data *wrqu, char *extra)
3280
 
{
3281
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3282
 
        struct rtllib_device *ieee = mpriv->rtllib;
3283
 
        struct net_device *dev = ieee->dev;
3284
 
 
3285
 
        return r8192_wx_get_retry(dev, info, wrqu, extra);
3286
 
}
3287
 
#endif
3288
 
static int meshdev_wx_set_mode(struct net_device *meshdev, 
3289
 
                             struct iw_request_info *info, 
3290
 
                             union iwreq_data *wrqu, char *extra)
3291
 
{
3292
 
#if 0
3293
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3294
 
        struct rtllib_device *ieee = mpriv->rtllib;
3295
 
        struct net_device *dev = ieee->dev;
3296
 
        
3297
 
        return r8192_wx_set_mode(dev, info, wrqu, extra);
3298
 
#endif
3299
 
        return 0;
3300
 
}
3301
 
static int meshdev_wx_set_wap(struct net_device *meshdev, 
3302
 
                             struct iw_request_info *info, 
3303
 
                             union iwreq_data *wrqu, char *extra)
3304
 
{
3305
 
#if 0
3306
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3307
 
        struct rtllib_device *ieee = mpriv->rtllib;
3308
 
        struct net_device *dev = ieee->dev;
3309
 
 
3310
 
        return r8192_wx_set_wap(dev, info, wrqu, extra);
3311
 
#endif
3312
 
        return 0;
3313
 
}
3314
 
static int meshdev_wx_set_mlme(struct net_device *meshdev, 
3315
 
                             struct iw_request_info *info, 
3316
 
                             union iwreq_data *wrqu, char *extra)
3317
 
{
3318
 
#if 0
3319
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3320
 
        struct rtllib_device *ieee = mpriv->rtllib;
3321
 
        struct net_device *dev = ieee->dev;
3322
 
 
3323
 
        return r8192_wx_set_mlme(dev, info, wrqu, extra);
3324
 
#endif
3325
 
        return 0;
3326
 
}
3327
 
static int meshdev_wx_set_essid(struct net_device *meshdev, 
3328
 
                             struct iw_request_info *info, 
3329
 
                             union iwreq_data *wrqu, char *extra)
3330
 
{
3331
 
#if 0
3332
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3333
 
        struct rtllib_device *ieee = mpriv->rtllib;
3334
 
        struct net_device *dev = ieee->dev;
3335
 
 
3336
 
        return r8192_wx_set_essid(dev, info, wrqu, extra);
3337
 
#endif
3338
 
        return 0;
3339
 
}
3340
 
static int meshdev_wx_set_gen_ie(struct net_device *meshdev, 
3341
 
                             struct iw_request_info *info, 
3342
 
                             union iwreq_data *wrqu, char *extra)
3343
 
{
3344
 
#if 0
3345
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3346
 
        struct rtllib_device *ieee = mpriv->rtllib;
3347
 
        struct net_device *dev = ieee->dev;
3348
 
 
3349
 
        return r8192_wx_set_gen_ie(dev, info, wrqu, extra);
3350
 
#endif
3351
 
        return 0;
3352
 
}
3353
 
static int meshdev_wx_set_auth(struct net_device *meshdev, 
3354
 
                             struct iw_request_info *info, 
3355
 
                             union iwreq_data *wrqu, char *extra)
3356
 
{
3357
 
#if 0
3358
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3359
 
        struct rtllib_device *ieee = mpriv->rtllib;
3360
 
        struct net_device *dev = ieee->dev;
3361
 
 
3362
 
        return r8192_wx_set_auth(dev, info, wrqu, extra);
3363
 
#endif
3364
 
        return 0;
3365
 
}
3366
 
static int meshdev_wx_set_enc_ext(struct net_device *meshdev, 
3367
 
                             struct iw_request_info *info, 
3368
 
                             union iwreq_data *wrqu, char *extra)
3369
 
{
3370
 
        int ret=0;
3371
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3372
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3373
 
        struct rtllib_device *ieee = mpriv->rtllib;
3374
 
        struct net_device *dev = ieee->dev;
3375
 
        struct r8192_priv *priv = (struct r8192_priv *)ieee->priv;
3376
 
 
3377
 
        printk("============================================================>%s\n", __FUNCTION__);
3378
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
3379
 
        ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra, 1);
3380
 
 
3381
 
        ret |= r8192_set_hw_enc(dev,info,wrqu,extra, 1);
3382
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
3383
 
#endif
3384
 
 
3385
 
        return ret;     
3386
 
}
3387
 
 
3388
 
static int dummy(struct net_device *dev, struct iw_request_info *a,
3389
 
                 union iwreq_data *wrqu,char *b)
3390
 
{
3391
 
        return -1;
3392
 
}
3393
 
 
3394
 
int rt_ioctl_siwpmksa(struct net_device *dev,
3395
 
                           struct iw_request_info *info,
3396
 
                           union iwreq_data *wrqu,
3397
 
                           char *extra)
3398
 
{
3399
 
        return 0;
3400
 
}
3401
 
 
3402
 
static iw_handler meshdev_wx_handlers[] =
3403
 
{
3404
 
        NULL,                     /* SIOCSIWCOMMIT */
3405
 
        meshdev_wx_get_name,      /* SIOCGIWNAME */
3406
 
        dummy,                    /* SIOCSIWNWID */
3407
 
        dummy,                    /* SIOCGIWNWID */
3408
 
        NULL,  
3409
 
        meshdev_wx_get_freq,        /* SIOCGIWFREQ */
3410
 
        meshdev_wx_set_mode,        /* SIOCSIWMODE */
3411
 
        meshdev_wx_get_mode,        /* SIOCGIWMODE */
3412
 
        NULL,  
3413
 
        meshdev_wx_get_sens,        /* SIOCGIWSENS */
3414
 
        NULL,                     /* SIOCSIWRANGE */
3415
 
        meshdev_wx_get_range,     /* SIOCGIWRANGE */
3416
 
        NULL,                     /* SIOCSIWPRIV */
3417
 
        NULL,                     /* SIOCGIWPRIV */
3418
 
        NULL,                     /* SIOCSIWSTATS */
3419
 
        NULL,                     /* SIOCGIWSTATS */
3420
 
        dummy,                    /* SIOCSIWSPY */
3421
 
        dummy,                    /* SIOCGIWSPY */
3422
 
        NULL,                     /* SIOCGIWTHRSPY */
3423
 
        NULL,                     /* SIOCWIWTHRSPY */
3424
 
        meshdev_wx_set_wap,               /* SIOCSIWAP */
3425
 
        meshdev_wx_get_wap,         /* SIOCGIWAP */
3426
 
        meshdev_wx_set_mlme, 
3427
 
        dummy,                     /* SIOCGIWAPLIST -- depricated */
3428
 
        NULL,  
3429
 
        NULL,  
3430
 
        meshdev_wx_set_essid,       /* SIOCSIWESSID */
3431
 
        meshdev_wx_get_essid,       /* SIOCGIWESSID */
3432
 
        dummy,                    /* SIOCSIWNICKN */
3433
 
        dummy,                    /* SIOCGIWNICKN */
3434
 
        NULL,                     /* -- hole -- */
3435
 
        NULL,                     /* -- hole -- */
3436
 
        NULL,  
3437
 
        meshdev_wx_get_rate,        /* SIOCGIWRATE */
3438
 
        dummy,                    /* SIOCSIWRTS */
3439
 
        dummy,                    /* SIOCGIWRTS */
3440
 
        NULL,  
3441
 
        NULL,  
3442
 
        dummy,                    /* SIOCSIWTXPOW */
3443
 
        dummy,                    /* SIOCGIWTXPOW */
3444
 
        NULL,  
3445
 
        NULL,  
3446
 
        meshdev_wx_set_enc,         /* SIOCSIWENCODE */
3447
 
        meshdev_wx_get_enc,         /* SIOCGIWENCODE */
3448
 
        dummy,                    /* SIOCSIWPOWER */
3449
 
        dummy,                    /* SIOCGIWPOWER */
3450
 
        NULL,                   /*---hole---*/
3451
 
        NULL,                   /*---hole---*/
3452
 
        meshdev_wx_set_gen_ie,
3453
 
        NULL,                   /* SIOCSIWGENIE */
3454
 
        meshdev_wx_set_auth,
3455
 
        NULL, 
3456
 
        meshdev_wx_set_enc_ext,                         /* SIOCSIWENCODEEXT */
3457
 
        NULL, 
3458
 
        (iw_handler) rt_ioctl_siwpmksa,
3459
 
        NULL,                    /*---hole---*/
3460
 
}; 
3461
 
 
3462
 
static struct iw_priv_args meshdev_private_args[] = { 
3463
 
        {
3464
 
                SIOCIWFIRSTPRIV + 0x0, 
3465
 
                0, 0, "enablemesh" 
3466
 
        },
3467
 
        {
3468
 
                SIOCIWFIRSTPRIV + 0x1, 
3469
 
                0, IW_PRIV_TYPE_CHAR | 64, "getmeshinfo"
3470
 
        },
3471
 
        {
3472
 
                SIOCIWFIRSTPRIV + 0x2, 
3473
 
                0, 0, "disablemesh"
3474
 
        },
3475
 
        {
3476
 
                SIOCIWFIRSTPRIV + 0x3, 
3477
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setch"
3478
 
        },
3479
 
        {
3480
 
                SIOCIWFIRSTPRIV + 0x4, 
3481
 
                IW_PRIV_TYPE_CHAR | 64  , 0, "setmeshid"
3482
 
        },
3483
 
        {       SIOCIWFIRSTPRIV + 0x5, 
3484
 
                0,IW_PRIV_TYPE_CHAR | 64 , "getmeshlist"
3485
 
        },
3486
 
        {       SIOCIWFIRSTPRIV + 0x6, 
3487
 
                IW_PRIV_TYPE_CHAR | 64,0 , "meshscan"
3488
 
        },
3489
 
        {
3490
 
                SIOCIWFIRSTPRIV + 0x7,
3491
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setmode"
3492
 
 
3493
 
        },
3494
 
        {
3495
 
                SIOCIWFIRSTPRIV + 0x8, 
3496
 
                IW_PRIV_TYPE_CHAR | 64, 0, "sethostname"
3497
 
        },
3498
 
        {
3499
 
                SIOCIWFIRSTPRIV + 0x9,
3500
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setBW"
3501
 
 
3502
 
        },
3503
 
        {
3504
 
                SIOCIWFIRSTPRIV + 0xa, 
3505
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "updateBW"
3506
 
        }, 
3507
 
        {       SIOCIWFIRSTPRIV + 0xb, 
3508
 
                0,IW_PRIV_TYPE_CHAR | 256 , "macdenyget"
3509
 
        },
3510
 
        {       SIOCIWFIRSTPRIV + 0xc, 
3511
 
                IW_PRIV_TYPE_CHAR | 64,0 , "macdenyadd"
3512
 
        },
3513
 
        /*
3514
 
        {
3515
 
                SIOCIWFIRSTPRIV + 0xe, 
3516
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_MASK, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_MASK, ""
3517
 
        },*/
3518
 
        {       SIOCIWFIRSTPRIV + 0xf, 
3519
 
                0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_MASK , "getneighborlist"
3520
 
        },
3521
 
        /* Sub-ioctls definitions*/
3522
 
        /*
3523
 
        {
3524
 
                OID_802_11_MESH_ID, 
3525
 
                IW_PRIV_TYPE_INT | 2047, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_MASK, "meshid"
3526
 
        },
3527
 
        {
3528
 
                OID_802_11_MESH_LIST, 
3529
 
                IW_PRIV_TYPE_INT | 2047, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_MASK, "meshlist"
3530
 
        },*/
3531
 
        {       SIOCIWFIRSTPRIV + 0x10, 
3532
 
                IW_PRIV_TYPE_CHAR | 64, 0, "set"
3533
 
        },
3534
 
        {       SIOCIWFIRSTPRIV + 0x12, 
3535
 
                IW_PRIV_TYPE_CHAR | 64,0 , "macdenydel"
3536
 
        },
3537
 
        {
3538
 
                SIOCIWFIRSTPRIV + 0x14,
3539
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setmeshsec"
3540
 
        },
3541
 
        {
3542
 
                SIOCIWFIRSTPRIV + 0x15,
3543
 
                IW_PRIV_TYPE_CHAR | 6, 0, "setmkddid"
3544
 
        },
3545
 
        {
3546
 
                SIOCIWFIRSTPRIV + 0x16,
3547
 
                IW_PRIV_TYPE_CHAR | 64, 0, "setkey"
3548
 
        },
3549
 
        {
3550
 
                SIOCIWFIRSTPRIV + 0x17,
3551
 
                IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "setsectype"
3552
 
        },
3553
 
};
3554
 
 
3555
 
int meshdev_wx_mesh(struct net_device *meshdev, 
3556
 
                               struct iw_request_info *info, 
3557
 
                               union iwreq_data *wrqu, char *extra)
3558
 
{
3559
 
        struct meshdev_priv *meshpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3560
 
        struct rtllib_device * ieee = meshpriv->rtllib;
3561
 
        struct net_device *dev = ieee->dev;
3562
 
        struct r8192_priv *priv = rtllib_priv(dev);
3563
 
        struct mshclass *mshobj = priv->mshobj;
3564
 
        int ret = 0;
3565
 
 
3566
 
        printk("@@@@@%s: ", __FUNCTION__);
3567
 
        if(mshobj)
3568
 
        {
3569
 
                switch(wrqu->data.flags)
3570
 
                {
3571
 
                        case OID_802_11_MESH_SECURITY_INFO:
3572
 
                        {
3573
 
                                printk("OID_802_11_MESH_SECURITY_INFO \n");
3574
 
                                if(mshobj->ext_patch_r819x_wx_get_security_info)
3575
 
                                        ret = mshobj->ext_patch_r819x_wx_get_security_info(dev, info, wrqu, extra);
3576
 
                                break;
3577
 
                        }
3578
 
                        case OID_802_11_MESH_ID:
3579
 
                        {
3580
 
                                printk("OID_802_11_MESH_ID \n");
3581
 
                                if(mshobj->ext_patch_r819x_wx_get_meshid)
3582
 
                                        ret = mshobj->ext_patch_r819x_wx_get_meshid(dev, info, wrqu, extra);
3583
 
                                break;
3584
 
                        }
3585
 
                        case OID_802_11_MESH_AUTO_LINK:
3586
 
                        {
3587
 
                                printk("OID_802_11_MESH_AUTO_LINK \n");
3588
 
                                if(mshobj->ext_patch_r819x_wx_get_auto_link)
3589
 
                                        ret = mshobj->ext_patch_r819x_wx_get_auto_link(dev, info, wrqu, extra);
3590
 
                                break;
3591
 
                        }
3592
 
                        case OID_802_11_MESH_LINK_STATUS:
3593
 
                        {
3594
 
                                printk("OID_802_11_MESH_LINK_STATUS \n");
3595
 
                                if(mshobj->ext_patch_r819x_wx_get_link_status)
3596
 
                                        ret = mshobj->ext_patch_r819x_wx_get_link_status(dev, info, wrqu, extra);
3597
 
                                break;
3598
 
                        }
3599
 
                        case OID_802_11_MESH_LIST:
3600
 
                        {
3601
 
                                printk("OID_802_11_MESH_LIST \n");
3602
 
                                if(mshobj->ext_patch_r819x_wx_get_neighbor_list)
3603
 
                                        ret = mshobj->ext_patch_r819x_wx_get_neighbor_list(dev, info, wrqu, extra);
3604
 
                                break;
3605
 
                        }
3606
 
                        case OID_802_11_MESH_ROUTE_LIST:
3607
 
                        {
3608
 
                                printk("OID_802_11_MESH_ROUTE_LIST \n");
3609
 
                                if(mshobj->ext_patch_r819x_wx_get_route_list)
3610
 
                                        ret = mshobj->ext_patch_r819x_wx_get_route_list(dev, info, wrqu, extra);
3611
 
                                break;
3612
 
                        }
3613
 
                        case OID_802_11_MESH_MAX_TX_RATE:
3614
 
                        {
3615
 
                                printk("OID_802_11_MESH_MAX_TX_RATE \n");
3616
 
                                if(mshobj->ext_patch_r819x_wx_get_maxrate)
3617
 
                                        ret = mshobj->ext_patch_r819x_wx_get_maxrate(dev, info, wrqu, extra);
3618
 
                                break;
3619
 
                        }
3620
 
                        case OID_802_11_MESH_CHANNEL:
3621
 
                        {
3622
 
                                printk("OID_802_11_MESH_CHANNEL \n");
3623
 
                                if(mshobj->ext_patch_r819x_wx_get_channel)
3624
 
                                        ret = mshobj->ext_patch_r819x_wx_get_channel(dev, info, wrqu, extra);
3625
 
                                break;
3626
 
                        }
3627
 
                        case OID_802_11_MESH_HOSTNAME:
3628
 
                        {
3629
 
                                printk("OID_802_11_MESH_HOSTNAME \n");
3630
 
                                if(mshobj->ext_patch_r819x_wx_get_host_name)
3631
 
                                        ret = mshobj->ext_patch_r819x_wx_get_host_name(dev, info, wrqu, extra);
3632
 
                                break;
3633
 
                        }
3634
 
                        case OID_802_11_MESH_ONLY_MODE:
3635
 
                        {
3636
 
                                printk("OID_802_11_MESH_ONLY_MODE \n");
3637
 
                                if(mshobj->ext_patch_r819x_wx_get_mesh_only_mode)
3638
 
                                        ret = mshobj->ext_patch_r819x_wx_get_mesh_only_mode(dev, info, wrqu, extra);
3639
 
                                break;
3640
 
                        }
3641
 
                        case RTL_OID_802_11_MESH_SECURITY_INFO:
3642
 
                        {
3643
 
                                printk("RTL_OID_802_11_MESH_SECURITY_INFO \n");
3644
 
                                if(mshobj->ext_patch_r819x_wx_set_security_info)
3645
 
                                        ret = mshobj->ext_patch_r819x_wx_set_security_info(dev, info, wrqu, extra);
3646
 
                                break;
3647
 
                        }
3648
 
                        case RTL_OID_802_11_MESH_ID:
3649
 
                        {
3650
 
                                printk("RTL_OID_802_11_MESH_ID \n");
3651
 
                                if(mshobj->ext_patch_r819x_wx_set_meshID)
3652
 
                                        ret = mshobj->ext_patch_r819x_wx_set_meshID(dev, (u8*)wrqu->data.pointer);
3653
 
                                break;
3654
 
                        }
3655
 
                        case RTL_OID_802_11_MESH_AUTO_LINK:
3656
 
                        {
3657
 
                                printk("RTL_OID_802_11_MESH_AUTO_LINK \n");
3658
 
                                if(mshobj->ext_patch_r819x_wx_set_auto_link)
3659
 
                                        ret = mshobj->ext_patch_r819x_wx_set_auto_link(dev, info, wrqu, extra);
3660
 
                                break;
3661
 
                        }
3662
 
                        case RTL_OID_802_11_MESH_ADD_LINK:
3663
 
                        {
3664
 
                                printk("RTL_OID_802_11_MESH_ADD_LINK \n");
3665
 
                                if(mshobj->ext_patch_r819x_wx_set_add_link)
3666
 
                                        ret = mshobj->ext_patch_r819x_wx_set_add_link(dev, info, wrqu, extra);
3667
 
                                break;
3668
 
                        }
3669
 
                        case RTL_OID_802_11_MESH_DEL_LINK:
3670
 
                        {
3671
 
                                printk("RTL_OID_802_11_MESH_DEL_LINK \n");
3672
 
                                if(mshobj->ext_patch_r819x_wx_set_del_link)
3673
 
                                        ret = mshobj->ext_patch_r819x_wx_set_del_link(dev, info, wrqu, extra);
3674
 
                                break;
3675
 
                        }
3676
 
                        case RTL_OID_802_11_MESH_MAX_TX_RATE:
3677
 
                        {
3678
 
                                printk("RTL_OID_802_11_MESH_MAX_TX_RATE \n");
3679
 
                                if(mshobj->ext_patch_r819x_wx_set_maxrate)
3680
 
                                        ret = mshobj->ext_patch_r819x_wx_set_maxrate(dev, info, wrqu, extra);
3681
 
                                break;
3682
 
                        }
3683
 
                        case RTL_OID_802_11_MESH_CHANNEL:
3684
 
                        {
3685
 
                                printk("RTL_OID_802_11_MESH_CHANNEL \n");
3686
 
                                printk("channel = %d\n",*(u8*)wrqu->data.pointer);
3687
 
                                r8192_wx_set_channel(dev, info, wrqu, wrqu->data.pointer);
3688
 
                                break;
3689
 
                        }
3690
 
                        case RTL_OID_802_11_MESH_HOSTNAME:
3691
 
                        {
3692
 
                                printk("RTL_OID_802_11_MESH_HOSTNAME \n");
3693
 
                                if(mshobj->ext_patch_r819x_wx_set_host_name)
3694
 
                                        ret = mshobj->ext_patch_r819x_wx_set_host_name(dev, info, wrqu, extra);
3695
 
                                break;
3696
 
                        }
3697
 
                        case RTL_OID_802_11_MESH_ONLY_MODE:
3698
 
                        {
3699
 
                                printk("RTL_OID_802_11_MESH_ONLY_MODE \n");
3700
 
                                if(mshobj->ext_patch_r819x_wx_set_mesh_only_mode)
3701
 
                                        ret = mshobj->ext_patch_r819x_wx_set_mesh_only_mode(dev, info, wrqu, extra);
3702
 
                                break;
3703
 
                        }
3704
 
                        default:
3705
 
                                printk("Default \n");
3706
 
                                break;
3707
 
                }
3708
 
        }
3709
 
        return ret;
3710
 
}
3711
 
 
3712
 
static int meshdev_wx_get_meshinfo(struct net_device *meshdev, 
3713
 
                               struct iw_request_info *info, 
3714
 
                               union iwreq_data *wrqu, char *extra)
3715
 
{
3716
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3717
 
        struct net_device *dev = mpriv->rtllib->dev;
3718
 
        
3719
 
printk("++++++======%s: dev=%p length=%d extra=%p\n", __FUNCTION__, dev, wrqu->data.length,extra);
3720
 
        return r8192_wx_get_meshinfo(dev, info, wrqu, extra);
3721
 
}
3722
 
 
3723
 
static int meshdev_wx_enable_mesh(struct net_device *meshdev, 
3724
 
                               struct iw_request_info *info, 
3725
 
                               union iwreq_data *wrqu, char *extra)
3726
 
{
3727
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3728
 
        struct rtllib_device *ieee = mpriv->rtllib;
3729
 
        struct net_device *dev = ieee->dev;
3730
 
        
3731
 
printk("++++++======%s\n", __FUNCTION__);
3732
 
        return r8192_wx_enable_mesh(dev, info, wrqu, extra);
3733
 
        
3734
 
}
3735
 
 
3736
 
static int meshdev_wx_disable_mesh(struct net_device *meshdev, 
3737
 
                               struct iw_request_info *info, 
3738
 
                               union iwreq_data *wrqu, char *extra)
3739
 
{
3740
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3741
 
        struct rtllib_device *ieee = mpriv->rtllib;
3742
 
        struct net_device *dev = ieee->dev;
3743
 
        
3744
 
printk("++++++======%s\n", __FUNCTION__);
3745
 
        return r8192_wx_disable_mesh(dev, info, wrqu, extra);
3746
 
}
3747
 
 
3748
 
 
3749
 
int meshdev_wx_set_channel(struct net_device *meshdev, 
3750
 
                               struct iw_request_info *info, 
3751
 
                               union iwreq_data *wrqu, char *extra)
3752
 
{
3753
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3754
 
        struct rtllib_device *ieee = mpriv->rtllib;
3755
 
        struct net_device *dev = ieee->dev;
3756
 
printk("++++++======%s\n", __FUNCTION__);
3757
 
 
3758
 
        return r8192_wx_set_channel(dev, info, wrqu, extra);
3759
 
}
3760
 
 
3761
 
static int meshdev_wx_set_meshid(struct net_device *meshdev, 
3762
 
                               struct iw_request_info *info, 
3763
 
                               union iwreq_data *wrqu, char *extra)
3764
 
{       
3765
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3766
 
        struct rtllib_device *ieee = mpriv->rtllib;
3767
 
        struct net_device *dev = ieee->dev;
3768
 
printk("++++++======%s\n", __FUNCTION__);
3769
 
 
3770
 
        return r8192_wx_set_meshID(dev, info, wrqu, extra);     
3771
 
}
3772
 
 
3773
 
static int meshdev_wx_mesh_scan(struct net_device *meshdev, 
3774
 
                               struct iw_request_info *info, 
3775
 
                               union iwreq_data *wrqu, char *extra)
3776
 
{
3777
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3778
 
        struct rtllib_device *ieee = mpriv->rtllib;
3779
 
        struct net_device *dev = ieee->dev;
3780
 
 
3781
 
printk("++++++======%s\n", __FUNCTION__);
3782
 
        return r8192_wx_mesh_scan(dev, info, wrqu, extra);
3783
 
}
3784
 
static int meshdev_wx_get_mesh_list(struct net_device *meshdev, 
3785
 
                             struct iw_request_info *info, 
3786
 
                             union iwreq_data *wrqu, char *extra)
3787
 
{
3788
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3789
 
        struct rtllib_device *ieee = mpriv->rtllib;
3790
 
        struct net_device *dev = ieee->dev;
3791
 
printk("++++++======%s\n", __FUNCTION__);
3792
 
 
3793
 
        return r8192_wx_get_mesh_list(dev, info, wrqu, extra);
3794
 
}
3795
 
static int meshdev_wx_set_meshmode(struct net_device *meshdev, 
3796
 
                               struct iw_request_info *info, 
3797
 
                               union iwreq_data *wrqu, char *extra)
3798
 
{
3799
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3800
 
        struct rtllib_device *ieee = mpriv->rtllib;
3801
 
        struct net_device *dev = ieee->dev;
3802
 
 
3803
 
printk("++++++======%s\n", __FUNCTION__);
3804
 
        return r8192_wx_set_meshmode(dev, info, wrqu, extra);
3805
 
}
3806
 
static int meshdev_wx_set_meshbw(struct net_device *meshdev, 
3807
 
                               struct iw_request_info *info, 
3808
 
                               union iwreq_data *wrqu, char *extra)
3809
 
{
3810
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3811
 
        struct rtllib_device *ieee = mpriv->rtllib;
3812
 
        struct net_device *dev = ieee->dev;
3813
 
 
3814
 
printk("++++++======%s\n", __FUNCTION__);
3815
 
        return r8192_wx_set_meshBW(dev, info, wrqu, extra);
3816
 
}
3817
 
static int meshdev_wx_update_beacon(struct net_device *meshdev, 
3818
 
                               struct iw_request_info *info, 
3819
 
                               union iwreq_data *wrqu, char *extra)
3820
 
{
3821
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3822
 
        struct rtllib_device *ieee = mpriv->rtllib;
3823
 
        struct net_device *dev = ieee->dev;
3824
 
        struct r8192_priv *priv = rtllib_priv(dev);
3825
 
        struct mshclass *mshobj= (priv)->mshobj;
3826
 
        u8 updateBW = 0;
3827
 
        u8 bserverHT = 0;       
3828
 
        
3829
 
        printk("++++++======%s\n", __FUNCTION__);
3830
 
        if(*extra == 0)
3831
 
        {
3832
 
                ieee->p2pmode = 1;
3833
 
                ieee->current_network.channel = ieee->current_mesh_network.channel; 
3834
 
                if(ieee->state!=RTLLIB_LINKED){
3835
 
                        if(ieee->pHTInfo->bCurBW40MHz)
3836
 
                                HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20_40, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
3837
 
                        else
3838
 
                                HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
3839
 
                }
3840
 
        }
3841
 
        else
3842
 
        {
3843
 
                ieee->p2pmode = 0;
3844
 
                updateBW=mshobj->ext_patch_r819x_wx_update_beacon(dev,&bserverHT);
3845
 
                printk("$$$$$$ Cur_networ.chan=%d, cur_mesh_net.chan=%d,bserverHT=%d\n", ieee->current_network.channel,ieee->current_mesh_network.channel,bserverHT);
3846
 
                if(updateBW == 1)
3847
 
                {
3848
 
                        if(bserverHT == 0)
3849
 
                        {
3850
 
                                printk("===>server is not HT supported,set 20M\n");
3851
 
                                HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);  
3852
 
                        }
3853
 
                        else
3854
 
                        {
3855
 
                                printk("===>updateBW is 1,bCurBW40MHz is %d,ieee->serverExtChlOffset is %d\n",ieee->pHTInfo->bCurBW40MHz,ieee->serverExtChlOffset);             
3856
 
                                if(ieee->pHTInfo->bCurBW40MHz)
3857
 
                                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20_40, ieee->serverExtChlOffset);  
3858
 
                                else
3859
 
                                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, ieee->serverExtChlOffset);  
3860
 
                        }
3861
 
                }
3862
 
                else
3863
 
                {
3864
 
                        printk("===>there is no same hostname server, ERR!!!\n");
3865
 
                        return -1;
3866
 
                }
3867
 
        }
3868
 
#ifdef RTL8192SE
3869
 
        write_nic_dword(dev,BSSIDR,((u32*)priv->rtllib->current_mesh_network.bssid)[0]);
3870
 
        write_nic_word(dev,BSSIDR+4,((u16*)priv->rtllib->current_mesh_network.bssid)[2]);
3871
 
#elif defined RTL8192CE
3872
 
        write_nic_dword(dev,REG_BSSID,((u32*)priv->rtllib->current_mesh_network.bssid)[0]);
3873
 
        write_nic_word(dev,REG_BSSID+4,((u16*)priv->rtllib->current_mesh_network.bssid)[2]);
3874
 
#endif
3875
 
 
3876
 
        return 0;
3877
 
}
3878
 
static int meshdev_wx_add_mac_deny(struct net_device *meshdev, 
3879
 
                               struct iw_request_info *info, 
3880
 
                               union iwreq_data *wrqu, char *extra)
3881
 
{
3882
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3883
 
        struct rtllib_device *ieee = mpriv->rtllib;
3884
 
        struct net_device *dev = ieee->dev;
3885
 
        struct r8192_priv *priv = rtllib_priv(dev);
3886
 
        
3887
 
        
3888
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_add_mac_deny )
3889
 
                return 0;
3890
 
 
3891
 
        return priv->mshobj->ext_patch_r819x_wx_set_add_mac_deny(dev, info, wrqu, extra);
3892
 
}
3893
 
 
3894
 
static int meshdev_wx_del_mac_deny(struct net_device *meshdev, 
3895
 
                               struct iw_request_info *info, 
3896
 
                               union iwreq_data *wrqu, char *extra)
3897
 
{
3898
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3899
 
        struct rtllib_device *ieee = mpriv->rtllib;
3900
 
        struct net_device *dev = ieee->dev;
3901
 
        struct r8192_priv *priv = rtllib_priv(dev);
3902
 
        
3903
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_del_mac_deny )
3904
 
                return 0;
3905
 
 
3906
 
        return priv->mshobj->ext_patch_r819x_wx_set_del_mac_deny(dev, info, wrqu, extra);
3907
 
}
3908
 
 
3909
 
static int meshdev_wx_get_neighbor_list(struct net_device *meshdev, 
3910
 
                               struct iw_request_info *info, 
3911
 
                               union iwreq_data *wrqu, char *extra)
3912
 
{
3913
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3914
 
        struct rtllib_device *ieee = mpriv->rtllib;
3915
 
        struct net_device *dev = ieee->dev;
3916
 
        struct r8192_priv *priv = rtllib_priv(dev);
3917
 
        int ret = 0;
3918
 
 
3919
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_get_neighbor_list )
3920
 
                return 0;
3921
 
        ret = priv->mshobj->ext_patch_r819x_wx_get_neighbor_list(dev, info, wrqu, extra);
3922
 
#ifdef MESH_AUTO_TEST
3923
 
        ret |= r8192_wx_set_channel(dev, info, wrqu, &ieee->current_network.channel);
3924
 
#endif
3925
 
        return ret;
3926
 
}
3927
 
 
3928
 
/* reserved for future
3929
 
static int r819x_wx_get_mac_allow(struct net_device *dev, 
3930
 
                               struct iw_request_info *info, 
3931
 
                               union iwreq_data *wrqu, char *extra)
3932
 
{
3933
 
                return 0;
3934
 
 
3935
 
        return priv->mshobj->ext_patch_r819x_wx_get_mac_allow(dev, info, wrqu, extra);
3936
 
}
3937
 
*/
3938
 
 
3939
 
static int meshdev_wx_get_mac_deny(struct net_device *meshdev, 
3940
 
                               struct iw_request_info *info, 
3941
 
                               union iwreq_data *wrqu, char *extra)
3942
 
{
3943
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3944
 
        struct rtllib_device *ieee = mpriv->rtllib;
3945
 
        struct net_device *dev = ieee->dev;
3946
 
        struct r8192_priv *priv = rtllib_priv(dev);
3947
 
        
3948
 
        if( ! priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_get_mac_deny )
3949
 
                return 0;
3950
 
 
3951
 
        return priv->mshobj->ext_patch_r819x_wx_get_mac_deny(dev, info, wrqu, extra);
3952
 
}
3953
 
 
3954
 
 
3955
 
static int meshdev_wx_set_hostname(struct net_device *meshdev, 
3956
 
                               struct iw_request_info *info, 
3957
 
                               union iwreq_data *wrqu, char *extra)
3958
 
{
3959
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
3960
 
        struct rtllib_device *ieee = mpriv->rtllib;
3961
 
 
3962
 
        if(wrqu->data.length > MAX_HOST_NAME_LENGTH)
3963
 
        {
3964
 
                printk("%s: Host name is too long. len=%d\n", __FUNCTION__, wrqu->data.length);
3965
 
                return -1;
3966
 
        }
3967
 
 
3968
 
        ieee->hostname_len = wrqu->data.length;
3969
 
        memcpy(ieee->hostname, extra, wrqu->data.length);
3970
 
        
3971
 
printk("++++++======%s: %s\n", __FUNCTION__, ieee->hostname);
3972
 
 
3973
 
        return 0;
3974
 
}
3975
 
static int meshdev_wx_set_mesh_security(struct net_device *meshdev, 
3976
 
                               struct iw_request_info *info, 
3977
 
                               union iwreq_data *wrqu, char *extra)
3978
 
{
3979
 
        struct meshdev_priv *mpriv = netdev_priv(meshdev);
3980
 
        struct rtllib_device *ieee = mpriv->rtllib;
3981
 
        struct net_device *dev = ieee->dev;
3982
 
 
3983
 
        printk("++++++======%s\n", __FUNCTION__);
3984
 
        return r8192_wx_set_mesh_security(dev, info, wrqu, extra);
3985
 
}
3986
 
static int meshdev_wx_set_mkdd_id(struct net_device *meshdev, 
3987
 
                               struct iw_request_info *info, 
3988
 
                               union iwreq_data *wrqu, char *extra)
3989
 
{
3990
 
        struct meshdev_priv *mpriv = netdev_priv(meshdev);
3991
 
        struct rtllib_device *ieee = mpriv->rtllib;
3992
 
        struct net_device *dev = ieee->dev;
3993
 
        
3994
 
 
3995
 
        printk("++++++======%s\n", __FUNCTION__);
3996
 
        return r8192_wx_set_mkdd_id(dev, info, wrqu, extra);
3997
 
}
3998
 
static int meshdev_wx_set_mesh_key(struct net_device *meshdev, 
3999
 
                               struct iw_request_info *info, 
4000
 
                               union iwreq_data *wrqu, char *extra)
4001
 
{
4002
 
        struct meshdev_priv *mpriv = netdev_priv(meshdev);
4003
 
        struct rtllib_device *ieee = mpriv->rtllib;
4004
 
        struct net_device *dev = ieee->dev;
4005
 
 
4006
 
        printk("++++++======%s\n", __FUNCTION__);
4007
 
        return r8192_wx_set_mesh_key(dev, info, wrqu, extra);
4008
 
}
4009
 
static int meshdev_wx_set_sec_type(struct net_device *meshdev, 
4010
 
                               struct iw_request_info *info, 
4011
 
                               union iwreq_data *wrqu, char *extra)
4012
 
{
4013
 
        struct meshdev_priv *mpriv = netdev_priv(meshdev);
4014
 
        struct rtllib_device *ieee = mpriv->rtllib;
4015
 
        struct net_device *dev = ieee->dev;
4016
 
 
4017
 
        printk("++++++======%s\n", __FUNCTION__);
4018
 
        return r8192_wx_set_mesh_sec_type(dev, info, wrqu, extra);
4019
 
}
4020
 
static u8 my_atoi(const char *arg)
4021
 
{
4022
 
        u8 val = 0;
4023
 
        for(; ; arg++){
4024
 
                switch (*arg){
4025
 
                        case '0'...'9':
4026
 
                                val = 10*val + (*arg-'0');
4027
 
                                break;
4028
 
                        default:
4029
 
                                return val;
4030
 
                }
4031
 
        }
4032
 
        return val;
4033
 
}
4034
 
 
4035
 
static int Set_Channel_Proc(struct net_device *meshdev, char *arg)
4036
 
{
4037
 
        int ch = my_atoi(arg);
4038
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4039
 
        struct rtllib_device *ieee = mpriv->rtllib;
4040
 
        struct r8192_priv *priv = (void *)ieee->priv;
4041
 
        struct net_device *dev = ieee->dev;
4042
 
 
4043
 
        if (!priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_set_channel || !ieee->only_mesh)
4044
 
                return 0;       
4045
 
                        
4046
 
printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!set current mesh network channel %d\n", ch);
4047
 
        if ( ch < 0 )   
4048
 
        {
4049
 
                rtllib_start_scan(ieee);                        
4050
 
                ieee->meshScanMode =2;
4051
 
        }
4052
 
        else    
4053
 
        {       
4054
 
                ieee->meshScanMode =0;          
4055
 
                if(priv->mshobj->ext_patch_r819x_wx_set_channel)
4056
 
                {
4057
 
                        priv->mshobj->ext_patch_r819x_wx_set_channel(ieee, ch);
4058
 
                        priv->mshobj->ext_patch_r819x_wx_set_mesh_chan(dev,ch);
4059
 
                }
4060
 
                queue_work_rsl(ieee->wq, &ieee->ext_stop_scan_wq);
4061
 
                ieee->set_chan(ieee->dev, ch);
4062
 
                ieee->current_mesh_network.channel = ch;
4063
 
                if(ieee->only_mesh)
4064
 
                        ieee->current_network.channel = ch;
4065
 
                ieee->current_network.channel = ieee->current_mesh_network.channel; 
4066
 
                if(ieee->pHTInfo->bCurBW40MHz)
4067
 
                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20_40, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
4068
 
                else
4069
 
                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, (ieee->current_mesh_network.channel<=6)?HT_EXTCHNL_OFFSET_UPPER:HT_EXTCHNL_OFFSET_LOWER);  
4070
 
                if(rtllib_act_scanning(ieee,true) == true)
4071
 
                        rtllib_stop_scan_syncro(ieee);
4072
 
        }
4073
 
        return 0;               
4074
 
}
4075
 
static int Set_MeshID_Proc(struct net_device *meshdev, char *arg)
4076
 
{
4077
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4078
 
        struct rtllib_device *ieee = mpriv->rtllib;
4079
 
        struct net_device *dev = ieee->dev;
4080
 
        struct r8192_priv *priv = rtllib_priv(dev);
4081
 
        RT_RF_POWER_STATE       rtState;
4082
 
        int ret = 0;
4083
 
        rtState = priv->rtllib->eRFPowerState;
4084
 
        
4085
 
        if(!priv->mshobj || !priv->mshobj->ext_patch_r819x_wx_enable_mesh || !priv->mshobj->ext_patch_r819x_wx_set_meshID)
4086
 
                return 0;
4087
 
 
4088
 
        if(rtllib_act_scanning(ieee,true) == true)
4089
 
                rtllib_stop_scan_syncro(ieee);
4090
 
        
4091
 
        /* Set Mesh ID */
4092
 
        ret = priv->mshobj->ext_patch_r819x_wx_set_meshID(dev, arg);
4093
 
        if(ret)
4094
 
                goto End;
4095
 
        
4096
 
        /* Enable Mesh */
4097
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
4098
 
        ret = priv->mshobj->ext_patch_r819x_wx_enable_mesh(dev);
4099
 
        if(!ret)
4100
 
        {
4101
 
#ifdef ENABLE_IPS
4102
 
                if(priv->rtllib->PowerSaveControl.bInactivePs){
4103
 
                        if(rtState == eRfOff){
4104
 
                                if(priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS)
4105
 
                                {
4106
 
                                        RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__);
4107
 
                                        SEM_UP_PRIV_WX(&priv->wx_sem);  
4108
 
                                        return -1;
4109
 
                                }
4110
 
                                else{
4111
 
                                        printk("=========>%s(): IPSLeave\n",__FUNCTION__);
4112
 
                                        IPSLeave(dev);
4113
 
                                }
4114
 
                        }
4115
 
                }
4116
 
#endif
4117
 
        }
4118
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
4119
 
#if 1
4120
 
        if (ieee->mesh_sec_type == 1) { 
4121
 
                rtl8192_abbr_handshk_set_GTK(ieee,1);
4122
 
        }
4123
 
#else
4124
 
        if (ieee->mesh_sec_type == 1)   
4125
 
                rtl8192_abbr_handshk_set_key(ieee); 
4126
 
#endif
4127
 
End:
4128
 
        return ret;     
4129
 
}
4130
 
static int Set_Bw40MHz_Proc(struct net_device *meshdev, char *arg)
4131
 
{
4132
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4133
 
        struct rtllib_device *ieee = mpriv->rtllib;
4134
 
        struct r8192_priv *priv = (void *)ieee->priv;
4135
 
        u8 bBw40MHz = my_atoi(arg);
4136
 
 
4137
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
4138
 
        printk("%s(): set mesh BW ! extra is %d\n",__FUNCTION__, bBw40MHz);
4139
 
        priv->rtllib->pHTInfo->bRegBW40MHz = bBw40MHz;
4140
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
4141
 
 
4142
 
        return 0;
4143
 
}
4144
 
static int Set_WirelessMode_Proc(struct net_device *meshdev, char *arg)
4145
 
{
4146
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4147
 
        struct rtllib_device *ieee = mpriv->rtllib;
4148
 
        struct r8192_priv *priv = (void *)ieee->priv;
4149
 
        struct net_device *dev = ieee->dev;
4150
 
        u8 wirelessmode = my_atoi(arg);
4151
 
 
4152
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
4153
 
 
4154
 
        printk("%s(): set mesh mode ! extra is %d\n",__FUNCTION__, wirelessmode);
4155
 
        if((wirelessmode != WIRELESS_MODE_A) && (wirelessmode != WIRELESS_MODE_B) && 
4156
 
                (wirelessmode != WIRELESS_MODE_G) && (wirelessmode != WIRELESS_MODE_AUTO) &&
4157
 
                (wirelessmode != WIRELESS_MODE_N_24G) && (wirelessmode != WIRELESS_MODE_N_5G))
4158
 
        {
4159
 
                printk("ERR!! you should input 1 | 2 | 4 | 8 | 16 | 32\n");
4160
 
                SEM_UP_PRIV_WX(&priv->wx_sem);  
4161
 
                return -1;
4162
 
        }
4163
 
        if(priv->rtllib->state == RTLLIB_LINKED)
4164
 
        {
4165
 
                if((priv->rtllib->mode != WIRELESS_MODE_N_5G) && (priv->rtllib->mode != WIRELESS_MODE_N_24G)){
4166
 
                        printk("===>wlan0 is linked,and ieee->mode is not N mode ,do not need to set mode,return\n");
4167
 
                        SEM_UP_PRIV_WX(&priv->wx_sem);  
4168
 
                        return 0;
4169
 
                }
4170
 
        }
4171
 
        priv->rtllib->mode = wirelessmode;
4172
 
        if(priv->ResetProgress == RESET_TYPE_NORESET)
4173
 
                rtl8192_SetWirelessMode(dev, priv->rtllib->mode);
4174
 
        HTUseDefaultSetting(priv->rtllib);
4175
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
4176
 
        return 0;
4177
 
}
4178
 
static int Set_ExtChnOffset_Proc(struct net_device *meshdev, char *arg)
4179
 
{
4180
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4181
 
        struct rtllib_device *ieee = mpriv->rtllib;
4182
 
#if 0
4183
 
        struct r8192_priv *priv = (void *)ieee->priv;
4184
 
        struct net_device *dev = ieee->dev;
4185
 
        struct mshclass *mshobj= priv->mshobj;
4186
 
        u8 updateBW = 0;
4187
 
        u8 bserverHT = 0;       
4188
 
#endif
4189
 
        ieee->p2pmode = 0;      
4190
 
#if 0
4191
 
        updateBW=mshobj->ext_patch_r819x_wx_update_beacon(dev,&bserverHT);
4192
 
        printk("$$$$$$ Cur_networ.chan=%d, cur_mesh_net.chan=%d,bserverHT=%d\n", ieee->current_network.channel,ieee->current_mesh_network.channel,bserverHT);
4193
 
        if(updateBW == 1)
4194
 
        {
4195
 
                if(bserverHT == 0)
4196
 
                {
4197
 
                        printk("===>server is not HT supported,set 20M\n");
4198
 
                        HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT);  
4199
 
                }
4200
 
                else
4201
 
                {
4202
 
                        printk("===>updateBW is 1,bCurBW40MHz is %d,ieee->serverExtChlOffset is %d\n",ieee->pHTInfo->bCurBW40MHz,ieee->serverExtChlOffset);             
4203
 
                        if(ieee->pHTInfo->bCurBW40MHz)
4204
 
                                HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20_40, ieee->serverExtChlOffset);  
4205
 
                        else
4206
 
                                HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, ieee->serverExtChlOffset);  
4207
 
                }
4208
 
        }
4209
 
        else
4210
 
        {
4211
 
                printk("===>there is no same hostname server, ERR!!!\n");
4212
 
                return -1;
4213
 
        }
4214
 
#endif
4215
 
        return 0;
4216
 
}
4217
 
static int Set_OnlyMesh_Proc(struct net_device *meshdev, char *arg)
4218
 
{
4219
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4220
 
        struct rtllib_device *ieee = mpriv->rtllib;
4221
 
        union iwreq_data tmprqu;
4222
 
        int ret = 0;
4223
 
 
4224
 
        ieee->p2pmode = 1;      
4225
 
        ieee->only_mesh = my_atoi(arg);
4226
 
printk("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!mesh only = %d, p2pmode = %d\n", ieee->only_mesh, ieee->p2pmode);
4227
 
        if(ieee->only_mesh)
4228
 
                ieee->current_network.channel = ieee->current_mesh_network.channel;
4229
 
        if(ieee->only_mesh == 0)
4230
 
        {
4231
 
                tmprqu.mode = ieee->iw_mode;
4232
 
                ieee->iw_mode = IW_MODE_INFRA; 
4233
 
                ret = rtllib_wx_set_mode(ieee, NULL, &tmprqu, NULL);
4234
 
        }
4235
 
        return ret;
4236
 
}
4237
 
static int Set_AsPortal_Proc(struct net_device *meshdev, char *arg)
4238
 
{
4239
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4240
 
        struct rtllib_device *ieee = mpriv->rtllib;
4241
 
        struct net_device *dev = ieee->dev;
4242
 
        struct r8192_priv *priv = (void *)ieee->priv;
4243
 
        u8 val = my_atoi(arg);
4244
 
        int ret = 0;
4245
 
 
4246
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
4247
 
        ret = priv->mshobj->ext_patch_r819x_wx_set_AsPortal(dev, val);
4248
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
4249
 
 
4250
 
        return ret;
4251
 
}
4252
 
static int Set_AsRoot_Proc(struct net_device *meshdev, char *arg)
4253
 
{
4254
 
        struct meshdev_priv *mpriv = (struct meshdev_priv *)netdev_priv_rsl(meshdev);
4255
 
        struct rtllib_device *ieee = mpriv->rtllib;
4256
 
        struct net_device *dev = ieee->dev;
4257
 
        struct r8192_priv *priv = (void *)ieee->priv;
4258
 
        u8 val = my_atoi(arg);
4259
 
        int ret = 0;
4260
 
 
4261
 
        SEM_DOWN_PRIV_WX(&priv->wx_sem);        
4262
 
        ret = priv->mshobj->ext_patch_r819x_wx_set_AsRoot(dev, val);
4263
 
        SEM_UP_PRIV_WX(&priv->wx_sem);  
4264
 
 
4265
 
        return ret;
4266
 
}
4267
 
 
4268
 
static struct {
4269
 
        char* name;
4270
 
        int (*set_proc)(struct net_device *dev, char *arg);
4271
 
} *private_set_proc, private_support_proc[] = {
4272
 
        {"Debug",                               NULL},
4273
 
        {"Channel",                             Set_Channel_Proc},            
4274
 
        {"MeshId",                              Set_MeshID_Proc},
4275
 
        {"Bw40MHz",                             Set_Bw40MHz_Proc},
4276
 
        {"WirelessMode",                        Set_WirelessMode_Proc},
4277
 
        {"ExtChnOffset",                        Set_ExtChnOffset_Proc},
4278
 
        {"OnlyMesh",                            Set_OnlyMesh_Proc},
4279
 
        {"AsPortal",                            Set_AsPortal_Proc},
4280
 
        {"AsRoot",                              Set_AsRoot_Proc},
4281
 
        {"MeshAuthMode",                        NULL},       
4282
 
        {"MeshEncrypType",                      NULL},  
4283
 
        {"<NULL>",                              NULL},
4284
 
};
4285
 
 
4286
 
static char *rtlstrchr(const char *s, int c)
4287
 
{
4288
 
        for(; *s!=(char)c; ++s)
4289
 
                if(*s == '\0')
4290
 
                        return NULL;
4291
 
        return (char *)s;
4292
 
}
4293
 
 
4294
 
static int meshdev_wx_set_param(struct net_device *dev, struct iw_request_info *info,
4295
 
                               union iwreq_data *w, char *extra)
4296
 
{
4297
 
        char * this_char = extra;
4298
 
        char *value = NULL;
4299
 
        int  Status=0;
4300
 
 
4301
 
        printk("=======>%s: extra=%s\n", __FUNCTION__,extra);
4302
 
        if (!*this_char)
4303
 
                return -EINVAL; 
4304
 
        
4305
 
        if ((value = rtlstrchr(this_char, '=')) != NULL)
4306
 
                *value++ = 0;
4307
 
 
4308
 
        for (private_set_proc = private_support_proc; strcmp(private_set_proc->name, "<NULL>"); private_set_proc++)            
4309
 
        {
4310
 
                if (strcmp(this_char, private_set_proc->name) == 0)
4311
 
                {
4312
 
                        if(private_set_proc->set_proc)
4313
 
                        {
4314
 
                                if(private_set_proc->set_proc(dev, value))
4315
 
                                {       
4316
 
                                        Status = -EINVAL;
4317
 
                                }
4318
 
                        }
4319
 
                        break;  
4320
 
                }
4321
 
        }
4322
 
        
4323
 
        if(strcmp(private_set_proc->name, "<NULL>") == 0)
4324
 
        {  
4325
 
                Status = -EINVAL;
4326
 
                printk("===>%s: (iwpriv) Not Support Set Command [%s]", __FUNCTION__, this_char);
4327
 
                if(value != NULL)
4328
 
                        printk(" value=%s\n", value);
4329
 
                else
4330
 
                        printk("\n");
4331
 
        }
4332
 
        
4333
 
        return Status;
4334
 
}
4335
 
 
4336
 
 
4337
 
static iw_handler meshdev_private_handler[] = {
4338
 
        meshdev_wx_enable_mesh,         
4339
 
        meshdev_wx_get_meshinfo,                
4340
 
        meshdev_wx_disable_mesh,                
4341
 
        meshdev_wx_set_channel,                 
4342
 
        meshdev_wx_set_meshid,                  
4343
 
        meshdev_wx_get_mesh_list,               
4344
 
        meshdev_wx_mesh_scan,                   
4345
 
        meshdev_wx_set_meshmode,                
4346
 
        meshdev_wx_set_hostname,                
4347
 
        meshdev_wx_set_meshbw,                  
4348
 
        meshdev_wx_update_beacon,               
4349
 
        meshdev_wx_get_mac_deny,                
4350
 
        meshdev_wx_add_mac_deny,                
4351
 
        NULL,                                   
4352
 
        NULL,
4353
 
        meshdev_wx_get_neighbor_list,           
4354
 
        meshdev_wx_set_param,                   
4355
 
        NULL,                                   
4356
 
        meshdev_wx_del_mac_deny,                
4357
 
        NULL,                                                   
4358
 
        meshdev_wx_set_mesh_security,           
4359
 
        meshdev_wx_set_mkdd_id,                 
4360
 
        meshdev_wx_set_mesh_key,                        
4361
 
        meshdev_wx_set_sec_type,                
4362
 
};
4363
 
 
4364
 
struct iw_handler_def  meshdev_wx_handlers_def={
4365
 
        .standard = meshdev_wx_handlers,
4366
 
        .num_standard = sizeof(meshdev_wx_handlers) / sizeof(iw_handler),
4367
 
        .private = meshdev_private_handler,
4368
 
        .num_private = sizeof(meshdev_private_handler) / sizeof(iw_handler),
4369
 
        .num_private_args = sizeof(meshdev_private_args) / sizeof(struct iw_priv_args),
4370
 
#if WIRELESS_EXT >= 17  
4371
 
        .get_wireless_stats = (void*)meshdev_stats,
4372
 
#endif
4373
 
        .private_args = (struct iw_priv_args *)meshdev_private_args,    
4374
 
};
4375
 
#endif
4376