From patchwork Fri Jul 10 16:21:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 235250 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp602564ilg; Fri, 10 Jul 2020 09:26:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFzIDzTmbpgqT71QZbbpYo4uByasUBxb304TVqmW6qQ8OyDmkTgmLqT7nnevDyRXJXU1DO X-Received: by 2002:a50:f413:: with SMTP id r19mr81801905edm.17.1594398381518; Fri, 10 Jul 2020 09:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594398381; cv=none; d=google.com; s=arc-20160816; b=ti+6EXu9ihnYh28n/D1ktz6qBsn6jzEMflLwnWttuqniuwobO4N67gOaecd3OGSB6Q TKNJDuXQq4kthZL+q3FrawJy4WdvSF6jASR7G6dH9HL/Tw4jF+KPJIPfuRcvRgUH8Omy n/gDfpXBaBDkHDcJH2wFRmOJDOK2EButU6WccMkhz5tAm6yXZXvVE41v/AitNRGLm+13 nJt24NFKq2yuKzWSYz2oCxJ4gjOHWtoGzOSRTbG4dylnHM69l5AZFmiIla0Y4R8Z8V1Q 3rjiKPrSqQ7ER+7XBCIqgcJ3CG0I6M3fxucTO5yKkzamDJ2tOYsPUxf8mI5neS4qfB3v VZxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=fmwXLjVAX/7L1W1yg4rY2rEiERHRNbOtgMhpF0K+lSg=; b=l+HAAtukSIx/IDdBZybKHrn+x+oSYcDvPVK2RJlTmjXWGFl37PjFi/uI0xIMrca6l/ Q1LCOKq07jbLlAXkqcy87Zq9AS6Pp7btuPRfKzsyGayBTnyLiUJvmnFS/Z5Ev9c+TwLv r0EGPZMhJhN23a9fx1jKEb8jQRngHYknxx/kWsC9vpp7Zu5Tz0YpdkH4VRMXwm1UFnac BoqmpZh+CuDblG26ZBUhN/NEhyand8Ohc3irrXMPM4VCKSIcgLAIkkEh6rA2XiJc9N4Z 9OHlQysJgPP8A50zE/CK2NAm1zeM2YDlfCokjMibJjgagi/I5vPapAMdbHpGiBqm52+m YX4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id d9si3998178eja.455.2020.07.10.09.26.21; Fri, 10 Jul 2020 09:26:21 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8FD691DA16; Fri, 10 Jul 2020 18:26:02 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 85D401D9E1 for ; Fri, 10 Jul 2020 18:25:58 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 68BEC20130B; Fri, 10 Jul 2020 18:25:58 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 847AC2003D1; Fri, 10 Jul 2020 18:25:56 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id CEA17402D7; Sat, 11 Jul 2020 00:25:53 +0800 (SGT) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Apeksha Gupta Date: Fri, 10 Jul 2020 21:51:32 +0530 Message-Id: <20200710162137.22973-4-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200710162137.22973-1-hemant.agrawal@nxp.com> References: <20200710162137.22973-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 4/9] net/dpaa2: add Tx/Rx burst mode info 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" From: Apeksha Gupta Retrieve burst mode information according to the selected Tx/Rx mode and offloads. Signed-off-by: Apeksha Gupta --- doc/guides/nics/features/dpaa2.ini | 2 + drivers/net/dpaa2/dpaa2_ethdev.c | 73 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) -- 2.17.1 diff --git a/doc/guides/nics/features/dpaa2.ini b/doc/guides/nics/features/dpaa2.ini index 831883d21..878f03d40 100644 --- a/doc/guides/nics/features/dpaa2.ini +++ b/doc/guides/nics/features/dpaa2.ini @@ -7,8 +7,10 @@ Speed capabilities = Y Link status = Y Link status event = Y +Burst mode info = Y Queue start/stop = Y Jumbo frame = Y +Scattered Rx = Y MTU update = Y Promiscuous mode = Y Allmulticast mode = Y diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 3e5502de5..a7195f6c1 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -286,6 +286,77 @@ dpaa2_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) return 0; } +static int +dpaa2_dev_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + struct rte_eth_conf *eth_conf = &dev->data->dev_conf; + int ret = -EINVAL; + unsigned int i; + const struct burst_info { + uint64_t flags; + const char *output; + } rx_offload_map[] = { + {DEV_RX_OFFLOAD_CHECKSUM, " Checksum,"}, + {DEV_RX_OFFLOAD_SCTP_CKSUM, " SCTP csum,"}, + {DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"}, + {DEV_RX_OFFLOAD_OUTER_UDP_CKSUM, " Outer UDP csum,"}, + {DEV_RX_OFFLOAD_VLAN_STRIP, " VLAN strip,"}, + {DEV_RX_OFFLOAD_VLAN_FILTER, " VLAN filter,"}, + {DEV_RX_OFFLOAD_JUMBO_FRAME, " Jumbo frame,"}, + {DEV_RX_OFFLOAD_TIMESTAMP, " Timestamp,"}, + {DEV_RX_OFFLOAD_RSS_HASH, " RSS,"}, + {DEV_RX_OFFLOAD_SCATTER, " Scattered,"} + }; + + /* Update Rx offload info */ + for (i = 0; i < RTE_DIM(rx_offload_map); i++) { + if (eth_conf->rxmode.offloads & rx_offload_map[i].flags) { + snprintf(mode->info, sizeof(mode->info), "%s", + rx_offload_map[i].output); + ret = 0; + break; + } + } + return ret; +} + +static int +dpaa2_dev_tx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + struct rte_eth_conf *eth_conf = &dev->data->dev_conf; + int ret = -EINVAL; + unsigned int i; + const struct burst_info { + uint64_t flags; + const char *output; + } tx_offload_map[] = { + {DEV_TX_OFFLOAD_VLAN_INSERT, " VLAN Insert,"}, + {DEV_TX_OFFLOAD_IPV4_CKSUM, " IPV4 csum,"}, + {DEV_TX_OFFLOAD_UDP_CKSUM, " UDP csum,"}, + {DEV_TX_OFFLOAD_TCP_CKSUM, " TCP csum,"}, + {DEV_TX_OFFLOAD_SCTP_CKSUM, " SCTP csum,"}, + {DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, " Outer IPV4 csum,"}, + {DEV_TX_OFFLOAD_MT_LOCKFREE, " MT lockfree,"}, + {DEV_TX_OFFLOAD_MBUF_FAST_FREE, " MBUF free disable,"}, + {DEV_TX_OFFLOAD_MULTI_SEGS, " Scattered,"} + }; + + /* Update Tx offload info */ + for (i = 0; i < RTE_DIM(tx_offload_map); i++) { + if (eth_conf->txmode.offloads & tx_offload_map[i].flags) { + snprintf(mode->info, sizeof(mode->info), "%s", + tx_offload_map[i].output); + ret = 0; + break; + } + } + return ret; +} + static int dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) { @@ -2206,6 +2277,8 @@ static struct eth_dev_ops dpaa2_ethdev_ops = { .rx_queue_release = dpaa2_dev_rx_queue_release, .tx_queue_setup = dpaa2_dev_tx_queue_setup, .tx_queue_release = dpaa2_dev_tx_queue_release, + .rx_burst_mode_get = dpaa2_dev_rx_burst_mode_get, + .tx_burst_mode_get = dpaa2_dev_tx_burst_mode_get, .rx_queue_count = dpaa2_dev_rx_queue_count, .flow_ctrl_get = dpaa2_flow_ctrl_get, .flow_ctrl_set = dpaa2_flow_ctrl_set,