vxworks+arm9,多播过滤的问题?
使用的vx5.5+at91rm9200
有两个hash寄存器:EMAC_HSH和EMAC_HSL,用哈希算法填写他们,可是设置了这两个寄存器后网卡起不到过滤作用,所有经过网卡的数据全都能收到,有谁调过这个片子上的驱动吗?希望给指点下,到底哪儿出了问题?
我把这部分代码贴上来,麻烦大家帮我看看,红色部分是调用ether_crc()函数的地方,其中ETH_ALEN=14,我总觉得这个ETH_ALEN应该等于6,但不知道怎么求证?
[color=#FF0000]crc_ret = ether_crc(ETH_ALEN, pAddr); bitnr = crc_ret >> 26;mc_filter[bitnr >> 5] |= 1 << (bitnr & 31);regs->EMAC_HSH |= mc_filter[1]; regs->EMAC_HSL |= mc_filter[0];[/color]#define ether_crc(length, data) bitreverse(crc32_le(~0, data, length))unsigned long bitreverse(unsigned long x){ x = (x >> 16) | (x << 16); x = (x >> 8 & 0x00ff00ff) | (x << 8 & 0xff00ff00); x = (x >> 4 & 0x0f0f0f0f) | (x << 4 & 0xf0f0f0f0); x = (x >> 2 & 0x33333333) | (x << 2 & 0xcccccccc); x = (x >> 1 & 0x55555555) | (x << 1 & 0xaaaaaaaa); return x;}#include "crc32table.h"unsigned long crc32_le(unsigned long crc, unsigned char const *p, int len){ const unsigned long *b =(unsigned long *)p; const unsigned long *tab = crc32table_le;logMsg("\n@@@@@ in crc = %ld\n", crc,0,0,0,0,0);// #define DO_CRC(x) crc = tab[ (crc ^ (x)) & 255 ] ^ (crc>>8) /* Align it */ if(!(((long)b)&3 && len)){ do { DO_CRC(*((unsigned char *)b)++); } while ((--len) && ((long)b)&3 ); } if((len >= 4)){ /* load data 32 bits wide, xor data 32 bits wide. */ size_t save_len = len & 3; len = len >> 2; --b; /* use pre increment below(*++b) for speed */ do { crc ^= *++b; DO_CRC(0); DO_CRC(0); DO_CRC(0); DO_CRC(0); } while (--len); b++; /* point to next byte(s) */ len = save_len; } /* And the last few bytes */ if(len){ do { DO_CRC(*((unsigned char *)b)++); } while (--len); }logMsg("\n@@@@@ crc = %ld\n", crc,0,0,0,0,0);// return (crc);#undef ENDIAN_SHIFT#undef DO_CRC}