Date: Tue, 7 Aug 2007 03:29:37 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 124798 for review Message-ID: <200708070329.l773TbB2097395@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=124798 Change 124798 by kmacy@kmacy_home:ethng on 2007/08/07 03:29:22 Pull in interface updates required for multi-queue support Affected files ... .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_offload.c#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#2 edit .. //depot/projects/ethng/src/sys/dev/cxgb/sys/mbufq.h#2 edit .. //depot/projects/ethng/src/sys/modules/cxgb/Makefile#2 edit Differences ... ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#2 (text+ko) ==== @@ -117,8 +117,9 @@ #else struct mtx lock; #endif - int port; + int port_id; uint8_t hw_addr[ETHER_ADDR_LEN]; + uint8_t tx_chan; uint8_t nqsets; uint8_t first_qset; struct taskqueue *tq; @@ -267,6 +268,8 @@ bus_dmamap_t desc_map; bus_dma_tag_t entry_tag; struct mbuf_head sendq; + struct mbuf_ring txq_mr; + uint32_t txq_drops; struct mtx lock; #define TXQ_NAME_LEN 32 char lockbuf[TXQ_NAME_LEN]; @@ -286,6 +289,10 @@ #define SGE_PSTAT_MAX (SGE_PSTATS_LRO_X_STREAMS+1) +#define QS_EXITING 0x1 +#define QS_RUNNING 0x2 +#define QS_BOUND 0x4 + struct sge_qset { struct sge_rspq rspq; struct sge_fl fl[SGE_RXQ_PER_SET]; @@ -295,6 +302,8 @@ uint64_t port_stats[SGE_PSTAT_MAX]; struct port_info *port; int idx; /* qset # */ + int qs_cpuid; + int qs_flags; }; struct sge { @@ -336,7 +345,8 @@ void *msix_intr_tag[SGE_QSETS]; uint8_t rxpkt_map[8]; /* maps RX_PKT interface values to port ids */ uint8_t rrss_map[SGE_QSETS]; /* revers RSS map table */ - + uint16_t rspq_map[RSS_TABLE_SIZE]; /* maps 7-bit cookie to qidx */ + struct filter_info *filters; /* Tasks */ @@ -466,7 +476,7 @@ uint8_t *macaddr = NULL; if (rm->idx == 0) - macaddr = rm->port->hw_addr; + macaddr = (uint8_t *)rm->port->hw_addr; rm->idx++; return (macaddr); @@ -507,11 +517,12 @@ void t3b_intr(void *data); void t3_intr_msi(void *data); void t3_intr_msix(void *data); -int t3_encap(struct port_info *, struct mbuf **); +int t3_encap(struct sge_qset *, struct mbuf **); int t3_sge_init_adapter(adapter_t *); int t3_sge_init_port(struct port_info *); void t3_sge_deinit_sw(adapter_t *); +int t3_free_tx_desc(struct sge_txq *q, int n, struct mbuf **m_vec); void t3_rx_eth_lro(adapter_t *adap, struct sge_rspq *rq, struct mbuf *m, int ethpad, uint32_t rss_hash, uint32_t rss_csum, int lro); ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_main.c#2 (text+ko) ==== @@ -557,7 +557,7 @@ sc->port[i].adapter = sc; sc->port[i].nqsets = port_qsets; sc->port[i].first_qset = i*port_qsets; - sc->port[i].port = i; + sc->port[i].port_id = i; sc->portdev[i] = child; device_set_softc(child, &sc->port[i]); } @@ -905,7 +905,7 @@ p = device_get_softc(dev); - snprintf(buf, sizeof(buf), "Port %d %s", p->port, p->port_type->desc); + snprintf(buf, sizeof(buf), "Port %d %s", p->port_id, p->port_type->desc); device_set_desc_copy(dev, buf); return (0); } @@ -950,7 +950,7 @@ p = device_get_softc(dev); snprintf(p->lockbuf, PORT_NAME_LEN, "cxgb port lock %d:%d", - device_get_unit(device_get_parent(dev)), p->port); + device_get_unit(device_get_parent(dev)), p->port_id); PORT_LOCK_INIT(p, p->lockbuf); /* Allocate an ifnet object and set it up */ @@ -1032,7 +1032,7 @@ } - snprintf(p->taskqbuf, TASKQ_NAME_LEN, "cxgb_port_taskq%d", p->port); + snprintf(p->taskqbuf, TASKQ_NAME_LEN, "cxgb_port_taskq%d", p->port_id); #ifdef TASKQUEUE_CURRENT /* Create a port for handling TX without starvation */ p->tq = taskqueue_create(p->taskqbuf, M_NOWAIT, @@ -1195,7 +1195,6 @@ } } - /* * Interrupt-context handler for external (PHY) interrupts. */ @@ -1704,7 +1703,7 @@ t3_intr_clear(sc); t3_sge_init_adapter(sc); } - setbit(&p->adapter->open_device_map, p->port); + setbit(&p->adapter->open_device_map, p->port_id); ADAPTER_UNLOCK(p->adapter); if (is_offload(sc) && !ofld_disable) { @@ -1714,10 +1713,10 @@ "Could not initialize offload capabilities\n"); } cxgb_link_start(p); - t3_link_changed(sc, p->port); + t3_link_changed(sc, p->port_id); ifp->if_baudrate = p->link_config.speed * 1000000; - t3_port_intr_enable(sc, p->port); + t3_port_intr_enable(sc, p->port_id); callout_reset(&sc->cxgb_tick_ch, sc->params.stats_update_period * hz, cxgb_tick, sc); @@ -1748,13 +1747,13 @@ ifp = p->ifp; - t3_port_intr_disable(p->adapter, p->port); + t3_port_intr_disable(p->adapter, p->port_id); ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); p->phy.ops->power_down(&p->phy, 1); t3_mac_disable(&p->mac, MAC_DIRECTION_TX | MAC_DIRECTION_RX); ADAPTER_LOCK(p->adapter); - clrbit(&p->adapter->open_device_map, p->port); + clrbit(&p->adapter->open_device_map, p->port_id); if (p->adapter->open_device_map == 0) { @@ -1936,10 +1935,10 @@ m = m0; m_collapse(m, TX_MAX_SEGS, &m0); } else - break; + break; } m = m0; - if ((err = t3_encap(p, &m)) != 0) + if ((err = t3_encap(qs, &m)) != 0) break; BPF_MTAP(ifp, m); } @@ -2119,7 +2118,7 @@ cxgb_set_rxmode(p); t3_link_start(&p->phy, mac, &p->link_config); t3_mac_enable(mac, MAC_DIRECTION_RX | MAC_DIRECTION_TX); - t3_port_intr_enable(adapter, p->port); + t3_port_intr_enable(adapter, p->port_id); p->mac.stats.num_resets++; } PORT_UNLOCK(p); @@ -2527,7 +2526,7 @@ } case CHELSIO_SET_QSET_NUM: { struct ch_reg *edata = (struct ch_reg *)data; - unsigned int port_idx = pi->port; + unsigned int port_idx = pi->port_id; if (sc->flags & FULL_INIT_DONE) return (EBUSY); ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_offload.c#2 (text+ko) ==== @@ -1250,7 +1250,7 @@ } /* Add new L2T entry */ - e = t3_l2t_get(tdev, new, ((struct port_info *)new->rt_ifp->if_softc)->port); + e = t3_l2t_get(tdev, new, ((struct port_info *)new->rt_ifp->if_softc)->port_id); if (!e) { log(LOG_ERR, "%s: couldn't allocate new l2t entry!\n", __FUNCTION__); ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_osdep.h#2 (text+ko) ==== @@ -52,6 +52,13 @@ typedef struct adapter adapter_t; struct sge_rspq; +struct mbuf_ring { + struct mbuf **mr_ring; + volatile uint32_t mr_cons; + volatile uint32_t mr_prod; + int mr_size; +}; + #define PANIC_IF(exp) do { \ if (exp) \ panic("BUG: %s", exp); \ @@ -99,19 +106,28 @@ #define TX_MAX_SIZE (1 << 16) /* 64KB */ #define TX_MAX_SEGS 36 /* maximum supported by card */ + #define TX_MAX_DESC 4 /* max descriptors per packet */ + #define TX_START_MIN_DESC (TX_MAX_DESC << 2) -#if 0 -#define TX_START_MAX_DESC (TX_ETH_Q_SIZE >> 2) /* maximum number of descriptors */ -#endif +#ifdef IFNET_MULTIQUEUE +#define TX_START_MAX_DESC (TX_MAX_DESC << 4) +#else #define TX_START_MAX_DESC (TX_MAX_DESC << 3) /* maximum number of descriptors * call to start used per */ +#endif #define TX_CLEAN_MAX_DESC (TX_MAX_DESC << 4) /* maximum tx descriptors * to clean per iteration */ +#define TX_WR_SIZE_MAX 11*1024 /* the maximum total size of packets aggregated into a single + * TX WR + */ +#define TX_WR_COUNT_MAX 7 /* the maximum total number of packets that can be + * aggregated into a single TX WR + */ #if defined(__i386__) || defined(__amd64__) @@ -174,8 +190,6 @@ #define net_device ifnet #define cpu_to_be32 htobe32 - - /* Standard PHY definitions */ #define BMCR_LOOPBACK BMCR_LOOP #define BMCR_ISOLATE BMCR_ISO ==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#2 (text+ko) ==== @@ -1160,14 +1160,14 @@ #define TCPPKTHDRSIZE (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + 20 + 20) int -t3_encap(struct port_info *p, struct mbuf **m) +t3_encap(struct sge_qset *qs, struct mbuf **m) { adapter_t *sc; struct mbuf *m0; - struct sge_qset *qs; struct sge_txq *txq; struct tx_sw_desc *stx; struct txq_state txqs; + struct port_info *p; unsigned int nsegs, ndesc, flits, cntrl, mlen; int err, tso_info = 0; @@ -1181,9 +1181,9 @@ struct cpl_tx_pkt *cpl; DPRINTF("t3_encap "); - m0 = *m; + m0 = *m; + p = qs->port; sc = p->adapter; - qs = &sc->sge.qs[p->first_qset]; txq = &qs->txq[TXQ_ETH]; stx = &txq->sdesc[txq->pidx]; txd = &txq->desc[txq->pidx]; @@ -1196,7 +1196,7 @@ * XXX handle checksum, TSO, and VLAN here * */ - cntrl = V_TXPKT_INTF(p->port); + cntrl = V_TXPKT_INTF(p->port_id); /* * XXX need to add VLAN support for 6.x ==== //depot/projects/ethng/src/sys/dev/cxgb/sys/mbufq.h#2 (text+ko) ==== @@ -36,6 +36,7 @@ struct mbuf *head; struct mbuf *tail; uint32_t qlen; + uint32_t qsize; struct mtx lock; }; @@ -57,13 +58,28 @@ return (l->qlen); } +static __inline int +mbufq_size(struct mbuf_head *l) +{ + return (l->qsize); +} +static __inline int +mbufq_head_size(struct mbuf_head *l) +{ + return (l->head ? l->head->m_pkthdr.len : 0); +} + static __inline void mbufq_tail(struct mbuf_head *l, struct mbuf *m) { l->qlen++; - l->tail->m_nextpkt = m; + if (l->head == NULL) + l->head = m; + else + l->tail->m_nextpkt = m; l->tail = m; + l->qsize += m->m_pkthdr.len; } static __inline struct mbuf * @@ -74,9 +90,12 @@ m = l->head; if (m) { if (m == l->tail) - l->tail = NULL; - l->head = m->m_nextpkt; + l->head = l->tail = NULL; + else + l->head = m->m_nextpkt; + m->m_nextpkt = NULL; l->qlen--; + l->qsize -= m->m_pkthdr.len; } return (m); ==== //depot/projects/ethng/src/sys/modules/cxgb/Makefile#2 (text+ko) ==== @@ -11,7 +11,11 @@ SRCS+= uipc_mvec.c CFLAGS+= -DCONFIG_CHELSIO_T3_CORE -g -DCONFIG_DEFINED -DDEFAULT_JUMBO -I${CXGB} -#CFLAGS+= -DINVARIANT_SUPPORT -DINVARIANTS +CFLAGS+= -DIFNET_MULTIQUEUE +CFLAGS+= -DINVARIANT_SUPPORT -DINVARIANTS +CFLAGS+= -DWITNESS +#CFLAGS+= -DDEBUG -DDEBUG_PRINT + .if ${MACHINE_ARCH} != "ia64" # ld is broken on ia64
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200708070329.l773TbB2097395>