* [PATCH 1/2]: Renumber PCI error enums to start at zero
@ 2006-11-01 23:54 Linas Vepstas
2006-11-02 0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
2006-11-02 1:08 ` [PATCH 1/2 v2]: Renumber PCI error enums to start at zero Linas Vepstas
0 siblings, 2 replies; 7+ messages in thread
From: Linas Vepstas @ 2006-11-01 23:54 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-pci
Greg,
This is a low-prioriity patch to fix an annoying numbering mistake.
Please apply this (and the next patch) at net convenience.
--linas
Subject: [PATCH 1/2]: Renumber PCI error enums to start at zero
Renumber the PCI error enums to start at zero for "normal/online".
This allows un-initialized pci channel state (which defaults to zero)
to be interpreted as "normal". Add very simple routine to check
state, just in case this ever has to be fiddled with again.
Signed-off-by: Linas Vepstas <linas@linas.org>
----
include/linux/pci.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Index: linux-2.6.19-rc4-git3/include/linux/pci.h
===================================================================
--- linux-2.6.19-rc4-git3.orig/include/linux/pci.h 2006-11-01 16:15:49.000000000 -0600
+++ linux-2.6.19-rc4-git3/include/linux/pci.h 2006-11-01 16:20:49.000000000 -0600
@@ -86,15 +86,20 @@ typedef unsigned int __bitwise pci_chann
enum pci_channel_state {
/* I/O channel is in normal state */
- pci_channel_io_normal = (__force pci_channel_state_t) 1,
+ pci_channel_io_normal = (__force pci_channel_state_t) 0,
/* I/O to channel is blocked */
- pci_channel_io_frozen = (__force pci_channel_state_t) 2,
+ pci_channel_io_frozen = (__force pci_channel_state_t) 1,
/* PCI card is dead */
- pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
+ pci_channel_io_perm_failure = (__force pci_channel_state_t) 2,
};
+static inline int pci_channel_offline(pci_channel_state_t state)
+{
+ return (state != pci_channel_io_normal);
+}
+
typedef unsigned short __bitwise pci_bus_flags_t;
enum pci_bus_flags {
PCI_BUS_FLAGS_NO_MSI = (__force pci_bus_flags_t) 1,
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2]: Use newly defined PCI channel offline routine
2006-11-01 23:54 [PATCH 1/2]: Renumber PCI error enums to start at zero Linas Vepstas
@ 2006-11-02 0:00 ` Linas Vepstas
2006-11-02 0:20 ` Auke Kok
2006-11-02 1:10 ` [PATCH 2/2 v2]: " Linas Vepstas
2006-11-02 1:08 ` [PATCH 1/2 v2]: Renumber PCI error enums to start at zero Linas Vepstas
1 sibling, 2 replies; 7+ messages in thread
From: Linas Vepstas @ 2006-11-02 0:00 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-pci, Auke Kok, Jesse Brandeburg
Subject: [PATCH 2/2]: Use newly defined PCI channel offline routine
Use newly minted routine to access the PCI channel state.
Signed-off-by: Linas Vepstas <linas@linas.org>
----
drivers/net/e1000/e1000_main.c | 2 +-
drivers/net/ixgb/ixgb_main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-2.6.19-rc4-git3.orig/drivers/net/e1000/e1000_main.c 2006-11-01 16:15:24.000000000 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c 2006-11-01 16:20:55.000000000 -0600
@@ -3297,7 +3297,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->error_state))
return;
spin_lock_irqsave(&adapter->stats_lock, flags);
Index: linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c
===================================================================
--- linux-2.6.19-rc4-git3.orig/drivers/net/ixgb/ixgb_main.c 2006-11-01 16:15:25.000000000 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c 2006-11-01 16:20:55.000000000 -0600
@@ -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->error_state))
return;
if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2]: Use newly defined PCI channel offline routine
2006-11-02 0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
@ 2006-11-02 0:20 ` Auke Kok
2006-11-02 0:40 ` Linas Vepstas
2006-11-02 1:10 ` [PATCH 2/2 v2]: " Linas Vepstas
1 sibling, 1 reply; 7+ messages in thread
From: Auke Kok @ 2006-11-02 0:20 UTC (permalink / raw)
To: Linas Vepstas; +Cc: gregkh, linux-kernel, linux-pci, Jesse Brandeburg
Linas Vepstas wrote:
> Subject: [PATCH 2/2]: Use newly defined PCI channel offline routine
>
> Use newly minted routine to access the PCI channel state.
why not write this so that it reads:
> + if (pci_channel_offline(pdev))
iow are we assuming that there are multiple error_state's per pdev? That seems bogus.
Auke
>
> Signed-off-by: Linas Vepstas <linas@linas.org>
>
> ----
> drivers/net/e1000/e1000_main.c | 2 +-
> drivers/net/ixgb/ixgb_main.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c
> ===================================================================
> --- linux-2.6.19-rc4-git3.orig/drivers/net/e1000/e1000_main.c 2006-11-01 16:15:24.000000000 -0600
> +++ linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c 2006-11-01 16:20:55.000000000 -0600
> @@ -3297,7 +3297,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->error_state))
> return;
>
> spin_lock_irqsave(&adapter->stats_lock, flags);
> Index: linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c
> ===================================================================
> --- linux-2.6.19-rc4-git3.orig/drivers/net/ixgb/ixgb_main.c 2006-11-01 16:15:25.000000000 -0600
> +++ linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c 2006-11-01 16:20:55.000000000 -0600
> @@ -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->error_state))
> return;
>
> if((netdev->flags & IFF_PROMISC) || (netdev->flags & IFF_ALLMULTI) ||
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2]: Use newly defined PCI channel offline routine
2006-11-02 0:20 ` Auke Kok
@ 2006-11-02 0:40 ` Linas Vepstas
0 siblings, 0 replies; 7+ messages in thread
From: Linas Vepstas @ 2006-11-02 0:40 UTC (permalink / raw)
To: Auke Kok; +Cc: gregkh, linux-kernel, linux-pci, Jesse Brandeburg
On Wed, Nov 01, 2006 at 04:20:11PM -0800, Auke Kok wrote:
> why not write this so that it reads:
>
> > + if (pci_channel_offline(pdev))
Dohhh! of course!
My excuse? Someone was trying to talk to me
while I wrote this code ...
--linas
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2 v2]: Renumber PCI error enums to start at zero
2006-11-01 23:54 [PATCH 1/2]: Renumber PCI error enums to start at zero Linas Vepstas
2006-11-02 0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
@ 2006-11-02 1:08 ` Linas Vepstas
1 sibling, 0 replies; 7+ messages in thread
From: Linas Vepstas @ 2006-11-02 1:08 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-pci
On Wed, Nov 01, 2006 at 05:54:17PM -0600, Linas Vepstas wrote:
[...]
Fix brain-disengaged error.
Greg,
This is a low-prioriity patch to fix an annoying numbering mistake.
Please apply this (and the next patch) at net convenience.
--linas
Subject: [PATCH 1/2]: Renumber PCI error enums to start at zero
Renumber the PCI error enums to start at zero for "normal/online".
This allows un-initialized pci channel state (which defaults to zero)
to be interpreted as "normal". Add very simple routine to check
state, just in case this ever has to be fiddled with again.
Signed-off-by: Linas Vepstas <linas@linas.org>
----
include/linux/pci.h | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Index: linux-2.6.19-rc4-git3/include/linux/pci.h
===================================================================
--- linux-2.6.19-rc4-git3.orig/include/linux/pci.h 2006-11-01 16:15:49.000000000 -0600
+++ linux-2.6.19-rc4-git3/include/linux/pci.h 2006-11-01 18:43:14.000000000 -0600
@@ -86,13 +86,13 @@ typedef unsigned int __bitwise pci_chann
enum pci_channel_state {
/* I/O channel is in normal state */
- pci_channel_io_normal = (__force pci_channel_state_t) 1,
+ pci_channel_io_normal = (__force pci_channel_state_t) 0,
/* I/O to channel is blocked */
- pci_channel_io_frozen = (__force pci_channel_state_t) 2,
+ pci_channel_io_frozen = (__force pci_channel_state_t) 1,
/* PCI card is dead */
- pci_channel_io_perm_failure = (__force pci_channel_state_t) 3,
+ pci_channel_io_perm_failure = (__force pci_channel_state_t) 2,
};
typedef unsigned short __bitwise pci_bus_flags_t;
@@ -180,6 +180,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)
{
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2 v2]: Use newly defined PCI channel offline routine
2006-11-02 0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
2006-11-02 0:20 ` Auke Kok
@ 2006-11-02 1:10 ` Linas Vepstas
2006-11-02 5:13 ` Auke Kok
1 sibling, 1 reply; 7+ messages in thread
From: Linas Vepstas @ 2006-11-02 1:10 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, linux-pci, Auke Kok, Jesse Brandeburg
On Wed, Nov 01, 2006 at 06:00:35PM -0600, Linas Vepstas wrote:
[...]
Resubmit, per Auke ...
--linas
Use newly minted routine to access the PCI channel state.
Signed-off-by: Linas Vepstas <linas@linas.org>
----
drivers/net/e1000/e1000_main.c | 2 +-
drivers/net/ixgb/ixgb_main.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c
===================================================================
--- linux-2.6.19-rc4-git3.orig/drivers/net/e1000/e1000_main.c 2006-11-01 18:40:48.000000000 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c 2006-11-01 18:44:11.000000000 -0600
@@ -3297,7 +3297,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);
Index: linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c
===================================================================
--- linux-2.6.19-rc4-git3.orig/drivers/net/ixgb/ixgb_main.c 2006-11-01 18:40:48.000000000 -0600
+++ linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c 2006-11-01 18:44:39.000000000 -0600
@@ -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) ||
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2 v2]: Use newly defined PCI channel offline routine
2006-11-02 1:10 ` [PATCH 2/2 v2]: " Linas Vepstas
@ 2006-11-02 5:13 ` Auke Kok
0 siblings, 0 replies; 7+ messages in thread
From: Auke Kok @ 2006-11-02 5:13 UTC (permalink / raw)
To: Linas Vepstas, gregkh; +Cc: linux-kernel, linux-pci, Jesse Brandeburg
Linas Vepstas wrote:
> On Wed, Nov 01, 2006 at 06:00:35PM -0600, Linas Vepstas wrote:
> [...]
> Resubmit, per Auke ...
This I'll ACK :)
Cheers,
Auke
>
> --linas
>
> Use newly minted routine to access the PCI channel state.
>
> Signed-off-by: Linas Vepstas <linas@linas.org>
Acked-by: Auke Kok <auke-jan.h.kok@intel.com>
> ----
> drivers/net/e1000/e1000_main.c | 2 +-
> drivers/net/ixgb/ixgb_main.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c
> ===================================================================
> --- linux-2.6.19-rc4-git3.orig/drivers/net/e1000/e1000_main.c 2006-11-01 18:40:48.000000000 -0600
> +++ linux-2.6.19-rc4-git3/drivers/net/e1000/e1000_main.c 2006-11-01 18:44:11.000000000 -0600
> @@ -3297,7 +3297,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);
> Index: linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c
> ===================================================================
> --- linux-2.6.19-rc4-git3.orig/drivers/net/ixgb/ixgb_main.c 2006-11-01 18:40:48.000000000 -0600
> +++ linux-2.6.19-rc4-git3/drivers/net/ixgb/ixgb_main.c 2006-11-01 18:44:39.000000000 -0600
> @@ -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) ||
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-11-02 5:14 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 23:54 [PATCH 1/2]: Renumber PCI error enums to start at zero Linas Vepstas
2006-11-02 0:00 ` [PATCH 2/2]: Use newly defined PCI channel offline routine Linas Vepstas
2006-11-02 0:20 ` Auke Kok
2006-11-02 0:40 ` Linas Vepstas
2006-11-02 1:10 ` [PATCH 2/2 v2]: " Linas Vepstas
2006-11-02 5:13 ` Auke Kok
2006-11-02 1:08 ` [PATCH 1/2 v2]: Renumber PCI error enums to start at zero Linas Vepstas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox