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 21E73428CD; Tue, 4 Apr 2023 15:03:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3744042B7E; Tue, 4 Apr 2023 15:03:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 74B5242B7E for ; Tue, 4 Apr 2023 15:03:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680613426; x=1712149426; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OiZu0cmyThkxMRLb+mEuLb1IYL6w8qfcO8DINBq3IEw=; b=EY2rXu93r7M50ffLktRLGHQkWi4moln+/VdmdsuydszWEzhUeCwVLuZx hjLBW324f0KNeIXzcHx9p8brIEcWmGPrqUbyrbWFB7n7EuzAyAjdJ9qgA 0d+KCQp/dGJqbmgL981rJa2BNzlLVK1G5S8a2kvWy4Pb/ZFBLCkQVr6rb cfABGLnJDK2nZV58TWB3P51kL7kY/eXddGAy/Y8gNLspfZgWOmjogAsfI LIrMcq/foUParK0TkW32pgkQkDNFg4SoXkE6nfgyeugU7nfh3tA+pPf3e EKxOMWPN976Ev3ql20f08F5q8SAmF/YF4c2ZQGJ+Q+NqkUSDV9OrxeIpv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="344739418" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="344739418" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2023 06:03:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="810229634" X-IronPort-AV: E=Sophos;i="5.98,317,1673942400"; d="scan'208";a="810229634" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by orsmga004.jf.intel.com with ESMTP; 04 Apr 2023 06:03:44 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, Beilei Xing Subject: [PATCH v3 2/2] common/idpf: refine capability get Date: Tue, 4 Apr 2023 12:41:12 +0000 Message-Id: <20230404124112.71703-3-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230404124112.71703-1-beilei.xing@intel.com> References: <20230321070703.80689-1-beilei.xing@intel.com> <20230404124112.71703-1-beilei.xing@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Beilei Xing Initialize required capability in PMD, and refine idpf_vc_caps_get function. Then different PMDs can require different capability. Signed-off-by: Beilei Xing --- drivers/common/idpf/idpf_common_virtchnl.c | 45 ++-------------------- drivers/net/cpfl/cpfl_ethdev.c | 41 ++++++++++++++++++++ drivers/net/idpf/idpf_ethdev.c | 40 +++++++++++++++++++ 3 files changed, 84 insertions(+), 42 deletions(-) diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c index 9ee7259539..a4e129062e 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.c +++ b/drivers/common/idpf/idpf_common_virtchnl.c @@ -278,51 +278,12 @@ idpf_vc_api_version_check(struct idpf_adapter *adapter) int idpf_vc_caps_get(struct idpf_adapter *adapter) { - struct virtchnl2_get_capabilities caps_msg; struct idpf_cmd_info args; int err; - memset(&caps_msg, 0, sizeof(struct virtchnl2_get_capabilities)); - - caps_msg.csum_caps = - VIRTCHNL2_CAP_TX_CSUM_L3_IPV4 | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP | - VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP | - VIRTCHNL2_CAP_TX_CSUM_GENERIC | - VIRTCHNL2_CAP_RX_CSUM_L3_IPV4 | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP | - VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP | - VIRTCHNL2_CAP_RX_CSUM_GENERIC; - - caps_msg.rss_caps = - VIRTCHNL2_CAP_RSS_IPV4_TCP | - VIRTCHNL2_CAP_RSS_IPV4_UDP | - VIRTCHNL2_CAP_RSS_IPV4_SCTP | - VIRTCHNL2_CAP_RSS_IPV4_OTHER | - VIRTCHNL2_CAP_RSS_IPV6_TCP | - VIRTCHNL2_CAP_RSS_IPV6_UDP | - VIRTCHNL2_CAP_RSS_IPV6_SCTP | - VIRTCHNL2_CAP_RSS_IPV6_OTHER | - VIRTCHNL2_CAP_RSS_IPV4_AH | - VIRTCHNL2_CAP_RSS_IPV4_ESP | - VIRTCHNL2_CAP_RSS_IPV4_AH_ESP | - VIRTCHNL2_CAP_RSS_IPV6_AH | - VIRTCHNL2_CAP_RSS_IPV6_ESP | - VIRTCHNL2_CAP_RSS_IPV6_AH_ESP; - - caps_msg.other_caps = VIRTCHNL2_CAP_WB_ON_ITR; - args.ops = VIRTCHNL2_OP_GET_CAPS; - args.in_args = (uint8_t *)&caps_msg; - args.in_args_size = sizeof(caps_msg); + args.in_args = (uint8_t *)&adapter->caps; + args.in_args_size = sizeof(struct virtchnl2_get_capabilities); args.out_buffer = adapter->mbx_resp; args.out_size = IDPF_DFLT_MBX_BUF_SIZE; @@ -333,7 +294,7 @@ idpf_vc_caps_get(struct idpf_adapter *adapter) return err; } - rte_memcpy(&adapter->caps, args.out_buffer, sizeof(caps_msg)); + rte_memcpy(&adapter->caps, args.out_buffer, sizeof(struct virtchnl2_get_capabilities)); return 0; } diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index d3c50619ea..186ccb3095 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1200,6 +1200,45 @@ static struct idpf_ctlq_create_info ctlq_info[IDPF_CTLQ_NUM] = { } }; +static struct virtchnl2_get_capabilities req_caps = { + .csum_caps = + VIRTCHNL2_CAP_TX_CSUM_L3_IPV4 | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP | + VIRTCHNL2_CAP_TX_CSUM_GENERIC | + VIRTCHNL2_CAP_RX_CSUM_L3_IPV4 | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP | + VIRTCHNL2_CAP_RX_CSUM_GENERIC, + + .rss_caps = + VIRTCHNL2_CAP_RSS_IPV4_TCP | + VIRTCHNL2_CAP_RSS_IPV4_UDP | + VIRTCHNL2_CAP_RSS_IPV4_SCTP | + VIRTCHNL2_CAP_RSS_IPV4_OTHER | + VIRTCHNL2_CAP_RSS_IPV6_TCP | + VIRTCHNL2_CAP_RSS_IPV6_UDP | + VIRTCHNL2_CAP_RSS_IPV6_SCTP | + VIRTCHNL2_CAP_RSS_IPV6_OTHER | + VIRTCHNL2_CAP_RSS_IPV4_AH | + VIRTCHNL2_CAP_RSS_IPV4_ESP | + VIRTCHNL2_CAP_RSS_IPV4_AH_ESP | + VIRTCHNL2_CAP_RSS_IPV6_AH | + VIRTCHNL2_CAP_RSS_IPV6_ESP | + VIRTCHNL2_CAP_RSS_IPV6_AH_ESP, + + .other_caps = VIRTCHNL2_CAP_WB_ON_ITR | + VIRTCHNL2_CAP_PTP +}; + static int cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adapter) { @@ -1229,6 +1268,8 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a goto err_reset_check; } + rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities)); + ret = idpf_adapter_init(base); if (ret != 0) { PMD_INIT_LOG(ERR, "Failed to init adapter"); diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 662a8a806a..18c152b598 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -1163,6 +1163,44 @@ static struct idpf_ctlq_create_info idpf_ctlq_info[IDPF_CTLQ_NUM] = { } }; +static struct virtchnl2_get_capabilities req_caps = { + .csum_caps = + VIRTCHNL2_CAP_TX_CSUM_L3_IPV4 | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_TCP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_UDP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV4_SCTP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_TCP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_UDP | + VIRTCHNL2_CAP_TX_CSUM_L4_IPV6_SCTP | + VIRTCHNL2_CAP_TX_CSUM_GENERIC | + VIRTCHNL2_CAP_RX_CSUM_L3_IPV4 | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_TCP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_UDP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV4_SCTP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_TCP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_UDP | + VIRTCHNL2_CAP_RX_CSUM_L4_IPV6_SCTP | + VIRTCHNL2_CAP_RX_CSUM_GENERIC, + + .rss_caps = + VIRTCHNL2_CAP_RSS_IPV4_TCP | + VIRTCHNL2_CAP_RSS_IPV4_UDP | + VIRTCHNL2_CAP_RSS_IPV4_SCTP | + VIRTCHNL2_CAP_RSS_IPV4_OTHER | + VIRTCHNL2_CAP_RSS_IPV6_TCP | + VIRTCHNL2_CAP_RSS_IPV6_UDP | + VIRTCHNL2_CAP_RSS_IPV6_SCTP | + VIRTCHNL2_CAP_RSS_IPV6_OTHER | + VIRTCHNL2_CAP_RSS_IPV4_AH | + VIRTCHNL2_CAP_RSS_IPV4_ESP | + VIRTCHNL2_CAP_RSS_IPV4_AH_ESP | + VIRTCHNL2_CAP_RSS_IPV6_AH | + VIRTCHNL2_CAP_RSS_IPV6_ESP | + VIRTCHNL2_CAP_RSS_IPV6_AH_ESP, + + .other_caps = VIRTCHNL2_CAP_WB_ON_ITR +}; + static int idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *adapter) { @@ -1192,6 +1230,8 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a goto err_reset_check; } + rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities)); + ret = idpf_adapter_init(base); if (ret != 0) { PMD_INIT_LOG(ERR, "Failed to init adapter"); -- 2.26.2