From patchwork Wed Aug 29 10:47:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 145409 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp521365ljw; Wed, 29 Aug 2018 03:50:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYK4+nI+ZSsdOrrlWmW+zENWrn/WTeGY8TWEH41dkgLqnzgcOEZvJA251K6oom2MrMSZXpQ X-Received: by 2002:a1c:a187:: with SMTP id k129-v6mr3800487wme.111.1535539811867; Wed, 29 Aug 2018 03:50:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535539811; cv=none; d=google.com; s=arc-20160816; b=VIXEMKvDc2IXTxpcX+SfIa/OWjKRAuuDbcWcocfhMDIv4LMh1qiNZLjreRTq2PQAYe w9IxQy77JYUvHJnBSwkF3XUgR4qZkriNq816W29jnHS5EIsZqVnfssMsSZ4TUC1vKyGV 5ibpMv6ywVfSBm3CgFD9WPU7QKr8n+Vo96jIGClPnKX5mmEOcjWlFzDR+10Z8FYogo9X Nr8vc1CZlal4STC4V/PPzAY68Vq2Amb3zKQOytStLsPOHx3mvR4SvBD/8R1U3LJh90yn NEE9IYbfSQ+SaSd2CxK76nCJ7FjzXoR9/vMI80a1D2ytcwvCxBg2K7VyW7TmRdFmYjQN PYHw== 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:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:dkim-signature:arc-authentication-results; bh=gm4EbmdbXH1JrVadBEs1oO+ysJ6YVqErGGe3XA1Dkgw=; b=Rl7ft1t7ZcYK/pFQhFX0ytYzMIdCW04OeGXSvIBHu3PKTFn8MbBkOBDaYXWQVKbYxc 2FUzZiJI7yecCsJ57NxMIaTEW4inJLdmSsCCnzd5cXQuyHmTk1A7h6cprhu5HyRrj9cd eDItf2j8QBceuEo5ZTmuvHyajCfVXMNUIg1RTIwPb8RcAkNSQ9BP/5ycJA3K4uK031Ex TSRUadMs4+Ax9xtgvwCCmfBG3Gkmyyi541NkjHdIkya6igLhj3FRjs5zk2+1apRnFilh YASuwtjHehsTiAh5aFwt18kb6Y4ACZMMGBlnA0yQNhYRETdF/IRWumaZiC/1Aj6TUDU3 q1IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=UPMqCJ5W; 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 w15-v6si2959483wro.101.2018.08.29.03.50.11; Wed, 29 Aug 2018 03:50:11 -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; dkim=fail header.i=@nxp.com header.s=selector1 header.b=UPMqCJ5W; 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 BBB8F4CB5; Wed, 29 Aug 2018 12:49:50 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00056.outbound.protection.outlook.com [40.107.0.56]) by dpdk.org (Postfix) with ESMTP id 548C34CA1 for ; Wed, 29 Aug 2018 12:49:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gm4EbmdbXH1JrVadBEs1oO+ysJ6YVqErGGe3XA1Dkgw=; b=UPMqCJ5Wyep8SXrOP6Kj/AEdhNsg2folhPEhVnFT6VjwzdSe6PnjMqauHZ9DmSc1PQbpPicom6EUvdrOPYq1iotqA5QRVqAaWy4qWn4F55Gu1SuMjHg5X0LiC0zwuKIpj65+7IRsprcyM1FV6AHpz0Fxxldn3hTkcz0JE7B8XNw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.143.30.134) by VI1PR0401MB2543.eurprd04.prod.outlook.com (2603:10a6:800:56::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 29 Aug 2018 10:49:45 +0000 From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Cc: dpdk-up@NXP1.onmicrosoft.com Date: Wed, 29 Aug 2018 16:17:30 +0530 Message-Id: <1535539660-20228-4-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535539660-20228-1-git-send-email-hemant.agrawal@nxp.com> References: <1535539660-20228-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.143.30.134] X-ClientProxiedBy: BM1PR0101CA0071.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::33) To VI1PR0401MB2543.eurprd04.prod.outlook.com (2603:10a6:800:56::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9efd239d-110e-45b8-78aa-08d60d9d229d X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0401MB2543; X-Micro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nFzUO6hxXkRUA8+pIm/6Hjncp4Me7Dmwe9wMZa35a8GYw3XQVZo7D25fRiSShq6kMFbA0k/aroGZbl4g4ln9Kb5yGOwJPFNuYyp26tqdA8U5m3mavu5ghI6JGjzKS9BXTRTT6xhM/SvTBagC1z6yA7c0wuA4bGQsrvzGSx6ZUc/b4lu09Bon35B6Ig0jLqAPZiItAc/mWC0zuQM3Fusphj1mGVyOaW4vgY5bNf55gUijCLNLMPIa/CT8gftUPvKtJDEgxGK1ILobGak5lqtak6XpqvXR5XkAtJKxzHOVXNyBt6vB+uAteNaetu1F4pzo64nsxDMQx94MQhnwWxKL8YazxPM9MlaXZCsANbPHLRwK6weiehyjGj6NbvZpp7qCTUgN2o; 4:HgBzRa5hMN4EklPtAnKQh9fA73cMz5xu/bS3SXGwt25hlO2a8LqkCzx/+TdsfB+d2ooD/6xcQrEDi3Shy84vnvU59A3bWFP9WRM4bf7F9bXoTeibj2lw7tVBK6cRm0/JvBEjdHk/dkhu0OODuRUwHgDYOKVe73Mu0WI5y9HZ2+4oD6Vlu7dYJUkw/DN2k5MhrS5PmtihMJd4wnpmnPRfMOVQIiu5KApiIJj2dk0MkE1Y0r/PV9Ly9NDk4OfMY+nmLJRgSYEPUvqKno+3UhdukSWRNX6Y6sSUi2z21o01RFJuf1equu12K1zc7XbMleSD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699016); SRVR:VI1PR0401MB2543; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0401MB2543; X-Forefront-PRVS: 077929D941 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(366004)(396003)(39860400002)(376002)(189003)(199004)(6512007)(6486002)(16526019)(53936002)(486006)(186003)(11346002)(105586002)(6116002)(106356001)(5660300001)(50466002)(68736007)(5009440100003)(2616005)(25786009)(48376002)(386003)(4326008)(55236004)(6666003)(73566003)(86362001)(956004)(107886003)(446003)(3846002)(26005)(575784001)(6506007)(476003)(316002)(52116002)(50226002)(478600001)(47776003)(66066001)(8936002)(16586007)(76176011)(51416003)(97736004)(44832011)(81166006)(8676002)(7736002)(305945005)(36756003)(81156014)(14444005)(2906002)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0401MB2543; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0401MB2543; 23:QIVUPsKxJtBIrFJc1+9MapNYoFgNsZp8ug22DAO?= j8YVG6fZBnc+wV56utBRu7/HlzyXbciP1vEdxEtsy66xqOAMPw+DoRWylELuLMQyQtoP7xb8u8ldSDoMZOTi7yQCZA29blV9DAh7dZ5hmDWqy0wrjtawYmQL1+Cw7j+9M2tDag6rR6BoZLZHjCqc7FGtcUSxCmR7wn2a8dEG40B2gudzOxODoIpI71RiulV5TjK/pbTcrI62Q9IzvaN8naZIGpbi2mnphdF/oGKleMoftbOoYNwG8qef9DhIIhdIeonRaX4EAyjpf7tfU/lc6zVGV7F1c/h1AWAgWlodxV5fXrA11m3kashZcWOmhsj3pp4UN1HI0c44mT/2pbwpCHCEYEFy6TgltYveRvu+EyA/9hPi+IgnZ3iUQQPugc8gEoziVM9Xjv5uvnuNCvsLzIWqz97UiWQM+Y2GEzm89cbELaHCRKNQ9DKZ7frXy+uNLwd4292/9yayFRdjnW5Lld8+um46N7AKaEps3A0yDWrZo22h/uKINoj4R27FKw7BVg2f9RByfjlE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ata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2018 10:49:45.2798 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9efd239d-110e-45b8-78aa-08d60d9d229d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2543 Subject: [dpdk-dev] [PATCH 03/13] net/dpaa: implement scatter offload support 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" Signed-off-by: Hemant Agrawal --- drivers/net/dpaa/dpaa_ethdev.c | 62 +++++++++++++++++++++++++++++++++++++++--- drivers/net/dpaa/dpaa_ethdev.h | 3 +- drivers/net/dpaa/dpaa_rxtx.c | 8 +++--- drivers/net/dpaa/dpaa_rxtx.h | 2 -- 4 files changed, 64 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index dd1bc90..a0e3f24 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -47,7 +47,8 @@ /* Supported Rx offloads */ static uint64_t dev_rx_offloads_sup = - DEV_RX_OFFLOAD_JUMBO_FRAME; + DEV_RX_OFFLOAD_JUMBO_FRAME | + DEV_RX_OFFLOAD_SCATTER; /* Rx offloads which cannot be disabled */ static uint64_t dev_rx_offloads_nodis = @@ -55,8 +56,7 @@ static uint64_t dev_rx_offloads_nodis = DEV_RX_OFFLOAD_UDP_CKSUM | DEV_RX_OFFLOAD_TCP_CKSUM | DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | - DEV_RX_OFFLOAD_CRC_STRIP | - DEV_RX_OFFLOAD_SCATTER; + DEV_RX_OFFLOAD_CRC_STRIP; /* Supported Tx offloads */ static uint64_t dev_tx_offloads_sup; @@ -148,11 +148,30 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) struct dpaa_if *dpaa_intf = dev->data->dev_private; uint32_t frame_size = mtu + ETHER_HDR_LEN + ETHER_CRC_LEN + VLAN_TAG_SIZE; + uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM; PMD_INIT_FUNC_TRACE(); if (mtu < ETHER_MIN_MTU || frame_size > DPAA_MAX_RX_PKT_LEN) return -EINVAL; + /* + * Refuse mtu that requires the support of scattered packets + * when this feature has not been enabled before. + */ + if (dev->data->min_rx_buf_size && + !dev->data->scattered_rx && frame_size > buffsz) { + DPAA_PMD_ERR("SG not enabled, will not fit in one buffer"); + return -EINVAL; + } + + /* check * >= max_frame */ + if (dev->data->min_rx_buf_size && dev->data->scattered_rx && + (frame_size > buffsz * DPAA_SGT_MAX_ENTRIES)) { + DPAA_PMD_ERR("Too big to fit for Max SG list %d", + buffsz * DPAA_SGT_MAX_ENTRIES); + return -EINVAL; + } + if (frame_size > ETHER_MAX_LEN) dev->data->dev_conf.rxmode.offloads &= DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -209,6 +228,13 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) DPAA_MAX_RX_PKT_LEN); } } + + if (rx_offloads & DEV_RX_OFFLOAD_SCATTER) { + DPAA_PMD_DEBUG("enabling scatter mode"); + fman_if_set_sg(dpaa_intf->fif, 1); + dev->data->scattered_rx = 1; + } + return 0; } @@ -306,7 +332,6 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev, dev_info->max_rx_queues = dpaa_intf->nb_rx_queues; dev_info->max_tx_queues = dpaa_intf->nb_tx_queues; - dev_info->min_rx_bufsize = DPAA_MIN_RX_BUF_SIZE; dev_info->max_rx_pktlen = DPAA_MAX_RX_PKT_LEN; dev_info->max_mac_addrs = DPAA_MAX_MAC_FILTER; dev_info->max_hash_mac_addrs = 0; @@ -520,6 +545,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct qm_mcc_initfq opts = {0}; u32 flags = 0; int ret; + u32 buffsz = rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; PMD_INIT_FUNC_TRACE(); @@ -533,6 +559,28 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, DPAA_PMD_INFO("Rx queue setup for queue index: %d fq_id (0x%x)", queue_idx, rxq->fqid); + /* Max packet can fit in single buffer */ + if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= buffsz) { + ; + } else if (dev->data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_SCATTER) { + if (dev->data->dev_conf.rxmode.max_rx_pkt_len > + buffsz * DPAA_SGT_MAX_ENTRIES) { + DPAA_PMD_ERR("max RxPkt size %d too big to fit " + "MaxSGlist %d", + dev->data->dev_conf.rxmode.max_rx_pkt_len, + buffsz * DPAA_SGT_MAX_ENTRIES); + rte_errno = EOVERFLOW; + return -rte_errno; + } + } else { + DPAA_PMD_WARN("The requested maximum Rx packet size (%u) is" + " larger than a single mbuf (%u) and scattered" + " mode has not been requested", + dev->data->dev_conf.rxmode.max_rx_pkt_len, + buffsz - RTE_PKTMBUF_HEADROOM); + } + if (!dpaa_intf->bp_info || dpaa_intf->bp_info->mp != mp) { struct fman_if_ic_params icp; uint32_t fd_offset; @@ -563,6 +611,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->name, fd_offset, fman_if_get_fdoff(dpaa_intf->fif)); } + DPAA_PMD_DEBUG("if:%s sg_on = %d, max_frm =%d", dpaa_intf->name, + fman_if_get_sg_enable(dpaa_intf->fif), + dev->data->dev_conf.rxmode.max_rx_pkt_len); /* checking if push mode only, no error check for now */ if (dpaa_push_mode_max_queue > dpaa_push_queue_idx) { dpaa_push_queue_idx++; @@ -1313,6 +1364,9 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) fman_if_reset_mcast_filter_table(fman_intf); /* Reset interface statistics */ fman_if_stats_reset(fman_intf); + /* Disable SG by default */ + fman_if_set_sg(fman_intf, 0); + fman_if_set_maxfrm(fman_intf, ETHER_MAX_LEN + VLAN_TAG_SIZE); return 0; diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index 2c38c34..2fc7231 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -39,9 +39,10 @@ /* Alignment to use for cpu-local structs to avoid coherency problems. */ #define MAX_CACHELINE 64 -#define DPAA_MIN_RX_BUF_SIZE 512 #define DPAA_MAX_RX_PKT_LEN 10240 +#define DPAA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */ + /* RX queue tail drop threshold (CGR Based) in frame count */ #define CGR_RX_PERFQ_THRESH 256 diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 168b77e..3a3a048 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -306,8 +306,6 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid) int i = 0; uint8_t fd_offset = fd->offset; - DPAA_DP_LOG(DEBUG, "Received an SG frame"); - vaddr = DPAA_MEMPOOL_PTOV(bp_info, qm_fd_addr(fd)); if (!vaddr) { DPAA_PMD_ERR("unable to convert physical address"); @@ -349,6 +347,8 @@ dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid) } prev_seg = cur_seg; } + DPAA_DP_LOG(DEBUG, "Received an SG frame len =%d, num_sg =%d", + first_seg->pkt_len, first_seg->nb_segs); dpaa_eth_packet_info(first_seg, vaddr); rte_pktmbuf_free_seg(temp); @@ -367,8 +367,6 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid) uint16_t offset; uint32_t length; - DPAA_DP_LOG(DEBUG, " FD--->MBUF"); - if (unlikely(format == qm_fd_sg)) return dpaa_eth_sg_to_mbuf(fd, ifid); @@ -379,6 +377,8 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid) offset = (fd->opaque & DPAA_FD_OFFSET_MASK) >> DPAA_FD_OFFSET_SHIFT; length = fd->opaque & DPAA_FD_LENGTH_MASK; + DPAA_DP_LOG(DEBUG, " FD--->MBUF off %d len = %d", offset, length); + /* Ignoring case when format != qm_fd_contig */ dpaa_display_frame(fd); diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h index d3e6351..6de70a7 100644 --- a/drivers/net/dpaa/dpaa_rxtx.h +++ b/drivers/net/dpaa/dpaa_rxtx.h @@ -32,8 +32,6 @@ /* L4 Type field: TCP */ #define DPAA_L4_PARSE_RESULT_TCP 0x20 -#define DPAA_SGT_MAX_ENTRIES 16 /* maximum number of entries in SG Table */ - #define DPAA_MAX_DEQUEUE_NUM_FRAMES 63 /**