Remove open-coded zalloc_cpumask_var() and zalloc_cpumask_var_node().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
No need to put ethtool_ops in data, they should be const.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
In a couple of cases collapse some extra code like:
int retval = NETDEV_TX_OK;
...
return retval;
into
return NETDEV_TX_OK;
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Reconfiguring the port requires us to flush all DMA queues. In
repeated testing we have found that RX flushes would sometimes fail
because the RX DMA engine was not properly isolated from the MACs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Received frames must be re-clocked by the local XGXS to the 156.25 MHz
(DDR) clock of the XGMII. If the remote clock is slightly faster this
can reduce a minimum IPG of 64 bit-times (1 cycle) to 32 bit-times
(half a cycle). If the XMAC detects that a frame has reached the
maximum RX frame length in the same cycle that it receives one of
these reduced IPGs, it may miss the IPG, causing two valid frames to
be treated as a single invalid frame (over-length with bad CRC).
We work around this by increasing the maximum RX frame length so that
peers with matched MTU will not provoke this bug.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
At probe time, falcon_reset_hw() performs a hard reset of the PHY
along with Falcon. There is no need to perform a soft reset later,
and any access to standard MDIO registers before the PHY firmware has
booted can interrupt the boot process, making the port unusable.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
falcon_reset_xaui() waits for XGXS reset to complete, but the XAUI
serdes reset may take longer. It needs to check both reset active
bits.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
We must call netif_carrier_off() after the device is registered, not
before, to set the operational state and user-space IFF_RUNNING flag
correctly.
Since we don't want observers to see an intermediate state, open-code
register_netdev() and add efx_update_name() and netif_carrier_off()
into the locked region.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Followup of commits 9d21493b4b
and 08baf56108
(net: tx scalability works : trans_start)
(net: txq_trans_update() helper)
Now that core network takes care of trans_start updates, dont do it
in drivers themselves, if possible. Multi queue drivers can
avoid one cache miss (on dev->trans_start) in their start_xmit()
handler.
Exceptions are NETIF_F_LLTX drivers (vxge & tehuti)
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
GRO/LRO can be controlled through ethtool so this is unnecessary.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Change error message when alloc_cpumask_var fails.
Repairs "cpumask: convert drivers/net/sfc".
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Make use of the newly-added generic MDIO clause 45 support and remove
redundant definitions.
Add an 'efx_' prefix to the remaining driver-specific MDIO functions
and remove arguments which are redundant with efx->mdio.prtad.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
It turns out that copying a 16-byte area at ~800k times a second
can be really expensive :) This patch redesigns the frags GRO
interface to avoid copying that area twice.
The two disciples of the frags interface have been converted.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
falcon_sim_phy_event() used EFX_OWORD_FIELD, which operates on
bitfields in 128-bit values, on an event, which is a 64-bit value.
This should be harmless - these macros always use little-endian
ordering, so it would read and write back the following 8 bytes
unchanged - but it is obviously wrong.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
sfc could call netif_napi_add() multiple times for the same
napi_struct, corrupting the list of napi_structs for the associated
device and leading to a busy-loop on device removal. Move the call to
netif_napi_add() and add a call to netif_napi_del() in the obvious
places.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Neither the lm90 driver nor the lm87 driver do support interrupts, so
there is no point in specifying one when declaring the devices.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
If we use a shared legacy IRQ then our interrupt handler may be called
as soon as it is registered even though IRQs are disabled on the NIC.
Now that the legacy interrupt handler also checks for event delivery,
it may decide to schedule polling in this case. Ensure that the NAPI
context is valid but disabled at this point.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Calculate a score for each 1000 IRQs:
- TX completions are worth 1 point
- RX completions are worth 4 if merged using LRO or 2 otherwise
Reduce moderation if the score is less than 10000, down to a minimum
of 5 us. Increase moderation if the score is more than 20000, up to
the specified maximum.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The bug this function works around only applies to the first set of
page-mapped registers; other pages can be written without locking.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
In rare cases, reading the legacy interrupt status register can
acknowledge an event queue whose attention flag has not yet been set
in the register. Until we service this event queue it will not
generate any more interrupts. Therefore, as a secondary check, poll
the next slot in each active event queue whose flag is not set.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
The packet parser used in the TX data path for locating checksum
fields can lose synchronisation with the TX queue manager when
handling packets that look like IPv4 but are too short (17-32 bytes).
Work around this by padding to 33 bytes.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Make the error count a per-NIC variable.
Reset this the count after an hour if it has not reached the critical value.
Set the critical value back to 5.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
When flushing queues we disable normal interrupt and event handling and
poll event queue 0 looking for flush completions. Unfortunately the
flush event polling loop fails to move past any other type of event.
This problem has not been observed in production hardware but appears to
be a possibility.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
i2c_del_adapter() leaves dangling pointers in the structure. If we
retry the NIC probe and pass the structure to i2c_add_adapter() again
it will lead to an oops unless we clear it first.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
If MAC switching fails, stop the port properly.
If PHY reinitialisation fails, clear the port_initialized flag.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Reinitialise LEDs after overriding them for identification.
Rename set_fault_led method to set_id_led since we always use it for
NIC identification and not faults.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This is a new PHY supporting SFP+ modules, used in the SFN4112F
reference design. It is similar to the QT2022C2 and shares much of
its support code.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Shuffle bits of the OUI into the conventional written order.
Replace PHY id component macros with functions.
Zero-pad PHY id components in log messages.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
During SFN4111T initialisation, check whether the PHY boot status
indicates a bad firmware checksum. If so, prepare to reflash rather
than continuing with normal initialisation.
Remove redundant PHY boot status check from tenxpress_phy_init().
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Commit 27dd2caca4 changed
mdio_clause45_check_mmds() to read both DEVS0 and DEVS1 registers and
to combine their values into an unsigned 32-bit mask. This made the
following test for a negative (failure) value useless. Fix it to
check whether either read failed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Impact: Include the header file. If CONFIG_SFC_MTD is not defined
then the functions 'efx_mtd_remove' and 'efx_mtd_rename' are defined
'static inline' with an empty function body in the header file, but
the the whole file mtd.c is not built in this case.
Fix this sparse warnings:
drivers/net/sfc/mtd.c:204:6: warning: symbol 'efx_mtd_remove' was not declared. Should it be static?
drivers/net/sfc/mtd.c:221:6: warning: symbol 'efx_mtd_rename' was not declared. Should it be static?
drivers/net/sfc/mtd.c:230:5: warning: symbol 'efx_mtd_probe' was not declared. Should it be static?
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Impact: Move variable declaration as close to their usage as possible.
Fix this sparse warning:
drivers/net/sfc/tenxpress.c:589:22: warning: symbol 'link_ok' shadows an earlier one
drivers/net/sfc/tenxpress.c:575:30: originally declared here
Signed-off-by: Hannes Eder <hannes@hanneseder.net>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/sfc/falcon.c: In function ‘falcon_alloc_special_buffer’:
drivers/net/sfc/falcon.c:340: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 10 has type ‘phys_addr_t’
drivers/net/sfc/falcon.c: In function ‘falcon_free_special_buffer’:
drivers/net/sfc/falcon.c:355: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 10 has type ‘phys_addr_t’
drivers/net/sfc/falcon.c: In function ‘falcon_probe_port’:
drivers/net/sfc/falcon.c:2346: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 7 has type ‘phys_addr_t’
drivers/net/sfc/falcon.c: In function ‘falcon_probe_nic’:
drivers/net/sfc/falcon.c:2924: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 7 has type ‘phys_addr_t’
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Base versions handle constant folding now.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>