Commit 5cb25901 authored by Jacob Keller's avatar Jacob Keller Committed by Jeff Kirsher

i40e: properly convert le16 value to CPU format

This ensures that the pvid which is stored in __le16 format is converted
to the CPU format. This will fix comparison issues on Big Endian
platforms.

Change-ID: I92c80d1315dc2a0f9f095d5a0c48d461beb052ed
Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 2ae0bf50
...@@ -1254,6 +1254,7 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, ...@@ -1254,6 +1254,7 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,
struct hlist_head *tmp_del_list, struct hlist_head *tmp_del_list,
int vlan_filters) int vlan_filters)
{ {
s16 pvid = le16_to_cpu(vsi->info.pvid);
struct i40e_mac_filter *f, *add_head; struct i40e_mac_filter *f, *add_head;
struct i40e_new_mac_filter *new; struct i40e_new_mac_filter *new;
struct hlist_node *h; struct hlist_node *h;
...@@ -1275,8 +1276,8 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, ...@@ -1275,8 +1276,8 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,
/* Update the filters about to be added in place */ /* Update the filters about to be added in place */
hlist_for_each_entry(new, tmp_add_list, hlist) { hlist_for_each_entry(new, tmp_add_list, hlist) {
if (vsi->info.pvid && new->f->vlan != vsi->info.pvid) if (pvid && new->f->vlan != pvid)
new->f->vlan = vsi->info.pvid; new->f->vlan = pvid;
else if (vlan_filters && new->f->vlan == I40E_VLAN_ANY) else if (vlan_filters && new->f->vlan == I40E_VLAN_ANY)
new->f->vlan = 0; new->f->vlan = 0;
else if (!vlan_filters && new->f->vlan == 0) else if (!vlan_filters && new->f->vlan == 0)
...@@ -1290,12 +1291,12 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, ...@@ -1290,12 +1291,12 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi,
* order to avoid duplicating code for adding the new filter * order to avoid duplicating code for adding the new filter
* then deleting the old filter. * then deleting the old filter.
*/ */
if ((vsi->info.pvid && f->vlan != vsi->info.pvid) || if ((pvid && f->vlan != pvid) ||
(vlan_filters && f->vlan == I40E_VLAN_ANY) || (vlan_filters && f->vlan == I40E_VLAN_ANY) ||
(!vlan_filters && f->vlan == 0)) { (!vlan_filters && f->vlan == 0)) {
/* Determine the new vlan we will be adding */ /* Determine the new vlan we will be adding */
if (vsi->info.pvid) if (pvid)
new_vlan = vsi->info.pvid; new_vlan = pvid;
else if (vlan_filters) else if (vlan_filters)
new_vlan = 0; new_vlan = 0;
else else
......
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