ether82563: fix multicast filter (based on openbsd em(4) driver)

This commit is contained in:
cinap_lenrek 2015-07-12 19:21:53 +02:00
parent cbd1ca6877
commit a5efa0e252

View file

@ -749,12 +749,24 @@ i82563multicast(void *arg, uchar *addr, int on)
edev = arg; edev = arg;
ctlr = edev->ctlr; ctlr = edev->ctlr;
x = addr[5]>>1; switch(ctlr->type){
if(ctlr->type == i82566) case i82566:
x &= 31; case i82567:
if(ctlr->type == i218) case i82567m:
x &= 15; case i82577:
bit = ((addr[5] & 1)<<4)|(addr[4]>>4); case i82577m:
case i82579:
case i218:
bit = (addr[5]<<2)|(addr[4]>>6);
x = (bit>>5) & 31;
break;
default:
bit = (addr[5]<<4)|(addr[4]>>4);
x = (bit>>5) & 127;
break;
}
bit &= 31;
/* /*
* multiple ether addresses can hash to the same filter bit, * multiple ether addresses can hash to the same filter bit,
* so it's never safe to clear a filter bit. * so it's never safe to clear a filter bit.
@ -764,8 +776,6 @@ i82563multicast(void *arg, uchar *addr, int on)
*/ */
if(on) if(on)
ctlr->mta[x] |= 1<<bit; ctlr->mta[x] |= 1<<bit;
// else
// ctlr->mta[x] &= ~(1<<bit);
csr32w(ctlr, Mta+x*4, ctlr->mta[x]); csr32w(ctlr, Mta+x*4, ctlr->mta[x]);
} }