netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bnx2x: stop using on-stack napi struct
@ 2011-11-01 16:04 Ariel Elior
  2011-11-02  5:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ariel Elior @ 2011-11-01 16:04 UTC (permalink / raw)
  To: davem, netdev; +Cc: eilong

Napi structure was allocated on stack to hold temporary value of copied
fastpath. This can be avoided by using the source fastpath as a
scratchpad thus saving stack space and code.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

---
 drivers/net/bnx2x/bnx2x_cmn.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
b/drivers/net/bnx2x/bnx2x_cmn.c
index 2890443..ff67d9b 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -56,19 +56,21 @@ static inline void bnx2x_bz_fp(struct bnx2x *bp, int
index)
  * @to:                destination FP index
  *
  * Makes sure the contents of the bp->fp[to].napi is kept
- * intact.
+ * intact. This is done by first copying the napi struct from
+ * the target to the source, and then mem copying the entire
+ * source onto the target
  */
 static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
 {
        struct bnx2x_fastpath *from_fp = &bp->fp[from];
        struct bnx2x_fastpath *to_fp = &bp->fp[to];
-       struct napi_struct orig_napi = to_fp->napi;
+
+       /* Copy the NAPI object as it has been already initialized */
+       from_fp->napi = to_fp->napi;
+
        /* Move bnx2x_fastpath contents */
        memcpy(to_fp, from_fp, sizeof(*to_fp));
        to_fp->index = to;
-
-       /* Restore the NAPI object as it has been already initialized */
-       to_fp->napi = orig_napi;
 }
 
 /* free skb in the packet ring at pos idx
-- 
1.7.4.1

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

* Re: [PATCH net-next] bnx2x: stop using on-stack napi struct
  2011-11-01 16:04 [PATCH net-next] bnx2x: stop using on-stack napi struct Ariel Elior
@ 2011-11-02  5:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-11-02  5:00 UTC (permalink / raw)
  To: ariele; +Cc: davem, netdev, eilong

From: "Ariel Elior" <ariele@broadcom.com>
Date: Tue, 1 Nov 2011 18:04:10 +0200

> Napi structure was allocated on stack to hold temporary value of copied
> fastpath. This can be avoided by using the source fastpath as a
> scratchpad thus saving stack space and code.
> Signed-off-by: Ariel Elior <ariele@broadcom.com>
> Signed-off-by: Eilon Greenstein <eilong@broadcom.com>

Your patch has been severely corrupted by your email client.

I'm sure your colleagues at Broadcom can help you fix this
so that you can submit this patch properly. :-)

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

end of thread, other threads:[~2011-11-02  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-01 16:04 [PATCH net-next] bnx2x: stop using on-stack napi struct Ariel Elior
2011-11-02  5:00 ` 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).