Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F145081295
D8343.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D8343.diff
View Options
Index: head/sys/dev/hyperv/netvsc/hv_net_vsc.c
===================================================================
--- head/sys/dev/hyperv/netvsc/hv_net_vsc.c
+++ head/sys/dev/hyperv/netvsc/hv_net_vsc.c
@@ -73,33 +73,6 @@
HN_NVS_VERSION_1
};
-uint32_t
-hn_chim_alloc(struct hn_softc *sc)
-{
- int i, bmap_cnt = sc->hn_chim_bmap_cnt;
- u_long *bmap = sc->hn_chim_bmap;
- uint32_t ret = HN_NVS_CHIM_IDX_INVALID;
-
- for (i = 0; i < bmap_cnt; ++i) {
- int idx;
-
- idx = ffsl(~bmap[i]);
- if (idx == 0)
- continue;
-
- --idx; /* ffsl is 1-based */
- KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt,
- ("invalid i %d and idx %d", i, idx));
-
- if (atomic_testandset_long(&bmap[i], idx))
- continue;
-
- ret = i * LONG_BIT + idx;
- break;
- }
- return (ret);
-}
-
static const void *
hn_nvs_xact_execute(struct hn_softc *sc, struct vmbus_xact *xact,
void *req, int reqlen, size_t *resplen0, uint32_t type)
@@ -648,25 +621,6 @@
/* EMPTY */
}
-void
-hn_chim_free(struct hn_softc *sc, uint32_t chim_idx)
-{
- u_long mask;
- uint32_t idx;
-
- idx = chim_idx / LONG_BIT;
- KASSERT(idx < sc->hn_chim_bmap_cnt,
- ("invalid chimney index 0x%x", chim_idx));
-
- mask = 1UL << (chim_idx % LONG_BIT);
- KASSERT(sc->hn_chim_bmap[idx] & mask,
- ("index bitmap 0x%lx, chimney index %u, "
- "bitmap idx %d, bitmask 0x%lx",
- sc->hn_chim_bmap[idx], chim_idx, idx, mask));
-
- atomic_clear_long(&sc->hn_chim_bmap[idx], mask);
-}
-
int
hn_nvs_alloc_subchans(struct hn_softc *sc, int *nsubch0)
{
Index: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
===================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -61,6 +61,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sockio.h>
+#include <sys/limits.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/module.h>
@@ -457,6 +458,52 @@
&rndis, sizeof(rndis), &txd->send_ctx));
}
+static __inline uint32_t
+hn_chim_alloc(struct hn_softc *sc)
+{
+ int i, bmap_cnt = sc->hn_chim_bmap_cnt;
+ u_long *bmap = sc->hn_chim_bmap;
+ uint32_t ret = HN_NVS_CHIM_IDX_INVALID;
+
+ for (i = 0; i < bmap_cnt; ++i) {
+ int idx;
+
+ idx = ffsl(~bmap[i]);
+ if (idx == 0)
+ continue;
+
+ --idx; /* ffsl is 1-based */
+ KASSERT(i * LONG_BIT + idx < sc->hn_chim_cnt,
+ ("invalid i %d and idx %d", i, idx));
+
+ if (atomic_testandset_long(&bmap[i], idx))
+ continue;
+
+ ret = i * LONG_BIT + idx;
+ break;
+ }
+ return (ret);
+}
+
+static __inline void
+hn_chim_free(struct hn_softc *sc, uint32_t chim_idx)
+{
+ u_long mask;
+ uint32_t idx;
+
+ idx = chim_idx / LONG_BIT;
+ KASSERT(idx < sc->hn_chim_bmap_cnt,
+ ("invalid chimney index 0x%x", chim_idx));
+
+ mask = 1UL << (chim_idx % LONG_BIT);
+ KASSERT(sc->hn_chim_bmap[idx] & mask,
+ ("index bitmap 0x%lx, chimney index %u, "
+ "bitmap idx %d, bitmask 0x%lx",
+ sc->hn_chim_bmap[idx], chim_idx, idx, mask));
+
+ atomic_clear_long(&sc->hn_chim_bmap[idx], mask);
+}
+
static int
hn_set_rxfilter(struct hn_softc *sc)
{
Index: head/sys/dev/hyperv/netvsc/if_hnvar.h
===================================================================
--- head/sys/dev/hyperv/netvsc/if_hnvar.h
+++ head/sys/dev/hyperv/netvsc/if_hnvar.h
@@ -94,9 +94,6 @@
struct vmbus_xact;
struct rndis_packet_msg;
-uint32_t hn_chim_alloc(struct hn_softc *sc);
-void hn_chim_free(struct hn_softc *sc, uint32_t chim_idx);
-
int hn_rndis_attach(struct hn_softc *sc, int mtu);
void hn_rndis_detach(struct hn_softc *sc);
int hn_rndis_conf_rss(struct hn_softc *sc, uint16_t flags);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 16, 6:40 PM (11 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28786341
Default Alt Text
D8343.diff (3 KB)
Attached To
Mode
D8343: hyperv/hn: Shuffle chimney sending buffer alloc/free around.
Attached
Detach File
Event Timeline
Log In to Comment