@@ -509,7 +509,7 @@ static bool sja1110_skb_has_inband_control_extension(const struct sk_buff *skb)
509
509
* packet.
510
510
*/
511
511
static void sja1105_vlan_rcv (struct sk_buff * skb , int * source_port ,
512
- int * switch_id , u16 * vid )
512
+ int * switch_id , int * vbid , u16 * vid )
513
513
{
514
514
struct vlan_ethhdr * hdr = (struct vlan_ethhdr * )skb_mac_header (skb );
515
515
u16 vlan_tci ;
@@ -519,8 +519,8 @@ static void sja1105_vlan_rcv(struct sk_buff *skb, int *source_port,
519
519
else
520
520
vlan_tci = ntohs (hdr -> h_vlan_TCI );
521
521
522
- if (vid_is_dsa_8021q_rxvlan (vlan_tci & VLAN_VID_MASK ))
523
- return dsa_8021q_rcv (skb , source_port , switch_id );
522
+ if (vid_is_dsa_8021q (vlan_tci & VLAN_VID_MASK ))
523
+ return dsa_8021q_rcv (skb , source_port , switch_id , vbid );
524
524
525
525
/* Try our best with imprecise RX */
526
526
* vid = vlan_tci & VLAN_VID_MASK ;
@@ -529,7 +529,7 @@ static void sja1105_vlan_rcv(struct sk_buff *skb, int *source_port,
529
529
static struct sk_buff * sja1105_rcv (struct sk_buff * skb ,
530
530
struct net_device * netdev )
531
531
{
532
- int source_port = -1 , switch_id = -1 ;
532
+ int source_port = -1 , switch_id = -1 , vbid = -1 ;
533
533
struct sja1105_meta meta = {0 };
534
534
struct ethhdr * hdr ;
535
535
bool is_link_local ;
@@ -542,7 +542,7 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
542
542
543
543
if (sja1105_skb_has_tag_8021q (skb )) {
544
544
/* Normal traffic path. */
545
- sja1105_vlan_rcv (skb , & source_port , & switch_id , & vid );
545
+ sja1105_vlan_rcv (skb , & source_port , & switch_id , & vbid , & vid );
546
546
} else if (is_link_local ) {
547
547
/* Management traffic path. Switch embeds the switch ID and
548
548
* port ID into bytes of the destination MAC, courtesy of
@@ -561,7 +561,9 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb,
561
561
return NULL ;
562
562
}
563
563
564
- if (source_port == -1 || switch_id == -1 )
564
+ if (vbid >= 1 )
565
+ skb -> dev = dsa_tag_8021q_find_port_by_vbid (netdev , vbid );
566
+ else if (source_port == -1 || switch_id == -1 )
565
567
skb -> dev = dsa_find_designated_bridge_port_by_vid (netdev , vid );
566
568
else
567
569
skb -> dev = dsa_master_find_slave (netdev , switch_id , source_port );
@@ -686,7 +688,7 @@ static struct sk_buff *sja1110_rcv_inband_control_extension(struct sk_buff *skb,
686
688
static struct sk_buff * sja1110_rcv (struct sk_buff * skb ,
687
689
struct net_device * netdev )
688
690
{
689
- int source_port = -1 , switch_id = -1 ;
691
+ int source_port = -1 , switch_id = -1 , vbid = -1 ;
690
692
bool host_only = false;
691
693
u16 vid = 0 ;
692
694
@@ -700,9 +702,11 @@ static struct sk_buff *sja1110_rcv(struct sk_buff *skb,
700
702
701
703
/* Packets with in-band control extensions might still have RX VLANs */
702
704
if (likely (sja1105_skb_has_tag_8021q (skb )))
703
- sja1105_vlan_rcv (skb , & source_port , & switch_id , & vid );
705
+ sja1105_vlan_rcv (skb , & source_port , & switch_id , & vbid , & vid );
704
706
705
- if (source_port == -1 || switch_id == -1 )
707
+ if (vbid >= 1 )
708
+ skb -> dev = dsa_tag_8021q_find_port_by_vbid (netdev , vbid );
709
+ else if (source_port == -1 || switch_id == -1 )
706
710
skb -> dev = dsa_find_designated_bridge_port_by_vid (netdev , vid );
707
711
else
708
712
skb -> dev = dsa_master_find_slave (netdev , switch_id , source_port );
0 commit comments