* [net-next 00/15][pull request] Intel Wired LAN Driver Updates
@ 2013-07-29 12:51 Jeff Kirsher
2013-07-29 12:52 ` [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays Jeff Kirsher
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Jeff Kirsher @ 2013-07-29 12:51 UTC (permalink / raw)
To: davem, bhelgaas; +Cc: Jeff Kirsher, netdev, gospo, sassmann, linux-pci
This series contains updates to ixgbe and pci.
The first patch for ixgbe from Greg Rose is the second submission. The
first submission of "ixgbe: Retain VLAN filtering in promiscuous + VT
mode" had a typo, which Joe Perches pointed out and is fixed in this
submission.
Alex updates the ixgbe driver to use the generic helper pci_vfs_assigned
instead of the driver specific function ixgbe_vfs_are_assigned.
Don Skidmore provides 4 patches for ixgbe, the first being a fix for
flow control ethtool reporting. Originally ixgbe_device_supports_autoneg_fc()
was expected to be called by only copper devices, which lead to false
information being displayed via ethtool. Two other patches add support
for fixed fiber for SFP+ devices and the addition of a quad-port x520
adapter. The last patch simply bumps the driver version.
Emil Tantilov provides 3 fixes for ixgbe, two of which resolve
semaphore lock issues. The third fix resolves several issues in the
previous implementation of the SFF data dumps of SFP+ modules.
The remaining ixgbe and pci patches are from Jacob Keller. The pci
patches exposes bus speed, link speed and bus width so that drivers
can take advantage of this information. In addition, adds a pci function
which obtains minimum link width and speed. Jacob also provides the
ixgbe patch to incorporate the pci function. He provides a patch that
fixes a lockdep issue created due to ixgbe_ptp_stop always running
cancel_work_sync even if the work item had not been created properly with
INIT_WORK. This issue was found and reported by Stephen Hemminger.
The following are changes since commit fe6f700d6cbb7e8a61711e325f53d9c9e0a42a4c:
net/mlx4_core: Respond to operation request by firmware
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master
Alexander Duyck (1):
ixgbe: Use pci_vfs_assigned instead of ixgbe_vfs_are_assigned
Don Skidmore (4):
ixgbe: fix fc autoneg ethtool reporting.
ixgbe: add new media type
ixgbe: bump version number
ixgbe: add support for quad-port x520 adapter
Emil Tantilov (3):
ixgbe: fix semaphore lock for I2C read/writes on 82598
ixgbe: fix SFF data dumps of SFP+ modules
ixgbe: clear semaphore bits on timeouts
Greg Rose (1):
ixgbe: Retain VLAN filtering in promiscuous + VT mode
Jacob Keller (6):
pci: expose pcie_link_speed and pcix_bus_speed arrays
pci: move enum pcie_link_width into pci.h
pci: Add function to obtain minimum link width and speed
ixgbe: call pcie_get_mimimum_link to check if device has enough
bandwidth
ixgbe: fix lockdep annotation issue for ptp's work item
ixgbe: rename LL_EXTENDED_STATS to use queue instead of q
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 7 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 34 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c | 231 ++++++++++-
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 88 +++--
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 94 ++---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 158 +++++++-
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | 470 ++++++++++++++++-------
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.h | 41 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 12 +-
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 101 +++--
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 12 +
drivers/pci/pci.c | 43 +++
drivers/pci/probe.c | 4 +-
include/linux/pci.h | 18 +
include/linux/pci_hotplug.h | 13 -
15 files changed, 983 insertions(+), 343 deletions(-)
--
1.7.11.7
^ permalink raw reply [flat|nested] 9+ messages in thread
* [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays
2013-07-29 12:51 [net-next 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
@ 2013-07-29 12:52 ` Jeff Kirsher
2013-07-29 18:44 ` Bjorn Helgaas
2013-07-29 12:52 ` [net-next 09/15] pci: move enum pcie_link_width into pci.h Jeff Kirsher
2013-07-29 12:52 ` [net-next 10/15] pci: Add function to obtain minimum link width and speed Jeff Kirsher
2 siblings, 1 reply; 9+ messages in thread
From: Jeff Kirsher @ 2013-07-29 12:52 UTC (permalink / raw)
To: davem, bhelgaas
Cc: Jacob Keller, netdev, gospo, sassmann, linux-pci, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
pcie_link_speed and pcix_bus_speed are arrays used by probe.c to correctly
convert lnksta register values into the pci_bus_speed enum. These static arrays
are useful outside probe for this purpose. This patch makes these defines into
const arrays and exposes them with an extern header in linux/include/pci.h
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/pci/probe.c | 4 ++--
include/linux/pci.h | 3 +++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 46ada5c..496c5b0 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -513,7 +513,7 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
return bridge;
}
-static unsigned char pcix_bus_speed[] = {
+const unsigned char pcix_bus_speed[] = {
PCI_SPEED_UNKNOWN, /* 0 */
PCI_SPEED_66MHz_PCIX, /* 1 */
PCI_SPEED_100MHz_PCIX, /* 2 */
@@ -532,7 +532,7 @@ static unsigned char pcix_bus_speed[] = {
PCI_SPEED_133MHz_PCIX_533 /* F */
};
-static unsigned char pcie_link_speed[] = {
+const unsigned char pcie_link_speed[] = {
PCI_SPEED_UNKNOWN, /* 0 */
PCIE_SPEED_2_5GT, /* 1 */
PCIE_SPEED_5_0GT, /* 2 */
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0fd1f15..95ff993 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -120,6 +120,9 @@ typedef int __bitwise pci_power_t;
/* Remember to update this when the list above changes! */
extern const char *pci_power_names[];
+extern const unsigned char pcix_bus_speed[];
+extern const unsigned char pcie_link_speed[];
+
static inline const char *pci_power_name(pci_power_t state)
{
return pci_power_names[1 + (int) state];
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [net-next 09/15] pci: move enum pcie_link_width into pci.h
2013-07-29 12:51 [net-next 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-07-29 12:52 ` [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays Jeff Kirsher
@ 2013-07-29 12:52 ` Jeff Kirsher
2013-07-29 18:39 ` Bjorn Helgaas
2013-07-29 12:52 ` [net-next 10/15] pci: Add function to obtain minimum link width and speed Jeff Kirsher
2 siblings, 1 reply; 9+ messages in thread
From: Jeff Kirsher @ 2013-07-29 12:52 UTC (permalink / raw)
To: davem, bhelgaas
Cc: Jacob Keller, netdev, gospo, sassmann, linux-pci, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
pcie_link_width is the enum used to define the link width values for a pcie
device. This enum should not be contained solely in pci_hotplug.h, and this
patch moves it next to pci_bus_speed in pci.h
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
include/linux/pci.h | 13 +++++++++++++
include/linux/pci_hotplug.h | 13 -------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 95ff993..fc2d1fb 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -186,6 +186,19 @@ enum pci_bus_flags {
PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
};
+/* These values come from the PCI Express Spec */
+enum pcie_link_width {
+ PCIE_LNK_WIDTH_RESRV = 0x00,
+ PCIE_LNK_X1 = 0x01,
+ PCIE_LNK_X2 = 0x02,
+ PCIE_LNK_X4 = 0x04,
+ PCIE_LNK_X8 = 0x08,
+ PCIE_LNK_X12 = 0x0C,
+ PCIE_LNK_X16 = 0x10,
+ PCIE_LNK_X32 = 0x20,
+ PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
+};
+
/* Based on the PCI Hotplug Spec, but some values are made up by us */
enum pci_bus_speed {
PCI_SPEED_33MHz = 0x00,
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
index 8db71dc..64e61e0 100644
--- a/include/linux/pci_hotplug.h
+++ b/include/linux/pci_hotplug.h
@@ -28,19 +28,6 @@
#ifndef _PCI_HOTPLUG_H
#define _PCI_HOTPLUG_H
-/* These values come from the PCI Express Spec */
-enum pcie_link_width {
- PCIE_LNK_WIDTH_RESRV = 0x00,
- PCIE_LNK_X1 = 0x01,
- PCIE_LNK_X2 = 0x02,
- PCIE_LNK_X4 = 0x04,
- PCIE_LNK_X8 = 0x08,
- PCIE_LNK_X12 = 0x0C,
- PCIE_LNK_X16 = 0x10,
- PCIE_LNK_X32 = 0x20,
- PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
-};
-
/**
* struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
* @owner: The module owner of this structure
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [net-next 10/15] pci: Add function to obtain minimum link width and speed
2013-07-29 12:51 [net-next 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-07-29 12:52 ` [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays Jeff Kirsher
2013-07-29 12:52 ` [net-next 09/15] pci: move enum pcie_link_width into pci.h Jeff Kirsher
@ 2013-07-29 12:52 ` Jeff Kirsher
2013-07-29 18:45 ` Bjorn Helgaas
2 siblings, 1 reply; 9+ messages in thread
From: Jeff Kirsher @ 2013-07-29 12:52 UTC (permalink / raw)
To: davem, bhelgaas
Cc: Jacob Keller, netdev, gospo, sassmann, linux-pci, Jeff Kirsher
From: Jacob Keller <jacob.e.keller@intel.com>
A PCI Express device can potentially report a link width and speed which it will
not properly fulfill due to being plugged into a slower link higher in the
chain. This function walks up the PCI bus chain and calculates the minimum link
width and speed of this entire chain. This can be useful to enable a device to
determine if it has enough bandwidth for optimum functionality.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/pci/pci.c | 43 +++++++++++++++++++++++++++++++++++++++++++
include/linux/pci.h | 2 ++
2 files changed, 45 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e37fea6..c71e78c 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3579,6 +3579,49 @@ int pcie_set_mps(struct pci_dev *dev, int mps)
}
/**
+ * pcie_get_minimum_link - determine minimum link settings of a PCI device
+ * @dev: PCI device to query
+ * @speed: storage for minimum speed
+ * @width: storage for minimum width
+ *
+ * This function will walk up the PCI device chain and determine the minimum
+ * link width and speed of the device.
+ */
+int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
+ enum pcie_link_width *width)
+{
+ int ret;
+
+ *speed = PCI_SPEED_UNKNOWN;
+ *width = PCIE_LNK_WIDTH_UNKNOWN;
+
+ while (dev) {
+ u16 lnksta;
+ enum pci_bus_speed next_speed;
+ enum pcie_link_width next_width;
+
+ ret = pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
+ if (ret)
+ return ret;
+
+ next_speed = pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS];
+ next_width = (lnksta & PCI_EXP_LNKSTA_NLW) >>
+ PCI_EXP_LNKSTA_NLW_SHIFT;
+
+ if (next_speed < *speed)
+ *speed = next_speed;
+
+ if (next_width < *width)
+ *width = next_width;
+
+ dev = dev->bus->self;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(pcie_get_minimum_link);
+
+/**
* pci_select_bars - Make BAR mask from the type of resource
* @dev: the PCI device for which BAR mask is made
* @flags: resource type mask to be selected
diff --git a/include/linux/pci.h b/include/linux/pci.h
index fc2d1fb..38994de 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -937,6 +937,8 @@ int pcie_get_readrq(struct pci_dev *dev);
int pcie_set_readrq(struct pci_dev *dev, int rq);
int pcie_get_mps(struct pci_dev *dev);
int pcie_set_mps(struct pci_dev *dev, int mps);
+int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
+ enum pcie_link_width *width);
int __pci_reset_function(struct pci_dev *dev);
int __pci_reset_function_locked(struct pci_dev *dev);
int pci_reset_function(struct pci_dev *dev);
--
1.7.11.7
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [net-next 09/15] pci: move enum pcie_link_width into pci.h
2013-07-29 12:52 ` [net-next 09/15] pci: move enum pcie_link_width into pci.h Jeff Kirsher
@ 2013-07-29 18:39 ` Bjorn Helgaas
0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2013-07-29 18:39 UTC (permalink / raw)
To: Jeff Kirsher
Cc: David Miller, Jacob Keller, netdev, gospo, sassmann,
linux-pci@vger.kernel.org
On Mon, Jul 29, 2013 at 6:52 AM, Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> pcie_link_width is the enum used to define the link width values for a pcie
> device. This enum should not be contained solely in pci_hotplug.h, and this
> patch moves it next to pci_bus_speed in pci.h
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> include/linux/pci.h | 13 +++++++++++++
> include/linux/pci_hotplug.h | 13 -------------
> 2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 95ff993..fc2d1fb 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -186,6 +186,19 @@ enum pci_bus_flags {
> PCI_BUS_FLAGS_NO_MMRBC = (__force pci_bus_flags_t) 2,
> };
>
> +/* These values come from the PCI Express Spec */
> +enum pcie_link_width {
> + PCIE_LNK_WIDTH_RESRV = 0x00,
> + PCIE_LNK_X1 = 0x01,
> + PCIE_LNK_X2 = 0x02,
> + PCIE_LNK_X4 = 0x04,
> + PCIE_LNK_X8 = 0x08,
> + PCIE_LNK_X12 = 0x0C,
> + PCIE_LNK_X16 = 0x10,
> + PCIE_LNK_X32 = 0x20,
> + PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
> +};
> +
> /* Based on the PCI Hotplug Spec, but some values are made up by us */
> enum pci_bus_speed {
> PCI_SPEED_33MHz = 0x00,
> diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h
> index 8db71dc..64e61e0 100644
> --- a/include/linux/pci_hotplug.h
> +++ b/include/linux/pci_hotplug.h
> @@ -28,19 +28,6 @@
> #ifndef _PCI_HOTPLUG_H
> #define _PCI_HOTPLUG_H
>
> -/* These values come from the PCI Express Spec */
> -enum pcie_link_width {
> - PCIE_LNK_WIDTH_RESRV = 0x00,
> - PCIE_LNK_X1 = 0x01,
> - PCIE_LNK_X2 = 0x02,
> - PCIE_LNK_X4 = 0x04,
> - PCIE_LNK_X8 = 0x08,
> - PCIE_LNK_X12 = 0x0C,
> - PCIE_LNK_X16 = 0x10,
> - PCIE_LNK_X32 = 0x20,
> - PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
> -};
> -
> /**
> * struct hotplug_slot_ops -the callbacks that the hotplug pci core can use
> * @owner: The module owner of this structure
> --
> 1.7.11.7
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays
2013-07-29 12:52 ` [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays Jeff Kirsher
@ 2013-07-29 18:44 ` Bjorn Helgaas
2013-07-29 21:03 ` Keller, Jacob E
0 siblings, 1 reply; 9+ messages in thread
From: Bjorn Helgaas @ 2013-07-29 18:44 UTC (permalink / raw)
To: Jeff Kirsher
Cc: David Miller, Jacob Keller, netdev, gospo, sassmann,
linux-pci@vger.kernel.org
On Mon, Jul 29, 2013 at 6:52 AM, Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> pcie_link_speed and pcix_bus_speed are arrays used by probe.c to correctly
> convert lnksta register values into the pci_bus_speed enum. These static arrays
> are useful outside probe for this purpose. This patch makes these defines into
> const arrays and exposes them with an extern header in linux/include/pci.h
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/pci/probe.c | 4 ++--
> include/linux/pci.h | 3 +++
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
> index 46ada5c..496c5b0 100644
> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -513,7 +513,7 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
> return bridge;
> }
>
> -static unsigned char pcix_bus_speed[] = {
> +const unsigned char pcix_bus_speed[] = {
> PCI_SPEED_UNKNOWN, /* 0 */
> PCI_SPEED_66MHz_PCIX, /* 1 */
> PCI_SPEED_100MHz_PCIX, /* 2 */
> @@ -532,7 +532,7 @@ static unsigned char pcix_bus_speed[] = {
> PCI_SPEED_133MHz_PCIX_533 /* F */
> };
>
> -static unsigned char pcie_link_speed[] = {
> +const unsigned char pcie_link_speed[] = {
> PCI_SPEED_UNKNOWN, /* 0 */
> PCIE_SPEED_2_5GT, /* 1 */
> PCIE_SPEED_5_0GT, /* 2 */
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 0fd1f15..95ff993 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -120,6 +120,9 @@ typedef int __bitwise pci_power_t;
> /* Remember to update this when the list above changes! */
> extern const char *pci_power_names[];
>
> +extern const unsigned char pcix_bus_speed[];
> +extern const unsigned char pcie_link_speed[];
As far as I can tell, you didn't actually add anything that uses
pcix_bus_speed[].
You added a pcie_link_speed[] use only in drivers/pci/pci.c; maybe
this extern declaration could go in drivers/pci/pci.h to limit its
visibility?
If you update this patch, note that we conventionally capitalize "PCI:
Expose ..." in the changelog summary, e.g., "git log --oneline
drivers/pci".
> static inline const char *pci_power_name(pci_power_t state)
> {
> return pci_power_names[1 + (int) state];
> --
> 1.7.11.7
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net-next 10/15] pci: Add function to obtain minimum link width and speed
2013-07-29 12:52 ` [net-next 10/15] pci: Add function to obtain minimum link width and speed Jeff Kirsher
@ 2013-07-29 18:45 ` Bjorn Helgaas
0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2013-07-29 18:45 UTC (permalink / raw)
To: Jeff Kirsher
Cc: David Miller, Jacob Keller, netdev, gospo, sassmann,
linux-pci@vger.kernel.org
On Mon, Jul 29, 2013 at 6:52 AM, Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
>
> A PCI Express device can potentially report a link width and speed which it will
> not properly fulfill due to being plugged into a slower link higher in the
> chain. This function walks up the PCI bus chain and calculates the minimum link
> width and speed of this entire chain. This can be useful to enable a device to
> determine if it has enough bandwidth for optimum functionality.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/pci.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> include/linux/pci.h | 2 ++
> 2 files changed, 45 insertions(+)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index e37fea6..c71e78c 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -3579,6 +3579,49 @@ int pcie_set_mps(struct pci_dev *dev, int mps)
> }
>
> /**
> + * pcie_get_minimum_link - determine minimum link settings of a PCI device
> + * @dev: PCI device to query
> + * @speed: storage for minimum speed
> + * @width: storage for minimum width
> + *
> + * This function will walk up the PCI device chain and determine the minimum
> + * link width and speed of the device.
> + */
> +int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
> + enum pcie_link_width *width)
> +{
> + int ret;
> +
> + *speed = PCI_SPEED_UNKNOWN;
> + *width = PCIE_LNK_WIDTH_UNKNOWN;
> +
> + while (dev) {
> + u16 lnksta;
> + enum pci_bus_speed next_speed;
> + enum pcie_link_width next_width;
> +
> + ret = pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
> + if (ret)
> + return ret;
> +
> + next_speed = pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS];
> + next_width = (lnksta & PCI_EXP_LNKSTA_NLW) >>
> + PCI_EXP_LNKSTA_NLW_SHIFT;
> +
> + if (next_speed < *speed)
> + *speed = next_speed;
> +
> + if (next_width < *width)
> + *width = next_width;
> +
> + dev = dev->bus->self;
> + }
> +
> + return 0;
> +}
> +EXPORT_SYMBOL(pcie_get_minimum_link);
> +
> +/**
> * pci_select_bars - Make BAR mask from the type of resource
> * @dev: the PCI device for which BAR mask is made
> * @flags: resource type mask to be selected
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index fc2d1fb..38994de 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -937,6 +937,8 @@ int pcie_get_readrq(struct pci_dev *dev);
> int pcie_set_readrq(struct pci_dev *dev, int rq);
> int pcie_get_mps(struct pci_dev *dev);
> int pcie_set_mps(struct pci_dev *dev, int mps);
> +int pcie_get_minimum_link(struct pci_dev *dev, enum pci_bus_speed *speed,
> + enum pcie_link_width *width);
> int __pci_reset_function(struct pci_dev *dev);
> int __pci_reset_function_locked(struct pci_dev *dev);
> int pci_reset_function(struct pci_dev *dev);
> --
> 1.7.11.7
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays
2013-07-29 18:44 ` Bjorn Helgaas
@ 2013-07-29 21:03 ` Keller, Jacob E
2013-07-29 21:19 ` Bjorn Helgaas
0 siblings, 1 reply; 9+ messages in thread
From: Keller, Jacob E @ 2013-07-29 21:03 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: Kirsher, Jeffrey T, David Miller, netdev, gospo@redhat.com,
sassmann@redhat.com, linux-pci@vger.kernel.org
T24gTW9uLCAyMDEzLTA3LTI5IGF0IDEyOjQ0IC0wNjAwLCBCam9ybiBIZWxnYWFzIHdyb3RlOg0K
PiBPbiBNb24sIEp1bCAyOSwgMjAxMyBhdCA2OjUyIEFNLCBKZWZmIEtpcnNoZXINCj4gPGplZmZy
ZXkudC5raXJzaGVyQGludGVsLmNvbT4gd3JvdGU6DQo+ID4gRnJvbTogSmFjb2IgS2VsbGVyIDxq
YWNvYi5lLmtlbGxlckBpbnRlbC5jb20+DQo+ID4NCj4gPiBwY2llX2xpbmtfc3BlZWQgYW5kIHBj
aXhfYnVzX3NwZWVkIGFyZSBhcnJheXMgdXNlZCBieSBwcm9iZS5jIHRvIGNvcnJlY3RseQ0KPiA+
IGNvbnZlcnQgbG5rc3RhIHJlZ2lzdGVyIHZhbHVlcyBpbnRvIHRoZSBwY2lfYnVzX3NwZWVkIGVu
dW0uIFRoZXNlIHN0YXRpYyBhcnJheXMNCj4gPiBhcmUgdXNlZnVsIG91dHNpZGUgcHJvYmUgZm9y
IHRoaXMgcHVycG9zZS4gVGhpcyBwYXRjaCBtYWtlcyB0aGVzZSBkZWZpbmVzIGludG8NCj4gPiBj
b25zdCBhcnJheXMgYW5kIGV4cG9zZXMgdGhlbSB3aXRoIGFuIGV4dG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VtbWFyeSwgZS5nLiwgImdpdCBsb2cgLS1vbmVsaW5lDQo+IGRyaXZlcnMvcGNpIi4N
Cg0KT2guIGdvb2QgdG8ga25vdywgSSB3aWxsIGtlZXAgdGhhdCBpbiBtaW5kIGZvciBmdXR1cmUu
DQo+IA0KPiA+ICBzdGF0aWMgaW5saW5lIGNvbnN0IGNoYXIgKnBjaV9wb3dlcl9uYW1lKHBjaV9w
b3dlcl90IHN0YXRlKQ0KPiA+ICB7DQo+ID4gICAgICAgICByZXR1cm4gcGNpX3Bvd2VyX25hbWVz
WzEgKyAoaW50KSBzdGF0ZV07DQo+ID4gLS0NCj4gPiAxLjcuMTEuNw0KPiA+DQoNClRoYW5rcywN
Ckpha2UNCg==
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays
2013-07-29 21:03 ` Keller, Jacob E
@ 2013-07-29 21:19 ` Bjorn Helgaas
0 siblings, 0 replies; 9+ messages in thread
From: Bjorn Helgaas @ 2013-07-29 21:19 UTC (permalink / raw)
To: Keller, Jacob E
Cc: Kirsher, Jeffrey T, David Miller, netdev, gospo@redhat.com,
sassmann@redhat.com, linux-pci@vger.kernel.org
On Mon, Jul 29, 2013 at 3:03 PM, Keller, Jacob E
<jacob.e.keller@intel.com> wrote:
> On Mon, 2013-07-29 at 12:44 -0600, Bjorn Helgaas wrote:
>> On Mon, Jul 29, 2013 at 6:52 AM, Jeff Kirsher
>> <jeffrey.t.kirsher@intel.com> wrote:
>> > From: Jacob Keller <jacob.e.keller@intel.com>
>> >
>> > pcie_link_speed and pcix_bus_speed are arrays used by probe.c to correctly
>> > convert lnksta register values into the pci_bus_speed enum. These static arrays
>> > are useful outside probe for this purpose. This patch makes these defines into
>> > const arrays and exposes them with an extern header in linux/include/pci.h
>> >
>> > Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>> > Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
>> > Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
>> > ---
>> > drivers/pci/probe.c | 4 ++--
>> > include/linux/pci.h | 3 +++
>> > 2 files changed, 5 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
>> > index 46ada5c..496c5b0 100644
>> > --- a/drivers/pci/probe.c
>> > +++ b/drivers/pci/probe.c
>> > @@ -513,7 +513,7 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
>> > return bridge;
>> > }
>> >
>> > -static unsigned char pcix_bus_speed[] = {
>> > +const unsigned char pcix_bus_speed[] = {
>> > PCI_SPEED_UNKNOWN, /* 0 */
>> > PCI_SPEED_66MHz_PCIX, /* 1 */
>> > PCI_SPEED_100MHz_PCIX, /* 2 */
>> > @@ -532,7 +532,7 @@ static unsigned char pcix_bus_speed[] = {
>> > PCI_SPEED_133MHz_PCIX_533 /* F */
>> > };
>> >
>> > -static unsigned char pcie_link_speed[] = {
>> > +const unsigned char pcie_link_speed[] = {
>> > PCI_SPEED_UNKNOWN, /* 0 */
>> > PCIE_SPEED_2_5GT, /* 1 */
>> > PCIE_SPEED_5_0GT, /* 2 */
>> > diff --git a/include/linux/pci.h b/include/linux/pci.h
>> > index 0fd1f15..95ff993 100644
>> > --- a/include/linux/pci.h
>> > +++ b/include/linux/pci.h
>> > @@ -120,6 +120,9 @@ typedef int __bitwise pci_power_t;
>> > /* Remember to update this when the list above changes! */
>> > extern const char *pci_power_names[];
>> >
>> > +extern const unsigned char pcix_bus_speed[];
>> > +extern const unsigned char pcie_link_speed[];
>>
>> As far as I can tell, you didn't actually add anything that uses
>> pcix_bus_speed[].
>>
>
> I mostly added this for consistency...
>
>> You added a pcie_link_speed[] use only in drivers/pci/pci.c; maybe
>> this extern declaration could go in drivers/pci/pci.h to limit its
>> visibility?
>
> Pretty sure I use the pcie_link_speed in the ixgbe driver by including
> the linux/pci.h header... Check patch 11/15 of this series where I
> actually use the values, so it would need to be in the linux/pci.h
> header.
I'm not sure I was copied on patch 11/15. I assume it might be
"ixgbe: call pcie_get_mimimum_link to check if device has enough
bandwidth", and I see that patch uses the pci_bus_speed enum, so the
enum definitely needs to be in include/linux/pci.h. But I don't see
the pcie_link_speed[] reference.
I did fetch your git tree and searched the diffs themselves but the
only use I saw was in pcie_get_minimum_link() in drivers/pci/pci.c.
Bjorn
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-07-29 21:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 12:51 [net-next 00/15][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-07-29 12:52 ` [net-next 08/15] pci: expose pcie_link_speed and pcix_bus_speed arrays Jeff Kirsher
2013-07-29 18:44 ` Bjorn Helgaas
2013-07-29 21:03 ` Keller, Jacob E
2013-07-29 21:19 ` Bjorn Helgaas
2013-07-29 12:52 ` [net-next 09/15] pci: move enum pcie_link_width into pci.h Jeff Kirsher
2013-07-29 18:39 ` Bjorn Helgaas
2013-07-29 12:52 ` [net-next 10/15] pci: Add function to obtain minimum link width and speed Jeff Kirsher
2013-07-29 18:45 ` Bjorn Helgaas
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).