From patchwork Tue Apr 22 12:39:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirsher, Jeffrey T" X-Patchwork-Id: 341321 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 30351140110 for ; Tue, 22 Apr 2014 22:41:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932644AbaDVMlK (ORCPT ); Tue, 22 Apr 2014 08:41:10 -0400 Received: from mga09.intel.com ([134.134.136.24]:45665 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932601AbaDVMjh (ORCPT ); Tue, 22 Apr 2014 08:39:37 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 22 Apr 2014 05:34:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,903,1389772800"; d="scan'208";a="517217472" Received: from unknown (HELO jtkirshe-mobl.amr.corp.intel.com) ([10.255.12.164]) by fmsmga001.fm.intel.com with ESMTP; 22 Apr 2014 05:39:34 -0700 From: Jeff Kirsher To: davem@davemloft.net Cc: Greg Rose , netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com, Catherine Sullivan , Jeff Kirsher Subject: [net-next 03/16] i40e: Reset the VF upon conflicting VLAN configuration Date: Tue, 22 Apr 2014 05:39:18 -0700 Message-Id: <1398170371-3333-4-git-send-email-jeffrey.t.kirsher@intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398170371-3333-1-git-send-email-jeffrey.t.kirsher@intel.com> References: <1398170371-3333-1-git-send-email-jeffrey.t.kirsher@intel.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Greg Rose If a host VMM administrator hoses his VF by assigning a port VLAN after it is already up and running with implicit permission to set local VLANs then we print a message warning the host administrator that the VF driver needs to be reloaded. In addition we need to knock the VF offline so that it does not continue to receive traffic not on the port VLAN assigned to it. So we reset the VF. The VF will cease operation and the administrator will be forced to unload and reload the VF driver to make it work again. Change-ID: Iae1ae006b244e74e30a4ee546b3c5fca5cfb40aa Signed-off-by: Greg Rose Signed-off-by: Catherine Sullivan Tested-by: Sibai Li Signed-off-by: Jeff Kirsher --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c index 02c11a7..e3e4df0 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -29,6 +29,24 @@ /***********************misc routines*****************************/ /** + * i40e_vc_disable_vf + * @pf: pointer to the pf info + * @vf: pointer to the vf info + * + * Disable the VF through a SW reset + **/ +static inline void i40e_vc_disable_vf(struct i40e_pf *pf, struct i40e_vf *vf) +{ + struct i40e_hw *hw = &pf->hw; + u32 reg; + + reg = rd32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id)); + reg |= I40E_VPGEN_VFRTRIG_VFSWR_MASK; + wr32(hw, I40E_VPGEN_VFRTRIG(vf->vf_id), reg); + i40e_flush(hw); +} + +/** * i40e_vc_isvalid_vsi_id * @vf: pointer to the vf info * @vsi_id: vf relative vsi id @@ -2088,10 +2106,16 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev, goto error_pvid; } - if (vsi->info.pvid == 0 && i40e_is_vsi_in_vlan(vsi)) + if (vsi->info.pvid == 0 && i40e_is_vsi_in_vlan(vsi)) { dev_err(&pf->pdev->dev, "VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n", vf_id); + /* Administrator Error - knock the VF offline until he does + * the right thing by reconfiguring his network correctly + * and then reloading the VF driver. + */ + i40e_vc_disable_vf(pf, vf); + } /* Check for condition where there was already a port VLAN ID * filter set and now it is being deleted by setting it to zero.