Re: svn commit: r314369 - head/sys/dev/bnxt

2017-02-27 Thread Sepherosa Ziehau
On Tue, Feb 28, 2017 at 10:27 AM, Stephen Hurd  wrote:
> 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) {
> +   default:
> +   ri->iri_rsstype = M_HASHTYPE_OPAQUE;
> +   break;

Is it a hash value or just ring index?  If its a hash value, you
should set it to M_HASHTYPE_OPAQUE_HASH here.

Thanks,
sephe
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r314369 - head/sys/dev/bnxt

2017-02-27 Thread Stephen Hurd
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.hTue Feb 28 00:58:16 2017(r314368)
+++ head/sys/dev/bnxt/bnxt.hTue 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_IPV42
+#define BNXT_RSS_HASH_TYPE_TCPV6   3
+#define BNXT_RSS_HASH_TYPE_UDPV6   4
+#define BNXT_RSS_HASH_TYPE_IPV65
+#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;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"