From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0087.outbound.protection.outlook.com [207.46.100.87]) by dpdk.org (Postfix) with ESMTP id 2B3DB9AC9 for ; Tue, 14 Jun 2016 21:08:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=L05nR9KKPJuzzjLDqRZiDgYZgAfs0tlUP4G6b6sM+98=; b=mjkHtfpehtTSE1ViGfclfQYpmm/gRS2/kbG2aNWOgsylp7dHS4yoq27P3rPMFIynftEvLjaX4yvxjSwPgkm8KKw3cVZBhektm8pzEMZaLvk6oIbnrld3cv4r3fwEGkGzyLru3Xf1DfvLuNIhdAf5672I7HnpEPuhTQVIZrJ/8YA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.caveonetworks.com (111.93.218.67) by BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) with Microsoft SMTP Server (TLS) id 15.1.511.8; Tue, 14 Jun 2016 19:08:24 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Wed, 15 Jun 2016 00:36:35 +0530 Message-ID: <1465931200-23912-21-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1465826143-22159-1-git-send-email-jerin.jacob@caviumnetworks.com> <1465931200-23912-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0040.INDPRD01.PROD.OUTLOOK.COM (10.164.116.140) To BY1PR0701MB1723.namprd07.prod.outlook.com (10.162.111.142) X-MS-Office365-Filtering-Correlation-Id: 2241e67f-d03d-4db7-d108-08d39487441c X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 2:wfCpNoHDprg//9uU8gcEVQHOcznPzPuCJeHdbU7kgZEjtFUuvmsQKaSwFehk8j6qDpO65cl3MKC0x7sNVjmEPiyTi3m0Lh7WMdwoAecT/iwJHC0RF4mZvSok94QfwhGyJhPDDflhLiPVz3sCjTXzzMuSA5xEqgnUYqpXjJt/YwBRUNzBjP0aulbWmsFB27U4; 3:D1CLc9hEGSmzcw3CPep6V1RY7U07AR8UhUnxcs65ay6n8CTm7vMI2VQqlQoRGCRPkzsRrip3vUp5k+55l3j5lPz8hVxf9oXzH1gPl5yTVIP3naFf9Au5OZn1QOs0v+EH X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 25:/D0UEB25l+1ljG0MLv0xaRqyjRLWv9bkuLDX3DHghBONt+n1zWV5SGnQ24955pYDIKhQDMDxf2IcZc19bOoGUdVTMbkQCns5DhB9JyBcVeOefGxzYIFF4SjmzJuc1lRw6tEm5q8KM+G+yae4TedeP/Z6+H5Q3cj9wpxPl5AD/Zt9c5m71Z8BfVP96L8uvCkOP4UNtTWG8FlPsI3eNvBXyQ9JsHDJOpCHyHFYH0PpkmVdHrBOJKyGvaPu1eEj9dNX747sHBHMZ7BCa77MjVcvCBsiN3sTNfi3JjkXWDk+QxU4/Fn/5/st4dQQefC3VQapEj8tmDQHuaIWRH07/rE4KcQVg4lDB2uC+iBwILhA7Sj97x82RXstAAGvxWKbgXUilr0rBFNQZic1Lu31U7maseXnvlP5MaA2pTlYba8lRpwVRKNb/MdKwlS503d6HCf2qFMKAgmErpD9b9rVNIGImQBX3R6l2ekEhxYEuL+BUFZyfyqouTQLC4RX8POPZy0u6et3G0FFUpKNq59CmZXs5t7udURq/ZxKaY4MZ5wT4uiytDbZ7R/+q5M98U2Vdjtt7YwrJmwMLFZJQ/LykmoBBjIU/ul4EJVSbygp/NJCZUkxvQpSJQI8Wvz46Pld384XgWWq9QbNQlRCGbKCaxk+nwR0P97PuPsAqYrQ0XqzKJhPyg9JYyBjqFWFLIbQK/V5cO7Dcq+5hVR1/iZ/4mUV2+hsxxDRt4SVOQAJvVsyea6O2KhKhBxf4zacYOOoKqDC X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 20:0DwEByACz9sEKYdJITPgjm8u10xXw0eDWHC71mOecZUZApohJT3flW2d6zQx8wwjJTlXqIuATpPnE/ny+uu1Pr0myRzmXvoXcK7q0Oi+PL/aJI5koChCQ2sIhonW1f5oRP7NtcF/OMXlCZvo9qOcdraWQnxq+jIF7V0tcbtj/YcA5znD7m8BP7VlpyFGCIyF3pV5KeQruLUFMkoydQrWw9/vh7hrK+jWN+oLtdv7uQ6oKdt3ygKHXdOhdXFWKDEBNdRhggKJCx/F2YLuxzI9lK+FP1KBydN24QDf4dS2vzm2l7ROARi1YkQURCKJyDzDxYeSce6c0CBB5A9xDRwZyhSG30U3k8IW0B0AHf52v2xFJVR1jkVBK2MpKGV2jAtLBXqF3hn96Lu5Th7U+zEajn9tQ5Vq7Xk2bEfM8cvBNM7kK1KprkpOTwhiiNR6so+gIeIE4s+KymlHCQJH42lbo7GQBIVMAaJcVM/DpTspMc+I/1sFc73icxdmhTuBPJ5X87v993Zr+c/ciw9USqTsxvy5wUm5bgLLBXgiC4XI+eHd9H1MliQ8hoCD0rEONW05yWmzPti2qcn+yIShpb1SPIhdZPogL5D0a1qQAvQlNqA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BY1PR0701MB1723; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1723; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 4:PPTAMfvGGZuf+pL8mhOeBzKmCPZFxT+HnXJNt/V4YmCC05SjZsLK8r5SOWsBya+moIeUb7SWmWVflQnvWmBpx36BLmctbSNXYwsyIDYiSq7+jF8tnaDbZLH5LWr0y5CK62mJxOS0shPp5VMxPHu8cpKmpV2cKXmBX2u8cM+clLJ0pHGrSpDKPhLIRRrt4lanF3HNUwwMb2QJkPH9VRqXCr/liPsjCgTBHG4qH2YcsZhs+3g3HRqNXMOueqTxqd5Nk36iruRBh+B/e/7KQMxvvjs0jH1sTo/B3U98tV96oa9RhiU/OcrrTHteUStqBacuip1/k9IsLXhJ1N8A5mncIhnmTskbg/IasTxw6WYDNM1NY52XeDKjX7k6hknJawlY X-Forefront-PRVS: 09730BD177 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(69596002)(189998001)(2950100001)(48376002)(77096005)(36756003)(19580405001)(5004730100002)(19580395003)(76176999)(5009440100003)(50986999)(97736004)(5003940100001)(68736007)(110136002)(92566002)(101416001)(5008740100001)(81166006)(8676002)(229853001)(81156014)(66066001)(4326007)(50466002)(2906002)(105586002)(106356001)(2351001)(47776003)(53416004)(76506005)(42186005)(33646002)(586003)(3846002)(6116002)(50226002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1723; H:localhost.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY1PR0701MB1723; 23:ameR0Sjy7zULfIBoQrNwXd/14su1xrI1dfswsaC?= =?us-ascii?Q?Oonrg9drW/8XiOfBiEbmMR5J6bvOwKS/EPJylCeDuGOnGx8lMzq/GKGf1MzP?= =?us-ascii?Q?Iewi/Pn4dPjfJpl8tdC99yIaE/33MBc1K+5giKUDf6f8Cn9kMNSXInQyks+C?= =?us-ascii?Q?hJB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/3+7ZGinLExFOb6?= =?us-ascii?Q?JSGrKUXgtpSh96LG0XEpKLsOOBUQXoWN+kspfz5ONiDrtbP6kIOuMaTE5O2I?= =?us-ascii?Q?ISYMUx8hJCZfYu6qdNS54PfFEfZLnadG/7s1WX4A8RwYObcHeI4jXV60is5u?= =?us-ascii?Q?Jl1Cw6tdkRZVtFUc=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1723; 5:qJbh+mCilgUvNJ5sPjSKMmh93gp8ARSkb7GNkdPZivrbIgpfBqBZ87fjbX70/HRU0Z0aX7DNToDzSl+JkjvrJT8EOirzCAG21VmHIY6W7ObzSLa3OdqRckZlzeG6cjcSHbW/XazzHgRDRdt3awtXFw==; 24:oJ+wMmEBNNVtXyQSdtJf2bv8yZM8LH2/yoONF3sxyMfTBc9an9544CAn+ILhrJasGYWA7IIbe4LrMg6gguhC10yXWtwLJUZBA2Mv+iKV8MY=; 7:DlKioU0koDSwOUIoxuxModYW/CawfumcVgdlMhXvaqBsCQpMg83K2GfQtGLSuZNp+8Jib7agOtmkuEN0EfjoHm/VxIDuxJkvJ6Dc3lOxlQ7LF1AYUc5sN7iWdcIN2BVG2FAcAvdMs4B0gwAy/V95Kz24U06SnRyoJyR3KNWjK4Yhbci++3de0T0PJ7LjZgK9d9pvWI4UoeAEcLv9lRSdiw== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jun 2016 19:08:24.7512 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1723 Subject: [dpdk-dev] [PATCH v5 20/25] net/thunderx: implement supported ptype get and Rx queue count X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Jun 2016 19:08:29 -0000 Signed-off-by: Jerin Jacob Signed-off-by: Maciej Czekaj Signed-off-by: Kamil Rytarowski Signed-off-by: Zyta Szpak Signed-off-by: Slawomir Rosek Signed-off-by: Radoslaw Biernacki --- drivers/net/thunderx/nicvf_ethdev.c | 41 +++++++++++++++++++++++++++++++++++++ drivers/net/thunderx/nicvf_rxtx.c | 9 ++++++++ drivers/net/thunderx/nicvf_rxtx.h | 2 ++ 3 files changed, 52 insertions(+) diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c index 15f5cfc..8b8d9d9 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -260,6 +260,45 @@ nicvf_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) stats->oerrors = port_stats.tx_drops; } +static const uint32_t * +nicvf_dev_supported_ptypes_get(struct rte_eth_dev *dev) +{ + size_t copied; + static uint32_t ptypes[32]; + struct nicvf *nic = nicvf_pmd_priv(dev); + static const uint32_t ptypes_pass1[] = { + RTE_PTYPE_L3_IPV4, + RTE_PTYPE_L3_IPV4_EXT, + RTE_PTYPE_L3_IPV6, + RTE_PTYPE_L3_IPV6_EXT, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_L4_FRAG, + }; + static const uint32_t ptypes_pass2[] = { + RTE_PTYPE_TUNNEL_GRE, + RTE_PTYPE_TUNNEL_GENEVE, + RTE_PTYPE_TUNNEL_VXLAN, + RTE_PTYPE_TUNNEL_NVGRE, + }; + static const uint32_t ptypes_end = RTE_PTYPE_UNKNOWN; + + copied = sizeof(ptypes_pass1); + memcpy(ptypes, ptypes_pass1, copied); + if (nicvf_hw_version(nic) == NICVF_PASS2) { + memcpy((char *)ptypes + copied, ptypes_pass2, + sizeof(ptypes_pass2)); + copied += sizeof(ptypes_pass2); + } + + memcpy((char *)ptypes + copied, &ptypes_end, sizeof(ptypes_end)); + if (dev->rx_pkt_burst == nicvf_recv_pkts || + dev->rx_pkt_burst == nicvf_recv_pkts_multiseg) + return ptypes; + + return NULL; +} + static void nicvf_dev_stats_reset(struct rte_eth_dev *dev) { @@ -888,6 +927,7 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .stats_reset = nicvf_dev_stats_reset, .promiscuous_enable = nicvf_dev_promisc_enable, .dev_infos_get = nicvf_dev_info_get, + .dev_supported_ptypes_get = nicvf_dev_supported_ptypes_get, .mtu_set = nicvf_dev_set_mtu, .reta_update = nicvf_dev_reta_update, .reta_query = nicvf_dev_reta_query, @@ -895,6 +935,7 @@ static const struct eth_dev_ops nicvf_eth_dev_ops = { .rss_hash_conf_get = nicvf_dev_rss_hash_conf_get, .rx_queue_setup = nicvf_dev_rx_queue_setup, .rx_queue_release = nicvf_dev_rx_queue_release, + .rx_queue_count = nicvf_dev_rx_queue_count, .tx_queue_setup = nicvf_dev_tx_queue_setup, .tx_queue_release = nicvf_dev_tx_queue_release, .get_reg_length = nicvf_dev_get_reg_length, diff --git a/drivers/net/thunderx/nicvf_rxtx.c b/drivers/net/thunderx/nicvf_rxtx.c index fed0859..1c6d6a8 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -570,3 +570,12 @@ nicvf_recv_pkts_multiseg(void *rx_queue, struct rte_mbuf **rx_pkts, return to_process; } + +uint32_t +nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx) +{ + struct nicvf_rxq *rxq; + + rxq = dev->data->rx_queues[queue_idx]; + return nicvf_addr_read(rxq->cq_status) & NICVF_CQ_CQE_COUNT_MASK; +} diff --git a/drivers/net/thunderx/nicvf_rxtx.h b/drivers/net/thunderx/nicvf_rxtx.h index d2ca2c9..ded87f3 100644 --- a/drivers/net/thunderx/nicvf_rxtx.h +++ b/drivers/net/thunderx/nicvf_rxtx.h @@ -84,6 +84,8 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt) } #endif +uint32_t nicvf_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t queue_idx); + uint16_t nicvf_recv_pkts(void *rxq, struct rte_mbuf **rx_pkts, uint16_t pkts); uint16_t nicvf_recv_pkts_multiseg(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts); -- 2.5.5