aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ef10.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-06-15sfc: Fix VLAN filtering feature if vPort has VLAN_RESTRICT flagAndrew Rybchenko1-0/+39
If vPort has VLAN_RESTRICT flag, VLAN tagged traffic will not be delivered without corresponding Rx filters which may be proxied to and moderated by hypervisor. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: VLAN filters must only be created if the firmware supports this.Martin Habets1-0/+13
If it is not supported we simply disable the feature. For the feature to work we need firmware filter support for OUTER_VID + LOC_MAC and for OUTER_VID + LOC_MAC_IG. The low-latency firmware can match on OUTER_VID + LOC_MAC but not on OUTER_VID + LOC_MAC_IG. For the capture packet firmware it is the other way around. Only the full-feature variant can match on both combinations. Incorporates a fix by Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> in the net_dev->[hw_]features handling. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Fix dup unknown multicast/unicast filters after datapath resetAndrew Rybchenko1-11/+69
Filter match flags are not unique criteria to be mapped to priority because of both unknown unicast and unknown multicast are mapped to LOC_MAC_IG. So, local MAC is required to map filter to priority. MCDI filter flags is unique criteria to find filter priority. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Refactor checks for invalid filter IDEdward Cree1-26/+13
Nearly every time we call efx_ef10_filter_remove_unsafe, we first check for EFX_EF10_FILTER_ID_INVALID, in which case we do nothing. So move that check into the function, simplifying all the call sites. Also, change the return type to void, since none of the callers check it. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Take mac_lock before calling efx_ef10_filter_table_probeMartin Habets1-0/+4
When trying to enslave an SFC interface to a bond the following BUG_ON was hit: kernel BUG [in ef10.c]! CPU: 0 PID: 4383 Comm: ifenslave Tainted: G ... Call Trace: efx_ef10_filter_add_vlan+0x121/0x180 [sfc] efx_ef10_filter_table_probe+0x2a2/0x4f0 [sfc] efx_ef10_set_mac_address+0x370/0x6d0 [sfc] efx_set_mac_address+0x7d/0x120 [sfc] dev_set_mac_address+0x43/0xa0 bond_enslave+0x337/0xea0 [bonding] This comes from function efx_ef10_filter_vlan_sync_rx_mode. To solve the bug we ensure the mac_lock is taken before calling efx_ef10_filter_add_vlan. But to avoid a priority inversion mac_lock must be taken before filter_sem. To satisfy these requirements we end up taking mac_lock in efx_ef10_vport_set_mac_address, efx_ef10_set_mac_address, efx_ef10_sriov_set_vf_vlan and efx_probe_filters. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Implement ndo_vlan_rx_{add, kill}_vid() callbacksAndrew Rybchenko1-0/+86
Supports HW VLAN filtering, en/disabled using ethtool. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Implement list of VLANs added over interfaceAndrew Rybchenko1-35/+290
Right now it contains dummy VLAN entry with unspecified VID only. The entry is used for the case when HW VLAN filtering is not used. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Make EF10 filter management helper functions VLAN-awareAndrew Rybchenko1-29/+41
It is a step to support VLAN filtering in HW. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Store unicast and multicast promisc flag with address cacheAndrew Rybchenko1-15/+15
These flags are built when address cache is updated. The information will be required when VLAN filtering is added and address cache is used without re-sync. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Move filter IDs to per-VLAN data structureAndrew Rybchenko1-37/+51
It is a step to support VLAN filtering in HW. Until then, there is only one struct efx_ef10_filter_vlan per struct efx_ef10_filter_table, with no VLAN information yet. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Forget filter ID when the filter is marked oldAndrew Rybchenko1-20/+33
It is required to remove setting of filter IDs to invalid from multicast and unicast addresses caching functions. Add initialization to invalid when filter table is created. Add paranoid checks to track consistency. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Assert filter_sem write locked when requiredEdward Cree1-1/+15
Based on a patch by Andrew Rybchenko <Andrew.Rybchenko@oktetlabs.ru> Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Move last mc_promisc flag to EF10 filter table stateAndrew Rybchenko1-2/+5
It is used for EF10 only and logically belongs to EF10 filter table state. It is OK that it is reset to false on filter table recreation since all filters are removed on destruction. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-06-15sfc: Define macro with EF10 offload featureAndrew Rybchenko1-4/+8
It is useful to simplify features addition. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-05-25sfc: on MC reset, clear PIO buffer linkage in TXQsEdward Cree1-0/+16
Otherwise, if we fail to allocate new PIO buffers, our TXQs will try to use the old ones, which aren't there any more. Fixes: 183233bec810 "sfc: Allocate and link PIO buffers; map them with write-combining" Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2016-04-28sfc: disable RSS when unsupportedJon Cooper1-2/+13
When certain firmware variants are selected (via the sfboot utility) the SFC7000 and SFC8000 series NICs don't support RSS. The driver still tries (and fails) to insert filters with the RSS flag, and the NIC fails to pass traffic. When the firmware reports RSS_LIMITED suppress allocating a default RSS context. The absence of an RSS context is picked up in filter insertion and RSS flags are discarded. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-23sfc: Downgrade or remove some error messagesBert Kenward1-6/+14
Depending on configuration the NIC may return errors for unprivileged functions and/or VFs. Where these are expected and handled, reduce the level of any output. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-23sfc: Make failed filter removal less noisyBert Kenward1-17/+31
There are situations - mostly reset related - where our view of the filter table differs from the hardware. In this case we may try and remove filters that aren't actually installed. This isn't that interesting in most situations, so downgrade the logging. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-17Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-12/+12
Conflicts: drivers/net/geneve.c Here we had an overlapping change, where in 'net' the extraneous stats bump was being removed whilst in 'net-next' the final argument to udp_tunnel6_xmit_skb() was being changed. Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-12sfc: only use RSS filters if we're using RSSBert Kenward1-12/+12
Without this, filter insertion on a VF would fail if only one channel was in use. This would include the unicast station filter and therefore no traffic would be received. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-05sfc: check warm_boot_count after other functions have been resetDaniel Pieczko1-2/+13
A change in MCFW behaviour means that the net driver must update its record of the warm_boot_count by reading it from the ER_DZ_BIU_MC_SFT_STATUS register. On v4.6.x MCFW the global boot count was incremented when some functions needed to be reset to enable multicast chaining, so all functions saw the same value. In that case, the driver needed to increment its warm_boot_count when other functions were reset, to avoid noticing it later and then trying to reset itself to recover unnecessarily. With v4.7+ MCFW, the boot count in firmware doesn't change as that is unnecessary since the PFs that have been reset will each receive an MC reboot notification. In that case, the driver re-reads the unchanged value. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-12-01sfc: make TSO version a per-queue parameterBert Kenward1-7/+6
The Solarflare 8000 series NIC will use a new TSO scheme. The current driver refuses to load if the current TSO scheme is not found. Remove that check and instead make the TSO version a per-queue parameter. Signed-off-by: Bert Kenward <bkenward@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-11-03Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+3
Minor overlapping changes in net/ipv4/ipmr.c, in 'net' we were fixing the "BH-ness" of the counter bumps whilst in 'net-next' the functions were modified to take an explicit 'net' parameter. Signed-off-by: David S. Miller <davem@davemloft.net>
2015-11-02sfc: push partner queue for skb->xmit_moreMartin Habets1-1/+3
When the IP stack passes SKBs the sfc driver puts them in 2 different TX queues (called partners), one for checksummed and one for not checksummed. If the SKB has xmit_more set the driver will delay pushing the work to the NIC. When later it does decide to push the buffers this patch ensures it also pushes the partner queue, if that also has any delayed work. Before this fix the work in the partner queue would be left for a long time and cause a netdev watchdog. Fixes: 70b33fb ("sfc: add support for skb->xmit_more") Reported-by: Jianlin Shi <jishi@redhat.com> Signed-off-by: Martin Habets <mhabets@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-12sfc: fully reset if MC_REBOOT event received without warm_boot_count incrementDaniel Pieczko1-11/+19
On EF10, MC_CMD_VPORT_RECONFIGURE can cause a CODE_MC_REBOOT event to be sent to a function without incrementing the (adapter-wide) warm_boot_count. In this case, the reboot is not detected by the loop on efx_mcdi_poll_reboot(), so prepare for recovery from an MC reboot anyway. When this codepath is run, the MC has always just rebooted, so this recovery is valid. The loop on efx_mcdi_poll_reboot() is still required for other MC reboot cases, so that actions in response to an MC reboot are performed, such as clearing locally calculated statistics. Siena NICs are unaffected by this change as the above scenario does not apply. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-08-28sfc: Allow driver to cope with a lower number of VIs than it needs for RSSShradha Shah1-10/+29
Previously, the driver would refuse to load if it couldn't secure enough VIs from the MC to fulfill its RSS requirements. This was causing probe to fail on later functions in configurations where we'd run out of VIs, such as having many VFs. This change allows the driver to load with fewer VIs, down to a minimum of 2. A warning will be printed saying that RSS requirements were not met, possibly affecting performance. efx->max_tx_channels needs to be set to avoid going down the failure path in efx_probe_nic() immediately in the loop after the probe() NIC-type function. Also, Set rc=ENOSPC when bombing out of efx_probe_nic due to lack of VIs. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-08-27Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+26
2015-08-27sfc: only use vadaptor stats if firmware is capableBert Kenward1-1/+26
Some of the stats handling code differs based on SR-IOV support, and SRIOV support is only available if full-featured firmware is used. Do not use vadaptor stats if firmware mode is not set to full-featured. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-31sfc: MC allocations must be restored following an entity resetDaniel Pieczko1-4/+12
Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-31sfc: allow ethtool selftest and MC reboot to complete on an unprivileged functionDaniel Pieczko1-0/+8
The policy in the net driver is to attempt MCDI commands and then handle any EPERM error codes appropriately when returned by unprivileged functions. The ethtool selftest contains some tests which are useful on an unprivileged function, such as the event queue interrupt tests, but other tests cannot be performed as the function does not have the required permissions. If a test returns -EPERM, act as though the test was not run and continue. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: clean fallbacks between promisc/normal in efx_ef10_filter_sync_rx_modeEdward Cree1-80/+208
Separate functions for inserting individual and promisc filters; explicit fallback logic in efx_ef10_filter_sync_rx_mode(), in order not to overload the 'promisc' flag as also meaning "fall back to promisc". Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: support cascaded multicast filtersDaniel Pieczko1-14/+42
If the workaround to support cascaded multicast filters ("workaround_26807") is enabled, the broadcast filter and individual multicast filters are not inserted when in promiscuous or allmulti mode. There is a race while inserting and removing filters when entering and leaving promiscuous mode. When changing promiscuous state with cascaded multicast filters, the old multicast filters are removed before inserting the new filters to avoid duplicating packets; this can lead to dropped packets until all filters have been inserted. The efx_nic:mc_promisc flag is added to record the presence of a multicast promiscuous filter; this gives a simple way to tell if the promiscuous state is changing. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: re-factor efx_ef10_filter_sync_rx_mode()Daniel Pieczko1-91/+126
This change is only re-factoring; there are no changes to functionality except for a slight elaboration of an error message (on mismatch filter insertion failure). Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: Insert multicast filters as well as mismatch filters in promiscuous modeJon Cooper1-51/+53
If a function is in promiscuous mode and another function has a broadcast or multicast filter inserted, the function in promiscuous mode won't see that broadcast or multicast traffic. Most notably this breaks broadcast, which means ARP doesn't work. Less show-stoppingly, a function listening on a multicast address that's also in promiscuous mode will not see that multicast traffic if another function is also listening on that multicast address. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: warn if other functions have been reset by MCFWDaniel Pieczko1-3/+14
When enabling the workaround for cascaded multicast filters, the MC can reset other functions if they have already inserted filters. In that case, the workaround has been enabled, but print an info message in the log recording that other functions had to be reset. As other functions were reset, the MC will have incremented its boot count, so also increment the warm_boot_count on the function which enabled the workaround, as that function won't have received an MC reboot event and does not need to reset. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: add output flag decoding to efx_mcdi_set_workaroundDaniel Pieczko1-3/+4
The initial use of this will be to check a flag reporting if an FLR was performed on other functions when enabling cascaded multicast filters. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: cope with ENOSYS from efx_mcdi_get_workarounds()Edward Cree1-13/+20
GET_WORKAROUNDS was only introduced in May 2014, not all firmware will have it. So call sites need to handle ENOSYS. In this case we're probing the bug26807 workaround, which is not implemented in any firmware that doesn't have GET_WORKAROUNDS. So interpret ENOSYS as 'false'. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-21sfc: enable cascaded multicast filters in MCFWDaniel Pieczko1-18/+45
After creating event queue 0, check to see if the workaround is enabled, and enable it if necessary. This will be called during PCI probe and also when coming back up after a reset. The nic_data->workaround_26807 will be used in the future to control the filter insertion behaviour based on this workaround. Only the primary PF can enable this workaround, so tolerate an EPERM error and continue. Otherwise, if any step in the checking and enabling of the workaround fails, the event queue must be removed. We check that workaround is implemented before trying to enable it, and store the current workaround setting before trying to change it. Signed-off-by: Edward Cree <ecree@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-08sfc: suppress handled MCDI failures when changing the MAC addressDaniel Pieczko1-2/+5
Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-08sfc: add legacy method for changing a PF's MAC addressDaniel Pieczko1-0/+120
Some versions of MCFW do not support the MC_CMD_VADAPTOR_SET_MAC command, and ENOSYS will be returned. If the PF created its own vport, the function's datapath must be stopped and the vport can be reconfigured to reflect the new MAC address. If the MCFW created the vport for the PF (which is the case when the nic_data->vport_mac is blank), nothing further needs to be done as the vport is not under the control of the PF. This only applies to PFs because the MCFW in question does not support VFs. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-07-08sfc: refactor code in efx_ef10_set_mac_address()Daniel Pieczko1-25/+20
Re-organize the structure of error handling to avoid having to duplicate the netif_err() around the ifdefs. The only change to the behaviour of the error-handling is that the PF's data structure to record VF details should only be updated if the original command succeeded. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: leak vports if a VF is assigned during PF unloadDaniel Pieczko1-0/+20
If any VF is assigned as the PF is unloaded, do not attempt to remove its vport or the vswitch. These will be removed if the driver binds to the PF again, as an entity reset occurs during probe. A 'force' flag is added to efx_ef10_pci_sriov_disable() to distinguish between disabling SR-IOV and driver unload. SR-IOV cannot be disabled if VFs are assigned to guests. If the PF driver is unloaded while VFs are assigned, the driver may try to bind to the VF again at a later point if the driver has been reloaded and the VF returns to the same domain as the PF. In this case, the PF will not have a VF data structure, so the VF can check this and drop out of probe early. In this case, efx->vf_count will be zero but VFs will be present. The user is advised to remove the VF and re-create it. The check at the beginning of efx_ef10_pci_sriov_disable() that efx->vf_count is non-zero is removed to allow SR-IOV to be disabled in this case. Also, if the PF driver is unloaded, it will disable SR-IOV to remove these unknown VFs. By not disabling bus-mastering if VFs are still assigned, the VF will continue to pass traffic after the PF has been removed. When using the max_vfs module parameter, if VFs are already present do not try to initialise any more. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: don't update stats on VF when called in atomic contextDaniel Pieczko1-2/+14
The ifenslave command to set up a bond runs in an atomic context, and it queries the stats on the devices that are being enslaved. A VF needs to make an MCDI call to update its stats, which is not allowed in atomic context. The releasing of the stats_lock is moved to the beginning of the VF stats update function so that in_interrupt() can be used; it must be taken again before returning from this function. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: suppress vadaptor stats when EVB is not presentDaniel Pieczko1-3/+9
The raw_mask array is not initialised, so it needs to be explicitly set to zero in the 'else' branch. If the EVB capability is not present, a port cannot have multiple functions so the per-port MAC stats are correct and should match the corresponding vadaptor stats, so this redundancy can be removed from the ethtool stats output. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: suppress ENOENT error messages from MC_CMD_MAC_STATSDaniel Pieczko1-3/+8
MC_CMD_MAC_STATS can be called on a function before a vadaptor has been created, as the kernel can call into this through ndo_get_stats/ndo_get_stats64. If MC_CMD_MAC_STATS is called before the DMA queues have been setup, so that a vadaptor has not been created yet, firmware will return ENOENT. This is expected, so suppress the MCDI error message in this case. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: update netdevice statistics to use vadaptor statsDaniel Pieczko1-19/+22
The netdevice statistics (in /proc/net/dev) are per-function stats so they must use the vadaptor stats. Change the use of MAC stats to vadaptor stats, and remove any statistics that can only be measured per-port. All stats that are removed will be shown as zeroes when these statistics are displayed. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: DMA the VF stats only when requestedDaniel Pieczko1-40/+109
Firmware does not support a periodic DMA of vadaptor-stats on VFs, so only update the stats buffer when stats are requested (when running "ethtool -S" or an ip/ifconfig command that reports stats). Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: display vadaptor statistics for all interfacesDaniel Pieczko1-4/+35
All interfaces will display vadaptor statistics, so set all the relevant bits in the stats bitmask. Only functions with the LINKCTRL flag will see other stats, including (per-port) MAC stats. The vadaptor stats are from rx_unicast to tx_overflow. Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: add "port_" prefix to MAC statsDaniel Pieczko1-124/+127
The MAC stats are per-port and will only be displayed on the PF with control of the link (one per physical port). Vadapter stats will also be displayed for this PF, so distinguish the MAC stats by adding a prefix of "port_". Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-02sfc: Implement ndo_gets_phys_port_id() for EF10 VFsShradha Shah1-0/+11
Signed-off-by: Shradha Shah <sshah@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>