svn commit: r219647 - in head: . sys/amd64/conf sys/boot/forth sys/conf sys/dev/bxe sys/i386/conf sys/modules/bxe usr.sbin/sysinstall

2011-03-14 Thread David Christensen
et
 device cxgbe   # Chelsio T4 10GbE PCIe adapter
 device de  # DEC/Intel DC21x4x (``Tulip'')
 device em  # Intel Pro/1000 Gigabit Ethernet

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Mar 14 22:05:59 2011(r219646)
+++ head/sys/conf/files Mon Mar 14 22:42:41 2011(r219647)
@@ -819,6 +819,8 @@ dev/bwi/bwirf.c optional bwi
 dev/bwi/if_bwi.c   optional bwi
 dev/bwi/if_bwi_pci.c   optional bwi pci
 dev/bwn/if_bwn.c   optional bwn siba_bwn
+dev/bxe/if_bxe.c   optional bxe
+dev/bxe/bxe_link.c optional bxe
 dev/cardbus/cardbus.c  optional cardbus
 dev/cardbus/cardbus_cis.c  optional cardbus
 dev/cardbus/cardbus_device.c   optional cardbus

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon Mar 14 22:05:59 2011(r219646)
+++ head/sys/conf/options   Mon Mar 14 22:42:41 2011(r219647)
@@ -702,8 +702,13 @@ ED_SIC opt_ed.h
 BCE_DEBUG  opt_bce.h
 BCE_NVRAM_WRITE_SUPPORTopt_bce.h
 
+# bxe driver
+BXE_DEBUG  opt_bxe.h
+BXE_NVRAM_WRITE_SUPPORTopt_bxe.h
+
 SOCKBUF_DEBUG  opt_global.h
 
+
 # options for ubsec driver
 UBSEC_DEBUGopt_ubsec.h
 UBSEC_RNDTEST  opt_ubsec.h

Added: head/sys/dev/bxe/bxe_debug.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bxe/bxe_debug.hMon Mar 14 22:42:41 2011
(r219647)
@@ -0,0 +1,357 @@
+/*-
+ * Copyright (c) 2007-2011 Broadcom Corporation. All rights reserved.
+ *
+ *Gary Zambrano 
+ *David Christensen 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Broadcom Corporation nor the name of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written consent.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ /*$FreeBSD$*/
+
+#ifndef _BXE_DEBUG_H
+#define_BXE_DEBUG_H
+
+extern uint32_t bxe_debug;
+
+/*
+ * Debugging macros and definitions.
+ */
+
+#defineBXE_CP_LOAD 0x0001
+#defineBXE_CP_SEND 0x0002
+#defineBXE_CP_RECV 0x0004
+#defineBXE_CP_INTR 0x0008
+#defineBXE_CP_UNLOAD   0x0010
+#defineBXE_CP_RESET0x0020
+#defineBXE_CP_IOCTL0x0040
+#defineBXE_CP_STATS0x0080
+#defineBXE_CP_MISC 0x0100
+#defineBXE_CP_PHY  0x0200
+#defineBXE_CP_RAMROD   0x0400
+#defineBXE_CP_NVRAM0x0800
+#defineBXE_CP_REGS 0x1000
+#defineBXE_CP_ALL  0x00FF
+#defineBXE_CP_MASK 0x00FF
+
+#define BXE_LEVEL_FATAL0x
+#define BXE_LEVEL_WARN 0x0100
+#define BXE_LEVEL_INFO 0x0200
+#define BXE_LEVEL_VERBOSE  0x0300
+#define BXE_LEVEL_EXTREME  0x0400
+#define BXE_LEVEL_INSANE   0x0500
+
+#define BXE_LEVEL_MASK 0xFF00
+
+#define BXE_WARN_LOAD  (BXE_CP_LOAD | BXE_LEVEL_WARN)
+#define BXE_INFO_LOAD  (BXE_CP_LOAD | BXE_LEVEL_INFO)
+#define BXE_VERBOSE_LOAD   (BXE_CP_LOAD | BXE_LEVEL_VERBOSE)
+#de

svn commit: r219656 - in head/sys: dev/bxe modules/bxe

2011-03-14 Thread David Christensen
Author: davidch
Date: Tue Mar 15 01:06:27 2011
New Revision: 219656
URL: http://svn.freebsd.org/changeset/base/219656

Log:
  - Inadvertently committed files with +x attribute, fixed.
  - Minor change to info output string.

Modified:
  head/sys/dev/bxe/if_bxe.c   (contents, props changed)
Directory Properties:
  head/sys/dev/bxe/bxe_debug.h   (props changed)
  head/sys/dev/bxe/bxe_fw_defs.h   (props changed)
  head/sys/dev/bxe/bxe_hsi.h   (props changed)
  head/sys/dev/bxe/bxe_include.h   (props changed)
  head/sys/dev/bxe/bxe_init.h   (props changed)
  head/sys/dev/bxe/bxe_init_values_e1.h   (props changed)
  head/sys/dev/bxe/bxe_init_values_e1h.h   (props changed)
  head/sys/dev/bxe/bxe_link.c   (props changed)
  head/sys/dev/bxe/bxe_link.h   (props changed)
  head/sys/dev/bxe/bxe_reg.h   (props changed)
  head/sys/dev/bxe/bxe_self_test.h   (props changed)
  head/sys/dev/bxe/dump_e1.h   (props changed)
  head/sys/dev/bxe/dump_e1h.h   (props changed)
  head/sys/dev/bxe/hw_dump_reg_st.h   (props changed)
  head/sys/dev/bxe/if_bxe.h   (props changed)
  head/sys/modules/bxe/Makefile   (props changed)

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Mon Mar 14 23:54:19 2011(r219655)
+++ head/sys/dev/bxe/if_bxe.c   Tue Mar 15 01:06:27 2011(r219656)
@@ -986,6 +986,7 @@ bxe_probe(device_t dev)
 static void
 bxe_print_adapter_info(struct bxe_softc *sc)
 {
+   int i = 0;
 
DBENTER(BXE_EXTREME_LOAD);
 
@@ -1008,17 +1009,26 @@ bxe_print_adapter_info(struct bxe_softc 
}
 
/* Device features. */
-   printf("); Flags ( ");
+   printf("); Flags (");
 
/* Miscellaneous flags. */
if (sc->bxe_flags & BXE_USING_MSI_FLAG)
-   printf("MSI ");
-   if (sc->bxe_flags & BXE_USING_MSIX_FLAG)
-   printf("MSI-X ");
-   if (sc->bxe_flags & BXE_SAFC_TX_FLAG)
-   printf("SAFC ");
-   if (TPA_ENABLED(sc))
-   printf("TPA ");
+   printf("MSI");
+
+   if (sc->bxe_flags & BXE_USING_MSIX_FLAG) {
+   if (i > 0) printf("|");
+   printf("MSI-X"); i++;
+   }
+
+   if (sc->bxe_flags & BXE_SAFC_TX_FLAG) {
+   if (i > 0) printf("|");
+   printf("SAFC"); i++;
+   }
+
+   if (TPA_ENABLED(sc)) {
+   if (i > 0) printf("|");
+   printf("TPA"); i++;
+   }
 
printf(") Queues (");
switch (sc->multi_mode) {
@@ -1032,8 +1042,9 @@ bxe_print_adapter_info(struct bxe_softc 
printf("Unknown");
break;
}
+
/* Firmware versions and device features. */
-   BXE_PRINTF("Firmware (%d.%d.%d); Bootcode (%d.%d.%d)\n",
+   printf("); Firmware (%d.%d.%d); Bootcode (%d.%d.%d)\n",
BCM_5710_FW_MAJOR_VERSION,
BCM_5710_FW_MINOR_VERSION,
BCM_5710_FW_REVISION_VERSION,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r220223 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 20:46:50 2011
New Revision: 220223
URL: http://svn.freebsd.org/changeset/base/220223

Log:
  - Fixed a problem where the stack passed a TSO frame larger than the 64K
size allowed by the DMA descriptor for TSO frames.
  
  MFC after:  One week

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 19:22:11 2011(r220222)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 20:46:50 2011(r220223)
@@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
 
 /* BXE Debug Options */
 #ifdef BXE_DEBUG
-   uint32_t bxe_debug = BXE_WARN;
+   uint32_t bxe_debug = BXE_INFO;
 
 /*  0 = Never  */
 /*  1 = 1 in 2,147,483,648 */
@@ -382,7 +382,7 @@ static void bxe_breakpoint(struct bxe_so
 #endif
 
 
-#defineBXE_DRIVER_VERSION  "1.5.52_preliminary"
+#defineBXE_DRIVER_VERSION  "1.5.52"
 
 static void bxe_init_e1_firmware(struct bxe_softc *sc);
 static void bxe_init_e1h_firmware(struct bxe_softc *sc);
@@ -13042,10 +13042,20 @@ bxe_dma_alloc(device_t dev)
 * address of the block.
 */
 
-   if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE,
-   BXE_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
-   NULL, NULL, BXE_STATUS_BLK_SZ, 1, BXE_STATUS_BLK_SZ,
-   0, NULL, NULL, &fp->status_block_tag)) {
+   if (bus_dma_tag_create(sc->parent_tag,
+   BCM_PAGE_SIZE,  /* alignment for segs */
+   BXE_DMA_BOUNDARY,   /* cannot cross */
+   BUS_SPACE_MAXADDR,  /* restricted low */
+   BUS_SPACE_MAXADDR,  /* restricted hi */
+   NULL,   /* filter f() */
+   NULL,   /* filter f() arg */
+   BXE_STATUS_BLK_SZ,  /* max map for this tag */
+   1,  /* # of discontinuities */
+   BXE_STATUS_BLK_SZ,  /* max seg size */
+   0,  /* flags */
+   NULL,   /* lock f() */
+   NULL,   /* lock f() arg */
+   &fp->status_block_tag)) {
BXE_PRINTF("%s(%d): Could not allocate fp[%d] "
"status block DMA tag!\n", __FILE__, __LINE__, i);
rc = ENOMEM;
@@ -13086,10 +13096,20 @@ bxe_dma_alloc(device_t dev)
 * allocate and clear the  memory, and fetch the
 * physical address of the block.
 */
-   if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE,
-   BXE_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
-   NULL, NULL, BXE_TX_CHAIN_PAGE_SZ, 1, BXE_TX_CHAIN_PAGE_SZ,
-   0, NULL, NULL, &fp->tx_bd_chain_tag)) {
+   if (bus_dma_tag_create(sc->parent_tag,
+   BCM_PAGE_SIZE,  /* alignment for segs */
+   BXE_DMA_BOUNDARY,   /* cannot cross */
+   BUS_SPACE_MAXADDR,  /* restricted low */
+   BUS_SPACE_MAXADDR,  /* restricted hi */
+   NULL,   /* filter f() */
+   NULL,   /* filter f() arg */
+   BXE_TX_CHAIN_PAGE_SZ,/* max map for this tag */
+   1,  /* # of discontinuities */
+   BXE_TX_CHAIN_PAGE_SZ,/* max seg size */
+   0,  /* flags */
+   NULL,   /* lock f() */
+   NULL,   /* lock f() arg */
+   &fp->tx_bd_chain_tag)) {
BXE_PRINTF(
"%s(%d): Could not allocate fp[%d] TX descriptor "
"chain DMA tag!\n", __FILE__, __LINE__, i);
@@ -13132,23 +13152,33 @@ bxe_dma_alloc(device_t dev)
}
 
/*
-* Check the required size before mapping to conserve resources.
+* Check required size before mapping to conserve resources.
 */
if (bxe_tso_enable) {
-   max_size = BXE_TSO_MAX_SIZE;
-   max_segments = 32; /* BXE_MAX_SEGMENTS; */
+   max_size = BXE_TSO_MAX_SIZE;
+   max_segments = BXE_TSO_MAX_SEGMENTS;
max_seg_size = BXE_TSO_MAX_SEG_SIZE;
} else {
-   max_size  = MCLBYTES * BXE_MAX_SEGMENTS;
+   max_size = MCLBYTES * BXE_MAX_SEGMENTS;
max_segments = BXE_MAX_SEGMENTS;
max_seg_size = MCLBYTES;
}
 
/* Create a DMA tag for TX mbufs. */
- 

svn commit: r220224 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 21:01:10 2011
New Revision: 220224
URL: http://svn.freebsd.org/changeset/base/220224

Log:
  - Print number of queues when RSS is enabled.
  - Improve reporting of media type (not always 10GBase-CX4).
  
  MFC after:One week

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 20:46:50 2011(r220223)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 21:01:10 2011(r220224)
@@ -1036,7 +1036,7 @@ bxe_print_adapter_info(struct bxe_softc 
printf("None");
break;
case ETH_RSS_MODE_REGULAR:
-   printf("RSS");
+   printf("RSS:%d", sc->num_queues);
break;
default:
printf("Unknown");
@@ -1717,14 +1717,6 @@ bxe_attach(device_t dev)
 
/* Prepare the tick routine. */
callout_init(&sc->bxe_tick_callout, CALLOUT_MPSAFE);
-   ifmedia_init(&sc->bxe_ifmedia, IFM_IMASK, bxe_ifmedia_upd,
-bxe_ifmedia_status);
-   ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_10G_CX4, 0, NULL);
-   ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_10G_CX4 | IFM_FDX, 0,
-   NULL);
-   ifmedia_add(&sc->bxe_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL);
-   ifmedia_set(&sc->bxe_ifmedia, IFM_ETHER | IFM_AUTO);
-   sc->bxe_ifmedia.ifm_media = sc->bxe_ifmedia.ifm_cur->ifm_media;
 
/* Enable bus master capability */
pci_enable_busmaster(dev);
@@ -1778,12 +1770,62 @@ bxe_attach(device_t dev)
 
/* Get hardware info from shared memory and validate data. */
if (bxe_get_function_hwinfo(sc)) {
-   DBPRINT(sc, BXE_WARN, "%s(): Failed to get hardware info!\n",
-   __FUNCTION__);
+   DBPRINT(sc, BXE_WARN,
+   "%s(): Failed to get hardware info!\n", __FUNCTION__);
rc = ENODEV;
goto bxe_attach_fail;
}
 
+   /* Identify supported media based on the PHY type. */
+   switch (XGXS_EXT_PHY_TYPE(sc->link_params.ext_phy_config)) {
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
+   DBPRINT(sc, BXE_INFO_LOAD,
+   "%s(): Found 10GBase-CX4 media.\n", __FUNCTION__);
+   sc->media = IFM_10G_CX4;
+   break;
+#if 0
+   /* ToDo: Configure correct media types for these PHYs. */
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8071
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726
+#endif
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727:
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727_NOC:
+   DBPRINT(sc, BXE_INFO_LOAD,
+   "%s(): Found 10GBase-SR media.\n", __FUNCTION__);
+   sc->media = IFM_10G_SR;
+   break;
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823:
+   DBPRINT(sc, BXE_INFO_LOAD,
+   "%s(): Found 10GBase-T media.\n", __FUNCTION__);
+   sc->media = IFM_10G_T;
+   break;
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
+   case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_NOT_CONN:
+   default:
+   BXE_PRINTF("%s(%d): PHY not supported by driver!\n",
+   __FILE__, __LINE__);
+   sc->media = 0;
+   rc = ENODEV;
+   goto bxe_attach_fail;
+   }
+
+   /* Setup supported media options. */
+   ifmedia_init(&sc->bxe_ifmedia,
+   IFM_IMASK, bxe_ifmedia_upd, bxe_ifmedia_status);
+   ifmedia_add(&sc->bxe_ifmedia,
+   IFM_ETHER | sc->media | IFM_FDX, 0, NULL);
+   ifmedia_add(&sc->bxe_ifmedia,
+   IFM_ETHER | IFM_AUTO, 0, NULL);
+   ifmedia_set(&sc->bxe_ifmedia,
+   IFM_ETHER | IFM_AUTO);
+   sc->bxe_ifmedia.ifm_media = sc->bxe_ifmedia.ifm_cur->ifm_media;
+
/* Set init arrays */
rc = bxe_init_firmware(sc);
if (rc) {
@@ -14153,6 +14195,18 @@ bxe_ifmedia_upd(struct ifnet *ifp)
DBPRINT(sc, BXE_VERBOSE_PHY,
"%s(): Media set to IFM_10G_CX4, forced mode.\n", __FUNCTION__);
break;
+   case IFM_10G_SR:
+   DBPRINT(sc, BXE_VERBOSE_PHY,
+   "%s(): Media set to IFM_10G_SR, forced mode.\n", __FUNCTION__);
+   break;
+   case IFM_10G_T:
+   DBPRINT(sc, BXE_VERBOSE_PHY,
+   "%s(): Media set to IFM_10G_T, forced mode.\n", __FUNCTION__);
+   break;
+   case IFM_10G_TWINAX:
+   DBPRINT(sc, BXE_VERBOSE_PHY,
+   "%s(): Media set to IFM_10G_TWINAX, for

svn commit: r220226 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 21:30:00 2011
New Revision: 220226
URL: http://svn.freebsd.org/changeset/base/220226

Log:
  - Added debug support to monitor mbuf defrag attempts/failures.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 21:21:07 2011(r220225)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 21:30:00 2011(r220226)
@@ -352,7 +352,7 @@ static int bxe_sysctl_reg_read(SYSCTL_HA
 static int bxe_sysctl_breakpoint(SYSCTL_HANDLER_ARGS);
 static void bxe_validate_rx_packet(struct bxe_fastpath *, uint16_t,
union eth_rx_cqe *, struct mbuf *);
-static void bxe_dump_grc(struct bxe_softc *, int);
+static void bxe_grcdump(struct bxe_softc *, int);
 static void bxe_dump_enet(struct bxe_softc *,struct mbuf *);
 static void bxe_dump_mbuf (struct bxe_softc *, struct mbuf *);
 static void bxe_dump_tx_mbuf_chain(struct bxe_softc *, int, int);
@@ -8585,16 +8585,22 @@ bxe_tx_encap(struct bxe_fastpath *fp, st
error = bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag, map, m0,
segs, &nsegs, BUS_DMA_NOWAIT);
do{
-   /* Handle any mapping errors. */
+   /* Handle any mapping errors. */
if(__predict_false(error)){
if (error == ENOMEM) {
+   /* Temporary OS resource issue. */
rc = ENOMEM;
}else if (error == EFBIG) {
+   /* Possibly recoverable. */
+   DBRUN(fp->mbuf_defrag_attempts++);
m0 = m_defrag(*m_head, M_DONTWAIT);
if (m0 == NULL) {
+   BXE_PRINTF("%s(%d): Can't defrag TX 
frame!\n",
+   __FILE__, __LINE__);
rc = ENOBUFS;
} else {
/* Defrag was successful, try mapping again.*/
+   DBRUN(fp->mbuf_defrag_successes++);
*m_head = m0;
error =
bus_dmamap_load_mbuf_sg(
@@ -8602,10 +8608,15 @@ bxe_tx_encap(struct bxe_fastpath *fp, st
segs, &nsegs, BUS_DMA_NOWAIT);
}
}else {
+   /* Unrecoverable. */
+   BXE_PRINTF("%s(%d): Unknown TX mapping error! "
+   "rc = %d.\n", __FILE__, __LINE__, error);
+   DBRUN(bxe_dump_mbuf(sc, m0));
rc = error;
}
break;
}
+
/*
 * Now that we know how many buffer descriptors are required to
 * send the frame, check whether we have enough transmit BD's
@@ -8615,29 +8626,39 @@ bxe_tx_encap(struct bxe_fastpath *fp, st
if (__predict_false((nsegs + 2) >
(USABLE_TX_BD - fp->used_tx_bd))) {
bus_dmamap_unload(fp->tx_mbuf_tag, map);
+   BXE_PRINTF("%s(%d): Insufficient TX queue space!\n",
+  __FILE__, __LINE__);
+   /* DRC - Should we drop a frame with this error? */
rc = ENOBUFS;
break;
}
+
/* Now make sure it fits in the pkt window */
-   if (nsegs > 12) {
-   /* The mbuf has more segments than the controller can handle.
-* Try to defrag the mbuf if there are too many
-* segments.  If it can't be defragged then
-* drop the frame, log an error, and exit.
-* An alternative would be to use a bounce buffer.
-*/
+   if (__predict_false(nsegs > 12)) {
+   /* The mbuf has more segments than the controller can
+* handle. Try to defrag the mbuf if there are too many
+* segments.  If it can't be defragged then
+* drop the frame, log an error, and exit.
+* An alternative would be to use a bounce buffer.
+*/
if(m0->m_pkthdr.csum_flags & CSUM_TSO){
if (! bxe_chktso_window(sc,nsegs,segs,m0))
/* Send it */
break;
}
+
/* Defrag for non tso and if tso needs it */
+   DB

svn commit: r220228 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 22:04:00 2011
New Revision: 220228
URL: http://svn.freebsd.org/changeset/base/220228

Log:
  - Fixed DMA engine errors by increasing timeouts to 200ms for reads/writes.
  - Improved some error reporting calls to include file name/line number.
  - Various style(9) fixes.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/if_bxe.c

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 21:33:33 2011(r220227)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 22:04:00 2011(r220228)
@@ -458,9 +458,7 @@ SYSCTL_UINT(_hw_bxe, OID_AUTO, tpa_enabl
 
 /*
  * Specifies the number of queues that will be used when a multi-queue
- * RSS mode is selected  using bxe_multi_mode below.  Some RSS modes
- * require additional queue configuration which may conflict with this
- * setting.  In that case this value will be overriden.
+ * RSS mode is selected  using bxe_multi_mode below.
  *
  * Allowable values are 0 (Auto) or 1 to MAX_CONTEXT (fixed queue number).
  */
@@ -1145,7 +1143,7 @@ bxe_interrupt_allocate(struct bxe_softc 
break;
}
} else {
-   /* User has forced INTx mode. */
+   /* User has forced INTx mode. */
sc->multi_mode = ETH_RSS_MODE_DISABLED;
sc->num_queues = 1;
}
@@ -1451,7 +1449,7 @@ bxe_interrupt_attach(struct bxe_softc *s
"%s(): Enabling slowpath MSI[0] vector.\n",
__FUNCTION__);
/*
-* Setup the interrupt handler.  Note that we pass the driver
+* Setup the interrupt handler. Note that we pass the driver
 * instance to the interrupt handler for the slowpath.
 */
rc = bus_setup_intr(sc->bxe_dev,sc->bxe_msi_res[0],
@@ -1477,7 +1475,7 @@ bxe_interrupt_attach(struct bxe_softc *s
"%s(): Enabling MSI[%d] vector.\n",
__FUNCTION__, i + 1);
/*
-* Setup the interrupt handler.  Note that we pass the
+* Setup the interrupt handler. Note that we pass the
 * fastpath context to the interrupt handler in this
 * case.
 */
@@ -1762,7 +1760,7 @@ bxe_attach(device_t dev)
 
/* Put indirect address registers into a sane state. */
pci_write_config(sc->bxe_dev, PCICFG_GRC_ADDRESS,
-   PCICFG_VENDOR_ID_OFFSET, 4);
+   PCICFG_VENDOR_ID_OFFSET, 4);
REG_WR(sc, PXP2_REG_PGL_ADDR_88_F0 + BP_PORT(sc) * 16, 0);
REG_WR(sc, PXP2_REG_PGL_ADDR_8C_F0 + BP_PORT(sc) * 16, 0);
REG_WR(sc, PXP2_REG_PGL_ADDR_90_F0 + BP_PORT(sc) * 16, 0);
@@ -1829,7 +1827,8 @@ bxe_attach(device_t dev)
/* Set init arrays */
rc = bxe_init_firmware(sc);
if (rc) {
-   BXE_PRINTF("Error loading firmware\n");
+   BXE_PRINTF("%s(%d): Error loading firmware\n",
+   __FILE__, __LINE__);
goto bxe_attach_fail;
}
 
@@ -1846,8 +1845,8 @@ bxe_attach(device_t dev)
 
/* Check that NVRAM contents are valid.*/
if (bxe_nvram_test(sc)) {
-   DBPRINT(sc, BXE_WARN, "%s(): Failed NVRAM test!\n",
-   __FUNCTION__);
+   BXE_PRINTF("%s(%d): Failed NVRAM test!\n",
+   __FILE__, __LINE__);
rc = ENODEV;
goto bxe_attach_fail;
}
@@ -1855,7 +1854,7 @@ bxe_attach(device_t dev)
/* Allocate the appropriate interrupts.*/
if (bxe_interrupt_allocate(sc)) {
BXE_PRINTF("%s(%d): Interrupt allocation failed!\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
rc = ENODEV;
goto bxe_attach_fail;
}
@@ -1902,10 +1901,13 @@ bxe_attach(device_t dev)
/* Disable WoL. */
sc->wol = 0;
 
+   /* Assume a standard 1500 byte MTU size for mbuf allocations. */
+   sc->mbuf_alloc_size  = MCLBYTES;
+
/* Allocate DMA memory resources. */
if (bxe_dma_alloc(sc->bxe_dev)) {
BXE_PRINTF("%s(%d): DMA allocation failed!\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
rc = ENOMEM;
goto bxe_attach_fail;
}
@@ -1914,7 +1916,7 @@ bxe_attach(device_t dev)
ifp = sc->bxe_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
BXE_PRINTF("%s(%d): Interface allocation failed!\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
rc = ENXIO;
goto bxe_attach_fail;
}
@@ -1935,8 +1937,6 @@ bxe_attach(device_t dev)
ifp->if_capenable =

svn commit: r220229 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 22:40:44 2011
New Revision: 220229
URL: http://svn.freebsd.org/changeset/base/220229

Log:
  - Freshened debug support code.
  - Renamed several RX variable for more consistent usage.
  - Fixed a potential problem when masking RX CQ producer value.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 22:04:00 2011(r220228)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 22:40:44 2011(r220229)
@@ -68,7 +68,8 @@ __FBSDID("$FreeBSD$");
 
 /* BXE Debug Options */
 #ifdef BXE_DEBUG
-   uint32_t bxe_debug = BXE_INFO;
+uint32_t bxe_debug = BXE_INFO;
+
 
 /*  0 = Never  */
 /*  1 = 1 in 2,147,483,648 */
@@ -345,8 +346,8 @@ int  bxe_set_gpio_int(struct bxe_softc *
 static int bxe_sysctl_driver_state(SYSCTL_HANDLER_ARGS);
 static int bxe_sysctl_hw_state(SYSCTL_HANDLER_ARGS);
 static int bxe_sysctl_dump_fw(SYSCTL_HANDLER_ARGS);
-static int bxe_sysctl_dump_cqe_chain(SYSCTL_HANDLER_ARGS);
-static int bxe_sysctl_dump_rx_chain(SYSCTL_HANDLER_ARGS);
+static int bxe_sysctl_dump_rx_cq_chain(SYSCTL_HANDLER_ARGS);
+static int bxe_sysctl_dump_rx_bd_chain(SYSCTL_HANDLER_ARGS);
 static int bxe_sysctl_dump_tx_chain(SYSCTL_HANDLER_ARGS);
 static int bxe_sysctl_reg_read(SYSCTL_HANDLER_ARGS);
 static int bxe_sysctl_breakpoint(SYSCTL_HANDLER_ARGS);
@@ -357,16 +358,16 @@ static void bxe_dump_enet(struct bxe_sof
 static void bxe_dump_mbuf (struct bxe_softc *, struct mbuf *);
 static void bxe_dump_tx_mbuf_chain(struct bxe_softc *, int, int);
 static void bxe_dump_rx_mbuf_chain(struct bxe_softc *, int, int);
-static void bxe_dump_pbd_locked(struct bxe_softc *,int,
+static void bxe_dump_tx_parsing_bd(struct bxe_fastpath *,int,
struct eth_tx_parse_bd *);
-static void bxe_dump_txbd_locked(struct bxe_fastpath *, int,
-   struct eth_tx_bd *);
-static void bxe_dump_rxbd_locked(struct bxe_fastpath *, int,
+static void bxe_dump_txbd(struct bxe_fastpath *, int,
+   union eth_tx_bd_types *);
+static void bxe_dump_rxbd(struct bxe_fastpath *, int,
struct eth_rx_bd *);
-static void bxe_dump_cqe_locked(struct bxe_fastpath *, int, union eth_rx_cqe 
*);
+static void bxe_dump_cqe(struct bxe_fastpath *, int, union eth_rx_cqe *);
 static void bxe_dump_tx_chain(struct bxe_fastpath *, int, int);
-static void bxe_dump_cqe_chain(struct bxe_fastpath *, int, int);
-static void bxe_dump_rx_chain(struct bxe_fastpath *, int, int);
+static void bxe_dump_rx_cq_chain(struct bxe_fastpath *, int, int);
+static void bxe_dump_rx_bd_chain(struct bxe_fastpath *, int, int);
 static void bxe_dump_status_block(struct bxe_softc *);
 static void bxe_dump_stats_block(struct bxe_softc *);
 static void bxe_dump_fp_state(struct bxe_fastpath *);
@@ -404,6 +405,7 @@ static device_method_t bxe_methods[] = {
KOBJMETHOD_END
 };
 
+
 static driver_t bxe_driver = {
"bxe",
bxe_methods,
@@ -1725,11 +1727,11 @@ bxe_attach(device_t dev)
 * processor memory.
 */
rid = PCIR_BAR(0);
-   sc->bxe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
-   &rid, RF_ACTIVE);
+   sc->bxe_res = bus_alloc_resource_any(dev,
+   SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (sc->bxe_res == NULL) {
BXE_PRINTF("%s(%d):PCI BAR0 memory allocation failed\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
rc = ENXIO;
goto bxe_attach_fail;
}
@@ -1744,11 +1746,11 @@ bxe_attach(device_t dev)
 * Doorbell (DB) memory.
 */
rid = PCIR_BAR(2);
-   sc->bxe_db_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY,
-   &rid, RF_ACTIVE);
+   sc->bxe_db_res = bus_alloc_resource_any(dev,
+   SYS_RES_MEMORY, &rid, RF_ACTIVE);
if (sc->bxe_db_res == NULL) {
BXE_PRINTF("%s(%d): PCI BAR2 memory allocation failed\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
rc = ENXIO;
goto bxe_attach_fail;
}
@@ -1834,7 +1836,6 @@ bxe_attach(device_t dev)
 
 
 #ifdef BXE_DEBUG
-
/* Allocate a memory buffer for grcdump output.*/
sc->grcdump_buffer = malloc(BXE_GRCDUMP_BUF_SIZE, M_TEMP, M_NOWAIT);
if (sc->grcdump_buffer == NULL) {
@@ -3738,8 +3739,8 @@ bxe_init_locked(struct bxe_softc *sc, in
callout_reset(&sc->bxe_tick_callout, hz, bxe_tick, sc);
/* Everything went OK, go ahead and exit. */
goto bxe_init_locked_exit;
+
/* Try and gracefully shutdown the device because of a failure. */
-/* Try and gracefully shutdown the device because of a failure. */
 bxe_init_locked_failed4:
 
for (i = 1; i < sc->num_queues; i++)
@@ -4413,6 +4414,7 @@ bxe_write_dmae(struct b

svn commit: r220230 - head/sys/dev/bxe

2011-03-31 Thread David Christensen
Author: davidch
Date: Thu Mar 31 22:50:55 2011
New Revision: 220230
URL: http://svn.freebsd.org/changeset/base/220230

Log:
  - Fixed build problem when not useing BXE_DEBUG.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/if_bxe.c

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Mar 31 22:40:44 2011(r220229)
+++ head/sys/dev/bxe/if_bxe.c   Thu Mar 31 22:50:55 2011(r220230)
@@ -15627,13 +15627,6 @@ bxe_add_sysctls(struct bxe_softc *sc)
SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bxe_dev));
struct bxe_eth_stats *estats = &sc->eth_stats;
 
-   struct sysctl_oid *queue_node;
-   struct sysctl_oid_list *queue_list;
-
-#define QUEUE_NAME_LEN 32
-   char namebuf[QUEUE_NAME_LEN];
-
-
SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
"estats_total_bytes_received_hi",
CTLFLAG_RD, &estats->total_bytes_received_hi,
@@ -15747,28 +15740,36 @@ bxe_add_sysctls(struct bxe_softc *sc)
CTLFLAG_RD, &sc->mbuf_alloc_failed, 0,
"mbuf cluster allocation failures");
 
-   for (int i = 0; i < sc->num_queues; i++) {
-   struct bxe_fastpath *fp = &sc->fp[i];
-   snprintf(namebuf, QUEUE_NAME_LEN, "fp[%02d]", i);
-
-   queue_node = SYSCTL_ADD_NODE(ctx, children, OID_AUTO,
-   namebuf, CTLFLAG_RD, NULL, "Queue Name");
-   queue_list = SYSCTL_CHILDREN(queue_node);
-
-   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
-   "mbuf_alloc_failed",
-   CTLFLAG_RD, &fp->mbuf_alloc_failed,
-   "Mbuf allocation failures");
-
-   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
-   "mbuf_defrag_attempts",
-   CTLFLAG_RD, &fp->mbuf_defrag_attempts,
-   "Mbuf defrag attempts");
-
-   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
-   "mbuf_defrag_successes",
-   CTLFLAG_RD, &fp->mbuf_defrag_successes,
-   "Mbuf defrag successes");
+   do() {
+#define QUEUE_NAME_LEN 32
+   char namebuf[QUEUE_NAME_LEN];
+   struct sysctl_oid *queue_node;
+   struct sysctl_oid_list *queue_list;
+
+   for (int i = 0; i < sc->num_queues; i++) {
+   struct bxe_fastpath *fp = &sc->fp[i];
+   snprintf(namebuf, QUEUE_NAME_LEN, "fp[%02d]", i);
+
+   queue_node = SYSCTL_ADD_NODE(ctx, children, OID_AUTO,
+   namebuf, CTLFLAG_RD, NULL, "Queue Name");
+   queue_list = SYSCTL_CHILDREN(queue_node);
+
+   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
+   "mbuf_alloc_failed",
+   CTLFLAG_RD, &fp->mbuf_alloc_failed,
+   "Mbuf allocation failures");
+
+   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
+   "mbuf_defrag_attempts",
+   CTLFLAG_RD, &fp->mbuf_defrag_attempts,
+   "Mbuf defrag attempts");
+
+   SYSCTL_ADD_ULONG(ctx, queue_list, OID_AUTO,
+   "mbuf_defrag_successes",
+   CTLFLAG_RD, &fp->mbuf_defrag_successes,
+   "Mbuf defrag successes");
+   }
+
}
 
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "driver_state",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r220377 - head/sys/dev/bxe

2011-04-05 Thread David Christensen
Author: davidch
Date: Tue Apr  5 22:13:33 2011
New Revision: 220377
URL: http://svn.freebsd.org/changeset/base/220377

Log:
  - Removed multiple console error messages and replaced with statistic
counters to reduce spew.
  - Fixed a TSO problem when an mbuf contains both header and payload in
the same cluster.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Tue Apr  5 21:56:05 2011(r220376)
+++ head/sys/dev/bxe/if_bxe.c   Tue Apr  5 22:13:33 2011(r220377)
@@ -1674,7 +1674,8 @@ bxe_init_firmware(struct bxe_softc *sc)
else if (CHIP_IS_E1H(sc))
bxe_init_e1h_firmware(sc);
else {
-   BXE_PRINTF("Unsupported chip revision\n");
+   BXE_PRINTF("%s(%d): Unsupported chip revision\n",
+   __FILE__, __LINE__);
return (ENXIO);
}
return (0);
@@ -1840,7 +1841,8 @@ bxe_attach(device_t dev)
sc->grcdump_buffer = malloc(BXE_GRCDUMP_BUF_SIZE, M_TEMP, M_NOWAIT);
if (sc->grcdump_buffer == NULL) {
/* Failure is OK, just print a message and continue attach. */
-   BXE_PRINTF("Failed to allocate grcdump memory buffer!\n");
+   BXE_PRINTF("%s(%d): Failed to allocate grcdump memory "
+   "buffer!\n", __FILE__, __LINE__);
}
 #endif
 
@@ -1867,7 +1869,8 @@ bxe_attach(device_t dev)
/* If bootcode is not running only initialize port 0. */
if (nomcp && BP_PORT(sc)) {
BXE_PRINTF(
-   "Second device disabled (no bootcode), exiting...\n");
+   "%s(%d): Second device disabled (no bootcode), "
+   "exiting...\n", __FILE__, __LINE__);
rc = ENODEV;
goto bxe_attach_fail;
}
@@ -1907,7 +1910,7 @@ bxe_attach(device_t dev)
 
/* Allocate DMA memory resources. */
if (bxe_dma_alloc(sc->bxe_dev)) {
-   BXE_PRINTF("%s(%d): DMA allocation failed!\n",
+   BXE_PRINTF("%s(%d): DMA memory allocation failed!\n",
__FILE__, __LINE__);
rc = ENOMEM;
goto bxe_attach_fail;
@@ -2041,8 +2044,8 @@ bxe_link_settings_supported(struct bxe_s
 
default:
BXE_PRINTF(
-   "%s(%d): BAD External PHY NVRAM config data "
-   "(0x%08X).\n",
+   "%s(%d): Bad NVRAM 1Gb PHY configuration data "
+   "(ext_phy_config=0x%08X).\n",
__FILE__, __LINE__,
sc->link_params.ext_phy_config);
goto bxe_link_settings_supported_exit;
@@ -2199,10 +2202,10 @@ bxe_link_settings_supported(struct bxe_s
__FUNCTION__);
break;
 
-   default:
BXE_PRINTF(
-   "%s(%d): BAD External PHY NVRAM config data "
-   "(0x%08X).\n", __FILE__, __LINE__,
+   "%s(%d): Bad NVRAM 10Gb PHY configuration data "
+   "(ext_phy_config=0x%08X).\n",
+   __FILE__, __LINE__,
sc->link_params.ext_phy_config);
goto bxe_link_settings_supported_exit;
}
@@ -2501,7 +2504,7 @@ bxe_get_function_hwinfo(struct bxe_softc
 
if ((mac_lo == 0) && (mac_hi == 0)) {
BXE_PRINTF("%s(%d): Invalid Ethernet address!\n",
-   __FILE__, __LINE__);
+   __FILE__, __LINE__);
} else {
sc->link_params.mac_addr[0] = (u_char)(mac_hi >> 8);
sc->link_params.mac_addr[1] = (u_char)(mac_hi);
@@ -2671,7 +2674,8 @@ bxe_get_common_hwinfo(struct bxe_softc *
val = SHMEM_RD(sc, validity_map[BP_PORT(sc)]);
if ((val & (SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) !=
(SHR_MEM_VALIDITY_DEV_INFO | SHR_MEM_VALIDITY_MB)) {
-   BXE_PRINTF("Invalid NVRAM-Bad validity signature!\n");
+   BXE_PRINTF("%s(%d): Invalid NVRAM! Bad validity "
+   "signature.\n", __FILE__, __LINE__);
goto bxe_get_common_hwinfo_exit;
}
 
@@ -2705,9 +2709,9 @@ bxe_get_common_hwinfo(struct bxe_softc *
/* Check bootcode version */
sc->common.bc_ver = ((SHMEM_RD(sc, dev_info.bc_rev)) >> 8);
if (sc->common.bc_ver < MIN_BXE_BC_VER) {
-   BXE_PRINTF("Warning: This driver needs bootcode 0x%08X "
-   "but found 0x%08X, please upgrade!\n", MIN_BXE_BC_VER,
-   sc->common.bc_ver);
+   BXE_PRINTF("%s(%d

svn commit: r220427 - head/sys/dev/bxe

2011-04-07 Thread David Christensen
Author: davidch
Date: Thu Apr  7 20:15:36 2011
New Revision: 220427
URL: http://svn.freebsd.org/changeset/base/220427

Log:
  - Fixed a problem when multiqueue mode was enabled which caused the CQ
chain to be corrupted.
  - Removed many console print warnings and replaced with driver maintained
counters.
  - Several style(9) fixes.
  
  MFC after:  One week.

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu Apr  7 16:06:39 2011(r220426)
+++ head/sys/dev/bxe/if_bxe.c   Thu Apr  7 20:15:36 2011(r220427)
@@ -481,16 +481,12 @@ SYSCTL_UINT(_hw_bxe, OID_AUTO, queue_cou
  * destination IP address and the source/destination TCP port).
  *
  */
+/* static int bxe_multi_mode = ETH_RSS_MODE_REGULAR; */
 static int bxe_multi_mode = ETH_RSS_MODE_DISABLED;
 TUNABLE_INT("hw.bxe.multi_mode", &bxe_multi_mode);
 SYSCTL_UINT(_hw_bxe, OID_AUTO, multi_mode, CTLFLAG_RDTUN, &bxe_multi_mode,
 0, "Multi-Queue Mode");
 
-static uint32_t bxe_pri_map = 0x0;
-TUNABLE_INT("hw.bxe.pri_map", &bxe_pri_map);
-SYSCTL_UINT(_hw_bxe, OID_AUTO, pri_map, CTLFLAG_RDTUN, &bxe_pri_map,
-0, "Priority map");
-
 /*
  * Host interrupt coalescing is controller by these values.
  * The first frame always causes an interrupt but subsequent
@@ -521,6 +517,7 @@ TUNABLE_INT("hw.bxe.mrrs", &bxe_mrrs);
 SYSCTL_UINT(_hw_bxe, OID_AUTO, mrrs, CTLFLAG_RDTUN, &bxe_mrrs,
 0, "PCIe maximum read request size.");
 
+#if 0
 /*
  * Allows setting the maximum number of received frames to process
  * during an interrupt.
@@ -544,6 +541,7 @@ static int bxe_tx_limit = -1;
 TUNABLE_INT("hw.bxe.tx_limit", &bxe_tx_limit);
 SYSCTL_UINT(_hw_bxe, OID_AUTO, tx_limit, CTLFLAG_RDTUN, &bxe_tx_limit,
0, "Maximum transmit frames processed during an interrupt.");
+#endif
 
 /*
  * Global variables
@@ -1891,8 +1889,16 @@ bxe_attach(device_t dev)
else
sc->mrrs = bxe_mrrs;
 
-   /* Select the RX and TX ring sizes */
-   sc->tx_ring_size = USABLE_TX_BD;
+   /*
+* Select the RX and TX ring sizes.  The actual
+* ring size for TX is complicated by the fact
+* that a single TX frame may be broken up into
+* many buffer descriptors (tx_start_bd,
+* tx_parse_bd, tx_data_bd).  In the best case,
+* there are always at least two BD's required
+* so we'll assume the best case here.
+*/
+   sc->tx_ring_size = (USABLE_TX_BD >> 1);
sc->rx_ring_size = USABLE_RX_BD;
 
/* Assume receive IP/TCP/UDP checksum is enabled. */
@@ -2907,7 +2913,7 @@ bxe_setup_leading(struct bxe_softc *sc)
 
DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | BXE_VERBOSE_RAMROD);
 
-   DBPRINT(sc, BXE_INFO_LOAD, "%s(): Setup leading connection "
+   DBPRINT(sc, BXE_VERBOSE_LOAD, "%s(): Setup leading connection "
"on fp[00].\n", __FUNCTION__);
 
/* Reset IGU state for the leading connection. */
@@ -2938,7 +2944,7 @@ bxe_stop_leading(struct bxe_softc *sc)
 
DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | BXE_VERBOSE_RAMROD);
 
-   DBPRINT(sc, BXE_INFO_LOAD, "%s(): Stop client connection "
+   DBPRINT(sc, BXE_VERBOSE_LOAD, "%s(): Stop client connection "
"on fp[00].\n", __FUNCTION__);
 
/* Send the ETH_HALT ramrod. */
@@ -2999,7 +3005,7 @@ bxe_setup_multi(struct bxe_softc *sc, in
 
DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | BXE_VERBOSE_RAMROD);
 
-   DBPRINT(sc, BXE_INFO_LOAD, "%s(): Setup client connection "
+   DBPRINT(sc, BXE_VERBOSE_LOAD, "%s(): Setup client connection "
"on fp[%02d].\n", __FUNCTION__, index);
 
fp = &sc->fp[index];
@@ -3034,7 +3040,7 @@ bxe_stop_multi(struct bxe_softc *sc, int
 
DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | BXE_VERBOSE_RAMROD);
 
-   DBPRINT(sc, BXE_INFO_LOAD, "%s(): Stop client connection "
+   DBPRINT(sc, BXE_VERBOSE_LOAD, "%s(): Stop client connection "
"on fp[%02d].\n", __FUNCTION__, index);
 
fp = &sc->fp[index];
@@ -3679,6 +3685,7 @@ bxe_init_locked(struct bxe_softc *sc, in
BXE_PRINTF("Multi-function mode is disabled\n");
/* sc->state = BXE_STATE_DISABLED; */
}
+
/* Setup additional client connections for RSS/multi-queue */
if (sc->state == BXE_STATE_OPEN) {
for (i = 1; i < sc->num_queues; i++) {
@@ -3794,9 +3801,9 @@ bxe_wait_ramrod(struct bxe_softc *sc, in
 
DBENTER(BXE_VERBOSE_LOAD | BXE_VERBOSE_RESET | BXE_VERBOSE_RAMROD);
 
-   DBPRINT(sc, BXE_VERBOSE_RAMROD, "%s(): %s for state 0x%08X on fp[%d], "
-   "currently 0x%08X.\n", __FUNCTION__, poll ? "Polling" : "Waiting",
-   state, idx, *state_p);
+   DBPRINT(sc, BXE_VERBOSE_RAMROD, "%s(): %s for state 0x%08X on "
+   

svn commit: r220932 - head/sys/dev/bxe

2011-04-21 Thread David Christensen
Author: davidch
Date: Thu Apr 21 23:06:00 2011
New Revision: 220932
URL: http://svn.freebsd.org/changeset/base/220932

Log:
  - Centralize driver tunables initialization/validation.
  - Centralize PCI resource allocation/release.
  - Enable flowid (TSS) support.
  - Added "per-fastpath" locks and watchdog timeouts.
  - Fixed problem where the CQ producer index was advanced beyond
the size of the CQ ring during initialization.
  - Replaced hard-coded debug levels in some debug print statements.
  - More style(9) fixes.
  
  MFC after:Two weeks

Modified:
  head/sys/dev/bxe/bxe_debug.h
  head/sys/dev/bxe/bxe_include.h
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/bxe_debug.h
==
--- head/sys/dev/bxe/bxe_debug.hThu Apr 21 21:56:28 2011
(r220931)
+++ head/sys/dev/bxe/bxe_debug.hThu Apr 21 23:06:00 2011
(r220932)
@@ -159,50 +159,50 @@ extern uint32_t bxe_debug;
 #ifdef BXE_DEBUG
 
 /* Print a message based on the logging level and code path. */
-#define DBPRINT(sc, level, format, args...)
\
-   do {
\
-   if (BXE_LOG_MSG(level)) {   
\
-   device_printf(sc->bxe_dev, format, ## args);\
-   }   
\
+#define DBPRINT(sc, level, format, args...)\
+   do {\
+   if (BXE_LOG_MSG(level)) {   \
+   device_printf(sc->dev, format, ## args);\
+   }   \
} while (0)
 
 /* Runs a particular command when debugging is enabled. */
-#define DBRUN(args...) \
-   do {\
-   args;   \
+#define DBRUN(args...) \
+   do {\
+   args;   \
} while (0)
 
 /* Runs a particular command based on the logging level. */
-#define DBRUNLV(level, args...) \
-   if (BXE_MSG_LEVEL(level)) { \
-   args;   \
+#define DBRUNLV(level, args...)\
+   if (BXE_MSG_LEVEL(level)) { \
+   args;   \
}
 
 /* Runs a particular command based on the code path. */
-#define DBRUNCP(cp, args...)   \
-   if (BXE_CODE_PATH(cp)) {\
-   args;   \
+#define DBRUNCP(cp, args...)   \
+   if (BXE_CODE_PATH(cp)) {\
+   args;   \
}
 
 /* Runs a particular command based on a condition. */
-#define DBRUNIF(cond, args...) \
-   if (cond) { \
-   args;   \
+#define DBRUNIF(cond, args...) \
+   if (cond) { \
+   args;   \
}
 
 /* Runs a particular command based on the logging level and code path. */
-#define DBRUNMSG(msg, args...) \
-   if (BXE_LOG_MSG(msg)) { \
-   args;   \
+#define DBRUNMSG(msg, args...) \
+   if (BXE_LOG_MSG(msg)) { \
+   args;   \
}
 
 /* Announces function entry. */
-#define DBENTER(cond)  \
-   DBPRINT(sc, (cond), "%s(enter:%d)\n", __FUNCTION__, curcpu) \
+#define DBENTER(cond)  \
+   DBPRINT(sc, (cond), "%s(enter:%d)\n", __FUNCTION__, curcpu)
 
 /* Announces function exit. */
-#define DBEXIT(cond)   \
-   DBPRINT(sc, (cond), "%s(exit:%d)\n", __FUNCTION__, curcpu) \
+#define DBEXIT(cond)   \
+   DBPRINT(sc, (cond), "%s(exit:%d)\n", __FUNCTION__, curcpu)
 
 /* Needed for random() function which is only used in debugging. */
 #include 

Modified: head/sys/dev/bxe/bxe_include.h
==
--- head/sys/dev/bxe/bxe_include.h  Thu Apr 21 21:56:28 2011   

svn commit: r221030 - head/sys/modules

2011-04-25 Thread David Christensen
Author: davidch
Date: Mon Apr 25 21:53:41 2011
New Revision: 221030
URL: http://svn.freebsd.org/changeset/base/221030

Log:
  - Added bxe(4) driver for i386 and amd64. Currently untested on other
CPU architectures.
  
  MFC after:One week

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Apr 25 21:27:38 2011(r221029)
+++ head/sys/modules/Makefile   Mon Apr 25 21:53:41 2011(r221030)
@@ -40,6 +40,8 @@ SUBDIR=   ${_3dfx} \
bce \
bfe \
bge \
+   ${_bxe} \
+   ${_bxe} \
${_bios} \
${_bktr} \
${_bm} \
@@ -383,6 +385,7 @@ _aout=  aout
 _apm=  apm
 _arcnet=   arcnet
 _bktr= bktr
+_bxe=  bxe
 _cardbus=  cardbus
 _cbb=  cbb
 _ce=   ce
@@ -529,6 +532,7 @@ _amdsbwd=   amdsbwd
 _amdtemp=  amdtemp
 _arcmsr=   arcmsr
 _asmc= asmc
+_bxe=  bxe
 _cardbus=  cardbus
 _cbb=  cbb
 _cmx=  cmx
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r221031 - head/sys/modules

2011-04-25 Thread David Christensen
Author: davidch
Date: Mon Apr 25 22:00:23 2011
New Revision: 221031
URL: http://svn.freebsd.org/changeset/base/221031

Log:
  - Removed duplicate {_bxe} definition.
  
  MFC after:One week

Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Apr 25 21:53:41 2011(r221030)
+++ head/sys/modules/Makefile   Mon Apr 25 22:00:23 2011(r221031)
@@ -41,7 +41,6 @@ SUBDIR=   ${_3dfx} \
bfe \
bge \
${_bxe} \
-   ${_bxe} \
${_bios} \
${_bktr} \
${_bm} \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r221342 - head/sys/dev/bxe

2011-05-02 Thread David Christensen
Author: davidch
Date: Mon May  2 20:43:24 2011
New Revision: 221342
URL: http://svn.freebsd.org/changeset/base/221342

Log:
  - Re-committed r220603 which was accidentally backed out by an earlier
commit.
  - Fixed a bug in an unused debug macro.
  
  MFC after:One week.

Modified:
  head/sys/dev/bxe/bxe_debug.h
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/bxe_debug.h
==
--- head/sys/dev/bxe/bxe_debug.hMon May  2 20:37:30 2011
(r221341)
+++ head/sys/dev/bxe/bxe_debug.hMon May  2 20:43:24 2011
(r221342)
@@ -210,7 +210,7 @@ extern uint32_t bxe_debug;
 /* Returns FALSE in "defects" per 2^31 - 1 calls, otherwise returns TRUE. */
 #define DB_RANDOMFALSE(defects)(random() > defects)
 #define DB_OR_RANDOMFALSE(defects)  || (random() > defects)
-#define DB_AND_RANDOMFALSE(defects) && (random() > ddfects)
+#define DB_AND_RANDOMFALSE(defects) && (random() > defects)
 
 /* Returns TRUE in "defects" per 2^31 - 1 calls, otherwise returns FALSE. */
 #define DB_RANDOMTRUE(defects) (random() < defects)

Modified: head/sys/dev/bxe/if_bxe.h
==
--- head/sys/dev/bxe/if_bxe.h   Mon May  2 20:37:30 2011(r221341)
+++ head/sys/dev/bxe/if_bxe.h   Mon May  2 20:43:24 2011(r221342)
@@ -1150,9 +1150,6 @@ struct bxe_fastpath {
 
 /* ToDo: Audit this structure for unused varaibles. */
 struct bxe_softc {
-   /*
-* MUST start with ifnet pointer (see definition of miibus_statchg()).
-*/
struct ifnet*bxe_ifp;
int media;
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r221354 - head/sys/dev/bxe

2011-05-02 Thread David Christensen
Author: davidch
Date: Mon May  2 23:34:33 2011
New Revision: 221354
URL: http://svn.freebsd.org/changeset/base/221354

Log:
  - Fixed a typo in an if() statement when setting flow control for MTU
greater than 5000 bytes.
  
  Submitted by: yongari

Modified:
  head/sys/dev/bxe/if_bxe.c

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Mon May  2 22:54:24 2011(r221353)
+++ head/sys/dev/bxe/if_bxe.c   Mon May  2 23:34:33 2011(r221354)
@@ -3600,7 +3600,7 @@ bxe_initial_phy_init(struct bxe_softc *s
 * It is recommended to turn off RX flow control for 5771x
 * when using jumbo frames for better performance.
 */
-   if (!IS_E1HMF(sc) & (sc->mbuf_alloc_size > 5000))
+   if (!IS_E1HMF(sc) && (sc->mbuf_alloc_size > 5000))
sc->link_params.req_fc_auto_adv = FLOW_CTRL_TX;
else
sc->link_params.req_fc_auto_adv = FLOW_CTRL_BOTH;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r206268 - head/sys/dev/bce

2010-04-06 Thread David Christensen
Author: davidch
Date: Tue Apr  6 12:44:28 2010
New Revision: 206268
URL: http://svn.freebsd.org/changeset/base/206268

Log:
  - Fixed 5708S 2.5G support broken in last commit.
  - Added some new debug helper routines to systcl.
  - Fixed many of the style(9) violations that have crept into the code
due to my use of a "smart" editor.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Tue Apr  6 12:33:05 2010(r206267)
+++ head/sys/dev/bce/if_bce.c   Tue Apr  6 12:44:28 2010(r206268)
@@ -39,8 +39,8 @@ __FBSDID("$FreeBSD$");
  *   BCM5708S B1, B2
  *   BCM5709C A1, C0
  *   BCM5709S A1, C0
- *  BCM5716C C0
- *  BCM5716S C0
+ *   BCM5716C C0
+ *   BCM5716S C0
  *
  * The following controllers are not supported by this driver:
  *   BCM5706C A0, A1 (pre-production)
@@ -277,37 +277,41 @@ static struct flash_spec flash_5709 = {
 //
 /* FreeBSD device entry points. */
 //
-static int  bce_probe  (device_t);
-static int  bce_attach (device_t);
-static int  bce_detach (device_t);
-static int  bce_shutdown   (device_t);
+static int  bce_probe  (device_t);
+static int  bce_attach (device_t);
+static int  bce_detach (device_t);
+static int  bce_shutdown   (device_t);
 
 
 //
 /* BCE Debug Data Structure Dump Routines   */
 //
 #ifdef BCE_DEBUG
-static u32 bce_reg_rd  (struct bce_softc *, 
u32);
-static voidbce_reg_wr  (struct bce_softc *, 
u32, u32);
-static voidbce_reg_wr16(struct bce_softc *, u32, u16);
-static u32  bce_ctx_rd (struct bce_softc *, u32, u32);
-static void bce_dump_enet   (struct bce_softc *, struct mbuf *);
-static void bce_dump_mbuf  (struct bce_softc *, struct 
mbuf *);
+static u32  bce_reg_rd (struct bce_softc *, u32);
+static void bce_reg_wr (struct bce_softc *, u32, u32);
+static void bce_reg_wr16   (struct bce_softc *, u32, u16);
+static u32  bce_ctx_rd (struct bce_softc *, u32, u32);
+static void bce_dump_enet  (struct bce_softc *, struct mbuf *);
+static void bce_dump_mbuf  (struct bce_softc *, struct mbuf *);
 static void bce_dump_tx_mbuf_chain (struct bce_softc *, u16, int);
 static void bce_dump_rx_mbuf_chain (struct bce_softc *, u16, int);
 #ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_mbuf_chain (struct bce_softc *, u16, int);
 #endif
-static void bce_dump_txbd  (struct bce_softc *, int, 
struct tx_bd *);
-static void bce_dump_rxbd  (struct bce_softc *, int, 
struct rx_bd *);
+static void bce_dump_txbd  (struct bce_softc *,
+int, struct tx_bd *);
+static void bce_dump_rxbd  (struct bce_softc *,
+int, struct rx_bd *);
 #ifdef BCE_JUMBO_HDRSPLIT
-static void bce_dump_pgbd  (struct bce_softc *, int, 
struct rx_bd *);
+static void bce_dump_pgbd  (struct bce_softc *, 
+int, struct rx_bd *);
 #endif
-static void bce_dump_l2fhdr(struct bce_softc *, int, 
struct l2_fhdr *);
-static void bce_dump_ctx   (struct bce_softc *, u16);
-static void bce_dump_ftqs  (struct bce_softc *);
+static void bce_dump_l2fhdr(struct bce_softc *,
+int, struct l2_fhdr *);
+static void bce_dump_ctx   (struct bce_softc *, u16);
+static void bce_dump_ftqs  (struct bce_softc *);
 static void bce_dump_tx_chain  (struct bce_softc *, u16, int);
-static void bce_dump_rx_chain  (struct bce_softc *, u16, int);
+static void bce_dump_rx_bd_chain   (struct bce_softc *, u16, int);
 #ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_chain  (struct bce_softc *, u16, int);
 #endif
@@ -315,7 +319,7 @@ static void bce_dump_status_block   (struc
 static void bce_dump_stats_block   (struct bce_softc *);
 static void bce_dump_driver_state  (struct bce_softc *);
 static void bce_dump_hw_state  (struct bce_softc *);
-static void bce_dump_mq_regs(struct bce_softc *);
+static void bce_dump_mq_regs   (struct bce_softc *);
 static void bce_dump_bc_state  (struct bce_softc *);
 static void bce_dump_txp

svn commit: r207391 - head/sys/dev/mii

2010-04-29 Thread David Christensen
Author: davidch
Date: Thu Apr 29 22:00:57 2010
New Revision: 207391
URL: http://svn.freebsd.org/changeset/base/207391

Log:
  - Pass flow control settings back to bce(4).
  
  MFC after:Two weeks

Modified:
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Apr 29 21:55:20 2010(r207390)
+++ head/sys/dev/mii/brgphy.c   Thu Apr 29 22:00:57 2010(r207391)
@@ -685,16 +685,15 @@ brgphy_status(struct mii_softc *sc)
 
}
 
-#if 0
-   /* Todo: Change bge/bce to use these settings. */
+   /* Todo: Change bge to use these settings. */
 
-   /* Fetch flow control settings from the PHY */
+   /* Fetch flow control settings from the copper PHY. */
if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) {
-   /* Set FLAG0 is RX is enabled and FLAG1 if TX is enabled */
+   /* Set FLAG0 if RX is enabled and FLAG1 if TX is enabled */
if ((anar & BRGPHY_ANAR_PC) && (anlpar & BRGPHY_ANLPAR_PC)) {
mii->mii_media_active |= IFM_FLAG0 | IFM_FLAG1;
} else if (!(anar & BRGPHY_ANAR_PC) && (anlpar & 
BRGPHY_ANAR_ASP) &&
-   (anlpar & BRPHY_ANLPAR_PC) && (anlpar & BRGPHY_ANLPAR_ASP)) 
{
+   (anlpar & BRGPHY_ANLPAR_PC) && (anlpar & 
BRGPHY_ANLPAR_ASP)) {
mii->mii_media_active |= IFM_FLAG1;
} else if ((anar & BRGPHY_ANAR_PC) && (anar & BRGPHY_ANAR_ASP) 
&&
!(anlpar & BRGPHY_ANLPAR_PC) && (anlpar & 
BRGPHY_ANLPAR_ASP)) {
@@ -703,7 +702,6 @@ brgphy_status(struct mii_softc *sc)
}
 
/* Todo: Add support for fiber settings too. */
-#endif
 
 
 brgphy_status_exit:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r207411 - head/sys/dev/bce

2010-04-29 Thread David Christensen
Author: davidch
Date: Fri Apr 30 02:35:46 2010
New Revision: 207411
URL: http://svn.freebsd.org/changeset/base/207411

Log:
  - Enable flow control.
  - Print device details only when verbose boot is enabled.
  - Add debug output for shared memory access.
  - Add debug statistics (checksum offload & VLAN frame counters).
  - Modify TX path to update consumer index for each frame completed
rather than updating the consumer index only once for a group of
frames to improve small packet performance.
  - Print driver/firmware pulse messages only when verbose boot
is enabled.
  - Add debug sysctl to clear statistics.
  - Fix more style(9) violations.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Fri Apr 30 00:46:43 2010(r207410)
+++ head/sys/dev/bce/if_bce.c   Fri Apr 30 02:35:46 2010(r207411)
@@ -303,7 +303,7 @@ static void bce_dump_txbd   (struct bce_s
 static void bce_dump_rxbd  (struct bce_softc *,
 int, struct rx_bd *);
 #ifdef BCE_JUMBO_HDRSPLIT
-static void bce_dump_pgbd  (struct bce_softc *, 
+static void bce_dump_pgbd  (struct bce_softc *,
 int, struct rx_bd *);
 #endif
 static void bce_dump_l2fhdr(struct bce_softc *,
@@ -368,7 +368,7 @@ static int  bce_nvram_write (struct bce
 //
 static void bce_get_media  (struct bce_softc *);
 static void bce_init_media (struct bce_softc *);
-static void bce_dma_map_addr   (void *, 
+static void bce_dma_map_addr   (void *,
 bus_dma_segment_t *, int, int);
 static int  bce_dma_alloc  (device_t);
 static void bce_dma_free   (struct bce_softc *);
@@ -379,7 +379,7 @@ static void bce_release_resources   (struc
 //
 static int  bce_fw_sync(struct bce_softc *, u32);
 static void bce_load_rv2p_fw   (struct bce_softc *, u32 *, u32, u32);
-static void bce_load_cpu_fw(struct bce_softc *, 
+static void bce_load_cpu_fw(struct bce_softc *,
 struct cpu_reg *, struct fw_info *);
 static void bce_start_cpu  (struct bce_softc *, struct cpu_reg *);
 static void bce_halt_cpu   (struct bce_softc *, struct cpu_reg *);
@@ -401,21 +401,21 @@ static int  bce_blockinit (struct bce_
 static int  bce_init_tx_chain  (struct bce_softc *);
 static void bce_free_tx_chain  (struct bce_softc *);
 
-static int  bce_get_rx_buf (struct bce_softc *, 
+static int  bce_get_rx_buf (struct bce_softc *,
 struct mbuf *, u16 *, u16 *, u32 *);
 static int  bce_init_rx_chain  (struct bce_softc *);
 static void bce_fill_rx_chain  (struct bce_softc *);
 static void bce_free_rx_chain  (struct bce_softc *);
 
 #ifdef BCE_JUMBO_HDRSPLIT
-static int  bce_get_pg_buf (struct bce_softc *, 
+static int  bce_get_pg_buf (struct bce_softc *,
 struct mbuf *, u16 *, u16 *);
 static int  bce_init_pg_chain  (struct bce_softc *);
 static void bce_fill_pg_chain  (struct bce_softc *);
 static void bce_free_pg_chain  (struct bce_softc *);
 #endif
 
-static struct mbuf *bce_tso_setup  (struct bce_softc *, 
+static struct mbuf *bce_tso_setup  (struct bce_softc *,
 struct mbuf **, u16 *);
 static int  bce_tx_encap   (struct bce_softc *, struct mbuf **);
 static void bce_start_locked   (struct ifnet *);
@@ -566,7 +566,7 @@ bce_probe(device_t dev)
 
/* Print out the device identity. */
snprintf(descbuf, BCE_DEVDESC_MAX, "%s (%c%d)",
-   t->bce_name, (((pci_read_config(dev, 
+   t->bce_name, (((pci_read_config(dev,
PCIR_REVID, 4) & 0xf0) >> 4) + 'A'),
(pci_read_config(dev, PCIR_REVID, 4) & 0xf));
 
@@ -593,57 +593,60 @@ bce_probe(device_t dev)
 static void
 bce_print_adapter_info(struct bce_softc *sc)
 {
-int i = 0;
+   int i = 0;
 
DBENTER(BCE_VERBOSE_LOAD);
 
-   BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid);
-   printf("Rev (%c%d); ", ((BCE_CHIP_ID(sc) & 0xf000) >> 12) + 'A',
-   ((BCE_CHIP_ID(sc) & 0x0ff0) >> 4));
-
-   /* Bus info. */
-   if (sc->bce_flags & BCE_PCIE_FLAG) {
-   printf("Bus (PCIe x%d, ", sc->link_width);
-   switch (sc->link_speed) {
-   case 1: printf("2.5Gbps); "); break;
-   case 2: printf("5Gbps); "); break;
-   default: printf("Unknown link speed); ");
+   if (bootverbose) {
+   BCE_PRINTF("AS

svn commit: r221709 - head/sys/dev/bxe

2011-05-09 Thread David Christensen
Author: davidch
Date: Mon May  9 18:46:53 2011
New Revision: 221709
URL: http://svn.freebsd.org/changeset/base/221709

Log:
  - Simplify multicast address programming.
  - Fix an incorrect "uint32_t *" cast in bxe_set_rx_mode().
  
  Submitted by:   yongari@
  Approved by:davidch@
  MFC after:  Two weeks

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Mon May  9 18:46:49 2011(r221708)
+++ head/sys/dev/bxe/if_bxe.c   Mon May  9 18:46:53 2011(r221709)
@@ -3323,7 +3323,7 @@ bxe_stop_locked(struct bxe_softc *sc, in
bxe_set_mac_addr_e1(sc, 0);
 
for (i = 0; i < config->hdr.length; i++)
-   CAM_INVALIDATE(config->config_table[i]);
+   CAM_INVALIDATE(&config->config_table[i]);
 
config->hdr.length = i;
config->hdr.offset = BXE_MAX_MULTICAST * (1 + port);
@@ -14254,6 +14254,8 @@ static void
 bxe_set_mac_addr_e1(struct bxe_softc *sc, int set)
 {
struct mac_configuration_cmd *config;
+   struct mac_configuration_entry *config_table;
+   uint8_t *eaddr;
int port;
 
DBENTER(BXE_VERBOSE_MISC);
@@ -14274,43 +14276,40 @@ bxe_set_mac_addr_e1(struct bxe_softc *sc
config->hdr.reserved1 = 0;
 
/* Program the primary MAC address. */
-   config->config_table[0].cam_entry.msb_mac_addr =
-   ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]);
-   config->config_table[0].cam_entry.middle_mac_addr =
-   ntohs(*(uint16_t *)&sc->link_params.mac_addr[2]);
-   config->config_table[0].cam_entry.lsb_mac_addr =
-   ntohs(*(uint16_t *)&sc->link_params.mac_addr[4]);
-   config->config_table[0].cam_entry.flags = htole16(port);
+   config_table = &config->config_table[0];
+   eaddr = sc->link_params.mac_addr;
+   config_table->cam_entry.msb_mac_addr = eaddr[0] << 8 | eaddr[1];
+   config_table->cam_entry.middle_mac_addr = eaddr[2] << 8 | eaddr[3];
+   config_table->cam_entry.lsb_mac_addr = eaddr[4] << 8 | eaddr[5];
+   config_table->cam_entry.flags = htole16(port);
 
if (set)
-   config->config_table[0].target_table_entry.flags = 0;
+   config_table->target_table_entry.flags = 0;
else
-   CAM_INVALIDATE(config->config_table[0]);
+   CAM_INVALIDATE(config_table);
 
-   /* t48  config->config_table[0].target_table_entry.client_id = 0; */
-   config->config_table[0].target_table_entry.vlan_id = 0;
+   config_table->target_table_entry.vlan_id = 0;
 
DBPRINT(sc, BXE_VERBOSE, "%s(): %s MAC (%04x:%04x:%04x)\n",
   __FUNCTION__, (set ? "Setting" : "Clearing"),
-  config->config_table[0].cam_entry.msb_mac_addr,
-  config->config_table[0].cam_entry.middle_mac_addr,
-  config->config_table[0].cam_entry.lsb_mac_addr);
+  config_table->cam_entry.msb_mac_addr,
+  config_table->cam_entry.middle_mac_addr,
+  config_table->cam_entry.lsb_mac_addr);
 
/* Program the broadcast MAC address. */
-   config->config_table[1].cam_entry.msb_mac_addr = 0x;
-   config->config_table[1].cam_entry.middle_mac_addr = 0x;
-   config->config_table[1].cam_entry.lsb_mac_addr = 0x;
-   config->config_table[1].cam_entry.flags = htole16(port);
+   config_table = &config->config_table[1];
+   config_table->cam_entry.msb_mac_addr = 0x;
+   config_table->cam_entry.middle_mac_addr = 0x;
+   config_table->cam_entry.lsb_mac_addr = 0x;
+   config_table->cam_entry.flags = htole16(port);
 
if (set)
-   config->config_table[1].target_table_entry.flags =
+   config_table->target_table_entry.flags =
TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST;
else
-   CAM_INVALIDATE(config->config_table[1]);
-
-   /*t48   config->config_table[1].target_table_entry.client_id = 0; */
-   config->config_table[1].target_table_entry.vlan_id = 0;
+   CAM_INVALIDATE(config_table);
 
+   config_table->target_table_entry.vlan_id = 0;
 
/* Post the command to slow path queue. */
bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0,
@@ -14330,6 +14329,8 @@ static void
 bxe_set_mac_addr_e1h(struct bxe_softc *sc, int set)
 {
struct mac_configuration_cmd_e1h *config;
+   struct mac_configuration_entry_e1h *config_table;
+   uint8_t *eaddr;
int func, port;
 
DBENTER(BXE_VERBOSE_MISC);
@@ -14356,30 +14357,27 @@ bxe_set_mac_addr_e1h(struct bxe_softc *s
config->hdr.reserved1 = 0;
 
/* Program the primary MAC address. */
-   config->config_table[0].msb_mac_addr =
-   ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]);
-   config->config_table[0].middle_mac_addr =
-   

svn commit: r221826 - head/sys/dev/bxe

2011-05-12 Thread David Christensen
Author: davidch
Date: Thu May 12 23:26:53 2011
New Revision: 221826
URL: http://svn.freebsd.org/changeset/base/221826

Log:
  - Use bus_describe_intr() to describe interrupt usage.
  - Use bus_bind_intr() to bind interrupt to a CPU when RSS/TSS is used.
  - Use M_DONTWAIT for RSS/TSS buffer allocation.
  - Add statistic to track max DRBR queue depth.
  - Fix problem in bxe_change_mtu() which referenced the old MTU size
in a debug print statement.
  
  MFC after:Two weeks

Modified:
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Thu May 12 22:31:13 2011(r221825)
+++ head/sys/dev/bxe/if_bxe.c   Thu May 12 23:26:53 2011(r221826)
@@ -1330,9 +1330,9 @@ bxe_interrupt_attach(struct bxe_softc *s
/* Setup the slowpath deferred task queue. */
TASK_INIT(&sc->task, 0, bxe_task_sp, sc);
sc->tq = taskqueue_create_fast("bxe_spq", M_NOWAIT,
-   taskqueue_thread_enqueue, &sc->tq);
+   taskqueue_thread_enqueue, &sc->tq);
taskqueue_start_threads(&sc->tq, 1, PI_NET, "%s spq",
-   device_get_nameunit(sc->dev));
+   device_get_nameunit(sc->dev));
 #endif
 
/* Setup interrupt handlers. */
@@ -1359,13 +1359,19 @@ bxe_interrupt_attach(struct bxe_softc *s
goto bxe_interrupt_attach_exit;
}
 
+#if __FreeBSD_version >= 800504
+   bus_describe_intr(sc->dev,
+ sc->bxe_msix_res[0],
+ sc->bxe_msix_tag[0],
+ "sp");
+#endif
+
/* Now initialize the fastpath vectors. */
for (i = 0; i < (sc->num_queues); i++) {
fp = &sc->fp[i];
-   DBPRINT(sc,
-   (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR),
-   "%s(): Enabling MSI-X[%d] vector.\n",
-   __FUNCTION__, i + 1);
+   DBPRINT(sc, (BXE_VERBOSE_LOAD | BXE_VERBOSE_INTR),
+   "%s(): Enabling MSI-X[%d] vector.\n",
+   __FUNCTION__, i + 1);
/*
 * Setup the interrupt handler. Note that we pass the
 * fastpath context to the interrupt handler in this
@@ -1377,8 +1383,7 @@ bxe_interrupt_attach(struct bxe_softc *s
NULL,
bxe_intr_fp,
fp,
-   &sc->bxe_msix_tag[i + 1]
-   );
+   &sc->bxe_msix_tag[i + 1]);
 
if (rc) {
BXE_PRINTF(
@@ -1386,6 +1391,21 @@ bxe_interrupt_attach(struct bxe_softc *s
__FILE__, __LINE__, (i + 1));
goto bxe_interrupt_attach_exit;
}
+
+#if __FreeBSD_version >= 800504
+   bus_describe_intr(sc->dev,
+ sc->bxe_msix_res[i + 1],
+ sc->bxe_msix_tag[i + 1],
+ "fp[%02d]",
+ i);
+#endif
+
+   /* Bind the fastpath instance to a CPU. */
+   if (sc->num_queues > 1) {
+   bus_bind_intr(sc->dev,
+sc->bxe_msix_res[i + 1], i);
+   }
+
 #ifdef BXE_TASK
TASK_INIT(&fp->task, 0, bxe_task_fp, fp);
fp->tq = taskqueue_create_fast("bxe_fpq", M_NOWAIT,
@@ -1418,6 +1438,13 @@ bxe_interrupt_attach(struct bxe_softc *s
goto bxe_interrupt_attach_exit;
}
 
+#if __FreeBSD_version >= 800504
+   bus_describe_intr(sc->dev,
+ sc->bxe_msi_res[0],
+ sc->bxe_msi_tag[0],
+ "sp");
+#endif
+
/* Now initialize the fastpath vectors. */
for (i = 0; i < (sc->num_queues); i++) {
fp = &sc->fp[i];
@@ -1445,6 +1472,15 @@ bxe_interrupt_attach(struct bxe_softc *s
__FILE__, __LINE__, (i + 1));
goto bxe_interrupt_attach_exit;
}
+
+#if __FreeBSD_version >= 800504
+   bus_describe_intr(sc->dev,
+ sc->bxe_msi_res[i + 1],
+ sc->bxe_msi_tag[i + 1],
+ "fp[%02d]",
+ i);
+#endi

svn commit: r222875 - head/sys/dev/bxe

2011-06-08 Thread David Christensen
Author: davidch
Date: Wed Jun  8 21:18:14 2011
New Revision: 222875
URL: http://svn.freebsd.org/changeset/base/222875

Log:
  - Major reorganization of mbuf handling throughout the driver to
increase robustness (no more calls to panic(9)) and simplify
code.
  - Allocate RX/TX data structures as a single buffer rather than
an array of 4KB pages to simplify code.
  - Fixed LRO (aka TPA) code.  Removed kernel module parameter and
support enabling disabling LRO through ifconfig(8) command line.
LRO is still disabled by default but should be enabled for best
performance on an endpoint device.
  - Fixed statistcs code and removed kernel module parameter (stats
should just work).
  - Added many software counters to help identify the cause of some
performance issues.
  - Streamlined adapter internal init/stop code paths.
  - Fiddled with debug code (adding some here, removing some there).
  - Continued style(9) adjustments.

Modified:
  head/sys/dev/bxe/bxe_debug.h
  head/sys/dev/bxe/bxe_link.c
  head/sys/dev/bxe/if_bxe.c
  head/sys/dev/bxe/if_bxe.h

Modified: head/sys/dev/bxe/bxe_debug.h
==
--- head/sys/dev/bxe/bxe_debug.hWed Jun  8 21:14:04 2011
(r222874)
+++ head/sys/dev/bxe/bxe_debug.hWed Jun  8 21:18:14 2011
(r222875)
@@ -41,21 +41,22 @@ extern uint32_t bxe_debug;
  * Debugging macros and definitions.
  */
 
-#defineBXE_CP_LOAD 0x0001
-#defineBXE_CP_SEND 0x0002
-#defineBXE_CP_RECV 0x0004
-#defineBXE_CP_INTR 0x0008
-#defineBXE_CP_UNLOAD   0x0010
-#defineBXE_CP_RESET0x0020
-#defineBXE_CP_IOCTL0x0040
-#defineBXE_CP_STATS0x0080
-#defineBXE_CP_MISC 0x0100
-#defineBXE_CP_PHY  0x0200
-#defineBXE_CP_RAMROD   0x0400
-#defineBXE_CP_NVRAM0x0800
-#defineBXE_CP_REGS 0x1000
-#defineBXE_CP_ALL  0x00FF
-#defineBXE_CP_MASK 0x00FF
+#defineBXE_CP_LOAD 0x0001
+#defineBXE_CP_SEND 0x0002
+#defineBXE_CP_RECV 0x0004
+#defineBXE_CP_INTR 0x0008
+#defineBXE_CP_UNLOAD   0x0010
+#defineBXE_CP_RESET0x0020
+#defineBXE_CP_IOCTL0x0040
+#defineBXE_CP_STATS0x0080
+#defineBXE_CP_MISC 0x0100
+#defineBXE_CP_PHY  0x0200
+#defineBXE_CP_RAMROD   0x0400
+#defineBXE_CP_NVRAM0x0800
+#defineBXE_CP_REGS 0x1000
+#defineBXE_CP_TPA  0x2000
+#defineBXE_CP_ALL  0x00FF
+#defineBXE_CP_MASK 0x00FF
 
 #define BXE_LEVEL_FATAL0x
 #define BXE_LEVEL_WARN 0x0100
@@ -144,12 +145,18 @@ extern uint32_t bxe_debug;
 #define BXE_EXTREME_REGS   (BXE_CP_REGS | BXE_LEVEL_EXTREME)
 #define BXE_INSANE_REGS(BXE_CP_REGS | BXE_LEVEL_INSANE)
 
-#define BXE_FATAL  (BXE_CP_ALL | BXE_LEVEL_FATAL)
-#define BXE_WARN   (BXE_CP_ALL | BXE_LEVEL_WARN)
-#define BXE_INFO   (BXE_CP_ALL | BXE_LEVEL_INFO)
-#define BXE_VERBOSE(BXE_CP_ALL | BXE_LEVEL_VERBOSE)
-#define BXE_EXTREME(BXE_CP_ALL | BXE_LEVEL_EXTREME)
-#define BXE_INSANE (BXE_CP_ALL | BXE_LEVEL_INSANE)
+#define BXE_WARN_TPA   (BXE_CP_TPA | BXE_LEVEL_WARN)
+#define BXE_INFO_TPA   (BXE_CP_TPA | BXE_LEVEL_INFO)
+#define BXE_VERBOSE_TPA(BXE_CP_TPA | BXE_LEVEL_VERBOSE)
+#define BXE_EXTREME_TPA(BXE_CP_TPA | BXE_LEVEL_EXTREME)
+#define BXE_INSANE_TPA (BXE_CP_TPA | BXE_LEVEL_INSANE)
+
+#define BXE_FATAL  (BXE_CP_ALL | BXE_LEVEL_FATAL)
+#define BXE_WARN   (BXE_CP_ALL | BXE_LEVEL_WARN)
+#define BXE_INFO   (BXE_CP_ALL | BXE_LEVEL_INFO)
+#define BXE_VERBOSE(BXE_CP_ALL | BXE_LEVEL_VERBOSE)
+#define BXE_EXTREME(BXE_CP_ALL | BXE_LEVEL_EXTREME)
+#define BXE_INSANE (BXE_CP_ALL | BXE_LEVEL_INSANE)
 
 #define BXE_CODE_PATH(cp)  ((cp & BXE_CP_MASK) & bxe_debug)
 #define BXE_MSG_LEVEL(lv)  ((lv & BXE_LEVEL_MASK) <= (bxe_debug & 
BXE_LEVEL_MASK))

Modified: head/sys/dev/bxe/bxe_link.c

svn commit: r218423 - head/sys/dev/bce

2011-02-07 Thread David Christensen
Author: davidch
Date: Mon Feb  7 23:00:24 2011
New Revision: 218423
URL: http://svn.freebsd.org/changeset/base/218423

Log:
  - Added systcls for header splitting, RX/TX buffer count, interrupt
coalescing, strict RX MTU, verbose output, and shared memory debug.
  - Added additional debug counters (VLAN tags and split header frames).
  - Updated debug counters to 64 bit definitions.
  - Updated l2fhdr bit definitions.
  - Combined RX buffer sizing into a single function.
  - Added buffer size and interrupt coalescing settings to adapter info
printout.
  
  Submitted by: davidch
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Mon Feb  7 22:37:27 2011(r218422)
+++ head/sys/dev/bce/if_bce.c   Mon Feb  7 23:00:24 2011(r218423)
@@ -287,48 +287,43 @@ static int  bce_shutdown  (device_t);
 /* BCE Debug Data Structure Dump Routines   */
 //
 #ifdef BCE_DEBUG
-static u32  bce_reg_rd (struct bce_softc *, u32);
-static void bce_reg_wr (struct bce_softc *, u32, u32);
-static void bce_reg_wr16   (struct bce_softc *, u32, u16);
-static u32  bce_ctx_rd (struct bce_softc *, u32, u32);
-static void bce_dump_enet  (struct bce_softc *, struct mbuf *);
-static void bce_dump_mbuf  (struct bce_softc *, struct mbuf *);
+static u32  bce_reg_rd (struct bce_softc *, u32);
+static void bce_reg_wr (struct bce_softc *, u32, u32);
+static void bce_reg_wr16   (struct bce_softc *, u32, u16);
+static u32  bce_ctx_rd (struct bce_softc *, u32, u32);
+static void bce_dump_enet  (struct bce_softc *, struct 
mbuf *);
+static void bce_dump_mbuf  (struct bce_softc *, struct 
mbuf *);
 static void bce_dump_tx_mbuf_chain (struct bce_softc *, u16, int);
 static void bce_dump_rx_mbuf_chain (struct bce_softc *, u16, int);
-#ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_mbuf_chain (struct bce_softc *, u16, int);
-#endif
-static void bce_dump_txbd  (struct bce_softc *,
+static void bce_dump_txbd  (struct bce_softc *,
 int, struct tx_bd *);
-static void bce_dump_rxbd  (struct bce_softc *,
+static void bce_dump_rxbd  (struct bce_softc *,
 int, struct rx_bd *);
-#ifdef BCE_JUMBO_HDRSPLIT
-static void bce_dump_pgbd  (struct bce_softc *,
+static void bce_dump_pgbd  (struct bce_softc *,
 int, struct rx_bd *);
-#endif
 static void bce_dump_l2fhdr(struct bce_softc *,
 int, struct l2_fhdr *);
-static void bce_dump_ctx   (struct bce_softc *, u16);
-static void bce_dump_ftqs  (struct bce_softc *);
+static void bce_dump_ctx   (struct bce_softc *, u16);
+static void bce_dump_ftqs  (struct bce_softc *);
 static void bce_dump_tx_chain  (struct bce_softc *, u16, int);
 static void bce_dump_rx_bd_chain   (struct bce_softc *, u16, int);
-#ifdef BCE_JUMBO_HDRSPLIT
 static void bce_dump_pg_chain  (struct bce_softc *, u16, int);
-#endif
 static void bce_dump_status_block  (struct bce_softc *);
 static void bce_dump_stats_block   (struct bce_softc *);
 static void bce_dump_driver_state  (struct bce_softc *);
 static void bce_dump_hw_state  (struct bce_softc *);
+static void bce_dump_shmem_state   (struct bce_softc *);
 static void bce_dump_mq_regs   (struct bce_softc *);
 static void bce_dump_bc_state  (struct bce_softc *);
 static void bce_dump_txp_state (struct bce_softc *, int);
 static void bce_dump_rxp_state (struct bce_softc *, int);
-static void bce_dump_tpat_state(struct bce_softc *, int);
+static void bce_dump_tpat_state(struct bce_softc *, int);
 static void bce_dump_cp_state  (struct bce_softc *, int);
 static void bce_dump_com_state (struct bce_softc *, int);
-static void bce_dump_rv2p_state(struct bce_softc *);
-static void bce_breakpoint (struct bce_softc *);
-#endif
+static void bce_dump_rv2p_state(struct bce_softc *);
+static void bce_breakpoint (struct bce_softc *);
+#endif /*BCE_DEBUG */
 
 
 //
@@ -355,15 +350,15 @@ static int sysctl_nvram_write(SYSCTL_HAN
 //
 static int  bce_acquire_nvram_lock (struct bce_softc *);
 static int  bce_release_nvram_lock (struct bce_softc *);
-static void bce_

svn commit: r218527 - head/sys/dev/bce

2011-02-10 Thread David Christensen
Author: davidch
Date: Thu Feb 10 22:36:23 2011
New Revision: 218527
URL: http://svn.freebsd.org/changeset/base/218527

Log:
  - Added error checking to nvram read functions.
  - Minor style updates.
  
  Submitted by: gcoo...@freebsd.org
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Thu Feb 10 19:58:21 2011(r218526)
+++ head/sys/dev/bce/if_bce.c   Thu Feb 10 22:36:23 2011(r218527)
@@ -89,12 +89,6 @@ __FBSDID("$FreeBSD$");
 #endif
 
 //
-/* BCE Build Time Options   */
-//
-/* #define BCE_NVRAM_WRITE_SUPPORT 1 */
-
-
-//
 /* PCI Device ID Table  */
 /*  */
 /* Used by bce_probe() to identify the devices supported by this driver.*/
@@ -339,9 +333,9 @@ static int  bce_miibus_write_reg(device
 static void bce_miibus_statchg (device_t);
 
 #ifdef BCE_DEBUG
-static int sysctl_nvram_dump(SYSCTL_HANDLER_ARGS);
+static int bce_sysctl_nvram_dump(SYSCTL_HANDLER_ARGS);
 #ifdef BCE_NVRAM_WRITE_SUPPORT
-static int sysctl_nvram_write(SYSCTL_HANDLER_ARGS);
+static int bce_sysctl_nvram_write(SYSCTL_HANDLER_ARGS);
 #endif
 #endif
 
@@ -2884,9 +2878,9 @@ bce_nvram_write(struct bce_softc *sc, u3
goto bce_nvram_write_exit;
 
 bce_nvram_write_locked_exit:
-   bce_disable_nvram_write(sc);
-   bce_disable_nvram_access(sc);
-   bce_release_nvram_lock(sc);
+   bce_disable_nvram_write(sc);
+   bce_disable_nvram_access(sc);
+   bce_release_nvram_lock(sc);
 
 bce_nvram_write_exit:
if (align_start || align_end)
@@ -2931,7 +2925,7 @@ bce_nvram_test(struct bce_softc *sc)
 * Verify that offset 0 of the NVRAM contains
 * a valid magic number.
 */
-magic = bce_be32toh(buf[0]);
+   magic = bce_be32toh(buf[0]);
if (magic != BCE_NVRAM_MAGIC) {
rc = ENODEV;
BCE_PRINTF("%s(%d): Invalid NVRAM magic value! "
@@ -8266,7 +8260,6 @@ bce_tick_exit:
return;
 }
 
-
 #ifdef BCE_DEBUG
 //
 /* Allows the driver state to be dumped through the sysctl interface.   */
@@ -8631,7 +8624,8 @@ bce_sysctl_nvram_read(SYSCTL_HANDLER_ARG
if (error || (req->newptr == NULL))
return (error);
 
-   bce_nvram_read(sc, result, data, 4);
+   error = bce_nvram_read(sc, result, data, 4);
+
BCE_PRINTF("offset 0x%08X = 0x%08X\n", result, bce_be32toh(val[0]));
 
return (error);
@@ -8701,50 +8695,62 @@ bce_sysctl_phy_read(SYSCTL_HANDLER_ARGS)
 }
 
 
+//
+/* Provides a sysctl interface for dumping the nvram contents.  */
+/* DO NOT ENABLE ON PRODUCTION SYSTEMS!
*/
+/* */
+/* Returns:*/
+/*   0 for success, positive errno for failure.
*/
+//
 static int
-sysctl_nvram_dump(SYSCTL_HANDLER_ARGS)
+bce_sysctl_nvram_dump(SYSCTL_HANDLER_ARGS)
 {
struct bce_softc *sc = (struct bce_softc *)arg1;
int error, i;
 
-   if (sc->nvram_buf == NULL) {
+   if (sc->nvram_buf == NULL)
sc->nvram_buf = malloc(sc->bce_flash_size,
-  M_TEMP, M_ZERO | M_WAITOK);
-   }
-   if (sc->nvram_buf == NULL) {
-   return(ENOMEM);
-   }
+   M_TEMP, M_ZERO | M_WAITOK);
+
+   error = 0;
if (req->oldlen == sc->bce_flash_size) {
-   for (i = 0; i < sc->bce_flash_size; i++) {
-   bce_nvram_read(sc, i, &sc->nvram_buf[i], 1);
-   }
+   for (i = 0; i < sc->bce_flash_size && error == 0; i++)
+   error = bce_nvram_read(sc, i, &sc->nvram_buf[i], 1);
}
 
-   error = SYSCTL_OUT(req, sc->nvram_buf, sc->bce_flash_size);
+   if (error == 0)
+   error = SYSCTL_OUT(req, sc->nvram_buf, sc->bce_flash_size);
 
return error;
 }
 
 #ifdef BCE_NVRAM_WRITE_SUPPORT
+//
+/* Provides a sysctl interface for writing to nvram.*/
+/* DO NOT ENABL

svn commit: r218529 - head/sys/dev/bce

2011-02-10 Thread David Christensen
Author: davidch
Date: Fri Feb 11 00:41:49 2011
New Revision: 218529
URL: http://svn.freebsd.org/changeset/base/218529

Log:
  - Updated firmware which improves small packet performance.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bcefw.h

Modified: head/sys/dev/bce/if_bcefw.h
==
--- head/sys/dev/bce/if_bcefw.h Thu Feb 10 23:36:39 2011(r218528)
+++ head/sys/dev/bce/if_bcefw.h Fri Feb 11 00:41:49 2011(r218529)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006-2010 Broadcom Corporation
+ * Copyright (c) 2006-2011 Broadcom Corporation
  * David Christensen .  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -31,1310 +31,1254 @@
 
 /*
  * This file contains firmware data derived from proprietary unpublished
- * source code, Copyright (c) 2004, 2005, 2007, 2008 Broadcom Corporation.
+ * source code, Copyright (c) 2004-2011 Broadcom Corporation.
  *
  * Permission is hereby granted for the distribution of this firmware data
- * in hexadecimal or equivalent format, provided this copyright notice is
- * accompanying it.
+ * in hexadecimal or equivalent format, provided this copyright notice also
+ * accompanies it.
  */
 
-/* Firmware release 4.6.17 for BCM5706 and BCM5708 (b06). */
-/* Firmware release 4.6.16 for BCM5709 and BCM5716 (b09). */
-int bce_COM_b06FwReleaseMajor = 0x1;
-int bce_COM_b06FwReleaseMinor = 0x0;
-int bce_COM_b06FwReleaseFix = 0x0;
-u32 bce_COM_b06FwStartAddr = 0x08f8;
-u32 bce_COM_b06FwTextAddr = 0x0800;
-int bce_COM_b06FwTextLen = 0x4df0;
-u32 bce_COM_b06FwDataAddr = 0x;
-int bce_COM_b06FwDataLen = 0x0;
-u32 bce_COM_b06FwRodataAddr = 0x08004df0;
-int bce_COM_b06FwRodataLen = 0x14;
-u32 bce_COM_b06FwBssAddr = 0x08004e58;
-int bce_COM_b06FwBssLen = 0xbc;
-u32 bce_COM_b06FwSbssAddr = 0x08004e20;
-int bce_COM_b06FwSbssLen = 0x38;
-u32 bce_COM_b06FwSDataAddr = 0x;
-int bce_COM_b06FwSDataLen = 0x0;
-u32 bce_COM_b06FwText[(0x4df0/4) + 1] = {
-0xa3e, 0x0, 0x0, 
-0xd, 0x636f6d34, 0x2e362e31, 0x3700, 
-0x4061102, 0x0, 0x3, 0x14, 
-0x32, 0x3, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x10, 
-0x136, 0xea60, 0x1, 0x0, 
-0x0, 0x0, 0x8, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x2, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x10, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x0, 0x0, 0x0, 0x0, 
-0x1003, 0x0, 0xd, 0xd, 
-0x3c020800, 0x24424e20, 0x3c030800, 0x24634f14, 
-0xac40, 0x43202b, 0x1480fffd, 0x24420004, 
-0x3c1d0800, 0x37bd7ffc, 0x3a0f021, 0x3c100800, 
-0x261000f8, 0x3c1c0800, 0x279c4e20, 0xe0002bd, 
-0x0, 0xd, 0x3c036010, 0x8c645000, 
-0x2402ff7f, 0x3c1a8000, 0x822024, 0x3484380c, 
-0x24020037, 0xac645000, 0xaf420008, 0x24020c80, 
-0xaf420024, 0x3c1b8008, 0x3c060800, 0x24c607e8, 
-0x3c020800, 0x24424e58, 0x2404001b, 0x2484, 
-0xac46, 0x481fffd, 0x24420004, 0x3c020800, 
-0x24420380, 0x3c010800, 0xac224e60, 0x3c020800, 
-0x24420680, 0x3c010800, 0xac224e64, 0x3c020800, 
-0x24420dcc, 0x3c010800, 0xac224ea0, 0x3c020800, 
-0x24420a5c, 0x3c030800, 0x24630954, 0x3c040800, 
-0x24840990, 0x3c050800, 0x24a53c70, 0x3c010800, 
-0xac224ea8, 0x3c020800, 0x24420570, 0x3c010800, 
-0xac264ea4, 0x3c010800, 0xac254eb4, 0x3c010800, 
-0xac234ebc, 0x3c010800, 0xac224ec0, 0x3c010800, 
-0xac244ec4, 0x3c010800, 0xac234e5c, 0x3c010800, 
-0xac204e68, 0x3c010800, 0xac204e6c, 0x3c010800, 
-0xac204e70, 0x3c010800, 0xac204e74, 0x3c010800, 
-0xac204e78, 0x3c010800, 0xac204e7c, 0x3c010800, 
-0xac204e80, 0x3c010800, 0xac244e84, 0x3c010800, 
-0xac204e88, 0x3c010800, 0xac204e8c, 0x3c010800, 
-0xac204e90, 0x3c010800, 0xac204e94, 0x3c010800, 
-0xac204e98, 0x3c010800, 0xac264e9c, 0x3c010800, 
-0xac204eac, 0x3c010800, 0xac254eb0, 0x3c010800, 
-0xac234eb8, 0xa000707, 0x0, 0x3c030800, 
-0x8c630020, 0x8f820008, 0x10430003, 0x0, 
-0xa00053f, 0xaf830008, 0x3e8, 0x0, 
-0x27bdffe8, 0xafb00010, 0xafbf0014, 0x27500100, 
-0x92020009, 0x1040001a, 0x24030001, 0x3c020800, 
-0x8c420020, 0x10400016, 0x1821, 0xe000577, 
-0x0, 0x96030008, 0x3c060800, 0x94c64ed6, 
-0x8e040018, 0x8f820020, 0x9605000c, 0x31c00, 
-0x661825, 0xac44, 0xac450004, 0x24040001, 
-0xac48, 0xac4c, 0xac400010, 0xac400014, 
-0xac400018, 0xe00059c, 0xac43001c, 0x1821, 
-0x8fbf0014, 0x8fb00010, 0x601021, 0x3e8, 
-0x27bd0018, 0x27bdffe8, 0xafbf0010, 0x97420108, 
-0x30437000, 0x24022000, 0x1062000a, 0x28642001, 
-0x54800012, 0x8fbf0010, 0x24024000, 0x10620008, 
-0x24026000, 0x1062000a, 0x8fbf0010, 0xafb, 
-0x1021, 0x8fbf0010, 0xabb, 0x27bd0018, 
-0xe000409, 0x0, 0xafa, 0x8fbf0010, 
-0xe000fc9, 0x0, 0x8fbf0010, 0x1021, 
-0x3e8, 0x27bd0018, 0x3c020800, 0x8c420020, 
-0x27bdffe8, 0x10400027, 0xafbf0010, 0xe000577, 
-0x0, 0x97420108, 0x9743010c, 0x8f850020, 
-0x3042003e, 0x3063, 0x21400, 0x431025, 
-0xaca2, 0x8f420100, 0x3c060800, 0x94c64ed6, 
-0x8fbf0010, 0xaca20004, 0x97430116, 0x9744010e, 
-0x3c022000, 0x31c00

svn commit: r225532 - head/sys/dev/bxe

2011-09-13 Thread David Christensen
Author: davidch
Date: Tue Sep 13 15:49:28 2011
New Revision: 225532
URL: http://svn.freebsd.org/changeset/base/225532

Log:
  - Fix compiler warning in ADD_64() macro.
  
  Approved by:  re
  Obtained from:dimi...@andic.com
  MFC after:One week

Modified:
  head/sys/dev/bxe/if_bxe.c

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Tue Sep 13 14:07:05 2011(r225531)
+++ head/sys/dev/bxe/if_bxe.c   Tue Sep 13 15:49:28 2011(r225532)
@@ -7188,7 +7188,7 @@ bxe_attn_int(struct bxe_softc* sc)
 /* sum[hi:lo] += add[hi:lo] */
 #defineADD_64(s_hi, a_hi, s_lo, a_lo) do { \
s_lo += a_lo;   \
-   s_hi += a_hi + (s_lo < a_lo) ? 1 : 0;   \
+   s_hi += a_hi + ((s_lo < a_lo) ? 1 : 0); \
 } while (0)
 
 /* Subtraction = minuend -= subtrahend */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r274384 - head

2014-11-11 Thread David Christensen
Author: davidch
Date: Tue Nov 11 16:51:00 2014
New Revision: 274384
URL: https://svnweb.freebsd.org/changeset/base/274384

Log:
  Remove myself from bxe(4) maintenance.

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSTue Nov 11 16:49:33 2014(r274383)
+++ head/MAINTAINERSTue Nov 11 16:51:00 2014(r274384)
@@ -48,7 +48,6 @@ cd(4) ken Pre-commit review requested.
 pass(4)ken Pre-commit review requested.
 ch(4)  ken Pre-commit review requested.
 em(4)  jfv Pre-commit review requested.
-bxe(4) davidch Pre-commit review requested.
 tdfx(4)cokane  Just keep me informed of changes, try not to 
break it.
 sendmail   gshapiroPre-commit review requested.
 etc/mail   gshapiroPre-commit review requested.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r235145 - head/sys/dev/bce

2012-05-08 Thread David Christensen
Author: davidch
Date: Tue May  8 22:38:46 2012
New Revision: 235145
URL: http://svn.freebsd.org/changeset/base/235145

Log:
  - Rename sysctl "loose_rx_mtu" to "strict_rx_mtu" to match code usage.
  
  Submitted by: davidch
  MFC after:1 day

Modified:
  head/sys/dev/bce/if_bce.c

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Tue May  8 21:09:03 2012(r235144)
+++ head/sys/dev/bce/if_bce.c   Tue May  8 22:38:46 2012(r235145)
@@ -527,7 +527,7 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, hdr_split
 /* Allowable values are TRUE or FALSE. */
 static int bce_strict_rx_mtu = FALSE;
 TUNABLE_INT("hw.bce.strict_rx_mtu", &bce_strict_rx_mtu);
-SYSCTL_UINT(_hw_bce, OID_AUTO, loose_rx_mtu, CTLFLAG_RDTUN,
+SYSCTL_UINT(_hw_bce, OID_AUTO, strict_rx_mtu, CTLFLAG_RDTUN,
 &bce_strict_rx_mtu, 0,
 "Enable/Disable strict RX frame size checking");
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r255736 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/bxe sys/i386/conf sys/modules/bxe

2013-09-20 Thread David Christensen
dev.bxe.#.queue
+.Ed
+.Pp
+To dump information for a single queue of a single instance (replace the
+additional '#' with the queue number):
+.Bd -literal -offset indent
+# sysctl -a | grep dev.bxe.#.queue.#
+.Ed
+.Pp
+The
+.Nm
+driver has the ability to dump a ton of debug messages to the system
+log. The default level of logging can be set with the 'hw.bxe.debug'
+configuration parameter. Take care with this setting as it can result in too
+many logs being dumped. Since this parameter is the default one, it affects
+every instance and will dramatically change the timing in the driver. A better
+alternative to aid in debugging is to dynamically change the debug level of a
+specific instance with the 'dev.bxe.#.debug' configuration parameter. This 
allows
+you to turn on/off logging of various debug groups on-the-fly.
+.Pp
+The different debug groups that can be toggled are:
+.Bd -literal -offset indent
+DBG_LOAD   0x0001 /* load and unload*/
+DBG_INTR   0x0002 /* interrupt handling */
+DBG_SP 0x0004 /* slowpath handling  */
+DBG_STATS  0x0008 /* stats updates  */
+DBG_TX 0x0010 /* packet transmit*/
+DBG_RX 0x0020 /* packet receive */
+DBG_PHY0x0040 /* phy/link handling  */
+DBG_IOCTL  0x0080 /* ioctl handling */
+DBG_MBUF   0x0100 /* dumping mbuf info  */
+DBG_REGS   0x0200 /* register access*/
+DBG_LRO0x0400 /* lro processing */
+DBG_ASSERT 0x8000 /* debug assert   */
+DBG_ALL0x /* flying monkeys */
+.Ed
+.Pp
+For example, to debug an issue in the receive path on bxe0:
+.Bd -literal -offset indent
+# sysctl dev.bxe.0.debug=0x22
+.Ed
+.Pp
+When finished turn the logging back off:
+.Bd -literal -offset indent
+# sysctl dev.bxe.0.debug=0
+.Ed
 .Sh SEE ALSO
 .Xr altq 4 ,
 .Xr arp 4 ,
@@ -124,6 +294,7 @@ The default value is -1.
 .Xr ng_ether 4 ,
 .Xr vlan 4 ,
 .Xr ifconfig 8
+.Xr netstat 1
 .Sh HISTORY
 The
 .Nm
@@ -133,6 +304,7 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Gary Zambrano Aq zambr...@broadcom.com
+.An Eric Davis Aq eda...@broadcom.com ,
+.An David Christensen Aq davi...@broadcom.com ,
 and
-.An David Christensen Aq davi...@broadcom.com .
+.An Gary Zambrano Aq zambr...@broadcom.com .

Modified: head/share/man/man4/vlan.4
==
--- head/share/man/man4/vlan.4  Fri Sep 20 20:04:29 2013(r255735)
+++ head/share/man/man4/vlan.4  Fri Sep 20 20:18:49 2013(r255736)
@@ -127,6 +127,7 @@ in hardware:
 .Xr ale 4 ,
 .Xr bce 4 ,
 .Xr bge 4 ,
+.Xr bxe 4 ,
 .Xr cxgb 4 ,
 .Xr cxgbe 4 ,
 .Xr em 4 ,

Modified: head/sys/amd64/conf/GENERIC
==
--- head/sys/amd64/conf/GENERIC Fri Sep 20 20:04:29 2013(r255735)
+++ head/sys/amd64/conf/GENERIC Fri Sep 20 20:18:49 2013(r255736)
@@ -204,7 +204,7 @@ device  ppi # Parallel port 
interface d
 device puc # Multi I/O cards and multi-channel UARTs
 
 # PCI Ethernet NICs.
-device bxe # Broadcom BCM57710/BCM57711/BCM57711E 10Gb 
Ethernet
+device bxe # Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE
 device de  # DEC/Intel DC21x4x (``Tulip'')
 device em  # Intel PRO/1000 Gigabit Ethernet Family
 device igb # Intel PRO/1000 PCIE Server Gigabit Family
@@ -341,8 +341,5 @@ device  virtio_blk  # VirtIO Block device
 device virtio_scsi # VirtIO SCSI device
 device virtio_balloon  # VirtIO Memory Balloon device
 
-# HyperV drivers
-device hyperv  # HyperV drivers 
-
 # VMware support
 device vmx # VMware VMXNET3 Ethernet

Modified: head/sys/amd64/conf/NOTES
==
--- head/sys/amd64/conf/NOTES   Fri Sep 20 20:04:29 2013(r255735)
+++ head/sys/amd64/conf/NOTES   Fri Sep 20 20:18:49 2013(r255736)
@@ -294,6 +294,8 @@ options DRM_DEBUG   # Include debug print
 # Network interfaces:
 #
 
+# bxe:  Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet
+#   adapters.
 # ed:   Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503
 #   HP PC Lan+, various PC Card devices
 #   (requires miibus)
@@ -313,6 +315,7 @@ options DRM_DEBUG   # Include debug print
 # wpi: Intel 3945ABG Wireless LAN controller
 #  Requires the wpi firmware module
 
+device bxe # Broadcom NetXtreme II BCM5771X/BCM578XX 10GbE
 device ed  # NE[12]000, SMC Ultra, 3c503, DS8390 cards
 optionsED_3C503
 optionsED_HPP

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Fri Sep 20 20:04:29 20

svn commit: r205299 - head/sys/dev/mii

2010-03-18 Thread David Christensen
Author: davidch
Date: Thu Mar 18 20:57:57 2010
New Revision: 205299
URL: http://svn.freebsd.org/changeset/base/205299

Log:
  - Added support for 5709S/5716S PHYs.
  
  Submitted by: pyunyh
  MFC after:2 weeks

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/brgphyreg.h
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Thu Mar 18 20:30:25 2010(r205298)
+++ head/sys/dev/mii/brgphy.c   Thu Mar 18 20:57:57 2010(r205299)
@@ -75,6 +75,7 @@ struct brgphy_softc {
 #define BRGPHY_5706S   0x0001
 #define BRGPHY_5708S   0x0002
 #define BRGPHY_NOANWAIT0x0004
+#define BRGPHY_5709S   0x0008
int bce_phy_flags;  /* PHY flags transferred from the MAC driver */
 };
 
@@ -139,6 +140,7 @@ static const struct mii_phydesc brgphys[
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5784),
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C),
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5761),
+MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709S),
MII_PHY_DESC(BROADCOM2, BCM5906),
MII_PHY_END
 };
@@ -216,30 +218,34 @@ brgphy_attach(device_t dev)
break;
case MII_OUI_xxBROADCOM:
switch (bsc->mii_model) {
-   case MII_MODEL_xxBROADCOM_BCM5706:
-   case MII_MODEL_xxBROADCOM_BCM5714:
-   /*
-* The 5464 PHY used in the 5706 supports both 
copper
-* and fiber interfaces over GMII.  Need to 
check the
-* shadow registers to see which mode is 
actually
-* in effect, and therefore whether we have 
5706C or
-* 5706S.
-*/
-   PHY_WRITE(sc, BRGPHY_MII_SHADOW_1C,
-   BRGPHY_SHADOW_1C_MODE_CTRL);
-   if (PHY_READ(sc, BRGPHY_MII_SHADOW_1C) &
-   BRGPHY_SHADOW_1C_ENA_1000X) {
-   bsc->serdes_flags |= BRGPHY_5706S;
-   sc->mii_flags |= MIIF_HAVEFIBER;
-   }
-   break;
+   case MII_MODEL_xxBROADCOM_BCM5706:
+   case MII_MODEL_xxBROADCOM_BCM5714:
+   /*
+* The 5464 PHY used in the 5706 supports both copper
+* and fiber interfaces over GMII.  Need to check the
+* shadow registers to see which mode is actually
+* in effect, and therefore whether we have 5706C or
+* 5706S.
+*/
+   PHY_WRITE(sc, BRGPHY_MII_SHADOW_1C,
+   BRGPHY_SHADOW_1C_MODE_CTRL);
+   if (PHY_READ(sc, BRGPHY_MII_SHADOW_1C) &
+   BRGPHY_SHADOW_1C_ENA_1000X) {
+   bsc->serdes_flags |= BRGPHY_5706S;
+   sc->mii_flags |= MIIF_HAVEFIBER;
+   }
+   break;
} break;
case MII_OUI_xxBROADCOM_ALT1:
switch (bsc->mii_model) {
-   case MII_MODEL_xxBROADCOM_ALT1_BCM5708S:
-   bsc->serdes_flags |= BRGPHY_5708S;
-   sc->mii_flags |= MIIF_HAVEFIBER;
-   break;
+   case MII_MODEL_xxBROADCOM_ALT1_BCM5708S:
+   bsc->serdes_flags |= BRGPHY_5708S;
+   sc->mii_flags |= MIIF_HAVEFIBER;
+   break;
+case MII_MODEL_xxBROADCOM_ALT1_BCM5709S:
+bsc->serdes_flags |= BRGPHY_5709S;
+sc->mii_flags |= MIIF_HAVEFIBER;
+break;
} break;
default:
device_printf(dev, "Unrecognized OUI for PHY!\n");
@@ -631,6 +637,7 @@ brgphy_status(struct mii_softc *sc)
PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, 
BRGPHY_5708S_DIG_PG0);
xstat = PHY_READ(sc, BRGPHY_5708S_PG0_1000X_STAT1);
 
+/* Check for MRBE auto-negotiated speed results. */
switch (xstat & 
BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK) {
case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10:
mii->mii_media_active |= IFM_10_FL; break;
@@ -642,11 +649,40 @@ brgphy_status(struct mii_softc *sc)
mii->mii_media_active |= IFM_2500_SX; break;
}
 
+/* Check for MRBE auto-negotiated duplex results. */
if (xstat & BRGPHY_5708S_PG0_1000X_STAT1_FDX)

svn commit: r205300 - head/sys/dev/bce

2010-03-18 Thread David Christensen
Author: davidch
Date: Thu Mar 18 21:00:53 2010
New Revision: 205300
URL: http://svn.freebsd.org/changeset/base/205300

Log:
  - Added support for 5709S/5716S PHYs.
  - Update copyright to 2010.
  - Add new debug code for RV2P block.
  - Improve output formatting for various debug functions.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcefw.h
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Thu Mar 18 20:57:57 2010(r205299)
+++ head/sys/dev/bce/if_bce.c   Thu Mar 18 21:00:53 2010(r205300)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2006-2009 Broadcom Corporation
+ * Copyright (c) 2006-2010 Broadcom Corporation
  * David Christensen .  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,9 @@ __FBSDID("$FreeBSD$");
  *   BCM5708C B1, B2
  *   BCM5708S B1, B2
  *   BCM5709C A1, C0
+ *   BCM5709S A1, C0
  *  BCM5716C C0
+ *  BCM5716S C0
  *
  * The following controllers are not supported by this driver:
  *   BCM5706C A0, A1 (pre-production)
@@ -46,7 +48,7 @@ __FBSDID("$FreeBSD$");
  *   BCM5708C A0, B0 (pre-production)
  *   BCM5708S A0, B0 (pre-production)
  *   BCM5709C A0  B0, B1, B2 (pre-production)
- *   BCM5709S A0, A1, B0, B1, B2, C0 (pre-production)
+ *   BCM5709S A0, B0, B1, B2 (pre-production)
  */
 
 #include "opt_bce.h"
@@ -320,6 +322,7 @@ static void bce_dump_rxp_state  (struct 
 static void bce_dump_tpat_state(struct bce_softc *, int);
 static void bce_dump_cp_state  (struct bce_softc *, int);
 static void bce_dump_com_state (struct bce_softc *, int);
+static void bce_dump_rv2p_state(struct bce_softc *);
 static void bce_breakpoint (struct bce_softc *);
 #endif
 
@@ -360,6 +363,7 @@ static int  bce_nvram_write (struct bc
 /*  */
 //
 static void bce_get_media  (struct bce_softc *);
+static void bce_init_media (struct bce_softc *);
 static void bce_dma_map_addr   (void *, bus_dma_segment_t *, int, int);
 static int  bce_dma_alloc  (device_t);
 static void bce_dma_free   (struct bce_softc *);
@@ -1096,7 +1100,10 @@ bce_attach(device_t dev)
else
ifp->if_baudrate = IF_Mbps(1000);
 
-   /* Check for an MII child bus by probing the PHY. */
+/* Handle any special PHY initialization for SerDes PHYs. */
+bce_init_media(sc);
+
+   /* MII child bus by probing the PHY. */
if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
bce_ifmedia_sts)) {
BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n",
@@ -1504,7 +1511,17 @@ bce_miibus_read_reg(device_t dev, int ph
return(0);
}
 
-   if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) {
+/*
+ * The 5709S PHY is an IEEE Clause 45 PHY
+ * with special mappings to work with IEEE
+ * Clause 22 register accesses.
+ */
+   if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) {
+   if (reg >= MII_BMCR && reg <= MII_ANLPRNP)
+   reg += 0x10;
+   }
+
+if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) {
val = REG_RD(sc, BCE_EMAC_MDIO_MODE);
val &= ~BCE_EMAC_MDIO_MODE_AUTO_POLL;
 
@@ -1584,6 +1601,16 @@ bce_miibus_write_reg(device_t dev, int p
 
DB_PRINT_PHY_REG(reg, val);
 
+/*
+ * The 5709S PHY is an IEEE Clause 45 PHY
+ * with special mappings to work with IEEE
+ * Clause 22 register accesses.
+ */
+   if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) {
+   if (reg >= MII_BMCR && reg <= MII_ANLPRNP)
+   reg += 0x10;
+   }
+
if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) {
val1 = REG_RD(sc, BCE_EMAC_MDIO_MODE);
val1 &= ~BCE_EMAC_MDIO_MODE_AUTO_POLL;
@@ -2647,9 +2674,11 @@ bce_get_media(struct bce_softc *sc)
DBPRINT(sc, BCE_INFO_LOAD,
"BCM5709 s/w configured for SerDes.\n");
sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG;
+break;
default:
DBPRINT(sc, BCE_INFO_LOAD,
"BCM5709 s/w configured for Copper.\n");
+break;
}
} else {