diff mbox

[net-next] bnx2x: stop using on-stack napi struct

Message ID 1320163450.11011.19.camel@lb-tlvb-ariel.il.broadcom.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Ariel Elior Nov. 1, 2011, 4:04 p.m. UTC
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(-)

 /* free skb in the packet ring at pos idx

Comments

David Miller Nov. 2, 2011, 5 a.m. UTC | #1
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. :-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
 }