aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGreg Rose <gregory.v.rose@intel.com>2013-11-28 01:39:34 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-01-05 23:59:01 -0500
commit6c12fcbf18cbbbd075908b3cef7dc19e184a3ee1 (patch)
treea907224deb44ef46ee19900332a0faa3db14465c /drivers/net
parent298deef1f439b31af8c2a63dda6211b2dbf2f51a (diff)
i40e: Fix SR-IOV VF port VLAN
This patch fixes two different problems. 1) The port VLAN configuration was not persistent across VF driver loads and unloads. 2) The port VLAN configuration was only correct the first time it was set. Switching the port VLAN on and off would cause subsequent VLAN configurations to be corrupted in the VSI. Ensure that the correct bits are being set for the VSI port VLAN configuration. Change-Id: I7ebf5329f77eb8d73ccd3324eb346b3abeea737d Signed-off-by: Greg Rose <gregory.v.rose@intel.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Tested-by: Sibai Li <sibai.li@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_main.c8
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c16
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h1
3 files changed, 20 insertions, 5 deletions
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 55fd23d8d5fe..d0b20465b454 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -2016,8 +2016,9 @@ int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)
2016 2016
2017 vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID); 2017 vsi->info.valid_sections = cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID);
2018 vsi->info.pvid = cpu_to_le16(vid); 2018 vsi->info.pvid = cpu_to_le16(vid);
2019 vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_INSERT_PVID; 2019 vsi->info.port_vlan_flags = I40E_AQ_VSI_PVLAN_MODE_TAGGED |
2020 vsi->info.port_vlan_flags |= I40E_AQ_VSI_PVLAN_MODE_UNTAGGED; 2020 I40E_AQ_VSI_PVLAN_INSERT_PVID |
2021 I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH;
2021 2022
2022 ctxt.seid = vsi->seid; 2023 ctxt.seid = vsi->seid;
2023 memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); 2024 memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info));
@@ -2040,8 +2041,9 @@ int i40e_vsi_add_pvid(struct i40e_vsi *vsi, u16 vid)
2040 **/ 2041 **/
2041void i40e_vsi_remove_pvid(struct i40e_vsi *vsi) 2042void i40e_vsi_remove_pvid(struct i40e_vsi *vsi)
2042{ 2043{
2044 i40e_vlan_stripping_disable(vsi);
2045
2043 vsi->info.pvid = 0; 2046 vsi->info.pvid = 0;
2044 i40e_vlan_rx_register(vsi->netdev, vsi->netdev->features);
2045} 2047}
2046 2048
2047/** 2049/**
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 685b2851550c..2c042a264db0 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -388,8 +388,16 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
388 dev_info(&pf->pdev->dev, 388 dev_info(&pf->pdev->dev,
389 "LAN VSI index %d, VSI id %d\n", 389 "LAN VSI index %d, VSI id %d\n",
390 vsi->idx, vsi->id); 390 vsi->idx, vsi->id);
391 /* If the port VLAN has been configured and then the
392 * VF driver was removed then the VSI port VLAN
393 * configuration was destroyed. Check if there is
394 * a port VLAN and restore the VSI configuration if
395 * needed.
396 */
397 if (vf->port_vlan_id)
398 i40e_vsi_add_pvid(vsi, vf->port_vlan_id);
391 f = i40e_add_filter(vsi, vf->default_lan_addr.addr, 399 f = i40e_add_filter(vsi, vf->default_lan_addr.addr,
392 0, true, false); 400 vf->port_vlan_id, true, false);
393 } 401 }
394 402
395 if (!f) { 403 if (!f) {
@@ -1958,7 +1966,7 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
1958 ret = i40e_vsi_add_pvid(vsi, 1966 ret = i40e_vsi_add_pvid(vsi,
1959 vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT)); 1967 vlan_id | (qos << I40E_VLAN_PRIORITY_SHIFT));
1960 else 1968 else
1961 i40e_vlan_stripping_disable(vsi); 1969 i40e_vsi_remove_pvid(vsi);
1962 1970
1963 if (vlan_id) { 1971 if (vlan_id) {
1964 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n", 1972 dev_info(&pf->pdev->dev, "Setting VLAN %d, QOS 0x%x on VF %d\n",
@@ -1978,6 +1986,10 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
1978 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n"); 1986 dev_err(&pf->pdev->dev, "Unable to update VF vsi context\n");
1979 goto error_pvid; 1987 goto error_pvid;
1980 } 1988 }
1989 /* The Port VLAN needs to be saved across resets the same as the
1990 * default LAN MAC address.
1991 */
1992 vf->port_vlan_id = le16_to_cpu(vsi->info.pvid);
1981 ret = 0; 1993 ret = 0;
1982 1994
1983error_pvid: 1995error_pvid:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
index d0b712c4bef3..bf3384f0abcb 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h
@@ -82,6 +82,7 @@ struct i40e_vf {
82 82
83 struct i40e_virtchnl_ether_addr default_lan_addr; 83 struct i40e_virtchnl_ether_addr default_lan_addr;
84 struct i40e_virtchnl_ether_addr default_fcoe_addr; 84 struct i40e_virtchnl_ether_addr default_fcoe_addr;
85 u16 port_vlan_id;
85 86
86 /* VSI indices - actual VSI pointers are maintained in the PF structure 87 /* VSI indices - actual VSI pointers are maintained in the PF structure
87 * When assigned, these will be non-zero, because VSI 0 is always 88 * When assigned, these will be non-zero, because VSI 0 is always