Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp493778ybl; Tue, 28 Jan 2020 06:50:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzIBO08TYrsIKaIGwFxr8Ha4R+2FICaAPbicrhjW8tZlxL2De8ZOcCn0jr6EO/K4Pq7V/A5 X-Received: by 2002:a9d:7083:: with SMTP id l3mr9125497otj.193.1580223004229; Tue, 28 Jan 2020 06:50:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580223004; cv=none; d=google.com; s=arc-20160816; b=YKDGFcVdNHaq6rkPCVLrhsyK7gcccuv1p/jyPd7MVDPw0b77e7NjQazgCTN2STekh1 lpfM7CXlN5By1qD8lKWSdbzSzUnbpF0WKOof9MixKveNhCOmDQ2bMFejGtqXN31jMv0j h6Hunr/nZqJybcG6EGd05QtTAcFHJnjpwOwh/5lJz5dCduhglv+xHFR41wJiCjkYKgao RdxC0+O2VReInKPyZ7SWbiXma8cjhNAqmhKY8+8pMDdw5EXDBFrCprHWS/rcz4F1CJuy M4Ink+mYtoFChBqHUMT5BbJLBixBsgbwxZ9vWTXNT5oikDarQqX1ut9GE+m+Jug3I9TV MeAQ== 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=zw7pIWJAH7wdq5LpcGAObxTSgD1RBLDxz2HFDbTwLyY=; b=iFqYu5Go80JaWZD3hOJ9E/5vHyhRCRfQPxHVub4jLrDy4hnkBhm7l/2RyvwweKQSy2 QovL+89z81gtrBGpnCPCvQ/d7TdXDW45qtJiE+LlsHKkJj1jySMFz2D673ySObp8BvJw vIg+QQENtkxmM9EoeYV/zJ2FTOexkOlZYvg5JmG8t3il2dv1fnjW9hxLfjOXc+8gfec+ F6ChLZFUd66mSMo8t3HSku0E08crpQH+ZxrqS1adC/UwKQh3jqj6kfmADNW0la08VkuB GMtVqzb7V9YxQCN0WD3NYpLBwuaNXhOP/oae4UXirSTCU+cz9GX9Afp39qG8QymiQXEV h/gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ekZgyFYU; 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 y9si5102891oiy.81.2020.01.28.06.49.51; Tue, 28 Jan 2020 06:50:04 -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=ekZgyFYU; 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 S1727567AbgA1OCI (ORCPT + 99 others); Tue, 28 Jan 2020 09:02:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:48358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727559AbgA1OCH (ORCPT ); Tue, 28 Jan 2020 09:02:07 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5E5DD24683; Tue, 28 Jan 2020 14:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220126; bh=MLCgaxSnSTyJxaX6lEGhzhwJQNiLmovMr7i2oLaS3Os=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ekZgyFYUco93uMK3QSDnw7KqNiXDCuPBVSivJ8kBP+TyrXvjRXFwXpvD4cVEksAgF SCm8ler+HFMkQ7/PUnnsd//dnE62vEsh9rI4av7F2DU1yw4GyOpIqc2fIa/kNd35Xk sCA+h6+Uc2oRBjQdcXSxOfrSEWLbkSHWTMRGmjo8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eli Cohen , Roi Dayan , Saeed Mahameed Subject: [PATCH 5.4 027/104] net/mlx5: E-Switch, Prevent ingress rate configuration of uplink rep Date: Tue, 28 Jan 2020 14:59:48 +0100 Message-Id: <20200128135821.022792530@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135817.238524998@linuxfoundation.org> References: <20200128135817.238524998@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Eli Cohen commit e401a1848be87123a2b2049addbf21138cb47081 upstream. Since the implementation relies on limiting the VF transmit rate to simulate ingress rate limiting, and since either uplink representor or ecpf are not associated with a VF, we limit the rate limit configuration for those ports. Fixes: fcb64c0f5640 ("net/mlx5: E-Switch, add ingress rate support") Signed-off-by: Eli Cohen Reviewed-by: Roi Dayan Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -3951,6 +3951,13 @@ static int apply_police_params(struct ml u32 rate_mbps; int err; + vport_num = rpriv->rep->vport; + if (vport_num >= MLX5_VPORT_ECPF) { + NL_SET_ERR_MSG_MOD(extack, + "Ingress rate limit is supported only for Eswitch ports connected to VFs"); + return -EOPNOTSUPP; + } + esw = priv->mdev->priv.eswitch; /* rate is given in bytes/sec. * First convert to bits/sec and then round to the nearest mbit/secs. @@ -3959,8 +3966,6 @@ static int apply_police_params(struct ml * 1 mbit/sec. */ rate_mbps = rate ? max_t(u32, (rate * 8 + 500000) / 1000000, 1) : 0; - vport_num = rpriv->rep->vport; - err = mlx5_esw_modify_vport_rate(esw, vport_num, rate_mbps); if (err) NL_SET_ERR_MSG_MOD(extack, "failed applying action to hardware");