Commit f7fc2f2e authored by Mitch Williams's avatar Mitch Williams Committed by Jeff Kirsher

i40e: use QOS field consistently

In i40e_ndo_set_vf_port_vlan, we were using the QOS value
inconsistently, sometimes shifting it, sometimes not. Do the shift-and-
or operation correctly, once, and use the result consistently everywhere
in the function.

Change-ID: I46f062f3edc90a8a017ecec9137f4d1ab0ab9e41
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent d8201e20
...@@ -2089,6 +2089,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) ...@@ -2089,6 +2089,7 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
int vf_id, u16 vlan_id, u8 qos) int vf_id, u16 vlan_id, u8 qos)
{ {
u16 vlanprio = vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT);
struct i40e_netdev_priv *np = netdev_priv(netdev); struct i40e_netdev_priv *np = netdev_priv(netdev);
struct i40e_pf *pf = np->vsi->back; struct i40e_pf *pf = np->vsi->back;
struct i40e_vsi *vsi; struct i40e_vsi *vsi;
...@@ -2116,8 +2117,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, ...@@ -2116,8 +2117,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
goto error_pvid; goto error_pvid;
} }
if (le16_to_cpu(vsi->info.pvid) == if (le16_to_cpu(vsi->info.pvid) == vlanprio)
(vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT)))
/* duplicate request, so just return success */ /* duplicate request, so just return success */
goto error_pvid; goto error_pvid;
...@@ -2141,7 +2141,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, ...@@ -2141,7 +2141,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
* MAC addresses deleted. * MAC addresses deleted.
*/ */
if ((!(vlan_id || qos) || if ((!(vlan_id || qos) ||
(vlan_id | qos) != le16_to_cpu(vsi->info.pvid)) && vlanprio != le16_to_cpu(vsi->info.pvid)) &&
vsi->info.pvid) vsi->info.pvid)
ret = i40e_vsi_add_vlan(vsi, I40E_VLAN_ANY); ret = i40e_vsi_add_vlan(vsi, I40E_VLAN_ANY);
...@@ -2156,8 +2156,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, ...@@ -2156,8 +2156,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
} }
} }
if (vlan_id || qos) if (vlan_id || qos)
ret = i40e_vsi_add_pvid(vsi, ret = i40e_vsi_add_pvid(vsi, vlanprio);
vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT));
else else
i40e_vsi_remove_pvid(vsi); i40e_vsi_remove_pvid(vsi);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment