if_bge.c (200246) | if_bge.c (200264) |
---|---|
1/*- 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.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: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.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: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 200246 2009-12-08 03:24:29Z yongari $"); | 35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 200264 2009-12-08 17:54:23Z yongari $"); |
36 37/* 38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 39 * 40 * The Broadcom BCM5700 is based on technology originally developed by 41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet 42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has 43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external --- 434 unchanged lines hidden (view full) --- 478}; 479 480static devclass_t bge_devclass; 481 482DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0); 483DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); 484 485static int bge_allow_asf = 1; | 36 37/* 38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 39 * 40 * The Broadcom BCM5700 is based on technology originally developed by 41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet 42 * MAC chips. The BCM5700, sometimes refered to as the Tigon III, has 43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external --- 434 unchanged lines hidden (view full) --- 478}; 479 480static devclass_t bge_devclass; 481 482DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0); 483DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0); 484 485static int bge_allow_asf = 1; |
486/* 487 * A common design characteristic for many Broadcom client controllers 488 * is that they only support a single outstanding DMA read operation 489 * on the PCIe bus. This means that it will take twice as long to fetch 490 * a TX frame that is split into header and payload buffers as it does 491 * to fetch a single, contiguous TX frame (2 reads vs. 1 read). For 492 * these controllers, coalescing buffers to reduce the number of memory 493 * reads is effective way to get maximum performance(about 940Mbps). 494 * Without collapsing TX buffers the maximum TCP bulk transfer 495 * performance is about 850Mbps. However forcing coalescing mbufs 496 * consumes a lot of CPU cycles, so leave it off by default. 497 */ 498static int bge_forced_collapse = 0; | |
499 500TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf); | 486 487TUNABLE_INT("hw.bge.allow_asf", &bge_allow_asf); |
501TUNABLE_INT("hw.bge.forced_collapse", &bge_forced_collapse); | |
502 503SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); 504SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0, 505 "Allow ASF mode if available"); | 488 489SYSCTL_NODE(_hw, OID_AUTO, bge, CTLFLAG_RD, 0, "BGE driver parameters"); 490SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0, 491 "Allow ASF mode if available"); |
506SYSCTL_INT(_hw_bge, OID_AUTO, forced_collapse, CTLFLAG_RD, &bge_forced_collapse, 507 0, "Number of fragmented TX buffers of a frame allowed before " 508 "forced collapsing"); | |
509 510#define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500" 511#define SPARC64_BLADE_1500_PATH_BGE "/pci@1f,700000/network@2" 512#define SPARC64_BLADE_2500_MODEL "SUNW,Sun-Blade-2500" 513#define SPARC64_BLADE_2500_PATH_BGE "/pci@1c,600000/network@3" 514#define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" 515 516static int --- 3415 unchanged lines hidden (view full) --- 3932 } 3933 if (m->m_flags & M_LASTFRAG) 3934 csum_flags |= BGE_TXBDFLAG_IP_FRAG_END; 3935 else if (m->m_flags & M_FRAG) 3936 csum_flags |= BGE_TXBDFLAG_IP_FRAG; 3937 } 3938 3939 if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && | 492 493#define SPARC64_BLADE_1500_MODEL "SUNW,Sun-Blade-1500" 494#define SPARC64_BLADE_1500_PATH_BGE "/pci@1f,700000/network@2" 495#define SPARC64_BLADE_2500_MODEL "SUNW,Sun-Blade-2500" 496#define SPARC64_BLADE_2500_PATH_BGE "/pci@1c,600000/network@3" 497#define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" 498 499static int --- 3415 unchanged lines hidden (view full) --- 3915 } 3916 if (m->m_flags & M_LASTFRAG) 3917 csum_flags |= BGE_TXBDFLAG_IP_FRAG_END; 3918 else if (m->m_flags & M_FRAG) 3919 csum_flags |= BGE_TXBDFLAG_IP_FRAG; 3920 } 3921 3922 if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0 && |
3940 bge_forced_collapse > 0 && (sc->bge_flags & BGE_FLAG_PCIE) != 0 && 3941 m->m_next != NULL) { | 3923 sc->bge_forced_collapse > 0 && 3924 (sc->bge_flags & BGE_FLAG_PCIE) != 0 && m->m_next != NULL) { |
3942 /* 3943 * Forcedly collapse mbuf chains to overcome hardware 3944 * limitation which only support a single outstanding 3945 * DMA read operation. 3946 */ | 3925 /* 3926 * Forcedly collapse mbuf chains to overcome hardware 3927 * limitation which only support a single outstanding 3928 * DMA read operation. 3929 */ |
3947 if (bge_forced_collapse == 1) | 3930 if (sc->bge_forced_collapse == 1) |
3948 m = m_defrag(m, M_DONTWAIT); 3949 else | 3931 m = m_defrag(m, M_DONTWAIT); 3932 else |
3950 m = m_collapse(m, M_DONTWAIT, bge_forced_collapse); | 3933 m = m_collapse(m, M_DONTWAIT, sc->bge_forced_collapse); |
3951 if (m == NULL) { 3952 m_freem(*m_head); 3953 *m_head = NULL; 3954 return (ENOBUFS); 3955 } 3956 *m_head = m; 3957 } 3958 --- 911 unchanged lines hidden (view full) --- 4870 "Register Read"); 4871 4872 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read", 4873 CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_mem_read, "I", 4874 "Memory Read"); 4875 4876#endif 4877 | 3934 if (m == NULL) { 3935 m_freem(*m_head); 3936 *m_head = NULL; 3937 return (ENOBUFS); 3938 } 3939 *m_head = m; 3940 } 3941 --- 911 unchanged lines hidden (view full) --- 4853 "Register Read"); 4854 4855 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "mem_read", 4856 CTLTYPE_INT | CTLFLAG_RW, sc, 0, bge_sysctl_mem_read, "I", 4857 "Memory Read"); 4858 4859#endif 4860 |
4861 /* 4862 * A common design characteristic for many Broadcom client controllers 4863 * is that they only support a single outstanding DMA read operation 4864 * on the PCIe bus. This means that it will take twice as long to fetch 4865 * a TX frame that is split into header and payload buffers as it does 4866 * to fetch a single, contiguous TX frame (2 reads vs. 1 read). For 4867 * these controllers, coalescing buffers to reduce the number of memory 4868 * reads is effective way to get maximum performance(about 940Mbps). 4869 * Without collapsing TX buffers the maximum TCP bulk transfer 4870 * performance is about 850Mbps. However forcing coalescing mbufs 4871 * consumes a lot of CPU cycles, so leave it off by default. 4872 */ 4873 SYSCTL_ADD_INT(ctx, children, OID_AUTO, "forced_collapse", 4874 CTLFLAG_RW, &sc->bge_forced_collapse, 0, 4875 "Number of fragmented TX buffers of a frame allowed before " 4876 "forced collapsing"); 4877 resource_int_value(device_get_name(sc->bge_dev), 4878 device_get_unit(sc->bge_dev), "forced_collapse", 4879 &sc->bge_forced_collapse); 4880 |
|
4878 if (BGE_IS_5705_PLUS(sc)) 4879 return; 4880 4881 tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, 4882 NULL, "BGE Statistics"); 4883 schildren = children = SYSCTL_CHILDREN(tree); 4884 BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", 4885 children, COSFramesDroppedDueToFilters, --- 311 unchanged lines hidden --- | 4881 if (BGE_IS_5705_PLUS(sc)) 4882 return; 4883 4884 tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, 4885 NULL, "BGE Statistics"); 4886 schildren = children = SYSCTL_CHILDREN(tree); 4887 BGE_SYSCTL_STAT(sc, ctx, "Frames Dropped Due To Filters", 4888 children, COSFramesDroppedDueToFilters, --- 311 unchanged lines hidden --- |