* [PATCH net 0/2] bnxt_en: 2 bug fixes.
@ 2016-05-04 20:56 Michael Chan
2016-05-04 20:56 ` [PATCH net 1/2] bnxt_en: Need memory barrier when processing the completion ring Michael Chan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michael Chan @ 2016-05-04 20:56 UTC (permalink / raw)
To: davem; +Cc: netdev
Fix crash on ppc64 due to missing memory barrier and restore multicast
after reset.
Michael Chan (2):
bnxt_en: Need memory barrier when processing the completion ring.
bnxt_en: Setup multicast properly after resetting device.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] bnxt_en: Need memory barrier when processing the completion ring.
2016-05-04 20:56 [PATCH net 0/2] bnxt_en: 2 bug fixes Michael Chan
@ 2016-05-04 20:56 ` Michael Chan
2016-05-04 20:56 ` [PATCH net 2/2] bnxt_en: Setup multicast properly after resetting device Michael Chan
2016-05-04 21:12 ` [PATCH net 0/2] bnxt_en: 2 bug fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2016-05-04 20:56 UTC (permalink / raw)
To: davem; +Cc: netdev
The code determines if the next ring entry is valid before proceeding
further to read the rest of the entry. The CPU can re-order and read
the rest of the entry first, possibly reading a stale entry, if DMA
of a new entry happens right after reading it. This issue can be
readily seen on a ppc64 system, causing it to crash.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 72eb29e..f33ff20 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1388,6 +1388,10 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
if (!TX_CMP_VALID(txcmp, raw_cons))
break;
+ /* The valid test of the entry must be done first before
+ * reading any further.
+ */
+ rmb();
if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
tx_pkts++;
/* return full budget so NAPI will complete. */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] bnxt_en: Setup multicast properly after resetting device.
2016-05-04 20:56 [PATCH net 0/2] bnxt_en: 2 bug fixes Michael Chan
2016-05-04 20:56 ` [PATCH net 1/2] bnxt_en: Need memory barrier when processing the completion ring Michael Chan
@ 2016-05-04 20:56 ` Michael Chan
2016-05-04 21:12 ` [PATCH net 0/2] bnxt_en: 2 bug fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Michael Chan @ 2016-05-04 20:56 UTC (permalink / raw)
To: davem; +Cc: netdev
The multicast/all-multicast internal flags are not properly restored
after device reset. This could lead to unreliable multicast operations
after an ethtool configuration change for example.
Call bnxt_mc_list_updated() and setup the vnic->mask in bnxt_init_chip()
to fix the issue.
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index f33ff20..9d4e8e1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4042,9 +4042,11 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
}
static int bnxt_cfg_rx_mode(struct bnxt *);
+static bool bnxt_mc_list_updated(struct bnxt *, u32 *);
static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
{
+ struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
int rc = 0;
if (irq_re_init) {
@@ -4100,13 +4102,22 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init)
netdev_err(bp->dev, "HWRM vnic filter failure rc: %x\n", rc);
goto err_out;
}
- bp->vnic_info[0].uc_filter_count = 1;
+ vnic->uc_filter_count = 1;
- bp->vnic_info[0].rx_mask = CFA_L2_SET_RX_MASK_REQ_MASK_BCAST;
+ vnic->rx_mask = CFA_L2_SET_RX_MASK_REQ_MASK_BCAST;
if ((bp->dev->flags & IFF_PROMISC) && BNXT_PF(bp))
- bp->vnic_info[0].rx_mask |=
- CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
+ vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS;
+
+ if (bp->dev->flags & IFF_ALLMULTI) {
+ vnic->rx_mask |= CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST;
+ vnic->mc_list_count = 0;
+ } else {
+ u32 mask = 0;
+
+ bnxt_mc_list_updated(bp, &mask);
+ vnic->rx_mask |= mask;
+ }
rc = bnxt_cfg_rx_mode(bp);
if (rc)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] bnxt_en: 2 bug fixes.
2016-05-04 20:56 [PATCH net 0/2] bnxt_en: 2 bug fixes Michael Chan
2016-05-04 20:56 ` [PATCH net 1/2] bnxt_en: Need memory barrier when processing the completion ring Michael Chan
2016-05-04 20:56 ` [PATCH net 2/2] bnxt_en: Setup multicast properly after resetting device Michael Chan
@ 2016-05-04 21:12 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2016-05-04 21:12 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
From: Michael Chan <michael.chan@broadcom.com>
Date: Wed, 4 May 2016 16:56:42 -0400
> Fix crash on ppc64 due to missing memory barrier and restore multicast
> after reset.
Looks good, series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-04 21:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-04 20:56 [PATCH net 0/2] bnxt_en: 2 bug fixes Michael Chan
2016-05-04 20:56 ` [PATCH net 1/2] bnxt_en: Need memory barrier when processing the completion ring Michael Chan
2016-05-04 20:56 ` [PATCH net 2/2] bnxt_en: Setup multicast properly after resetting device Michael Chan
2016-05-04 21:12 ` [PATCH net 0/2] bnxt_en: 2 bug 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).