Skip to contentSkip to conversation

Revised [PATCH 1/2]: define inline for test of channel error state

PATCH New Linas Vepstas 2 participants 3 messages Dec 12, 2006 – Dec 13, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Greg,

Per discussion, a revised patch. Silly me, the value was already initialized in drivers/pci/probe.c and I'd been dragging along a prehistoric version of the if checks.

--linas

[PATCH 1/2]: define inline for test of pci channel error state

Add very simple routine to indicate the pci channel error state.

----

 include/linux/pci.h |    5 +++++
 1 file changed, 5 insertions(+)
include/linux/pci.h +5 -0
Index: linux-2.6.19-git7/include/linux/pci.h
===================================================================
@@ -181,6 +181,11 @@ struct pci_dev {
 #define	to_pci_dev(n) container_of(n, struct pci_dev, dev)
 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
 
+static inline int pci_channel_offline(struct pci_dev *pdev)
+{
+	return (pdev->error_state != pci_channel_io_normal);
+}
+
 static inline struct pci_cap_saved_state *pci_find_saved_cap(
 	struct pci_dev *pci_dev,char cap)
 {
#1 lore raw

PATCH 2/2 : Use newly defined PCI channel offline routine

Use newly minted routine to access the PCI channel state.

----

 drivers/net/e1000/e1000_main.c |    2 +-
 drivers/net/ixgb/ixgb_main.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/e1000/e1000_main.c +1 -1
Index: linux-2.6.19-git7/drivers/net/e1000/e1000_main.c
===================================================================
@@ -3449,7 +3449,7 @@ e1000_update_stats(struct e1000_adapter 
 	 */
 	if (adapter->link_speed == 0)
 		return;
-	if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+	if (pci_channel_offline(pdev))
 		return;
 
 	spin_lock_irqsave(&adapter->stats_lock, flags);
drivers/net/ixgb/ixgb_main.c +1 -1
Index: linux-2.6.19-git7/drivers/net/ixgb/ixgb_main.c
===================================================================
@@ -1564,7 +1564,7 @@ ixgb_update_stats(struct ixgb_adapter *a
 	struct pci_dev *pdev = adapter->pdev;
 
 	/* Prevent stats update while adapter is being reset */
-	if (pdev->error_state && pdev->error_state != pci_channel_io_normal)
+	if (pci_channel_offline(pdev))
 		return;
 
 	if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
#2 lore raw
In reply to Linas Vepstas
Quoted 9 lines · Linas Vepstas

Greg,

Per discussion, a revised patch. Silly me, the value was already initialized in drivers/pci/probe.c and I'd been dragging along a prehistoric version of the if checks.

--linas

[PATCH 1/2]: define inline for test of pci channel error state

care to resend 2/2 also? It's best to resend entire series, otherwise I have to go dig for it, and it will take me a while to remember to do that...

thanks,

greg "my inbox looks like hell" k-h