svn commit: r190582 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/bce dev/cxgb
Xin LI
delphij at FreeBSD.org
Mon Mar 30 18:01:02 PDT 2009
Author: delphij
Date: Tue Mar 31 01:01:01 2009
New Revision: 190582
URL: http://svn.freebsd.org/changeset/base/190582
Log:
Update bce(4) to latest -CURRENT version:
- Add several HP OEM parts' PCI IDs (187133+187317)
- Remove intermediate variable busaddr and have bus_* operate
directly on softc members upon initialization. (187204)
- Only enable split header operation when ZERO_COPY_SOCKETS is
enabled in the kernel. (189117)
- Updated firmware to latest 4.6.X release. (189325)
- Added missing firmware for 5709 A1 controllers. (189325)
- Changed some debug statistic variable names to be more
consistent. (189325)
Approved by: re (kensmith)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/bce/if_bce.c
stable/7/sys/dev/bce/if_bcefw.h
stable/7/sys/dev/bce/if_bcereg.h
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c Mon Mar 30 22:18:38 2009 (r190581)
+++ stable/7/sys/dev/bce/if_bce.c Tue Mar 31 01:01:01 2009 (r190582)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2006-2008 Broadcom Corporation
+ * Copyright (c) 2006-2009 Broadcom Corporation
* David Christensen <davidch at broadcom.com>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$");
* BCM5708C B1, B2
* BCM5708S B1, B2
* BCM5709C A1, C0
- * BCM5716 C0
+ * BCM5716C C0
*
* The following controllers are not supported by this driver:
* BCM5706C A0, A1 (pre-production)
@@ -71,25 +71,24 @@ __FBSDID("$FreeBSD$");
/* 1073741824 = 1 in 2 */
/* Controls how often the l2_fhdr frame error check will fail. */
- int bce_debug_l2fhdr_status_check = 0;
+ int l2fhdr_error_sim_control = 0;
/* Controls how often the unexpected attention check will fail. */
- int bce_debug_unexpected_attention = 0;
+ int unexpected_attention_sim_control = 0;
/* Controls how often to simulate an mbuf allocation failure. */
- int bce_debug_mbuf_allocation_failure = 0;
+ int mbuf_alloc_failed_sim_control = 0;
/* Controls how often to simulate a DMA mapping failure. */
- int bce_debug_dma_map_addr_failure = 0;
+ int dma_map_addr_failed_sim_control = 0;
/* Controls how often to simulate a bootcode failure. */
- int bce_debug_bootcode_running_failure = 0;
+ int bootcode_running_failure_sim_control = 0;
#endif
/****************************************************************************/
/* BCE Build Time Options */
/****************************************************************************/
-#define BCE_USE_SPLIT_HEADER 1
/* #define BCE_NVRAM_WRITE_SUPPORT 1 */
@@ -106,6 +105,10 @@ static struct bce_type bce_devs[] = {
"HP NC370T Multifunction Gigabit Server Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x3106,
"HP NC370i Multifunction Gigabit Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x3070,
+ "HP NC380T PCIe DP Multifunc Gig Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5706, HP_VENDORID, 0x1709,
+ "HP NC371i Multifunction Gigabit Server Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5706, PCI_ANY_ID, PCI_ANY_ID,
"Broadcom NetXtreme II BCM5706 1000Base-T" },
@@ -116,18 +119,38 @@ static struct bce_type bce_devs[] = {
"Broadcom NetXtreme II BCM5706 1000Base-SX" },
/* BCM5708C controllers and OEM boards. */
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708, HP_VENDORID, 0x7037,
+ "HP NC373T PCIe Multifunction Gig Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708, HP_VENDORID, 0x7038,
+ "HP NC373i Multifunction Gigabit Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708, HP_VENDORID, 0x7045,
+ "HP NC374m PCIe Multifunction Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5708, PCI_ANY_ID, PCI_ANY_ID,
"Broadcom NetXtreme II BCM5708 1000Base-T" },
/* BCM5708S controllers and OEM boards. */
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708S, HP_VENDORID, 0x1706,
+ "HP NC373m Multifunction Gigabit Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708S, HP_VENDORID, 0x703b,
+ "HP NC373i Multifunction Gigabit Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5708S, HP_VENDORID, 0x703d,
+ "HP NC373F PCIe Multifunc Giga Server Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5708S, PCI_ANY_ID, PCI_ANY_ID,
"Broadcom NetXtreme II BCM5708 1000Base-SX" },
/* BCM5709C controllers and OEM boards. */
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5709, HP_VENDORID, 0x7055,
+ "HP NC382i DP Multifunction Gigabit Server Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5709, HP_VENDORID, 0x7059,
+ "HP NC382T PCIe DP Multifunction Gigabit Server Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5709, PCI_ANY_ID, PCI_ANY_ID,
"Broadcom NetXtreme II BCM5709 1000Base-T" },
/* BCM5709S controllers and OEM boards. */
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5709S, HP_VENDORID, 0x171d,
+ "HP NC382m DP 1GbE Multifunction BL-c Adapter" },
+ { BRCM_VENDORID, BRCM_DEVICEID_BCM5709S, HP_VENDORID, 0x7056,
+ "HP NC382i DP Multifunction Gigabit Server Adapter" },
{ BRCM_VENDORID, BRCM_DEVICEID_BCM5709S, PCI_ANY_ID, PCI_ANY_ID,
"Broadcom NetXtreme II BCM5709 1000Base-SX" },
@@ -270,12 +293,12 @@ static void bce_dump_enet (str
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_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
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 *);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
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 *);
@@ -283,7 +306,7 @@ static void bce_dump_ctx (struct bce_s
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);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
static void bce_dump_pg_chain (struct bce_softc *, u16, int);
#endif
static void bce_dump_status_block (struct bce_softc *);
@@ -368,7 +391,7 @@ static int bce_init_rx_chain (struct b
static void bce_fill_rx_chain (struct bce_softc *);
static void bce_free_rx_chain (struct bce_softc *);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
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 *);
@@ -472,7 +495,8 @@ SYSCTL_UINT(_hw_bce, OID_AUTO, msi_enabl
/* ToDo: Add tunable to enable/disable strict MTU handling. */
/* Currently allows "loose" RX MTU checking (i.e. sets the */
/* H/W RX MTU to the size of the largest receive buffer, or */
-/* 2048 bytes). */
+/* 2048 bytes). This will cause a UNH failure but is more */
+/* desireable from a functional perspective. */
/****************************************************************************/
@@ -572,8 +596,8 @@ bce_print_adapter_info(struct bce_softc
}
/* Firmware version and device features. */
- printf("F/W (0x%08X); Flags( ", sc->bce_fw_ver);
-#ifdef BCE_USE_SPLIT_HEADER
+ printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver);
+#ifdef ZERO_COPY_SOCKETS
printf("SPLT ");
#endif
if (sc->bce_flags & BCE_MFW_ENABLE_FLAG)
@@ -823,7 +847,7 @@ bce_attach(device_t dev)
__FUNCTION__, sc->bce_shmem_base);
/* Fetch the bootcode revision. */
- sc->bce_fw_ver = REG_RD_IND(sc, sc->bce_shmem_base +
+ sc->bce_bc_ver = REG_RD_IND(sc, sc->bce_shmem_base +
BCE_DEV_INFO_BC_REV);
/* Check if any management firmware is running. */
@@ -989,7 +1013,7 @@ bce_attach(device_t dev)
* This may change later if the MTU size is set to
* something other than 1500.
*/
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
sc->rx_bd_mbuf_alloc_size = MHLEN;
/* Make sure offset is 16 byte aligned for hardware. */
sc->rx_bd_mbuf_align_pad = roundup2((MSIZE - MHLEN), 16) -
@@ -2729,7 +2753,7 @@ bce_dma_free(struct bce_softc *sc)
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/* Free, unmap and destroy all page buffer descriptor chain pages. */
for (i = 0; i < PG_PAGES; i++ ) {
if (sc->pg_bd_chain[i] != NULL) {
@@ -2793,7 +2817,7 @@ bce_dma_free(struct bce_softc *sc)
sc->rx_mbuf_tag = NULL;
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/* Unload and destroy the page mbuf maps. */
for (i = 0; i < TOTAL_PG_BD; i++) {
if (sc->pg_mbuf_map[i] != NULL) {
@@ -2840,20 +2864,16 @@ bce_dma_map_addr(void *arg, bus_dma_segm
bus_addr_t *busaddr = arg;
/* Simulate a mapping failure. */
- DBRUNIF(DB_RANDOMTRUE(bce_debug_dma_map_addr_failure),
- printf("bce: %s(%d): Simulating DMA mapping error.\n",
- __FILE__, __LINE__);
+ DBRUNIF(DB_RANDOMTRUE(dma_map_addr_failed_sim_control),
error = ENOMEM);
/* Check for an error and signal the caller that an error occurred. */
if (error) {
- printf("bce %s(%d): DMA mapping error! error = %d, "
- "nseg = %d\n", __FILE__, __LINE__, error, nseg);
*busaddr = 0;
- return;
+ } else {
+ *busaddr = segs->ds_addr;
}
- *busaddr = segs->ds_addr;
return;
}
@@ -2886,7 +2906,6 @@ bce_dma_alloc(device_t dev)
{
struct bce_softc *sc;
int i, error, rc = 0;
- bus_addr_t busaddr;
bus_size_t max_size, max_seg_size;
int max_segments;
@@ -2955,7 +2974,7 @@ bce_dma_alloc(device_t dev)
sc->status_block,
BCE_STATUS_BLK_SZ,
bce_dma_map_addr,
- &busaddr,
+ &sc->status_block_paddr,
BUS_DMA_NOWAIT);
if (error) {
@@ -2965,7 +2984,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->status_block_paddr = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): status_block_paddr = 0x%jX\n",
__FUNCTION__, (uintmax_t) sc->status_block_paddr);
@@ -3009,7 +3027,7 @@ bce_dma_alloc(device_t dev)
sc->stats_block,
BCE_STATS_BLK_SZ,
bce_dma_map_addr,
- &busaddr,
+ &sc->stats_block_paddr,
BUS_DMA_NOWAIT);
if(error) {
@@ -3019,7 +3037,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->stats_block_paddr = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): stats_block_paddr = 0x%jX\n",
__FUNCTION__, (uintmax_t) sc->stats_block_paddr);
@@ -3077,7 +3094,7 @@ bce_dma_alloc(device_t dev)
sc->ctx_block[i],
BCM_PAGE_SIZE,
bce_dma_map_addr,
- &busaddr,
+ &sc->ctx_paddr[i],
BUS_DMA_NOWAIT);
if (error) {
@@ -3087,7 +3104,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->ctx_paddr[i] = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): ctx_paddr[%d] = 0x%jX\n",
__FUNCTION__, i, (uintmax_t) sc->ctx_paddr[i]);
}
@@ -3133,7 +3149,7 @@ bce_dma_alloc(device_t dev)
sc->tx_bd_chain[i],
BCE_TX_CHAIN_PAGE_SZ,
bce_dma_map_addr,
- &busaddr,
+ &sc->tx_bd_chain_paddr[i],
BUS_DMA_NOWAIT);
if (error) {
@@ -3143,7 +3159,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->tx_bd_chain_paddr[i] = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): tx_bd_chain_paddr[%d] = 0x%jX\n",
__FUNCTION__, i, (uintmax_t) sc->tx_bd_chain_paddr[i]);
}
@@ -3231,7 +3246,7 @@ bce_dma_alloc(device_t dev)
sc->rx_bd_chain[i],
BCE_RX_CHAIN_PAGE_SZ,
bce_dma_map_addr,
- &busaddr,
+ &sc->rx_bd_chain_paddr[i],
BUS_DMA_NOWAIT);
if (error) {
@@ -3241,7 +3256,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->rx_bd_chain_paddr[i] = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): rx_bd_chain_paddr[%d] = 0x%jX\n",
__FUNCTION__, i, (uintmax_t) sc->rx_bd_chain_paddr[i]);
}
@@ -3249,12 +3263,17 @@ bce_dma_alloc(device_t dev)
/*
* Create a DMA tag for RX mbufs.
*/
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
max_size = max_seg_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ?
MCLBYTES : sc->rx_bd_mbuf_alloc_size);
#else
max_size = max_seg_size = MJUM9BYTES;
#endif
+ max_segments = 1;
+
+ DBPRINT(sc, BCE_INFO, "%s(): Creating rx_mbuf_tag (max size = 0x%jX "
+ "max segments = %d, max segment size = 0x%jX)\n", __FUNCTION__,
+ (uintmax_t) max_size, max_segments, (uintmax_t) max_seg_size);
if (bus_dma_tag_create(sc->parent_tag,
1,
@@ -3263,7 +3282,7 @@ bce_dma_alloc(device_t dev)
BUS_SPACE_MAXADDR,
NULL, NULL,
max_size,
- 1,
+ max_segments,
max_seg_size,
0,
NULL, NULL,
@@ -3285,7 +3304,7 @@ bce_dma_alloc(device_t dev)
}
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/*
* Create a DMA tag for the page buffer descriptor chain,
* allocate and clear the memory, and fetch the physical
@@ -3328,7 +3347,7 @@ bce_dma_alloc(device_t dev)
sc->pg_bd_chain[i],
BCE_PG_CHAIN_PAGE_SZ,
bce_dma_map_addr,
- &busaddr,
+ &sc->pg_bd_chain_paddr[i],
BUS_DMA_NOWAIT);
if (error) {
@@ -3338,7 +3357,6 @@ bce_dma_alloc(device_t dev)
goto bce_dma_alloc_exit;
}
- sc->pg_bd_chain_paddr[i] = busaddr;
DBPRINT(sc, BCE_INFO, "%s(): pg_bd_chain_paddr[%d] = 0x%jX\n",
__FUNCTION__, i, (uintmax_t) sc->pg_bd_chain_paddr[i]);
}
@@ -4140,15 +4158,24 @@ bce_init_cpus(struct bce_softc *sc)
if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
(BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
- bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1, sizeof(bce_xi_rv2p_proc1),
- RV2P_PROC1);
- bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2, sizeof(bce_xi_rv2p_proc2),
- RV2P_PROC2);
+
+ if ((BCE_CHIP_REV(sc) == BCE_CHIP_REV_Ax)) {
+ bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc1,
+ sizeof(bce_xi90_rv2p_proc1), RV2P_PROC1);
+ bce_load_rv2p_fw(sc, bce_xi90_rv2p_proc2,
+ sizeof(bce_xi90_rv2p_proc2), RV2P_PROC2);
+ } else {
+ bce_load_rv2p_fw(sc, bce_xi_rv2p_proc1,
+ sizeof(bce_xi_rv2p_proc1), RV2P_PROC1);
+ bce_load_rv2p_fw(sc, bce_xi_rv2p_proc2,
+ sizeof(bce_xi_rv2p_proc2), RV2P_PROC2);
+ }
+
} else {
- bce_load_rv2p_fw(sc, bce_rv2p_proc1, sizeof(bce_rv2p_proc1),
- RV2P_PROC1);
- bce_load_rv2p_fw(sc, bce_rv2p_proc2, sizeof(bce_rv2p_proc2),
- RV2P_PROC2);
+ bce_load_rv2p_fw(sc, bce_rv2p_proc1,
+ sizeof(bce_rv2p_proc1), RV2P_PROC1);
+ bce_load_rv2p_fw(sc, bce_rv2p_proc2,
+ sizeof(bce_rv2p_proc2), RV2P_PROC2);
}
bce_init_rxp_cpu(sc);
@@ -4367,7 +4394,7 @@ bce_stop(struct bce_softc *sc)
bce_disable_intr(sc);
/* Free RX buffers. */
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
bce_free_pg_chain(sc);
#endif
bce_free_rx_chain(sc);
@@ -4711,7 +4738,7 @@ bce_blockinit(struct bce_softc *sc)
/* Verify that bootcode is running. */
reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE);
- DBRUNIF(DB_RANDOMTRUE(bce_debug_bootcode_running_failure),
+ DBRUNIF(DB_RANDOMTRUE(bootcode_running_failure_sim_control),
BCE_PRINTF("%s(%d): Simulating bootcode failure.\n",
__FILE__, __LINE__);
reg = 0);
@@ -4798,14 +4825,14 @@ bce_get_rx_buf(struct bce_softc *sc, str
if (m == NULL) {
/* Simulate an mbuf allocation failure. */
- DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure),
- sc->mbuf_alloc_failed++;
- sc->debug_mbuf_sim_alloc_failed++;
+ DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control),
+ sc->mbuf_alloc_failed_count++;
+ sc->mbuf_alloc_failed_sim_count++;
rc = ENOBUFS;
goto bce_get_rx_buf_exit);
/* This is a new mbuf allocation. */
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
MGETHDR(m_new, M_DONTWAIT, MT_DATA);
#else
if (sc->rx_bd_mbuf_alloc_size <= MCLBYTES)
@@ -4815,7 +4842,7 @@ bce_get_rx_buf(struct bce_softc *sc, str
#endif
if (m_new == NULL) {
- sc->mbuf_alloc_failed++;
+ sc->mbuf_alloc_failed_count++;
rc = ENOBUFS;
goto bce_get_rx_buf_exit;
}
@@ -4845,7 +4872,9 @@ bce_get_rx_buf(struct bce_softc *sc, str
BCE_PRINTF("%s(%d): Error mapping mbuf into RX chain (%d)!\n",
__FILE__, __LINE__, error);
+ sc->dma_map_addr_rx_failed_count++;
m_freem(m_new);
+
DBRUN(sc->debug_rx_mbuf_alloc--);
rc = ENOBUFS;
@@ -4884,7 +4913,7 @@ bce_get_rx_buf_exit:
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Encapsulate an mbuf cluster into the page chain. */
/* */
@@ -4923,16 +4952,16 @@ bce_get_pg_buf(struct bce_softc *sc, str
if (m == NULL) {
/* Simulate an mbuf allocation failure. */
- DBRUNIF(DB_RANDOMTRUE(bce_debug_mbuf_allocation_failure),
- sc->mbuf_alloc_failed++;
- sc->debug_mbuf_sim_alloc_failed++;
+ DBRUNIF(DB_RANDOMTRUE(mbuf_alloc_failed_sim_control),
+ sc->mbuf_alloc_failed_count++;
+ sc->mbuf_alloc_failed_sim_count++;
rc = ENOBUFS;
goto bce_get_pg_buf_exit);
/* This is a new mbuf allocation. */
m_new = m_getcl(M_DONTWAIT, MT_DATA, 0);
if (m_new == NULL) {
- sc->mbuf_alloc_failed++;
+ sc->mbuf_alloc_failed_count++;
rc = ENOBUFS;
goto bce_get_pg_buf_exit;
}
@@ -4993,7 +5022,7 @@ bce_get_pg_buf_exit:
return(rc);
}
-#endif /* BCE_USE_SPLIT_HEADER */
+#endif /* ZERO_COPY_SOCKETS */
/****************************************************************************/
/* Initialize the TX context memory. */
@@ -5351,7 +5380,7 @@ bce_free_rx_chain(struct bce_softc *sc)
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Allocate memory and initialize the page data structures. */
/* Assumes that bce_init_rx_chain() has not already been called. */
@@ -5517,7 +5546,7 @@ bce_free_pg_chain(struct bce_softc *sc)
DBEXIT(BCE_VERBOSE_RESET | BCE_VERBOSE_RECV | BCE_VERBOSE_UNLOAD);
}
-#endif /* BCE_USE_SPLIT_HEADER */
+#endif /* ZERO_COPY_SOCKETS */
/****************************************************************************/
@@ -5690,7 +5719,7 @@ bce_rx_intr(struct bce_softc *sc)
unsigned int pkt_len;
u16 sw_rx_cons, sw_rx_cons_idx, hw_rx_cons;
u32 status;
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
unsigned int rem_len;
u16 sw_pg_cons, sw_pg_cons_idx;
#endif
@@ -5706,7 +5735,7 @@ bce_rx_intr(struct bce_softc *sc)
bus_dmamap_sync(sc->rx_bd_chain_tag,
sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTWRITE);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/* Prepare the page chain pages to be accessed by the host CPU. */
for (int i = 0; i < PG_PAGES; i++)
bus_dmamap_sync(sc->pg_bd_chain_tag,
@@ -5718,7 +5747,7 @@ bce_rx_intr(struct bce_softc *sc)
/* Get working copies of the driver's view of the consumer indices. */
sw_rx_cons = sc->rx_cons;
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
sw_pg_cons = sc->pg_cons;
#endif
@@ -5750,20 +5779,20 @@ bce_rx_intr(struct bce_softc *sc)
sc->free_rx_bd++;
/*
- * Frames received on the NetXteme II are prepended
- * with an l2_fhdr structure which provides status
- * information about the received frame (including
- * VLAN tags and checksum info). The frames are also
- * automatically adjusted to align the IP header
- * (i.e. two null bytes are inserted before the
- * Ethernet header). As a result the data DMA'd by
- * the controller into the mbuf is as follows:
+ * Frames received on the NetXteme II are prepended with an
+ * l2_fhdr structure which provides status information about
+ * the received frame (including VLAN tags and checksum info).
+ * The frames are also automatically adjusted to align the IP
+ * header (i.e. two null bytes are inserted before the Ethernet
+ * header). As a result the data DMA'd by the controller into
+ * the mbuf is as follows:
+ *
* +---------+-----+---------------------+-----+
* | l2_fhdr | pad | packet data | FCS |
* +---------+-----+---------------------+-----+
- * The l2_fhdr needs to be checked and skipped and
- * the FCS needs to be stripped before sending the
- * packet up the stack.
+ *
+ * The l2_fhdr needs to be checked and skipped and the FCS needs
+ * to be stripped before sending the packet up the stack.
*/
l2fhdr = mtod(m0, struct l2_fhdr *);
@@ -5780,7 +5809,7 @@ bce_rx_intr(struct bce_softc *sc)
*/
m_adj(m0, sizeof(struct l2_fhdr) + ETHER_ALIGN);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/*
* Check whether the received frame fits in a single
* mbuf or not (i.e. packet data + FCS <=
@@ -5878,8 +5907,9 @@ bce_rx_intr(struct bce_softc *sc)
BCE_PRINTF("Invalid Ethernet frame size!\n");
m_print(m0, 128));
- DBRUNIF(DB_RANDOMTRUE(bce_debug_l2fhdr_status_check),
+ DBRUNIF(DB_RANDOMTRUE(l2fhdr_error_sim_control),
BCE_PRINTF("Simulating l2_fhdr status error.\n");
+ sc->l2fhdr_error_sim_count++;
status = status | L2_FHDR_ERRORS_PHY_DECODE);
/* Check the received frame for errors. */
@@ -5889,7 +5919,7 @@ bce_rx_intr(struct bce_softc *sc)
/* Log the error and release the mbuf. */
ifp->if_ierrors++;
- DBRUN(sc->l2fhdr_status_errors++);
+ sc->l2fhdr_error_count++;
m_freem(m0);
m0 = NULL;
@@ -5930,10 +5960,7 @@ bce_rx_intr(struct bce_softc *sc)
}
}
- /*
- * If we received a packet with a vlan tag,
- * attach that information to the packet.
- */
+ /* Attach the VLAN tag. */
if (status & L2_FHDR_STATUS_L2_VLAN_TAG) {
#if __FreeBSD_version < 700000
VLAN_INPUT_TAG(ifp, m0, l2fhdr->l2_fhdr_vlan_tag, continue);
@@ -5943,7 +5970,7 @@ bce_rx_intr(struct bce_softc *sc)
#endif
}
- /* Pass the mbuf off to the upper layers. */
+ /* Increment received packet statistics. */
ifp->if_ipackets++;
bce_rx_int_next_rx:
@@ -5953,7 +5980,7 @@ bce_rx_int_next_rx:
if (m0) {
/* Make sure we don't lose our place when we release the lock. */
sc->rx_cons = sw_rx_cons;
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
sc->pg_cons = sw_pg_cons;
#endif
@@ -5963,7 +5990,7 @@ bce_rx_int_next_rx:
/* Recover our place. */
sw_rx_cons = sc->rx_cons;
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
sw_pg_cons = sc->pg_cons;
#endif
}
@@ -5974,7 +6001,7 @@ bce_rx_int_next_rx:
}
/* No new packets to process. Refill the RX and page chains and exit. */
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
sc->pg_cons = sw_pg_cons;
bce_fill_pg_chain(sc);
#endif
@@ -5986,7 +6013,7 @@ bce_rx_int_next_rx:
bus_dmamap_sync(sc->rx_bd_chain_tag,
sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
for (int i = 0; i < PG_PAGES; i++)
bus_dmamap_sync(sc->pg_bd_chain_tag,
sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE);
@@ -6232,7 +6259,7 @@ bce_init_locked(struct bce_softc *sc)
* Calculate and program the hardware Ethernet MTU
* size. Be generous on the receive if we have room.
*/
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
if (ifp->if_mtu <= (sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size))
ether_mtu = sc->rx_bd_mbuf_data_len + sc->pg_bd_mbuf_alloc_size;
#else
@@ -6257,14 +6284,17 @@ bce_init_locked(struct bce_softc *sc)
DBPRINT(sc, BCE_INFO_LOAD,
"%s(): rx_bd_mbuf_alloc_size = %d, rx_bce_mbuf_data_len = %d, "
- "rx_bd_mbuf_align_pad = %d, pg_bd_mbuf_alloc_size = %d\n",
- __FUNCTION__, sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len,
- sc->rx_bd_mbuf_align_pad, sc->pg_bd_mbuf_alloc_size);
+ "rx_bd_mbuf_align_pad = %d\n", __FUNCTION__,
+ sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len,
+ sc->rx_bd_mbuf_align_pad);
/* Program appropriate promiscuous/multicast filtering. */
bce_set_rx_mode(sc);
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
+ DBPRINT(sc, BCE_INFO_LOAD, "%s(): pg_bd_mbuf_alloc_size = %d\n",
+ __FUNCTION__, sc->pg_bd_mbuf_alloc_size);
+
/* Init page buffer descriptor chain. */
bce_init_pg_chain(sc);
#endif
@@ -6473,10 +6503,7 @@ bce_tx_encap_skip_tso:
/* Check if the DMA mapping was successful */
if (error == EFBIG) {
- /* The mbuf is too fragmented for our DMA mapping. */
- DBPRINT(sc, BCE_WARN, "%s(): fragmented mbuf (%d pieces)\n",
- __FUNCTION__, nsegs);
- DBRUN(bce_dump_mbuf(sc, m0););
+ sc->fragmented_mbuf_count++;
/* Try to defrag the mbuf. */
m0 = m_defrag(*m_head, M_DONTWAIT);
@@ -6484,7 +6511,7 @@ bce_tx_encap_skip_tso:
/* Defrag was unsuccessful */
m_freem(*m_head);
*m_head = NULL;
- sc->mbuf_alloc_failed++;
+ sc->mbuf_alloc_failed_count++;
rc = ENOBUFS;
goto bce_tx_encap_exit;
}
@@ -6497,7 +6524,7 @@ bce_tx_encap_skip_tso:
/* Still getting an error after a defrag. */
if (error == ENOMEM) {
/* Insufficient DMA buffers available. */
- sc->tx_dma_map_failures++;
+ sc->dma_map_addr_tx_failed_count++;
rc = error;
goto bce_tx_encap_exit;
} else if (error != 0) {
@@ -6507,19 +6534,19 @@ bce_tx_encap_skip_tso:
__FILE__, __LINE__);
m_freem(m0);
*m_head = NULL;
- sc->tx_dma_map_failures++;
+ sc->dma_map_addr_tx_failed_count++;
rc = ENOBUFS;
goto bce_tx_encap_exit;
}
} else if (error == ENOMEM) {
/* Insufficient DMA buffers available. */
- sc->tx_dma_map_failures++;
+ sc->dma_map_addr_tx_failed_count++;
rc = error;
goto bce_tx_encap_exit;
} else if (error != 0) {
m_freem(m0);
*m_head = NULL;
- sc->tx_dma_map_failures++;
+ sc->dma_map_addr_tx_failed_count++;
rc = error;
goto bce_tx_encap_exit;
}
@@ -6777,7 +6804,7 @@ bce_ioctl(struct ifnet *ifp, u_long comm
BCE_LOCK(sc);
ifp->if_mtu = ifr->ifr_mtu;
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/* No buffer allocation size changes are necessary. */
#else
/* Recalculate our buffer allocation sizes. */
@@ -7024,9 +7051,10 @@ bce_intr(void *xsc)
status_attn_bits = sc->status_block->status_attn_bits;
- DBRUNIF(DB_RANDOMTRUE(bce_debug_unexpected_attention),
- BCE_PRINTF("Simulating unexpected status attention bit set.");
- status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR);
+ DBRUNIF(DB_RANDOMTRUE(unexpected_attention_sim_control),
+ BCE_PRINTF("Simulating unexpected status attention bit set.");
+ sc->unexpected_attention_sim_count++;
+ status_attn_bits = status_attn_bits | STATUS_ATTN_BITS_PARITY_ERROR);
/* Was it a link change interrupt? */
if ((status_attn_bits & STATUS_ATTN_BITS_LINK_STATE) !=
@@ -7044,13 +7072,13 @@ bce_intr(void *xsc)
(sc->status_block->status_attn_bits_ack &
~STATUS_ATTN_BITS_LINK_STATE))) {
- DBRUN(sc->unexpected_attentions++);
+ sc->unexpected_attention_count++;
BCE_PRINTF("%s(%d): Fatal attention detected: 0x%08X\n",
__FILE__, __LINE__, sc->status_block->status_attn_bits);
DBRUNMSG(BCE_FATAL,
- if (bce_debug_unexpected_attention == 0)
+ if (unexpected_attention_sim_control == 0)
bce_breakpoint(sc));
bce_init_locked(sc);
@@ -7299,8 +7327,8 @@ bce_stats_update(struct bce_softc *sc)
sc->stat_EtherStatsUndersizePkts =
stats->stat_EtherStatsUndersizePkts;
- sc->stat_EtherStatsOverrsizePkts =
- stats->stat_EtherStatsOverrsizePkts;
+ sc->stat_EtherStatsOversizePkts =
+ stats->stat_EtherStatsOversizePkts;
sc->stat_EtherStatsPktsRx64Octets =
stats->stat_EtherStatsPktsRx64Octets;
@@ -7404,7 +7432,7 @@ bce_stats_update(struct bce_softc *sc)
/* ToDo: This method loses soft errors. */
ifp->if_ierrors =
(u_long) sc->stat_EtherStatsUndersizePkts +
- (u_long) sc->stat_EtherStatsOverrsizePkts +
+ (u_long) sc->stat_EtherStatsOversizePkts +
(u_long) sc->stat_IfInMBUFDiscards +
(u_long) sc->stat_Dot3StatsAlignmentErrors +
(u_long) sc->stat_Dot3StatsFCSErrors +
@@ -7478,7 +7506,7 @@ bce_tick(void *xsc)
bce_stats_update(sc);
/* Top off the receive and page chains. */
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
bce_fill_pg_chain(sc);
#endif
bce_fill_rx_chain(sc);
@@ -7658,7 +7686,7 @@ bce_sysctl_dump_tx_chain(SYSCTL_HANDLER_
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Provides a sysctl interface to allow dumping the page chain. */
/* */
@@ -7855,6 +7883,91 @@ bce_add_sysctls(struct bce_softc *sc)
#ifdef BCE_DEBUG
SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "l2fhdr_error_sim_control",
+ CTLFLAG_RW, &l2fhdr_error_sim_control,
+ 0, "Debug control to force l2fhdr errors");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "l2fhdr_error_sim_count",
+ CTLFLAG_RD, &sc->l2fhdr_error_sim_count,
+ 0, "Number of simulated l2_fhdr errors");
+#endif
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "l2fhdr_error_count",
+ CTLFLAG_RD, &sc->l2fhdr_error_count,
+ 0, "Number of l2_fhdr errors");
+
+#ifdef BCE_DEBUG
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "mbuf_alloc_failed_sim_control",
+ CTLFLAG_RW, &mbuf_alloc_failed_sim_control,
+ 0, "Debug control to force mbuf allocation failures");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "mbuf_alloc_failed_sim_count",
+ CTLFLAG_RD, &sc->mbuf_alloc_failed_sim_count,
+ 0, "Number of simulated mbuf cluster allocation failures");
+#endif
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "mbuf_alloc_failed_count",
+ CTLFLAG_RD, &sc->mbuf_alloc_failed_count,
+ 0, "Number of mbuf allocation failures");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "fragmented_mbuf_count",
+ CTLFLAG_RD, &sc->fragmented_mbuf_count,
+ 0, "Number of fragmented mbufs");
+
+#ifdef BCE_DEBUG
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "dma_map_addr_failed_sim_control",
+ CTLFLAG_RW, &dma_map_addr_failed_sim_control,
+ 0, "Debug control to force DMA mapping failures");
+
+ /* ToDo: Figure out how to update this value in bce_dma_map_addr(). */
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "dma_map_addr_failed_sim_count",
+ CTLFLAG_RD, &sc->dma_map_addr_failed_sim_count,
+ 0, "Number of simulated DMA mapping failures");
+
+#endif
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "dma_map_addr_rx_failed_count",
+ CTLFLAG_RD, &sc->dma_map_addr_rx_failed_count,
+ 0, "Number of RX DMA mapping failures");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "dma_map_addr_tx_failed_count",
+ CTLFLAG_RD, &sc->dma_map_addr_tx_failed_count,
+ 0, "Number of TX DMA mapping failures");
+
+#ifdef BCE_DEBUG
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "unexpected_attention_sim_control",
+ CTLFLAG_RW, &unexpected_attention_sim_control,
+ 0, "Debug control to simulate unexpected attentions");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "unexpected_attention_sim_count",
+ CTLFLAG_RW, &sc->unexpected_attention_sim_count,
+ 0, "Number of simulated unexpected attentions");
+#endif
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "unexpected_attention_count",
+ CTLFLAG_RW, &sc->unexpected_attention_count,
+ 0, "Number of unexpected attentions");
+
+#ifdef BCE_DEBUG
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
+ "debug_bootcode_running_failure",
+ CTLFLAG_RW, &bootcode_running_failure_sim_control,
+ 0, "Debug control to force bootcode running failures");
+
+ SYSCTL_ADD_INT(ctx, children, OID_AUTO,
"rx_low_watermark",
CTLFLAG_RD, &sc->rx_low_watermark,
0, "Lowest level of free rx_bd's");
@@ -7875,26 +7988,6 @@ bce_add_sysctls(struct bce_softc *sc)
0, "Number of times the TX chain was full");
SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "l2fhdr_status_errors",
- CTLFLAG_RD, &sc->l2fhdr_status_errors,
- 0, "l2_fhdr status errors");
-
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "unexpected_attentions",
- CTLFLAG_RD, &sc->unexpected_attentions,
- 0, "Unexpected attentions");
-
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "lost_status_block_updates",
- CTLFLAG_RD, &sc->lost_status_block_updates,
- 0, "Lost status block updates");
-
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "debug_mbuf_sim_alloc_failed",
- CTLFLAG_RD, &sc->debug_mbuf_sim_alloc_failed,
- 0, "Simulated mbuf cluster allocation failures");
-
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
"requested_tso_frames",
CTLFLAG_RD, &sc->requested_tso_frames,
0, "Number of TSO frames received");
@@ -7920,16 +8013,6 @@ bce_add_sysctls(struct bce_softc *sc)
"TX interrupt time");
#endif
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "mbuf_alloc_failed",
- CTLFLAG_RD, &sc->mbuf_alloc_failed,
- 0, "mbuf cluster allocation failures");
-
- SYSCTL_ADD_INT(ctx, children, OID_AUTO,
- "tx_dma_map_failures",
- CTLFLAG_RD, &sc->tx_dma_map_failures,
- 0, "tx dma mapping failures");
-
SYSCTL_ADD_ULONG(ctx, children, OID_AUTO,
"stat_IfHcInOctets",
CTLFLAG_RD, &sc->stat_IfHCInOctets,
@@ -8046,9 +8129,9 @@ bce_add_sysctls(struct bce_softc *sc)
0, "Undersize packets");
SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
- "stat_EtherStatsOverrsizePkts",
- CTLFLAG_RD, &sc->stat_EtherStatsOverrsizePkts,
- 0, "stat_EtherStatsOverrsizePkts");
+ "stat_EtherStatsOversizePkts",
+ CTLFLAG_RD, &sc->stat_EtherStatsOversizePkts,
+ 0, "stat_EtherStatsOversizePkts");
SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
"stat_EtherStatsPktsRx64Octets",
@@ -8231,7 +8314,7 @@ bce_add_sysctls(struct bce_softc *sc)
(void *)sc, 0,
bce_sysctl_dump_tx_chain, "I", "Dump tx_bd chain");
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
SYSCTL_ADD_PROC(ctx, children, OID_AUTO,
"dump_pg_chain", CTLTYPE_INT | CTLFLAG_RW,
(void *)sc, 0,
@@ -8526,7 +8609,7 @@ bce_dump_rx_mbuf_chain(struct bce_softc
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Prints out the mbufs in the mbuf page chain. */
/* */
@@ -8650,7 +8733,7 @@ bce_dump_rxbd(struct bce_softc *sc, int
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Prints out a rx_bd structure in the page chain. */
/* */
@@ -9137,7 +9220,7 @@ bce_dump_rx_chain(struct bce_softc *sc,
}
-#ifdef BCE_USE_SPLIT_HEADER
+#ifdef ZERO_COPY_SOCKETS
/****************************************************************************/
/* Prints out the page chain. */
/* */
@@ -9439,9 +9522,9 @@ bce_dump_stats_block(struct bce_softc *s
BCE_PRINTF(" 0x%08X : EtherStatsUndersizePkts\n",
sblk->stat_EtherStatsUndersizePkts);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-stable
mailing list