提交 f7f13b0b 编写于 作者: B Ben Hutchings 提交者: Jeff Garzik

sfc: Simplified efx_rx_calc_buffer_size() using get_order()

Merged it into its only caller, efx_init_channels().
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 91ad757c
...@@ -317,26 +317,6 @@ static void efx_remove_eventq(struct efx_channel *channel) ...@@ -317,26 +317,6 @@ static void efx_remove_eventq(struct efx_channel *channel)
* *
*************************************************************************/ *************************************************************************/
/* Setup per-NIC RX buffer parameters.
* Calculate the rx buffer allocation parameters required to support
* the current MTU, including padding for header alignment and overruns.
*/
static void efx_calc_rx_buffer_params(struct efx_nic *efx)
{
unsigned int order, len;
len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
efx->type->rx_buffer_padding);
/* Calculate page-order */
for (order = 0; ((1u << order) * PAGE_SIZE) < len; ++order)
;
efx->rx_buffer_len = len;
efx->rx_buffer_order = order;
}
static int efx_probe_channel(struct efx_channel *channel) static int efx_probe_channel(struct efx_channel *channel)
{ {
struct efx_tx_queue *tx_queue; struct efx_tx_queue *tx_queue;
...@@ -387,7 +367,14 @@ static int efx_init_channels(struct efx_nic *efx) ...@@ -387,7 +367,14 @@ static int efx_init_channels(struct efx_nic *efx)
struct efx_channel *channel; struct efx_channel *channel;
int rc = 0; int rc = 0;
efx_calc_rx_buffer_params(efx); /* Calculate the rx buffer allocation parameters required to
* support the current MTU, including padding for header
* alignment and overruns.
*/
efx->rx_buffer_len = (max(EFX_PAGE_IP_ALIGN, NET_IP_ALIGN) +
EFX_MAX_FRAME_LEN(efx->net_dev->mtu) +
efx->type->rx_buffer_padding);
efx->rx_buffer_order = get_order(efx->rx_buffer_len);
/* Initialise the channels */ /* Initialise the channels */
efx_for_each_channel(channel, efx) { efx_for_each_channel(channel, efx) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册