aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/sfc/rx.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/sfc/rx.c b/drivers/net/sfc/rx.c
index f15d33225342..88f87ef5e15f 100644
--- a/drivers/net/sfc/rx.c
+++ b/drivers/net/sfc/rx.c
@@ -86,16 +86,12 @@ static unsigned int rx_refill_limit = 95;
86 */ 86 */
87#define EFX_RXD_HEAD_ROOM 2 87#define EFX_RXD_HEAD_ROOM 2
88 88
89static inline unsigned int efx_page_offset(void *p)
90{
91 return (__force unsigned int)p & (PAGE_SIZE - 1);
92}
93static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf) 89static inline unsigned int efx_rx_buf_offset(struct efx_rx_buffer *buf)
94{ 90{
95 /* Offset is always within one page, so we don't need to consider 91 /* Offset is always within one page, so we don't need to consider
96 * the page order. 92 * the page order.
97 */ 93 */
98 return efx_page_offset(buf->data); 94 return (__force unsigned long) buf->data & (PAGE_SIZE - 1);
99} 95}
100static inline unsigned int efx_rx_buf_size(struct efx_nic *efx) 96static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
101{ 97{
@@ -291,10 +287,10 @@ static inline int efx_init_rx_buffer_page(struct efx_rx_queue *rx_queue,
291 EFX_PAGE_IP_ALIGN); 287 EFX_PAGE_IP_ALIGN);
292 } 288 }
293 289
294 offset = efx_page_offset(rx_queue->buf_data);
295 rx_buf->len = bytes; 290 rx_buf->len = bytes;
296 rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
297 rx_buf->data = rx_queue->buf_data; 291 rx_buf->data = rx_queue->buf_data;
292 offset = efx_rx_buf_offset(rx_buf);
293 rx_buf->dma_addr = rx_queue->buf_dma_addr + offset;
298 294
299 /* Try to pack multiple buffers per page */ 295 /* Try to pack multiple buffers per page */
300 if (efx->rx_buffer_order == 0) { 296 if (efx->rx_buffer_order == 0) {