diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2016-04-16 11:25:54 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-04-16 22:34:40 -0400 |
commit | 3d780b926a12dd798417446d733d457f1be1cc73 (patch) | |
tree | 6065a2d9bfe45518f6f8ce4e4425fc2460a70b22 /drivers/net/ethernet/netronome/nfp/nfp_net.h | |
parent | 180012dc05e565260a25696767c8f5b2df5fc50e (diff) | |
download | lwn-3d780b926a12dd798417446d733d457f1be1cc73.tar.gz lwn-3d780b926a12dd798417446d733d457f1be1cc73.zip |
nfp: add async reconfiguration mechanism
Some callers of nfp_net_reconfig() are in atomic context so
we used to busy wait for commands to complete. In worst case
scenario that means locking up a core for up to 5 seconds
when a command times out. Lets add a timer-based mechanism
of asynchronously checking whether reconfiguration completed
successfully for atomic callers to use. Non-atomic callers
can now just sleep.
The approach taken is quite simple because (1) synchronous
reconfigurations always happen under RTNL (or before device
is registered); (2) we can coalesce pending reconfigs.
There is no need for request queues, timer which eventually
takes a look at reconfiguration result to report errors is
good enough.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/netronome/nfp/nfp_net.h')
-rw-r--r-- | drivers/net/ethernet/netronome/nfp/nfp_net.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net.h b/drivers/net/ethernet/netronome/nfp/nfp_net.h index 3d53fcf323eb..e744acc18ef4 100644 --- a/drivers/net/ethernet/netronome/nfp/nfp_net.h +++ b/drivers/net/ethernet/netronome/nfp/nfp_net.h @@ -59,8 +59,8 @@ netdev_warn((nn)->netdev, fmt, ## args); \ } while (0) -/* Max time to wait for NFP to respond on updates (in ms) */ -#define NFP_NET_POLL_TIMEOUT 5000 +/* Max time to wait for NFP to respond on updates (in seconds) */ +#define NFP_NET_POLL_TIMEOUT 5 /* Bar allocation */ #define NFP_NET_CRTL_BAR 0 @@ -447,6 +447,10 @@ static inline bool nfp_net_fw_ver_eq(struct nfp_net_fw_version *fw_ver, * @shared_name: Name for shared interrupt * @me_freq_mhz: ME clock_freq (MHz) * @reconfig_lock: Protects HW reconfiguration request regs/machinery + * @reconfig_posted: Pending reconfig bits coming from async sources + * @reconfig_timer_active: Timer for reading reconfiguration results is pending + * @reconfig_sync_present: Some thread is performing synchronous reconfig + * @reconfig_timer: Timer for async reading of reconfig results * @link_up: Is the link up? * @link_status_lock: Protects @link_up and ensures atomicity with BAR reading * @rx_coalesce_usecs: RX interrupt moderation usecs delay parameter @@ -531,6 +535,10 @@ struct nfp_net { spinlock_t link_status_lock; spinlock_t reconfig_lock; + u32 reconfig_posted; + bool reconfig_timer_active; + bool reconfig_sync_present; + struct timer_list reconfig_timer; u32 rx_coalesce_usecs; u32 rx_coalesce_max_frames; |