if_pcn.c (121816) | if_pcn.c (122625) |
---|---|
1/* 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 36 unchanged lines hidden (view full) --- 45 * these enhancements is the ability to perform PCI DMA operations 46 * using 32-bit addressing (which eliminates the need for ISA 47 * bounce-buffering), and special receive buffer alignment (which 48 * allows the receive handler to pass packets to the upper protocol 49 * layers without copying on both the x86 and alpha platforms). 50 */ 51 52#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2000 Berkeley Software Design, Inc. 3 * Copyright (c) 1997, 1998, 1999, 2000 4 * Bill Paul <wpaul@osd.bsdi.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 36 unchanged lines hidden (view full) --- 45 * these enhancements is the ability to perform PCI DMA operations 46 * using 32-bit addressing (which eliminates the need for ISA 47 * bounce-buffering), and special receive buffer alignment (which 48 * allows the receive handler to pass packets to the upper protocol 49 * layers without copying on both the x86 and alpha platforms). 50 */ 51 52#include <sys/cdefs.h> |
53__FBSDID("$FreeBSD: head/sys/pci/if_pcn.c 121816 2003-10-31 18:32:15Z brooks $"); | 53__FBSDID("$FreeBSD: head/sys/pci/if_pcn.c 122625 2003-11-13 20:55:53Z obrien $"); |
54 55#include <sys/param.h> 56#include <sys/systm.h> 57#include <sys/sockio.h> 58#include <sys/mbuf.h> 59#include <sys/malloc.h> 60#include <sys/kernel.h> 61#include <sys/socket.h> --- 69 unchanged lines hidden (view full) --- 131static void pcn_ifmedia_sts (struct ifnet *, struct ifmediareq *); 132 133static int pcn_miibus_readreg (device_t, int, int); 134static int pcn_miibus_writereg (device_t, int, int, int); 135static void pcn_miibus_statchg (device_t); 136 137static void pcn_setfilt (struct ifnet *); 138static void pcn_setmulti (struct pcn_softc *); | 54 55#include <sys/param.h> 56#include <sys/systm.h> 57#include <sys/sockio.h> 58#include <sys/mbuf.h> 59#include <sys/malloc.h> 60#include <sys/kernel.h> 61#include <sys/socket.h> --- 69 unchanged lines hidden (view full) --- 131static void pcn_ifmedia_sts (struct ifnet *, struct ifmediareq *); 132 133static int pcn_miibus_readreg (device_t, int, int); 134static int pcn_miibus_writereg (device_t, int, int, int); 135static void pcn_miibus_statchg (device_t); 136 137static void pcn_setfilt (struct ifnet *); 138static void pcn_setmulti (struct pcn_softc *); |
139static u_int32_t pcn_crc (caddr_t); | 139static u_int32_t pcn_mchash (caddr_t); |
140static void pcn_reset (struct pcn_softc *); 141static int pcn_list_rx_init (struct pcn_softc *); 142static int pcn_list_tx_init (struct pcn_softc *); 143 144#ifdef PCN_USEIOSPACE 145#define PCN_RES SYS_RES_IOPORT 146#define PCN_RID PCN_PCI_LOIO 147#else --- 156 unchanged lines hidden (view full) --- 304 } 305 306 return; 307} 308 309#define DC_POLY 0xEDB88320 310 311static u_int32_t | 140static void pcn_reset (struct pcn_softc *); 141static int pcn_list_rx_init (struct pcn_softc *); 142static int pcn_list_tx_init (struct pcn_softc *); 143 144#ifdef PCN_USEIOSPACE 145#define PCN_RES SYS_RES_IOPORT 146#define PCN_RID PCN_PCI_LOIO 147#else --- 156 unchanged lines hidden (view full) --- 304 } 305 306 return; 307} 308 309#define DC_POLY 0xEDB88320 310 311static u_int32_t |
312pcn_crc(addr) 313 caddr_t addr; | 312pcn_mchash(addr) 313 caddr_t addr; |
314{ | 314{ |
315 u_int32_t idx, bit, data, crc; | 315 u_int32_t crc; 316 int idx, bit; 317 u_int8_t data; |
316 317 /* Compute CRC for the address value. */ 318 crc = 0xFFFFFFFF; /* initial value */ 319 320 for (idx = 0; idx < 6; idx++) { 321 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 322 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? DC_POLY : 0); 323 } --- 24 unchanged lines hidden (view full) --- 348 /* first, zot all the existing hash bits */ 349 for (i = 0; i < 4; i++) 350 pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); 351 352 /* now program new ones */ 353 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 354 if (ifma->ifma_addr->sa_family != AF_LINK) 355 continue; | 318 319 /* Compute CRC for the address value. */ 320 crc = 0xFFFFFFFF; /* initial value */ 321 322 for (idx = 0; idx < 6; idx++) { 323 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 324 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? DC_POLY : 0); 325 } --- 24 unchanged lines hidden (view full) --- 350 /* first, zot all the existing hash bits */ 351 for (i = 0; i < 4; i++) 352 pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); 353 354 /* now program new ones */ 355 TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { 356 if (ifma->ifma_addr->sa_family != AF_LINK) 357 continue; |
356 h = pcn_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); | 358 h = pcn_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); |
357 hashes[h >> 4] |= 1 << (h & 0xF); 358 } 359 360 for (i = 0; i < 4; i++) 361 pcn_csr_write(sc, PCN_CSR_MAR0 + i, hashes[i]); 362 363 PCN_CSR_CLRBIT(sc, PCN_CSR_EXTCTL1, PCN_EXTCTL1_SPND); 364 --- 1075 unchanged lines hidden --- | 359 hashes[h >> 4] |= 1 << (h & 0xF); 360 } 361 362 for (i = 0; i < 4; i++) 363 pcn_csr_write(sc, PCN_CSR_MAR0 + i, hashes[i]); 364 365 PCN_CSR_CLRBIT(sc, PCN_CSR_EXTCTL1, PCN_EXTCTL1_SPND); 366 --- 1075 unchanged lines hidden --- |