提交 ac0b715e 编写于 作者: Z Zhu Yanjun 提交者: David S. Miller

forcedeth: optimize the rx with likely

In the rx fastpath, the function netdev_alloc_skb rarely fails.
Therefore, a likely() optimization is added to this error check
conditional.

CC: Srinivas Eeda <srinivas.eeda@oracle.com>
CC: Joe Jin <joe.jin@oracle.com>
CC: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: NZhu Yanjun <yanjun.zhu@oracle.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d36f45e5
...@@ -1817,7 +1817,7 @@ static int nv_alloc_rx(struct net_device *dev) ...@@ -1817,7 +1817,7 @@ static int nv_alloc_rx(struct net_device *dev)
while (np->put_rx.orig != less_rx) { while (np->put_rx.orig != less_rx) {
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD); struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
if (skb) { if (likely(skb)) {
np->put_rx_ctx->skb = skb; np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev, np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
skb->data, skb->data,
...@@ -1858,7 +1858,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev) ...@@ -1858,7 +1858,7 @@ static int nv_alloc_rx_optimized(struct net_device *dev)
while (np->put_rx.ex != less_rx) { while (np->put_rx.ex != less_rx) {
struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD); struct sk_buff *skb = netdev_alloc_skb(dev, np->rx_buf_sz + NV_RX_ALLOC_PAD);
if (skb) { if (likely(skb)) {
np->put_rx_ctx->skb = skb; np->put_rx_ctx->skb = skb;
np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev, np->put_rx_ctx->dma = dma_map_single(&np->pci_dev->dev,
skb->data, skb->data,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册