]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/ethernet/intel/i40e/i40e.h
i40e: avoid race condition when sending filters to firmware for addition
[karo-tx-linux.git] / drivers / net / ethernet / intel / i40e / i40e.h
index fdd9069b6cec19b858e879398ec44a10faec9358..7a23d3e47c6fac2f38668a132a23b3b745086325 100644 (file)
@@ -467,6 +467,22 @@ struct i40e_mac_filter {
        enum i40e_filter_state state;
 };
 
+/* Wrapper structure to keep track of filters while we are preparing to send
+ * firmware commands. We cannot send firmware commands while holding a
+ * spinlock, since it might sleep. To avoid this, we wrap the added filters in
+ * a separate structure, which will track the state change and update the real
+ * filter while under lock. We can't simply hold the filters in a separate
+ * list, as this opens a window for a race condition when adding new MAC
+ * addresses to all VLANs, or when adding new VLANs to all MAC addresses.
+ */
+struct i40e_new_mac_filter {
+       struct hlist_node hlist;
+       struct i40e_mac_filter *f;
+
+       /* Track future changes to state separately */
+       enum i40e_filter_state state;
+};
+
 struct i40e_veb {
        struct i40e_pf *pf;
        u16 idx;