hyperv/vmbus: Add functions to test RX/TX bufring emptiness
MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8044
This commit is contained in:
parent
92a85eb9d7
commit
e8223cc6cf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306387
@ -173,5 +173,7 @@ const struct hyperv_guid *
|
||||
vmbus_chan_guid_inst(const struct vmbus_channel *chan);
|
||||
int vmbus_chan_prplist_nelem(int br_size, int prpcnt_max,
|
||||
int dlen_max);
|
||||
bool vmbus_chan_rx_empty(const struct vmbus_channel *chan);
|
||||
bool vmbus_chan_tx_empty(const struct vmbus_channel *chan);
|
||||
|
||||
#endif /* !_VMBUS_H_ */
|
||||
|
@ -83,6 +83,20 @@ vmbus_txbr_maxpktsz(const struct vmbus_txbr *tbr)
|
||||
return (tbr->txbr_dsize - sizeof(uint64_t) - 1);
|
||||
}
|
||||
|
||||
static __inline bool
|
||||
vmbus_txbr_empty(const struct vmbus_txbr *tbr)
|
||||
{
|
||||
|
||||
return (tbr->txbr_windex == tbr->txbr_rindex ? true : false);
|
||||
}
|
||||
|
||||
static __inline bool
|
||||
vmbus_rxbr_empty(const struct vmbus_rxbr *rbr)
|
||||
{
|
||||
|
||||
return (rbr->rxbr_windex == rbr->rxbr_rindex ? true : false);
|
||||
}
|
||||
|
||||
static __inline int
|
||||
vmbus_br_nelem(int br_size, int elem_size)
|
||||
{
|
||||
|
@ -1692,3 +1692,17 @@ vmbus_chan_prplist_nelem(int br_size, int prpcnt_max, int dlen_max)
|
||||
|
||||
return (vmbus_br_nelem(br_size, elem_size));
|
||||
}
|
||||
|
||||
bool
|
||||
vmbus_chan_tx_empty(const struct vmbus_channel *chan)
|
||||
{
|
||||
|
||||
return (vmbus_txbr_empty(&chan->ch_txbr));
|
||||
}
|
||||
|
||||
bool
|
||||
vmbus_chan_rx_empty(const struct vmbus_channel *chan)
|
||||
{
|
||||
|
||||
return (vmbus_rxbr_empty(&chan->ch_rxbr));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user