hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
....@@ -453,12 +453,6 @@
453453 if (vid > 4095)
454454 return -EINVAL;
455455
456
- if (hw->promisc) {
457
- netdev_err(dev,
458
- "Adding VLAN in promisc mode not supported\n");
459
- return -EPERM;
460
- }
461
-
462456 /* Single Rx VLAN Filter */
463457 if (hw->num_vlan == 1) {
464458 /* For single VLAN filter, VID 0 means VLAN promiscuous */
....@@ -508,12 +502,6 @@
508502 {
509503 int i, ret = 0;
510504
511
- if (hw->promisc) {
512
- netdev_err(dev,
513
- "Deleting VLAN in promisc mode not supported\n");
514
- return -EPERM;
515
- }
516
-
517505 /* Single Rx VLAN Filter */
518506 if (hw->num_vlan == 1) {
519507 if ((hw->vlan_filter[0] & GMAC_VLAN_TAG_VID) == vid) {
....@@ -536,39 +524,6 @@
536524 }
537525
538526 return ret;
539
-}
540
-
541
-static void dwmac4_vlan_promisc_enable(struct net_device *dev,
542
- struct mac_device_info *hw)
543
-{
544
- void __iomem *ioaddr = hw->pcsr;
545
- u32 value;
546
- u32 hash;
547
- u32 val;
548
- int i;
549
-
550
- /* Single Rx VLAN Filter */
551
- if (hw->num_vlan == 1) {
552
- dwmac4_write_single_vlan(dev, 0);
553
- return;
554
- }
555
-
556
- /* Extended Rx VLAN Filter Enable */
557
- for (i = 0; i < hw->num_vlan; i++) {
558
- if (hw->vlan_filter[i] & GMAC_VLAN_TAG_DATA_VEN) {
559
- val = hw->vlan_filter[i] & ~GMAC_VLAN_TAG_DATA_VEN;
560
- dwmac4_write_vlan_filter(dev, hw, i, val);
561
- }
562
- }
563
-
564
- hash = readl(ioaddr + GMAC_VLAN_HASH_TABLE);
565
- if (hash & GMAC_VLAN_VLHT) {
566
- value = readl(ioaddr + GMAC_VLAN_TAG);
567
- if (value & GMAC_VLAN_VTHM) {
568
- value &= ~GMAC_VLAN_VTHM;
569
- writel(value, ioaddr + GMAC_VLAN_TAG);
570
- }
571
- }
572527 }
573528
574529 static void dwmac4_restore_hw_vlan_rx_fltr(struct net_device *dev,
....@@ -690,22 +645,12 @@
690645 }
691646
692647 /* VLAN filtering */
693
- if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
648
+ if (dev->flags & IFF_PROMISC && !hw->vlan_fail_q_en)
649
+ value &= ~GMAC_PACKET_FILTER_VTFE;
650
+ else if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
694651 value |= GMAC_PACKET_FILTER_VTFE;
695652
696653 writel(value, ioaddr + GMAC_PACKET_FILTER);
697
-
698
- if (dev->flags & IFF_PROMISC && !hw->vlan_fail_q_en) {
699
- if (!hw->promisc) {
700
- hw->promisc = 1;
701
- dwmac4_vlan_promisc_enable(dev, hw);
702
- }
703
- } else {
704
- if (hw->promisc) {
705
- hw->promisc = 0;
706
- dwmac4_restore_hw_vlan_rx_fltr(dev, hw);
707
- }
708
- }
709654 }
710655
711656 static void dwmac4_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,