summaryrefslogtreecommitdiffstats
tag namemlx5-updates-2019-08-21 (effd347b39da1b03b937bacb47097eb72b290c26)
tag date2019-08-21 15:55:18 -0700
tagged bySaeed Mahameed <saeedm@mellanox.com>
tagged objectcommit 5970882a25...
downloadlinux-mlx5-updates-2019-08-21.tar.gz
mlx5 tc flow handling for concurrent execution (Part 3)
This series includes updates to mlx5 ethernet and core driver: Vlad submits part 3 of 3 part series to allow TC flow handling for concurrent execution. Vlad says: ========== Structure mlx5e_neigh_hash_entry code that uses it are refactored in following ways: - Extend neigh_hash_entry with rcu and modify its users to always take reference to the structure when using it (neigh_hash_entry has already had atomic reference counter which was only used when scheduling neigh update on workqueue from atomic context of neigh update netevent). - Always use mlx5e_neigh_update_table->encap_lock when modifying neigh update hash table and list. Originally, this lock was only used to synchronize with netevent handler function, which is called from bh context and cannot use rtnl lock for synchronization. Use rcu read lock instead of encap_lock to lookup nhe in atomic context of netevent even handler function. Convert encap_lock to mutex to allow creating new neigh hash entries while holding it, which is safe to do because the lock is no longer used in atomic context. - Rcu-ify mlx5e_neigh_hash_entry->encap_list by changing operations on encap list to their rcu counterparts and extending encap structure with rcu_head to free the encap instances after rcu grace period. This allows fast traversal of list of encaps attached to nhe under rcu read lock protection. - Take encap_table_lock when accessing encap entries in neigh update and neigh stats update code to protect from concurrent encap entry insertion or removal. This approach leads to potential race condition when neigh update and neigh stats update code can access encap and flow entries that are not fully initialized or are being destroyed, or neigh can change state without updating encaps that are created concurrently. Prevent these issues by following changes in flow and encap initialization: - Extend mlx5e_tc_flow with 'init_done' completion. Modify neigh update to wait for both encap and flow completions to prevent concurrent access to a structure that is being initialized by tc. - Skip structures that failed during initialization: encaps with encap_id<0 and flows that don't have OFFLOADED flag set. - To ensure that no new flows are added to encap when it is being accessed by neigh update or neigh stats update, take encap_table_lock mutex. - To prevent concurrent deletion by tc, ensure that neigh update and neigh stats update hold references to encap and flow instances while using them. With changes presented in this patch set it is now safe to execute tc concurrently with neigh update and neigh stats update. However, these two workqueue tasks modify same flow "tmp_list" field to store flows with reference taken in temporary list to release the references after update operation finishes and should not be executed concurrently with each other. Last 3 patches of this series provide 3 new mlx5 trace points to track mlx5 tc requests and mlx5 neigh updates. -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEGhZs6bAKwk/OTgTpSD+KveBX+j4FAl1dy9YACgkQSD+KveBX +j6kIAf+PgnUuqH/VJKRVqLDvCvHJMV+pmfnTUBJNJinkg2QTgRw2+0hKj5bJgit EOKxVbJEB4bC7FERjgTNY981fl2hK7/NQSWcWemhH7mwvnzAffpIuXMrK6Sw1uD9 FHSeMCIRZLnaQi7oZYK7TEptChh4lsxVOMF9rLCAZ+ivbJFqYLOVRvo936FD91FN 6gqzccyXY9srz9ideOZHxOLqGGFfDktw/Ijr5uyylVRSJFnj3zLhVAshNEYISHIE 1a3cQQ9k7RmYCdlEcKxWO81doaNx3E9t110opqlDTm7ETOaqH/tOuMQDbABuVG0Q ELKnFwuPG2Hi26jcusasvMjYyYttXg== =0UbW -----END PGP SIGNATURE-----