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 90E14460C2; Mon, 20 Jan 2025 12:16:19 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 835AB40A87; Mon, 20 Jan 2025 12:15:17 +0100 (CET) Received: from lf-2-45.ptr.blmpb.com (lf-2-45.ptr.blmpb.com [101.36.218.45]) by mails.dpdk.org (Postfix) with ESMTP id 17CA140E2C for ; Mon, 20 Jan 2025 12:15:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1737371704; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=7sESri90zyzITZTXYo0ZgaNuLR+/7YQ+iGGJcS9ibjw=; b=IKRIBSG+IlFXP9dMS+hkGifeK6nqutcH9D8CPxksLzAr/Nv3A+1TWTE+CMOujNdbGxF/Ib kkman2hyCFDLlm5hcM2eWkUg7eLPejeZlSObqTj37nXOPNHAhs8LVAhOG9xWRbpp7OtL+T M3Rm9kPOdwKXUvpK5EeajDq/aVD2k7BvsEYHGPyAR7VAfr8r2eROU52NQVDXeINfcjTcoi jpAFOHO9yPKM3xnz88GwEYQMB8/x5WkS4svlzUJ7GwW9Hd9AW1JkmuUMXwPySkobVhFXH2 MRQRLdJzVW5kh7XrQIFm/bKlKRLt2875vjkkP1qHNhaF5JSbEOfQPp3okfRlug== From: "WanRenyong" Subject: [PATCH v6 14/15] net/xsc: add ethdev infos get Mime-Version: 1.0 In-Reply-To: <20250120111431.1048479-1-wanry@yunsilicon.com> X-Mailer: git-send-email 2.25.1 X-Original-From: WanRenyong Content-Type: text/plain; charset=UTF-8 To: Cc: , , , , , , , , , Message-Id: <20250120111501.1048479-15-wanry@yunsilicon.com> References: <20250120111431.1048479-1-wanry@yunsilicon.com> X-Lms-Return-Path: Content-Transfer-Encoding: 7bit Date: Mon, 20 Jan 2025 19:15:02 +0800 Received: from ubuntu-liun.yunsilicon.com ([58.34.192.114]) by smtp.feishu.cn with ESMTPS; Mon, 20 Jan 2025 19:15:02 +0800 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 Implement xsc ethdev information get ops. Signed-off-by: WanRenyong --- drivers/net/xsc/xsc_ethdev.c | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c index 63c64ce547..5d548adb2d 100644 --- a/drivers/net/xsc/xsc_ethdev.c +++ b/drivers/net/xsc/xsc_ethdev.c @@ -364,6 +364,66 @@ xsc_ethdev_close(struct rte_eth_dev *dev) return 0; } +static uint64_t +xsc_get_rx_queue_offloads(struct rte_eth_dev *dev) +{ + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); + struct xsc_dev_config *config = &priv->config; + uint64_t offloads = 0; + + if (config->hw_csum) + offloads |= (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_RX_OFFLOAD_UDP_CKSUM | + RTE_ETH_RX_OFFLOAD_TCP_CKSUM); + + return offloads; +} + +static uint64_t +xsc_get_tx_port_offloads(struct rte_eth_dev *dev) +{ + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); + uint64_t offloads = 0; + struct xsc_dev_config *config = &priv->config; + + if (config->hw_csum) + offloads |= (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | + RTE_ETH_TX_OFFLOAD_UDP_CKSUM | + RTE_ETH_TX_OFFLOAD_TCP_CKSUM); + if (config->tso) + offloads |= RTE_ETH_TX_OFFLOAD_TCP_TSO; + return offloads; +} + +static int +xsc_ethdev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info) +{ + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); + + info->min_rx_bufsize = 64; + info->max_rx_pktlen = 65536; + info->max_lro_pkt_size = 0; + info->max_rx_queues = 256; + info->max_tx_queues = 1024; + info->rx_desc_lim.nb_max = 4096; + info->rx_desc_lim.nb_min = 16; + info->tx_desc_lim.nb_max = 8192; + info->tx_desc_lim.nb_min = 128; + + info->rx_queue_offload_capa = xsc_get_rx_queue_offloads(dev); + info->rx_offload_capa = info->rx_queue_offload_capa; + info->tx_offload_capa = xsc_get_tx_port_offloads(dev); + + info->if_index = priv->ifindex; + info->speed_capa = priv->xdev->link_speed_capa; + info->hash_key_size = XSC_RSS_HASH_KEY_LEN; + info->tx_desc_lim.nb_seg_max = 8; + info->tx_desc_lim.nb_mtu_seg_max = 8; + info->switch_info.name = dev->data->name; + info->switch_info.port_id = priv->representor_id; + return 0; +} + static int xsc_ethdev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc, uint32_t socket, const struct rte_eth_rxconf *conf, @@ -549,6 +609,7 @@ const struct eth_dev_ops xsc_eth_dev_ops = { .dev_close = xsc_ethdev_close, .stats_get = xsc_ethdev_stats_get, .stats_reset = xsc_ethdev_stats_reset, + .dev_infos_get = xsc_ethdev_infos_get, .rx_queue_setup = xsc_ethdev_rx_queue_setup, .tx_queue_setup = xsc_ethdev_tx_queue_setup, .rx_queue_release = xsc_ethdev_rxq_release, -- 2.25.1