From patchwork Fri Apr 3 04:46:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhao1, Wei" X-Patchwork-Id: 67736 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06633A0562; Fri, 3 Apr 2020 07:09:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 254291C11F; Fri, 3 Apr 2020 07:07:56 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 201111C0B5 for ; Fri, 3 Apr 2020 07:07:53 +0200 (CEST) IronPort-SDR: yuCzmidrwZCLLkqYU+y9PpMVk2QRNCXsYnaaa8H5th9aqHTThw90riqKQjy81r3zSlUcemzLit 0gv6W7nZMmVg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2020 22:07:53 -0700 IronPort-SDR: WS/jb2sBSKAstMpzvb6uj9LZhouvIlXr/jNRJ9JYC5E6oBn0hzedE4xw0ygU/oT/sC4E7W+Czw IGrXi92y0kFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,338,1580803200"; d="scan'208";a="451178867" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by fmsmga006.fm.intel.com with ESMTP; 02 Apr 2020 22:07:52 -0700 From: Wei Zhao To: dev@dpdk.org Cc: qi.z.zhang@intel.com, nannan.lu@intel.com, qi.fu@intel.com, yuan.peng@intel.com, Beilei Xing Date: Fri, 3 Apr 2020 12:46:09 +0800 Message-Id: <20200403044609.27512-14-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200403044609.27512-1-wei.zhao1@intel.com> References: <20200403024353.24681-1-wei.zhao1@intel.com> <20200403044609.27512-1-wei.zhao1@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v4 13/13] net/ice: redirect switch rule to new VSI X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After VF reset, VF's VSI number may be changed, the switch rule which forwards packet to the old VSI number should be redirected to the new VSI number. Signed-off-by: Beilei Xing --- drivers/net/ice/ice_dcf_parent.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 37f0e2be2..e05b6b3e5 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -19,6 +19,8 @@ ice_dcf_update_vsi_ctx(struct ice_hw *hw, uint16_t vsi_handle, uint16_t vsi_map) { struct ice_vsi_ctx *vsi_ctx; + bool first_update = false; + uint16_t new_vsi_num; if (unlikely(vsi_handle >= ICE_MAX_VSI)) { PMD_DRV_LOG(ERR, "Invalid vsi handle %u", vsi_handle); @@ -35,11 +37,25 @@ ice_dcf_update_vsi_ctx(struct ice_hw *hw, uint16_t vsi_handle, vsi_handle); return; } + hw->vsi_ctx[vsi_handle] = vsi_ctx; + first_update = true; } - vsi_ctx->vsi_num = (vsi_map & VIRTCHNL_DCF_VF_VSI_ID_M) >> - VIRTCHNL_DCF_VF_VSI_ID_S; - hw->vsi_ctx[vsi_handle] = vsi_ctx; + new_vsi_num = (vsi_map & VIRTCHNL_DCF_VF_VSI_ID_M) >> + VIRTCHNL_DCF_VF_VSI_ID_S; + + /* Redirect rules if vsi mapping table changes. */ + if (!first_update && vsi_ctx->vsi_num != new_vsi_num) { + struct ice_flow_redirect rd; + + memset(&rd, 0, sizeof(struct ice_flow_redirect)); + rd.type = ICE_FLOW_REDIRECT_VSI; + rd.vsi_handle = vsi_handle; + rd.new_vsi_num = new_vsi_num; + ice_flow_redirect((struct ice_adapter *)hw->back, &rd); + } else { + vsi_ctx->vsi_num = new_vsi_num; + } PMD_DRV_LOG(DEBUG, "VF%u is assigned with vsi number %u", vsi_handle, vsi_ctx->vsi_num);