From: Jacob Keller Date: Mon, 12 Dec 2016 23:44:15 +0000 (-0800) Subject: i40e: properly convert le16 value to CPU format X-Git-Tag: v4.1.12-104.0.20170618_1145~174 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7ceb33ec99f39d670bc2a3678c963ce9b6198327;p=users%2Fjedix%2Flinux-maple.git 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: Jacob Keller Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Orabug: 26132523 (cherry picked from commit 5cb259016b4258d7ac53588a01d17da1ceda84b7) Signed-off-by: Jack Vogel Reviewed-by: Brian Maly --- diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index f8e1ca2c1ad48..f53d883b8b6d5 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -1266,6 +1266,7 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, struct hlist_head *tmp_del_list, int vlan_filters) { + s16 pvid = le16_to_cpu(vsi->info.pvid); struct i40e_mac_filter *f, *add_head; struct i40e_new_mac_filter *new; struct hlist_node *h; @@ -1287,8 +1288,8 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, /* Update the filters about to be added in place */ hlist_for_each_entry(new, tmp_add_list, hlist) { - if (vsi->info.pvid && new->f->vlan != vsi->info.pvid) - new->f->vlan = vsi->info.pvid; + if (pvid && new->f->vlan != pvid) + new->f->vlan = pvid; else if (vlan_filters && new->f->vlan == I40E_VLAN_ANY) new->f->vlan = 0; else if (!vlan_filters && new->f->vlan == 0) @@ -1302,12 +1303,12 @@ static int i40e_correct_mac_vlan_filters(struct i40e_vsi *vsi, * order to avoid duplicating code for adding the new 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 == 0)) { /* Determine the new vlan we will be adding */ - if (vsi->info.pvid) - new_vlan = vsi->info.pvid; + if (pvid) + new_vlan = pvid; else if (vlan_filters) new_vlan = 0; else