From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0065.outbound.protection.outlook.com [104.47.32.65]) by dpdk.org (Postfix) with ESMTP id 7F28F594E for ; Tue, 5 Jul 2016 14:50:27 +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=HFcOtkL43HZp0qx7eaXTHayLk7U9cTORYyajAzUDv7U=; b=Hv1wqexBQb2oAIYR4SU9xEfDYbbtrHwU8BftxIxked8k37afnG78KLZNDdmlbdPacl4ZemFuVqUzpZjnuuZkR65ytAp5O025KMG2yqOs8gIfibk/zTqRSS95mo56MIM4p2UdzBMu7Ygx+Lqc+l47RckVT8P6VQbMMOw/yIoN/lI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jerin.Jacob@cavium.com; Received: from localhost.localdomain.com (111.93.218.67) by BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) with Microsoft SMTP Server (TLS) id 15.1.534.14; Tue, 5 Jul 2016 12:50:23 +0000 From: Jerin Jacob To: CC: , , , , , Jerin Jacob Date: Tue, 5 Jul 2016 18:19:25 +0530 Message-ID: <1467722966-2572-4-git-send-email-jerin.jacob@caviumnetworks.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1467722966-2572-1-git-send-email-jerin.jacob@caviumnetworks.com> References: <1467371814-26754-1-git-send-email-jerin.jacob@caviumnetworks.com> <1467722966-2572-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: MAXPR01CA0020.INDPRD01.PROD.OUTLOOK.COM (10.164.147.27) To BLUPR0701MB1716.namprd07.prod.outlook.com (10.163.85.142) X-MS-Office365-Filtering-Correlation-Id: cac53c0f-d267-4e82-e7f0-08d3a4d2efdc X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 2:TcQNaZ81moyW/BHeNTW8DaLz1TDws3aBbfBeXj43YwV9gLnJ3kOdFh7VmzBhXiNiZ5SoanfLzSatFMNjwI18PK+K6iX5KhIQcJqo8KPVClZC/kjkETCrOmGY/GcrX3Diq8JtXR8gYGTk518r9fvTUPxI/KxyI576i4WkaXnwijGbvGtrVPLETqopnHLO1ZYV; 3:bIK5rEf41tHEF96yLRKiRj19MTlYZq1Bjb7sftzF3ZlqZfXz5d8EHZstujsWw2JFqkgU+YugIjjZ5FOTjGnWdXThlCVSdlUIKLptH3oiEvfg0oF3ZodqU5U3Yrvx+bwp X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 25:FIjtN9YP+PNuW94wtumVyHzVsVQ6pA8sPouwD1VsnzGT/+MgdK+ESVTXxTJh2TvucAXSxoQWNXZpl5RE+rbphcR4vB5WY+fFtnzK3agHcnN9OC3XE7EBFZKCs1kHwNpXE15k9POsVZQMSh7GYzM3DHefg5+4xUREJoJ3jFNAtIQnqd9GovnLk40yESYOi/h9PB3KStKeH6XxISUbIjXzmJYhdESBdPmYiKEwqM7T91blCpvoFHAVfM6Yshao00kZXGn8A3P05gH+NgrGykRT+KnkiAkOVKimIlQp7BFlTpK9r+KAS7U4VRiWz+x7Pw1sDQNo9t6Ulvb8AvO4hMAkzamfX2ZVmlB7pgtYCUQTBFtCDbXhgdYnmtYWzkGCZCkbXJQqGEvSy3PmF5+bp/Z7SSqAnoE1wXBS58+kHKthUGXA5WbzeUrHYbD4zP2B7WZwn52DemtTTprhxFXoEyA9led21Y3BkNjLdBEi5GgTf/fSlG2arym3NwuKptV04oPxuZ6CBxSYQPFExJxtH14v2k18lDpcaZCpzKcX/FFOSHC64OP0biIYYKAKEM6hKHvyNypDXICCv9V8H6TPXBqj2OhxJvN7WJ1WmMLliF4zYWd3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test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:BLUPR0701MB1716; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0701MB1716; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0701MB1716; 4:vuVbS77yRkBR9fq3J7XGvLG2bsYWt8bgkgOZm7WdyxSe2jIG8Ofc5SctV0cb7j2rpX3r6c5XMcheNxM+SkiRTH695CgyXqBB4dQAO4GLOqd4aAe42GZ1fZf4itF1LheL73oNq1mRfU9Eo6vmADjVvCd3O5B7bYYLbZZ6t8iR71UkLlNtXo36jH1qY1U+vdetg8REhnu0JRFtAV/9/CdbWG1se3Xy0EqPkg9JvBl+tMdm+AkN3UqAXHdRvA8lb4aMLi6xThnUIMjODNYS/jVXAprtJJXpGm18H69RdmvGSV9XpKyK41vtwjljnbxQM8qPUxhBNXuZrkWlsGFXIa0B5+n2kR3NDq3cms9eJ6GQM+kgnEnOKsv2X6JKi0wGHPjs X-Forefront-PRVS: 0994F5E0C5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(199003)(189002)(305945005)(7846002)(101416001)(7736002)(19580395003)(107886002)(97736004)(19580405001)(189998001)(69596002)(110136002)(68736007)(50226002)(42186005)(92566002)(53416004)(48376002)(4001430100002)(2950100001)(50466002)(33646002)(76176999)(5009440100003)(81156014)(8676002)(81166006)(586003)(47776003)(105586002)(2351001)(5003940100001)(229853001)(106356001)(4326007)(6116002)(3846002)(66066001)(36756003)(77096005)(50986999)(2906002)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0701MB1716; H:localhost.localdomain.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BLUPR0701MB1716; 23:Hyg4YU/aOy4p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+NajmZZLB2L2WkxjsATT4hAFF3KF5yqofkjgtCa4CSZpGnxYm3H6OntO+9QNfWgO/5Td+mVIRHJWMwltXEkpeIIpRkULTkzGW1SOUEzLicLFoeWWwEBVYZT4ApM5ACyvJYoYvyFMDmFxiKNdl9mdBUqHtKooWZGYQ8CprpUb272srnYGGZvIDFaB2LB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2016 12:50:23.1372 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0701MB1716 Subject: [dpdk-dev] [PATCH v3 3/4] virtio: add cpuflag based vector handler selection 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, 05 Jul 2016 12:50:28 -0000 Introduced cpuflag based run-time detection to select the SSE based simple Rx handler Signed-off-by: Jerin Jacob --- drivers/net/virtio/virtio_rxtx.c | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index e707954..adc3457 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -50,6 +50,7 @@ #include #include #include +#include #include "virtio_logs.h" #include "virtio_ethdev.h" @@ -470,6 +471,28 @@ virtio_dev_rx_queue_release(void *rxq) rte_memzone_free(mz); } +static void +virtio_update_rxtx_handler(struct rte_eth_dev *dev, + const struct rte_eth_txconf *tx_conf) +{ + uint8_t use_simple_rxtx = 0; + struct virtio_hw *hw = dev->data->dev_private; + +#if defined RTE_ARCH_X86 + if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SSE3)) + use_simple_rxtx = 1; +#endif + /* Use simple rx/tx func if single segment and no offloads */ + if (use_simple_rxtx && + (tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) == VIRTIO_SIMPLE_FLAGS && + !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { + PMD_INIT_LOG(INFO, "Using simple rx/tx path"); + dev->tx_pkt_burst = virtio_xmit_pkts_simple; + dev->rx_pkt_burst = virtio_recv_pkts_vec; + hw->use_simple_rxtx = use_simple_rxtx; + } +} + /* * struct rte_eth_dev *dev: Used to update dev * uint16_t nb_desc: Defaults to values read from config space @@ -485,10 +508,6 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf) { uint8_t vtpci_queue_idx = 2 * queue_idx + VTNET_SQ_TQ_QUEUE_IDX; - -#ifdef RTE_MACHINE_CPUFLAG_SSSE3 - struct virtio_hw *hw = dev->data->dev_private; -#endif struct virtnet_tx *txvq; struct virtqueue *vq; uint16_t tx_free_thresh; @@ -502,16 +521,7 @@ virtio_dev_tx_queue_setup(struct rte_eth_dev *dev, return -EINVAL; } -#ifdef RTE_MACHINE_CPUFLAG_SSSE3 - /* Use simple rx/tx func if single segment and no offloads */ - if ((tx_conf->txq_flags & VIRTIO_SIMPLE_FLAGS) == VIRTIO_SIMPLE_FLAGS && - !vtpci_with_feature(hw, VIRTIO_NET_F_MRG_RXBUF)) { - PMD_INIT_LOG(INFO, "Using simple rx/tx path"); - dev->tx_pkt_burst = virtio_xmit_pkts_simple; - dev->rx_pkt_burst = virtio_recv_pkts_vec; - hw->use_simple_rxtx = 1; - } -#endif + virtio_update_rxtx_handler(dev, tx_conf); ret = virtio_dev_queue_setup(dev, VTNET_TQ, queue_idx, vtpci_queue_idx, nb_desc, socket_id, (void **)&txvq); -- 2.5.5