aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-02-04 19:02:18 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-11 11:06:34 -0500
commitd39cb7866e5f6ff32ed4d99cc3fcd19bda701492 (patch)
treec225f7d4f5133b3237f68088aed4ab4c262ad84b /drivers/net
parent39c341a8dcf060b246b0beddac90cd7de11d4a20 (diff)
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/dm9000.c35
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
index 1d790a8e3a98..2259605131cf 100644
--- a/drivers/net/dm9000.c
+++ b/drivers/net/dm9000.c
@@ -1155,24 +1155,6 @@ dm9000_write_eeprom(board_info_t *db, int offset, u8 *data)
1155} 1155}
1156 1156
1157/* 1157/*
1158 * Calculate the CRC valude of the Rx packet
1159 * flag = 1 : return the reverse CRC (for the received packet CRC)
1160 * 0 : return the normal CRC (for Hash Table index)
1161 */
1162
1163static unsigned long
1164cal_CRC(unsigned char *Data, unsigned int Len, u8 flag)
1165{
1166
1167 u32 crc = ether_crc_le(Len, Data);
1168
1169 if (flag)
1170 return ~crc;
1171
1172 return crc;
1173}
1174
1175/*
1176 * Set DM9000 multicast address 1158 * Set DM9000 multicast address
1177 */ 1159 */
1178static void 1160static void
@@ -1181,15 +1163,16 @@ dm9000_hash_table(struct net_device *dev)
1181 board_info_t *db = (board_info_t *) dev->priv; 1163 board_info_t *db = (board_info_t *) dev->priv;
1182 struct dev_mc_list *mcptr = dev->mc_list; 1164 struct dev_mc_list *mcptr = dev->mc_list;
1183 int mc_cnt = dev->mc_count; 1165 int mc_cnt = dev->mc_count;
1166 int i, oft;
1184 u32 hash_val; 1167 u32 hash_val;
1185 u16 i, oft, hash_table[4]; 1168 u16 hash_table[4];
1186 unsigned long flags; 1169 unsigned long flags;
1187 1170
1188 dm9000_dbg(db, 1, "entering %s\n", __func__); 1171 dm9000_dbg(db, 1, "entering %s\n", __func__);
1189 1172
1190 spin_lock_irqsave(&db->lock,flags); 1173 spin_lock_irqsave(&db->lock, flags);
1191 1174
1192 for (i = 0, oft = 0x10; i < 6; i++, oft++) 1175 for (i = 0, oft = DM9000_PAR; i < 6; i++, oft++)
1193 iow(db, oft, dev->dev_addr[i]); 1176 iow(db, oft, dev->dev_addr[i]);
1194 1177
1195 /* Clear Hash Table */ 1178 /* Clear Hash Table */
@@ -1201,17 +1184,17 @@ dm9000_hash_table(struct net_device *dev)
1201 1184
1202 /* the multicast address in Hash Table : 64 bits */ 1185 /* the multicast address in Hash Table : 64 bits */
1203 for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) { 1186 for (i = 0; i < mc_cnt; i++, mcptr = mcptr->next) {
1204 hash_val = cal_CRC((char *) mcptr->dmi_addr, 6, 0) & 0x3f; 1187 hash_val = ether_crc_le(6, mcptr->dmi_addr) & 0x3f;
1205 hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16); 1188 hash_table[hash_val / 16] |= (u16) 1 << (hash_val % 16);
1206 } 1189 }
1207 1190
1208 /* Write the hash table to MAC MD table */ 1191 /* Write the hash table to MAC MD table */
1209 for (i = 0, oft = 0x16; i < 4; i++) { 1192 for (i = 0, oft = DM9000_MAR; i < 4; i++) {
1210 iow(db, oft++, hash_table[i] & 0xff); 1193 iow(db, oft++, hash_table[i]);
1211 iow(db, oft++, (hash_table[i] >> 8) & 0xff); 1194 iow(db, oft++, hash_table[i] >> 8);
1212 } 1195 }
1213 1196
1214 spin_unlock_irqrestore(&db->lock,flags); 1197 spin_unlock_irqrestore(&db->lock, flags);
1215} 1198}
1216 1199
1217 1200