ixgbe: Add SR-IOV features to main module
Subsystems (2)
[email protected]
Acked-by Peter P Waskiewicz JrFrom: Greg Rose <[email protected]>
Adds SR-IOV features supported by the 82599 controller to the main driver module. If the CONFIG_PCI_IOV kernel option is selected then the SR-IOV features are enabled. Use the max_vfs module option to allocate up to 63 virtual functions per physical port.
---
+static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter) +{
+ struct ixgbe_hw *hw = &adapter->hw; + u32 gcr; + u32 gpie; + u32 vmdctl;
+
+#ifdef CONFIG_PCI_IOV
+ /* disable iov and allow time for transactions to clear */
+ pci_disable_sriov(adapter->pdev);
+#endif
+ msleep(500);
what is the sleep used for ?
if this is to wait for pci_disable then add it
in the #ifdef above.
i s there a registerthat can be checked to ensure that the device is in the expected state ? (similar to line 311 of the orginal patch)
@@ -2269,6 +2376,20 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
}
IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc);+ if (adapter->num_vfs) {
+ u32 reg;
+
+ /* Map PF MAC address in RAR Entry 0 to first pool
+ * following VFs */
+ hw->mac.ops.set_vmdq(hw, 0, adapter->num_vfs);
+
+ /* Set up VF register offsets for selected VT Mode, i.e.
+ * 64 VFs for SR-IOV */
+ reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
+ reg |= 0x80000003;
what is the significance of the 0x80000003 ?
Quoted 32 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, December 09, 2009 5:15 PM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; Rose, Gregory V; Waskiewicz Jr, Peter P
Subject: Re: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main moduleFrom: Greg Rose <[email protected]>
Adds SR-IOV features supported by the 82599 controller to the main driver
module. If theCONFIG_PCI_IOVkernel option is selected then the SR-IOV features are enabled. Use themax_vfsmodule option to allocate up to 63
virtual functions per physical port.---
(quoted diff) +12
-0+static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter) +{ + struct ixgbe_hw *hw = &adapter->hw; + u32 gcr; + u32 gpie; + u32 vmdctl; + +#ifdef CONFIG_PCI_IOV + /* disable iov and allow time for transactions to clear */ + pci_disable_sriov(adapter->pdev); +#endif + msleep(500);
Quoted 1 line
what is the sleep used for ?
[Rose, Gregory V]
It's mostly a safety valve to give plenty of time for all bus transactions to complete or time out.
Quoted 5 lines
if this is to wait for
pci_disablethen add it
in the #ifdef above.
i s there a registerthat can be checked to ensure that the device is in the expected state ? (similar to line 311 of the orginal patch)
[Rose, Gregory V]
Not reliably.
Quoted 19 lines
(quoted diff) +11
-0@@ -2269,6 +2376,20 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) } IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); + if (adapter->num_vfs) { + u32 reg; + + /* Map PF MAC address in RAR Entry 0 to first pool + * following VFs */ + hw->mac.ops.set_vmdq(hw, 0, adapter->num_vfs); + + /* Set up VF register offsets for selected VT Mode, i.e. + * 64 VFs for SR-IOV */ + reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); + reg |= 0x80000003;
Quoted 1 line
what is the significance of the
0x80000003?
[Rose, Gregory V]
Oh, a magic number. We'll fix that.
In this case it's to set up the correct PCIe configuration on the device.
- Greg
Quoted 32 lines · Gregory V
Quoted 32 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, December 09, 2009 5:15 PM
To: Kirsher, Jeffrey T
Cc: [email protected]; [email protected]; Rose, Gregory V; Waskiewicz Jr, Peter P
Subject: Re: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main moduleFrom: Greg Rose <[email protected]>
Adds SR-IOV features supported by the 82599 controller to the main driver
module. If theCONFIG_PCI_IOVkernel option is selected then the SR-IOV features are enabled. Use themax_vfsmodule option to allocate up to 63
virtual functions per physical port.---
(quoted diff) +12
-0+static inline void ixgbe_disable_sriov(struct ixgbe_adapter *adapter) +{ + struct ixgbe_hw *hw = &adapter->hw; + u32 gcr; + u32 gpie; + u32 vmdctl; + +#ifdef CONFIG_PCI_IOV + /* disable iov and allow time for transactions to clear */ + pci_disable_sriov(adapter->pdev); +#endif + msleep(500);
Quoted 4 lines
Quoted 1 line
what is the sleep used for ?
[Rose, Gregory V]
It's mostly a safety valve to give plenty of time for all bus transactions to complete or time out.
I think Chavey is pointing out that if CONFIG_PCI_IOV is not enabled, you'd be sleeping for 500 msecs for no reason. You should probably stick the msleep(500) inside the ifdef.
-PJ
Quoted 40 lines
Quoted 6 lines
if this is to wait for
pci_disablethen add it
in the #ifdef above.
i s there a registerthat can be checked to ensure that the device is in the expected state ? (similar to line 311 of the orginal patch)[Rose, Gregory V]
Not reliably.
Quoted 19 lines
(quoted diff) +11
-0@@ -2269,6 +2376,20 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter) } IXGBE_WRITE_REG(hw, IXGBE_MRQC, mrqc); + if (adapter->num_vfs) { + u32 reg; + + /* Map PF MAC address in RAR Entry 0 to first pool + * following VFs */ + hw->mac.ops.set_vmdq(hw, 0, adapter->num_vfs); + + /* Set up VF register offsets for selected VT Mode, i.e. + * 64 VFs for SR-IOV */ + reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT); + reg |= 0x80000003;Quoted 1 line
what is the significance of the
0x80000003?[Rose, Gregory V]
Oh, a magic number. We'll fix that.
In this case it's to set up the correct PCIe configuration on the device.
- Greg
Quoted 8 lines
-----Original Message-----
From: Waskiewicz Jr, Peter P
Sent: Wednesday, December 09, 2009 5:44 PM
To: Rose, Gregory V
Cc: [email protected]; Kirsher, Jeffrey T; [email protected]; [email protected]; Waskiewicz Jr, Peter P
Subject: RE: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main module
Quoted 4 lines
Quoted 2 lines · Gregory V
Quoted 2 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
[snippage]
Quoted 18 lines
Quoted 1 line
Quoted 1 line
+static inline void ixgbe_disable_sriov(struct
ixgbe_adapter*adapter)
Quoted 12 lines
Quoted 12 lines
(quoted diff) +11
-0+{ + struct ixgbe_hw *hw = &adapter->hw; + u32 gcr; + u32 gpie; + u32 vmdctl; + +#ifdef CONFIG_PCI_IOV + /* disable iov and allow time for transactions to clear */ + pci_disable_sriov(adapter->pdev); +#endif + msleep(500);Quoted 4 lines
Quoted 1 line
what is the sleep used for ?
[Rose, Gregory V]
It's mostly a safety valve to give plenty of time for all bus
Quoted 8 lines
transactions to complete or time out.
I think Chavey is pointing out that if
CONFIG_PCI_IOVis not enabled, you'd be sleeping for 500 msecs for no reason. You should probably stick
the msleep(500) inside the ifdef.-PJ
[Rose, Gregory V]
Oh, missed that due to my preconceptions. My reading of the code is that this function should never be called unless SR-IOV was enabled in the first place (could be wrong of course). However, for code correctness and readability I agree that the msleep should be moved within the #ifdef.
Added to my community comment notes.
- Greg
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
(quoted diff) +5
-0+#ifdef CONFIG_PCI_IOV + /* disable iov and allow time for transactions to clear */ + pci_disable_sriov(adapter->pdev); +#endif + msleep(500);
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
what is the sleep used for ?
[Rose, Gregory V]
It's mostly a safety valve to give plenty of time for all bus transactions to complete or time out.
I think Chavey is pointing out that if
CONFIG_PCI_IOVis not enabled, you'd be sleeping for 500 msecs for no reason. You should probably stick the msleep(500) inside the ifdef.
pci_disable_sriov() calls sriov_disable(), which already does ssleep(1). Do you really need another 500 msec of sleep after that 1000 msecs? My impression of the PCI spec was that the 1 second wait is supposed to be sufficient.
- R.
Quoted 23 lines
-----Original Message-----
From: Roland Dreier [mailto:[email protected]]
Sent: Thursday, December 10, 2009 11:58 AM
To: Waskiewicz Jr, Peter P
Cc: Rose, Gregory V; [email protected]; Kirsher, Jeffrey T; [email protected]; [email protected]
Subject: Re: [RFC PATCH 05/12] ixgbe: Add SR-IOV features to main moduleQuoted 10 lines
Quoted 10 lines
Quoted 7 lines
(quoted diff) +5
-0+#ifdef CONFIG_PCI_IOV + /* disable iov and allow time for transactions to clear */ + pci_disable_sriov(adapter->pdev); +#endif + msleep(500);what is the sleep used for ?
[Rose, Gregory V]
It's mostly a safety valve to give plenty of time for all bus
transactions to complete or time out.
Quoted 3 lines
I think Chavey is pointing out that if
CONFIG_PCI_IOVis not enabled, you'd be sleeping for 500 msecs for no reason. You should probably
Quoted 7 lines
stick
Quoted 1 line
the msleep(500) inside the ifdef.
pci_disable_sriov()callssriov_disable(), which already does ssleep(1). Do you really need another 500 msec of sleep after that 1000 msecs? My impression of the PCI spec was that the 1 second wait is supposed to be sufficient.
[Rose, Gregory V]
I think you're correct. I'll just pull the msleep(500) and do some local functional testing to make sure it doesn't cause any problems. If not then I'll remove it permanently.
- Greg