hyperv/hn: Nuke unnecessary M_NETVSC
MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8340
This commit is contained in:
parent
a6e9118bf4
commit
90321eb752
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=307985
@ -52,8 +52,6 @@
|
||||
#include <dev/hyperv/netvsc/if_hnreg.h>
|
||||
#include <dev/hyperv/netvsc/if_hnvar.h>
|
||||
|
||||
MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver");
|
||||
|
||||
/*
|
||||
* Forward declarations
|
||||
*/
|
||||
@ -308,7 +306,7 @@ hn_nvs_conn_chim(struct hn_softc *sc)
|
||||
|
||||
sc->hn_chim_bmap_cnt = sc->hn_chim_cnt / LONG_BIT;
|
||||
sc->hn_chim_bmap = malloc(sc->hn_chim_bmap_cnt * sizeof(u_long),
|
||||
M_NETVSC, M_WAITOK | M_ZERO);
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
/* Done! */
|
||||
sc->hn_flags |= HN_FLAG_CHIM_CONNECTED;
|
||||
@ -427,7 +425,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc)
|
||||
}
|
||||
|
||||
if (sc->hn_chim_bmap != NULL) {
|
||||
free(sc->hn_chim_bmap, M_NETVSC);
|
||||
free(sc->hn_chim_bmap, M_DEVBUF);
|
||||
sc->hn_chim_bmap = NULL;
|
||||
}
|
||||
return (0);
|
||||
|
@ -66,8 +66,6 @@
|
||||
|
||||
#define HN_USE_TXDESC_BUFRING
|
||||
|
||||
MALLOC_DECLARE(M_NETVSC);
|
||||
|
||||
/*
|
||||
* The following arguably belongs in a separate header file
|
||||
*/
|
||||
|
@ -2606,7 +2606,7 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
|
||||
sc->hn_rx_ring_inuse = sc->hn_rx_ring_cnt;
|
||||
|
||||
sc->hn_rx_ring = malloc(sizeof(struct hn_rx_ring) * sc->hn_rx_ring_cnt,
|
||||
M_NETVSC, M_WAITOK | M_ZERO);
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
#if defined(INET) || defined(INET6)
|
||||
#if __FreeBSD_version >= 1100095
|
||||
@ -2647,7 +2647,7 @@ hn_create_rx_data(struct hn_softc *sc, int ring_cnt)
|
||||
rxr->hn_ifp = sc->hn_ifp;
|
||||
if (i < sc->hn_tx_ring_cnt)
|
||||
rxr->hn_txr = &sc->hn_tx_ring[i];
|
||||
rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
|
||||
rxr->hn_rdbuf = malloc(NETVSC_PACKET_SIZE, M_DEVBUF, M_WAITOK);
|
||||
rxr->hn_rx_idx = i;
|
||||
rxr->hn_rxbuf = sc->hn_rxbuf;
|
||||
|
||||
@ -2794,9 +2794,9 @@ hn_destroy_rx_data(struct hn_softc *sc)
|
||||
#if defined(INET) || defined(INET6)
|
||||
tcp_lro_free(&rxr->hn_lro);
|
||||
#endif
|
||||
free(rxr->hn_rdbuf, M_NETVSC);
|
||||
free(rxr->hn_rdbuf, M_DEVBUF);
|
||||
}
|
||||
free(sc->hn_rx_ring, M_NETVSC);
|
||||
free(sc->hn_rx_ring, M_DEVBUF);
|
||||
sc->hn_rx_ring = NULL;
|
||||
|
||||
sc->hn_rx_ring_cnt = 0;
|
||||
@ -2821,11 +2821,11 @@ hn_create_tx_ring(struct hn_softc *sc, int id)
|
||||
|
||||
txr->hn_txdesc_cnt = HN_TX_DESC_CNT;
|
||||
txr->hn_txdesc = malloc(sizeof(struct hn_txdesc) * txr->hn_txdesc_cnt,
|
||||
M_NETVSC, M_WAITOK | M_ZERO);
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
#ifndef HN_USE_TXDESC_BUFRING
|
||||
SLIST_INIT(&txr->hn_txlist);
|
||||
#else
|
||||
txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC,
|
||||
txr->hn_txdesc_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_DEVBUF,
|
||||
M_WAITOK, &txr->hn_tx_lock);
|
||||
#endif
|
||||
|
||||
@ -2843,7 +2843,7 @@ hn_create_tx_ring(struct hn_softc *sc, int id)
|
||||
TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr);
|
||||
|
||||
br_depth = hn_get_txswq_depth(txr);
|
||||
txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC,
|
||||
txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_DEVBUF,
|
||||
M_WAITOK, &txr->hn_tx_lock);
|
||||
}
|
||||
|
||||
@ -3026,14 +3026,14 @@ hn_destroy_tx_ring(struct hn_tx_ring *txr)
|
||||
bus_dma_tag_destroy(txr->hn_tx_rndis_dtag);
|
||||
|
||||
#ifdef HN_USE_TXDESC_BUFRING
|
||||
buf_ring_free(txr->hn_txdesc_br, M_NETVSC);
|
||||
buf_ring_free(txr->hn_txdesc_br, M_DEVBUF);
|
||||
#endif
|
||||
|
||||
free(txr->hn_txdesc, M_NETVSC);
|
||||
free(txr->hn_txdesc, M_DEVBUF);
|
||||
txr->hn_txdesc = NULL;
|
||||
|
||||
if (txr->hn_mbuf_br != NULL)
|
||||
buf_ring_free(txr->hn_mbuf_br, M_NETVSC);
|
||||
buf_ring_free(txr->hn_mbuf_br, M_DEVBUF);
|
||||
|
||||
#ifndef HN_USE_TXDESC_BUFRING
|
||||
mtx_destroy(&txr->hn_txlist_spin);
|
||||
@ -3065,7 +3065,7 @@ hn_create_tx_data(struct hn_softc *sc, int ring_cnt)
|
||||
sc->hn_tx_ring_inuse = sc->hn_tx_ring_cnt;
|
||||
|
||||
sc->hn_tx_ring = malloc(sizeof(struct hn_tx_ring) * sc->hn_tx_ring_cnt,
|
||||
M_NETVSC, M_WAITOK | M_ZERO);
|
||||
M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
|
||||
ctx = device_get_sysctl_ctx(sc->hn_dev);
|
||||
child = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->hn_dev));
|
||||
@ -3225,7 +3225,7 @@ hn_destroy_tx_data(struct hn_softc *sc)
|
||||
for (i = 0; i < sc->hn_tx_ring_cnt; ++i)
|
||||
hn_destroy_tx_ring(&sc->hn_tx_ring[i]);
|
||||
|
||||
free(sc->hn_tx_ring, M_NETVSC);
|
||||
free(sc->hn_tx_ring, M_DEVBUF);
|
||||
sc->hn_tx_ring = NULL;
|
||||
|
||||
sc->hn_tx_ring_cnt = 0;
|
||||
@ -4175,12 +4175,12 @@ hn_chan_callback(struct vmbus_channel *chan, void *xrxr)
|
||||
} else if (ret == ENOBUFS) {
|
||||
/* Handle large packet */
|
||||
if (bufferlen > NETVSC_PACKET_SIZE) {
|
||||
free(buffer, M_NETVSC);
|
||||
free(buffer, M_DEVBUF);
|
||||
buffer = NULL;
|
||||
}
|
||||
|
||||
/* alloc new buffer */
|
||||
buffer = malloc(bytes_rxed, M_NETVSC, M_NOWAIT);
|
||||
buffer = malloc(bytes_rxed, M_DEVBUF, M_NOWAIT);
|
||||
if (buffer == NULL) {
|
||||
if_printf(rxr->hn_ifp,
|
||||
"hv_cb malloc buffer failed, len=%u\n",
|
||||
@ -4196,7 +4196,7 @@ hn_chan_callback(struct vmbus_channel *chan, void *xrxr)
|
||||
} while (1);
|
||||
|
||||
if (bufferlen > NETVSC_PACKET_SIZE)
|
||||
free(buffer, M_NETVSC);
|
||||
free(buffer, M_DEVBUF);
|
||||
|
||||
hv_rf_channel_rollup(rxr, rxr->hn_txr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user