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 BACEF428D7; Thu, 6 Apr 2023 10:05:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63EB042D1D; Thu, 6 Apr 2023 10:05:34 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 7877742D0C for ; Thu, 6 Apr 2023 10:05:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680768332; x=1712304332; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=so62BJMVlJh/SklbAL/pkfkozt8ZHLTXm9GK9akO4tk=; b=f7B8Bfl7RlCbwM3t0o9KymvVKj6PzCdf0OnTesU6J0dV3jMGdjFj/CP/ P8DwGeXnC0PtorhesZd9ElYT4VMdTECkAVid2W5ccz8SqCk5vId6pb5L7 xBNYWsUnRG/pLCFkPr/u373fgaeA5nx2X1lCzyz56+Yn69lXWk0FVFg5T /raWLSAx1yuBYVcSGHTFBpNiD+rN0krbmYeFFHtXSxHrd4PLt2mAmgslf nB8gvEPeRK8udZOtWxzd9AblmW7zPPob5O7w0DzuaishP+5TpddI/rO53 QJ/Ct7TEYQBw04E3+SRRoU8eBdRdUbbpRX54MdRo8KKEBK578tGxPW4jR A==; X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="345272385" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="345272385" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2023 01:05:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10671"; a="664358458" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="664358458" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by orsmga006.jf.intel.com with ESMTP; 06 Apr 2023 01:05:30 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, Beilei Xing Subject: [PATCH v4 2/2] common/idpf: refine capability get Date: Thu, 6 Apr 2023 07:42:45 +0000 Message-Id: <20230406074245.82991-3-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230406074245.82991-1-beilei.xing@intel.com> References: <20230404124112.71703-1-beilei.xing@intel.com> <20230406074245.82991-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 | 40 +++++++++++++++++++ drivers/net/idpf/idpf_ethdev.c | 40 +++++++++++++++++++ 3 files changed, 83 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..306b8ad769 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -1200,6 +1200,44 @@ 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 +}; + static int cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adapter) { @@ -1229,6 +1267,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