netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] bnx2x: small fixes
@ 2015-08-10  9:49 Yuval Mintz
  2015-08-10  9:49 ` [PATCH net 1/2] bnx2x: Prevent null pointer dereference on SKB release Yuval Mintz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuval Mintz @ 2015-08-10  9:49 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ariel.Elior, Yuval Mintz

This adds 2 small fixes, one to error flows during memory release
and the other to flash writes via ethtool API.

Dave,

Please consider applying this series to `net'.

Thanks,
Yuval
-- 
1.8.3.1

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

* [PATCH net 1/2] bnx2x: Prevent null pointer dereference on SKB release
  2015-08-10  9:49 [PATCH net 0/2] bnx2x: small fixes Yuval Mintz
@ 2015-08-10  9:49 ` Yuval Mintz
  2015-08-10  9:49 ` [PATCH net 2/2] bnx2x: Free NVRAM lock at end of each page Yuval Mintz
  2015-08-10 21:32 ` [PATCH net 0/2] bnx2x: small fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Mintz @ 2015-08-10  9:49 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ariel.Elior, Yuval Mintz

On error flows its possible to free an SKB even if it was not allocated.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index a90d736..f7fbdc9 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -262,9 +262,9 @@ static u16 bnx2x_free_tx_pkt(struct bnx2x *bp, struct bnx2x_fp_txdata *txdata,
 	if (likely(skb)) {
 		(*pkts_compl)++;
 		(*bytes_compl) += skb->len;
+		dev_kfree_skb_any(skb);
 	}
 
-	dev_kfree_skb_any(skb);
 	tx_buf->first_bd = 0;
 	tx_buf->skb = NULL;
 
-- 
1.9.3

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

* [PATCH net 2/2] bnx2x: Free NVRAM lock at end of each page
  2015-08-10  9:49 [PATCH net 0/2] bnx2x: small fixes Yuval Mintz
  2015-08-10  9:49 ` [PATCH net 1/2] bnx2x: Prevent null pointer dereference on SKB release Yuval Mintz
@ 2015-08-10  9:49 ` Yuval Mintz
  2015-08-10 21:32 ` [PATCH net 0/2] bnx2x: small fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuval Mintz @ 2015-08-10  9:49 UTC (permalink / raw)
  To: davem, netdev; +Cc: Ariel.Elior, Yuval Mintz

Writing each 4Kb page into flash might take up-to ~100 miliseconds,
during which time management firmware cannot acces the nvram for its
own uses.

Firmware upgrade utility use the ethtool API to burn new flash images
for the device via the ethtool API, doing so by writing several page-worth
of data on each command. Such action might create problems for the
management firmware, as the nvram might not be accessible for a long time.

This patch changes the write implementation, releasing the nvram lock on
the completion of each page, allowing the management firmware time to
claim it and perform its own required actions.

Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: Ariel Elior <Ariel.Elior@qlogic.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 76b9052..5907c82 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1718,6 +1718,22 @@ static int bnx2x_nvram_write(struct bnx2x *bp, u32 offset, u8 *data_buf,
 		offset += sizeof(u32);
 		data_buf += sizeof(u32);
 		written_so_far += sizeof(u32);
+
+		/* At end of each 4Kb page, release nvram lock to allow MFW
+		 * chance to take it for its own use.
+		 */
+		if ((cmd_flags & MCPR_NVM_COMMAND_LAST) &&
+		    (written_so_far < buf_size)) {
+			DP(BNX2X_MSG_ETHTOOL | BNX2X_MSG_NVM,
+			   "Releasing NVM lock after offset 0x%x\n",
+			   (u32)(offset - sizeof(u32)));
+			bnx2x_release_nvram_lock(bp);
+			usleep_range(1000, 2000);
+			rc = bnx2x_acquire_nvram_lock(bp);
+			if (rc)
+				return rc;
+		}
+
 		cmd_flags = 0;
 	}
 
-- 
1.9.3

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

* Re: [PATCH net 0/2] bnx2x: small fixes
  2015-08-10  9:49 [PATCH net 0/2] bnx2x: small fixes Yuval Mintz
  2015-08-10  9:49 ` [PATCH net 1/2] bnx2x: Prevent null pointer dereference on SKB release Yuval Mintz
  2015-08-10  9:49 ` [PATCH net 2/2] bnx2x: Free NVRAM lock at end of each page Yuval Mintz
@ 2015-08-10 21:32 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-08-10 21:32 UTC (permalink / raw)
  To: Yuval.Mintz; +Cc: netdev, Ariel.Elior

From: Yuval Mintz <Yuval.Mintz@qlogic.com>
Date: Mon, 10 Aug 2015 12:49:34 +0300

> This adds 2 small fixes, one to error flows during memory release
> and the other to flash writes via ethtool API.

Series applied, thanks.

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

end of thread, other threads:[~2015-08-10 21:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10  9:49 [PATCH net 0/2] bnx2x: small fixes Yuval Mintz
2015-08-10  9:49 ` [PATCH net 1/2] bnx2x: Prevent null pointer dereference on SKB release Yuval Mintz
2015-08-10  9:49 ` [PATCH net 2/2] bnx2x: Free NVRAM lock at end of each page Yuval Mintz
2015-08-10 21:32 ` [PATCH net 0/2] bnx2x: small fixes 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).