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

sfc: Merged efx_page_offset() into efx_rx_buf_offset()

Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
上级 55668611
...@@ -86,16 +86,12 @@ static unsigned int rx_refill_limit = 95; ...@@ -86,16 +86,12 @@ static unsigned int rx_refill_limit = 95;
*/ */
#define EFX_RXD_HEAD_ROOM 2 #define EFX_RXD_HEAD_ROOM 2
static inline unsigned int efx_page_offset(void *p)
{
return (__force unsigned int)p & (PAGE_SIZE - 1);
}
static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf) static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf)
{ {
/* Offset is always within one page, so we don't need to consider /* Offset is always within one page, so we don't need to consider
* the page order. * the page order.
*/ */
return efx_page_offset(buf->data); return (__force unsigned long) buf->data & (PAGE_SIZE - 1);
} }
static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
{ {
...@@ -291,10 +287,10 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue, ...@@ -291,10 +287,10 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
EFX_PAGE_IP_ALIGN); EFX_PAGE_IP_ALIGN);
} }
offset = efx_page_offset(rx_queue->buf_data);
rx_buf->len = bytes; rx_buf->len = bytes;
rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
rx_buf->data = rx_queue->buf_data; rx_buf->data = rx_queue->buf_data;
offset = efx_rx_buf_offset(rx_buf);
rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
/* Try to pack multiple buffers per page */ /* Try to pack multiple buffers per page */
if (efx->rx_buffer_order == 0) { if (efx->rx_buffer_order == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册