Commit 2a3f2790 authored by Brice Goglin's avatar Brice Goglin Committed by David S. Miller

myri10ge: optimize 4k-boundary check when stocking rx pages

Small optimization to the code which checks to see if we'd cross
a 4K boundary when stocking RX ring.
Signed-off-by: default avatarBrice Goglin <brice@myri.com>
Signed-off-by: default avatarAndrew Gallatin <gallatin@myri.com>
Signed-off-by: default avatarGuillaume Morin <guillaume@morinfr.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 45bb0060
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#include "myri10ge_mcp.h" #include "myri10ge_mcp.h"
#include "myri10ge_mcp_gen_header.h" #include "myri10ge_mcp_gen_header.h"
#define MYRI10GE_VERSION_STR "1.5.1-1.453" #define MYRI10GE_VERSION_STR "1.5.2-1.459"
MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
MODULE_AUTHOR("Maintainer: help@myri.com"); MODULE_AUTHOR("Maintainer: help@myri.com");
...@@ -1200,6 +1200,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, ...@@ -1200,6 +1200,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
{ {
struct page *page; struct page *page;
int idx; int idx;
#if MYRI10GE_ALLOC_SIZE > 4096
int end_offset;
#endif
if (unlikely(rx->watchdog_needed && !watchdog)) if (unlikely(rx->watchdog_needed && !watchdog))
return; return;
...@@ -1241,9 +1244,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx, ...@@ -1241,9 +1244,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
#if MYRI10GE_ALLOC_SIZE > 4096 #if MYRI10GE_ALLOC_SIZE > 4096
/* don't cross a 4KB boundary */ /* don't cross a 4KB boundary */
if ((rx->page_offset >> 12) != end_offset = rx->page_offset + bytes - 1;
((rx->page_offset + bytes - 1) >> 12)) if ((unsigned)(rx->page_offset ^ end_offset) > 4095)
rx->page_offset = (rx->page_offset + 4096) & ~4095; rx->page_offset = end_offset & ~4095;
#endif #endif
rx->fill_cnt++; rx->fill_cnt++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment