@@ -347,6 +347,37 @@ static int ef100_phy_probe(struct efx_nic *efx)
347
347
return 0 ;
348
348
}
349
349
350
+ static int ef100_filter_table_probe (struct efx_nic * efx )
351
+ {
352
+ return efx_mcdi_filter_table_probe (efx , true);
353
+ }
354
+
355
+ static int ef100_filter_table_up (struct efx_nic * efx )
356
+ {
357
+ int rc ;
358
+
359
+ rc = efx_mcdi_filter_add_vlan (efx , EFX_FILTER_VID_UNSPEC );
360
+ if (rc ) {
361
+ efx_mcdi_filter_table_down (efx );
362
+ return rc ;
363
+ }
364
+
365
+ rc = efx_mcdi_filter_add_vlan (efx , 0 );
366
+ if (rc ) {
367
+ efx_mcdi_filter_del_vlan (efx , EFX_FILTER_VID_UNSPEC );
368
+ efx_mcdi_filter_table_down (efx );
369
+ }
370
+
371
+ return rc ;
372
+ }
373
+
374
+ static void ef100_filter_table_down (struct efx_nic * efx )
375
+ {
376
+ efx_mcdi_filter_del_vlan (efx , 0 );
377
+ efx_mcdi_filter_del_vlan (efx , EFX_FILTER_VID_UNSPEC );
378
+ efx_mcdi_filter_table_down (efx );
379
+ }
380
+
350
381
/* Other
351
382
*/
352
383
static int ef100_reconfigure_mac (struct efx_nic * efx , bool mtu_only )
@@ -393,12 +424,24 @@ static int ef100_reset(struct efx_nic *efx, enum reset_type reset_type)
393
424
__clear_bit (reset_type , & efx -> reset_pending );
394
425
rc = dev_open (efx -> net_dev , NULL );
395
426
} else if (reset_type == RESET_TYPE_ALL ) {
427
+ /* A RESET_TYPE_ALL will cause filters to be removed, so we remove filters
428
+ * and reprobe after reset to avoid removing filters twice
429
+ */
430
+ down_read (& efx -> filter_sem );
431
+ ef100_filter_table_down (efx );
432
+ up_read (& efx -> filter_sem );
396
433
rc = efx_mcdi_reset (efx , reset_type );
397
434
if (rc )
398
435
return rc ;
399
436
400
437
netif_device_attach (efx -> net_dev );
401
438
439
+ down_read (& efx -> filter_sem );
440
+ rc = ef100_filter_table_up (efx );
441
+ up_read (& efx -> filter_sem );
442
+ if (rc )
443
+ return rc ;
444
+
402
445
rc = dev_open (efx -> net_dev , NULL );
403
446
} else {
404
447
rc = 1 ; /* Leave the device closed */
@@ -480,6 +523,20 @@ const struct efx_nic_type ef100_pf_nic_type = {
480
523
.rx_remove = efx_mcdi_rx_remove ,
481
524
.rx_write = ef100_rx_write ,
482
525
.rx_packet = __ef100_rx_packet ,
526
+ .max_rx_ip_filters = EFX_MCDI_FILTER_TBL_ROWS ,
527
+ .filter_table_probe = ef100_filter_table_up ,
528
+ .filter_table_restore = efx_mcdi_filter_table_restore ,
529
+ .filter_table_remove = ef100_filter_table_down ,
530
+ .filter_insert = efx_mcdi_filter_insert ,
531
+ .filter_remove_safe = efx_mcdi_filter_remove_safe ,
532
+ .filter_get_safe = efx_mcdi_filter_get_safe ,
533
+ .filter_clear_rx = efx_mcdi_filter_clear_rx ,
534
+ .filter_count_rx_used = efx_mcdi_filter_count_rx_used ,
535
+ .filter_get_rx_id_limit = efx_mcdi_filter_get_rx_id_limit ,
536
+ .filter_get_rx_ids = efx_mcdi_filter_get_rx_ids ,
537
+ #ifdef CONFIG_RFS_ACCEL
538
+ .filter_rfs_expire_one = efx_mcdi_filter_rfs_expire_one ,
539
+ #endif
483
540
484
541
.get_phys_port_id = efx_ef100_get_phys_port_id ,
485
542
@@ -840,6 +897,12 @@ static int ef100_probe_main(struct efx_nic *efx)
840
897
if (rc )
841
898
goto fail ;
842
899
900
+ down_write (& efx -> filter_sem );
901
+ rc = ef100_filter_table_probe (efx );
902
+ up_write (& efx -> filter_sem );
903
+ if (rc )
904
+ goto fail ;
905
+
843
906
rc = ef100_register_netdev (efx );
844
907
if (rc )
845
908
goto fail ;
@@ -877,6 +940,10 @@ void ef100_remove(struct efx_nic *efx)
877
940
struct ef100_nic_data * nic_data = efx -> nic_data ;
878
941
879
942
ef100_unregister_netdev (efx );
943
+
944
+ down_write (& efx -> filter_sem );
945
+ efx_mcdi_filter_table_remove (efx );
946
+ up_write (& efx -> filter_sem );
880
947
efx_fini_channels (efx );
881
948
kfree (efx -> phy_data );
882
949
efx -> phy_data = NULL ;
0 commit comments