From patchwork Fri Jul 6 08:10:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 141276 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2836816ljj; Fri, 6 Jul 2018 01:14:55 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc/B1gTbYHN0ZbkdIGl2vjNGOKeZ1bhQLZgtjVliADi0IkVZ1MLsD7QK9jUcK4NRNBbecCe X-Received: by 2002:adf:b1d2:: with SMTP id r18-v6mr7259200wra.79.1530864895445; Fri, 06 Jul 2018 01:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530864895; cv=none; d=google.com; s=arc-20160816; b=RMHG4x49jzUhPV+aZJbVywrSuA8avWqFCYXSc/Vh3oXZXi+yxOfyFiIKjTOr4qBwQf IIc4LwhsZTHQ7/uh6AUlxy8bPRBL+2nLJ6FNQVJsk0kHmMILfMncIQAaXMZzu9XkK/oJ fFMVTFBbIBRNdk2oON//JTXxBw/R8xfC9oLpVYZlHs/yfS4fMf/nBK1VLmANxIlVX/ap x2ZUq5822Q7V8MeHyHzD8cMsJf7vIK2j9oTfyaPrd+gGL6rVfQ4FW2/t4yx0ycL5iZHO OGso4W4xdqIiiYP+81stt5FIFbUe61YOEWO+SNMlYBYtujpE7Ui8D9EE+RYUf8wO8eNp WloA== 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=OsLBsMdYSskxlKGg88nmbBouVFlcApTClbJbzTdixnk=; b=IiO5m2J6Cozh/v3PktBPQBJjN0o45avFTvUFmRqpnPPGdOfL63DBx1SrptWHxIR3jI KcGnMqtgiwdRZ+FsMNyqX1yD/m6jdCHy6d6Ho9/Kb9Mf14B/8dbBFQTUe1cx634axAGQ uuMjihOyEYvnMvzGvqYahkwIQ4qqgN9kV42Cxtl3Oke0xLVQmI1j4diWuAwYY6BY1h6o 1e6LlPuA71ftInZT9MZWmeCm1wPQRk/v5ycUmCucZsvCCo1lObBc1YKJz3XlWHDS8XzI d8MaUwvNMsTW0flyobeir83ae55f7WRNqg8KJ5xbN6acX0o5RITKJToC3GWKT/vgbyjd 7i4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nxp.com header.s=selector1 header.b=TXyXkzmT; 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 h14-v6si6106094wrq.378.2018.07.06.01.14.55; Fri, 06 Jul 2018 01:14:55 -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=TXyXkzmT; 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 84FA81C4DE; Fri, 6 Jul 2018 10:12:29 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00055.outbound.protection.outlook.com [40.107.0.55]) by dpdk.org (Postfix) with ESMTP id BC94B1C44E for ; Fri, 6 Jul 2018 10:12:17 +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=OsLBsMdYSskxlKGg88nmbBouVFlcApTClbJbzTdixnk=; b=TXyXkzmTrPyDN+MBl0MsEAcysI6MfSeCCS1B1FpukYBK2lviAPWAIkvGeRt4Fwj9AwOnk7yhJkUOCipxf1wADxG/I5stXvf87ikPdO1qAYiQZ+bpTdMDrgLFcXqBCn9gavy3Syjtq/E+To0ECNTkkAtUSM/lL9qGeObYpkFLGHY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=hemant.agrawal@nxp.com; Received: from bf-netperf1.ap.freescale.net (14.142.187.166) by AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.23; Fri, 6 Jul 2018 08:12:15 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: shreyansh.jain@nxp.com Date: Fri, 6 Jul 2018 13:40:13 +0530 Message-Id: <1530864613-11754-16-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530864613-11754-1-git-send-email-hemant.agrawal@nxp.com> References: <1530697431-1244-1-git-send-email-hemant.agrawal@nxp.com> <1530864613-11754-1-git-send-email-hemant.agrawal@nxp.com> MIME-Version: 1.0 X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: PN1PR01CA0076.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:1::16) To AM2PR04MB0755.eurprd04.prod.outlook.com (2a01:111:e400:8411::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4db23da7-b092-4d8a-f27e-08d5e3182fab X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM2PR04MB0755; X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 3:wYUmY9RpHzuUlbDswzr6BW8zUcq9sktuFwemjsVE1fGJMaWm1sp1sz35Gv/3LymIMta8Aok486EQUP9zDM14U6inHncdF/BuchT6d4lkAILIq8IeeR2LPPUGG5SZFUopqGKOSzI60tLz3oDWczl+Ia/+cKEfkvwAmWooaC8uwty9FJ3THXOiVYsnz3LPl/7yjWfXfaB/xYptvX2rOpeMz0guTx/IkUmNJX/3E1diTSlB1EMpIy5Knl3nWRdZqjXC; 25:CGwr7he0/JMdYvvYGxmXjifKlT78Zto7y2wdAM/O+j2LUJvibROLs3uBYv0Tz/AJl7ynLytyg3zUQZ+kTg1w5AB0j4TI7esG22W5srXRdwkBSqM1QOJC5MX5nLnpHjevDg/tsfZRLs98TKz8I+kaOAryJF3kQBsJpeiWdcKkXdkA1RguHIfK8qPgTB+DO3tyiKsdpNHZE8K9HF9IS6XUXU7dwzxnDMhKmgiiQXOHX/jNIG24yoiGaLxdbMWUBKn8CRiV02UnQq/UbjFTb1khN4ZmvRYjvvl/hSMH5utnOXaY2Ly2UEGaMNLODJaBzpsG2O/nc4guZEhjlm6cq3X5PA==; 31:5pWlPQtW1ngHQJ1GRiMSjYcuHRkPOxPFj1TWfy3TssypXimbKTTKkIFCqOxHAiQrYIvZmjFLq+bl3tLkysPri9bngBFET/K25jEr1gNxbzdYm/6TDTvDBYeguhQrpf2vWVGluiu4ouQbJe62nRhmknBq/p8d2Gd/5QZW48SV3odcOBpSYl0cDdTmxo9PaeXyuZ9kAWLCyJIBGNONzGLcLaEcmbfH3gxYuG97bipvN9o= X-MS-TrafficTypeDiagnostic: AM2PR04MB0755: X-Microsoft-Exchange-Diagnostics: 1; AM2PR04MB0755; 20:vaEc6Fh3WRbAvvIicSysKTr2Dk1Zd40vqlQvOctrxtEBgDsHVxSw9+q1BF/O7KBhGLrz8SPepeoZdsatXZiyOQdapQfByS7dt9AQTOGGGFBmmgUixNU9lAWb8kPeNYgsi8vmPNQmcXy3hsvr5iSXr+O82pTyHc2T2gP9K4+7Q77POEycvegFv0h+Xuav44qtlTVfQtAw4QdQD+cGFBqcM5xaSQR4Fl4xYBAH2i6+f6Z9jSAm2axwtk2u8qkDek9KroPzf1HgtbUupkJYerWciQOnPvHeSAWK3co4x2cUA1gukld1mJHWyj++HlIhv6ln6NIUJqoVHeXsnTh1vtweuuSdkzRJ38aCUrDoR9tOuyGnB7pkmTSfoNK329maFk37N6PV5ViZBA5+16owpWoXSc/LojxqsyHMD2B3vEMt8XySH63nj/a4RpqA5SGukyCN/cIEGetbTmHeRwBeEiU+IRCxf0McDmP3xVvjwEoC93aE0qpzJ9oaIqMmKUrT3Ag4; 4:MMFnY+hP+9EskAA5ihGZwqOS3QkXuNlC2UbNEegt1VOCJo8AII8UzcPKM7vD2D93rJWM189Ga2X7tGAF9lyGoKoED8IwNSBlylAOR0qjAMqCnFsHfaRJIlAWHebVYTRTjfdv+ehp5c8/ZY4rhMZAPxmcLcrnpghCyEVVYOvXLNVf56g7aQbp52jn8efwNYGD3gXPZEZMMyashmQK6B4osJT6ymm1Wc6jCBThONsGEiM/k0aqOr9VpUQMzOGNrof/p5NhU44SKQWtoqhnF0WDF8g5oR7kGh3bEZEy6ddfJfe+EVJehDEHKzVD3l3oTV3V 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)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM2PR04MB0755; BCL:0; PCL:0; RULEID:; SRVR:AM2PR04MB0755; X-Forefront-PRVS: 0725D9E8D0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(366004)(136003)(396003)(39860400002)(199004)(189003)(6512007)(48376002)(5660300001)(68736007)(36756003)(8936002)(50466002)(305945005)(47776003)(7736002)(2361001)(8676002)(2351001)(52116002)(316002)(81166006)(81156014)(386003)(53936002)(26005)(55236004)(6506007)(97736004)(51416003)(50226002)(186003)(16586007)(14444005)(16526019)(6916009)(76176011)(478600001)(105586002)(86362001)(575784001)(66066001)(956004)(2616005)(5009440100003)(476003)(6116002)(446003)(486006)(11346002)(6486002)(25786009)(2906002)(44832011)(3846002)(106356001)(4326008)(110426005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM2PR04MB0755; H:bf-netperf1.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM2PR04MB0755; 23:EQyoY3TxuRMHtcvqSX51E7XOK4xjwAxSPYD5lUynk?= rd37AFEMWsAg5bicRGkHUpro2s263drOKjcs3wlxkJQItAz69ggeXlq6SEx5+oQClJcK9fxHpA8N8HBLMwvFMfV2lI1rTXB6tyKf1bAVOGR7K1Zu7a/3t/vkG+G5qlybyOnKiL73Uu8JGA8rj7aoVDppvSBKO3hVk4odXaao0GoQaGtifuQnVNqulHPnO3Vv2RGyMoZ9bi1TiOzJWRtbDrlIKXg/xTlMO/fnyfmvPU+MOdeTlleTyM4KTmkHxrIMACuPvunum0uyZkdaq4pMtnFWqC2WuRVnU10V7zLsO8rN2m7oqMZKHjJ5H+kgEmOAvjFl5IGUWWCD12I1q9oo8394DpN0UU5POeH8ESod0ML02GdkkStrG+vQ42ZnAphXBzlPLiwtRxskL1GPMkPiH/L2r3Zghf11yvpS8pie/kCBycnq++Q6tXD3nq5ntcv6YRsXN/R95j4LhHo7Jk52TIsgI3Fu7AyPmASU6kK8qZQ5YhA6i8ISaWLKSgsT/8F4B6tEY1tgMpzn6vC+NYfe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DbKDDoLU1RehzPM/iWtTChPqpHrck8tNeOpgHmiNAoCC1M3ztiZhvZZka8Tbogh7ecorffUvMlx+TeqEbCdpszmhVmkrYLPWJAvyiezPJ4ZaEmG+/Zu7FCVOPddu+/5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2018 08:12:15.2464 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4db23da7-b092-4d8a-f27e-08d5e3182fab X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM2PR04MB0755 Subject: [dpdk-dev] [PATCH v3 16/16] 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 Acked-by: Shreyansh Jain --- drivers/net/dpaa/dpaa_ethdev.c | 75 +++++++++++++++++++++++++++++++++++++----- drivers/net/dpaa/dpaa_ethdev.h | 3 +- drivers/net/dpaa/dpaa_rxtx.c | 4 +-- drivers/net/dpaa/dpaa_rxtx.h | 2 -- 4 files changed, 70 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 5c0aafb..c49d3a5 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; @@ -196,13 +215,24 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { if (dev->data->dev_conf.rxmode.max_rx_pkt_len <= DPAA_MAX_RX_PKT_LEN) { + DPAA_PMD_DEBUG("enabling jumbo"); fman_if_set_maxfrm(dpaa_intf->fif, dev->data->dev_conf.rxmode.max_rx_pkt_len); - return 0; + dev->data->mtu = + dev->data->dev_conf.rxmode.max_rx_pkt_len - + ETHER_HDR_LEN - ETHER_CRC_LEN - VLAN_TAG_SIZE; } else { - return -1; + DPAA_PMD_ERR("enabling jumbo err conf max len=%d " + "supported is %d", + dev->data->dev_conf.rxmode.max_rx_pkt_len, + DPAA_MAX_RX_PKT_LEN); } } + if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { + DPAA_PMD_DEBUG("enabling scatter mode"); + fman_if_set_sg(dpaa_intf->fif, 1); + dev->data->scattered_rx = 1; + } return 0; } @@ -300,7 +330,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; @@ -514,6 +543,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(); @@ -527,6 +557,27 @@ 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.enable_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; @@ -553,10 +604,13 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, fman_if_set_bp(dpaa_intf->fif, mp->size, dpaa_intf->bp_info->bpid, bp_size); dpaa_intf->valid = 1; - DPAA_PMD_INFO("if =%s - fd_offset = %d offset = %d", - dpaa_intf->name, fd_offset, - fman_if_get_fdoff(dpaa_intf->fif)); + DPAA_PMD_DEBUG("if:%s fd_offset = %d offset = %d", + 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++; @@ -1304,6 +1358,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 c79b9f8..1e7a656 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..6e96a80 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); 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 /**