From owner-p4-projects@FreeBSD.ORG Thu Feb 1 09:30:16 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1270916A575; Thu, 1 Feb 2007 09:30:16 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0C7A16A573 for ; Thu, 1 Feb 2007 09:30:15 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 820E913C478 for ; Thu, 1 Feb 2007 09:30:15 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l119UDED046334 for ; Thu, 1 Feb 2007 09:30:13 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l119UCpk046331 for perforce@freebsd.org; Thu, 1 Feb 2007 09:30:12 GMT (envelope-from rdivacky@FreeBSD.org) Date: Thu, 1 Feb 2007 09:30:12 GMT Message-Id: <200702010930.l119UCpk046331@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 113820 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Feb 2007 09:30:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=113820 Change 113820 by rdivacky@rdivacky_witten on 2007/02/01 09:29:25 IFC Affected files ... .. //depot/projects/linuxolator/src/sys/dev/mxge/if_mxge.c#6 integrate .. //depot/projects/linuxolator/src/sys/dev/mxge/if_mxge_var.h#5 integrate .. //depot/projects/linuxolator/src/sys/dev/sound/driver.c#3 integrate .. //depot/projects/linuxolator/src/sys/dev/sound/pcm/dsp.h#3 integrate .. //depot/projects/linuxolator/src/sys/modules/msdosfs/Makefile#3 integrate .. //depot/projects/linuxolator/src/sys/netinet/in.h#3 integrate .. //depot/projects/linuxolator/src/sys/nfsclient/nfs_vnops.c#7 integrate .. //depot/projects/linuxolator/src/sys/ufs/ufs/ufs_quota.c#6 integrate .. //depot/projects/linuxolator/src/sys/ufs/ufs/ufs_vfsops.c#2 integrate Differences ... ==== //depot/projects/linuxolator/src/sys/dev/mxge/if_mxge.c#6 (text+ko) ==== @@ -32,7 +32,7 @@ ***************************************************************************/ #include -__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.17 2007/01/30 08:39:44 gallatin Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mxge/if_mxge.c,v 1.20 2007/01/31 19:53:36 gallatin Exp $"); #include #include @@ -90,6 +90,7 @@ static int mxge_deassert_wait = 1; static int mxge_flow_control = 1; static int mxge_verbose = 0; +static int mxge_ticks; static char *mxge_fw_unaligned = "mxge_ethp_z8e"; static char *mxge_fw_aligned = "mxge_eth_z8e"; @@ -648,7 +649,7 @@ buf->response_addr.low = htobe32(dma_low); buf->response_addr.high = htobe32(dma_high); - mtx_lock(&sc->cmd_lock); + mtx_lock(&sc->cmd_mtx); response->result = 0xffffffff; mb(); mxge_pio_copy((volatile void *)cmd_addr, buf, sizeof (*buf)); @@ -661,20 +662,20 @@ if (response->result != 0xffffffff) { if (response->result == 0) { data->data0 = be32toh(response->data); - mtx_unlock(&sc->cmd_lock); + mtx_unlock(&sc->cmd_mtx); return 0; } else { device_printf(sc->dev, "mxge: command %d " "failed, result = %d\n", cmd, be32toh(response->result)); - mtx_unlock(&sc->cmd_lock); + mtx_unlock(&sc->cmd_mtx); return ENXIO; } } DELAY(1000); } - mtx_unlock(&sc->cmd_lock); + mtx_unlock(&sc->cmd_mtx); device_printf(sc->dev, "mxge: command %d timed out" "result = %d\n", cmd, be32toh(response->result)); @@ -927,7 +928,6 @@ { mxge_cmd_t cmd; - mxge_dma_t dmabench_dma; size_t bytes; int status; @@ -975,13 +975,10 @@ /* run a DMA benchmark */ sc->read_dma = sc->write_dma = sc->read_write_dma = 0; - status = mxge_dma_alloc(sc, &dmabench_dma, 4096, 4096); - if (status) - goto dmabench_fail; /* Read DMA */ - cmd.data0 = MXGE_LOWPART_TO_U32(dmabench_dma.bus_addr); - cmd.data1 = MXGE_HIGHPART_TO_U32(dmabench_dma.bus_addr); + cmd.data0 = MXGE_LOWPART_TO_U32(sc->dmabench_dma.bus_addr); + cmd.data1 = MXGE_HIGHPART_TO_U32(sc->dmabench_dma.bus_addr); cmd.data2 = sc->tx.boundary * 0x10000; status = mxge_send_cmd(sc, MXGEFW_DMA_TEST, &cmd); @@ -992,8 +989,8 @@ (cmd.data0 & 0xffff); /* Write DMA */ - cmd.data0 = MXGE_LOWPART_TO_U32(dmabench_dma.bus_addr); - cmd.data1 = MXGE_HIGHPART_TO_U32(dmabench_dma.bus_addr); + cmd.data0 = MXGE_LOWPART_TO_U32(sc->dmabench_dma.bus_addr); + cmd.data1 = MXGE_HIGHPART_TO_U32(sc->dmabench_dma.bus_addr); cmd.data2 = sc->tx.boundary * 0x1; status = mxge_send_cmd(sc, MXGEFW_DMA_TEST, &cmd); if (status != 0) @@ -1002,8 +999,8 @@ sc->write_dma = ((cmd.data0>>16) * sc->tx.boundary * 2) / (cmd.data0 & 0xffff); /* Read/Write DMA */ - cmd.data0 = MXGE_LOWPART_TO_U32(dmabench_dma.bus_addr); - cmd.data1 = MXGE_HIGHPART_TO_U32(dmabench_dma.bus_addr); + cmd.data0 = MXGE_LOWPART_TO_U32(sc->dmabench_dma.bus_addr); + cmd.data1 = MXGE_HIGHPART_TO_U32(sc->dmabench_dma.bus_addr); cmd.data2 = sc->tx.boundary * 0x10001; status = mxge_send_cmd(sc, MXGEFW_DMA_TEST, &cmd); if (status != 0) @@ -1013,9 +1010,6 @@ ((cmd.data0>>16) * sc->tx.boundary * 2 * 2) / (cmd.data0 & 0xffff); - mxge_dma_free(&dmabench_dma); - -dmabench_fail: /* reset mcp/driver shared state back to 0 */ bzero(sc->rx_done.entry, bytes); sc->rx_done.idx = 0; @@ -1028,6 +1022,8 @@ sc->rx_big.cnt = 0; sc->rx_small.cnt = 0; sc->rdma_tags_available = 15; + sc->fw_stats->valid = 0; + sc->fw_stats->send_done_count = 0; status = mxge_update_mac_address(sc); mxge_change_promisc(sc, 0); mxge_change_pause(sc, sc->pause); @@ -1054,11 +1050,11 @@ if (intr_coal_delay == 0 || intr_coal_delay > 1000*1000) return EINVAL; - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); *sc->intr_coal_delay_ptr = htobe32(intr_coal_delay); sc->intr_coal_delay = intr_coal_delay; - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); return err; } @@ -1078,9 +1074,9 @@ if (enabled == sc->pause) return 0; - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); err = mxge_change_pause(sc, enabled); - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); return err; } @@ -1698,9 +1694,9 @@ mxge_softc_t *sc = ifp->if_softc; - mtx_lock(&sc->tx_lock); + mtx_lock(&sc->tx_mtx); mxge_start_locked(sc); - mtx_unlock(&sc->tx_lock); + mtx_unlock(&sc->tx_mtx); } /* @@ -2032,11 +2028,11 @@ if (ifp->if_drv_flags & IFF_DRV_OACTIVE && tx->req - tx->done < (tx->mask + 1)/4) { - mtx_lock(&sc->tx_lock); + mtx_lock(&sc->tx_mtx); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; sc->tx.wake++; mxge_start_locked(sc); - mtx_unlock(&sc->tx_lock); + mtx_unlock(&sc->tx_mtx); } } @@ -2109,12 +2105,6 @@ } static void -mxge_watchdog(struct ifnet *ifp) -{ - printf("%s called\n", __FUNCTION__); -} - -static void mxge_init(void *arg) { } @@ -2145,6 +2135,7 @@ } for (i = 0; i <= sc->tx.mask; i++) { + sc->tx.info[i].flag = 0; if (sc->tx.info[i].m == NULL) continue; bus_dmamap_unload(sc->tx.dmat, @@ -2168,41 +2159,39 @@ if (sc->rx_big.shadow != NULL) free(sc->rx_big.shadow, M_DEVBUF); if (sc->tx.info != NULL) { - for (i = 0; i <= sc->tx.mask; i++) { - if (sc->tx.info[i].map != NULL) + if (sc->tx.dmat != NULL) { + for (i = 0; i <= sc->tx.mask; i++) { bus_dmamap_destroy(sc->tx.dmat, sc->tx.info[i].map); + } + bus_dma_tag_destroy(sc->tx.dmat); } free(sc->tx.info, M_DEVBUF); } if (sc->rx_small.info != NULL) { - for (i = 0; i <= sc->rx_small.mask; i++) { - if (sc->rx_small.info[i].map != NULL) + if (sc->rx_small.dmat != NULL) { + for (i = 0; i <= sc->rx_small.mask; i++) { bus_dmamap_destroy(sc->rx_small.dmat, sc->rx_small.info[i].map); + } + bus_dmamap_destroy(sc->rx_small.dmat, + sc->rx_small.extra_map); + bus_dma_tag_destroy(sc->rx_small.dmat); } free(sc->rx_small.info, M_DEVBUF); } if (sc->rx_big.info != NULL) { - for (i = 0; i <= sc->rx_big.mask; i++) { - if (sc->rx_big.info[i].map != NULL) + if (sc->rx_big.dmat != NULL) { + for (i = 0; i <= sc->rx_big.mask; i++) { bus_dmamap_destroy(sc->rx_big.dmat, sc->rx_big.info[i].map); + } + bus_dmamap_destroy(sc->rx_big.dmat, + sc->rx_big.extra_map); + bus_dma_tag_destroy(sc->rx_big.dmat); } free(sc->rx_big.info, M_DEVBUF); } - if (sc->rx_big.extra_map != NULL) - bus_dmamap_destroy(sc->rx_big.dmat, - sc->rx_big.extra_map); - if (sc->rx_small.extra_map != NULL) - bus_dmamap_destroy(sc->rx_small.dmat, - sc->rx_small.extra_map); - if (sc->tx.dmat != NULL) - bus_dma_tag_destroy(sc->tx.dmat); - if (sc->rx_small.dmat != NULL) - bus_dma_tag_destroy(sc->rx_small.dmat); - if (sc->rx_big.dmat != NULL) - bus_dma_tag_destroy(sc->rx_big.dmat); } static int @@ -2406,6 +2395,8 @@ device_printf(sc->dev, "failed to reset\n"); return EIO; } + bzero(sc->rx_done.entry, + mxge_max_intr_slots * sizeof(*sc->rx_done.entry)); if (MCLBYTES >= sc->ifp->if_mtu + ETHER_HDR_LEN + MXGEFW_PAD) @@ -2413,18 +2404,6 @@ else sc->big_bytes = MJUMPAGESIZE; - err = mxge_alloc_rings(sc); - if (err != 0) { - device_printf(sc->dev, "failed to allocate rings\n"); - return err; - } - - err = bus_setup_intr(sc->dev, sc->irq_res, - INTR_TYPE_NET | INTR_MPSAFE, - mxge_intr, sc, &sc->ih); - if (err != 0) { - goto abort_with_rings; - } /* get the lanai pointers to the send and receive rings */ @@ -2442,8 +2421,7 @@ if (err != 0) { device_printf(sc->dev, "failed to get ring sizes or locations\n"); - err = EIO; - goto abort_with_irq; + return EIO; } if (sc->wc) { @@ -2532,10 +2510,7 @@ abort: mxge_free_mbufs(sc); -abort_with_irq: - bus_teardown_intr(sc->dev, sc->irq_res, sc->ih); -abort_with_rings: - mxge_free_rings(sc); + return err; } @@ -2554,19 +2529,161 @@ } if (old_down_cnt == sc->down_cnt) { /* wait for down irq */ - (void)tsleep(&sc->down_cnt, PWAIT, "down mxge", hz); + DELAY(10 * sc->intr_coal_delay); } if (old_down_cnt == sc->down_cnt) { device_printf(sc->dev, "never got down irq\n"); } - if (sc->ih != NULL) - bus_teardown_intr(sc->dev, sc->irq_res, sc->ih); + mxge_free_mbufs(sc); - mxge_free_rings(sc); + return 0; } +static void +mxge_setup_cfg_space(mxge_softc_t *sc) +{ + device_t dev = sc->dev; + int reg; + uint16_t cmd, lnk, pectl; + + /* find the PCIe link width and set max read request to 4KB*/ + if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { + lnk = pci_read_config(dev, reg + 0x12, 2); + sc->link_width = (lnk >> 4) & 0x3f; + + pectl = pci_read_config(dev, reg + 0x8, 2); + pectl = (pectl & ~0x7000) | (5 << 12); + pci_write_config(dev, reg + 0x8, pectl, 2); + } + + /* Enable DMA and Memory space access */ + pci_enable_busmaster(dev); + cmd = pci_read_config(dev, PCIR_COMMAND, 2); + cmd |= PCIM_CMD_MEMEN; + pci_write_config(dev, PCIR_COMMAND, cmd, 2); +} + +static uint32_t +mxge_read_reboot(mxge_softc_t *sc) +{ + device_t dev = sc->dev; + uint32_t vs; + + /* find the vendor specific offset */ + if (pci_find_extcap(dev, PCIY_VENDOR, &vs) != 0) { + device_printf(sc->dev, + "could not find vendor specific offset\n"); + return (uint32_t)-1; + } + /* enable read32 mode */ + pci_write_config(dev, vs + 0x10, 0x3, 1); + /* tell NIC which register to read */ + pci_write_config(dev, vs + 0x18, 0xfffffff0, 4); + return (pci_read_config(dev, vs + 0x14, 4)); +} + +static void +mxge_watchdog_reset(mxge_softc_t *sc) +{ + int err; + uint32_t reboot; + uint16_t cmd; + + err = ENXIO; + + device_printf(sc->dev, "Watchdog reset!\n"); + /* + * check to see if the NIC rebooted. If it did, then all of + * PCI config space has been reset, and things like the + * busmaster bit will be zero. If this is the case, then we + * must restore PCI config space before the NIC can be used + * again + */ + cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2); + if (cmd == 0xffff) { + /* + * maybe the watchdog caught the NIC rebooting; wait + * up to 100ms for it to finish. If it does not come + * back, then give up + */ + DELAY(1000*100); + cmd = pci_read_config(sc->dev, PCIR_COMMAND, 2); + if (cmd == 0xffff) { + device_printf(sc->dev, "NIC disappeared!\n"); + goto abort; + } + } + if ((cmd & PCIM_CMD_BUSMASTEREN) == 0) { + /* print the reboot status */ + reboot = mxge_read_reboot(sc); + device_printf(sc->dev, "NIC rebooted, status = 0x%x\n", + reboot); + /* restore PCI configuration space */ + + /* XXXX waiting for pci_cfg_restore() to be exported */ + goto abort; /* just abort for now */ + + /* and redo any changes we made to our config space */ + mxge_setup_cfg_space(sc); + } else { + device_printf(sc->dev, "NIC did not reboot, ring state:\n"); + device_printf(sc->dev, "tx.req=%d tx.done=%d\n", + sc->tx.req, sc->tx.done); + device_printf(sc->dev, "pkt_done=%d fw=%d\n", + sc->tx.pkt_done, + be32toh(sc->fw_stats->send_done_count)); + } + + if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) { + mxge_close(sc); + err = mxge_open(sc); + } + +abort: + /* + * stop the watchdog if the nic is dead, to avoid spamming the + * console + */ + if (err != 0) { + callout_stop(&sc->co_hdl); + } +} + +static void +mxge_watchdog(mxge_softc_t *sc) +{ + mxge_tx_buf_t *tx = &sc->tx; + + /* see if we have outstanding transmits, which + have been pending for more than mxge_ticks */ + if (tx->req != tx->done && + tx->watchdog_req != tx->watchdog_done && + tx->done == tx->watchdog_done) + mxge_watchdog_reset(sc); + + tx->watchdog_req = tx->req; + tx->watchdog_done = tx->done; +} + +static void +mxge_tick(void *arg) +{ + mxge_softc_t *sc = arg; + + + /* Synchronize with possible callout reset/stop. */ + if (callout_pending(&sc->co_hdl) || + !callout_active(&sc->co_hdl)) { + mtx_unlock(&sc->driver_mtx); + return; + } + + callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc); + mxge_watchdog(sc); +} + static int mxge_media_change(struct ifnet *ifp) { @@ -2585,10 +2702,11 @@ if ((real_mtu > MXGE_MAX_ETHER_MTU) || real_mtu < 60) return EINVAL; - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); old_mtu = ifp->if_mtu; ifp->if_mtu = mtu; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + callout_stop(&sc->co_hdl); mxge_close(sc); err = mxge_open(sc); if (err != 0) { @@ -2596,8 +2714,9 @@ mxge_close(sc); (void) mxge_open(sc); } + callout_reset(&sc->co_hdl, mxge_ticks, mxge_tick, sc); } - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); return err; } @@ -2634,11 +2753,13 @@ break; case SIOCSIFFLAGS: - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); if (ifp->if_flags & IFF_UP) { - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { err = mxge_open(sc); - else { + callout_reset(&sc->co_hdl, mxge_ticks, + mxge_tick, sc); + } else { /* take care of promis can allmulti flag chages */ mxge_change_promisc(sc, @@ -2646,21 +2767,23 @@ mxge_set_multicast_list(sc); } } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { mxge_close(sc); + callout_stop(&sc->co_hdl); + } } - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); break; case SIOCADDMULTI: case SIOCDELMULTI: - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); mxge_set_multicast_list(sc); - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); break; case SIOCSIFCAP: - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); mask = ifr->ifr_reqcap ^ ifp->if_capenable; if (mask & IFCAP_TXCSUM) { if (IFCAP_TXCSUM & ifp->if_capenable) { @@ -2693,7 +2816,7 @@ err = EINVAL; } } - sx_xunlock(&sc->driver_lock); + mtx_unlock(&sc->driver_mtx); break; case SIOCGIFMEDIA: @@ -2723,11 +2846,14 @@ &mxge_deassert_wait); TUNABLE_INT_FETCH("hw.mxge.verbose", &mxge_verbose); + TUNABLE_INT_FETCH("hw.mxge.ticks", &mxge_ticks); if (bootverbose) mxge_verbose = 1; if (mxge_intr_coal_delay < 0 || mxge_intr_coal_delay > 10*1000) mxge_intr_coal_delay = 30; + if (mxge_ticks == 0) + mxge_ticks = hz; sc->pause = mxge_flow_control; } @@ -2737,8 +2863,7 @@ mxge_softc_t *sc = device_get_softc(dev); struct ifnet *ifp; size_t bytes; - int count, rid, err, reg; - uint16_t cmd, pectl, lnk; + int count, rid, err; sc->dev = dev; mxge_fetch_tunables(sc); @@ -2768,28 +2893,21 @@ err = ENOSPC; goto abort_with_parent_dmat; } - mtx_init(&sc->cmd_lock, NULL, - MTX_NETWORK_LOCK, MTX_DEF); - mtx_init(&sc->tx_lock, device_get_nameunit(dev), + snprintf(sc->cmd_mtx_name, sizeof(sc->cmd_mtx_name), "%s:cmd", + device_get_nameunit(dev)); + mtx_init(&sc->cmd_mtx, sc->cmd_mtx_name, NULL, MTX_DEF); + snprintf(sc->tx_mtx_name, sizeof(sc->tx_mtx_name), "%s:tx", + device_get_nameunit(dev)); + mtx_init(&sc->tx_mtx, sc->tx_mtx_name, NULL, MTX_DEF); + snprintf(sc->driver_mtx_name, sizeof(sc->driver_mtx_name), + "%s:drv", device_get_nameunit(dev)); + mtx_init(&sc->driver_mtx, sc->driver_mtx_name, MTX_NETWORK_LOCK, MTX_DEF); - sx_init(&sc->driver_lock, device_get_nameunit(dev)); - /* find the PCIe link width and set max read request to 4KB*/ - if (pci_find_extcap(dev, PCIY_EXPRESS, ®) == 0) { - lnk = pci_read_config(dev, reg + 0x12, 2); - sc->link_width = (lnk >> 4) & 0x3f; - - pectl = pci_read_config(dev, reg + 0x8, 2); - pectl = (pectl & ~0x7000) | (5 << 12); - pci_write_config(dev, reg + 0x8, pectl, 2); - } + callout_init_mtx(&sc->co_hdl, &sc->driver_mtx, 0); - /* Enable DMA and Memory space access */ - pci_enable_busmaster(dev); - cmd = pci_read_config(dev, PCIR_COMMAND, 2); - cmd |= PCIM_CMD_MEMEN; - pci_write_config(dev, PCIR_COMMAND, cmd, 2); - + mxge_setup_cfg_space(sc); + /* Map the board into the kernel */ rid = PCIR_BARS; sc->mem_res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, @@ -2839,12 +2957,15 @@ goto abort_with_zeropad_dma; sc->fw_stats = (mcp_irq_data_t *)sc->fw_stats_dma.addr; + err = mxge_dma_alloc(sc, &sc->dmabench_dma, 4096, 4096); + if (err != 0) + goto abort_with_fw_stats; /* allocate interrupt queues */ bytes = mxge_max_intr_slots * sizeof (*sc->rx_done.entry); err = mxge_dma_alloc(sc, &sc->rx_done.dma, bytes, 4096); if (err != 0) - goto abort_with_fw_stats; + goto abort_with_dmabench; sc->rx_done.entry = sc->rx_done.dma.addr; bzero(sc->rx_done.entry, bytes); @@ -2877,6 +2998,18 @@ if (err != 0) goto abort_with_irq_res; + err = mxge_alloc_rings(sc); + if (err != 0) { + device_printf(sc->dev, "failed to allocate rings\n"); + goto abort_with_irq_res; + } + + err = bus_setup_intr(sc->dev, sc->irq_res, + INTR_TYPE_NET | INTR_MPSAFE, + mxge_intr, sc, &sc->ih); + if (err != 0) { + goto abort_with_rings; + } /* hook into the network stack */ if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_baudrate = 100000000; @@ -2890,7 +3023,6 @@ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = mxge_ioctl; ifp->if_start = mxge_start; - ifp->if_watchdog = mxge_watchdog; ether_ifattach(ifp, sc->mac_addr); /* ether_ifattach sets mtu to 1500 */ ifp->if_mtu = MXGE_MAX_ETHER_MTU - ETHER_HDR_LEN; @@ -2902,6 +3034,8 @@ mxge_add_sysctls(sc); return 0; +abort_with_rings: + mxge_free_rings(sc); abort_with_irq_res: bus_release_resource(dev, SYS_RES_IRQ, sc->msi_enabled ? 1 : 0, sc->irq_res); @@ -2910,6 +3044,8 @@ abort_with_rx_done: sc->rx_done.entry = NULL; mxge_dma_free(&sc->rx_done.dma); +abort_with_dmabench: + mxge_dma_free(&sc->dmabench_dma); abort_with_fw_stats: mxge_dma_free(&sc->fw_stats_dma); abort_with_zeropad_dma: @@ -2920,9 +3056,9 @@ bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BARS, sc->mem_res); abort_with_lock: pci_disable_busmaster(dev); - mtx_destroy(&sc->cmd_lock); - mtx_destroy(&sc->tx_lock); - sx_destroy(&sc->driver_lock); + mtx_destroy(&sc->cmd_mtx); + mtx_destroy(&sc->tx_mtx); + mtx_destroy(&sc->driver_mtx); if_free(ifp); abort_with_parent_dmat: bus_dma_tag_destroy(sc->parent_dmat); @@ -2936,12 +3072,16 @@ { mxge_softc_t *sc = device_get_softc(dev); - sx_xlock(&sc->driver_lock); + mtx_lock(&sc->driver_mtx); if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) mxge_close(sc); - sx_xunlock(&sc->driver_lock); + callout_stop(&sc->co_hdl); + mtx_unlock(&sc->driver_mtx); ether_ifdetach(sc->ifp); + ifmedia_removeall(&sc->media); mxge_dummy_rdma(sc, 0); + bus_teardown_intr(sc->dev, sc->irq_res, sc->ih); + mxge_free_rings(sc); bus_release_resource(dev, SYS_RES_IRQ, sc->msi_enabled ? 1 : 0, sc->irq_res); if (sc->msi_enabled) @@ -2950,13 +3090,14 @@ sc->rx_done.entry = NULL; mxge_dma_free(&sc->rx_done.dma); mxge_dma_free(&sc->fw_stats_dma); + mxge_dma_free(&sc->dmabench_dma); mxge_dma_free(&sc->zeropad_dma); mxge_dma_free(&sc->cmd_dma); bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BARS, sc->mem_res); pci_disable_busmaster(dev); - mtx_destroy(&sc->cmd_lock); - mtx_destroy(&sc->tx_lock); - sx_destroy(&sc->driver_lock); + mtx_destroy(&sc->cmd_mtx); + mtx_destroy(&sc->tx_mtx); + mtx_destroy(&sc->driver_mtx); if_free(sc->ifp); bus_dma_tag_destroy(sc->parent_dmat); return 0; ==== //depot/projects/linuxolator/src/sys/dev/mxge/if_mxge_var.h#5 (text+ko) ==== @@ -29,7 +29,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -$FreeBSD: src/sys/dev/mxge/if_mxge_var.h,v 1.7 2007/01/30 08:39:44 gallatin Exp $ +$FreeBSD: src/sys/dev/mxge/if_mxge_var.h,v 1.9 2007/01/31 19:53:36 gallatin Exp $ ***************************************************************************/ @@ -108,13 +108,14 @@ int boundary; /* boundary transmits cannot cross*/ int stall; /* #times hw queue exhausted */ int wake; /* #times irq re-enabled xmit */ - + int watchdog_req; /* cache of req */ + int watchdog_done; /* cache of done */ } mxge_tx_buf_t; typedef struct { struct ifnet* ifp; int big_bytes; - struct mtx tx_lock; + struct mtx tx_mtx; int csum_flag; /* rx_csums? */ uint8_t mac_addr[6]; /* eeprom mac address */ mxge_tx_buf_t tx; /* transmit ring */ @@ -138,8 +139,8 @@ int intr_coal_delay; volatile uint32_t *intr_coal_delay_ptr; int wc; - struct mtx cmd_lock; - struct sx driver_lock; + struct mtx cmd_mtx; + struct mtx driver_mtx; int wake_queue; int stop_queue; int down_cnt; @@ -159,10 +160,15 @@ int read_write_dma; int fw_multicast_support; int link_width; + mxge_dma_t dmabench_dma; + struct callout co_hdl; char *mac_addr_string; char product_code_string[64]; char serial_number_string[64]; char scratch[256]; + char tx_mtx_name[16]; + char cmd_mtx_name[16]; + char driver_mtx_name[16]; } mxge_softc_t; #define MXGE_PCI_VENDOR_MYRICOM 0x14c1 ==== //depot/projects/linuxolator/src/sys/dev/sound/driver.c#3 (text+ko) ==== @@ -18,12 +18,12 @@ * 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, WHETHERIN CONTRACT, STRICT + * 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 THEPOSSIBILITY OF + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sound/driver.c,v 1.20 2006/10/01 14:57:34 netchild Exp $ + * $FreeBSD: src/sys/dev/sound/driver.c,v 1.21 2007/01/31 08:53:45 joel Exp $ */ #include ==== //depot/projects/linuxolator/src/sys/dev/sound/pcm/dsp.h#3 (text+ko) ==== @@ -1,5 +1,3 @@ -#ifndef _PCMDSP_H_ -#define _PCMDSP_H_ /*- * Copyright (c) 1999 Cameron Grant * All rights reserved. @@ -25,9 +23,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/sound/pcm/dsp.h,v 1.10 2006/09/23 20:45:47 netchild Exp $ + * $FreeBSD: src/sys/dev/sound/pcm/dsp.h,v 1.11 2007/01/31 12:10:48 joel Exp $ */ +#ifndef _PCMDSP_H_ +#define _PCMDSP_H_ + extern struct cdevsw dsp_cdevsw; int dsp_oss_audioinfo(struct cdev *, oss_audioinfo *); ==== //depot/projects/linuxolator/src/sys/modules/msdosfs/Makefile#3 (text+ko) ==== @@ -1,11 +1,11 @@ -# $FreeBSD: src/sys/modules/msdosfs/Makefile,v 1.23 2007/01/30 10:17:36 ru Exp $ +# $FreeBSD: src/sys/modules/msdosfs/Makefile,v 1.24 2007/02/01 04:21:03 avatar Exp $ .PATH: ${.CURDIR}/../../fs/msdosfs KMOD= msdosfs SRCS= vnode_if.h \ - msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_lookup.c \ - msdosfs_vfsops.c msdosfs_vnops.c + msdosfs_conv.c msdosfs_denode.c msdosfs_fat.c msdosfs_fileno.c \ + msdosfs_lookup.c msdosfs_vfsops.c msdosfs_vnops.c EXPORT_SYMS= msdosfs_iconv .include ==== //depot/projects/linuxolator/src/sys/netinet/in.h#3 (text+ko) ==== @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * @(#)in.h 8.3 (Berkeley) 1/3/94 - * $FreeBSD: src/sys/netinet/in.h,v 1.97 2006/12/29 21:59:17 piso Exp $ + * $FreeBSD: src/sys/netinet/in.h,v 1.98 2007/01/31 14:34:47 bms Exp $ */ #ifndef _NETINET_IN_H_ @@ -351,6 +351,16 @@ #define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) #define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_LINKLOCAL(i) (((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000) + +#define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \ + (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \ + (((u_int32_t)(i) & 0xffff0000) == 0xc0a80000)) + +#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & 0xffffff00) == 0xe0000000) + +#define IN_ANY_LOCAL(i) (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i)) + #define INADDR_LOOPBACK (u_int32_t)0x7f000001 #ifndef _KERNEL #define INADDR_NONE 0xffffffff /* -1 return */ ==== //depot/projects/linuxolator/src/sys/nfsclient/nfs_vnops.c#7 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_vnops.c,v 1.272 2007/01/23 10:01:19 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/nfsclient/nfs_vnops.c,v 1.273 2007/01/31 23:10:27 mohans Exp $"); /* * vnode op calls for Sun NFS version 2 and 3 @@ -1434,6 +1434,8 @@ if (vap->va_atime.tv_sec == VNOVAL) vap->va_atime = vap->va_mtime; error = nfs_setattrrpc(newvp, vap, cnp->cn_cred, cnp->cn_thread); + if (error) + vput(newvp); } if (!error) { if (cnp->cn_flags & MAKEENTRY) ==== //depot/projects/linuxolator/src/sys/ufs/ufs/ufs_quota.c#6 (text+ko) ==== @@ -33,7 +33,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.87 2007/01/20 13:54:28 delphij Exp $"); +__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_quota.c,v 1.88 2007/02/01 01:01:56 mpp Exp $"); #include "opt_ffs.h" @@ -891,6 +891,11 @@ struct uio auio; int error; + /* XXX: Disallow negative id values to prevent the + * creation of 100GB+ quota data files. + */ + if ((int)id < 0) + return (EINVAL); dqvp = ump->um_quotas[type]; if (dqvp == NULLVP || (ump->um_qflags[type] & QTF_CLOSING)) { *dqp = NODQUOT; ==== //depot/projects/linuxolator/src/sys/ufs/ufs/ufs_vfsops.c#2 (text+ko) ==== @@ -35,7 +35,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_vfsops.c,v 1.47 2005/12/14 00:49:52 des Exp $"); +__FBSDID("$FreeBSD: src/sys/ufs/ufs/ufs_vfsops.c,v 1.48 2007/02/01 02:13:53 mpp Exp $"); #include "opt_quota.h" #include "opt_ufs.h" @@ -86,10 +86,10 @@ * Do operations associated with quotas */ int -ufs_quotactl(mp, cmds, uid, arg, td) +ufs_quotactl(mp, cmds, id, arg, td) struct mount *mp; int cmds; - uid_t uid; + uid_t id; void *arg; struct thread *td; { @@ -98,10 +98,23 @@ #else int cmd, type, error; - if (uid == -1) - uid = td->td_ucred->cr_ruid; cmd = cmds >> SUBCMDSHIFT; type = cmds & SUBCMDMASK; + if (id == -1) { + switch (type) { + + case USRQUOTA: + id = td->td_ucred->cr_ruid; + break; + + case GRPQUOTA: + id = td->td_ucred->cr_rgid; + break; + + default: + return (EINVAL); + } + } if ((u_int)type >= MAXQUOTAS) return (EINVAL); @@ -118,15 +131,15 @@ break; case Q_SETQUOTA: - error = setquota(td, mp, uid, type, arg); + error = setquota(td, mp, id, type, arg); break; case Q_SETUSE: - error = setuse(td, mp, uid, type, arg); + error = setuse(td, mp, id, type, arg); break; case Q_GETQUOTA: - error = getquota(td, mp, uid, type, arg); + error = getquota(td, mp, id, type, arg); break; case Q_SYNC: