aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/ethtool.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-08-24sfc: Fix reporting of IPv4 full filters through ethtoolBen Hutchings1-2/+2
ETHTOOL_GRXCLSRULE returns filters for a TCP/IPv4 or UDP/IPv4 4-tuple with source and destination swapped. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-08-02sfc: Fix maximum number of TSO segments and minimum TX queue sizeBen Hutchings1-5/+11
Currently an skb requiring TSO may not fit within a minimum-size TX queue. The TX queue selected for the skb may stall and trigger the TX watchdog repeatedly (since the problem skb will be retried after the TX reset). This issue is designated as CVE-2012-3412. Set the maximum number of TSO segments for our devices to 100. This should make no difference to behaviour unless the actual MSS is less than about 700. Increase the minimum TX queue size accordingly to allow for 2 worst-case skbs, so that there will definitely be space to add an skb after we wake a queue. To avoid invalidating existing configurations, change efx_ethtool_set_ringparam() to fix up values that are too small rather than returning -EINVAL. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-07-17sfc: Use strlcpy() to copy ethtool stats namesBen Hutchings1-1/+1
Fix CID 113703 in the Coverity report on Linux. ethtool stats names are limited to 32 bytes including a null terminator. Use strlcpy() to ensure that we will always include the null terminator even if a source string becomes longer than this. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-05-10drivers/net: Convert compare_ether_addr to ether_addr_equalJoe Perches1-1/+1
Use the new bool function ether_addr_equal to add some clarity and reduce the likelihood for misuse of compare_ether_addr for sorting. Done via cocci script: $ cat compare_ether_addr.cocci @@ expression a,b; @@ - !compare_ether_addr(a, b) + ether_addr_equal(a, b) @@ expression a,b; @@ - compare_ether_addr(a, b) + !ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) == 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !ether_addr_equal(a, b) != 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) == 0 + !ether_addr_equal(a, b) @@ expression a,b; @@ - ether_addr_equal(a, b) != 0 + ether_addr_equal(a, b) @@ expression a,b; @@ - !!ether_addr_equal(a, b) + ether_addr_equal(a, b) Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-05-10sfc: Added support for new ethtool APIs for obtaining module eepromStuart Hodgson1-0/+35
Currently allows for SFP+ eeprom to be returned using the ethtool API. This can be extended in future to handle different eeprom formats and sizes Signed-off-by: Stuart Hodgson <smhodgson@solarflare.com> [bwh: Drop redundant validation, comment, whitespace] Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16sfc: Add SR-IOV back-end support for SFC9000 familyBen Hutchings1-1/+2
On the SFC9000 family, each port has 1024 Virtual Interfaces (VIs), each with an RX queue, a TX queue, an event queue and a mailbox register. These may be assigned to up to 127 SR-IOV virtual functions per port, with up to 64 VIs per VF. We allocate an extra channel (IRQ and event queue only) to receive requests from VF drivers. There is a per-port limit of 4 concurrent RX queue flushes, and queue flushes may be initiated by the MC in response to a Function Level Reset (FLR) of a VF. Therefore, when SR-IOV is in use, we submit all flush requests via the MC. The RSS indirection table is shared with VFs, so the number of RX queues used in the PF is limited to the number of VIs per VF. This is almost entirely the work of Steve Hodgson, formerly shodgson@solarflare.com. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-02-16sfc: Add support for configuring RX unicast/multicast default filtersBen Hutchings1-17/+42
On Siena all received packets that don't match a more specific filter will match the unicast or multicast default filter. Currently we leave these set to the default values (RSS with base queue number of 0). Allow them to be reconfigured to select a single RX queue. These default filters are programmed through the FILTER_CTL register, but we represent them internally as an additional table of size 2. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Make all MAC statistics consistently 64 bits wideBen Hutchings1-63/+54
Currently we use type u64 for byte counts, which can very quickly exceed 2^32, and unsigned long for packet counts, which do not. But it can still take only 20-something minutes to send or receive 2^32 packets, and not all tools properly handle overflow even if they sample more often than this. The MAC statistics are all updated synchronously, so it costs very little to make them all 64-bit regardless of native word size. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Remove dependence on NAPI polling in efx_test_eventq_irq()Ben Hutchings1-4/+0
We cannot safely assume that the NAPI handler will complete within the 20 ms that we allow for the event self-test. The handler may be deferred for longer than this, particularly on realtime kernels. Instead, check whether either an event has been handled or (as in the old failure path) whether an interrupt has been received and an event has been delivered but not yet handled. Use napi_disable() to synchronize with the NAPI handler before checking, since it will clear events before updating eventq_read_ptr. Remove the test result chan.N.eventq.poll, since it is not an error if the NAPI handler does not run during the test. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Merge efx_mac_operations into efx_nic_typeBen Hutchings1-2/+2
No NICs need to switch efx_mac_operations at run-time, and the MAC operations are fairly closely bound to NIC types. Move efx_mac_operations::reconfigure to efx_nic_type::reconfigure_mac and efx_mac_operations::check_fault fo efx_nic_type::check_mac_fault. Change callers to call through efx->type or directly if the NIC type is known. Remove efx_mac_operations::update_stats. The implementations for Falcon used to fetch MAC statistics synchronously and this was used by efx_register_netdev() to clear statistics after running self-tests. However, it now only converts statistics that have already been fetched (and that only for Falcon), and the call from efx_register_netdev() has no effect. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-27sfc: Hold efx_nic::stats_lock while reading efx_nic::mac_statsBen Hutchings1-2/+5
efx_nic::stats_lock is used to serialise stats updates, but each reader was dropping it before it finished reading efx_nic::mac_stats. If there were concurrent stats reads using procfs, or one using procfs and one using ethtool, an update could race with a read. On a 32-bit system, the reader could see word-tearing of 64-bit stats (32 bits of the old value and 32 bits of the new). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-09sfc: Const-qualify static data as appropriate, partly prompted by checkpatchBen Hutchings1-2/+2
Fix the following warnings: WARNING: struct dev_pm_ops should normally be const WARNING: static const char * array should probably be static const char * const Similarly const-qualify struct i2c_board_info, struct i2c_algo_bit_data, struct efx_ethtool_stat, struct efx_mtd_ops and struct siena_nvram_type_info. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-05sfc: Fix some formatting errors reported by checkpatchBen Hutchings1-2/+2
Fix the following errors and warnings: ERROR: trailing whitespace ERROR: spaces required around that '=' (ctx:VxV) WARNING: please, no space before tabs Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
2012-01-04sfc: Implement ethtool RX NFC rules API instead of n-tuple APIBen Hutchings1-39/+149
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-12-16ethtool: Centralise validation of ETHTOOL_{G, S}RXFHINDIR parametersBen Hutchings1-23/+12
Add a new ethtool operation (get_rxfh_indir_size) to get the indirectional table size. Use this to validate the user buffer size before calling get_rxfh_indir or set_rxfh_indir. Use get_rxnfc to get the number of RX rings, and validate the contents of the new indirection table before calling set_rxfh_indir. Remove this validation from drivers. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Acked-by: Dimitris Michailidis <dm@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-10-07net: Remove unnecessary driver assignments of ethtool_ringparam fields to zeroRick Jones1-4/+0
Per comments from Ben Hutchings on a previous patch, sweep the floors a little removing unnecessary assignments of zero to fields of struct ethtool_ringparam in driver code supporting ethtool -g. Signed-off-by: Rick Jones <rick.jones2@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16ethtool: Clean up definitions of rule location arrays in RX NFCBen Hutchings1-1/+1
Correct the description of ethtool_rxnfc::rule_locs; it is an array of currently used locations, not all possible valid locations. Add note that drivers must not use ethtool_rxnfc::rule_locs. The rule_locs argument to ethtool_ops::get_rxnfc is either NULL or a pointer to an array of u32, so change the parameter type accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16sfc: Use correct fields of struct ethtool_coalesceBen Hutchings1-9/+27
An earlier developer misunderstood the meaning of the 'irq' fields and the driver did not support the standard fields. To avoid invalidating existing user documentation, we report and accept changes through either the standard or 'irq' fields. If both are changed at the same time, we prefer the standard field. Also explain why we don't currently use the 'max_frames' fields. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16sfc: Validate IRQ moderation parameters in efx_init_irq_moderation()Ben Hutchings1-9/+8
Add a range check, and move the check that RX and TX are consistent from efx_ethtool_set_coalesce(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16sfc: Correct reporting and validation of TX interrupt coalescingBen Hutchings1-34/+33
The reported TX IRQ moderation is generated in a completely crazy way. Make it simple and correct. When channels are shared between RX and TX, TX IRQ moderation must be the same as RX IRQ moderation, but must be specified as 0! Allow it to be either specified as the same, or left at its previous value in which case it will be quietly overridden. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16sfc: Use consistent types for interrupt coalescing parametersBen Hutchings1-1/+2
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-09-16sfc: Correct error code for unsupported interrupt coalescing parametersBen Hutchings1-3/+3
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2011-08-11sfc: Move the Solarflare driversJeff Kirsher1-0/+1012
Moves the Solarflare drivers into drivers/net/ethernet/sfc/ and make the necessary Kconfig and Makefile changes. CC: Steve Hodgson <shodgson@solarflare.com> CC: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>