From patchwork Mon Oct 9 09:09:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wenxu X-Patchwork-Id: 823128 X-Patchwork-Delegate: ian.stokes@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y9ZMY0V0Wz9tXF for ; Mon, 9 Oct 2017 20:15:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 64B74A88; Mon, 9 Oct 2017 09:14:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id BC52AA86 for ; Mon, 9 Oct 2017 09:14:57 +0000 (UTC) X-Greylist: delayed 00:05:45 by SQLgrey-1.7.6 Received: from m97138.mail.qiye.163.com (m97138.mail.qiye.163.com [220.181.97.138]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id 42E631AD for ; Mon, 9 Oct 2017 09:14:55 +0000 (UTC) Received: from localhost.localdomain (unknown [120.132.1.226]) by smtp9 (Coremail) with SMTP id u+CowABHdbCvPNtZ3v9RDg--.10S2; Mon, 09 Oct 2017 17:09:03 +0800 (CST) From: wenxu@ucloud.cn To: dev@openvswitch.org Date: Mon, 9 Oct 2017 17:09:02 +0800 Message-Id: <1507540142-9313-1-git-send-email-wenxu@ucloud.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: u+CowABHdbCvPNtZ3v9RDg--.10S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxCF17WF4xCF47uF4xCryUJrb_yoWrKw1xpa 95XanYyrn7Xr47Xryft3yxCr13Kr4xCr47G3ySv3WfXFyq9ws8Ar47WrW3uFy7Jr95Zw4r AFWDZF4vgw18uFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jsNVgUUUUU= X-Originating-IP: [120.132.1.226] X-CM-SenderInfo: xzhq53w6xfz0lxgou0/1tbiaw9sKFlZsxd7SQAAs2 X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] netdev-dpdk: New option 'hw_strip_crc' fields for DPDK interfaces X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: wenxu Some vf driver like i40evf can't disable the hw_strip_crc, with err 'dpdk|ERR|i40evf_dev_configure(): VF can't disable HW CRC Strip' so hw_strip_crc feature should can be configurable Signed-off-by: wenxu Signed-off-by: wenxu --- NEWS | 2 ++ lib/netdev-dpdk.c | 30 ++++++++++++++++++++++++++++++ vswitchd/vswitch.xml | 9 +++++++++ 3 files changed, 41 insertions(+) diff --git a/NEWS b/NEWS index a3c1a02..d913847 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ Post-v2.8.0 chassis "hostname" in addition to a chassis "name". - Linux kernel 4.13 * Add support for compiling OVS with the latest Linux 4.13 kernel + - DPDK: + * New option 'hw_strip_crc' fields for DPDK interfaces v2.8.0 - xx xxx xxxx --------------------- diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c60f46f..23c2a72 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -402,11 +402,15 @@ struct netdev_dpdk { int requested_n_rxq; int requested_rxq_size; int requested_txq_size; + bool requested_hw_strip_crc; /* Number of rx/tx descriptors for physical devices */ int rxq_size; int txq_size; + /*crc strip feature config*/ + bool hw_strip_crc; + /* Socket ID detected when vHost device is brought up */ int requested_socket_id; @@ -700,6 +704,7 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq) conf.rxmode.hw_ip_checksum = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) != 0; + conf.rxmode.hw_strip_crc = dev->hw_strip_crc; /* A device may report more queues than it makes available (this has * been observed for Intel xl710, which reserves some of them for * SRIOV): rte_eth_*_queue_setup will fail if a queue is not @@ -914,6 +919,8 @@ common_construct(struct netdev *netdev, dpdk_port_t port_no, dev->requested_n_txq = NR_QUEUE; dev->requested_rxq_size = NIC_PORT_DEFAULT_RXQ_SIZE; dev->requested_txq_size = NIC_PORT_DEFAULT_TXQ_SIZE; + dev->requested_hw_strip_crc = false; + dev->hw_strip_crc = false; /* Initialize the flow control to NULL */ memset(&dev->fc_conf, 0, sizeof dev->fc_conf); @@ -1192,6 +1199,11 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args) } else { smap_add(args, "rx_csum_offload", "false"); } + if (dev->hw_strip_crc) { + smap_add(args, "hw_strip_crc", "true"); + } else { + smap_add(args, "hw_strip_crc", "false"); + } } ovs_mutex_unlock(&dev->mutex); @@ -1255,6 +1267,19 @@ dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args) } static void +dpdk_set_hw_strip_crc_config(struct netdev_dpdk *dev, const struct smap *args) + OVS_REQUIRES(dev->mutex) +{ + int new_hw_strip_crc; + + new_hw_strip_crc = smap_get_bool(args, "hw_strip_crc", false); + if (new_hw_strip_crc != dev->requested_hw_strip_crc) { + dev->requested_hw_strip_crc = new_hw_strip_crc; + netdev_request_reconfigure(&dev->up); + } +} + +static void dpdk_process_queue_size(struct netdev *netdev, const struct smap *args, const char *flag, int default_size, int *new_size) { @@ -1290,6 +1315,8 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, dpdk_set_rxq_config(dev, args); + dpdk_set_hw_strip_crc_config(dev, args); + dpdk_process_queue_size(netdev, args, "n_rxq_desc", NIC_PORT_DEFAULT_RXQ_SIZE, &dev->requested_rxq_size); @@ -3196,6 +3223,7 @@ netdev_dpdk_reconfigure(struct netdev *netdev) if (netdev->n_txq == dev->requested_n_txq && netdev->n_rxq == dev->requested_n_rxq && dev->mtu == dev->requested_mtu + && dev->hw_strip_crc == dev->requested_hw_strip_crc && dev->rxq_size == dev->requested_rxq_size && dev->txq_size == dev->requested_txq_size && dev->socket_id == dev->requested_socket_id) { @@ -3217,6 +3245,8 @@ netdev_dpdk_reconfigure(struct netdev *netdev) dev->rxq_size = dev->requested_rxq_size; dev->txq_size = dev->requested_txq_size; + dev->hw_strip_crc = dev->requested_hw_strip_crc; + rte_free(dev->tx_q); err = dpdk_eth_dev_init(dev); dev->tx_q = netdev_dpdk_alloc_txq(netdev->n_txq); diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 074535b..d1e7a6b 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -2589,6 +2589,15 @@

+ +

+ Specifies DPDK interfaces whether enable hw_strip_crc feature or not. + If not specified, the default is false. + Not supported by DPDK vHost interfaces. +

+
+

Specifies mapping of RX queues of this interface to CPU cores.

Value should be set in the following form: