netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/13] cxgb3 - use immediate data for offload Tx
@ 2007-08-11  6:29 Divy Le Ray
  2007-08-14  5:43 ` Jeff Garzik
  0 siblings, 1 reply; 3+ messages in thread
From: Divy Le Ray @ 2007-08-11  6:29 UTC (permalink / raw)
  To: jeff; +Cc: netdev, linux-kernel, swise

From: Divy Le Ray <divy@chelsio.com>

Send small TX_DATA work requests as immediate data even when
there are fragments.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
---

 drivers/net/cxgb3/sge.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 9213cda..dca2716 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1182,8 +1182,8 @@ int t3_eth_xmit(struct sk_buff *skb, struct net_device *dev)
  *
  *	Writes a packet as immediate data into a Tx descriptor.  The packet
  *	contains a work request at its beginning.  We must write the packet
- *	carefully so the SGE doesn't read accidentally before it's written in
- *	its entirety.
+ *	carefully so the SGE doesn't read it accidentally before it's written
+ *	in its entirety.
  */
 static inline void write_imm(struct tx_desc *d, struct sk_buff *skb,
 			     unsigned int len, unsigned int gen)
@@ -1191,7 +1191,11 @@ static inline void write_imm(struct tx_desc *d, struct sk_buff *skb,
 	struct work_request_hdr *from = (struct work_request_hdr *)skb->data;
 	struct work_request_hdr *to = (struct work_request_hdr *)d;
 
-	memcpy(&to[1], &from[1], len - sizeof(*from));
+	if (likely(!skb->data_len))
+		memcpy(&to[1], &from[1], len - sizeof(*from));
+	else
+		skb_copy_bits(skb, sizeof(*from), &to[1], len - sizeof(*from));
+
 	to->wr_hi = from->wr_hi | htonl(F_WR_SOP | F_WR_EOP |
 					V_WR_BCNTLFLT(len & 7));
 	wmb();
@@ -1261,7 +1265,7 @@ static inline void reclaim_completed_tx_imm(struct sge_txq *q)
 
 static inline int immediate(const struct sk_buff *skb)
 {
-	return skb->len <= WR_LEN && !skb->data_len;
+	return skb->len <= WR_LEN;
 }
 
 /**
@@ -1467,12 +1471,13 @@ static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb,
  */
 static inline unsigned int calc_tx_descs_ofld(const struct sk_buff *skb)
 {
-	unsigned int flits, cnt = skb_shinfo(skb)->nr_frags;
+	unsigned int flits, cnt;
 
-	if (skb->len <= WR_LEN && cnt == 0)
+	if (skb->len <= WR_LEN)
 		return 1;	/* packet fits as immediate data */
 
 	flits = skb_transport_offset(skb) / 8;	/* headers */
+	cnt = skb_shinfo(skb)->nr_frags;
 	if (skb->tail != skb->transport_header)
 		cnt++;
 	return flits_to_desc(flits + sgl_len(cnt));

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/13] cxgb3 - use immediate data for offload Tx
  2007-08-11  6:29 [PATCH 4/13] cxgb3 - use immediate data for offload Tx Divy Le Ray
@ 2007-08-14  5:43 ` Jeff Garzik
  2007-08-14 23:25   ` Divy Le Ray
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2007-08-14  5:43 UTC (permalink / raw)
  To: Divy Le Ray; +Cc: netdev, linux-kernel, swise

Divy Le Ray wrote:
> From: Divy Le Ray <divy@chelsio.com>
> 
> Send small TX_DATA work requests as immediate data even when
> there are fragments.
> 
> Signed-off-by: Divy Le Ray <divy@chelsio.com>
> ---
> 
>  drivers/net/cxgb3/sge.c |   17 +++++++++++------
>  1 files changed, 11 insertions(+), 6 deletions(-)

needs additional explanation.  don't just describe the new post-change 
behavior, describe why this change is needed.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 4/13] cxgb3 - use immediate data for offload Tx
  2007-08-14  5:43 ` Jeff Garzik
@ 2007-08-14 23:25   ` Divy Le Ray
  0 siblings, 0 replies; 3+ messages in thread
From: Divy Le Ray @ 2007-08-14 23:25 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, linux-kernel, Steve Wise

Jeff Garzik wrote:
>
> Divy Le Ray wrote:
> > From: Divy Le Ray <divy@chelsio.com>
> >
> > Send small TX_DATA work requests as immediate data even when
> > there are fragments.
> >
> > Signed-off-by: Divy Le Ray <divy@chelsio.com>
> > ---
> >
> >  drivers/net/cxgb3/sge.c |   17 +++++++++++------
> >  1 files changed, 11 insertions(+), 6 deletions(-)
>
> needs additional explanation.  don't just describe the new post-change
> behavior, describe why this change is needed.
>
>
It's an optimization avoiding doing multiple DMAs for small fragmented 
packets.
The driver already implements this optimization for small contiguous 
packets.

Divy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-14 23:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-11  6:29 [PATCH 4/13] cxgb3 - use immediate data for offload Tx Divy Le Ray
2007-08-14  5:43 ` Jeff Garzik
2007-08-14 23:25   ` Divy Le Ray

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).