Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3439900imu; Sun, 11 Nov 2018 15:08:19 -0800 (PST) X-Google-Smtp-Source: AJdET5fxtDgmDpfodFkQ1MZqxpx52OpMjA+7qpwNXAEaZ/gGRYYKV+Jw+o5UolTFJRbFJKaiauaz X-Received: by 2002:a17:902:162:: with SMTP id 89-v6mr17714819plb.293.1541977699749; Sun, 11 Nov 2018 15:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977699; cv=none; d=google.com; s=arc-20160816; b=uMoR/1D2/rswk8aGNXJBLhK3T6UdMczf77fMmB30PE342xGTPuM4Utbw6XndtU6991 KjkbprY6Z8aJV0g9+BDZOlfYeEoLJ9WhRPLd7+1lXwPczQSphOu76BEGja3g0dRkGC7O Bt0mS5HrViv7pL/uNzqLr3a+5FCrumbpui+u7ia9zlbZDRqDBqsyUhB3bDwSNWNqjm5V hCZfzC+PLJTY2BjlGm9OrRm431lo46vyulFmegTzbuQkxywF0jMJ18rO0tr74BWqMbmE U/W4LUSWfxq8KNZX+gpWrHytczRljns4+q3INNt+bLcRxCjNBN2GDDFYaE5X1RdusFld 3FAQ== 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=ouCZUR/98OF4GPL5QbY9TDbX+BfWcLpLObvQFUPNHCE=; b=T1lY2QsYz5tNHeZdrDeJ4DiRmkPNtzmVr/U4Fj4N0huMaijUrlHusdUvnQesa4LPZN N38VO0X4ZgbnoQDSAFsEphk18YWqG477TctTxlGXWEjInZLpixhWKfY+hThz7aYqFk4c 9hcdRqpn1s3gk7Ly33DRghxiJVbKlVapL4R74l++Z/gld96Eue4He4XJsqPOFbsJ7OHy 7j6ltgZz9zucx30VPaJEiWRjz87dI6khZPSz/SLq8E2EEKBXK6aeGeMfgMeWnjDZsH4/ V/0RuuYMCqH6MFExJnwSG1eSXcaIk+oIanRRJdMYJm69kNFZVnmquHl6aBK6MGA7Nlpc alPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=efyEh5zJ; 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 q25si1788389pgv.541.2018.11.11.15.08.04; Sun, 11 Nov 2018 15:08:19 -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=efyEh5zJ; 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 S1733245AbeKLI5s (ORCPT + 99 others); Mon, 12 Nov 2018 03:57:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:51248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390286AbeKLIWI (ORCPT ); Mon, 12 Nov 2018 03:22:08 -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 F178A223CB; Sun, 11 Nov 2018 22:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975532; bh=IK15JnU6i9Kx3RfC6shLuA2c/YVyz9q5ZENcgdaCz9w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=efyEh5zJiCho6iS/z9EIuZh3AzSJKhsxiksFzsanC+E4/H+OuTe3aN6vc2r0XyTI0 ltFP6oG9lklAA7aHe546RIT2ISFVe93d7j3euRF65EYF5m/dLCiRxgCv/SW8DrWa0r 4dpOvBH3fMlOOpJYgTx0PAECBaLrRr/eNszTLcg4= 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.14 042/222] nfp: devlink port split support for 1x100G CXP NIC Date: Sun, 11 Nov 2018 14:22:19 -0800 Message-Id: <20181111221651.923012600@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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); @@ -127,6 +132,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); @@ -142,7 +148,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);