From owner-svn-src-head@FreeBSD.ORG Tue Apr 5 22:13:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7574106564A; Tue, 5 Apr 2011 22:13:33 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B64958FC0A; Tue, 5 Apr 2011 22:13:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p35MDX34032224; Tue, 5 Apr 2011 22:13:33 GMT (envelope-from davidch@svn.freebsd.org) Received: (from davidch@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p35MDXX7032221; Tue, 5 Apr 2011 22:13:33 GMT (envelope-from davidch@svn.freebsd.org) Message-Id: <201104052213.p35MDXX7032221@svn.freebsd.org> From: David Christensen Date: Tue, 5 Apr 2011 22:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220377 - head/sys/dev/bxe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2011 22:13:33 -0000 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): Warning: This driver needs bootcode " + "0x%08X but found 0x%08X, please upgrade!\n", + __FILE__, __LINE__, MIN_BXE_BC_VER, sc->common.bc_ver); goto bxe_get_common_hwinfo_exit; } @@ -2850,7 +2854,8 @@ bxe_detach(device_t dev) ifp = sc->bxe_ifp; if (ifp != NULL && ifp->if_vlantrunk != NULL) { - BXE_PRINTF("Cannot detach while VLANs are in use.\n"); + BXE_PRINTF("%s(%d): Cannot detach while VLANs are in use.\n", + __FILE__, __LINE__); return(EBUSY); } @@ -3041,7 +3046,8 @@ bxe_stop_multi(struct bxe_softc *sc, int /* Wait for the ramrod completion. */ rc = bxe_wait_ramrod(sc, BXE_FP_STATE_HALTED, index, &(fp->state), 1); if (rc){ - BXE_PRINTF("halted failed \n"); + BXE_PRINTF("%s(%d): fp[%02d] client ramrod halt failed!\n", + __FILE__, __LINE__, index); goto bxe_stop_multi_exit; } /* Delete the CFC entry. */ @@ -3185,7 +3191,7 @@ bxe_stop_locked(struct bxe_softc *sc, in if (count == 0) { BXE_PRINTF( - "%s(%d): Timeout wating for fp[%d] to complete.\n", + "%s(%d): Timeout wating for fp[%d] transmits to complete!\n", __FILE__, __LINE__, i); break; } @@ -3252,7 +3258,6 @@ bxe_stop_locked(struct bxe_softc *sc, in /* Stop all non-leading client connections. */ for (i = 1; i < sc->num_queues; i++) { if (bxe_stop_multi(sc, i)){ - BXE_PRINTF("multi failed \n"); goto bxe_stop_locked_exit; } } @@ -3262,9 +3267,8 @@ bxe_stop_locked(struct bxe_softc *sc, in #ifdef BXE_DEBUG if ((sc->state != BXE_STATE_CLOSING_WAIT4_UNLOAD) || (sc->fp[0].state != BXE_FP_STATE_CLOSED)) { - BXE_PRINTF( - "%s(): Failed to close leading connection!\n", - __FUNCTION__); + BXE_PRINTF("%s(%d): Failed to close leading " + "client connection!\n", __FILE__, __LINE__); } #endif } @@ -3368,7 +3372,9 @@ bxe_link_report(struct bxe_softc *sc) /* Report the link status change to OS. */ if (sc->state == BXE_STATE_OPEN) if_link_state_change(sc->bxe_ifp, LINK_STATE_UP); + line_speed = sc->link_vars.line_speed; + if (IS_E1HMF(sc)){ vn_max_rate = ((sc->mf_config[BP_E1HVN(sc)] & FUNC_MF_CFG_MAX_BW_MASK) >> @@ -3383,6 +3389,7 @@ bxe_link_report(struct bxe_softc *sc) printf("full duplex"); else printf("half duplex"); + if (sc->link_vars.flow_ctrl) { if (sc->link_vars.flow_ctrl & FLOW_CTRL_RX) { printf(", receive "); @@ -3395,7 +3402,7 @@ bxe_link_report(struct bxe_softc *sc) printf("\n"); } else { /* Report the link down */ - BXE_PRINTF("Link is down.\n"); + BXE_PRINTF("Link is down\n"); if_link_state_change(sc->bxe_ifp, LINK_STATE_DOWN); } @@ -3611,7 +3618,8 @@ bxe_init_locked(struct bxe_softc *sc, in /* Initialize hardware. */ if (bxe_init_hw(sc, load_code)){ - BXE_PRINTF("HW init failed, aborting\n"); + BXE_PRINTF("%s(%d): Hardware initialization failed, " + "aborting!\n", __FILE__, __LINE__); goto bxe_init_locked_failed1; } @@ -3628,8 +3636,8 @@ bxe_init_locked(struct bxe_softc *sc, in sc->mbuf_alloc_size = MJUM9BYTES; - DBPRINT(sc, BXE_INFO, - "%s(): mbuf_alloc_size = %d, max_frame_size = %d\n", __FUNCTION__, + DBPRINT(sc, BXE_INFO, "%s(): mbuf_alloc_size = %d, " + "max_frame_size = %d\n", __FUNCTION__, sc->mbuf_alloc_size, sc->port.ether_mtu); /* Setup NIC internals and enable interrupts. */ @@ -3638,7 +3646,7 @@ bxe_init_locked(struct bxe_softc *sc, in if ((load_code == FW_MSG_CODE_DRV_LOAD_COMMON) && (sc->common.shmem2_base)){ if (bxe_dcc_enable) { - BXE_PRINTF(" setting dcc support\n"); + BXE_PRINTF("Enabing DCC support\n"); SHMEM2_WR(sc, dcc_support, (SHMEM_DCC_SUPPORT_DISABLE_ENABLE_PF_TLV | SHMEM_DCC_SUPPORT_BANDWIDTH_ALLOCATION_TLV)); @@ -3675,8 +3683,8 @@ bxe_init_locked(struct bxe_softc *sc, in if (sc->state == BXE_STATE_OPEN) { for (i = 1; i < sc->num_queues; i++) { if (bxe_setup_multi(sc, i)) { - DBPRINT(sc, 1, - "%s(): fp[%d] CLIENT_SETUP ramrod failed! State not OPEN!\n", + DBPRINT(sc, BXE_FATAL, + "%s(): fp[%02d] CLIENT_SETUP ramrod failed! State not OPEN!\n", __FUNCTION__, i); goto bxe_init_locked_failed4; } @@ -4067,9 +4075,9 @@ static void bxe_init_wr_zp(struct bxe_softc *sc, uint32_t addr, uint32_t len, uint32_t blob_off) { - BXE_PRINTF("%s(): Compressed FW is not supported yet. " - "ERROR: address:0x%x len:0x%x bloboffset:0x%x\n", __FUNCTION__, - addr, len, blob_off); + BXE_PRINTF("%s(%d): Compressed FW is not supported yet. " + "ERROR: address:0x%x len:0x%x blob_offset:0x%x\n", + __FILE__, __LINE__, addr, len, blob_off); } /* @@ -4720,8 +4728,10 @@ bxe_panic_dump(struct bxe_softc *sc) BXE_PRINTF("---------- Begin crash dump ----------\n"); /* Idle check is run twice to verify the controller has stopped. */ - bxe_idle_chk(sc); bxe_idle_chk(sc); + bxe_idle_chk(sc); + bxe_idle_chk(sc); bxe_mc_assert(sc); + #ifdef BXE_DEBUG bxe_breakpoint(sc); #endif @@ -5677,7 +5687,8 @@ bxe_get_gpio(struct bxe_softc *sc, int g gpio_mask = 1 << gpio_shift; if (gpio_num > MISC_REGISTERS_GPIO_3) { - BXE_PRINTF("Invalid GPIO %d\n", gpio_num); + DBPRINT(sc, BXE_WARN, "%s(): Invalid GPIO %d\n", + __FUNCTION__, gpio_num); return (-EINVAL); } @@ -5785,7 +5796,8 @@ bxe_set_gpio_int(struct bxe_softc *sc, i (gpio_port ? MISC_REGISTERS_GPIO_PORT_SHIFT : 0); gpio_mask = (1 << gpio_shift); if (gpio_num > MISC_REGISTERS_GPIO_3) { - BXE_PRINTF("Invalid GPIO %d\n", gpio_num); + DBPRINT(sc, BXE_WARN, "%s(): Invalid GPIO %d\n", + __FUNCTION__, gpio_num); return (-EINVAL); } @@ -6180,8 +6192,8 @@ bxe_sp_post(struct bxe_softc *sc, int co /* We are limited to 8 slowpath commands. */ if (!sc->spq_left) { - BXE_PRINTF("%s(%d): Slowpath queue is full!\n", __FILE__, - __LINE__); + BXE_PRINTF("%s(%d): Slowpath queue is full!\n", + __FILE__, __LINE__); bxe_panic_dump(sc); rc = EBUSY; goto bxe_sp_post_exit; @@ -6363,7 +6375,8 @@ bxe_attn_int_asserted(struct bxe_softc * nig_mask = 0; if (sc->attn_state & asserted) - BXE_PRINTF("%s(%d): IGU ERROR!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): IGU attention ERROR!\n", + __FILE__, __LINE__); rc = bxe_acquire_hw_lock(sc, HW_LOCK_RESOURCE_PORT0_ATT_MASK + port); @@ -6551,8 +6564,8 @@ bxe_attn_int_deasserted0(struct bxe_soft SHMEM_WR(sc, dev_info.port_hw_config[port].external_phy_config, sc->link_params.ext_phy_config); /* Log the failure */ - BXE_PRINTF("A fan failure has caused the driver to shutdown " - "the device to prevent permanent damage.\n"); + BXE_PRINTF("A fan failure has caused the driver to " + "shutdown the device to prevent permanent damage.\n"); } if (attn & (AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0 | @@ -6568,9 +6581,8 @@ bxe_attn_int_deasserted0(struct bxe_soft val &= ~(attn & HW_INTERRUT_ASSERT_SET_0); REG_WR(sc, reg_offset, val); - BXE_PRINTF( - "%s(%d): FATAL hardware block attention (set0 = 0x%08X)!\n", - __FILE__, __LINE__, + BXE_PRINTF("%s(%d): FATAL hardware block attention " + "(set0 = 0x%08X)!\n", __FILE__, __LINE__, (attn & (uint32_t)HW_INTERRUT_ASSERT_SET_0)); bxe_panic_dump(sc); @@ -6616,9 +6628,8 @@ bxe_attn_int_deasserted1(struct bxe_soft val &= ~(attn & HW_INTERRUT_ASSERT_SET_1); REG_WR(sc, reg_offset, val); - BXE_PRINTF( - "%s(%d): FATAL hardware block attention (set1 = 0x%08X)!\n", - __FILE__, __LINE__, + BXE_PRINTF("%s(%d): FATAL hardware block attention " + "(set1 = 0x%08X)!\n", __FILE__, __LINE__, (attn & (uint32_t)HW_INTERRUT_ASSERT_SET_1)); bxe_panic_dump(sc); @@ -7098,7 +7109,8 @@ bxe_stats_port_base_init(struct bxe_soft struct dmae_command *dmae; if (!sc->port.pmf || !sc->port.port_stx) { - BXE_PRINTF("%s(%d): Bug!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): Invalid statistcs port setup!\n", + __FILE__, __LINE__); return; } @@ -7445,7 +7457,8 @@ bxe_stats_port_init(struct bxe_softc *sc /* Sanity check. */ if (!sc->link_vars.link_up || !sc->port.pmf) { - BXE_PRINTF("%s(%d): Bug!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): Invalid statistics port setup!\n", + __FILE__, __LINE__); goto bxe_stats_port_init_exit; } @@ -7664,7 +7677,8 @@ bxe_stats_func_init(struct bxe_softc *sc stats_comp = BXE_SP(sc, stats_comp); if (!sc->func_stx) { - BXE_PRINTF("%s(%d): Bug!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): Invalid statistics function setup!\n", + __FILE__, __LINE__); goto bxe_stats_func_init_exit; } @@ -8006,27 +8020,33 @@ bxe_stats_storm_update(struct bxe_softc /* Are STORM statistics valid? */ if ((uint16_t)(le16toh(tclient->stats_counter) + 1) != sc->stats_counter) { +#if 0 DBPRINT(sc, BXE_WARN, "%s(): Stats not updated by TSTORM " "(tstorm counter (%d) != stats_counter (%d))!\n", __FUNCTION__, tclient->stats_counter, sc->stats_counter); +#endif rc = 1; goto bxe_stats_storm_update_exit; } if ((uint16_t)(le16toh(uclient->stats_counter) + 1) != sc->stats_counter) { +#if 0 DBPRINT(sc, BXE_WARN, "%s(): Stats not updated by USTORM " "(ustorm counter (%d) != stats_counter (%d))!\n", __FUNCTION__, uclient->stats_counter, sc->stats_counter); +#endif rc = 2; goto bxe_stats_storm_update_exit; } if ((uint16_t)(le16toh(xclient->stats_counter) + 1) != sc->stats_counter) { +#if 0 DBPRINT(sc, BXE_WARN, "%s(): Stats not updated by XSTORM " "(xstorm counter (%d) != stats_counter (%d))!\n", __FUNCTION__, xclient->stats_counter, sc->stats_counter); +#endif rc = 3; goto bxe_stats_storm_update_exit; } @@ -8498,7 +8518,9 @@ bxe_stats_handle(struct bxe_softc *sc, e * Check that (13 total bds - 3bds) = 10 bd window >= MSS. * The window: 3 bds are = 1 (for headers BD) + 2 (for PBD and last BD) * The headers comes in a seperate bd in FreeBSD. So 13-3=10. - * returns 1 to defrag, 0 if OK. + * + * Returns: + * 0 if OK to send, 1 if packet needs further defragmentation. */ static int bxe_chktso_window(struct bxe_softc* sc, int nsegs, bus_dma_segment_t *segs, @@ -8573,11 +8595,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st sc = fp->sc; DBENTER(BXE_VERBOSE_SEND); - rc = 0; - nbds = 0; - ovlan = 0; - vlan_off = 0; - total_pkt_size = 0; + rc = nbds = ovlan = vlan_off = total_pkt_size = 0; m0 = *m_head; @@ -8600,122 +8618,116 @@ bxe_tx_encap(struct bxe_fastpath *fp, st map = fp->tx_mbuf_map[TX_BD(pkt_prod)]; error = bus_dmamap_load_mbuf_sg(fp->tx_mbuf_tag, map, m0, segs, &nsegs, BUS_DMA_NOWAIT); + do{ /* Handle any mapping errors. */ if(__predict_false(error)){ + fp->tx_dma_mapping_failure++; if (error == ENOMEM) { - /* Temporary OS resource issue. */ + /* Resource issue, try again later. */ rc = ENOMEM; }else if (error == EFBIG) { /* Possibly recoverable. */ - DBRUN(fp->mbuf_defrag_attempts++); + 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__); + fp->mbuf_defrag_failures++; rc = ENOBUFS; } else { /* Defrag was successful, try mapping again.*/ - DBRUN(fp->mbuf_defrag_successes++); + fp->mbuf_defrag_successes++; *m_head = m0; error = bus_dmamap_load_mbuf_sg( fp->tx_mbuf_tag, map, m0, segs, &nsegs, BUS_DMA_NOWAIT); + if (error) { + fp->tx_dma_mapping_failure++; + rc = error; + } } }else { /* Unrecoverable. */ - BXE_PRINTF("%s(%d): Unknown TX mapping error! " - "rc = %d.\n", __FILE__, __LINE__, error); + DBPRINT(sc, BXE_WARN_SEND, + "%s(): Unknown TX mapping error! " + "rc = %d.\n", __FUNCTION__, 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 - * to do the job. Make sure we have enough room for a parsing - * BD too. - */ + /* Make sure this enough room in the send queue. */ if (__predict_false((nsegs + 2) > (USABLE_TX_BD - fp->used_tx_bd))) { + fp->tx_queue_too_full++; 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 (__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. + + /* + * The mbuf may be to big for the controller + * to handle. If the frame is a TSO frame + * we'll need to do an additional check. */ if(m0->m_pkthdr.csum_flags & CSUM_TSO){ - if (! bxe_chktso_window(sc,nsegs,segs,m0)) - /* Send it */ + if (bxe_chktso_window(sc,nsegs,segs,m0) == 0) + /* OK to send. */ break; - } + else + fp->tso_window_violation++; + } else + fp->std_window_violation++; - /* Defrag for non tso and if tso needs it */ - DBRUN(fp->mbuf_defrag_attempts++); + /* + * If this is a standard frame then defrag is + * required. Unmap the mbuf, defrag it, then + * try mapping it again. + */ + fp->mbuf_defrag_attempts++; + bus_dmamap_unload(fp->tx_mbuf_tag, map); m0 = m_defrag(*m_head, M_DONTWAIT); if (m0 == NULL) { - BXE_PRINTF("%s(%d): Can't defrag TX frame!\n", - __FILE__, __LINE__); + fp->mbuf_defrag_failures++; rc = ENOBUFS; break; } /* Defrag was successful, try mapping again. */ - DBRUN(fp->mbuf_defrag_successes++); + fp->mbuf_defrag_successes++; *m_head = m0; error = bus_dmamap_load_mbuf_sg( fp->tx_mbuf_tag, map, m0, segs, &nsegs, BUS_DMA_NOWAIT); + /* Handle any mapping errors. */ if (__predict_false(error)) { - if(error == ENOMEM) { - /* This is a recoverable error, - * try again later. - */ - rc = ENOMEM; - } else { - /* The frame can't be defragged, - * drop it. - */ - BXE_PRINTF("%s(%d): Can't map TX frame!\n", - __FILE__, __LINE__); - rc = error; - } + fp->tx_dma_mapping_failure++; + rc = error; break; } /* Last try */ if (m0->m_pkthdr.csum_flags & CSUM_TSO){ - if (bxe_chktso_window(sc,nsegs,segs,m0)) + if (bxe_chktso_window(sc,nsegs,segs,m0) == 1) rc = ENOBUFS; } else if (nsegs > 12 ){ - BXE_PRINTF("%s(%d): Too many fragments for a TSO " - "frame!\n", __FILE__, __LINE__); rc = ENOBUFS; - } + } else + rc = 0; } }while (0); - /* Check for errors */ + /* Check for errors */ if (rc){ if(rc == ENOMEM){ /* Recoverable try again later */ - BXE_PRINTF("%s(%d): Error mapping mbuf into TX chain, " - "returning pkt to queue!\n",__FILE__, __LINE__); }else{ fp->soft_tx_errors++; DBRUN(fp->tx_mbuf_alloc--); @@ -8729,10 +8741,10 @@ bxe_tx_encap(struct bxe_fastpath *fp, st fp->tx_pkt_prod++; /* set flag according to packet type (UNICAST_ADDRESS is default)*/ - if (m0->m_flags & M_BCAST) - mac_type = BROADCAST_ADDRESS; - else if (m0->m_flags & M_MCAST) - mac_type = MULTICAST_ADDRESS; + if (m0->m_flags & M_BCAST) + mac_type = BROADCAST_ADDRESS; + else if (m0->m_flags & M_MCAST) + mac_type = MULTICAST_ADDRESS; /* Prepare the first transmit BD for the mbuf(Get a link from the chain). */ tx_start_bd = &fp->tx_bd_chain[TX_PAGE(bd_prod)][TX_IDX(bd_prod)].start_bd; @@ -8766,7 +8778,8 @@ bxe_tx_encap(struct bxe_fastpath *fp, st */ tx_start_bd->vlan = htole16(pkt_prod); - /* Add a parsing BD from the chain. The parsing bd is always added, + /* + * Add a parsing BD from the chain. The parsing bd is always added, * however, it is only used for tso & chksum. */ bd_prod = TX_BD(NEXT_TX_BD(bd_prod)); @@ -8816,7 +8829,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st if (m0->m_pkthdr.csum_flags & CSUM_IP) { DBPRINT(sc, BXE_EXTREME_SEND, "%s(): IP checksum " "enabled.\n", __FUNCTION__); - DBRUN(sc->debug_ip_csum_offload_frames++); + fp->ip_csum_offload_frames++; flags |= ETH_TX_BD_FLAGS_IP_CSUM; } @@ -8833,7 +8846,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st /* Add the TCP checksum offload flag. */ flags |= ETH_TX_BD_FLAGS_L4_CSUM; - DBRUN(sc->debug_tcp_csum_offload_frames++); + fp->tcp_csum_offload_frames++; /* Update the enet + IP + TCP header length. */ tx_parse_bd->total_hlen += (uint16_t)(th->th_off << 1); @@ -8866,7 +8879,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st /* Add the TCP checksum offload flag for UDP frames too. */ flags |= ETH_TX_BD_FLAGS_L4_CSUM; - DBRUN(sc->debug_udp_csum_offload_frames++); + fp->udp_csum_offload_frames++; tx_parse_bd->global_data |= ETH_TX_PARSE_BD_UDP_CS_FLG; /* Get a pointer to the UDP header. */ @@ -8894,13 +8907,13 @@ bxe_tx_encap(struct bxe_fastpath *fp, st break; } case ETHERTYPE_IPV6: - BXE_PRINTF("%s(%d): IPv6 checksum offload not " - "supported!.\n", __FILE__, __LINE__); + fp->unsupported_tso_ipv6_request++; + /* DRC - How to handle this error? */ break; default: - BXE_PRINTF("%s(%d): TSO enabled for unsupported protocol!.\n", - __FILE__, __LINE__); + fp->unsupported_tso_protocol_request++; + /* DRC - How to handle this error? */ } /* Setup the Parsing BD with TSO specific info */ @@ -8913,7 +8926,7 @@ bxe_tx_encap(struct bxe_fastpath *fp, st tx_start_bd->bd_flags.as_bitfield |= ETH_TX_BD_FLAGS_SW_LSO; - DBRUN(sc->debug_tso_offload_frames++); + fp->tso_offload_frames++; if (__predict_false(tx_start_bd->nbytes > hdr_len)) { /* * Split the first BD into 2 BDs to make the @@ -8932,6 +8945,8 @@ bxe_tx_encap(struct bxe_fastpath *fp, st tx_data_bd->addr_hi = htole32(U64_HI(segs[0].ds_addr + hdr_len)); tx_data_bd->addr_lo = htole32(U64_LO(segs[0].ds_addr + hdr_len)); tx_data_bd->nbytes = htole16(segs[0].ds_len) - hdr_len; + if (tx_total_pkt_size_bd == NULL) + tx_total_pkt_size_bd = tx_data_bd; /* * This indicates that the transmit BD @@ -9015,8 +9030,6 @@ bxe_tx_encap(struct bxe_fastpath *fp, st */ -//pci_read_config(sc->bxe_dev, PCIR_REVID, 4); - /* Don't allow reordering of writes for nbd and packets. */ mb(); /* @@ -9028,22 +9041,21 @@ bxe_tx_encap(struct bxe_fastpath *fp, st // BXE_PRINTF("doorbell: nbd %d bd %u index %d\n", nbds, bd_prod, fp->index); fp->tx_db.data.prod += nbds; + /* Producer points to the next free tx_bd at this point. */ fp->tx_bd_prod = bd_prod; DOORBELL(sc, fp->index, fp->tx_db.raw); - DBRUN(fp->tx_pkts++); /* Prevent speculative reads from getting ahead of the status block. */ - bus_space_barrier(sc->bxe_btag, sc->bxe_bhandle, 0, 0, - BUS_SPACE_BARRIER_READ); + bus_space_barrier(sc->bxe_btag, sc->bxe_bhandle, + 0, 0, BUS_SPACE_BARRIER_READ); - /* Prevent speculative reads from getting ahead of the status block. */ - bus_space_barrier(sc->bxe_db_btag, sc->bxe_db_bhandle, 0, 0, - BUS_SPACE_BARRIER_READ); -//pci_read_config(sc->bxe_dev, PCIR_REVID, 4); + /* Prevent speculative reads from getting ahead of the doorbell. */ + bus_space_barrier(sc->bxe_db_btag, sc->bxe_db_bhandle, + 0, 0, BUS_SPACE_BARRIER_READ); DBEXIT(BXE_VERBOSE_SEND); return(rc); @@ -9109,15 +9121,12 @@ static void bxe_tx_start_locked(struct ifnet *ifp, struct bxe_fastpath *fp) { struct bxe_softc *sc; - struct mbuf *m; - int tx_count; + struct mbuf *m = NULL; + int tx_count = 0; sc = fp->sc; DBENTER(BXE_EXTREME_SEND); - m = NULL; - tx_count = 0; - /* Keep adding entries while there are frames to send. */ while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -9136,6 +9145,7 @@ bxe_tx_start_locked(struct ifnet *ifp, s * and wait for the NIC to drain the chain. */ if (__predict_false(bxe_tx_encap(fp, &m))) { + fp->tx_encap_failures++; /* Very Bad Frames(tm) may have been dropped. */ if (m != NULL) { /* @@ -9162,17 +9172,12 @@ bxe_tx_start_locked(struct ifnet *ifp, s } /* No TX packets were dequeued. */ - if (tx_count == 0) { - DBPRINT(sc, BXE_INFO_SEND, - "%s(): No packets were dequeued on fp[%d].\n", __FUNCTION__, - fp->index); - goto bxe_tx_start_locked_exit; - } - - /* Reset the TX watchdog timeout timer. */ - sc->watchdog_timer = BXE_TX_TIMEOUT; + if (tx_count > 0) + /* Reset the TX watchdog timeout timer. */ + sc->watchdog_timer = BXE_TX_TIMEOUT; + else + fp->tx_start_called_on_empty_queue++; -bxe_tx_start_locked_exit: DBEXIT(BXE_EXTREME_SEND); } @@ -9353,14 +9358,6 @@ bxe_ioctl(struct ifnet *ifp, u_long comm error = EINVAL; } - /* Handle any other capabilities. */ - if (mask & ~(IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | - IFCAP_RXCSUM | IFCAP_TXCSUM)) { - BXE_PRINTF("%s(%d): Unsupported capability!\n", - __FILE__, __LINE__); - error = EINVAL; - } - /* Restart the controller with the new capabilities. */ if (reinit) { bxe_stop_locked(sc, UNLOAD_NORMAL); @@ -10139,7 +10136,7 @@ bxe_alloc_mbuf(struct bxe_fastpath *fp, if (__predict_false(m_new == NULL)) { DBPRINT(sc, BXE_WARN, "%s(): mbuf allocation failure!\n", __FUNCTION__); - DBRUN(fp->mbuf_alloc_failed++); + fp->mbuf_alloc_failed++; goto bxe_alloc_mbuf_exit; } @@ -10199,7 +10196,7 @@ bxe_map_mbuf(struct bxe_fastpath *fp, st DBPRINT(sc, BXE_WARN, "%s(): mbuf mapping failure (%d)!\n", __FUNCTION__, rc); m_freem(m); - DBRUN(fp->mbuf_alloc_failed++); + fp->mbuf_alloc_failed++; goto bxe_map_mbuf_exit; } @@ -10324,24 +10321,23 @@ bxe_init_rx_chains(struct bxe_softc *sc) for (i = 0; i < sc->num_queues; i++) { fp = &sc->fp[i]; DBPRINT(sc, (BXE_INSANE_LOAD | BXE_INSANE_RESET), - "%s(): Initializing fp[%d] TPA pool.\n", + "%s(): Initializing fp[%02d] TPA pool.\n", __FUNCTION__, i); for (j = 0; j < max_agg_queues; j++) { DBPRINT(sc, (BXE_INSANE_LOAD | BXE_INSANE_RESET), - "%s(): Initializing fp[%d] TPA pool[%d].\n", - __FUNCTION__, i, j); + "%s(): Initializing fp[%02d] TPA " + "pool[%d].\n", __FUNCTION__, i, j); fp->disable_tpa = 0; fp->tpa_mbuf_ptr[j] = bxe_alloc_tpa_mbuf(fp, j, sc->mbuf_alloc_size); if (fp->tpa_mbuf_ptr[j] == NULL) { - BXE_PRINTF( - "%s(%d): Failed to allocate TPA pool mbuf for fp[%d]! " - "Disabling TPA on this queue!\n", - __FILE__, __LINE__, i); + fp->tpa_mbuf_alloc_failed++; + BXE_PRINTF("TPA disabled on " + "fp[%02d]!\n", i); bxe_free_tpa_pool(fp, j); fp->disable_tpa = 1; break; @@ -10439,9 +10435,10 @@ bxe_init_rx_chains(struct bxe_softc *sc) while (ring_prod < sc->rx_ring_size) { if (bxe_alloc_rx_sge(sc, fp, ring_prod) != 0) { + fp->tpa_mbuf_alloc_failed++; BXE_PRINTF( "%s(%d): Memory allocation failure! " - "Disabling TPA for fp[%d].\n", + "Disabling TPA for fp[%02d].\n", __FILE__, __LINE__, i); /* Cleanup already allocated elements */ @@ -11307,8 +11304,8 @@ bxe_init_internal(struct bxe_softc *sc, default: BXE_PRINTF( - "%s(%d): Unknown load_code (0x%08X) from MCP!\n", __FILE__, - __LINE__, load_code); + "%s(%d): Unknown load_code (0x%08X) from MCP!\n", + __FILE__, __LINE__, load_code); break; } @@ -11434,7 +11431,7 @@ bxe_gunzip_init_nomem2: bxe_gunzip_init_nomem1: BXE_PRINTF( - "%s(%d): Cannot allocate firmware buffer for un-compression!\n", + "%s(%d): Cannot allocate firmware buffer for decompression!\n", __FILE__, __LINE__); rc = ENOMEM; @@ -12229,22 +12226,24 @@ bxe_init_common(struct bxe_softc *sc) /* Finish CFC initialization. */ val = bxe_reg_poll(sc, CFC_REG_LL_INIT_DONE, 1, 100, 10); if (val != 1) { - BXE_PRINTF("%s(%d): CFC LL_INIT failed!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): CFC LL_INIT failed!\n", + __FILE__, __LINE__); rc = EBUSY; goto bxe_init_common_exit; } val = bxe_reg_poll(sc, CFC_REG_AC_INIT_DONE, 1, 100, 10); if (val != 1) { - BXE_PRINTF("%s(%d): CFC AC_INIT failed!\n", __FILE__, __LINE__); + BXE_PRINTF("%s(%d): CFC AC_INIT failed!\n", + __FILE__, __LINE__); rc = EBUSY; goto bxe_init_common_exit; } val = bxe_reg_poll(sc, CFC_REG_CAM_INIT_DONE, 1, 100, 10); if (val != 1) { - BXE_PRINTF("%s(%d): CFC CAM_INIT failed!\n", __FILE__, - __LINE__); + BXE_PRINTF("%s(%d): CFC CAM_INIT failed!\n", + __FILE__, __LINE__); rc = EBUSY; goto bxe_init_common_exit; } @@ -12713,8 +12712,8 @@ bxe_fw_command(struct bxe_softc *sc, uin if (seq == (rc & FW_MSG_SEQ_NUMBER_MASK )) rc &= FW_MSG_CODE_MASK; else { - BXE_PRINTF("%s(%d): Bootcode failed to respond!\n", __FILE__, - __LINE__); + BXE_PRINTF("%s(%d): Bootcode failed to respond!\n", + __FILE__, __LINE__); DBRUN(bxe_dump_fw(sc)); rc = 0; } @@ -13143,8 +13142,9 @@ bxe_dma_alloc(device_t dev) 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); + BXE_PRINTF( + "%s(%d): Could not allocate fp[%d] status block DMA tag!\n", + __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; } @@ -13153,8 +13153,8 @@ bxe_dma_alloc(device_t dev) (void **)&fp->status_block, BUS_DMA_NOWAIT, &fp->status_block_map)) { BXE_PRINTF( - "%s(%d): Could not allocate fp[%d] status block " - "DMA memory!\n", __FILE__, __LINE__, i); + "%s(%d): Could not allocate fp[%d] status block DMA memory!\n", + __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; } @@ -13166,8 +13166,9 @@ bxe_dma_alloc(device_t dev) bxe_dma_map_addr, &busaddr, BUS_DMA_NOWAIT); if (error) { - BXE_PRINTF("%s(%d): Could not map fp[%d] status block " - "DMA memory!\n", __FILE__, __LINE__, i); + BXE_PRINTF( + "%s(%d): Could not map fp[%d] status block DMA memory!\n", + __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; } @@ -13198,8 +13199,8 @@ bxe_dma_alloc(device_t dev) 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); + "%s(%d): Could not allocate fp[%d] TX descriptor chain DMA tag!\n", + __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; } @@ -13209,8 +13210,7 @@ bxe_dma_alloc(device_t dev) (void **)&fp->tx_bd_chain[j], BUS_DMA_NOWAIT, &fp->tx_bd_chain_map[j])) { BXE_PRINTF( - "%s(%d): Could not allocate fp[%d] TX " - "descriptor chain DMA memory!\n", + "%s(%d): Could not allocate fp[%d] TX descriptor chain DMA memory!\n", __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; @@ -13224,8 +13224,8 @@ bxe_dma_alloc(device_t dev) &busaddr, BUS_DMA_NOWAIT); if (error) { - BXE_PRINTF("%s(%d): Could not map fp[%d] " - "TX descriptor chain DMA memory!\n", + BXE_PRINTF( + "%s(%d): Could not map fp[%d] TX descriptor chain DMA memory!\n", __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; @@ -13278,8 +13278,8 @@ bxe_dma_alloc(device_t dev) if (bus_dmamap_create(fp->tx_mbuf_tag, BUS_DMA_NOWAIT, &(fp->tx_mbuf_map[j]))) { - BXE_PRINTF("%s(%d): Unable to create fp[%d] " - "TX mbuf DMA map!\n", + BXE_PRINTF( + "%s(%d): Unable to create fp[%d] TX mbuf DMA map!\n", __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; @@ -13306,8 +13306,8 @@ bxe_dma_alloc(device_t dev) NULL, /* lock f() */ NULL, /* lock f() arg */ &fp->rx_bd_chain_tag)) { - BXE_PRINTF("%s(%d): Could not allocate fp[%d] " - "RX BD chain DMA tag!\n", + BXE_PRINTF( + "%s(%d): Could not allocate fp[%d] RX BD chain DMA tag!\n", __FILE__, __LINE__, i); rc = ENOMEM; goto bxe_dma_alloc_exit; @@ -14792,9 +14792,9 @@ bxe_rxeof(struct bxe_fastpath *fp) #endif DBRUNIF((cqe_fp_flags == 0), - BXE_PRINTF("%s(): CQE received with null " - "type/error flags!\n", __FUNCTION__); + fp->null_cqe_flags++; bxe_dump_cqe(fp, rx_cq_cons_idx, cqe)); + /* DRC - ANything else to do here? */ /* Check the CQE type for slowpath or fastpath completion. */ if (__predict_false(CQE_TYPE(cqe_fp_flags) == @@ -15087,6 +15087,7 @@ bxe_txeof(struct bxe_fastpath *fp) txbd = NULL; sw_tx_chain_cons = TX_BD(sw_tx_bd_cons); pkt_cons = TX_BD(sw_pkt_cons); + #ifdef BXE_DEBUG if (sw_tx_chain_cons > MAX_TX_BD) { BXE_PRINTF( @@ -15106,6 +15107,7 @@ bxe_txeof(struct bxe_fastpath *fp) bxe_breakpoint(sc); } #endif + /* * Find the number of BD's that were used in the completed pkt. */ @@ -15126,8 +15128,7 @@ bxe_txeof(struct bxe_fastpath *fp) fp->tx_mbuf_ptr[pkt_cons] = NULL; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***