diff options
| author | Alexander Motin <mav@FreeBSD.org> | 2018-01-31 01:04:36 +0000 |
|---|---|---|
| committer | Alexander Motin <mav@FreeBSD.org> | 2018-01-31 01:04:36 +0000 |
| commit | 6e76bc32d4a4e816d5e58877b158554c86071cb8 (patch) | |
| tree | 4746b72869e596f5084e1aec50d16b723ac38577 /sys/dev/ntb | |
| parent | 05d56d83b6b9f3d3084d58d0a55e2ad7d9463464 (diff) | |
Notes
Diffstat (limited to 'sys/dev/ntb')
| -rw-r--r-- | sys/dev/ntb/ntb_transport.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/ntb/ntb_transport.c b/sys/dev/ntb/ntb_transport.c index 39a06cf83f75..0dfb6a30ce16 100644 --- a/sys/dev/ntb/ntb_transport.c +++ b/sys/dev/ntb/ntb_transport.c @@ -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; |
