From owner-svn-src-all@FreeBSD.ORG Mon May 30 23:27:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 260781065672; Mon, 30 May 2011 23:27:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 14D9F8FC15; Mon, 30 May 2011 23:27:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4UNRgt6097629; Mon, 30 May 2011 23:27:42 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4UNRgBf097626; Mon, 30 May 2011 23:27:42 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201105302327.p4UNRgBf097626@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 30 May 2011 23:27:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222514 - stable/8/sys/dev/cxgbe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2011 23:27:43 -0000 Author: np Date: Mon May 30 23:27:42 2011 New Revision: 222514 URL: http://svn.freebsd.org/changeset/base/222514 Log: MFC r222003, r222085, r222102 r222003: Add missing header. The test for VLAN_CAPABILITIES later in the file doesn't make sense without it. r222085: - Enable per-channel congestion notification. - Enable PCIe relaxed ordering for all egress queues and rx data buffers. r222102: Simplify t4_os_find_pci_capability. Modified: stable/8/sys/dev/cxgbe/t4_main.c stable/8/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_main.c Mon May 30 21:56:37 2011 (r222513) +++ stable/8/sys/dev/cxgbe/t4_main.c Mon May 30 23:27:42 2011 (r222514) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "common/t4_hw.h" #include "common/common.h" @@ -365,7 +366,13 @@ t4_attach(device_t dev) sc->mbox = sc->pf; pci_enable_busmaster(dev); - pci_set_max_read_req(dev, 4096); + if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) { + pci_set_max_read_req(dev, 4096); + v = pci_read_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, 2); + v |= PCIM_EXP_CTL_RELAXED_ORD_ENABLE; + pci_write_config(dev, i + PCIR_EXPRESS_DEVICE_CTL, v, 2); + } + snprintf(sc->lockname, sizeof(sc->lockname), "%s", device_get_nameunit(dev)); mtx_init(&sc->sc_lock, sc->lockname, 0, MTX_DEF); @@ -3208,41 +3215,9 @@ filter_rpl(struct adapter *sc, const str int t4_os_find_pci_capability(struct adapter *sc, int cap) { - device_t dev; - struct pci_devinfo *dinfo; - pcicfgregs *cfg; - uint32_t status; - uint8_t ptr; - - dev = sc->dev; - dinfo = device_get_ivars(dev); - cfg = &dinfo->cfg; - - status = pci_read_config(dev, PCIR_STATUS, 2); - if (!(status & PCIM_STATUS_CAPPRESENT)) - return (0); - - switch (cfg->hdrtype & PCIM_HDRTYPE) { - case 0: - case 1: - ptr = PCIR_CAP_PTR; - break; - case 2: - ptr = PCIR_CAP_PTR_2; - break; - default: - return (0); - break; - } - ptr = pci_read_config(dev, ptr, 1); - - while (ptr != 0) { - if (pci_read_config(dev, ptr + PCICAP_ID, 1) == cap) - return (ptr); - ptr = pci_read_config(dev, ptr + PCICAP_NEXTPTR, 1); - } + int i; - return (0); + return (pci_find_cap(sc->dev, cap, &i) == 0 ? i : 0); } int Modified: stable/8/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/8/sys/dev/cxgbe/t4_sge.c Mon May 30 21:56:37 2011 (r222513) +++ stable/8/sys/dev/cxgbe/t4_sge.c Mon May 30 23:27:42 2011 (r222514) @@ -100,7 +100,7 @@ static int alloc_ring(struct adapter *, static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, void *); static int alloc_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *, - int); + int, int); static int free_iq_fl(struct port_info *, struct sge_iq *, struct sge_fl *); static int alloc_iq(struct sge_iq *, int); static int free_iq(struct sge_iq *); @@ -1103,7 +1103,7 @@ free_ring(struct adapter *sc, bus_dma_ta */ static int alloc_iq_fl(struct port_info *pi, struct sge_iq *iq, struct sge_fl *fl, - int intr_idx) + int intr_idx, int cong) { int rc, i, cntxt_id; size_t len; @@ -1154,6 +1154,8 @@ alloc_iq_fl(struct port_info *pi, struct V_FW_IQ_CMD_IQESIZE(ilog2(iq->esize) - 4)); c.iqsize = htobe16(iq->qsize); c.iqaddr = htobe64(iq->ba); + if (cong >= 0) + c.iqns_to_fl0congen = htobe32(F_FW_IQ_CMD_IQFLINTCONGEN); if (fl) { mtx_init(&fl->fl_lock, fl->lockname, NULL, MTX_DEF); @@ -1197,7 +1199,15 @@ alloc_iq_fl(struct port_info *pi, struct fl->needed = fl->cap; c.iqns_to_fl0congen = - htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE)); + htobe32(V_FW_IQ_CMD_FL0HOSTFCMODE(X_HOSTFCMODE_NONE) | + F_FW_IQ_CMD_FL0FETCHRO | F_FW_IQ_CMD_FL0DATARO | + F_FW_IQ_CMD_FL0PADEN); + if (cong >= 0) { + c.iqns_to_fl0congen |= + htobe32(V_FW_IQ_CMD_FL0CNGCHMAP(cong) | + F_FW_IQ_CMD_FL0CONGCIF | + F_FW_IQ_CMD_FL0CONGEN); + } c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(X_FETCHBURSTMIN_64B) | V_FW_IQ_CMD_FL0FBMAX(X_FETCHBURSTMAX_512B)); @@ -1324,7 +1334,7 @@ free_iq_fl(struct port_info *pi, struct static int alloc_iq(struct sge_iq *iq, int intr_idx) { - return alloc_iq_fl(NULL, iq, NULL, intr_idx); + return alloc_iq_fl(NULL, iq, NULL, intr_idx, -1); } static int @@ -1341,7 +1351,7 @@ alloc_rxq(struct port_info *pi, struct s struct sysctl_oid_list *children; char name[16]; - rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx); + rc = alloc_iq_fl(pi, &rxq->iq, &rxq->fl, intr_idx, 1 << pi->tx_chan); if (rc != 0) return (rc); @@ -1432,7 +1442,7 @@ alloc_ctrlq(struct adapter *sc, struct s c.physeqid_pkd = htobe32(0); c.fetchszm_to_iqid = htobe32(V_FW_EQ_CTRL_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | - V_FW_EQ_CTRL_CMD_PCIECHN(idx) | + V_FW_EQ_CTRL_CMD_PCIECHN(idx) | F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | @@ -1557,7 +1567,7 @@ alloc_txq(struct port_info *pi, struct s c.viid_pkd = htobe32(V_FW_EQ_ETH_CMD_VIID(pi->viid)); c.fetchszm_to_iqid = htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_STATUS_PAGE) | - V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | + V_FW_EQ_ETH_CMD_PCIECHN(pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) |