@@ -438,16 +438,6 @@ static int mlxsw_sp_fid_vni_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index,
438
438
return mlxsw_reg_write (mlxsw_sp -> core , MLXSW_REG (sfmr ), sfmr_pl );
439
439
}
440
440
441
- static int mlxsw_sp_fid_vid_map (struct mlxsw_sp * mlxsw_sp , u16 fid_index ,
442
- u16 vid , bool valid )
443
- {
444
- enum mlxsw_reg_svfa_mt mt = MLXSW_REG_SVFA_MT_VID_TO_FID ;
445
- char svfa_pl [MLXSW_REG_SVFA_LEN ];
446
-
447
- mlxsw_reg_svfa_pack (svfa_pl , 0 , mt , valid , fid_index , vid );
448
- return mlxsw_reg_write (mlxsw_sp -> core , MLXSW_REG (svfa ), svfa_pl );
449
- }
450
-
451
441
static int __mlxsw_sp_fid_port_vid_map (struct mlxsw_sp * mlxsw_sp , u16 fid_index ,
452
442
u8 local_port , u16 vid , bool valid )
453
443
{
@@ -458,140 +448,6 @@ static int __mlxsw_sp_fid_port_vid_map(struct mlxsw_sp *mlxsw_sp, u16 fid_index,
458
448
return mlxsw_reg_write (mlxsw_sp -> core , MLXSW_REG (svfa ), svfa_pl );
459
449
}
460
450
461
- static int mlxsw_sp_fid_8021q_configure (struct mlxsw_sp_fid * fid )
462
- {
463
- struct mlxsw_sp * mlxsw_sp = fid -> fid_family -> mlxsw_sp ;
464
- struct mlxsw_sp_fid_8021q * fid_8021q ;
465
- int err ;
466
-
467
- err = mlxsw_sp_fid_op (mlxsw_sp , fid -> fid_index , fid -> fid_index , true);
468
- if (err )
469
- return err ;
470
-
471
- fid_8021q = mlxsw_sp_fid_8021q_fid (fid );
472
- err = mlxsw_sp_fid_vid_map (mlxsw_sp , fid -> fid_index , fid_8021q -> vid ,
473
- true);
474
- if (err )
475
- goto err_fid_map ;
476
-
477
- return 0 ;
478
-
479
- err_fid_map :
480
- mlxsw_sp_fid_op (mlxsw_sp , fid -> fid_index , 0 , false);
481
- return err ;
482
- }
483
-
484
- static void mlxsw_sp_fid_8021q_deconfigure (struct mlxsw_sp_fid * fid )
485
- {
486
- struct mlxsw_sp * mlxsw_sp = fid -> fid_family -> mlxsw_sp ;
487
- struct mlxsw_sp_fid_8021q * fid_8021q ;
488
-
489
- fid_8021q = mlxsw_sp_fid_8021q_fid (fid );
490
- mlxsw_sp_fid_vid_map (mlxsw_sp , fid -> fid_index , fid_8021q -> vid , false);
491
- mlxsw_sp_fid_op (mlxsw_sp , fid -> fid_index , 0 , false);
492
- }
493
-
494
- static int mlxsw_sp_fid_8021q_index_alloc (struct mlxsw_sp_fid * fid ,
495
- const void * arg , u16 * p_fid_index )
496
- {
497
- struct mlxsw_sp_fid_family * fid_family = fid -> fid_family ;
498
- u16 vid = * (u16 * ) arg ;
499
-
500
- /* Use 1:1 mapping for simplicity although not a must */
501
- if (vid < fid_family -> start_index || vid > fid_family -> end_index )
502
- return - EINVAL ;
503
- * p_fid_index = vid ;
504
-
505
- return 0 ;
506
- }
507
-
508
- static bool
509
- mlxsw_sp_fid_8021q_compare (const struct mlxsw_sp_fid * fid , const void * arg )
510
- {
511
- u16 vid = * (u16 * ) arg ;
512
-
513
- return mlxsw_sp_fid_8021q_fid (fid )-> vid == vid ;
514
- }
515
-
516
- static u16 mlxsw_sp_fid_8021q_flood_index (const struct mlxsw_sp_fid * fid )
517
- {
518
- return fid -> fid_index ;
519
- }
520
-
521
- static int mlxsw_sp_fid_8021q_port_vid_map (struct mlxsw_sp_fid * fid ,
522
- struct mlxsw_sp_port * mlxsw_sp_port ,
523
- u16 vid )
524
- {
525
- struct mlxsw_sp * mlxsw_sp = mlxsw_sp_port -> mlxsw_sp ;
526
- u8 local_port = mlxsw_sp_port -> local_port ;
527
-
528
- /* In case there are no {Port, VID} => FID mappings on the port,
529
- * we can use the global VID => FID mapping we created when the
530
- * FID was configured.
531
- */
532
- if (mlxsw_sp -> fid_core -> port_fid_mappings [local_port ] == 0 )
533
- return 0 ;
534
- return __mlxsw_sp_fid_port_vid_map (mlxsw_sp , fid -> fid_index , local_port ,
535
- vid , true);
536
- }
537
-
538
- static void
539
- mlxsw_sp_fid_8021q_port_vid_unmap (struct mlxsw_sp_fid * fid ,
540
- struct mlxsw_sp_port * mlxsw_sp_port , u16 vid )
541
- {
542
- struct mlxsw_sp * mlxsw_sp = mlxsw_sp_port -> mlxsw_sp ;
543
- u8 local_port = mlxsw_sp_port -> local_port ;
544
-
545
- if (mlxsw_sp -> fid_core -> port_fid_mappings [local_port ] == 0 )
546
- return ;
547
- __mlxsw_sp_fid_port_vid_map (mlxsw_sp , fid -> fid_index , local_port , vid ,
548
- false);
549
- }
550
-
551
- static const struct mlxsw_sp_fid_ops mlxsw_sp_fid_8021q_ops = {
552
- .setup = mlxsw_sp_fid_8021q_setup ,
553
- .configure = mlxsw_sp_fid_8021q_configure ,
554
- .deconfigure = mlxsw_sp_fid_8021q_deconfigure ,
555
- .index_alloc = mlxsw_sp_fid_8021q_index_alloc ,
556
- .compare = mlxsw_sp_fid_8021q_compare ,
557
- .flood_index = mlxsw_sp_fid_8021q_flood_index ,
558
- .port_vid_map = mlxsw_sp_fid_8021q_port_vid_map ,
559
- .port_vid_unmap = mlxsw_sp_fid_8021q_port_vid_unmap ,
560
- };
561
-
562
- static const struct mlxsw_sp_flood_table mlxsw_sp_fid_8021q_flood_tables [] = {
563
- {
564
- .packet_type = MLXSW_SP_FLOOD_TYPE_UC ,
565
- .bridge_type = MLXSW_REG_SFGC_BRIDGE_TYPE_1Q_FID ,
566
- .table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFSET ,
567
- .table_index = 0 ,
568
- },
569
- {
570
- .packet_type = MLXSW_SP_FLOOD_TYPE_MC ,
571
- .bridge_type = MLXSW_REG_SFGC_BRIDGE_TYPE_1Q_FID ,
572
- .table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFSET ,
573
- .table_index = 1 ,
574
- },
575
- {
576
- .packet_type = MLXSW_SP_FLOOD_TYPE_BC ,
577
- .bridge_type = MLXSW_REG_SFGC_BRIDGE_TYPE_1Q_FID ,
578
- .table_type = MLXSW_REG_SFGC_TABLE_TYPE_FID_OFFSET ,
579
- .table_index = 2 ,
580
- },
581
- };
582
-
583
- /* Range and flood configuration must match mlxsw_config_profile */
584
- static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021q_family = {
585
- .type = MLXSW_SP_FID_TYPE_8021Q ,
586
- .fid_size = sizeof (struct mlxsw_sp_fid_8021q ),
587
- .start_index = 1 ,
588
- .end_index = VLAN_VID_MASK ,
589
- .flood_tables = mlxsw_sp_fid_8021q_flood_tables ,
590
- .nr_flood_tables = ARRAY_SIZE (mlxsw_sp_fid_8021q_flood_tables ),
591
- .rif_type = MLXSW_SP_RIF_TYPE_VLAN ,
592
- .ops = & mlxsw_sp_fid_8021q_ops ,
593
- };
594
-
595
451
static struct mlxsw_sp_fid_8021d *
596
452
mlxsw_sp_fid_8021d_fid (const struct mlxsw_sp_fid * fid )
597
453
{
@@ -846,6 +702,14 @@ static const struct mlxsw_sp_fid_family mlxsw_sp_fid_8021d_family = {
846
702
.lag_vid_valid = 1 ,
847
703
};
848
704
705
+ static bool
706
+ mlxsw_sp_fid_8021q_compare (const struct mlxsw_sp_fid * fid , const void * arg )
707
+ {
708
+ u16 vid = * (u16 * ) arg ;
709
+
710
+ return mlxsw_sp_fid_8021q_fid (fid )-> vid == vid ;
711
+ }
712
+
849
713
static void
850
714
mlxsw_sp_fid_8021q_fdb_clear_offload (const struct mlxsw_sp_fid * fid ,
851
715
const struct net_device * nve_dev )
0 commit comments