hyperv/vmbus: Channel struct field rename

MFC after:	1 week
Sponsored by:	Microsoft OSTC
Differential Revision:	https://reviews.freebsd.org/D7242
This commit is contained in:
sephe 2016-07-20 05:26:04 +00:00
parent 3bcc502527
commit 3baa357428
6 changed files with 57 additions and 57 deletions

View File

@ -117,7 +117,7 @@ typedef void (*vmbus_chan_callback_t)(void *);
typedef struct hv_vmbus_channel {
device_t ch_dev;
struct vmbus_softc *vmbus_sc;
struct vmbus_softc *ch_vmbus;
uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */
uint32_t ch_id; /* channel id */
@ -129,13 +129,13 @@ typedef struct hv_vmbus_channel {
uint32_t ch_montrig_mask;/* MNF trig mask */
/*
* send to parent
* TX bufring; at the beginning of ch_bufring.
*/
hv_vmbus_ring_buffer_info outbound;
hv_vmbus_ring_buffer_info ch_txbr;
/*
* receive from parent
* RX bufring; immediately following ch_txbr.
*/
hv_vmbus_ring_buffer_info inbound;
hv_vmbus_ring_buffer_info ch_rxbr;
struct taskqueue *ch_tq;
struct task ch_task;
@ -169,9 +169,9 @@ typedef struct hv_vmbus_channel {
/*
* Driver private data
*/
void *hv_chan_priv1;
void *hv_chan_priv2;
void *hv_chan_priv3;
void *ch_dev_priv1;
void *ch_dev_priv2;
void *ch_dev_priv3;
void *ch_bufring; /* TX+RX bufrings */
struct hyperv_dma ch_bufring_dma;

View File

@ -50,7 +50,7 @@
#include "hv_rndis_filter.h"
/* priv1 and priv2 are consumed by the main driver */
#define hv_chan_rdbuf hv_chan_priv3
#define ch_dev_rdbuf ch_dev_priv3
MALLOC_DEFINE(M_NETVSC, "netvsc", "Hyper-V netvsc driver");
@ -644,7 +644,7 @@ void
hv_nv_subchan_attach(struct hv_vmbus_channel *chan)
{
chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
vmbus_chan_open(chan, NETVSC_DEVICE_RING_BUFFER_SIZE,
NETVSC_DEVICE_RING_BUFFER_SIZE, NULL, 0,
hv_nv_on_channel_callback, chan);
@ -670,7 +670,7 @@ hv_nv_on_device_add(struct hn_softc *sc, void *additional_info)
sema_init(&net_dev->channel_init_sema, 0, "netdev_sema");
chan->hv_chan_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
chan->ch_dev_rdbuf = malloc(NETVSC_PACKET_SIZE, M_NETVSC, M_WAITOK);
/*
* Open the channel
@ -679,7 +679,7 @@ hv_nv_on_device_add(struct hn_softc *sc, void *additional_info)
NETVSC_DEVICE_RING_BUFFER_SIZE, NETVSC_DEVICE_RING_BUFFER_SIZE,
NULL, 0, hv_nv_on_channel_callback, chan);
if (ret != 0) {
free(chan->hv_chan_rdbuf, M_NETVSC);
free(chan->ch_dev_rdbuf, M_NETVSC);
goto cleanup;
}
@ -694,7 +694,7 @@ hv_nv_on_device_add(struct hn_softc *sc, void *additional_info)
close:
/* Now, we can close the channel safely */
free(chan->hv_chan_rdbuf, M_NETVSC);
free(chan->ch_dev_rdbuf, M_NETVSC);
vmbus_chan_close(chan);
cleanup:
@ -725,7 +725,7 @@ hv_nv_on_device_remove(struct hn_softc *sc, boolean_t destroy_channel)
/* Now, we can close the channel safely */
free(sc->hn_prichan->hv_chan_rdbuf, M_NETVSC);
free(sc->hn_prichan->ch_dev_rdbuf, M_NETVSC);
vmbus_chan_close(sc->hn_prichan);
sema_destroy(&net_dev->channel_init_sema);
@ -986,7 +986,7 @@ hv_nv_on_channel_callback(void *xchan)
if (net_dev == NULL)
return;
buffer = chan->hv_chan_rdbuf;
buffer = chan->ch_dev_rdbuf;
do {
struct vmbus_chanpkt_hdr *pkt = buffer;
uint32_t bytes_rxed;

View File

@ -120,8 +120,8 @@ __FBSDID("$FreeBSD$");
#include "hv_rndis_filter.h"
#include "vmbus_if.h"
#define hv_chan_rxr hv_chan_priv1
#define hv_chan_txr hv_chan_priv2
#define ch_dev_rxr ch_dev_priv1
#define ch_dev_txr ch_dev_priv2
/* Short for Hyper-V network interface */
#define NETVSC_DEVNAME "hn"
@ -811,9 +811,9 @@ hn_tx_done(struct hv_vmbus_channel *chan, void *xpkt)
void
netvsc_channel_rollup(struct hv_vmbus_channel *chan)
{
struct hn_tx_ring *txr = chan->hv_chan_txr;
struct hn_tx_ring *txr = chan->ch_dev_txr;
#if defined(INET) || defined(INET6)
struct hn_rx_ring *rxr = chan->hv_chan_rxr;
struct hn_rx_ring *rxr = chan->ch_dev_rxr;
tcp_lro_flush_all(&rxr->hn_lro);
#endif
@ -1284,7 +1284,7 @@ netvsc_recv(struct hv_vmbus_channel *chan, netvsc_packet *packet,
const struct rndis_hash_info *hash_info,
const struct rndis_hash_value *hash_value)
{
struct hn_rx_ring *rxr = chan->hv_chan_rxr;
struct hn_rx_ring *rxr = chan->ch_dev_rxr;
struct ifnet *ifp = rxr->hn_ifp;
struct mbuf *m_new;
int size, do_lro = 0, do_csum = 1;
@ -2928,7 +2928,7 @@ hn_channel_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan)
("RX ring %d already attached", idx));
rxr->hn_rx_flags |= HN_RX_FLAG_ATTACHED;
chan->hv_chan_rxr = rxr;
chan->ch_dev_rxr = rxr;
if (bootverbose) {
if_printf(sc->hn_ifp, "link RX ring %d to channel%u\n",
idx, chan->ch_id);
@ -2941,7 +2941,7 @@ hn_channel_attach(struct hn_softc *sc, struct hv_vmbus_channel *chan)
("TX ring %d already attached", idx));
txr->hn_tx_flags |= HN_TX_FLAG_ATTACHED;
chan->hv_chan_txr = txr;
chan->ch_dev_txr = txr;
txr->hn_chan = chan;
if (bootverbose) {
if_printf(sc->hn_ifp, "link TX ring %d to channel%u\n",

View File

@ -316,7 +316,7 @@ storvsc_subchan_attach(struct storvsc_softc *sc,
memset(&props, 0, sizeof(props));
new_channel->hv_chan_priv1 = sc;
new_channel->ch_dev_priv1 = sc;
vmbus_chan_cpu_rr(new_channel);
ret = vmbus_chan_open(new_channel,
sc->hs_drv_props->drv_ringbuffer_size,
@ -575,7 +575,7 @@ hv_storvsc_connect_vsp(struct storvsc_softc *sc)
/*
* Open the channel
*/
KASSERT(sc->hs_chan->hv_chan_priv1 == sc, ("invalid chan priv1"));
KASSERT(sc->hs_chan->ch_dev_priv1 == sc, ("invalid chan priv1"));
vmbus_chan_cpu_rr(sc->hs_chan);
ret = vmbus_chan_open(
sc->hs_chan,
@ -773,7 +773,7 @@ hv_storvsc_on_channel_callback(void *xchan)
{
int ret = 0;
hv_vmbus_channel *channel = xchan;
struct storvsc_softc *sc = channel->hv_chan_priv1;
struct storvsc_softc *sc = channel->ch_dev_priv1;
uint32_t bytes_recvd;
uint64_t request_id;
uint8_t packet[roundup2(sizeof(struct vstor_packet), 8)];
@ -915,7 +915,7 @@ storvsc_attach(device_t dev)
sc = device_get_softc(dev);
sc->hs_chan = vmbus_get_channel(dev);
sc->hs_chan->hv_chan_priv1 = sc;
sc->hs_chan->ch_dev_priv1 = sc;
stor_type = storvsc_get_storage_type(dev);

View File

@ -1015,7 +1015,7 @@ vmbus_child_pnpinfo_str(device_t dev, device_t child, char *buf, size_t buflen)
int
vmbus_add_child(struct hv_vmbus_channel *chan)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
device_t parent = sc->vmbus_dev;
int error = 0;
@ -1052,7 +1052,7 @@ vmbus_delete_child(struct hv_vmbus_channel *chan)
* device_add_child()
*/
mtx_lock(&Giant);
error = device_delete_child(chan->vmbus_sc->vmbus_dev, chan->ch_dev);
error = device_delete_child(chan->ch_vmbus->vmbus_dev, chan->ch_dev);
mtx_unlock(&Giant);
return error;

View File

@ -83,7 +83,7 @@ vmbus_chan_msgprocs[VMBUS_CHANMSG_TYPE_MAX] = {
static void
vmbus_chan_signal_tx(struct hv_vmbus_channel *chan)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
uint32_t chanid = chan->ch_id;
atomic_set_long(&sc->vmbus_tx_evtflags[chanid >> VMBUS_EVTFLAG_SHIFT],
@ -187,7 +187,7 @@ vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan)
"in", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "");
if (br_tree != NULL) {
hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree),
&chan->inbound, "inbound ring buffer stats");
&chan->ch_rxbr, "inbound ring buffer stats");
}
/*
@ -197,7 +197,7 @@ vmbus_chan_sysctl_create(struct hv_vmbus_channel *chan)
"out", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "");
if (br_tree != NULL) {
hv_ring_buffer_stat(ctx, SYSCTL_CHILDREN(br_tree),
&chan->outbound, "outbound ring buffer stats");
&chan->ch_txbr, "outbound ring buffer stats");
}
}
@ -205,7 +205,7 @@ int
vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size,
const void *udata, int udlen, vmbus_chan_callback_t cb, void *cbarg)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
const struct vmbus_chanmsg_chopen_resp *resp;
const struct vmbus_message *msg;
struct vmbus_chanmsg_chopen *req;
@ -233,7 +233,7 @@ vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size,
vmbus_chan_update_evtflagcnt(sc, chan);
chan->ch_tq = VMBUS_PCPU_GET(chan->vmbus_sc, event_tq, chan->ch_cpuid);
chan->ch_tq = VMBUS_PCPU_GET(chan->ch_vmbus, event_tq, chan->ch_cpuid);
if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
TASK_INIT(&chan->ch_task, 0, vmbus_chan_task, chan);
else
@ -254,9 +254,9 @@ vmbus_chan_open(struct hv_vmbus_channel *chan, int txbr_size, int rxbr_size,
chan->ch_bufring = br;
/* TX bufring comes first */
hv_vmbus_ring_buffer_init(&chan->outbound, br, txbr_size);
hv_vmbus_ring_buffer_init(&chan->ch_txbr, br, txbr_size);
/* RX bufring immediately follows TX bufring */
hv_vmbus_ring_buffer_init(&chan->inbound, br + txbr_size, rxbr_size);
hv_vmbus_ring_buffer_init(&chan->ch_rxbr, br + txbr_size, rxbr_size);
/* Create sysctl tree for this channel */
vmbus_chan_sysctl_create(chan);
@ -337,7 +337,7 @@ int
vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr,
int size, uint32_t *gpadl0)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
struct vmbus_msghc *mh;
struct vmbus_chanmsg_gpadl_conn *req;
const struct vmbus_message *msg;
@ -466,7 +466,7 @@ vmbus_chan_gpadl_connect(struct hv_vmbus_channel *chan, bus_addr_t paddr,
int
vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
struct vmbus_msghc *mh;
struct vmbus_chanmsg_gpadl_disconn *req;
int error;
@ -503,7 +503,7 @@ vmbus_chan_gpadl_disconnect(struct hv_vmbus_channel *chan, uint32_t gpadl)
static void
vmbus_chan_close_internal(struct hv_vmbus_channel *chan)
{
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
struct vmbus_msghc *mh;
struct vmbus_chanmsg_chclose *req;
struct taskqueue *tq = chan->ch_tq;
@ -564,8 +564,8 @@ vmbus_chan_close_internal(struct hv_vmbus_channel *chan)
/*
* Destroy the TX+RX bufrings.
*/
hv_ring_buffer_cleanup(&chan->outbound);
hv_ring_buffer_cleanup(&chan->inbound);
hv_ring_buffer_cleanup(&chan->ch_txbr);
hv_ring_buffer_cleanup(&chan->ch_rxbr);
if (chan->ch_bufring != NULL) {
hyperv_dmamem_free(&chan->ch_bufring_dma, chan->ch_bufring);
chan->ch_bufring = NULL;
@ -635,7 +635,7 @@ vmbus_chan_send(struct hv_vmbus_channel *chan, uint16_t type, uint16_t flags,
iov[2].iov_base = &pad;
iov[2].iov_len = pad_pktlen - pktlen;
error = hv_ring_buffer_write(&chan->outbound, iov, 3, &send_evt);
error = hv_ring_buffer_write(&chan->ch_txbr, iov, 3, &send_evt);
if (!error && send_evt)
vmbus_chan_signal_tx(chan);
return error;
@ -675,7 +675,7 @@ vmbus_chan_send_sglist(struct hv_vmbus_channel *chan,
iov[3].iov_base = &pad;
iov[3].iov_len = pad_pktlen - pktlen;
error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt);
error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt);
if (!error && send_evt)
vmbus_chan_signal_tx(chan);
return error;
@ -717,7 +717,7 @@ vmbus_chan_send_prplist(struct hv_vmbus_channel *chan,
iov[3].iov_base = &pad;
iov[3].iov_len = pad_pktlen - pktlen;
error = hv_ring_buffer_write(&chan->outbound, iov, 4, &send_evt);
error = hv_ring_buffer_write(&chan->ch_txbr, iov, 4, &send_evt);
if (!error && send_evt)
vmbus_chan_signal_tx(chan);
return error;
@ -730,7 +730,7 @@ vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0,
struct vmbus_chanpkt_hdr pkt;
int error, dlen, hlen;
error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt));
error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt));
if (error)
return error;
@ -747,7 +747,7 @@ vmbus_chan_recv(struct hv_vmbus_channel *chan, void *data, int *dlen0,
*dlen0 = dlen;
/* Skip packet header */
error = hv_ring_buffer_read(&chan->inbound, data, dlen, hlen);
error = hv_ring_buffer_read(&chan->ch_rxbr, data, dlen, hlen);
KASSERT(!error, ("hv_ring_buffer_read failed"));
return 0;
@ -760,7 +760,7 @@ vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan,
struct vmbus_chanpkt_hdr pkt;
int error, pktlen;
error = hv_ring_buffer_peek(&chan->inbound, &pkt, sizeof(pkt));
error = hv_ring_buffer_peek(&chan->ch_rxbr, &pkt, sizeof(pkt));
if (error)
return error;
@ -773,7 +773,7 @@ vmbus_chan_recv_pkt(struct hv_vmbus_channel *chan,
*pktlen0 = pktlen;
/* Include packet header */
error = hv_ring_buffer_read(&chan->inbound, pkt0, pktlen, 0);
error = hv_ring_buffer_read(&chan->ch_rxbr, pkt0, pktlen, 0);
KASSERT(!error, ("hv_ring_buffer_read failed"));
return 0;
@ -803,12 +803,12 @@ vmbus_chan_task(void *xchan, int pending __unused)
cb(cbarg);
left = hv_ring_buffer_read_end(&chan->inbound);
left = hv_ring_buffer_read_end(&chan->ch_rxbr);
if (left == 0) {
/* No more data in RX bufring; done */
break;
}
hv_ring_buffer_read_begin(&chan->inbound);
hv_ring_buffer_read_begin(&chan->ch_rxbr);
}
}
@ -850,7 +850,7 @@ vmbus_event_flags_proc(struct vmbus_softc *sc, volatile u_long *event_flags,
continue;
if (chan->ch_flags & VMBUS_CHAN_FLAG_BATCHREAD)
hv_ring_buffer_read_begin(&chan->inbound);
hv_ring_buffer_read_begin(&chan->ch_rxbr);
taskqueue_enqueue(chan->ch_tq, &chan->ch_task);
}
}
@ -925,7 +925,7 @@ vmbus_chan_alloc(struct vmbus_softc *sc)
return NULL;
}
chan->vmbus_sc = sc;
chan->ch_vmbus = sc;
mtx_init(&chan->ch_subchan_lock, "vmbus subchan", NULL, MTX_DEF);
TAILQ_INIT(&chan->ch_subchans);
TASK_INIT(&chan->ch_detach_task, 0, vmbus_chan_detach_task, chan);
@ -947,7 +947,7 @@ vmbus_chan_free(struct hv_vmbus_channel *chan)
static int
vmbus_chan_add(struct hv_vmbus_channel *newchan)
{
struct vmbus_softc *sc = newchan->vmbus_sc;
struct vmbus_softc *sc = newchan->ch_vmbus;
struct hv_vmbus_channel *prichan;
if (newchan->ch_id == 0) {
@ -1040,14 +1040,14 @@ vmbus_chan_cpu_set(struct hv_vmbus_channel *chan, int cpu)
{
KASSERT(cpu >= 0 && cpu < mp_ncpus, ("invalid cpu %d", cpu));
if (chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WS2008 ||
chan->vmbus_sc->vmbus_version == VMBUS_VERSION_WIN7) {
if (chan->ch_vmbus->vmbus_version == VMBUS_VERSION_WS2008 ||
chan->ch_vmbus->vmbus_version == VMBUS_VERSION_WIN7) {
/* Only cpu0 is supported */
cpu = 0;
}
chan->ch_cpuid = cpu;
chan->ch_vcpuid = VMBUS_PCPU_GET(chan->vmbus_sc, vcpuid, cpu);
chan->ch_vcpuid = VMBUS_PCPU_GET(chan->ch_vmbus, vcpuid, cpu);
if (bootverbose) {
printf("vmbus_chan%u: assigned to cpu%u [vcpu%u]\n",
@ -1180,7 +1180,7 @@ vmbus_chan_detach_task(void *xchan, int pending __unused)
vmbus_delete_child(chan);
/* NOTE: DO NOT free primary channel for now */
} else {
struct vmbus_softc *sc = chan->vmbus_sc;
struct vmbus_softc *sc = chan->ch_vmbus;
struct hv_vmbus_channel *pri_chan = chan->ch_prichan;
struct vmbus_chanmsg_chfree *req;
struct vmbus_msghc *mh;
@ -1264,7 +1264,7 @@ vmbus_chan_cpu2chan(struct hv_vmbus_channel *prichan, int cpu)
if (TAILQ_EMPTY(&prichan->ch_subchans))
return prichan;
vcpu = VMBUS_PCPU_GET(prichan->vmbus_sc, vcpuid, cpu);
vcpu = VMBUS_PCPU_GET(prichan->ch_vmbus, vcpuid, cpu);
#define CHAN_VCPU_DIST(ch, vcpu) \
(((ch)->ch_vcpuid > (vcpu)) ? \