From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5552FA0C43; Wed, 12 May 2021 11:23:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D3C694003F; Wed, 12 May 2021 11:23:25 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 28E154003E; Wed, 12 May 2021 11:23:23 +0200 (CEST) IronPort-SDR: VMyKm5FinLldRsE8/qaaGQmZh435UoRKIzY1RzW+opcFujlWdLcC13b4QYeJoib2Uuw4/77lN+ 0/y86wF1xIGA== X-IronPort-AV: E=McAfee;i="6200,9189,9981"; a="199708754" X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="199708754" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 02:23:18 -0700 IronPort-SDR: 3qQSlg9izSPy8zya62NdqIPCcPBsQDj8BjWIhNGbq0uCafGLxYZl3sdbq4V0xh2LKHjyWnFp7T YDS2Er27jMBA== X-IronPort-AV: E=Sophos;i="5.82,293,1613462400"; d="scan'208";a="455498976" Received: from shwdenpg235.ccr.corp.intel.com ([10.240.182.60]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2021 02:23:15 -0700 From: Alvin Zhang To: beilei.xing@intel.com, Ting.Xu@intel.com Cc: dev@dpdk.org, Alvin Zhang , stable@dpdk.org Date: Wed, 12 May 2021 17:23:11 +0800 Message-Id: <20210512092311.27392-1-alvinx.zhang@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20210512071604.38696-1-alvinx.zhang@intel.com> References: <20210512071604.38696-1-alvinx.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4] net/i40e: fix VF RSS configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" The kernel driver supports VF RSS configuration message "VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA", this patch adds PMD support for these messages. Fixes: b81295c474b0 ("net/i40e: add user callback for VF to PF message") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang --- v2, v3, v4: Update codes according to comments. --- drivers/net/i40e/i40e_pf.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 9804ed4..e2d8b2b 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -29,6 +29,28 @@ #define I40E_CFG_CRCSTRIP_DEFAULT 1 +/* Supported RSS offloads */ +#define I40E_DEFAULT_RSS_HENA ( \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_UDP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_SCTP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_OTHER) | \ + BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV4) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_UDP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_SCTP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_OTHER) | \ + BIT_ULL(I40E_FILTER_PCTYPE_FRAG_IPV6) | \ + BIT_ULL(I40E_FILTER_PCTYPE_L2_PAYLOAD)) + +#define I40E_DEFAULT_RSS_HENA_EXPANDED (I40E_DEFAULT_RSS_HENA | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV4_TCP_SYN_NO_ACK) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV4_UDP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV4_UDP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_IPV6_TCP_SYN_NO_ACK) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_UNICAST_IPV6_UDP) | \ + BIT_ULL(I40E_FILTER_PCTYPE_NONF_MULTICAST_IPV6_UDP)) + static int i40e_pf_host_switch_queues(struct i40e_pf_vf *vf, struct virtchnl_queue_select *qsel, @@ -1288,6 +1310,37 @@ (u8 *)vfres, sizeof(*vfres)); } +static void +i40e_pf_host_process_cmd_get_rss_hena(struct i40e_pf_vf *vf) +{ + struct virtchnl_rss_hena vrh = {0}; + struct i40e_pf *pf = vf->pf; + + if (pf->adapter->hw.mac.type == I40E_MAC_X722) + vrh.hena = I40E_DEFAULT_RSS_HENA_EXPANDED; + else + vrh.hena = I40E_DEFAULT_RSS_HENA; + + i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_GET_RSS_HENA_CAPS, + I40E_SUCCESS, (uint8_t *)&vrh, sizeof(vrh)); +} + +static void +i40e_pf_host_process_cmd_set_rss_hena(struct i40e_pf_vf *vf, uint8_t *msg) +{ + struct virtchnl_rss_hena *vrh = + (struct virtchnl_rss_hena *)msg; + struct i40e_hw *hw = &vf->pf->adapter->hw; + + i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(0, vf->vf_idx), + (uint32_t)vrh->hena); + i40e_write_rx_ctl(hw, I40E_VFQF_HENA1(1, vf->vf_idx), + (uint32_t)(vrh->hena >> 32)); + + i40e_pf_host_send_msg_to_vf(vf, VIRTCHNL_OP_SET_RSS_HENA, + I40E_SUCCESS, NULL, 0); +} + void i40e_pf_host_handle_vf_msg(struct rte_eth_dev *dev, uint16_t abs_vf_id, uint32_t opcode, @@ -1458,6 +1511,14 @@ PMD_DRV_LOG(INFO, "OP_REQUEST_QUEUES received"); i40e_pf_host_process_cmd_request_queues(vf, msg); break; + case VIRTCHNL_OP_GET_RSS_HENA_CAPS: + PMD_DRV_LOG(INFO, "OP_GET_RSS_HENA_CAPS received"); + i40e_pf_host_process_cmd_get_rss_hena(vf); + break; + case VIRTCHNL_OP_SET_RSS_HENA: + PMD_DRV_LOG(INFO, "OP_SET_RSS_HENA received"); + i40e_pf_host_process_cmd_set_rss_hena(vf, msg); + break; /* Don't add command supported below, which will * return an error code. -- 1.8.3.1