svn commit: r329057 - stable/11/sys/dev/ntb

Alexander Motin mav at FreeBSD.org
Fri Feb 9 03:07:13 UTC 2018


Author: mav
Date: Fri Feb  9 03:07:12 2018
New Revision: 329057
URL: https://svnweb.freebsd.org/changeset/base/329057

Log:
  MFC r328611: Try to preallocate receive memory early.
  
  We may not have enough contiguous memory later, when NTB connection get
  established.  It is quite likely that NTB windows are symmetric and this
  allocation remain, but even if not, we will just reallocate it later.

Modified:
  stable/11/sys/dev/ntb/ntb_transport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/ntb/ntb_transport.c
==============================================================================
--- stable/11/sys/dev/ntb/ntb_transport.c	Fri Feb  9 03:06:45 2018	(r329056)
+++ stable/11/sys/dev/ntb/ntb_transport.c	Fri Feb  9 03:07:12 2018	(r329057)
@@ -332,7 +332,7 @@ ntb_transport_attach(device_t dev)
 	struct ntb_transport_child **cpp = &nt->child;
 	struct ntb_transport_child *nc;
 	struct ntb_transport_mw *mw;
-	uint64_t db_bitmap;
+	uint64_t db_bitmap, size;
 	int rc, i, db_count, spad_count, qp, qpu, qpo, qpt;
 	char cfg[128] = "";
 	char buf[32];
@@ -383,6 +383,17 @@ ntb_transport_attach(device_t dev)
 		rc = ntb_mw_set_wc(dev, i, VM_MEMATTR_WRITE_COMBINING);
 		if (rc)
 			ntb_printf(0, "Unable to set mw%d caching\n", i);
+
+		/*
+		 * Try to preallocate receive memory early, since there may
+		 * be not enough contiguous memory later.  It is quite likely
+		 * that NTB windows are symmetric and this allocation remain,
+		 * but even if not, we will just reallocate it later.
+		 */
+		size = mw->phys_size;
+		if (max_mw_size != 0 && size > max_mw_size)
+			size = max_mw_size;
+		ntb_set_mw(nt, i, size);
 	}
 
 	qpu = 0;


More information about the svn-src-all mailing list