From owner-svn-src-all@freebsd.org Mon Jun 6 09:08:17 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7CF0B6DF96; Mon, 6 Jun 2016 09:08:17 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B586E1746; Mon, 6 Jun 2016 09:08:17 +0000 (UTC) (envelope-from arybchik@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u5698GVv047013; Mon, 6 Jun 2016 09:08:16 GMT (envelope-from arybchik@FreeBSD.org) Received: (from arybchik@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u5698GMe047012; Mon, 6 Jun 2016 09:08:16 GMT (envelope-from arybchik@FreeBSD.org) Message-Id: <201606060908.u5698GMe047012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arybchik set sender to arybchik@FreeBSD.org using -f From: Andrew Rybchenko Date: Mon, 6 Jun 2016 09:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301494 - head/sys/dev/sfxge X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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, 06 Jun 2016 09:08:18 -0000 Author: arybchik Date: Mon Jun 6 09:08:16 2016 New Revision: 301494 URL: https://svnweb.freebsd.org/changeset/base/301494 Log: sfxge(4): pick an RSS bucket for the packet enqueued and select TXQ accordingly Submitted by: Ivan Malov Reviewed by: gnn Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D6723 Modified: head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/sfxge_tx.c ============================================================================== --- head/sys/dev/sfxge/sfxge_tx.c Mon Jun 6 09:07:26 2016 (r301493) +++ head/sys/dev/sfxge/sfxge_tx.c Mon Jun 6 09:08:16 2016 (r301494) @@ -49,6 +49,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_rss.h" + #include #include #include @@ -68,6 +70,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef RSS +#include +#endif + #include "common/efx.h" #include "sfxge.h" @@ -818,12 +824,24 @@ sfxge_if_transmit(struct ifnet *ifp, str (CSUM_DELAY_DATA | CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_TSO)) { int index = 0; +#ifdef RSS + uint32_t bucket_id; + + /* + * Select a TX queue which matches the corresponding + * RX queue for the hash in order to assign both + * TX and RX parts of the flow to the same CPU + */ + if (rss_m2bucket(m, &bucket_id) == 0) + index = bucket_id % (sc->txq_count - (SFXGE_TXQ_NTYPES - 1)); +#else /* check if flowid is set */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { uint32_t hash = m->m_pkthdr.flowid; index = sc->rx_indir_table[hash % SFXGE_RX_SCALE_MAX]; } +#endif #if SFXGE_TX_PARSE_EARLY if (m->m_pkthdr.csum_flags & CSUM_TSO) sfxge_parse_tx_packet(m);