Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3489278imu; Sun, 11 Nov 2018 16:15:21 -0800 (PST) X-Google-Smtp-Source: AJdET5c7MstrmboHvetPYco9vraC1fXVUMm3mP4vhQWIqkPJR3JQ32CTiAhiPorNErFK8j8nugWd X-Received: by 2002:a17:902:74ca:: with SMTP id f10mr1831347plt.273.1541981720957; Sun, 11 Nov 2018 16:15:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981720; cv=none; d=google.com; s=arc-20160816; b=PI2w6102TuqKo9w+puyRAFO1sb/D6aXAl6AtySIU11Kx00StxX1vL+KY757xgzki+a 8N/HQ84IehxpVR2dpuX6fqwi6alVUYTHdqEmmfWPSBrVThnjp5daBfLPRb8bZz8ugEPi W7DID5PBTOZuu89E/tyX6RzYUVY5TalKgEzhEzzDUxg6/ovPB3OICKm4QlAGj3f0IWVQ 2mXOH0H0VOC0W4sfF/D0DP7p0b1jHVZHPXcOoTxtp7sVcOcf8sMN5fNO3WXboRAe/jB5 oLJ75XLklf843p/SQPYtsZFkLXBSjdriXnYz6FZST/asY70HVoV7hrYUGEwuXoa/TX4B gGSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dyMhNzkCPUEhFnErfMA/yYjTBOCwv9NKtcBF2tqfA7g=; b=jcrliCsaFYjd7yc7egeDRE6WhLlIlQMUEzHQMlCaYQBUQxwpBLxlAZUtDQiDJ/3omx hawQ2dibMJoRPaSk7l7pTBEwaFKdf5rsK8g+CJyUf0QLizQdxDbl1mK0ZIO99E8tPNI9 u96dbfR4Cim/69bw2PBfNLw3p9cj6jFtBaHO8QflzoxsmqyhWhb3g+xDn3qlfaq9WX5y y4gwzxKQcAunX8okPZwsEn7b4W5qK4cq/33J/xw8VhocRmd5A5lgmHelt3WWve1t2Eln pT/nud8H6UBs2J6FQNbRhnkqNB0js68a/3gvmNDoy9pAVkdcWcmL7wdeC1WLcj/d0p/w dnHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n0uXAT1q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si16673588plc.282.2018.11.11.16.15.06; Sun, 11 Nov 2018 16:15:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n0uXAT1q; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730356AbeKLIRL (ORCPT + 99 others); Mon, 12 Nov 2018 03:17:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:59662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730159AbeKLIRG (ORCPT ); Mon, 12 Nov 2018 03:17:06 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0BB0A21780; Sun, 11 Nov 2018 22:27:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975231; bh=8uWRwZ2z5fAqDQ9ZtXY3V9zIzJa2ZFa33fmp2SMaRbI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0uXAT1qhiVJ7kZ7oMhu4n34HjGTAYSkhLCbvlZhJfz/JMZOxkKDMpyiYYxYpkOPG GfaiHPZAnRiS2ACgLiqVcH6GGVqUez4ZzJZ/J2RYBCleOFosaQD5AZnkO7B0z8nP4F k6mPYvd/YOPTi7WO203FvV1OnVr3bp+w1S8svGpY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan C Goodfellow , Jakub Kicinski , Greg Weeks , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 056/361] nfp: devlink port split support for 1x100G CXP NIC Date: Sun, 11 Nov 2018 14:16:43 -0800 Message-Id: <20181111221627.875982220@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ryan C Goodfellow [ Upstream commit 5948185b97fa1f83d7855e638a72982a1073ebf5 ] This commit makes it possible to use devlink to split the 100G CXP Netronome into two 40G interfaces. Currently when you ask for 2 interfaces, the math in src/nfp_devlink.c:nfp_devlink_port_split calculates that you want 5 lanes per port because for some reason eth_port.port_lanes=10 (shouldn't this be 12 for CXP?). What we really want when asking for 2 breakout interfaces is 4 lanes per port. This commit makes that happen by calculating based on 8 lanes if 10 are present. Signed-off-by: Ryan C Goodfellow Reviewed-by: Jakub Kicinski Reviewed-by: Greg Weeks Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/netronome/nfp/nfp_devlink.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/netronome/nfp/nfp_devlink.c +++ b/drivers/net/ethernet/netronome/nfp/nfp_devlink.c @@ -96,6 +96,7 @@ nfp_devlink_port_split(struct devlink *d { struct nfp_pf *pf = devlink_priv(devlink); struct nfp_eth_table_port eth_port; + unsigned int lanes; int ret; if (count < 2) @@ -114,8 +115,12 @@ nfp_devlink_port_split(struct devlink *d goto out; } - ret = nfp_devlink_set_lanes(pf, eth_port.index, - eth_port.port_lanes / count); + /* Special case the 100G CXP -> 2x40G split */ + lanes = eth_port.port_lanes / count; + if (eth_port.lanes == 10 && count == 2) + lanes = 8 / count; + + ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes); out: mutex_unlock(&pf->lock); @@ -128,6 +133,7 @@ nfp_devlink_port_unsplit(struct devlink { struct nfp_pf *pf = devlink_priv(devlink); struct nfp_eth_table_port eth_port; + unsigned int lanes; int ret; mutex_lock(&pf->lock); @@ -143,7 +149,12 @@ nfp_devlink_port_unsplit(struct devlink goto out; } - ret = nfp_devlink_set_lanes(pf, eth_port.index, eth_port.port_lanes); + /* Special case the 100G CXP -> 2x40G unsplit */ + lanes = eth_port.port_lanes; + if (eth_port.port_lanes == 8) + lanes = 10; + + ret = nfp_devlink_set_lanes(pf, eth_port.index, lanes); out: mutex_unlock(&pf->lock);