]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/net/ethernet/microchip/sparx5/sparx5_vlan.c
net: sparx5: Fix add vlan when invalid operation
[mirror_ubuntu-jammy-kernel.git] / drivers / net / ethernet / microchip / sparx5 / sparx5_vlan.c
index 4ce490a25f332dfbfc1116281047037c68010512..8e56ffa1c4f7afe5f1ba2eb6d19c80e8c0a08c6d 100644 (file)
@@ -58,16 +58,6 @@ int sparx5_vlan_vid_add(struct sparx5_port *port, u16 vid, bool pvid,
        struct sparx5 *sparx5 = port->sparx5;
        int ret;
 
-       /* Make the port a member of the VLAN */
-       set_bit(port->portno, sparx5->vlan_mask[vid]);
-       ret = sparx5_vlant_set_mask(sparx5, vid);
-       if (ret)
-               return ret;
-
-       /* Default ingress vlan classification */
-       if (pvid)
-               port->pvid = vid;
-
        /* Untagged egress vlan classification */
        if (untagged && port->vid != vid) {
                if (port->vid) {
@@ -79,6 +69,16 @@ int sparx5_vlan_vid_add(struct sparx5_port *port, u16 vid, bool pvid,
                port->vid = vid;
        }
 
+       /* Make the port a member of the VLAN */
+       set_bit(port->portno, sparx5->vlan_mask[vid]);
+       ret = sparx5_vlant_set_mask(sparx5, vid);
+       if (ret)
+               return ret;
+
+       /* Default ingress vlan classification */
+       if (pvid)
+               port->pvid = vid;
+
        sparx5_vlan_port_apply(sparx5, port);
 
        return 0;