From owner-svn-src-all@freebsd.org Tue Feb 28 02:27:52 2017 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 96559CEFEA6; Tue, 28 Feb 2017 02:27:52 +0000 (UTC) (envelope-from shurd@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 6E4BEF40; Tue, 28 Feb 2017 02:27:52 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1S2RpwO094907; Tue, 28 Feb 2017 02:27:51 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1S2RpsS094905; Tue, 28 Feb 2017 02:27:51 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201702280227.v1S2RpsS094905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 28 Feb 2017 02:27:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314369 - head/sys/dev/bnxt 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.23 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: Tue, 28 Feb 2017 02:27:52 -0000 Author: shurd (ports committer) Date: Tue Feb 28 02:27:51 2017 New Revision: 314369 URL: https://svnweb.freebsd.org/changeset/base/314369 Log: bnxt: propagate RSS hash type to the network stack. RSS hash type will be used to identify the CPU on to which, a receive packet will be queued. This patch extracts the "RSS hash type" from the receive completion and sends it to the stack. Submitted by: Venkatkumar Duvvuru Reviewed by: shurd Approved by: sbruno MFC after: 1 week Sponsored by: Broadcom Limited Differential Revision: https://reviews.freebsd.org/D9685 Modified: head/sys/dev/bnxt/bnxt.h head/sys/dev/bnxt/bnxt_txrx.c Modified: head/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Tue Feb 28 00:58:16 2017 (r314368) +++ head/sys/dev/bnxt/bnxt.h Tue Feb 28 02:27:51 2017 (r314369) @@ -92,6 +92,14 @@ __FBSDID("$FreeBSD$"); #define BNXT_MAX_MTU 9000 +#define BNXT_RSS_HASH_TYPE_TCPV4 0 +#define BNXT_RSS_HASH_TYPE_UDPV4 1 +#define BNXT_RSS_HASH_TYPE_IPV4 2 +#define BNXT_RSS_HASH_TYPE_TCPV6 3 +#define BNXT_RSS_HASH_TYPE_UDPV6 4 +#define BNXT_RSS_HASH_TYPE_IPV6 5 +#define BNXT_GET_RSS_PROFILE_ID(rss_hash_type) ((rss_hash_type >> 1) & 0x1F) + /* Completion related defines */ #define CMP_VALID(cmp, v_bit) \ ((!!(((struct cmpl_base *)(cmp))->info3_v & htole32(CMPL_BASE_V))) == !!(v_bit) ) Modified: head/sys/dev/bnxt/bnxt_txrx.c ============================================================================== --- head/sys/dev/bnxt/bnxt_txrx.c Tue Feb 28 00:58:16 2017 (r314368) +++ head/sys/dev/bnxt/bnxt_txrx.c Tue Feb 28 02:27:51 2017 (r314369) @@ -412,6 +412,37 @@ cmpl_invalid: return avail; } +static void +bnxt_set_rsstype(if_rxd_info_t ri, uint8_t rss_hash_type) +{ + uint8_t rss_profile_id; + + rss_profile_id = BNXT_GET_RSS_PROFILE_ID(rss_hash_type); + switch (rss_profile_id) { + case BNXT_RSS_HASH_TYPE_TCPV4: + ri->iri_rsstype = M_HASHTYPE_RSS_TCP_IPV4; + break; + case BNXT_RSS_HASH_TYPE_UDPV4: + ri->iri_rsstype = M_HASHTYPE_RSS_UDP_IPV4; + break; + case BNXT_RSS_HASH_TYPE_IPV4: + ri->iri_rsstype = M_HASHTYPE_RSS_IPV4; + break; + case BNXT_RSS_HASH_TYPE_TCPV6: + ri->iri_rsstype = M_HASHTYPE_RSS_TCP_IPV6; + break; + case BNXT_RSS_HASH_TYPE_UDPV6: + ri->iri_rsstype = M_HASHTYPE_RSS_UDP_IPV6; + break; + case BNXT_RSS_HASH_TYPE_IPV6: + ri->iri_rsstype = M_HASHTYPE_RSS_IPV6; + break; + default: + ri->iri_rsstype = M_HASHTYPE_OPAQUE; + break; + } +} + static int bnxt_pkt_get_l2(struct bnxt_softc *softc, if_rxd_info_t ri, struct bnxt_cp_ring *cpr, uint16_t flags_type) @@ -429,13 +460,7 @@ bnxt_pkt_get_l2(struct bnxt_softc *softc /* Extract from the first 16-byte BD */ if (flags_type & RX_PKT_CMPL_FLAGS_RSS_VALID) { ri->iri_flowid = le32toh(rcp->rss_hash); - /* - * TODO: Extract something useful from rcp->rss_hash_type - * (undocumented) - * May be documented in the "LSI ES" - * also check the firmware code. - */ - ri->iri_rsstype = M_HASHTYPE_OPAQUE; + bnxt_set_rsstype(ri, rcp->rss_hash_type); } else { ri->iri_rsstype = M_HASHTYPE_NONE; @@ -515,13 +540,7 @@ bnxt_pkt_get_tpa(struct bnxt_softc *soft /* Extract from the first 16-byte BD */ if (le16toh(tpas->low.flags_type) & RX_TPA_START_CMPL_FLAGS_RSS_VALID) { ri->iri_flowid = le32toh(tpas->low.rss_hash); - /* - * TODO: Extract something useful from tpas->low.rss_hash_type - * (undocumented) - * May be documented in the "LSI ES" - * also check the firmware code. - */ - ri->iri_rsstype = M_HASHTYPE_OPAQUE; + bnxt_set_rsstype(ri, tpas->low.rss_hash_type); } else { ri->iri_rsstype = M_HASHTYPE_NONE;