if_sk.c (122586) | if_sk.c (122625) |
---|---|
1/* $OpenBSD: if_sk.c,v 1.33 2003/08/12 05:23:06 nate Exp $ */ | 1/* $OpenBSD: if_sk.c,v 2.33 2003/08/12 05:23:06 nate Exp $ */ |
2 3/* 4 * Copyright (c) 1997, 1998, 1999, 2000 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 70 unchanged lines hidden (view full) --- 80 * SysKonnect has the distinction of being the only vendor on the market 81 * with a dual port gigabit ethernet NIC. The GEnesis provides dual FIFOs, 82 * dual DMA queues, packet/MAC/transmit arbiters and direct access to the 83 * XMAC registers. This driver takes advantage of these features to allow 84 * both XMACs to operate as independent interfaces. 85 */ 86 87#include <sys/cdefs.h> | 2 3/* 4 * Copyright (c) 1997, 1998, 1999, 2000 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: --- 70 unchanged lines hidden (view full) --- 80 * SysKonnect has the distinction of being the only vendor on the market 81 * with a dual port gigabit ethernet NIC. The GEnesis provides dual FIFOs, 82 * dual DMA queues, packet/MAC/transmit arbiters and direct access to the 83 * XMAC registers. This driver takes advantage of these features to allow 84 * both XMACs to operate as independent interfaces. 85 */ 86 87#include <sys/cdefs.h> |
88__FBSDID("$FreeBSD: head/sys/dev/sk/if_sk.c 122586 2003-11-12 23:01:15Z wilko $"); | 88__FBSDID("$FreeBSD: head/sys/dev/sk/if_sk.c 122625 2003-11-13 20:55:53Z obrien $"); |
89 90#include <sys/param.h> 91#include <sys/systm.h> 92#include <sys/sockio.h> 93#include <sys/mbuf.h> 94#include <sys/malloc.h> 95#include <sys/kernel.h> 96#include <sys/socket.h> --- 35 unchanged lines hidden (view full) --- 132MODULE_DEPEND(sk, ether, 1, 1, 1); 133MODULE_DEPEND(sk, miibus, 1, 1, 1); 134 135/* "controller miibus0" required. See GENERIC if you get errors here. */ 136#include "miibus_if.h" 137 138#ifndef lint 139static const char rcsid[] = | 89 90#include <sys/param.h> 91#include <sys/systm.h> 92#include <sys/sockio.h> 93#include <sys/mbuf.h> 94#include <sys/malloc.h> 95#include <sys/kernel.h> 96#include <sys/socket.h> --- 35 unchanged lines hidden (view full) --- 132MODULE_DEPEND(sk, ether, 1, 1, 1); 133MODULE_DEPEND(sk, miibus, 1, 1, 1); 134 135/* "controller miibus0" required. See GENERIC if you get errors here. */ 136#include "miibus_if.h" 137 138#ifndef lint 139static const char rcsid[] = |
140 "$FreeBSD: head/sys/dev/sk/if_sk.c 122586 2003-11-12 23:01:15Z wilko $"; | 140 "$FreeBSD: head/sys/dev/sk/if_sk.c 122625 2003-11-13 20:55:53Z obrien $"; |
141#endif 142 143static struct sk_type sk_devs[] = { 144 { 145 VENDORID_SK, 146 DEVICEID_SK_V1, 147 "SysKonnect Gigabit Ethernet (V1.0)" 148 }, --- 72 unchanged lines hidden (view full) --- 221 int); 222static void sk_xmac_miibus_statchg (struct sk_if_softc *); 223 224static int sk_marv_miibus_readreg (struct sk_if_softc *, int, int); 225static int sk_marv_miibus_writereg (struct sk_if_softc *, int, int, 226 int); 227static void sk_marv_miibus_statchg (struct sk_if_softc *); 228 | 141#endif 142 143static struct sk_type sk_devs[] = { 144 { 145 VENDORID_SK, 146 DEVICEID_SK_V1, 147 "SysKonnect Gigabit Ethernet (V1.0)" 148 }, --- 72 unchanged lines hidden (view full) --- 221 int); 222static void sk_xmac_miibus_statchg (struct sk_if_softc *); 223 224static int sk_marv_miibus_readreg (struct sk_if_softc *, int, int); 225static int sk_marv_miibus_writereg (struct sk_if_softc *, int, int, 226 int); 227static void sk_marv_miibus_statchg (struct sk_if_softc *); 228 |
229static u_int32_t sk_calchash (caddr_t); | 229static u_int32_t sk_mchash (caddr_t); |
230static void sk_setfilt (struct sk_if_softc *, caddr_t, int); 231static void sk_setmulti (struct sk_if_softc *); 232 233#ifdef SK_USEIOSPACE 234#define SK_RES SYS_RES_IOPORT 235#define SK_RID SK_PCI_LOIO 236#else 237#define SK_RES SYS_RES_MEMORY --- 472 unchanged lines hidden (view full) --- 710{ 711 return; 712} 713 714#define SK_POLY 0xEDB88320 715#define SK_BITS 6 716 717static u_int32_t | 230static void sk_setfilt (struct sk_if_softc *, caddr_t, int); 231static void sk_setmulti (struct sk_if_softc *); 232 233#ifdef SK_USEIOSPACE 234#define SK_RES SYS_RES_IOPORT 235#define SK_RID SK_PCI_LOIO 236#else 237#define SK_RES SYS_RES_MEMORY --- 472 unchanged lines hidden (view full) --- 710{ 711 return; 712} 713 714#define SK_POLY 0xEDB88320 715#define SK_BITS 6 716 717static u_int32_t |
718sk_calchash(addr) 719 caddr_t addr; | 718sk_mchash(addr) 719 caddr_t addr; |
720{ | 720{ |
721 u_int32_t idx, bit, data, crc; | 721 u_int32_t crc; 722 int idx, bit; 723 u_int8_t data; |
722 723 /* Compute CRC for the address value. */ 724 crc = 0xFFFFFFFF; /* initial value */ 725 726 for (idx = 0; idx < 6; idx++) { 727 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 728 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? SK_POLY : 0); 729 } --- 63 unchanged lines hidden (view full) --- 793 */ 794 if (sc->sk_type == SK_GENESIS && i < XM_RXFILT_MAX) { 795 sk_setfilt(sc_if, 796 LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i); 797 i++; 798 continue; 799 } 800 | 724 725 /* Compute CRC for the address value. */ 726 crc = 0xFFFFFFFF; /* initial value */ 727 728 for (idx = 0; idx < 6; idx++) { 729 for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) 730 crc = (crc >> 1) ^ (((crc ^ data) & 1) ? SK_POLY : 0); 731 } --- 63 unchanged lines hidden (view full) --- 795 */ 796 if (sc->sk_type == SK_GENESIS && i < XM_RXFILT_MAX) { 797 sk_setfilt(sc_if, 798 LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i); 799 i++; 800 continue; 801 } 802 |
801 h = sk_calchash( | 803 h = sk_mchash( |
802 LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); 803 if (h < 32) 804 hashes[0] |= (1 << h); 805 else 806 hashes[1] |= (1 << (h - 32)); 807 } 808 } 809 --- 1850 unchanged lines hidden --- | 804 LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); 805 if (h < 32) 806 hashes[0] |= (1 << h); 807 else 808 hashes[1] |= (1 << (h - 32)); 809 } 810 } 811 --- 1850 unchanged lines hidden --- |