@@ -2116,17 +2116,16 @@ void i40e_aqc_del_filters(struct i40e_vsi *vsi, const char *vsi_name,
2116
2116
* @list: the list of filters to send to firmware
2117
2117
* @add_head: Position in the add hlist
2118
2118
* @num_add: the number of filters to add
2119
- * @promisc_change: set to true on exit if promiscuous mode was forced on
2120
2119
*
2121
2120
* Send a request to firmware via AdminQ to add a chunk of filters. Will set
2122
- * promisc_changed to true if the firmware has run out of space for more
2123
- * filters.
2121
+ * __I40E_VSI_OVERFLOW_PROMISC bit in vsi->state if the firmware has run out of
2122
+ * space for more filters.
2124
2123
*/
2125
2124
static
2126
2125
void i40e_aqc_add_filters (struct i40e_vsi * vsi , const char * vsi_name ,
2127
2126
struct i40e_aqc_add_macvlan_element_data * list ,
2128
2127
struct i40e_new_mac_filter * add_head ,
2129
- int num_add , bool * promisc_changed )
2128
+ int num_add )
2130
2129
{
2131
2130
struct i40e_hw * hw = & vsi -> back -> hw ;
2132
2131
int aq_err , fcnt ;
@@ -2136,7 +2135,6 @@ void i40e_aqc_add_filters(struct i40e_vsi *vsi, const char *vsi_name,
2136
2135
fcnt = i40e_update_filter_state (num_add , list , add_head );
2137
2136
2138
2137
if (fcnt != num_add ) {
2139
- * promisc_changed = true;
2140
2138
set_bit (__I40E_VSI_OVERFLOW_PROMISC , vsi -> state );
2141
2139
dev_warn (& vsi -> back -> pdev -> dev ,
2142
2140
"Error %s adding RX filters on %s, promiscuous mode forced on\n" ,
@@ -2269,9 +2267,9 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2269
2267
struct i40e_mac_filter * f ;
2270
2268
struct i40e_new_mac_filter * new , * add_head = NULL ;
2271
2269
struct i40e_hw * hw = & vsi -> back -> hw ;
2270
+ bool old_overflow , new_overflow ;
2272
2271
unsigned int failed_filters = 0 ;
2273
2272
unsigned int vlan_filters = 0 ;
2274
- bool promisc_changed = false;
2275
2273
char vsi_name [16 ] = "PF" ;
2276
2274
int filter_list_len = 0 ;
2277
2275
i40e_status aq_ret = 0 ;
@@ -2293,6 +2291,8 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2293
2291
usleep_range (1000 , 2000 );
2294
2292
pf = vsi -> back ;
2295
2293
2294
+ old_overflow = test_bit (__I40E_VSI_OVERFLOW_PROMISC , vsi -> state );
2295
+
2296
2296
if (vsi -> netdev ) {
2297
2297
changed_flags = vsi -> current_netdev_flags ^ vsi -> netdev -> flags ;
2298
2298
vsi -> current_netdev_flags = vsi -> netdev -> flags ;
@@ -2466,15 +2466,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2466
2466
/* flush a full buffer */
2467
2467
if (num_add == filter_list_len ) {
2468
2468
i40e_aqc_add_filters (vsi , vsi_name , add_list ,
2469
- add_head , num_add ,
2470
- & promisc_changed );
2469
+ add_head , num_add );
2471
2470
memset (add_list , 0 , list_size );
2472
2471
num_add = 0 ;
2473
2472
}
2474
2473
}
2475
2474
if (num_add ) {
2476
2475
i40e_aqc_add_filters (vsi , vsi_name , add_list , add_head ,
2477
- num_add , & promisc_changed );
2476
+ num_add );
2478
2477
}
2479
2478
/* Now move all of the filters from the temp add list back to
2480
2479
* the VSI's list.
@@ -2503,24 +2502,16 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2503
2502
}
2504
2503
spin_unlock_bh (& vsi -> mac_filter_hash_lock );
2505
2504
2506
- /* If promiscuous mode has changed, we need to calculate a new
2507
- * threshold for when we are safe to exit
2508
- */
2509
- if (promisc_changed )
2510
- vsi -> promisc_threshold = (vsi -> active_filters * 3 ) / 4 ;
2511
-
2512
2505
/* Check if we are able to exit overflow promiscuous mode. We can
2513
2506
* safely exit if we didn't just enter, we no longer have any failed
2514
2507
* filters, and we have reduced filters below the threshold value.
2515
2508
*/
2516
- if (test_bit (__I40E_VSI_OVERFLOW_PROMISC , vsi -> state ) &&
2517
- !promisc_changed && !failed_filters &&
2518
- (vsi -> active_filters < vsi -> promisc_threshold )) {
2509
+ if (old_overflow && !failed_filters &&
2510
+ vsi -> active_filters < vsi -> promisc_threshold ) {
2519
2511
dev_info (& pf -> pdev -> dev ,
2520
2512
"filter logjam cleared on %s, leaving overflow promiscuous mode\n" ,
2521
2513
vsi_name );
2522
2514
clear_bit (__I40E_VSI_OVERFLOW_PROMISC , vsi -> state );
2523
- promisc_changed = true;
2524
2515
vsi -> promisc_threshold = 0 ;
2525
2516
}
2526
2517
@@ -2530,6 +2521,14 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2530
2521
goto out ;
2531
2522
}
2532
2523
2524
+ new_overflow = test_bit (__I40E_VSI_OVERFLOW_PROMISC , vsi -> state );
2525
+
2526
+ /* If we are entering overflow promiscuous, we need to calculate a new
2527
+ * threshold for when we are safe to exit
2528
+ */
2529
+ if (!old_overflow && new_overflow )
2530
+ vsi -> promisc_threshold = (vsi -> active_filters * 3 ) / 4 ;
2531
+
2533
2532
/* check for changes in promiscuous modes */
2534
2533
if (changed_flags & IFF_ALLMULTI ) {
2535
2534
bool cur_multipromisc ;
@@ -2550,12 +2549,11 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
2550
2549
}
2551
2550
}
2552
2551
2553
- if ((changed_flags & IFF_PROMISC ) || promisc_changed ) {
2552
+ if ((changed_flags & IFF_PROMISC ) || old_overflow != new_overflow ) {
2554
2553
bool cur_promisc ;
2555
2554
2556
2555
cur_promisc = (!!(vsi -> current_netdev_flags & IFF_PROMISC ) ||
2557
- test_bit (__I40E_VSI_OVERFLOW_PROMISC ,
2558
- vsi -> state ));
2556
+ new_overflow );
2559
2557
aq_ret = i40e_set_promiscuous (pf , cur_promisc );
2560
2558
if (aq_ret ) {
2561
2559
retval = i40e_aq_rc_to_posix (aq_ret ,
0 commit comments