From owner-freebsd-net@FreeBSD.ORG Sat Apr 12 10:17:27 2014 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EADD52AC for ; Sat, 12 Apr 2014 10:17:26 +0000 (UTC) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [188.134.15.200]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70DDE15DC for ; Sat, 12 Apr 2014 10:17:26 +0000 (UTC) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 8337B7F4CE; Sat, 12 Apr 2014 14:17:23 +0400 (MSK) X-DKIM: Sendmail DKIM Filter v2.8.2 shelob.oktetlabs.ru 8337B7F4CE DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1397297843; bh=Rr6BZuiS34ocgxKhDFexEP8HOar2XjzvwJWUW/ZL0xY=; l=3662; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:Content-Type; b=rk9xAtOcRInLiwwhXj9OmE0eQjyIHmAjl6sMsfkAStNwE3w6IQscgQ7B0FjXLNEyL szgO/bZf+eCafyt1a0OEx1x0tErMMlyk1eke4JaCtw0nA3j2rdKQigZok7vsnET+Wh raC9x7yXZHs9uCzPkhOtj1XUGIJeACYmVGtAVZp4= Message-ID: <534912B4.106@oktetlabs.ru> Date: Sat, 12 Apr 2014 14:17:24 +0400 From: Andrew Rybchenko Organization: OKTET Labs User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: net@FreeBSD.org Subject: [PATCH 3/3] sfxge: use TXQ type as label to support more than 32 TXQs Content-Type: multipart/mixed; boundary="------------090407050909080702060908" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Apr 2014 10:17:27 -0000 This is a multi-part message in MIME format. --------------090407050909080702060908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload) in all other event queues. --------------090407050909080702060908 Content-Type: text/x-patch; name="3-sfxge-txq_type_as_label.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="3-sfxge-txq_type_as_label.patch" sfxge: use TXQ type as label to support more than 32 TXQs There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload) in all other event queues. Submitted by: Andrew Rybchenko Sponsored by: Solarflare Communications, Inc. diff -r 42f27b037ebb -r ab60166f0df9 sys/dev/sfxge/sfxge_ev.c --- a/sys/dev/sfxge/sfxge_ev.c Thu Apr 10 14:23:36 2014 +0400 +++ b/sys/dev/sfxge/sfxge_ev.c Fri Apr 11 15:40:47 2014 +0400 @@ -218,18 +218,27 @@ return (B_FALSE); } +static struct sfxge_txq * +sfxge_get_txq_by_label(struct sfxge_evq *evq, enum sfxge_txq_type label) +{ + unsigned int index; + + KASSERT((evq->index == 0 && label < SFXGE_TXQ_NTYPES) || + (label == SFXGE_TXQ_IP_TCP_UDP_CKSUM), ("unexpected txq label")); + index = (evq->index == 0) ? label : (evq->index - 1 + SFXGE_TXQ_NTYPES); + return evq->sc->txq[index]; +} + static boolean_t sfxge_ev_tx(void *arg, uint32_t label, uint32_t id) { struct sfxge_evq *evq; - struct sfxge_softc *sc; struct sfxge_txq *txq; unsigned int stop; unsigned int delta; evq = (struct sfxge_evq *)arg; - sc = evq->sc; - txq = sc->txq[label]; + txq = sfxge_get_txq_by_label(evq, label); KASSERT(txq != NULL, ("txq == NULL")); KASSERT(evq->index == txq->evq_index, @@ -279,7 +288,7 @@ /* Resend a software event on the correct queue */ evq = sc->evq[txq->evq_index]; - label = txq_index; + label = txq->type; KASSERT((label & SFXGE_MAGIC_DMAQ_LABEL_MASK) == label, ("(label & SFXGE_MAGIC_DMAQ_LABEL_MASK) != label")); magic = SFXGE_MAGIC_TX_QFLUSH_DONE | label; @@ -336,7 +345,7 @@ break; } case SFXGE_MAGIC_TX_QFLUSH_DONE: { - struct sfxge_txq *txq = sc->txq[label]; + struct sfxge_txq *txq = sfxge_get_txq_by_label(evq, label); KASSERT(txq != NULL, ("txq == NULL")); KASSERT(evq->index == txq->evq_index, diff -r 42f27b037ebb -r ab60166f0df9 sys/dev/sfxge/sfxge_tx.c --- a/sys/dev/sfxge/sfxge_tx.c Thu Apr 10 14:23:36 2014 +0400 +++ b/sys/dev/sfxge/sfxge_tx.c Fri Apr 11 15:40:47 2014 +0400 @@ -27,6 +27,21 @@ * SUCH DAMAGE. */ +/* Theory of operation: + * + * Tx queues allocation and mapping + * + * One Tx queue with enabled checksum offload is allocated per Rx channel + * (event queue). Also 2 Tx queues (one without checksum offload and one + * with IP checksum offload only) are allocated and bound to event queue 0. + * sfxge_txq_type is used as Tx queue label. + * + * So, event queue plus label mapping to Tx queue index is: + * if event queue index is 0, TxQ-index = TxQ-label * [0..SFXGE_TXQ_NTYPES) + * else TxQ-index = SFXGE_TXQ_NTYPES + EvQ-index - 1 + * See sfxge_get_txq_by_label() sfxge_ev.c + */ + #include __FBSDID("$FreeBSD$"); @@ -1179,7 +1194,7 @@ } /* Create the common code transmit queue. */ - if ((rc = efx_tx_qcreate(sc->enp, index, index, esmp, + if ((rc = efx_tx_qcreate(sc->enp, index, txq->type, esmp, SFXGE_NDESCS, txq->buf_base_id, flags, evq->common, &txq->common)) != 0) goto fail; --------------090407050909080702060908--