mirror of https://gitee.com/openkylin/linux.git
DM9000: Remove cal_CRC() and use ether_crc_le instead
Remove the cal_CRC as this is basically wrappering the ether_crc_le function, and is only being used by the multicast hash table functions. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
parent
39c341a8dc
commit
d39cb7866e
|
@ -1154,24 +1154,6 @@ dm9000_write_eeprom(board_info_t *db, int offset, u8 *data)
|
||||||
mutex_unlock(&db->addr_lock);
|
mutex_unlock(&db->addr_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Calculate the CRC valude of the Rx packet
|
|
||||||
* flag = 1 : return the reverse CRC (for the received packet CRC)
|
|
||||||
* 0 : return the normal CRC (for Hash Table index)
|
|
||||||
*/
|
|
||||||
|
|
||||||
static unsigned long
|
|
||||||
cal_CRC(unsigned char *Data, unsigned int Len, u8 flag)
|
|
||||||
{
|
|
||||||
|
|
||||||
u32 crc = ether_crc_le(Len, Data);
|
|
||||||
|
|
||||||
if (flag)
|
|
||||||
return ~crc;
|
|
||||||
|
|
||||||
return crc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set DM9000 multicast address
|
* Set DM9000 multicast address
|
||||||
*/
|
*/
|
||||||
|
@ -1181,15 +1163,16 @@ dm9000_hash_table(struct net_device *dev)
|
||||||
board_info_t *db = (board_info_t *) dev->priv;
|
board_info_t *db = (board_info_t *) dev->priv;
|
||||||
struct dev_mc_list *mcptr = dev->mc_list;
|
struct dev_mc_list *mcptr = dev->mc_list;
|
||||||
int mc_cnt = dev->mc_count;
|
int mc_cnt = dev->mc_count;
|
||||||
|
int i, oft;
|
||||||
u32 hash_val;
|
u32 hash_val;
|
||||||
u16 i, oft, hash_table[4];
|
u16 hash_table[4];
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
dm9000_dbg(db, 1, "entering %s\n", __func__);
|
dm9000_dbg(db, 1, "entering %s\n", __func__);
|
||||||
|
|
||||||
spin_lock_irqsave(&db->lock, flags);
|
spin_lock_irqsave(&db->lock, flags);
|
||||||
|
|
||||||
for (i = 0, oft = 0x10; i < 6; i++, oft++)
|
for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
|
||||||
iow(db, oft, dev->dev_addr[i]);
|
iow(db, oft, dev->dev_addr[i]);
|
||||||
|
|
||||||
/* Clear Hash Table */
|
/* Clear Hash Table */
|
||||||
|
@ -1201,14 +1184,14 @@ dm9000_hash_table(struct net_device *dev)
|
||||||
|
|
||||||
/* the multicast address in Hash Table : 64 bits */
|
/* the multicast address in Hash Table : 64 bits */
|
||||||
for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
|
for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
|
||||||
hash_val = cal_CRC((char *) mcptr->dmi_addr, 6, 0) & 0x3f;
|
hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f;
|
||||||
hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
|
hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the hash table to MAC MD table */
|
/* Write the hash table to MAC MD table */
|
||||||
for (i = 0, oft = 0x16; i < 4; i++) {
|
for (i = 0, oft = DM9000_MAR; i < 4; i++) {
|
||||||
iow(db, oft++, hash_table[i] & 0xff);
|
iow(db, oft++, hash_table[i]);
|
||||||
iow(db, oft++, (hash_table[i] >> 8) & 0xff);
|
iow(db, oft++, hash_table[i] >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irqrestore(&db->lock, flags);
|
spin_unlock_irqrestore(&db->lock, flags);
|
||||||
|
|
Loading…
Reference in New Issue