net/sfc/base: round number of queue buffers up
Functions efx_*q_nbufs return the number of a queue buffers by dividing the queue size by page size. If minimum size of a queue is smaller than one page, we still need the page and number of buffers should not be 0. Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
parent
d6b55d5682
commit
b914326157
@ -188,7 +188,7 @@ efx_evq_nbufs(
|
|||||||
__in const efx_nic_t *enp,
|
__in const efx_nic_t *enp,
|
||||||
__in unsigned int ndescs)
|
__in unsigned int ndescs)
|
||||||
{
|
{
|
||||||
return (efx_evq_size(enp, ndescs) / EFX_BUF_SIZE);
|
return (EFX_DIV_ROUND_UP(efx_evq_size(enp, ndescs), EFX_BUF_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -781,7 +781,7 @@ efx_rxq_nbufs(
|
|||||||
__in const efx_nic_t *enp,
|
__in const efx_nic_t *enp,
|
||||||
__in unsigned int ndescs)
|
__in unsigned int ndescs)
|
||||||
{
|
{
|
||||||
return (efx_rxq_size(enp, ndescs) / EFX_BUF_SIZE);
|
return (EFX_DIV_ROUND_UP(efx_rxq_size(enp, ndescs), EFX_BUF_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -312,7 +312,7 @@ efx_txq_nbufs(
|
|||||||
__in const efx_nic_t *enp,
|
__in const efx_nic_t *enp,
|
||||||
__in unsigned int ndescs)
|
__in unsigned int ndescs)
|
||||||
{
|
{
|
||||||
return (efx_txq_size(enp, ndescs) / EFX_BUF_SIZE);
|
return (EFX_DIV_ROUND_UP(efx_txq_size(enp, ndescs), EFX_BUF_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
__checkReturn efx_rc_t
|
__checkReturn efx_rc_t
|
||||||
|
Loading…
Reference in New Issue
Block a user