if_udav.c (194677) | if_udav.c (195049) |
---|---|
1/* $NetBSD: if_udav.c,v 1.2 2003/09/04 15:17:38 tsutsui Exp $ */ 2/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ | 1/* $NetBSD: if_udav.c,v 1.2 2003/09/04 15:17:38 tsutsui Exp $ */ 2/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ |
3/* $FreeBSD: head/sys/dev/usb/net/if_udav.c 194677 2009-06-23 02:19:59Z thompsa $ */ | 3/* $FreeBSD: head/sys/dev/usb/net/if_udav.c 195049 2009-06-26 11:45:06Z rwatson $ */ |
4/*- 5 * Copyright (c) 2003 6 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright --- 27 unchanged lines hidden (view full) --- 39 40/* 41 * TODO: 42 * Interrupt Endpoint support 43 * External PHYs 44 */ 45 46#include <sys/cdefs.h> | 4/*- 5 * Copyright (c) 2003 6 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright --- 27 unchanged lines hidden (view full) --- 39 40/* 41 * TODO: 42 * Interrupt Endpoint support 43 * External PHYs 44 */ 45 46#include <sys/cdefs.h> |
47__FBSDID("$FreeBSD: head/sys/dev/usb/net/if_udav.c 194677 2009-06-23 02:19:59Z thompsa $"); | 47__FBSDID("$FreeBSD: head/sys/dev/usb/net/if_udav.c 195049 2009-06-26 11:45:06Z rwatson $"); |
48 49#include <sys/stdint.h> 50#include <sys/stddef.h> 51#include <sys/param.h> 52#include <sys/queue.h> 53#include <sys/types.h> 54#include <sys/systm.h> 55#include <sys/kernel.h> --- 433 unchanged lines hidden (view full) --- 489 } 490 491 /* first, zot all the existing hash bits */ 492 memset(hashtbl, 0x00, sizeof(hashtbl)); 493 hashtbl[7] |= 0x80; /* broadcast address */ 494 udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl)); 495 496 /* now program new ones */ | 48 49#include <sys/stdint.h> 50#include <sys/stddef.h> 51#include <sys/param.h> 52#include <sys/queue.h> 53#include <sys/types.h> 54#include <sys/systm.h> 55#include <sys/kernel.h> --- 433 unchanged lines hidden (view full) --- 489 } 490 491 /* first, zot all the existing hash bits */ 492 memset(hashtbl, 0x00, sizeof(hashtbl)); 493 hashtbl[7] |= 0x80; /* broadcast address */ 494 udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl)); 495 496 /* now program new ones */ |
497 IF_ADDR_LOCK(ifp); | 497 if_maddr_rlock(ifp); |
498 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) 499 { 500 if (ifma->ifma_addr->sa_family != AF_LINK) 501 continue; 502 h = ether_crc32_be(LLADDR((struct sockaddr_dl *) 503 ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; 504 hashtbl[h / 8] |= 1 << (h % 8); 505 } | 498 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) 499 { 500 if (ifma->ifma_addr->sa_family != AF_LINK) 501 continue; 502 h = ether_crc32_be(LLADDR((struct sockaddr_dl *) 503 ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; 504 hashtbl[h / 8] |= 1 << (h % 8); 505 } |
506 IF_ADDR_UNLOCK(ifp); | 506 if_maddr_runlock(ifp); |
507 508 /* disable all multicast */ 509 UDAV_CLRBIT(sc, UDAV_RCR, UDAV_RCR_ALL); 510 511 /* write hash value to the register */ 512 udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl)); 513} 514 --- 343 unchanged lines hidden --- | 507 508 /* disable all multicast */ 509 UDAV_CLRBIT(sc, UDAV_RCR, UDAV_RCR_ALL); 510 511 /* write hash value to the register */ 512 udav_csr_write(sc, UDAV_MAR, hashtbl, sizeof(hashtbl)); 513} 514 --- 343 unchanged lines hidden --- |