if_ffec.c (262728) | if_ffec.c (262929) |
---|---|
1/*- 2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2013 Ian Lepore <ian@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/ffec/if_ffec.c 262728 2014-03-04 06:55:54Z hrs $"); | 29__FBSDID("$FreeBSD: head/sys/dev/ffec/if_ffec.c 262929 2014-03-08 14:58:39Z hrs $"); |
30 31/* 32 * Driver for Freescale Fast Ethernet Controller, found on imx-series SoCs among 33 * others. Also works for the ENET Gigibit controller found on imx6 and imx28, 34 * but the driver doesn't currently use any of the ENET advanced features other 35 * than enabling gigabit. 36 * 37 * The interface name 'fec' is already taken by netgraph's Fast Etherchannel --- 916 unchanged lines hidden (view full) --- 954 if ((ifp->if_flags & IFF_ALLMULTI)) 955 ghash = 0xffffffffffffffffLLU; 956 else { 957 ghash = 0; 958 if_maddr_rlock(ifp); 959 TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { 960 if (ifma->ifma_addr->sa_family != AF_LINK) 961 continue; | 30 31/* 32 * Driver for Freescale Fast Ethernet Controller, found on imx-series SoCs among 33 * others. Also works for the ENET Gigibit controller found on imx6 and imx28, 34 * but the driver doesn't currently use any of the ENET advanced features other 35 * than enabling gigabit. 36 * 37 * The interface name 'fec' is already taken by netgraph's Fast Etherchannel --- 916 unchanged lines hidden (view full) --- 954 if ((ifp->if_flags & IFF_ALLMULTI)) 955 ghash = 0xffffffffffffffffLLU; 956 else { 957 ghash = 0; 958 if_maddr_rlock(ifp); 959 TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { 960 if (ifma->ifma_addr->sa_family != AF_LINK) 961 continue; |
962 crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) | 962 /* 6 bits from MSB in LE CRC32 are used for hash. */ 963 crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) |
963 ifma->ifma_addr), ETHER_ADDR_LEN); | 964 ifma->ifma_addr), ETHER_ADDR_LEN); |
964 ghash |= 1LLU << (crc & 0x3f); | 965 ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); |
965 } 966 if_maddr_runlock(ifp); 967 } 968 WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32)); 969 WR4(sc, FEC_GALR_REG, (uint32_t)ghash); 970 971 /* 972 * Set the individual address filter hash. --- 791 unchanged lines hidden --- | 966 } 967 if_maddr_runlock(ifp); 968 } 969 WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32)); 970 WR4(sc, FEC_GALR_REG, (uint32_t)ghash); 971 972 /* 973 * Set the individual address filter hash. --- 791 unchanged lines hidden --- |