Skip to content

Commit a2f23e0

Browse files
committed
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue
Jeff Kirsher says: ==================== Intel Wired LAN Driver Updates 2015-09-15 This series contains updates to ixgbe and fm10k. Don fixes a ixgbe issue by adding checks for systems that do not have SFP's to avoid incorrectly acting on interrupts that are falsely interpreted as SFP events. Alex Williamson adds a fix for ixgbe to disable SR-IOV prior to unregistering the netdev to avoid issues with guest OS's which do not support hot-unplug or their hot-unplug is broken. Alex Duyck update the lowest limit for adaptive interrupt interrupt moderation to about 12K interrupts per second for ixgbe. This change increases the performance for ixgbe. Also fixed up fm10k to remove the optimization that assumed that all fragments would be limited to page size, since that assumption is incorrect as the TCP allocator can provide up to a 32K page fragment. Updated fm10k to add the MAC address to the list of values recorded on driver load. Fixes fm10k so that we only trigger the data path reset if the fabric is ready to handle traffic to avoid triggering the reset unless the switch API is ready for us. Jacob updates the fm10k driver to disable the service task during suspend and re-enable it after we resume. If we don't do this, the device could be UP when you suspend and come back from resume as DOWN. Also update fm10k to prevent the removal of default VID rules, and correctly remove the stack layers information of the VLAN, but then return to forwarding that VID as untagged frames. If we deleted the VID rules here, we would begin dropping traffic due to VLAN membership violations. Fixed fm10k to use pcie_get_minimum_link(), which is useful in cases where we connect to a slot at Gen3, but the slot is behind a bus which is only connected at Gen2. Updated fm10k to update the netdev permanent address during reinit instead of up to enable users to immediately see the new MAC address on the VF even if the device is not up. Adds the creation of VLAN interfaces on a device, even while the device is down for fm10k. Fixed an issue where we request the incorrect MAC/VLAN combinations, and prevents us from accidentally reporting some frames as VLAN tagged. Provided a couple of trivial fixes for fm10k to fix code style and typos in code comments. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents c4047f5 + 9adbac5 commit a2f23e0

File tree

12 files changed

+252
-135
lines changed

12 files changed

+252
-135
lines changed

drivers/net/ethernet/intel/fm10k/fm10k_debugfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ static void *fm10k_dbg_desc_seq_start(struct seq_file *s, loff_t *pos)
3737
}
3838

3939
static void *fm10k_dbg_desc_seq_next(struct seq_file *s,
40-
void __always_unused *v, loff_t *pos)
40+
void __always_unused *v,
41+
loff_t *pos)
4142
{
4243
struct fm10k_ring *ring = s->private;
4344

4445
return (++(*pos) < ring->count) ? pos : NULL;
4546
}
4647

4748
static void fm10k_dbg_desc_seq_stop(struct seq_file __always_unused *s,
48-
__always_unused void *v)
49+
void __always_unused *v)
4950
{
5051
/* Do nothing. */
5152
}

drivers/net/ethernet/intel/fm10k/fm10k_iov.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,6 @@ int fm10k_iov_resume(struct pci_dev *pdev)
228228
hw->iov.ops.set_lport(hw, vf_info, i,
229229
FM10K_VF_FLAG_MULTI_CAPABLE);
230230

231-
/* assign our default vid to the VF following reset */
232-
vf_info->sw_vid = hw->mac.default_vid;
233-
234231
/* mailbox is disconnected so we don't send a message */
235232
hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
236233

drivers/net/ethernet/intel/fm10k/fm10k_main.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,11 @@ static unsigned int fm10k_process_skb_fields(struct fm10k_ring *rx_ring,
497497
if (rx_desc->w.vlan) {
498498
u16 vid = le16_to_cpu(rx_desc->w.vlan);
499499

500-
if (vid != rx_ring->vid)
500+
if ((vid & VLAN_VID_MASK) != rx_ring->vid)
501501
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vid);
502+
else if (vid & VLAN_PRIO_MASK)
503+
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
504+
vid & VLAN_PRIO_MASK);
502505
}
503506

504507
fm10k_type_trans(rx_ring, rx_desc, skb);
@@ -1079,22 +1082,17 @@ netdev_tx_t fm10k_xmit_frame_ring(struct sk_buff *skb,
10791082
struct fm10k_tx_buffer *first;
10801083
int tso;
10811084
u32 tx_flags = 0;
1082-
#if PAGE_SIZE > FM10K_MAX_DATA_PER_TXD
10831085
unsigned short f;
1084-
#endif
10851086
u16 count = TXD_USE_COUNT(skb_headlen(skb));
10861087

10871088
/* need: 1 descriptor per page * PAGE_SIZE/FM10K_MAX_DATA_PER_TXD,
10881089
* + 1 desc for skb_headlen/FM10K_MAX_DATA_PER_TXD,
10891090
* + 2 desc gap to keep tail from touching head
10901091
* otherwise try next time
10911092
*/
1092-
#if PAGE_SIZE > FM10K_MAX_DATA_PER_TXD
10931093
for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
10941094
count += TXD_USE_COUNT(skb_shinfo(skb)->frags[f].size);
1095-
#else
1096-
count += skb_shinfo(skb)->nr_frags;
1097-
#endif
1095+
10981096
if (fm10k_maybe_stop_tx(tx_ring, count + 3)) {
10991097
tx_ring->tx_stats.tx_busy++;
11001098
return NETDEV_TX_BUSY;

drivers/net/ethernet/intel/fm10k/fm10k_netdev.c

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
758758
struct fm10k_intfc *interface = netdev_priv(netdev);
759759
struct fm10k_hw *hw = &interface->hw;
760760
s32 err;
761+
int i;
761762

762763
/* updates do not apply to VLAN 0 */
763764
if (!vid)
@@ -775,8 +776,25 @@ static int fm10k_update_vid(struct net_device *netdev, u16 vid, bool set)
775776
if (!set)
776777
clear_bit(vid, interface->active_vlans);
777778

778-
/* if default VLAN is already present do nothing */
779-
if (vid == hw->mac.default_vid)
779+
/* disable the default VID on ring if we have an active VLAN */
780+
for (i = 0; i < interface->num_rx_queues; i++) {
781+
struct fm10k_ring *rx_ring = interface->rx_ring[i];
782+
u16 rx_vid = rx_ring->vid & (VLAN_N_VID - 1);
783+
784+
if (test_bit(rx_vid, interface->active_vlans))
785+
rx_ring->vid |= FM10K_VLAN_CLEAR;
786+
else
787+
rx_ring->vid &= ~FM10K_VLAN_CLEAR;
788+
}
789+
790+
/* Do not remove default VID related entries from VLAN and MAC tables */
791+
if (!set && vid == hw->mac.default_vid)
792+
return 0;
793+
794+
/* Do not throw an error if the interface is down. We will sync once
795+
* we come up
796+
*/
797+
if (test_bit(__FM10K_DOWN, &interface->state))
780798
return 0;
781799

782800
fm10k_mbx_lock(interface);
@@ -996,21 +1014,6 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
9961014
int xcast_mode;
9971015
u16 vid, glort;
9981016

999-
/* restore our address if perm_addr is set */
1000-
if (hw->mac.type == fm10k_mac_vf) {
1001-
if (is_valid_ether_addr(hw->mac.perm_addr)) {
1002-
ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
1003-
ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr);
1004-
ether_addr_copy(netdev->dev_addr, hw->mac.perm_addr);
1005-
netdev->addr_assign_type &= ~NET_ADDR_RANDOM;
1006-
}
1007-
1008-
if (hw->mac.vlan_override)
1009-
netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
1010-
else
1011-
netdev->features |= NETIF_F_HW_VLAN_CTAG_RX;
1012-
}
1013-
10141017
/* record glort for this interface */
10151018
glort = interface->glort;
10161019

@@ -1045,7 +1048,7 @@ void fm10k_restore_rx_state(struct fm10k_intfc *interface)
10451048
vid, true, 0);
10461049
}
10471050

1048-
/* update xcast mode before syncronizing addresses */
1051+
/* update xcast mode before synchronizing addresses */
10491052
hw->mac.ops.update_xcast_mode(hw, glort, xcast_mode);
10501053

10511054
/* synchronize all of the addresses */

drivers/net/ethernet/intel/fm10k/fm10k_pci.c

Lines changed: 145 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,21 @@ static void fm10k_reinit(struct fm10k_intfc *interface)
170170
/* reassociate interrupts */
171171
fm10k_mbx_request_irq(interface);
172172

173+
/* update hardware address for VFs if perm_addr has changed */
174+
if (hw->mac.type == fm10k_mac_vf) {
175+
if (is_valid_ether_addr(hw->mac.perm_addr)) {
176+
ether_addr_copy(hw->mac.addr, hw->mac.perm_addr);
177+
ether_addr_copy(netdev->perm_addr, hw->mac.perm_addr);
178+
ether_addr_copy(netdev->dev_addr, hw->mac.perm_addr);
179+
netdev->addr_assign_type &= ~NET_ADDR_RANDOM;
180+
}
181+
182+
if (hw->mac.vlan_override)
183+
netdev->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
184+
else
185+
netdev->features |= NETIF_F_HW_VLAN_CTAG_RX;
186+
}
187+
173188
/* reset clock */
174189
fm10k_ts_reset(interface);
175190

@@ -663,6 +678,10 @@ static void fm10k_configure_rx_ring(struct fm10k_intfc *interface,
663678
/* assign default VLAN to queue */
664679
ring->vid = hw->mac.default_vid;
665680

681+
/* if we have an active VLAN, disable default VID */
682+
if (test_bit(hw->mac.default_vid, interface->active_vlans))
683+
ring->vid |= FM10K_VLAN_CLEAR;
684+
666685
/* Map interrupt */
667686
if (ring->q_vector) {
668687
rxint = ring->q_vector->v_idx + NON_Q_VECTORS(hw);
@@ -861,10 +880,12 @@ void fm10k_netpoll(struct net_device *netdev)
861880

862881
#endif
863882
#define FM10K_ERR_MSG(type) case (type): error = #type; break
864-
static void fm10k_print_fault(struct fm10k_intfc *interface, int type,
883+
static void fm10k_handle_fault(struct fm10k_intfc *interface, int type,
865884
struct fm10k_fault *fault)
866885
{
867886
struct pci_dev *pdev = interface->pdev;
887+
struct fm10k_hw *hw = &interface->hw;
888+
struct fm10k_iov_data *iov_data = interface->iov_data;
868889
char *error;
869890

870891
switch (type) {
@@ -918,6 +939,30 @@ static void fm10k_print_fault(struct fm10k_intfc *interface, int type,
918939
"%s Address: 0x%llx SpecInfo: 0x%x Func: %02x.%0x\n",
919940
error, fault->address, fault->specinfo,
920941
PCI_SLOT(fault->func), PCI_FUNC(fault->func));
942+
943+
/* For VF faults, clear out the respective LPORT, reset the queue
944+
* resources, and then reconnect to the mailbox. This allows the
945+
* VF in question to resume behavior. For transient faults that are
946+
* the result of non-malicious behavior this will log the fault and
947+
* allow the VF to resume functionality. Obviously for malicious VFs
948+
* they will be able to attempt malicious behavior again. In this
949+
* case, the system administrator will need to step in and manually
950+
* remove or disable the VF in question.
951+
*/
952+
if (fault->func && iov_data) {
953+
int vf = fault->func - 1;
954+
struct fm10k_vf_info *vf_info = &iov_data->vf_info[vf];
955+
956+
hw->iov.ops.reset_lport(hw, vf_info);
957+
hw->iov.ops.reset_resources(hw, vf_info);
958+
959+
/* reset_lport disables the VF, so re-enable it */
960+
hw->iov.ops.set_lport(hw, vf_info, vf,
961+
FM10K_VF_FLAG_MULTI_CAPABLE);
962+
963+
/* reset_resources will disconnect from the mbx */
964+
vf_info->mbx.ops.connect(hw, &vf_info->mbx);
965+
}
921966
}
922967

923968
static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr)
@@ -941,7 +986,7 @@ static void fm10k_report_fault(struct fm10k_intfc *interface, u32 eicr)
941986
continue;
942987
}
943988

944-
fm10k_print_fault(interface, type, &fault);
989+
fm10k_handle_fault(interface, type, &fault);
945990
}
946991
}
947992

@@ -1705,22 +1750,86 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
17051750

17061751
static void fm10k_slot_warn(struct fm10k_intfc *interface)
17071752
{
1708-
struct device *dev = &interface->pdev->dev;
1753+
enum pcie_link_width width = PCIE_LNK_WIDTH_UNKNOWN;
1754+
enum pci_bus_speed speed = PCI_SPEED_UNKNOWN;
17091755
struct fm10k_hw *hw = &interface->hw;
1756+
int max_gts = 0, expected_gts = 0;
17101757

1711-
if (hw->mac.ops.is_slot_appropriate(hw))
1758+
if (pcie_get_minimum_link(interface->pdev, &speed, &width) ||
1759+
speed == PCI_SPEED_UNKNOWN || width == PCIE_LNK_WIDTH_UNKNOWN) {
1760+
dev_warn(&interface->pdev->dev,
1761+
"Unable to determine PCI Express bandwidth.\n");
17121762
return;
1763+
}
1764+
1765+
switch (speed) {
1766+
case PCIE_SPEED_2_5GT:
1767+
/* 8b/10b encoding reduces max throughput by 20% */
1768+
max_gts = 2 * width;
1769+
break;
1770+
case PCIE_SPEED_5_0GT:
1771+
/* 8b/10b encoding reduces max throughput by 20% */
1772+
max_gts = 4 * width;
1773+
break;
1774+
case PCIE_SPEED_8_0GT:
1775+
/* 128b/130b encoding has less than 2% impact on throughput */
1776+
max_gts = 8 * width;
1777+
break;
1778+
default:
1779+
dev_warn(&interface->pdev->dev,
1780+
"Unable to determine PCI Express bandwidth.\n");
1781+
return;
1782+
}
1783+
1784+
dev_info(&interface->pdev->dev,
1785+
"PCI Express bandwidth of %dGT/s available\n",
1786+
max_gts);
1787+
dev_info(&interface->pdev->dev,
1788+
"(Speed:%s, Width: x%d, Encoding Loss:%s, Payload:%s)\n",
1789+
(speed == PCIE_SPEED_8_0GT ? "8.0GT/s" :
1790+
speed == PCIE_SPEED_5_0GT ? "5.0GT/s" :
1791+
speed == PCIE_SPEED_2_5GT ? "2.5GT/s" :
1792+
"Unknown"),
1793+
hw->bus.width,
1794+
(speed == PCIE_SPEED_2_5GT ? "20%" :
1795+
speed == PCIE_SPEED_5_0GT ? "20%" :
1796+
speed == PCIE_SPEED_8_0GT ? "<2%" :
1797+
"Unknown"),
1798+
(hw->bus.payload == fm10k_bus_payload_128 ? "128B" :
1799+
hw->bus.payload == fm10k_bus_payload_256 ? "256B" :
1800+
hw->bus.payload == fm10k_bus_payload_512 ? "512B" :
1801+
"Unknown"));
17131802

1714-
dev_warn(dev,
1715-
"For optimal performance, a %s %s slot is recommended.\n",
1716-
(hw->bus_caps.width == fm10k_bus_width_pcie_x1 ? "x1" :
1717-
hw->bus_caps.width == fm10k_bus_width_pcie_x4 ? "x4" :
1718-
"x8"),
1719-
(hw->bus_caps.speed == fm10k_bus_speed_2500 ? "2.5GT/s" :
1720-
hw->bus_caps.speed == fm10k_bus_speed_5000 ? "5.0GT/s" :
1721-
"8.0GT/s"));
1722-
dev_warn(dev,
1723-
"A slot with more lanes and/or higher speed is suggested.\n");
1803+
switch (hw->bus_caps.speed) {
1804+
case fm10k_bus_speed_2500:
1805+
/* 8b/10b encoding reduces max throughput by 20% */
1806+
expected_gts = 2 * hw->bus_caps.width;
1807+
break;
1808+
case fm10k_bus_speed_5000:
1809+
/* 8b/10b encoding reduces max throughput by 20% */
1810+
expected_gts = 4 * hw->bus_caps.width;
1811+
break;
1812+
case fm10k_bus_speed_8000:
1813+
/* 128b/130b encoding has less than 2% impact on throughput */
1814+
expected_gts = 8 * hw->bus_caps.width;
1815+
break;
1816+
default:
1817+
dev_warn(&interface->pdev->dev,
1818+
"Unable to determine expected PCI Express bandwidth.\n");
1819+
return;
1820+
}
1821+
1822+
if (max_gts < expected_gts) {
1823+
dev_warn(&interface->pdev->dev,
1824+
"This device requires %dGT/s of bandwidth for optimal performance.\n",
1825+
expected_gts);
1826+
dev_warn(&interface->pdev->dev,
1827+
"A %sslot with x%d lanes is suggested.\n",
1828+
(hw->bus_caps.speed == fm10k_bus_speed_2500 ? "2.5GT/s " :
1829+
hw->bus_caps.speed == fm10k_bus_speed_5000 ? "5.0GT/s " :
1830+
hw->bus_caps.speed == fm10k_bus_speed_8000 ? "8.0GT/s " : ""),
1831+
hw->bus_caps.width);
1832+
}
17241833
}
17251834

17261835
/**
@@ -1739,7 +1848,6 @@ static int fm10k_probe(struct pci_dev *pdev,
17391848
{
17401849
struct net_device *netdev;
17411850
struct fm10k_intfc *interface;
1742-
struct fm10k_hw *hw;
17431851
int err;
17441852

17451853
err = pci_enable_device_mem(pdev);
@@ -1783,7 +1891,6 @@ static int fm10k_probe(struct pci_dev *pdev,
17831891

17841892
interface->netdev = netdev;
17851893
interface->pdev = pdev;
1786-
hw = &interface->hw;
17871894

17881895
interface->uc_addr = ioremap(pci_resource_start(pdev, 0),
17891896
FM10K_UC_ADDR_SIZE);
@@ -1825,24 +1932,12 @@ static int fm10k_probe(struct pci_dev *pdev,
18251932
/* Register PTP interface */
18261933
fm10k_ptp_register(interface);
18271934

1828-
/* print bus type/speed/width info */
1829-
dev_info(&pdev->dev, "(PCI Express:%s Width: %s Payload: %s)\n",
1830-
(hw->bus.speed == fm10k_bus_speed_8000 ? "8.0GT/s" :
1831-
hw->bus.speed == fm10k_bus_speed_5000 ? "5.0GT/s" :
1832-
hw->bus.speed == fm10k_bus_speed_2500 ? "2.5GT/s" :
1833-
"Unknown"),
1834-
(hw->bus.width == fm10k_bus_width_pcie_x8 ? "x8" :
1835-
hw->bus.width == fm10k_bus_width_pcie_x4 ? "x4" :
1836-
hw->bus.width == fm10k_bus_width_pcie_x1 ? "x1" :
1837-
"Unknown"),
1838-
(hw->bus.payload == fm10k_bus_payload_128 ? "128B" :
1839-
hw->bus.payload == fm10k_bus_payload_256 ? "256B" :
1840-
hw->bus.payload == fm10k_bus_payload_512 ? "512B" :
1841-
"Unknown"));
1842-
18431935
/* print warning for non-optimal configurations */
18441936
fm10k_slot_warn(interface);
18451937

1938+
/* report MAC address for logging */
1939+
dev_info(&pdev->dev, "%pM\n", netdev->dev_addr);
1940+
18461941
/* enable SR-IOV after registering netdev to enforce PF/VF ordering */
18471942
fm10k_iov_configure(pdev, 0);
18481943

@@ -1983,6 +2078,16 @@ static int fm10k_resume(struct pci_dev *pdev)
19832078
if (err)
19842079
return err;
19852080

2081+
/* assume host is not ready, to prevent race with watchdog in case we
2082+
* actually don't have connection to the switch
2083+
*/
2084+
interface->host_ready = false;
2085+
fm10k_watchdog_host_not_ready(interface);
2086+
2087+
/* clear the service task disable bit to allow service task to start */
2088+
clear_bit(__FM10K_SERVICE_DISABLE, &interface->state);
2089+
fm10k_service_event_schedule(interface);
2090+
19862091
/* restore SR-IOV interface */
19872092
fm10k_iov_resume(pdev);
19882093

@@ -2010,6 +2115,15 @@ static int fm10k_suspend(struct pci_dev *pdev,
20102115

20112116
fm10k_iov_suspend(pdev);
20122117

2118+
/* the watchdog tasks may read registers, which will appear like a
2119+
* surprise-remove event once the PCI device is disabled. This will
2120+
* cause us to close the netdevice, so we don't retain the open/closed
2121+
* state post-resume. Prevent this by disabling the service task while
2122+
* suspended, until we actually resume.
2123+
*/
2124+
set_bit(__FM10K_SERVICE_DISABLE, &interface->state);
2125+
cancel_work_sync(&interface->service_task);
2126+
20132127
rtnl_lock();
20142128

20152129
if (netif_running(netdev))

0 commit comments

Comments
 (0)