Date: Tue, 28 Feb 2017 02:27:51 +0000 (UTC) From: Stephen Hurd <shurd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r314369 - head/sys/dev/bnxt Message-ID: <201702280227.v1S2RpsS094905@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <venkatkumar.duvvuru@broadcom.com> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702280227.v1S2RpsS094905>