* [PATCH -next 1/3] bnx2: Add GRO support. @ 2010-05-05 5:21 Michael Chan 2010-05-05 5:21 ` [PATCH -next 2/3] bnx2: Add prefetches to rx path Michael Chan 2010-05-05 7:49 ` [PATCH -next 1/3] bnx2: Add GRO support David Miller 0 siblings, 2 replies; 5+ messages in thread From: Michael Chan @ 2010-05-05 5:21 UTC (permalink / raw) To: davem; +Cc: netdev Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Matt Carlson <mcarlson@broadcom.com> --- drivers/net/bnx2.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index ab26bbc..6ad3184 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -3207,10 +3207,10 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) #ifdef BCM_VLAN if (hw_vlan) - vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag); + vlan_gro_receive(&bnapi->napi, bp->vlgrp, vtag, skb); else #endif - netif_receive_skb(skb); + napi_gro_receive(&bnapi->napi, skb); rx_pkt++; -- 1.6.4.GIT ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH -next 2/3] bnx2: Add prefetches to rx path. 2010-05-05 5:21 [PATCH -next 1/3] bnx2: Add GRO support Michael Chan @ 2010-05-05 5:21 ` Michael Chan 2010-05-05 5:45 ` Eric Dumazet 2010-05-05 7:49 ` [PATCH -next 1/3] bnx2: Add GRO support David Miller 1 sibling, 1 reply; 5+ messages in thread From: Michael Chan @ 2010-05-05 5:21 UTC (permalink / raw) To: davem; +Cc: netdev Add prefetches of the skb and the next rx descriptor to speed up rx path. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: Matt Carlson <mcarlson@broadcom.com> --- drivers/net/bnx2.c | 12 +++++++++--- drivers/net/bnx2.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 6ad3184..cdee29b 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -2719,6 +2719,7 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index) } rx_buf->skb = skb; + rx_buf->desc = (struct l2_fhdr *) skb->data; dma_unmap_addr_set(rx_buf, mapping, mapping); rxbd->rx_bd_haddr_hi = (u64) mapping >> 32; @@ -2941,6 +2942,7 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, rxr->rx_prod_bseq += bp->rx_buf_use_size; prod_rx_buf->skb = skb; + prod_rx_buf->desc = (struct l2_fhdr *) skb->data; if (cons == prod) return; @@ -3086,7 +3088,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) while (sw_cons != hw_cons) { unsigned int len, hdr_len; u32 status; - struct sw_bd *rx_buf; + struct sw_bd *rx_buf, *next_rx_buf; struct sk_buff *skb; dma_addr_t dma_addr; u16 vtag = 0; @@ -3097,7 +3099,11 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) rx_buf = &rxr->rx_buf_ring[sw_ring_cons]; skb = rx_buf->skb; + prefetch(skb); + next_rx_buf = + &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))]; + prefetch(next_rx_buf->desc); rx_buf->skb = NULL; dma_addr = dma_unmap_addr(rx_buf, mapping); @@ -3106,7 +3112,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) BNX2_RX_OFFSET + BNX2_RX_COPY_THRESH, PCI_DMA_FROMDEVICE); - rx_hdr = (struct l2_fhdr *) skb->data; + rx_hdr = rx_buf->desc; len = rx_hdr->l2_fhdr_pkt_len; status = rx_hdr->l2_fhdr_status; @@ -5764,7 +5770,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) rx_buf = &rxr->rx_buf_ring[rx_start_idx]; rx_skb = rx_buf->skb; - rx_hdr = (struct l2_fhdr *) rx_skb->data; + rx_hdr = rx_buf->desc; skb_reserve(rx_skb, BNX2_RX_OFFSET); pci_dma_sync_single_for_cpu(bp->pdev, diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h index ab34a5d..dd35bd0 100644 --- a/drivers/net/bnx2.h +++ b/drivers/net/bnx2.h @@ -6551,6 +6551,7 @@ struct l2_fhdr { struct sw_bd { struct sk_buff *skb; + struct l2_fhdr *desc; DEFINE_DMA_UNMAP_ADDR(mapping); }; -- 1.6.4.GIT ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next 2/3] bnx2: Add prefetches to rx path. 2010-05-05 5:21 ` [PATCH -next 2/3] bnx2: Add prefetches to rx path Michael Chan @ 2010-05-05 5:45 ` Eric Dumazet 2010-05-05 15:01 ` Michael Chan 0 siblings, 1 reply; 5+ messages in thread From: Eric Dumazet @ 2010-05-05 5:45 UTC (permalink / raw) To: Michael Chan; +Cc: davem, netdev Le mardi 04 mai 2010 à 22:21 -0700, Michael Chan a écrit : > Add prefetches of the skb and the next rx descriptor to speed up rx path. > > Signed-off-by: Michael Chan <mchan@broadcom.com> > Signed-off-by: Matt Carlson <mcarlson@broadcom.com> > --- > drivers/net/bnx2.c | 12 +++++++++--- > drivers/net/bnx2.h | 1 + > 2 files changed, 10 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c > index 6ad3184..cdee29b 100644 > --- a/drivers/net/bnx2.c > +++ b/drivers/net/bnx2.c > @@ -2719,6 +2719,7 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index) > } > > rx_buf->skb = skb; > + rx_buf->desc = (struct l2_fhdr *) skb->data; > dma_unmap_addr_set(rx_buf, mapping, mapping); > > rxbd->rx_bd_haddr_hi = (u64) mapping >> 32; > @@ -2941,6 +2942,7 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, > rxr->rx_prod_bseq += bp->rx_buf_use_size; > > prod_rx_buf->skb = skb; > + prod_rx_buf->desc = (struct l2_fhdr *) skb->data; > > if (cons == prod) > return; > @@ -3086,7 +3088,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) > while (sw_cons != hw_cons) { > unsigned int len, hdr_len; > u32 status; > - struct sw_bd *rx_buf; > + struct sw_bd *rx_buf, *next_rx_buf; > struct sk_buff *skb; > dma_addr_t dma_addr; > u16 vtag = 0; > @@ -3097,7 +3099,11 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) > > rx_buf = &rxr->rx_buf_ring[sw_ring_cons]; > skb = rx_buf->skb; > + prefetch(skb); why not a prefetchw() ? > > + next_rx_buf = > + &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))]; > + prefetch(next_rx_buf->desc); So cpu is allowed to start a memory transaction on next_skb->data, while not yes DMA unmapped ? > rx_buf->skb = NULL; > > dma_addr = dma_unmap_addr(rx_buf, mapping); > @@ -3106,7 +3112,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget) > BNX2_RX_OFFSET + BNX2_RX_COPY_THRESH, > PCI_DMA_FROMDEVICE); > > - rx_hdr = (struct l2_fhdr *) skb->data; > + rx_hdr = rx_buf->desc; > len = rx_hdr->l2_fhdr_pkt_len; > status = rx_hdr->l2_fhdr_status; > > @@ -5764,7 +5770,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode) > rx_buf = &rxr->rx_buf_ring[rx_start_idx]; > rx_skb = rx_buf->skb; > > - rx_hdr = (struct l2_fhdr *) rx_skb->data; > + rx_hdr = rx_buf->desc; > skb_reserve(rx_skb, BNX2_RX_OFFSET); > > pci_dma_sync_single_for_cpu(bp->pdev, > diff --git a/drivers/net/bnx2.h b/drivers/net/bnx2.h > index ab34a5d..dd35bd0 100644 > --- a/drivers/net/bnx2.h > +++ b/drivers/net/bnx2.h > @@ -6551,6 +6551,7 @@ struct l2_fhdr { > > struct sw_bd { > struct sk_buff *skb; > + struct l2_fhdr *desc; > DEFINE_DMA_UNMAP_ADDR(mapping); > }; > It seems there are two parts in this patch, one caching skb->data in sw_bd, and prefetches... ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next 2/3] bnx2: Add prefetches to rx path. 2010-05-05 5:45 ` Eric Dumazet @ 2010-05-05 15:01 ` Michael Chan 0 siblings, 0 replies; 5+ messages in thread From: Michael Chan @ 2010-05-05 15:01 UTC (permalink / raw) To: 'Eric Dumazet'; +Cc: davem@davemloft.net, netdev@vger.kernel.org Eric Dumazet wrote: > > @@ -3097,7 +3099,11 @@ bnx2_rx_int(struct bnx2 *bp, struct > bnx2_napi *bnapi, int budget) > > > > rx_buf = &rxr->rx_buf_ring[sw_ring_cons]; > > skb = rx_buf->skb; > > + prefetch(skb); > > why not a prefetchw() ? Yes, didn't know there was a prefetchw() before you pointed it out. > > > > > + next_rx_buf = > > + > &rxr->rx_buf_ring[RX_RING_IDX(NEXT_RX_BD(sw_cons))]; > > + prefetch(next_rx_buf->desc); > > So cpu is allowed to start a memory transaction on > next_skb->data, while > not yes DMA unmapped ? Very good point. The prefetch() will not work and will be wasted on systems that have pci_dma_sync_...() defined. I think we can skip the prefetch if pci_dma_sync_...() is defined. The logic to determine if the next descriptor is ready, dma_sync it, and prefetch it will be complicated and we may end up not gaining any performance in the end. What do you think? Thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next 1/3] bnx2: Add GRO support. 2010-05-05 5:21 [PATCH -next 1/3] bnx2: Add GRO support Michael Chan 2010-05-05 5:21 ` [PATCH -next 2/3] bnx2: Add prefetches to rx path Michael Chan @ 2010-05-05 7:49 ` David Miller 1 sibling, 0 replies; 5+ messages in thread From: David Miller @ 2010-05-05 7:49 UTC (permalink / raw) To: mchan; +Cc: netdev From: "Michael Chan" <mchan@broadcom.com> Date: Tue, 4 May 2010 22:21:44 -0700 > Signed-off-by: Michael Chan <mchan@broadcom.com> > Signed-off-by: Matt Carlson <mcarlson@broadcom.com> Please turn it on by default by setting NETIF_F_GRO in your probe routine. I don't want a precedent started where we have drivers that support GRO but don't enable it by default. If there are some performance degradations, we fix them instead of deferring the issue by not enabling it by default in some awkward selection of drivers. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-05-05 15:01 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-05-05 5:21 [PATCH -next 1/3] bnx2: Add GRO support Michael Chan 2010-05-05 5:21 ` [PATCH -next 2/3] bnx2: Add prefetches to rx path Michael Chan 2010-05-05 5:45 ` Eric Dumazet 2010-05-05 15:01 ` Michael Chan 2010-05-05 7:49 ` [PATCH -next 1/3] bnx2: Add GRO support David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).