From: "Yuval Mintz" <yuvalmin@broadcom.com>
To: davem@davemloft.net, netdev@vger.kernel.org
Cc: ariele@broadcom.com, eilong@broadcom.com,
"Yuval Mintz" <yuvalmin@broadcom.com>
Subject: [PATCH net 2/5] bnx2x: Fix move FP memory deallocations
Date: Wed, 28 Aug 2013 01:13:01 +0300 [thread overview]
Message-ID: <1377641584-2939-3-git-send-email-yuvalmin@broadcom.com> (raw)
In-Reply-To: <1377641584-2939-1-git-send-email-yuvalmin@broadcom.com>
If driver will fail to allocate all queues, it will shrink the number of
queues and move the storage queue to its correct place (i.e., the last
queue among the newly supported number).
When changing the pointers of the new location of the FCoE queue, we need
to pay special attention to the aggregations pointer - that memory is allocated
during probe and released upon driver removal. Current implementation has 2
pointers pointing to the same chunk of allocated memory, meaning upon removal
there will be two kfree() of the same chunk while the other won't be released.
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f2d1ff1..26b4dfc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -53,6 +53,7 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
struct bnx2x_fp_stats *to_fp_stats = &bp->fp_stats[to];
int old_max_eth_txqs, new_max_eth_txqs;
int old_txdata_index = 0, new_txdata_index = 0;
+ struct bnx2x_agg_info *old_tpa_info = to_fp->tpa_info;
/* Copy the NAPI object as it has been already initialized */
from_fp->napi = to_fp->napi;
@@ -61,6 +62,11 @@ static inline void bnx2x_move_fp(struct bnx2x *bp, int from, int to)
memcpy(to_fp, from_fp, sizeof(*to_fp));
to_fp->index = to;
+ /* Retain the tpa_info of the original `to' version as we don't want
+ * 2 FPs to contain the same tpa_info pointer.
+ */
+ to_fp->tpa_info = old_tpa_info;
+
/* move sp_objs contents as well, as their indices match fp ones */
memcpy(to_sp_objs, from_sp_objs, sizeof(*to_sp_objs));
--
1.8.1.227.g44fe835
next prev parent reply other threads:[~2013-08-27 22:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 22:12 [PATCH net 0/5] bnx2x: Bug fixes patch series Yuval Mintz
2013-08-27 22:13 ` [PATCH net 1/5] bnx2x: vf mark stats started Yuval Mintz
2013-08-27 22:13 ` Yuval Mintz [this message]
2013-08-27 22:13 ` [PATCH net 3/5] bnx2x: Fix functionality of configuring vlan list Yuval Mintz
2013-08-27 22:13 ` [PATCH net 4/5] bnx2x: Fix VF memory leak unload Yuval Mintz
2013-08-27 22:13 ` [PATCH net 5/5] bnx2x: Fix VF stats sync Yuval Mintz
2013-08-28 2:04 ` [PATCH net 0/5] bnx2x: Bug fixes patch series David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377641584-2939-3-git-send-email-yuvalmin@broadcom.com \
--to=yuvalmin@broadcom.com \
--cc=ariele@broadcom.com \
--cc=davem@davemloft.net \
--cc=eilong@broadcom.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).