mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
hyperv/vmbus: Reorder channel fields.
MFC after: 1 week Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D7258
This commit is contained in:
parent
f617e011c9
commit
3fcf36f408
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303128
@ -83,7 +83,7 @@ static __inline void
|
||||
vmbus_chan_signal_tx(const struct hv_vmbus_channel *chan)
|
||||
{
|
||||
atomic_set_long(chan->ch_evtflag, chan->ch_evtflag_mask);
|
||||
if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
|
||||
if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF)
|
||||
atomic_set_int(chan->ch_montrig, chan->ch_montrig_mask);
|
||||
else
|
||||
hypercall_signal_event(chan->ch_monprm_dma.hv_paddr);
|
||||
@ -95,7 +95,7 @@ vmbus_chan_sysctl_mnf(SYSCTL_HANDLER_ARGS)
|
||||
struct hv_vmbus_channel *chan = arg1;
|
||||
int mnf = 0;
|
||||
|
||||
if (chan->ch_flags & VMBUS_CHAN_FLAG_HASMNF)
|
||||
if (chan->ch_txflags & VMBUS_CHAN_TXF_HASMNF)
|
||||
mnf = 1;
|
||||
return sysctl_handle_int(oidp, &mnf, 0, req);
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ vmbus_chan_msgproc_choffer(struct vmbus_softc *sc,
|
||||
/*
|
||||
* Setup MNF stuffs.
|
||||
*/
|
||||
chan->ch_flags |= VMBUS_CHAN_FLAG_HASMNF;
|
||||
chan->ch_txflags |= VMBUS_CHAN_TXF_HASMNF;
|
||||
|
||||
trig_idx = offer->chm_montrig / VMBUS_MONTRIG_LEN;
|
||||
if (trig_idx >= VMBUS_MONTRIGS_MAX)
|
||||
|
@ -71,29 +71,13 @@ typedef struct {
|
||||
} hv_vmbus_ring_buffer_info;
|
||||
|
||||
typedef struct hv_vmbus_channel {
|
||||
device_t ch_dev;
|
||||
struct vmbus_softc *ch_vmbus;
|
||||
/*
|
||||
* NOTE:
|
||||
* Fields before ch_txbr are only accessed on this channel's
|
||||
* target CPU.
|
||||
*/
|
||||
uint32_t ch_flags; /* VMBUS_CHAN_FLAG_ */
|
||||
uint32_t ch_id; /* channel id */
|
||||
|
||||
/*
|
||||
* These are based on the vmbus_chanmsg_choffer.chm_montrig.
|
||||
* Save it here for easy access.
|
||||
*/
|
||||
volatile uint32_t *ch_montrig; /* MNF trigger loc. */
|
||||
uint32_t ch_montrig_mask;/* MNF trig mask */
|
||||
|
||||
/*
|
||||
* These are based on the vmbus_chanmsg_choffer.chm_chanid.
|
||||
* Save it here for easy access.
|
||||
*/
|
||||
volatile u_long *ch_evtflag; /* event flag loc. */
|
||||
u_long ch_evtflag_mask;/* event flag */
|
||||
|
||||
/*
|
||||
* TX bufring; at the beginning of ch_bufring.
|
||||
*/
|
||||
hv_vmbus_ring_buffer_info ch_txbr;
|
||||
/*
|
||||
* RX bufring; immediately following ch_txbr.
|
||||
*/
|
||||
@ -104,9 +88,46 @@ typedef struct hv_vmbus_channel {
|
||||
vmbus_chan_callback_t ch_cb;
|
||||
void *ch_cbarg;
|
||||
|
||||
/*
|
||||
* TX bufring; at the beginning of ch_bufring.
|
||||
*
|
||||
* NOTE:
|
||||
* Put TX bufring and the following MNF/evtflag to a new
|
||||
* cacheline, since they will be accessed on all CPUs by
|
||||
* locking ch_txbr first.
|
||||
*
|
||||
* XXX
|
||||
* TX bufring and following MNF/evtflags do _not_ fit in
|
||||
* one 64B cacheline.
|
||||
*/
|
||||
hv_vmbus_ring_buffer_info ch_txbr __aligned(CACHE_LINE_SIZE);
|
||||
uint32_t ch_txflags; /* VMBUS_CHAN_TXF_ */
|
||||
|
||||
/*
|
||||
* These are based on the vmbus_chanmsg_choffer.chm_montrig.
|
||||
* Save it here for easy access.
|
||||
*/
|
||||
uint32_t ch_montrig_mask;/* MNF trig mask */
|
||||
volatile uint32_t *ch_montrig; /* MNF trigger loc. */
|
||||
|
||||
/*
|
||||
* These are based on the vmbus_chanmsg_choffer.chm_chanid.
|
||||
* Save it here for easy access.
|
||||
*/
|
||||
u_long ch_evtflag_mask;/* event flag */
|
||||
volatile u_long *ch_evtflag; /* event flag loc. */
|
||||
|
||||
/*
|
||||
* Rarely used fields.
|
||||
*/
|
||||
|
||||
struct hyperv_mon_param *ch_monprm;
|
||||
struct hyperv_dma ch_monprm_dma;
|
||||
|
||||
uint32_t ch_id; /* channel id */
|
||||
device_t ch_dev;
|
||||
struct vmbus_softc *ch_vmbus;
|
||||
|
||||
int ch_cpuid; /* owner cpu */
|
||||
/*
|
||||
* Virtual cpuid for ch_cpuid; it is used to communicate cpuid
|
||||
@ -141,11 +162,10 @@ typedef struct hv_vmbus_channel {
|
||||
struct hyperv_guid ch_guid_inst;
|
||||
|
||||
struct sysctl_ctx_list ch_sysctl_ctx;
|
||||
} hv_vmbus_channel;
|
||||
} hv_vmbus_channel __aligned(CACHE_LINE_SIZE);
|
||||
|
||||
#define VMBUS_CHAN_ISPRIMARY(chan) ((chan)->ch_subidx == 0)
|
||||
|
||||
#define VMBUS_CHAN_FLAG_HASMNF 0x0001
|
||||
/*
|
||||
* If this flag is set, this channel's interrupt will be masked in ISR,
|
||||
* and the RX bufring will be drained before this channel's interrupt is
|
||||
@ -156,6 +176,8 @@ typedef struct hv_vmbus_channel {
|
||||
*/
|
||||
#define VMBUS_CHAN_FLAG_BATCHREAD 0x0002
|
||||
|
||||
#define VMBUS_CHAN_TXF_HASMNF 0x0001
|
||||
|
||||
#define VMBUS_CHAN_ST_OPENED_SHIFT 0
|
||||
#define VMBUS_CHAN_ST_OPENED (1 << VMBUS_CHAN_ST_OPENED_SHIFT)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user