Author: np
Date: Wed Oct 17 00:45:01 2018
New Revision: 339396
URL: https://svnweb.freebsd.org/changeset/base/339396

Log:
  MFC r325840, r327811, and r329701.
  
  r325840:
  CXGBE: fix big-endian behaviour
  
  The setbit/clearbit pair casts the bitfield pointer
  to uint8_t* which effectively treats its contents as
  little-endian variable. The ffs() function accepts int as
  the parameter, which is big-endian. Use uint8_t here to
  avoid mismatch, as we have only 4 doorbells.
  
  Submitted by:          Wojciech Macek <w...@freebsd.org>
  Reviewed by:           np
  Obtained from:         Semihalf
  Sponsored by:          QCM Technologies
  Differential revision: https://reviews.freebsd.org/D13084
  
  r327811:
  CXGBE: fix get_filt to be endianness-aware
  
  Unconditional 32-bit shift is not endianness-safe.
  Modify the logic to work both on LE and BE.
  
  Submitted by:          Wojciech Macek <w...@freebsd.org>
  Reviewed by:           np
  Obtained from:         Semihalf
  Sponsored by:          IBM, QCM Technologies
  Differential revision: https://reviews.freebsd.org/D13102
  
  r329701:
  CXGBE: implement prefetch on non-Intel architectures
  
  Submitted by:          Michal Stanek <m...@semihalf.com>
  Obtained from:         Semihalf
  Reviewed by:           np, p...@semihalf.com
  Sponsored by:          IBM, QCM Technologies
  Differential revision: https://reviews.freebsd.org/D14452

Modified:
  stable/11/sys/dev/cxgbe/adapter.h
  stable/11/sys/dev/cxgbe/t4_sge.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/cxgbe/adapter.h
==============================================================================
--- stable/11/sys/dev/cxgbe/adapter.h   Wed Oct 17 00:27:21 2018        
(r339395)
+++ stable/11/sys/dev/cxgbe/adapter.h   Wed Oct 17 00:45:01 2018        
(r339396)
@@ -70,7 +70,7 @@ prefetch(void *x)
        __asm volatile("prefetcht0 %0" :: "m" (*(unsigned long *)x));
 }
 #else
-#define prefetch(x)
+#define prefetch(x) __builtin_prefetch(x)
 #endif
 
 #ifndef SYSCTL_ADD_UQUAD
@@ -422,7 +422,7 @@ struct sge_eq {
        struct mtx eq_lock;
 
        struct tx_desc *desc;   /* KVA of descriptor ring */
-       uint16_t doorbells;
+       uint8_t doorbells;
        volatile uint32_t *udb; /* KVA of doorbell (lies within BAR2) */
        u_int udb_qid;          /* relative qid within the doorbell page */
        uint16_t sidx;          /* index of the entry with the status page */
@@ -692,7 +692,7 @@ struct sge_nm_txq {
        uint16_t equiqidx;      /* EQUIQ last requested at this pidx */
        uint16_t equeqidx;      /* EQUEQ last requested at this pidx */
        uint16_t dbidx;         /* pidx of the most recent doorbell */
-       uint16_t doorbells;
+       uint8_t doorbells;
        volatile uint32_t *udb;
        u_int udb_qid;
        u_int cntxt_id;
@@ -804,7 +804,7 @@ struct adapter {
        struct l2t_data *l2t;   /* L2 table */
        struct tid_info tids;
 
-       uint16_t doorbells;
+       uint8_t doorbells;
        int offload_map;        /* ports with IFCAP_TOE enabled */
        int active_ulds;        /* ULDs activated on this adapter */
        int flags;

Modified: stable/11/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- stable/11/sys/dev/cxgbe/t4_sge.c    Wed Oct 17 00:27:21 2018        
(r339395)
+++ stable/11/sys/dev/cxgbe/t4_sge.c    Wed Oct 17 00:45:01 2018        
(r339396)
@@ -4731,13 +4731,13 @@ get_flit(struct sglist_seg *segs, int nsegs, int idx)
 
        switch (idx % 3) {
        case 0: {
-               __be64 rc;
+               uint64_t rc;
 
-               rc = htobe32(segs[i].ss_len);
+               rc = (uint64_t)segs[i].ss_len << 32;
                if (i + 1 < nsegs)
-                       rc |= (uint64_t)htobe32(segs[i + 1].ss_len) << 32;
+                       rc |= (uint64_t)(segs[i + 1].ss_len);
 
-               return (rc);
+               return (htobe64(rc));
        }
        case 1:
                return (htobe64(segs[i].ss_paddr));
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to