* [net-next 00/16][pull request] Intel Wired LAN Driver Updates
@ 2014-03-21 12:09 Jeff Kirsher
2014-03-21 12:09 ` [net-next 01/16] i40e/i40evf: Add EEE LPI stats Jeff Kirsher
` (18 more replies)
0 siblings, 19 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann
This series contains updates to igb, ixgbe, ixgbevf, i40e and i40evf.
Anjali provides a i40e/i40evf patch to add Energy Efficient Ethernet
Low Power Idle stats and a fix for i40e to change the string
"Side Band" to "Sideband" for consistency.
Mitch provides 2 patches for i40evf to fix if the driver encounters
an error while communicating with the PF driver, do not shut down the
admin queue unconditionally. Add an error message when the admin
queue message never completes and fix formatting on another message
that was unnecessarily wrapped.
Mark provides a ixgbe patch and five ixgbevf patches. Fix a possible
infinite recursion when an adapter is removed and registers all read
as all one's in ixgbe_clear_vmdq_generic() and ixgbe_clear_rar_generic().
Converts macros to static inline functions to align kernel coding standard
and prepare for adding Live Error Recovery (LER) to ixgbevf. Change the
ethtool register test to use the normal register accessor functions and
eliminate macors used for calling register test functions to make error
exits more clear. Checks all register reads for adapter removal by checking
the status register after any register read that returns all F's since the
status register will never return 0xFFFFFFFF unless the adapter is removed.
Jacob implements SIOCGHWTSTAMP ioctl for igb which enables user processes
to read the current hardware stamp config settings non-destructively.
Todd adds the initial register read and write for surprise removal (LER)
for igb.
Christian Engelmayer fixes an igb memory leak in the igb_get_module_eeprom()
error handling path.
Ken Ichikawa provides a fix for igb, specifically for 82575 hardware to
specify -1 to the phc_index for ethtool's get_ts_info, otherwise a wrong
value will be set to the phc_index.
Christopher Paasch fixes a null pointer dereference in igb and makes sure
to unset the HAS_MSIX flag when the driver falls back to MSI only.
The following are changes since commit a85ae0e97879f51bccd8511668b07d346d98b3eb:
Merge branch 'bcmgenet-next'
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Anjali Singhai Jain (2):
i40e/i40evf: Add EEE LPI stats
i40e: Fix a message string
Christian Engelmayer (1):
igb: Fix memory leak in igb_get_module_eeprom()
Christoph Paasch (2):
igb: Fix Null-pointer dereference in igb_reset_q_vector
igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back
Fujinaka, Todd (1):
igb: add register rd/wr for surprise removal
Jacob Keller (1):
igb: implement SIOCGHWTSTAMP ioctl
Ken ICHIKAWA (1):
igb: specify phc_index of 82575 for get_ts_info
Mark Rustad (6):
ixgbe: Break recursion in case of removal
ixgbevf: Use static inlines instead of macros
ixgbevf: Make the ethtool register test use accessors
ixgbevf: Check register reads for adapter removal
ixgbevf: Check for adapter removal on register writes
ixgbevf: Additional adapter removal checks
Mitch Williams (2):
i40evf: don't shut down admin queue on error
i40evf: clean up init error messages
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 5 +
drivers/net/ethernet/intel/i40e/i40e_main.c | 17 ++-
drivers/net/ethernet/intel/i40e/i40e_type.h | 5 +
drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 +
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +-
drivers/net/ethernet/intel/igb/e1000_regs.h | 21 +++-
drivers/net/ethernet/intel/igb/igb.h | 5 +-
drivers/net/ethernet/intel/igb/igb_ethtool.c | 14 ++-
drivers/net/ethernet/intel/igb/igb_main.c | 33 ++++-
drivers/net/ethernet/intel/igb/igb_ptp.c | 46 ++++---
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 3 +
drivers/net/ethernet/intel/ixgbevf/ethtool.c | 141 ++++++++++++++--------
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 6 +
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 68 ++++++++++-
drivers/net/ethernet/intel/ixgbevf/regs.h | 12 +-
drivers/net/ethernet/intel/ixgbevf/vf.h | 33 ++++-
16 files changed, 321 insertions(+), 102 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 23+ messages in thread
* [net-next 01/16] i40e/i40evf: Add EEE LPI stats
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 02/16] i40e: Fix a message string Jeff Kirsher
` (17 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem
Cc: Anjali Singhai Jain, netdev, gospo, sassmann, Kevin Scott,
Catherine Sullivan, Jeff Kirsher
From: Anjali Singhai Jain <anjali.singhai@intel.com>
Add 4 new stats to keep track of EEE LPI (Low Power Idle) state.
Change-ID: Id6316619bb0559789770288b694a54d17f8fac5c
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Kevin Scott <kevin.c.scott@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 5 +++++
drivers/net/ethernet/intel/i40e/i40e_main.c | 15 +++++++++++++++
drivers/net/ethernet/intel/i40e/i40e_type.h | 5 +++++
drivers/net/ethernet/intel/i40evf/i40e_type.h | 5 +++++
4 files changed, 30 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 6049e63..28da412 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -114,6 +114,11 @@ static struct i40e_stats i40e_gstrings_stats[] = {
I40E_PF_STAT("VF_admin_queue_requests", vf_aq_requests),
I40E_PF_STAT("tx_hwtstamp_timeouts", tx_hwtstamp_timeouts),
I40E_PF_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared),
+ /* LPI stats */
+ I40E_PF_STAT("tx_lpi_status", stats.tx_lpi_status),
+ I40E_PF_STAT("rx_lpi_status", stats.rx_lpi_status),
+ I40E_PF_STAT("tx_lpi_count", stats.tx_lpi_count),
+ I40E_PF_STAT("rx_lpi_count", stats.rx_lpi_count),
};
#define I40E_QUEUE_STATS_LEN(n) \
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 1133542..a1f3369 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -740,6 +740,7 @@ void i40e_update_stats(struct i40e_vsi *vsi)
u32 rx_page, rx_buf;
u64 rx_p, rx_b;
u64 tx_p, tx_b;
+ u32 val;
int i;
u16 q;
@@ -972,6 +973,20 @@ void i40e_update_stats(struct i40e_vsi *vsi)
i40e_stat_update32(hw, I40E_GLPRT_RJC(hw->port),
pf->stat_offsets_loaded,
&osd->rx_jabber, &nsd->rx_jabber);
+
+ val = rd32(hw, I40E_PRTPM_EEE_STAT);
+ nsd->tx_lpi_status =
+ (val & I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_MASK) >>
+ I40E_PRTPM_EEE_STAT_TX_LPI_STATUS_SHIFT;
+ nsd->rx_lpi_status =
+ (val & I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_MASK) >>
+ I40E_PRTPM_EEE_STAT_RX_LPI_STATUS_SHIFT;
+ i40e_stat_update32(hw, I40E_PRTPM_TLPIC,
+ pf->stat_offsets_loaded,
+ &osd->tx_lpi_count, &nsd->tx_lpi_count);
+ i40e_stat_update32(hw, I40E_PRTPM_RLPIC,
+ pf->stat_offsets_loaded,
+ &osd->rx_lpi_count, &nsd->rx_lpi_count);
}
pf->stat_offsets_loaded = true;
diff --git a/drivers/net/ethernet/intel/i40e/i40e_type.h b/drivers/net/ethernet/intel/i40e/i40e_type.h
index 5c902f4..d2f0b95 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_type.h
@@ -1014,6 +1014,11 @@ struct i40e_hw_port_stats {
u64 tx_size_big; /* ptc9522 */
u64 mac_short_packet_dropped; /* mspdc */
u64 checksum_error; /* xec */
+ /* EEE LPI */
+ bool tx_lpi_status;
+ bool rx_lpi_status;
+ u64 tx_lpi_count; /* etlpic */
+ u64 rx_lpi_count; /* erlpic */
};
/* Checksum and Shadow RAM pointers */
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_type.h b/drivers/net/ethernet/intel/i40evf/i40e_type.h
index 7189d6f..efe73ad 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_type.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_type.h
@@ -1020,6 +1020,11 @@ struct i40e_hw_port_stats {
u64 tx_size_big; /* ptc9522 */
u64 mac_short_packet_dropped; /* mspdc */
u64 checksum_error; /* xec */
+ /* EEE LPI */
+ bool tx_lpi_status;
+ bool rx_lpi_status;
+ u64 tx_lpi_count; /* etlpic */
+ u64 rx_lpi_count; /* erlpic */
};
/* Checksum and Shadow RAM pointers */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 02/16] i40e: Fix a message string
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-21 12:09 ` [net-next 01/16] i40e/i40evf: Add EEE LPI stats Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 03/16] i40evf: don't shut down admin queue on error Jeff Kirsher
` (16 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem
Cc: Anjali Singhai Jain, netdev, gospo, sassmann, Catherine Sullivan,
Jeff Kirsher
From: Anjali Singhai Jain <anjali.singhai@intel.com>
Change string from "Side Band" to "Sideband" for consistency.
Change-ID: I45f05466bb5c63b0f999d743312bcb61b5bd6518
Signed-off-by: Anjali Singhai Jain <anjali.singhai@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Kavindya Deegala <kavindya.s.deegala@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a1f3369..28df88e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6396,7 +6396,7 @@ static int i40e_sw_init(struct i40e_pf *pf)
pf->flags |= I40E_FLAG_FD_SB_ENABLED;
} else {
dev_info(&pf->pdev->dev,
- "Flow Director Side Band mode Disabled in MFP mode\n");
+ "Flow Director Sideband mode Disabled in MFP mode\n");
}
pf->fdir_pf_filter_count =
pf->hw.func_caps.fd_filters_guaranteed;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 03/16] i40evf: don't shut down admin queue on error
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-21 12:09 ` [net-next 01/16] i40e/i40evf: Add EEE LPI stats Jeff Kirsher
2014-03-21 12:09 ` [net-next 02/16] i40e: Fix a message string Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 04/16] i40evf: clean up init error messages Jeff Kirsher
` (15 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem
Cc: Mitch Williams, netdev, gospo, sassmann, Catherine Sullivan,
Jeff Kirsher
From: Mitch Williams <mitch.a.williams@intel.com>
If the driver encounters an error while communicating with the PF
driver, don't just shut down the admin queue unconditionally. The PF
may be delayed, and shutting down the admin queue causes it to fail
completely. If this happens, the VF will never complete initialization.
Change-ID: I6192e9d8caeefb738428c3597fa2f54fa400ce7f
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index d381bcc..4d547ab 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -2133,8 +2133,6 @@ err_alloc:
kfree(adapter->vf_res);
adapter->vf_res = NULL;
err:
- if (hw->aq.asq.count)
- i40evf_shutdown_adminq(hw); /* ignore error */
/* Things went into the weeds, so try again later */
if (++adapter->aq_wait_count > I40EVF_AQ_MAX_ERR) {
dev_err(&pdev->dev, "Failed to communicate with PF; giving up.\n");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 04/16] i40evf: clean up init error messages
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (2 preceding siblings ...)
2014-03-21 12:09 ` [net-next 03/16] i40evf: don't shut down admin queue on error Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 05/16] ixgbe: Break recursion in case of removal Jeff Kirsher
` (14 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem
Cc: Mitch Williams, netdev, gospo, sassmann, Catherine Sullivan,
Jeff Kirsher
From: Mitch Williams <mitch.a.williams@intel.com>
Add an error message when the admin queue message never completes, and
fix formatting on another one that was unnecessarily wrapped.
Change-ID: I8b8a4eb7629d741f09357250144023cd4a72231f
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Catherine Sullivan <catherine.sullivan@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 4d547ab..d3eafa3 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1968,8 +1968,7 @@ static void i40evf_init_task(struct work_struct *work)
}
err = i40evf_send_api_ver(adapter);
if (err) {
- dev_err(&pdev->dev, "Unable to send to PF (%d)\n",
- err);
+ dev_err(&pdev->dev, "Unable to send to PF (%d)\n", err);
i40evf_shutdown_adminq(hw);
goto err;
}
@@ -1977,8 +1976,10 @@ static void i40evf_init_task(struct work_struct *work)
goto restart;
break;
case __I40EVF_INIT_VERSION_CHECK:
- if (!i40evf_asq_done(hw))
+ if (!i40evf_asq_done(hw)) {
+ dev_err(&pdev->dev, "Admin queue command never completed.\n");
goto err;
+ }
/* aq msg sent, awaiting reply */
err = i40evf_verify_api_ver(adapter);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 05/16] ixgbe: Break recursion in case of removal
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (3 preceding siblings ...)
2014-03-21 12:09 ` [net-next 04/16] i40evf: clean up init error messages Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 06/16] ixgbevf: Use static inlines instead of macros Jeff Kirsher
` (13 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
When an adapter is removed and registers all read as all one's,
an infinite recursion can happen between ixgbe_clear_vmdq_generic
and ixgbe_clear_rar_generic. Adding a check for removal breaks
this recursion.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
index 911b711..24fba39 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
@@ -2913,6 +2913,9 @@ s32 ixgbe_clear_vmdq_generic(struct ixgbe_hw *hw, u32 rar, u32 vmdq)
mpsar_lo = IXGBE_READ_REG(hw, IXGBE_MPSAR_LO(rar));
mpsar_hi = IXGBE_READ_REG(hw, IXGBE_MPSAR_HI(rar));
+ if (ixgbe_removed(hw->hw_addr))
+ goto done;
+
if (!mpsar_lo && !mpsar_hi)
goto done;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 06/16] ixgbevf: Use static inlines instead of macros
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (4 preceding siblings ...)
2014-03-21 12:09 ` [net-next 05/16] ixgbe: Break recursion in case of removal Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 07/16] ixgbevf: Make the ethtool register test use accessors Jeff Kirsher
` (12 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Kernel coding standard prefers static inline functions instead
of macros, so use them for register accessors. This is to prepare
for adding LER, Live Error Recovery, checks to those accessors.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 5 ++++
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ++--
drivers/net/ethernet/intel/ixgbevf/regs.h | 12 +---------
drivers/net/ethernet/intel/ixgbevf/vf.h | 28 ++++++++++++++++++++++-
4 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index 08fb88a..d4b1f50 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -315,6 +315,11 @@ static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring)
return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
}
+static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value)
+{
+ writel(value, ring->tail);
+}
+
#define IXGBEVF_RX_DESC(R, i) \
(&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
#define IXGBEVF_TX_DESC(R, i) \
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 592d8a6..74df8bf 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -111,7 +111,7 @@ static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring,
* such as IA-64).
*/
wmb();
- writel(val, rx_ring->tail);
+ ixgbevf_write_tail(rx_ring, val);
}
/**
@@ -3060,7 +3060,7 @@ static void ixgbevf_tx_map(struct ixgbevf_ring *tx_ring,
tx_ring->next_to_use = i;
/* notify HW of packet */
- writel(i, tx_ring->tail);
+ ixgbevf_write_tail(tx_ring, i);
return;
dma_error:
diff --git a/drivers/net/ethernet/intel/ixgbevf/regs.h b/drivers/net/ethernet/intel/ixgbevf/regs.h
index debd8c0..09dd8f6 100644
--- a/drivers/net/ethernet/intel/ixgbevf/regs.h
+++ b/drivers/net/ethernet/intel/ixgbevf/regs.h
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 82599 Virtual Function driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
@@ -70,16 +70,6 @@
#define IXGBE_VFGOTC_MSB 0x02024
#define IXGBE_VFMPRC 0x01034
-#define IXGBE_WRITE_REG(a, reg, value) writel((value), ((a)->hw_addr + (reg)))
-
-#define IXGBE_READ_REG(a, reg) readl((a)->hw_addr + (reg))
-
-#define IXGBE_WRITE_REG_ARRAY(a, reg, offset, value) ( \
- writel((value), ((a)->hw_addr + (reg) + ((offset) << 2))))
-
-#define IXGBE_READ_REG_ARRAY(a, reg, offset) ( \
- readl((a)->hw_addr + (reg) + ((offset) << 2)))
-
#define IXGBE_WRITE_FLUSH(a) (IXGBE_READ_REG(a, IXGBE_VFSTATUS))
#endif /* _IXGBEVF_REGS_H_ */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 7b1f502..8ebed72 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 82599 Virtual Function driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
@@ -172,6 +172,32 @@ struct ixgbevf_info {
const struct ixgbe_mac_operations *mac_ops;
};
+static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
+{
+ writel(value, hw->hw_addr + reg);
+}
+#define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v)
+
+static inline u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
+{
+ return readl(hw->hw_addr + reg);
+}
+#define IXGBE_READ_REG(h, r) ixgbe_read_reg(h, r)
+
+static inline void ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg,
+ u32 offset, u32 value)
+{
+ ixgbe_write_reg(hw, reg + (offset << 2), value);
+}
+#define IXGBE_WRITE_REG_ARRAY(h, r, o, v) ixgbe_write_reg_array(h, r, o, v)
+
+static inline u32 ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg,
+ u32 offset)
+{
+ return ixgbe_read_reg(hw, reg + (offset << 2));
+}
+#define IXGBE_READ_REG_ARRAY(h, r, o) ixgbe_read_reg_array(h, r, o)
+
void ixgbevf_rlpml_set_vf(struct ixgbe_hw *hw, u16 max_size);
int ixgbevf_negotiate_api_version(struct ixgbe_hw *hw, int api);
int ixgbevf_get_queues(struct ixgbe_hw *hw, unsigned int *num_tcs,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 07/16] ixgbevf: Make the ethtool register test use accessors
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (5 preceding siblings ...)
2014-03-21 12:09 ` [net-next 06/16] ixgbevf: Use static inlines instead of macros Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 08/16] ixgbevf: Check register reads for adapter removal Jeff Kirsher
` (11 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Make the ethtool register test use the normal register accessor
functions. Also eliminate macros used for calling register test
functions to make error exits clearer.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ethtool.c | 119 +++++++++++++++------------
1 file changed, 67 insertions(+), 52 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index f68b78c..c769a8d 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -1,7 +1,7 @@
/*******************************************************************************
Intel 82599 Virtual Function driver
- Copyright(c) 1999 - 2012 Intel Corporation.
+ Copyright(c) 1999 - 2014 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
@@ -530,41 +530,47 @@ static const u32 register_test_patterns[] = {
0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF
};
-#define REG_PATTERN_TEST(R, M, W) \
-{ \
- u32 pat, val, before; \
- for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) { \
- before = readl(adapter->hw.hw_addr + R); \
- writel((register_test_patterns[pat] & W), \
- (adapter->hw.hw_addr + R)); \
- val = readl(adapter->hw.hw_addr + R); \
- if (val != (register_test_patterns[pat] & W & M)) { \
- hw_dbg(&adapter->hw, \
- "pattern test reg %04X failed: got " \
- "0x%08X expected 0x%08X\n", \
- R, val, (register_test_patterns[pat] & W & M)); \
- *data = R; \
- writel(before, adapter->hw.hw_addr + R); \
- return 1; \
- } \
- writel(before, adapter->hw.hw_addr + R); \
- } \
+static bool reg_pattern_test(struct ixgbevf_adapter *adapter, u64 *data,
+ int reg, u32 mask, u32 write)
+{
+ u32 pat, val, before;
+
+ for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) {
+ before = ixgbe_read_reg(&adapter->hw, reg);
+ ixgbe_write_reg(&adapter->hw, reg,
+ register_test_patterns[pat] & write);
+ val = ixgbe_read_reg(&adapter->hw, reg);
+ if (val != (register_test_patterns[pat] & write & mask)) {
+ hw_dbg(&adapter->hw,
+ "pattern test reg %04X failed: got 0x%08X expected 0x%08X\n",
+ reg, val,
+ register_test_patterns[pat] & write & mask);
+ *data = reg;
+ ixgbe_write_reg(&adapter->hw, reg, before);
+ return true;
+ }
+ ixgbe_write_reg(&adapter->hw, reg, before);
+ }
+ return false;
}
-#define REG_SET_AND_CHECK(R, M, W) \
-{ \
- u32 val, before; \
- before = readl(adapter->hw.hw_addr + R); \
- writel((W & M), (adapter->hw.hw_addr + R)); \
- val = readl(adapter->hw.hw_addr + R); \
- if ((W & M) != (val & M)) { \
- pr_err("set/check reg %04X test failed: got 0x%08X expected " \
- "0x%08X\n", R, (val & M), (W & M)); \
- *data = R; \
- writel(before, (adapter->hw.hw_addr + R)); \
- return 1; \
- } \
- writel(before, (adapter->hw.hw_addr + R)); \
+static bool reg_set_and_check(struct ixgbevf_adapter *adapter, u64 *data,
+ int reg, u32 mask, u32 write)
+{
+ u32 val, before;
+
+ before = ixgbe_read_reg(&adapter->hw, reg);
+ ixgbe_write_reg(&adapter->hw, reg, write & mask);
+ val = ixgbe_read_reg(&adapter->hw, reg);
+ if ((write & mask) != (val & mask)) {
+ pr_err("set/check reg %04X test failed: got 0x%08X expected 0x%08X\n",
+ reg, (val & mask), write & mask);
+ *data = reg;
+ ixgbe_write_reg(&adapter->hw, reg, before);
+ return true;
+ }
+ ixgbe_write_reg(&adapter->hw, reg, before);
+ return false;
}
static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
@@ -580,38 +586,47 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
*/
while (test->reg) {
for (i = 0; i < test->array_len; i++) {
+ bool b = false;
+
switch (test->test_type) {
case PATTERN_TEST:
- REG_PATTERN_TEST(test->reg + (i * 0x40),
- test->mask,
- test->write);
+ b = reg_pattern_test(adapter, data,
+ test->reg + (i * 0x40),
+ test->mask,
+ test->write);
break;
case SET_READ_TEST:
- REG_SET_AND_CHECK(test->reg + (i * 0x40),
- test->mask,
- test->write);
+ b = reg_set_and_check(adapter, data,
+ test->reg + (i * 0x40),
+ test->mask,
+ test->write);
break;
case WRITE_NO_TEST:
- writel(test->write,
- (adapter->hw.hw_addr + test->reg)
- + (i * 0x40));
+ ixgbe_write_reg(&adapter->hw,
+ test->reg + (i * 0x40),
+ test->write);
break;
case TABLE32_TEST:
- REG_PATTERN_TEST(test->reg + (i * 4),
- test->mask,
- test->write);
+ b = reg_pattern_test(adapter, data,
+ test->reg + (i * 4),
+ test->mask,
+ test->write);
break;
case TABLE64_TEST_LO:
- REG_PATTERN_TEST(test->reg + (i * 8),
- test->mask,
- test->write);
+ b = reg_pattern_test(adapter, data,
+ test->reg + (i * 8),
+ test->mask,
+ test->write);
break;
case TABLE64_TEST_HI:
- REG_PATTERN_TEST((test->reg + 4) + (i * 8),
- test->mask,
- test->write);
+ b = reg_pattern_test(adapter, data,
+ test->reg + 4 + (i * 8),
+ test->mask,
+ test->write);
break;
}
+ if (b)
+ return 1;
}
test++;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 08/16] ixgbevf: Check register reads for adapter removal
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (6 preceding siblings ...)
2014-03-21 12:09 ` [net-next 07/16] ixgbevf: Make the ethtool register test use accessors Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:09 ` [net-next 09/16] ixgbevf: Check for adapter removal on register writes Jeff Kirsher
` (10 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Check all register reads for adapter removal by checking the status
register after any register read that returns 0xFFFFFFFF. Since the
status register will never return 0xFFFFFFFF unless the adapter is
removed, such a value from a status register read confirms the
removal. Since this patch adds so much to ixgbe_read_reg, stop
inlining it, to reduce driver bloat.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ixgbevf.h | 1 +
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 51 +++++++++++++++++++++--
drivers/net/ethernet/intel/ixgbevf/vf.h | 9 ++--
3 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index d4b1f50..a08bd7c 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -406,6 +406,7 @@ struct ixgbevf_adapter {
u64 bp_tx_missed;
#endif
+ u8 __iomem *io_addr; /* Mainly for iounmap use */
u32 link_speed;
bool link_up;
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 74df8bf..37c4ebe 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -99,6 +99,48 @@ static void ixgbevf_queue_reset_subtask(struct ixgbevf_adapter *adapter);
static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector);
static void ixgbevf_free_all_rx_resources(struct ixgbevf_adapter *adapter);
+static void ixgbevf_remove_adapter(struct ixgbe_hw *hw)
+{
+ struct ixgbevf_adapter *adapter = hw->back;
+
+ if (!hw->hw_addr)
+ return;
+ hw->hw_addr = NULL;
+ dev_err(&adapter->pdev->dev, "Adapter removed\n");
+}
+
+static void ixgbevf_check_remove(struct ixgbe_hw *hw, u32 reg)
+{
+ u32 value;
+
+ /* The following check not only optimizes a bit by not
+ * performing a read on the status register when the
+ * register just read was a status register read that
+ * returned IXGBE_FAILED_READ_REG. It also blocks any
+ * potential recursion.
+ */
+ if (reg == IXGBE_VFSTATUS) {
+ ixgbevf_remove_adapter(hw);
+ return;
+ }
+ value = ixgbe_read_reg(hw, IXGBE_VFSTATUS);
+ if (value == IXGBE_FAILED_READ_REG)
+ ixgbevf_remove_adapter(hw);
+}
+
+u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
+{
+ u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
+ u32 value;
+
+ if (IXGBE_REMOVED(reg_addr))
+ return IXGBE_FAILED_READ_REG;
+ value = readl(reg_addr + reg);
+ if (unlikely(value == IXGBE_FAILED_READ_REG))
+ ixgbevf_check_remove(hw, reg);
+ return value;
+}
+
static inline void ixgbevf_release_rx_desc(struct ixgbevf_ring *rx_ring,
u32 val)
{
@@ -1139,7 +1181,7 @@ static void ixgbevf_configure_tx_ring(struct ixgbevf_adapter *adapter,
/* reset head and tail pointers */
IXGBE_WRITE_REG(hw, IXGBE_VFTDH(reg_idx), 0);
IXGBE_WRITE_REG(hw, IXGBE_VFTDT(reg_idx), 0);
- ring->tail = hw->hw_addr + IXGBE_VFTDT(reg_idx);
+ ring->tail = adapter->io_addr + IXGBE_VFTDT(reg_idx);
/* reset ntu and ntc to place SW in sync with hardwdare */
ring->next_to_clean = 0;
@@ -1318,7 +1360,7 @@ static void ixgbevf_configure_rx_ring(struct ixgbevf_adapter *adapter,
/* reset head and tail pointers */
IXGBE_WRITE_REG(hw, IXGBE_VFRDH(reg_idx), 0);
IXGBE_WRITE_REG(hw, IXGBE_VFRDT(reg_idx), 0);
- ring->tail = hw->hw_addr + IXGBE_VFRDT(reg_idx);
+ ring->tail = adapter->io_addr + IXGBE_VFRDT(reg_idx);
/* reset ntu and ntc to place SW in sync with hardwdare */
ring->next_to_clean = 0;
@@ -3459,6 +3501,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
hw->hw_addr = ioremap(pci_resource_start(pdev, 0),
pci_resource_len(pdev, 0));
+ adapter->io_addr = hw->hw_addr;
if (!hw->hw_addr) {
err = -EIO;
goto err_ioremap;
@@ -3544,7 +3587,7 @@ err_register:
ixgbevf_clear_interrupt_scheme(adapter);
err_sw_init:
ixgbevf_reset_interrupt_capability(adapter);
- iounmap(hw->hw_addr);
+ iounmap(adapter->io_addr);
err_ioremap:
free_netdev(netdev);
err_alloc_etherdev:
@@ -3582,7 +3625,7 @@ static void ixgbevf_remove(struct pci_dev *pdev)
ixgbevf_clear_interrupt_scheme(adapter);
ixgbevf_reset_interrupt_capability(adapter);
- iounmap(adapter->hw.hw_addr);
+ iounmap(adapter->io_addr);
pci_release_regions(pdev);
hw_dbg(&adapter->hw, "Remove complete\n");
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 8ebed72..7cb1a52 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -172,16 +172,17 @@ struct ixgbevf_info {
const struct ixgbe_mac_operations *mac_ops;
};
+#define IXGBE_FAILED_READ_REG 0xffffffffU
+
+#define IXGBE_REMOVED(a) unlikely(!(a))
+
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
{
writel(value, hw->hw_addr + reg);
}
#define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v)
-static inline u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
-{
- return readl(hw->hw_addr + reg);
-}
+u32 ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg);
#define IXGBE_READ_REG(h, r) ixgbe_read_reg(h, r)
static inline void ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 09/16] ixgbevf: Check for adapter removal on register writes
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (7 preceding siblings ...)
2014-03-21 12:09 ` [net-next 08/16] ixgbevf: Check register reads for adapter removal Jeff Kirsher
@ 2014-03-21 12:09 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 10/16] ixgbevf: Additional adapter removal checks Jeff Kirsher
` (9 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:09 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Prevent writes to an adapter that has been detected as removed
by a previous failing read.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/vf.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 7cb1a52..096d33a 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -178,7 +178,11 @@ struct ixgbevf_info {
static inline void ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 value)
{
- writel(value, hw->hw_addr + reg);
+ u8 __iomem *reg_addr = ACCESS_ONCE(hw->hw_addr);
+
+ if (IXGBE_REMOVED(reg_addr))
+ return;
+ writel(value, reg_addr + reg);
}
#define IXGBE_WRITE_REG(h, r, v) ixgbe_write_reg(h, r, v)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 10/16] ixgbevf: Additional adapter removal checks
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (8 preceding siblings ...)
2014-03-21 12:09 ` [net-next 09/16] ixgbevf: Check for adapter removal on register writes Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 11/16] igb: implement SIOCGHWTSTAMP ioctl Jeff Kirsher
` (8 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem; +Cc: Mark Rustad, netdev, gospo, sassmann, Jeff Kirsher
From: Mark Rustad <mark.d.rustad@intel.com>
Additional checks are needed for a detected removal not to cause
problems. Some involve simply avoiding a lot of stuff that can't
do anything good, and also cases where the phony return value can
cause problems. In addition, down the adapter when the removal is
sensed.
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbevf/ethtool.c | 22 ++++++++++++++++++++++
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 13 +++++++++++++
2 files changed, 35 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index c769a8d..b2d0023 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -535,6 +535,10 @@ static bool reg_pattern_test(struct ixgbevf_adapter *adapter, u64 *data,
{
u32 pat, val, before;
+ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
+ *data = 1;
+ return true;
+ }
for (pat = 0; pat < ARRAY_SIZE(register_test_patterns); pat++) {
before = ixgbe_read_reg(&adapter->hw, reg);
ixgbe_write_reg(&adapter->hw, reg,
@@ -559,6 +563,10 @@ static bool reg_set_and_check(struct ixgbevf_adapter *adapter, u64 *data,
{
u32 val, before;
+ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
+ *data = 1;
+ return true;
+ }
before = ixgbe_read_reg(&adapter->hw, reg);
ixgbe_write_reg(&adapter->hw, reg, write & mask);
val = ixgbe_read_reg(&adapter->hw, reg);
@@ -578,6 +586,12 @@ static int ixgbevf_reg_test(struct ixgbevf_adapter *adapter, u64 *data)
const struct ixgbevf_reg_test *test;
u32 i;
+ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
+ dev_err(&adapter->pdev->dev,
+ "Adapter removed - register test blocked\n");
+ *data = 1;
+ return 1;
+ }
test = reg_test_vf;
/*
@@ -641,6 +655,14 @@ static void ixgbevf_diag_test(struct net_device *netdev,
struct ixgbevf_adapter *adapter = netdev_priv(netdev);
bool if_running = netif_running(netdev);
+ if (IXGBE_REMOVED(adapter->hw.hw_addr)) {
+ dev_err(&adapter->pdev->dev,
+ "Adapter removed - test blocked\n");
+ data[0] = 1;
+ data[1] = 1;
+ eth_test->flags |= ETH_TEST_FL_FAILED;
+ return;
+ }
set_bit(__IXGBEVF_TESTING, &adapter->state);
if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
/* Offline tests */
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 37c4ebe..a50e892 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -107,6 +107,7 @@ static void ixgbevf_remove_adapter(struct ixgbe_hw *hw)
return;
hw->hw_addr = NULL;
dev_err(&adapter->pdev->dev, "Adapter removed\n");
+ schedule_work(&adapter->watchdog_task);
}
static void ixgbevf_check_remove(struct ixgbe_hw *hw, u32 reg)
@@ -1301,6 +1302,8 @@ static void ixgbevf_disable_rx_queue(struct ixgbevf_adapter *adapter,
u32 rxdctl;
u8 reg_idx = ring->reg_idx;
+ if (IXGBE_REMOVED(hw->hw_addr))
+ return;
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
rxdctl &= ~IXGBE_RXDCTL_ENABLE;
@@ -1326,6 +1329,8 @@ static void ixgbevf_rx_desc_queue_enable(struct ixgbevf_adapter *adapter,
u32 rxdctl;
u8 reg_idx = ring->reg_idx;
+ if (IXGBE_REMOVED(hw->hw_addr))
+ return;
do {
usleep_range(1000, 2000);
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(reg_idx));
@@ -2399,6 +2404,14 @@ static void ixgbevf_watchdog_task(struct work_struct *work)
bool link_up = adapter->link_up;
s32 need_reset;
+ if (IXGBE_REMOVED(hw->hw_addr)) {
+ if (!test_bit(__IXGBEVF_DOWN, &adapter->state)) {
+ rtnl_lock();
+ ixgbevf_down(adapter);
+ rtnl_unlock();
+ }
+ return;
+ }
ixgbevf_queue_reset_subtask(adapter);
adapter->flags |= IXGBE_FLAG_IN_WATCHDOG_TASK;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 11/16] igb: implement SIOCGHWTSTAMP ioctl
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (9 preceding siblings ...)
2014-03-21 12:10 ` [net-next 10/16] ixgbevf: Additional adapter removal checks Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 12/16] igb: add register rd/wr for surprise removal Jeff Kirsher
` (7 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem; +Cc: Jacob Keller, netdev, gospo, sassmann, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
This patch adds support for the SIOCGHWTSTAMP ioctl which enables user
processes to read the current hwtstamp_config settings
non-destructively. Previously a process had to be privileged and could
only set values, it couldn't return what is currently set without
possibly overwriting the value.
This patch adds support for this new operation into igb by keeping a
shadow copy of the config in the adapter structure, which is returned
upon request.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/igb.h | 5 ++--
drivers/net/ethernet/intel/igb/igb_main.c | 4 ++-
drivers/net/ethernet/intel/igb/igb_ptp.c | 46 +++++++++++++++++++++----------
3 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index a202c96..411b213 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -434,6 +434,7 @@ struct igb_adapter {
struct delayed_work ptp_overflow_work;
struct work_struct ptp_tx_work;
struct sk_buff *ptp_tx_skb;
+ struct hwtstamp_config tstamp_config;
unsigned long ptp_tx_start;
unsigned long last_rx_ptp_check;
spinlock_t tmreg_lock;
@@ -545,8 +546,8 @@ static inline void igb_ptp_rx_hwtstamp(struct igb_ring *rx_ring,
rx_ring->last_rx_timestamp = jiffies;
}
-int igb_ptp_hwtstamp_ioctl(struct net_device *netdev, struct ifreq *ifr,
- int cmd);
+int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
+int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
#ifdef CONFIG_IGB_HWMON
void igb_sysfs_exit(struct igb_adapter *adapter);
int igb_sysfs_init(struct igb_adapter *adapter);
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 17feea0..f623e6c 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7162,8 +7162,10 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
case SIOCGMIIREG:
case SIOCSMIIREG:
return igb_mii_ioctl(netdev, ifr, cmd);
+ case SIOCGHWTSTAMP:
+ return igb_ptp_get_ts_config(netdev, ifr);
case SIOCSHWTSTAMP:
- return igb_ptp_hwtstamp_ioctl(netdev, ifr, cmd);
+ return igb_ptp_set_ts_config(netdev, ifr);
default:
return -EOPNOTSUPP;
}
diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index a894551a..da55fbb 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -541,10 +541,26 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
}
/**
- * igb_ptp_hwtstamp_ioctl - control hardware time stamping
+ * igb_ptp_get_ts_config - get hardware time stamping config
+ * @netdev:
+ * @ifreq:
+ *
+ * Get the hwtstamp_config settings to return to the user. Rather than attempt
+ * to deconstruct the settings from the registers, just return a shadow copy
+ * of the last known settings.
+ **/
+int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr)
+{
+ struct igb_adapter *adapter = netdev_priv(netdev);
+ struct hwtstamp_config *config = &adapter->tstamp_config;
+
+ return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
+ -EFAULT : 0;
+}
+/**
+ * igb_ptp_set_ts_config - control hardware time stamping
* @netdev:
* @ifreq:
- * @cmd:
*
* Outgoing time stamping can be enabled and disabled. Play nice and
* disable it when requested, although it shouldn't case any overhead
@@ -558,12 +574,11 @@ void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector,
* not supported, with the exception of "all V2 events regardless of
* level 2 or 4".
**/
-int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
- struct ifreq *ifr, int cmd)
+int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr)
{
struct igb_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw;
- struct hwtstamp_config config;
+ struct hwtstamp_config *config = &adapter->tstamp_config;
u32 tsync_tx_ctl = E1000_TSYNCTXCTL_ENABLED;
u32 tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
u32 tsync_rx_cfg = 0;
@@ -571,14 +586,14 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
bool is_l2 = false;
u32 regval;
- if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+ if (copy_from_user(config, ifr->ifr_data, sizeof(*config)))
return -EFAULT;
/* reserved for future extensions */
- if (config.flags)
+ if (config->flags)
return -EINVAL;
- switch (config.tx_type) {
+ switch (config->tx_type) {
case HWTSTAMP_TX_OFF:
tsync_tx_ctl = 0;
case HWTSTAMP_TX_ON:
@@ -587,7 +602,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
return -ERANGE;
}
- switch (config.rx_filter) {
+ switch (config->rx_filter) {
case HWTSTAMP_FILTER_NONE:
tsync_rx_ctl = 0;
break;
@@ -611,7 +626,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_EVENT_V2;
- config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+ config->rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
is_l2 = true;
is_l4 = true;
break;
@@ -622,12 +637,12 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
*/
if (hw->mac.type != e1000_82576) {
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
- config.rx_filter = HWTSTAMP_FILTER_ALL;
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
break;
}
/* fall through */
default:
- config.rx_filter = HWTSTAMP_FILTER_NONE;
+ config->rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE;
}
@@ -644,7 +659,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
if ((hw->mac.type >= e1000_82580) && tsync_rx_ctl) {
tsync_rx_ctl = E1000_TSYNCRXCTL_ENABLED;
tsync_rx_ctl |= E1000_TSYNCRXCTL_TYPE_ALL;
- config.rx_filter = HWTSTAMP_FILTER_ALL;
+ config->rx_filter = HWTSTAMP_FILTER_ALL;
is_l2 = true;
is_l4 = true;
@@ -708,7 +723,7 @@ int igb_ptp_hwtstamp_ioctl(struct net_device *netdev,
regval = rd32(E1000_RXSTMPL);
regval = rd32(E1000_RXSTMPH);
- return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+ return copy_to_user(ifr->ifr_data, config, sizeof(*config)) ?
-EFAULT : 0;
}
@@ -865,6 +880,9 @@ void igb_ptp_reset(struct igb_adapter *adapter)
if (!(adapter->flags & IGB_FLAG_PTP))
return;
+ /* reset the tstamp_config */
+ memset(&adapter->tstamp_config, 0, sizeof(adapter->tstamp_config));
+
switch (adapter->hw.mac.type) {
case e1000_82576:
/* Dial the nominal frequency. */
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 12/16] igb: add register rd/wr for surprise removal
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (10 preceding siblings ...)
2014-03-21 12:10 ` [net-next 11/16] igb: implement SIOCGHWTSTAMP ioctl Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 13/16] igb: Fix memory leak in igb_get_module_eeprom() Jeff Kirsher
` (6 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem; +Cc: Fujinaka, Todd, netdev, gospo, sassmann, Jeff Kirsher
From: "Fujinaka, Todd" <todd.fujinaka@intel.com>
Add initial register rd/wr for surprise removal (LER).
Signed-off-by: Todd Fujinaka <todd.fujinaka@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/e1000_regs.h | 21 ++++++++++++++++++---
drivers/net/ethernet/intel/igb/igb_main.c | 22 ++++++++++++++++++++++
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/e1000_regs.h b/drivers/net/ethernet/intel/igb/e1000_regs.h
index d0f14be..bdb246e 100644
--- a/drivers/net/ethernet/intel/igb/e1000_regs.h
+++ b/drivers/net/ethernet/intel/igb/e1000_regs.h
@@ -362,12 +362,25 @@
* Filter - RW */
#define E1000_VMVIR(_n) (0x03700 + (4 * (_n)))
-#define wr32(reg, value) (writel(value, hw->hw_addr + reg))
-#define rd32(reg) (readl(hw->hw_addr + reg))
+struct e1000_hw;
+
+u32 igb_rd32(struct e1000_hw *hw, u32 reg);
+
+/* write operations, indexed using DWORDS */
+#define wr32(reg, val) \
+do { \
+ u8 __iomem *hw_addr = ACCESS_ONCE((hw)->hw_addr); \
+ if (!E1000_REMOVED(hw_addr)) \
+ writel((val), &hw_addr[(reg)]); \
+} while (0)
+
+#define rd32(reg) (igb_rd32(hw, reg))
+
#define wrfl() ((void)rd32(E1000_STATUS))
#define array_wr32(reg, offset, value) \
- (writel(value, hw->hw_addr + reg + ((offset) << 2)))
+ wr32((reg) + ((offset) << 2), (value))
+
#define array_rd32(reg, offset) \
(readl(hw->hw_addr + reg + ((offset) << 2)))
@@ -406,4 +419,6 @@
#define E1000_INVM_DATA_REG(_n) (0x12120 + 4*(_n))
#define E1000_INVM_SIZE 64 /* Number of INVM Data Registers */
+#define E1000_REMOVED(h) unlikely(!(h))
+
#endif
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index f623e6c..e8b4f7b 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -751,6 +751,28 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
}
}
+u32 igb_rd32(struct e1000_hw *hw, u32 reg)
+{
+ struct igb_adapter *igb = container_of(hw, struct igb_adapter, hw);
+ u8 __iomem *hw_addr = ACCESS_ONCE(hw->hw_addr);
+ u32 value = 0;
+
+ if (E1000_REMOVED(hw_addr))
+ return ~value;
+
+ value = readl(&hw_addr[reg]);
+
+ /* reads should not return all F's */
+ if (!(~value) && (!reg || !(~readl(hw_addr)))) {
+ struct net_device *netdev = igb->netdev;
+ hw->hw_addr = NULL;
+ netif_device_detach(netdev);
+ netdev_err(netdev, "PCIe link lost, device now detached\n");
+ }
+
+ return value;
+}
+
/**
* igb_write_ivar - configure ivar for given MSI-X vector
* @hw: pointer to the HW structure
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 13/16] igb: Fix memory leak in igb_get_module_eeprom()
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (11 preceding siblings ...)
2014-03-21 12:10 ` [net-next 12/16] igb: add register rd/wr for surprise removal Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 14/16] igb: specify phc_index of 82575 for get_ts_info Jeff Kirsher
` (5 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem; +Cc: Christian Engelmayer, netdev, gospo, sassmann, Jeff Kirsher
From: Christian Engelmayer <cengelma@gmx.at>
Fix a memory leak in the igb_get_module_eeprom() error handling path.
Detected by Coverity: CID 1016508.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index e35bc1f..d5c3e65 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2791,9 +2791,11 @@ static int igb_get_module_eeprom(struct net_device *netdev,
/* Read EEPROM block, SFF-8079/SFF-8472, word at a time */
for (i = 0; i < last_word - first_word + 1; i++) {
status = igb_read_phy_reg_i2c(hw, first_word + i, &dataword[i]);
- if (status != E1000_SUCCESS)
+ if (status != E1000_SUCCESS) {
/* Error occurred while reading module */
+ kfree(dataword);
return -EIO;
+ }
be16_to_cpus(&dataword[i]);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 14/16] igb: specify phc_index of 82575 for get_ts_info
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (12 preceding siblings ...)
2014-03-21 12:10 ` [net-next 13/16] igb: Fix memory leak in igb_get_module_eeprom() Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector Jeff Kirsher
` (4 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem; +Cc: Ken ICHIKAWA, netdev, gospo, sassmann, Jeff Kirsher
From: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
82575 has only software timestamping capability and it has
no PTP Hardware Clocks. Therefore, -1 has to be specified
to the phc_index for ethtool's get_ts_info, otherwise a wrong
value will be set to the phc_index.
v2: move the if (adapter->ptp_clock) section specifying phc_index
to above the switch statement as suggested by Matthew Vick.
adapter->ptpclock will always be NULL for 82575.
Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
Acked-by: Matthew Vick <matthew.vick@intel.com>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/igb_ethtool.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index d5c3e65..e5570ac 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -2353,6 +2353,11 @@ static int igb_get_ts_info(struct net_device *dev,
{
struct igb_adapter *adapter = netdev_priv(dev);
+ if (adapter->ptp_clock)
+ info->phc_index = ptp_clock_index(adapter->ptp_clock);
+ else
+ info->phc_index = -1;
+
switch (adapter->hw.mac.type) {
case e1000_82575:
info->so_timestamping =
@@ -2374,11 +2379,6 @@ static int igb_get_ts_info(struct net_device *dev,
SOF_TIMESTAMPING_RX_HARDWARE |
SOF_TIMESTAMPING_RAW_HARDWARE;
- if (adapter->ptp_clock)
- info->phc_index = ptp_clock_index(adapter->ptp_clock);
- else
- info->phc_index = -1;
-
info->tx_types =
(1 << HWTSTAMP_TX_OFF) |
(1 << HWTSTAMP_TX_ON);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (13 preceding siblings ...)
2014-03-21 12:10 ` [net-next 14/16] igb: specify phc_index of 82575 for get_ts_info Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 12:10 ` [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only Jeff Kirsher
` (3 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem
Cc: Christoph Paasch, netdev, gospo, sassmann, Carolyn Wyborny,
Jeff Kirsher
From: Christoph Paasch <christoph.paasch@uclouvain.be>
When igb_set_interrupt_capability() calls
igb_reset_interrupt_capability() (e.g., because CONFIG_PCI_MSI is unset),
num_q_vectors has been set but no vector has yet been allocated.
igb_reset_interrupt_capability() will then call igb_reset_q_vector,
which assumes that the vector is allocated. As this is not the case, we
are accessing a NULL-pointer.
This patch fixes it by checking that q_vector is indeed different from
NULL.
Fixes: 02ef6e1d0b0023 (igb: Fix queue allocation method to accommodate changing during runtime)
Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index e8b4f7b..6acf787 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1035,6 +1035,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx)
{
struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
+ /* Coming from igb_set_interrupt_capability, the vectors are not yet
+ * allocated. So, q_vector is NULL so we should stop here.
+ */
+ if (!q_vector)
+ return;
+
if (q_vector->tx.ring)
adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (14 preceding siblings ...)
2014-03-21 12:10 ` [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector Jeff Kirsher
@ 2014-03-21 12:10 ` Jeff Kirsher
2014-03-21 19:24 ` [net-next 00/16][pull request] Intel Wired LAN Driver Updates David Miller
` (2 subsequent siblings)
18 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-21 12:10 UTC (permalink / raw)
To: davem
Cc: Christoph Paasch, netdev, gospo, sassmann, Carolyn Wyborny,
Jeff Kirsher
From: Christoph Paasch <christoph.paasch@uclouvain.be>
Prior to cd14ef54d25 (igb: Change to use statically allocated array for
MSIx entries), having msix_entries different from NULL was an indicator
that MSIX is enabled.
In igb_set_interrupt_capabiliy we may fall back to MSI-only. Prior to
the above patch msix_entries was set to NULL by
igb_reset_interrupt_capability.
However, now we are checking the flag for IGB_FLAG_HAS_MSIX and so the
stack gets completly confused:
[ 42.659791] ------------[ cut here ]------------
[ 42.715032] WARNING: CPU: 7 PID: 0 at net/sched/sch_generic.c:264 dev_watchdog+0x15c/0x1fb()
[ 42.848263] NETDEV WATCHDOG: eth0 (igb): transmit queue 0 timed out
[ 42.923253] Modules linked in:
[ 42.959875] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 3.14.0-rc2-mptcp #437
[ 43.043184] Hardware name: HP ProLiant DL165 G7, BIOS O37 01/26/2011
[ 43.119215] 0000000000000108 ffff88023fdc3da8 ffffffff81487847 0000000000000108
[ 43.208165] ffff88023fdc3df8 ffff88023fdc3de8 ffffffff81034e7d ffff88023fdc3dd8
[ 43.297120] ffffffff813fff10 ffff880236018000 ffff880236b178c0 0000000000000008
[ 43.386071] Call Trace:
[ 43.415303] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
[ 43.484174] [<ffffffff81034e7d>] warn_slowpath_common+0x77/0x91
[ 43.556049] [<ffffffff813fff10>] ? dev_watchdog+0x15c/0x1fb
[ 43.623759] [<ffffffff81034f2b>] warn_slowpath_fmt+0x41/0x43
[ 43.692511] [<ffffffff813fff10>] dev_watchdog+0x15c/0x1fb
[ 43.758141] [<ffffffff813ffdb4>] ? __netdev_watchdog_up+0x64/0x64
[ 43.832091] [<ffffffff8103cd04>] call_timer_fn+0x17/0x6f
[ 43.896682] [<ffffffff8103cebe>] run_timer_softirq+0x162/0x1a2
[ 43.967511] [<ffffffff81038520>] __do_softirq+0xcd/0x1cc
[ 44.032104] [<ffffffff81038689>] irq_exit+0x3a/0x48
[ 44.091492] [<ffffffff81026d43>] smp_apic_timer_interrupt+0x43/0x50
[ 44.167525] [<ffffffff8148c24a>] apic_timer_interrupt+0x6a/0x70
[ 44.239392] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
[ 44.310343] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
[ 44.374934] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
[ 44.444724] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
[ 44.513472] ---[ end trace a5a075fd4e7f854f ]---
[ 44.568753] igb 0000:04:00.0 eth0: Reset adapter
[ 46.206945] random: nonblocking pool is initialized
[ 46.465670] irq 44: nobody cared (try booting with the "irqpoll" option)
[ 46.545862] CPU: 7 PID: 0 Comm: swapper/7 Tainted: G W 3.14.0-rc2-mptcp #437
[ 46.640610] Hardware name: HP ProLiant DL165 G7, BIOS O37 01/26/2011
[ 46.716641] ffff8802363f8c84 ffff88023fdc3e38 ffffffff81487847 00000000a03cdb6d
[ 46.805598] ffff8802363f8c00 ffff88023fdc3e68 ffffffff81068489 0000007f81825400
[ 46.894539] ffff8802363f8c00 0000000000000000 0000000000000000 ffff88023fdc3ea8
[ 46.983484] Call Trace:
[ 47.012714] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
[ 47.081585] [<ffffffff81068489>] __report_bad_irq+0x35/0xc1
[ 47.149295] [<ffffffff81068683>] note_interrupt+0x16e/0x1ea
[ 47.217006] [<ffffffff8106679e>] handle_irq_event_percpu+0x116/0x12e
[ 47.294075] [<ffffffff810667e9>] handle_irq_event+0x33/0x4f
[ 47.361787] [<ffffffff81068c95>] handle_fasteoi_irq+0x83/0xd1
[ 47.431577] [<ffffffff81003d5b>] handle_irq+0x1f/0x28
[ 47.493047] [<ffffffff81003567>] do_IRQ+0x4e/0xd4
[ 47.550358] [<ffffffff8148b06a>] common_interrupt+0x6a/0x6a
[ 47.618066] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
[ 47.689016] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
[ 47.753605] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
[ 47.823397] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
[ 47.892146] handlers:
[ 47.919301] [<ffffffff812fbd7d>] igb_intr
So, this patch unsets the flag to indicate that we are not using MSIX.
This patch does exactly this: Unsetting the flag when falling back to MSI.
Fixes: cd14ef54d25b (igb: Change to use statically allocated array for MSIx entries)
Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/igb/igb_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 6acf787..cd20409 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -1149,6 +1149,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
/* If we can't do MSI-X, try MSI */
msi_only:
+ adapter->flags &= ~IGB_FLAG_HAS_MSIX;
#ifdef CONFIG_PCI_IOV
/* disable SR-IOV for non MSI-X configurations */
if (adapter->vf_data) {
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [net-next 00/16][pull request] Intel Wired LAN Driver Updates
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
` (15 preceding siblings ...)
2014-03-21 12:10 ` [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only Jeff Kirsher
@ 2014-03-21 19:24 ` David Miller
[not found] ` <0082c389c1d6488cb5cf473ff1bc26e2@UCL-MBX03.OASIS.UCLOUVAIN.BE>
[not found] ` <3ed2b36cb601493fae970917602ab6d1@UCL-MBX03.OASIS.UCLOUVAIN.BE>
18 siblings, 0 replies; 23+ messages in thread
From: David Miller @ 2014-03-21 19:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 21 Mar 2014 05:09:50 -0700
> This series contains updates to igb, ixgbe, ixgbevf, i40e and i40evf.
Pulled, thanks Jeff.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector
[not found] ` <0082c389c1d6488cb5cf473ff1bc26e2@UCL-MBX03.OASIS.UCLOUVAIN.BE>
@ 2014-03-23 14:31 ` Christoph Paasch
2014-03-24 20:49 ` Jeff Kirsher
[not found] ` <6af5c43984d241daa37714ea8f98ab53@UCL-MBX03.OASIS.UCLOUVAIN.BE>
0 siblings, 2 replies; 23+ messages in thread
From: Christoph Paasch @ 2014-03-23 14:31 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com, Carolyn Wyborny
On 21/03/14 - 12:10:05, Jeff Kirsher wrote:
> From: Christoph Paasch <christoph.paasch@uclouvain.be>
>
> When igb_set_interrupt_capability() calls
> igb_reset_interrupt_capability() (e.g., because CONFIG_PCI_MSI is unset),
> num_q_vectors has been set but no vector has yet been allocated.
>
> igb_reset_interrupt_capability() will then call igb_reset_q_vector,
> which assumes that the vector is allocated. As this is not the case, we
> are accessing a NULL-pointer.
>
> This patch fixes it by checking that q_vector is indeed different from
> NULL.
>
> Fixes: 02ef6e1d0b0023 (igb: Fix queue allocation method to accommodate changing during runtime)
> Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Hello Jeff,
shouldn't this one rather be for 'net' instead of 'net-next'? Because
02ef6e1d0b0023 is part of 3.14-rc1.
Cheers,
Christoph
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index e8b4f7b..6acf787 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -1035,6 +1035,12 @@ static void igb_reset_q_vector(struct igb_adapter *adapter, int v_idx)
> {
> struct igb_q_vector *q_vector = adapter->q_vector[v_idx];
>
> + /* Coming from igb_set_interrupt_capability, the vectors are not yet
> + * allocated. So, q_vector is NULL so we should stop here.
> + */
> + if (!q_vector)
> + return;
> +
> if (q_vector->tx.ring)
> adapter->tx_ring[q_vector->tx.ring->queue_index] = NULL;
>
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only
[not found] ` <3ed2b36cb601493fae970917602ab6d1@UCL-MBX03.OASIS.UCLOUVAIN.BE>
@ 2014-03-23 14:32 ` Christoph Paasch
2014-03-24 20:51 ` Jeff Kirsher
0 siblings, 1 reply; 23+ messages in thread
From: Christoph Paasch @ 2014-03-23 14:32 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com, Carolyn Wyborny
On 21/03/14 - 12:10:06, Jeff Kirsher wrote:
> From: Christoph Paasch <christoph.paasch@uclouvain.be>
>
> Prior to cd14ef54d25 (igb: Change to use statically allocated array for
> MSIx entries), having msix_entries different from NULL was an indicator
> that MSIX is enabled.
> In igb_set_interrupt_capabiliy we may fall back to MSI-only. Prior to
> the above patch msix_entries was set to NULL by
> igb_reset_interrupt_capability.
>
> However, now we are checking the flag for IGB_FLAG_HAS_MSIX and so the
> stack gets completly confused:
>
> [ 42.659791] ------------[ cut here ]------------
> [ 42.715032] WARNING: CPU: 7 PID: 0 at net/sched/sch_generic.c:264 dev_watchdog+0x15c/0x1fb()
> [ 42.848263] NETDEV WATCHDOG: eth0 (igb): transmit queue 0 timed out
> [ 42.923253] Modules linked in:
> [ 42.959875] CPU: 7 PID: 0 Comm: swapper/7 Not tainted 3.14.0-rc2-mptcp #437
> [ 43.043184] Hardware name: HP ProLiant DL165 G7, BIOS O37 01/26/2011
> [ 43.119215] 0000000000000108 ffff88023fdc3da8 ffffffff81487847 0000000000000108
> [ 43.208165] ffff88023fdc3df8 ffff88023fdc3de8 ffffffff81034e7d ffff88023fdc3dd8
> [ 43.297120] ffffffff813fff10 ffff880236018000 ffff880236b178c0 0000000000000008
> [ 43.386071] Call Trace:
> [ 43.415303] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
> [ 43.484174] [<ffffffff81034e7d>] warn_slowpath_common+0x77/0x91
> [ 43.556049] [<ffffffff813fff10>] ? dev_watchdog+0x15c/0x1fb
> [ 43.623759] [<ffffffff81034f2b>] warn_slowpath_fmt+0x41/0x43
> [ 43.692511] [<ffffffff813fff10>] dev_watchdog+0x15c/0x1fb
> [ 43.758141] [<ffffffff813ffdb4>] ? __netdev_watchdog_up+0x64/0x64
> [ 43.832091] [<ffffffff8103cd04>] call_timer_fn+0x17/0x6f
> [ 43.896682] [<ffffffff8103cebe>] run_timer_softirq+0x162/0x1a2
> [ 43.967511] [<ffffffff81038520>] __do_softirq+0xcd/0x1cc
> [ 44.032104] [<ffffffff81038689>] irq_exit+0x3a/0x48
> [ 44.091492] [<ffffffff81026d43>] smp_apic_timer_interrupt+0x43/0x50
> [ 44.167525] [<ffffffff8148c24a>] apic_timer_interrupt+0x6a/0x70
> [ 44.239392] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
> [ 44.310343] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
> [ 44.374934] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
> [ 44.444724] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
> [ 44.513472] ---[ end trace a5a075fd4e7f854f ]---
> [ 44.568753] igb 0000:04:00.0 eth0: Reset adapter
> [ 46.206945] random: nonblocking pool is initialized
> [ 46.465670] irq 44: nobody cared (try booting with the "irqpoll" option)
> [ 46.545862] CPU: 7 PID: 0 Comm: swapper/7 Tainted: G W 3.14.0-rc2-mptcp #437
> [ 46.640610] Hardware name: HP ProLiant DL165 G7, BIOS O37 01/26/2011
> [ 46.716641] ffff8802363f8c84 ffff88023fdc3e38 ffffffff81487847 00000000a03cdb6d
> [ 46.805598] ffff8802363f8c00 ffff88023fdc3e68 ffffffff81068489 0000007f81825400
> [ 46.894539] ffff8802363f8c00 0000000000000000 0000000000000000 ffff88023fdc3ea8
> [ 46.983484] Call Trace:
> [ 47.012714] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
> [ 47.081585] [<ffffffff81068489>] __report_bad_irq+0x35/0xc1
> [ 47.149295] [<ffffffff81068683>] note_interrupt+0x16e/0x1ea
> [ 47.217006] [<ffffffff8106679e>] handle_irq_event_percpu+0x116/0x12e
> [ 47.294075] [<ffffffff810667e9>] handle_irq_event+0x33/0x4f
> [ 47.361787] [<ffffffff81068c95>] handle_fasteoi_irq+0x83/0xd1
> [ 47.431577] [<ffffffff81003d5b>] handle_irq+0x1f/0x28
> [ 47.493047] [<ffffffff81003567>] do_IRQ+0x4e/0xd4
> [ 47.550358] [<ffffffff8148b06a>] common_interrupt+0x6a/0x6a
> [ 47.618066] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
> [ 47.689016] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
> [ 47.753605] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
> [ 47.823397] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
> [ 47.892146] handlers:
> [ 47.919301] [<ffffffff812fbd7d>] igb_intr
>
> So, this patch unsets the flag to indicate that we are not using MSIX.
> This patch does exactly this: Unsetting the flag when falling back to MSI.
>
> Fixes: cd14ef54d25b (igb: Change to use statically allocated array for MSIx entries)
> Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Same here - cd14ef54d25b is part of 3.14-rc1. I think it should go into net
instead of net-next.
Cheers,
Christoph
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 6acf787..cd20409 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -1149,6 +1149,7 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter, bool msix)
>
> /* If we can't do MSI-X, try MSI */
> msi_only:
> + adapter->flags &= ~IGB_FLAG_HAS_MSIX;
> #ifdef CONFIG_PCI_IOV
> /* disable SR-IOV for non MSI-X configurations */
> if (adapter->vf_data) {
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector
2014-03-23 14:31 ` [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector Christoph Paasch
@ 2014-03-24 20:49 ` Jeff Kirsher
[not found] ` <6af5c43984d241daa37714ea8f98ab53@UCL-MBX03.OASIS.UCLOUVAIN.BE>
1 sibling, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-24 20:49 UTC (permalink / raw)
To: Christoph Paasch
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com, Carolyn Wyborny
[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]
On Sun, 2014-03-23 at 15:31 +0100, Christoph Paasch wrote:
> On 21/03/14 - 12:10:05, Jeff Kirsher wrote:
> > From: Christoph Paasch <christoph.paasch@uclouvain.be>
> >
> > When igb_set_interrupt_capability() calls
> > igb_reset_interrupt_capability() (e.g., because CONFIG_PCI_MSI is
> unset),
> > num_q_vectors has been set but no vector has yet been allocated.
> >
> > igb_reset_interrupt_capability() will then call igb_reset_q_vector,
> > which assumes that the vector is allocated. As this is not the case,
> we
> > are accessing a NULL-pointer.
> >
> > This patch fixes it by checking that q_vector is indeed different
> from
> > NULL.
> >
> > Fixes: 02ef6e1d0b0023 (igb: Fix queue allocation method to
> accommodate changing during runtime)
> > Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> > Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> > Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>
> Hello Jeff,
>
> shouldn't this one rather be for 'net' instead of 'net-next'? Because
> 02ef6e1d0b0023 is part of 3.14-rc1.
Yes, but being that it is late in the -rcX cycle and 3.14 is expected to
be released anytime now, it was not prudent to try and push this in
right before the window closes. It is better to have -stable pick this
up once Linus releases 3.14. Same goes for your other patch.
So once Linus releases 3.14 and Linus merges in Dave's net-next tree for
3.15, I will notify the stable maintainers that your 2 patches need to
be picked up for 3.14.x stable trees.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only
2014-03-23 14:32 ` [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only Christoph Paasch
@ 2014-03-24 20:51 ` Jeff Kirsher
0 siblings, 0 replies; 23+ messages in thread
From: Jeff Kirsher @ 2014-03-24 20:51 UTC (permalink / raw)
To: Christoph Paasch
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com, Carolyn Wyborny
[-- Attachment #1: Type: text/plain, Size: 4939 bytes --]
On Sun, 2014-03-23 at 15:32 +0100, Christoph Paasch wrote:
> On 21/03/14 - 12:10:06, Jeff Kirsher wrote:
> > From: Christoph Paasch <christoph.paasch@uclouvain.be>
> >
> > Prior to cd14ef54d25 (igb: Change to use statically allocated array
> for
> > MSIx entries), having msix_entries different from NULL was an
> indicator
> > that MSIX is enabled.
> > In igb_set_interrupt_capabiliy we may fall back to MSI-only. Prior
> to
> > the above patch msix_entries was set to NULL by
> > igb_reset_interrupt_capability.
> >
> > However, now we are checking the flag for IGB_FLAG_HAS_MSIX and so
> the
> > stack gets completly confused:
> >
> > [ 42.659791] ------------[ cut here ]------------
> > [ 42.715032] WARNING: CPU: 7 PID: 0 at net/sched/sch_generic.c:264
> dev_watchdog+0x15c/0x1fb()
> > [ 42.848263] NETDEV WATCHDOG: eth0 (igb): transmit queue 0 timed
> out
> > [ 42.923253] Modules linked in:
> > [ 42.959875] CPU: 7 PID: 0 Comm: swapper/7 Not tainted
> 3.14.0-rc2-mptcp #437
> > [ 43.043184] Hardware name: HP ProLiant DL165 G7, BIOS O37
> 01/26/2011
> > [ 43.119215] 0000000000000108 ffff88023fdc3da8 ffffffff81487847
> 0000000000000108
> > [ 43.208165] ffff88023fdc3df8 ffff88023fdc3de8 ffffffff81034e7d
> ffff88023fdc3dd8
> > [ 43.297120] ffffffff813fff10 ffff880236018000 ffff880236b178c0
> 0000000000000008
> > [ 43.386071] Call Trace:
> > [ 43.415303] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
> > [ 43.484174] [<ffffffff81034e7d>] warn_slowpath_common+0x77/0x91
> > [ 43.556049] [<ffffffff813fff10>] ? dev_watchdog+0x15c/0x1fb
> > [ 43.623759] [<ffffffff81034f2b>] warn_slowpath_fmt+0x41/0x43
> > [ 43.692511] [<ffffffff813fff10>] dev_watchdog+0x15c/0x1fb
> > [ 43.758141] [<ffffffff813ffdb4>] ? __netdev_watchdog_up
> +0x64/0x64
> > [ 43.832091] [<ffffffff8103cd04>] call_timer_fn+0x17/0x6f
> > [ 43.896682] [<ffffffff8103cebe>] run_timer_softirq+0x162/0x1a2
> > [ 43.967511] [<ffffffff81038520>] __do_softirq+0xcd/0x1cc
> > [ 44.032104] [<ffffffff81038689>] irq_exit+0x3a/0x48
> > [ 44.091492] [<ffffffff81026d43>] smp_apic_timer_interrupt
> +0x43/0x50
> > [ 44.167525] [<ffffffff8148c24a>] apic_timer_interrupt+0x6a/0x70
> > [ 44.239392] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
> > [ 44.310343] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
> > [ 44.374934] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
> > [ 44.444724] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
> > [ 44.513472] ---[ end trace a5a075fd4e7f854f ]---
> > [ 44.568753] igb 0000:04:00.0 eth0: Reset adapter
> > [ 46.206945] random: nonblocking pool is initialized
> > [ 46.465670] irq 44: nobody cared (try booting with the "irqpoll"
> option)
> > [ 46.545862] CPU: 7 PID: 0 Comm: swapper/7 Tainted: G W
> 3.14.0-rc2-mptcp #437
> > [ 46.640610] Hardware name: HP ProLiant DL165 G7, BIOS O37
> 01/26/2011
> > [ 46.716641] ffff8802363f8c84 ffff88023fdc3e38 ffffffff81487847
> 00000000a03cdb6d
> > [ 46.805598] ffff8802363f8c00 ffff88023fdc3e68 ffffffff81068489
> 0000007f81825400
> > [ 46.894539] ffff8802363f8c00 0000000000000000 0000000000000000
> ffff88023fdc3ea8
> > [ 46.983484] Call Trace:
> > [ 47.012714] <IRQ> [<ffffffff81487847>] dump_stack+0x49/0x62
> > [ 47.081585] [<ffffffff81068489>] __report_bad_irq+0x35/0xc1
> > [ 47.149295] [<ffffffff81068683>] note_interrupt+0x16e/0x1ea
> > [ 47.217006] [<ffffffff8106679e>] handle_irq_event_percpu
> +0x116/0x12e
> > [ 47.294075] [<ffffffff810667e9>] handle_irq_event+0x33/0x4f
> > [ 47.361787] [<ffffffff81068c95>] handle_fasteoi_irq+0x83/0xd1
> > [ 47.431577] [<ffffffff81003d5b>] handle_irq+0x1f/0x28
> > [ 47.493047] [<ffffffff81003567>] do_IRQ+0x4e/0xd4
> > [ 47.550358] [<ffffffff8148b06a>] common_interrupt+0x6a/0x6a
> > [ 47.618066] <EOI> [<ffffffff8100992c>] ? default_idle+0x6/0x8
> > [ 47.689016] [<ffffffff81009b31>] arch_cpu_idle+0x13/0x18
> > [ 47.753605] [<ffffffff81066126>] cpu_startup_entry+0xa7/0x101
> > [ 47.823397] [<ffffffff81025660>] start_secondary+0x1b2/0x1b7
> > [ 47.892146] handlers:
> > [ 47.919301] [<ffffffff812fbd7d>] igb_intr
> >
> > So, this patch unsets the flag to indicate that we are not using
> MSIX.
> > This patch does exactly this: Unsetting the flag when falling back
> to MSI.
> >
> > Fixes: cd14ef54d25b (igb: Change to use statically allocated array
> for MSIx entries)
> > Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> > Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> > Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>
> Same here - cd14ef54d25b is part of 3.14-rc1. I think it should go
> into net
> instead of net-next.
See my response to your inquiry on your other patch (15/16).
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector
[not found] ` <6af5c43984d241daa37714ea8f98ab53@UCL-MBX03.OASIS.UCLOUVAIN.BE>
@ 2014-03-24 20:57 ` Christoph Paasch
0 siblings, 0 replies; 23+ messages in thread
From: Christoph Paasch @ 2014-03-24 20:57 UTC (permalink / raw)
To: Jeff Kirsher
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com,
sassmann@redhat.com, Carolyn Wyborny
On 24/03/14 - 20:49:30, Jeff Kirsher wrote:
> On Sun, 2014-03-23 at 15:31 +0100, Christoph Paasch wrote:
> > On 21/03/14 - 12:10:05, Jeff Kirsher wrote:
> > > From: Christoph Paasch <christoph.paasch@uclouvain.be>
> > >
> > > When igb_set_interrupt_capability() calls
> > > igb_reset_interrupt_capability() (e.g., because CONFIG_PCI_MSI is
> > unset),
> > > num_q_vectors has been set but no vector has yet been allocated.
> > >
> > > igb_reset_interrupt_capability() will then call igb_reset_q_vector,
> > > which assumes that the vector is allocated. As this is not the case,
> > we
> > > are accessing a NULL-pointer.
> > >
> > > This patch fixes it by checking that q_vector is indeed different
> > from
> > > NULL.
> > >
> > > Fixes: 02ef6e1d0b0023 (igb: Fix queue allocation method to
> > accommodate changing during runtime)
> > > Cc: Carolyn Wyborny <carolyn.wyborny@intel.com>
> > > Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
> > > Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com>
> > > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> >
> > Hello Jeff,
> >
> > shouldn't this one rather be for 'net' instead of 'net-next'? Because
> > 02ef6e1d0b0023 is part of 3.14-rc1.
>
> Yes, but being that it is late in the -rcX cycle and 3.14 is expected to
> be released anytime now, it was not prudent to try and push this in
> right before the window closes. It is better to have -stable pick this
> up once Linus releases 3.14. Same goes for your other patch.
>
> So once Linus releases 3.14 and Linus merges in Dave's net-next tree for
> 3.15, I will notify the stable maintainers that your 2 patches need to
> be picked up for 3.14.x stable trees.
Ok, fair enough.
Cheers,
Christoph
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2014-03-24 20:57 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-21 12:09 [net-next 00/16][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2014-03-21 12:09 ` [net-next 01/16] i40e/i40evf: Add EEE LPI stats Jeff Kirsher
2014-03-21 12:09 ` [net-next 02/16] i40e: Fix a message string Jeff Kirsher
2014-03-21 12:09 ` [net-next 03/16] i40evf: don't shut down admin queue on error Jeff Kirsher
2014-03-21 12:09 ` [net-next 04/16] i40evf: clean up init error messages Jeff Kirsher
2014-03-21 12:09 ` [net-next 05/16] ixgbe: Break recursion in case of removal Jeff Kirsher
2014-03-21 12:09 ` [net-next 06/16] ixgbevf: Use static inlines instead of macros Jeff Kirsher
2014-03-21 12:09 ` [net-next 07/16] ixgbevf: Make the ethtool register test use accessors Jeff Kirsher
2014-03-21 12:09 ` [net-next 08/16] ixgbevf: Check register reads for adapter removal Jeff Kirsher
2014-03-21 12:09 ` [net-next 09/16] ixgbevf: Check for adapter removal on register writes Jeff Kirsher
2014-03-21 12:10 ` [net-next 10/16] ixgbevf: Additional adapter removal checks Jeff Kirsher
2014-03-21 12:10 ` [net-next 11/16] igb: implement SIOCGHWTSTAMP ioctl Jeff Kirsher
2014-03-21 12:10 ` [net-next 12/16] igb: add register rd/wr for surprise removal Jeff Kirsher
2014-03-21 12:10 ` [net-next 13/16] igb: Fix memory leak in igb_get_module_eeprom() Jeff Kirsher
2014-03-21 12:10 ` [net-next 14/16] igb: specify phc_index of 82575 for get_ts_info Jeff Kirsher
2014-03-21 12:10 ` [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector Jeff Kirsher
2014-03-21 12:10 ` [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only Jeff Kirsher
2014-03-21 19:24 ` [net-next 00/16][pull request] Intel Wired LAN Driver Updates David Miller
[not found] ` <0082c389c1d6488cb5cf473ff1bc26e2@UCL-MBX03.OASIS.UCLOUVAIN.BE>
2014-03-23 14:31 ` [net-next 15/16] igb: Fix Null-pointer dereference in igb_reset_q_vector Christoph Paasch
2014-03-24 20:49 ` Jeff Kirsher
[not found] ` <6af5c43984d241daa37714ea8f98ab53@UCL-MBX03.OASIS.UCLOUVAIN.BE>
2014-03-24 20:57 ` Christoph Paasch
[not found] ` <3ed2b36cb601493fae970917602ab6d1@UCL-MBX03.OASIS.UCLOUVAIN.BE>
2014-03-23 14:32 ` [net-next 16/16] igb: Unset IGB_FLAG_HAS_MSIX-flag when falling back to msi-only Christoph Paasch
2014-03-24 20:51 ` Jeff Kirsher
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).