etherwpi: dont enable transmit power for invalid channels, add multicast stub

This commit is contained in:
cinap_lenrek 2015-07-11 02:33:16 +02:00
parent 266057f0da
commit b4f9ca6c97

View file

@ -273,7 +273,7 @@ struct Ctlr {
Powergrp pwrgrps[5]; Powergrp pwrgrps[5];
} eeprom; } eeprom;
char maxpwr[255]; char maxpwr[256];
Shared *shared; Shared *shared;
@ -535,6 +535,7 @@ wpiinit(Ether *edev)
goto Err; goto Err;
memmove(edev->ea, b, Eaddrlen); memmove(edev->ea, b, Eaddrlen);
memset(ctlr->maxpwr, 0, sizeof(ctlr->maxpwr));
for(i = 0; i < nelem(bands); i++){ for(i = 0; i < nelem(bands); i++){
if((err = eepromread(ctlr, b, 2*bands[i].nchan, bands[i].addr)) != nil) if((err = eepromread(ctlr, b, 2*bands[i].nchan, bands[i].addr)) != nil)
goto Err; goto Err;
@ -1348,19 +1349,21 @@ rxon(Ether *edev, Wnode *bss)
return; return;
} }
/* tx power */ if(ctlr->maxpwr[ctlr->channel] != 0){
memset(p = c, 0, sizeof(c)); /* tx power */
*p++ = 1; /* band (0 = 5ghz) */ memset(p = c, 0, sizeof(c));
p++; /* reserved */ *p++ = 1; /* band (0 = 5ghz) */
put16(p, ctlr->channel), p += 2; p++; /* reserved */
for(rate = 0; rate < nelem(ratetab); rate++){ put16(p, ctlr->channel), p += 2;
idx = pwridx(ctlr, &ctlr->eeprom.pwrgrps[0], ctlr->channel, rate); for(rate = 0; rate < nelem(ratetab); rate++){
*p++ = ratetab[rate].plcp; idx = pwridx(ctlr, &ctlr->eeprom.pwrgrps[0], ctlr->channel, rate);
*p++ = rfgain_2ghz[idx]; /* rf_gain */ *p++ = ratetab[rate].plcp;
*p++ = dspgain_2ghz[idx]; /* dsp_gain */ *p++ = rfgain_2ghz[idx]; /* rf_gain */
p++; /* reservd */ *p++ = dspgain_2ghz[idx]; /* dsp_gain */
p++; /* reservd */
}
cmd(ctlr, 151, c, p - c);
} }
cmd(ctlr, 151, c, p - c);
if(ctlr->bcastnodeid == -1){ if(ctlr->bcastnodeid == -1){
ctlr->bcastnodeid = 24; ctlr->bcastnodeid = 24;
@ -1525,6 +1528,11 @@ wpipromiscuous(void *arg, int on)
qunlock(ctlr); qunlock(ctlr);
} }
static void
wpimulticast(void *, uchar*, int)
{
}
static void static void
wpirecover(void *arg) wpirecover(void *arg)
{ {
@ -1846,7 +1854,7 @@ again:
edev->ctl = wpictl; edev->ctl = wpictl;
edev->shutdown = wpishutdown; edev->shutdown = wpishutdown;
edev->promiscuous = wpipromiscuous; edev->promiscuous = wpipromiscuous;
edev->multicast = nil; edev->multicast = wpimulticast;
edev->mbps = 54; edev->mbps = 54;
if(wpiinit(edev) < 0){ if(wpiinit(edev) < 0){