From patchwork Thu Jul 13 10:10:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Kavanagh X-Patchwork-Id: 787645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3x7WmC59Ftz9s72 for ; Thu, 13 Jul 2017 20:10:35 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8A938901; Thu, 13 Jul 2017 10:10:32 +0000 (UTC) X-Original-To: ovs-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 0803F891 for ; Thu, 13 Jul 2017 10:10:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 65BBAAD for ; Thu, 13 Jul 2017 10:10:30 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP; 13 Jul 2017 03:10:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,353,1496127600"; d="scan'208";a="126693335" Received: from silpixa00380299.ir.intel.com ([10.237.222.17]) by fmsmga006.fm.intel.com with ESMTP; 13 Jul 2017 03:10:28 -0700 From: Mark Kavanagh To: ovs-dev@openvswitch.org, vipin.varghese@intel.com, aconole@redhat.com, dball@vmware.com, sugesh.chandran@intel.com Date: Thu, 13 Jul 2017 11:10:27 +0100 Message-Id: <1499940627-194604-1-git-send-email-mark.b.kavanagh@intel.com> X-Mailer: git-send-email 1.9.3 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v4] netdev-dpdk: use rte_eth_dev_set_mtu 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 DPDK provides an API to set the MTU of compatible physical devices - rte_eth_dev_set_mtu(). Prior to DPDK v16.07 however, this API was not implemented in some DPDK PMDs (i40e, specifically). To allow the use of jumbo frames with affected NICs in OvS-DPDK, MTU configuration was achieved by setting the jumbo frame flag, and corresponding maximum permitted Rx frame size, in an rte_eth_conf structure for the NIC port, and subsequently invoking rte_eth_dev_configure() with that configuration. However, that method does not set the MTU field of the underlying DPDK structure (rte_eth_dev) for the corresponding physical device; consequently, rte_eth_dev_get_mtu() reports the incorrect MTU for an OvS-DPDK phy device with non-standard MTU. Resolve this issue by invoking rte_eth_dev_set_mtu() when setting up or modifying the MTU of a DPDK phy port. Fixes: 0072e93 ("netdev-dpdk: add support for jumbo frames") Reported-by: Aaron Conole Reported-by: Vipin Varghese Reviewed-by: Aaron Conole Acked-by: Sugesh Chandran Acked-by: Darrell Ball Tested-by: Sugesh Chandran Signed-off-by: Mark Kavanagh --- v4->v3: - rebase to HEAD of master - add 'acked-by' tags for S. Chandran, D. Ball - add 'tested-by' tag for S. Chandran v3->v2: - enable scatter_rx explicitly for jumbo MTU v2->v1: - add 'reported-by' tag for Aaron Conole - change VLOG_INFO to VLOG_ERR lib/netdev-dpdk.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ea17b97..2194638 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -650,13 +650,12 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq) int i; struct rte_eth_conf conf = port_conf; + /* For some NICs (e.g. Niantic), scatter_rx mode needs to be explicitly + * enabled. */ if (dev->mtu > ETHER_MTU) { - conf.rxmode.jumbo_frame = 1; - conf.rxmode.max_rx_pkt_len = dev->max_packet_len; - } else { - conf.rxmode.jumbo_frame = 0; - conf.rxmode.max_rx_pkt_len = 0; + conf.rxmode.enable_scatter = 1; } + conf.rxmode.hw_ip_checksum = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) != 0; /* A device may report more queues than it makes available (this has @@ -676,6 +675,13 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq) break; } + diag = rte_eth_dev_set_mtu(dev->port_id, dev->mtu); + if (diag) { + VLOG_ERR("Interface %s MTU (%d) setup error: %s", + dev->up.name, dev->mtu, rte_strerror(-diag)); + break; + } + for (i = 0; i < n_txq; i++) { diag = rte_eth_tx_queue_setup(dev->port_id, i, dev->txq_size, dev->socket_id, NULL);