Date: Fri, 5 Feb 2016 05:31:59 +0000 From: Phabricator <phabric-noreply@FreeBSD.org> To: freebsd-net@freebsd.org Subject: [Differential] [Closed] D5159: hyperv/hn: Recover half of the chimney sending space Message-ID: <e4d2b41832295454d9e2b119a14e0837@localhost.localdomain> In-Reply-To: <differential-rev-PHID-DREV-ilfipff27tzltswcpxdp-req@FreeBSD.org> References: <differential-rev-PHID-DREV-ilfipff27tzltswcpxdp-req@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--b1_e4d2b41832295454d9e2b119a14e0837 Content-Type: text/plain; charset = "utf-8" Content-Transfer-Encoding: 8bit This revision was automatically updated to reflect the committed changes. Closed by commit rS295303: hyperv/hn: Recover half of the chimney sending space (authored by sephe). CHANGED PRIOR TO COMMIT https://reviews.freebsd.org/D5159?vs=12926&id=13037#toc REPOSITORY rS FreeBSD src repository CHANGES SINCE LAST UPDATE https://reviews.freebsd.org/D5159?vs=12926&id=13037 REVISION DETAIL https://reviews.freebsd.org/D5159 AFFECTED FILES head/sys/dev/hyperv/netvsc/hv_net_vsc.c CHANGE DETAILS diff --git a/head/sys/dev/hyperv/netvsc/hv_net_vsc.c b/head/sys/dev/hyperv/netvsc/hv_net_vsc.c --- a/head/sys/dev/hyperv/netvsc/hv_net_vsc.c +++ b/head/sys/dev/hyperv/netvsc/hv_net_vsc.c @@ -136,15 +136,15 @@ int i; for (i = 0; i < bitsmap_words; i++) { - idx = ffs(~bitsmap[i]); + idx = ffsl(~bitsmap[i]); if (0 == idx) continue; idx--; - if (i * BITS_PER_LONG + idx >= net_dev->send_section_count) - return (ret); + KASSERT(i * BITS_PER_LONG + idx < net_dev->send_section_count, + ("invalid i %d and idx %lu", i, idx)); - if (synch_test_and_set_bit(idx, &bitsmap[i])) + if (atomic_testandset_long(&bitsmap[i], idx)) continue; ret = i * BITS_PER_LONG + idx; @@ -789,8 +789,27 @@ if (NULL != net_vsc_pkt) { if (net_vsc_pkt->send_buf_section_idx != NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX) { - synch_change_bit(net_vsc_pkt->send_buf_section_idx, - net_dev->send_section_bitsmap); + u_long mask; + int idx; + + idx = net_vsc_pkt->send_buf_section_idx / + BITS_PER_LONG; + KASSERT(idx < net_dev->bitsmap_words, + ("invalid section index %u", + net_vsc_pkt->send_buf_section_idx)); + mask = 1UL << + (net_vsc_pkt->send_buf_section_idx % + BITS_PER_LONG); + + KASSERT(net_dev->send_section_bitsmap[idx] & + mask, + ("index bitmap 0x%lx, section index %u, " + "bitmap idx %d, bitmask 0x%lx", + net_dev->send_section_bitsmap[idx], + net_vsc_pkt->send_buf_section_idx, + idx, mask)); + atomic_clear_long( + &net_dev->send_section_bitsmap[idx], mask); } /* Notify the layer above us */ EMAIL PREFERENCES https://reviews.freebsd.org/settings/panel/emailpreferences/ To: sepherosa_gmail.com, delphij, royger, decui_microsoft.com, honzhan_microsoft.com, howard0su_gmail.com, adrian, network Cc: freebsd-net-list --b1_e4d2b41832295454d9e2b119a14e0837 Content-Type: text/x-patch; charset=utf-8; name="D5159.13037.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="D5159.13037.patch" ZGlmZiAtLWdpdCBhL2hlYWQvc3lzL2Rldi9oeXBlcnYvbmV0dnNjL2h2X25ldF92c2MuYyBiL2hl YWQvc3lzL2Rldi9oeXBlcnYvbmV0dnNjL2h2X25ldF92c2MuYwotLS0gYS9oZWFkL3N5cy9kZXYv aHlwZXJ2L25ldHZzYy9odl9uZXRfdnNjLmMKKysrIGIvaGVhZC9zeXMvZGV2L2h5cGVydi9uZXR2 c2MvaHZfbmV0X3ZzYy5jCkBAIC0xMzYsMTUgKzEzNiwxNSBAQAogCWludCBpOwogCiAJZm9yIChp ID0gMDsgaSA8IGJpdHNtYXBfd29yZHM7IGkrKykgewotCQlpZHggPSBmZnMofmJpdHNtYXBbaV0p OworCQlpZHggPSBmZnNsKH5iaXRzbWFwW2ldKTsKIAkJaWYgKDAgPT0gaWR4KQogCQkJY29udGl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G5ldF92c2NfcGt0LT5zZW5kX2J1Zl9zZWN0aW9uX2lkeCkpOworCQkJCW1hc2sgPSAxVUwg PDwKKwkJCQkgICAgKG5ldF92c2NfcGt0LT5zZW5kX2J1Zl9zZWN0aW9uX2lkeCAlCisJCQkJICAg ICBCSVRTX1BFUl9MT05HKTsKKworCQkJCUtBU1NFUlQobmV0X2Rldi0+c2VuZF9zZWN0aW9uX2Jp dHNtYXBbaWR4XSAmCisJCQkJICAgIG1hc2ssCisJCQkJICAgICgiaW5kZXggYml0bWFwIDB4JWx4 LCBzZWN0aW9uIGluZGV4ICV1LCAiCisJCQkJICAgICAiYml0bWFwIGlkeCAlZCwgYml0bWFzayAw eCVseCIsCisJCQkJICAgICBuZXRfZGV2LT5zZW5kX3NlY3Rpb25fYml0c21hcFtpZHhdLAorCQkJ CSAgICAgbmV0X3ZzY19wa3QtPnNlbmRfYnVmX3NlY3Rpb25faWR4LAorCQkJCSAgICAgaWR4LCBt YXNrKSk7CisJCQkJYXRvbWljX2NsZWFyX2xvbmcoCisJCQkJICAgICZuZXRfZGV2LT5zZW5kX3Nl Y3Rpb25fYml0c21hcFtpZHhdLCBtYXNrKTsKIAkJCX0KIAkJCQogCQkJLyogTm90aWZ5IHRoZSBs YXllciBhYm92ZSB1cyAqLwoK --b1_e4d2b41832295454d9e2b119a14e0837--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e4d2b41832295454d9e2b119a14e0837>