Author: cem
Date: Wed Oct 14 02:14:15 2015
New Revision: 289280
URL: https://svnweb.freebsd.org/changeset/base/289280

Log:
  NTB: MFV 78958433: Enable Snoop on Primary Side
  
  Enable Snoop from Primary to Secondary side on BAR23 and BAR45 on all
  TLPs.  Previously, Snoop was only enabled from Secondary to Primary
  side.  This can have a performance improvement on some workloads.
  
  Also, make the code more obvious about how the link is being enabled.
  
  Authored by:  Jon Mason
  Obtained from:        Linux (Dual BSD/GPL driver)
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/dev/ntb/ntb_hw/ntb_hw.c
  head/sys/dev/ntb/ntb_hw/ntb_regs.h

Modified: head/sys/dev/ntb/ntb_hw/ntb_hw.c
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_hw.c    Wed Oct 14 02:10:07 2015        
(r289279)
+++ head/sys/dev/ntb/ntb_hw/ntb_hw.c    Wed Oct 14 02:14:15 2015        
(r289280)
@@ -1050,12 +1050,18 @@ ntb_handle_link_event(struct ntb_softc *
 static void
 ntb_hw_link_up(struct ntb_softc *ntb)
 {
+       uint32_t cntl;
 
-       if (ntb->conn_type == NTB_CONN_TRANSPARENT)
+       if (ntb->conn_type == NTB_CONN_TRANSPARENT) {
                ntb_handle_link_event(ntb, NTB_LINK_UP);
-       else
-               ntb_reg_write(4, ntb->reg_ofs.lnk_cntl,
-                   NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP);
+               return;
+       }
+
+       cntl = ntb_reg_read(4, ntb->reg_ofs.lnk_cntl);
+       cntl &= ~(NTB_CNTL_LINK_DISABLE | NTB_CNTL_CFG_LOCK);
+       cntl |= NTB_CNTL_P2S_BAR23_SNOOP | NTB_CNTL_S2P_BAR23_SNOOP;
+       cntl |= NTB_CNTL_P2S_BAR45_SNOOP | NTB_CNTL_S2P_BAR45_SNOOP;
+       ntb_reg_write(4, ntb->reg_ofs.lnk_cntl, cntl);
 }
 
 static void
@@ -1069,8 +1075,9 @@ ntb_hw_link_down(struct ntb_softc *ntb)
        }
 
        cntl = ntb_reg_read(4, ntb->reg_ofs.lnk_cntl);
-       cntl &= ~(NTB_CNTL_BAR23_SNOOP | NTB_CNTL_BAR45_SNOOP);
-       cntl |= NTB_CNTL_LINK_DISABLE;
+       cntl &= ~(NTB_CNTL_P2S_BAR23_SNOOP | NTB_CNTL_S2P_BAR23_SNOOP);
+       cntl &= ~(NTB_CNTL_P2S_BAR45_SNOOP | NTB_CNTL_S2P_BAR45_SNOOP);
+       cntl |= NTB_CNTL_LINK_DISABLE | NTB_CNTL_CFG_LOCK;
        ntb_reg_write(4, ntb->reg_ofs.lnk_cntl, cntl);
 }
 

Modified: head/sys/dev/ntb/ntb_hw/ntb_regs.h
==============================================================================
--- head/sys/dev/ntb/ntb_hw/ntb_regs.h  Wed Oct 14 02:10:07 2015        
(r289279)
+++ head/sys/dev/ntb/ntb_hw/ntb_regs.h  Wed Oct 14 02:14:15 2015        
(r289280)
@@ -116,11 +116,13 @@
 #define SOC_LTSSMSTATEJMP_FORCEDETECT  (1 << 2)
 #define SOC_IBIST_ERR_OFLOW    0x7fff7fff
 
-#define NTB_CNTL_CFG_LOCK      (1 << 0)
-#define NTB_CNTL_LINK_DISABLE  (1 << 1)
-#define NTB_CNTL_BAR23_SNOOP   (1 << 2)
-#define NTB_CNTL_BAR45_SNOOP   (1 << 6)
-#define SOC_CNTL_LINK_DOWN     (1 << 16)
+#define NTB_CNTL_CFG_LOCK              (1 << 0)
+#define NTB_CNTL_LINK_DISABLE          (1 << 1)
+#define NTB_CNTL_S2P_BAR23_SNOOP       (1 << 2)
+#define NTB_CNTL_P2S_BAR23_SNOOP       (1 << 4)
+#define NTB_CNTL_S2P_BAR45_SNOOP       (1 << 6)
+#define NTB_CNTL_P2S_BAR45_SNOOP       (1 << 8)
+#define SOC_CNTL_LINK_DOWN             (1 << 16)
 
 #define XEON_PBAR23SZ_OFFSET   0x00d0
 #define XEON_PBAR45SZ_OFFSET   0x00d1
_______________________________________________
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