From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2on0090.outbound.protection.outlook.com [65.55.169.90]) by dpdk.org (Postfix) with ESMTP id BB84C6883 for ; Sun, 29 May 2016 18:55:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=FYbSCbwZcJtEetYKhWa6YMhusnycPzEPXg1+VLXFG1o=; b=W07ObXbBM+xLI2+hQj6U0KxNG2Mz1b8mZIFuAM4XYz09UJgjrhR1izDr6Bbfw+lVPrd2byxs7bMayqHJ+mXUgxHTnfknAiEagMMjGnNw79H9DNqv5F+zX/gXHfn3di8NNC6mJhscPPM73KGYc52fFhEWg8QJhvto7RvsbMa3SnY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost.localdomain.localdomain (122.167.187.184) by BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) with Microsoft SMTP Server (TLS) id 15.1.501.7; Sun, 29 May 2016 16:55:18 +0000 From: Jerin Jacob To: CC: , , , Jerin Jacob , Maciej Czekaj , Kamil Rytarowski , Zyta Szpak , Slawomir Rosek , Radoslaw Biernacki Date: Sun, 29 May 2016 22:24:21 +0530 Message-ID: <1464540867-13115-4-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464540867-13115-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1462634198-2289-1-git-send-email-jerin.jacob@caviumnetworks.com> <1464540867-13115-1-git-send-email-jerin.jacob@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [122.167.187.184] X-ClientProxiedBy: PN1PR01CA0029.INDPRD01.PROD.OUTLOOK.COM (10.164.137.36) To BY1PR0701MB1722.namprd07.prod.outlook.com (10.162.111.141) X-MS-Office365-Filtering-Correlation-Id: 082fc8f8-4ea9-4a34-efc4-08d387e20626 X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 2:ji1DxotLLLcTOQaXuBrIOjeYogOmMMTmbpOcuguaXKM+ay/BoDd1lcID7VhkHfdrTDpEjHvJMxGbdOrdH5fzx2KjG5DQGMkiYWpllCFMQDMRPgD+7pR4fuPBaiEhT8Hdr9Shgwstfjs8OEq3mQPgVy8GHzh5/gi1zyrkFZf3uiZGlF1kGecHEH5UF6LhMWt/; 3:JtKblHECteJ9snnPw5zxh7+8toj7fAmqtkC2a2NrEOe9BqggaBSPJExL/7LCglzix+CANiJN9lTiUSHy/8oem0SVZon/HlbLNfNr6O8XEZKIy1Z/fpwsgdnWfVV/mooP; 25:i0XdlNQ4trOKPh++9bbNxzQCmrnTWV5Jl86VdYrA7x746TTEIggzb35SFgzfRzBQIAcQex5qEypPYyPHHu7pxdtipoBchfoLNVvNKGBC6U7KLwu4i1KqXlm5LHFcfZG0SvRL7fFPW3AIdLXN0Q+K3ediu6KZejEBM84Uq5zDpx0Q39HFGZg8/KTXcBx6QJOxwTwvHJ0MjSH5eHVjQoCWtuYUAqouDPg5Na8bEaxqF9RW3yOrzlxPEkBSY74UoBIQ7M5KjSgCugpx38fFX1hCslkkWiAiWXV6CRshn9TcoB8vTvH//uKakpY91LoXHN3skHsmptT7t1qDvuNtQh/PxIdE8mJRUY0sk8s2QYQBZbYxInlw4mFO+jSlDug5fW3lNfbJrBQG8szgWgJ0UGfcaNoUxTjEPJL7Npv+qwvIgO0= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 20:5WMPg3+x2PVlsgSPlnzNQRu62IPrx/AYGloIGRjYjjGQvve/BhZmIRJ6vb4/Sjd/UhlmAjFBLHDmepJMjcBrtjirS1b6F3HXmkCAMS/NISeQyqet86ToU1FhgJ56/oufV2d0rPmt+dGMOweFFjZyHx/1PlvwkXPgEMx6vBAxnYk4PktPFFTBoIrU26tdsy4KlIJnfxRtlY34T9/XMDUQAD8UtfRTBv5TR4hzJNeX+cfLkGVHdUDFrp9IItwZPH0cvZpeO9N6yPENjnmF+vjkub0T6QRUylJ6blU9BxxZW8yMjhmKc8k85d/nCLSbmcYYup+M4XAWWjMdcYR2heML5Ioj0VwUjlmSrZzMSypCsai+gLvyXnWGYKi49l5CbFRQw+JMHFCdf+IgK9KE51I7wsFqZZKLzqQXgA6Cutso38rN5m/nuPj7ORobq1rGVQpIrmYXnsqQHjUUJvauDWjgkTwOLUiifuoGM2qsR2KP/MTH4vh/T+wbGcT+nDmMwBeWzDB0lU75HBjjh0lmXTKIE19/OGaFBtrBgJ+Txqc5hnrehrIm0qLcArUu13EGDyKypJ5ZZdMzzBkCVzD0VWLoXUWIlKKlRBDd9yhBnxXXKgQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BY1PR0701MB1722; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1722; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 4:WRNq0kneqekE2cqpmhUVTZZaXdXKlQG/4DFZMbKZDuUg1dwK4DtVqSia5ohfVCqW5hZlNCSzYnnSoF2NK5xqxVBp/QPr/mgRKJSncR5G/yCp3lRbaCtBlGTQXxzRmz8/CuryeyB1hcRq6fDHfK88KyV5rpe/BFLE/qJbXcpgqDE2daW0vWzUdp7MibOBJ+8RXH4QPZw+lMGVy7aXMVrsgONJz+TPyj33jQ3gxEUXceuf6N8pTUn5SL7RTiutn6GTtShL8v+FAX4P1NYtOC1CsWNjr4rmfN6EsU2Bm/vRy+lwQPJaXL9b04mjPvYmoN9ppnJxjWV8p/uiuRnPiQ1kFGtEwICvRoqhrPhzdI4O4QK8j9Qmu9Y95HHeGbsBCQMb X-Forefront-PRVS: 0957AD37A0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(33646002)(42186005)(50466002)(92566002)(50226002)(229853001)(2351001)(5003940100001)(189998001)(2950100001)(110136002)(77096005)(36756003)(47776003)(5004730100002)(48376002)(575784001)(2906002)(586003)(8676002)(5008740100001)(19580395003)(66066001)(4326007)(76176999)(81166006)(3846002)(6116002)(50986999)(19580405001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1722; H:localhost.localdomain.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 23:2hFC3tjC4qUAKVt2v1yzPYuj+B5eD2HcuywoR1bRIRN9ntCsBvDiXtA4BGV5StX7oVq8yqjWNVoW8DdNo46EKU4V8+QwEJ26vHF1K5HcEmJodxvgO18xlJao4yX1/S8CBB5CXHfQKsMmBJrEsE7czD7L9IXEO2fjZlknEmi1LQQ2BxlnKBSKiNKlAythpXEkNXW9zZvYXFASvxnK4J8pvjjvCSm4kYlzxEOPzVLYwIhgg3k8b1igVOp6lYyLef7lS/7wCFZ1SK2SPq72DSiM5HATyxJCn6inAbQw9U4aTuKQbY7HRI0cy8CgNsBmFJGIPfTjrBJv9VhVJg5WeXE2Q0TtUxYjhheRH1eK1hgLpHngW6CdQ5wtPYD6zZ3DJ7UnhtiaMOaT+DxcrVWXqzMfYh8f5eOeCN23q+0a7tehrDaVbMDOMhiQThO4KCVBvhPtrB5zdv7ASSJ4J12+SXmQAU53Ny5+lP8ZYhSy16rwPL+Y0VPT4dpfIZ9xMqf0zHi00G6zsiHbSGScAwmj322lp575KKmjpIOSQ1hWuTJstJRvi+ZgjnBg3TELtkO0vtnuvUCgF1PcyQs0u0DD4SY9ndjSHMzWd4pDHyGvHqUssew2fILBHw3Bl+0bdp5VXY4uGlgWaWqAvsnpS3JfFPSX5tsvIydgJdMEuzeHz229VbslMUdko6+vwL+UdCh8k98HILdv6XV2xCORfEdOCf+JB/XYdZU+Iwq3cVAa05p0K9PjAANSlH1Y8NzX43JRg2hOo+SBfWC/MhA1JodEK2lzKLt94G9Y4UGwEz32TSqxMbNJcKTDEFRRu/CJNcpYPyphIFsSfZvolGNWncm/oAksU28KYumoKMwolwM2+O60M0cqESQL7ddvzqw/1OCg1yaomaTYX+go7D/9nlEIsksS5Q== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1722; 5:7gvNlz5ZkrMPJjcv2FDTVKYUf4JeChuO9z1Bdp6u5aAv1tyrfim3AfT0TSMf66s+rv4VUqJ7/azvRxkT+Y8N4bKNq9EuQWPdP1SZKraUgr4Zpcmqdtgc3U5/a5JdgTZhQ0RUKWq0ku9jNl/jSefZtg==; 24:sIHy6Hrclrqc+AmTtqj03nplmTXZpP2uKbc8gizjRi/878HPyZCZkLOMcsf5O+SgZ4LvxxDNNoob5GeYjUUJC6YymhJwafQSBfYVklFMhZc=; 7:gpyZMhMC4mHddQ/9XBNEGVjKXXJg4tjeX/G6EFbiu4Kmeg3AL5+1uE4eqJP33FKjxfPEKfIABd2nGSU92j+wyMW4diSmcccAEzUl7iryoS4accRN+qhnwA9FkK9Xcfzmq+FIxj3vd/1PUvLyi0i7Z4I70wKanDhDp8cz2t8PEJSmw+VCICb5GQb2GHiHibcG SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 May 2016 16:55:18.9944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1722 Subject: [dpdk-dev] [PATCH v2 14/20] thunderx/nicvf: add dev_supported_ptypes_get and rx_queue_count support 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: Sun, 29 May 2016 16:55:24 -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 4c53cb9..56e0b5c 100644 --- a/drivers/net/thunderx/nicvf_ethdev.c +++ b/drivers/net/thunderx/nicvf_ethdev.c @@ -314,6 +314,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) { @@ -942,6 +981,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, @@ -949,6 +989,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 80c0018..8031685 100644 --- a/drivers/net/thunderx/nicvf_rxtx.c +++ b/drivers/net/thunderx/nicvf_rxtx.c @@ -571,3 +571,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 = (struct nicvf_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 1e355b6..44cef06 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