Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3667375ima; Mon, 4 Feb 2019 03:07:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IZxdyec6xuZY8XMC4hRBYoAXfN+Ww30BeV8dyeqwelDPe4c42M03F5QMXtiSNkmLPP7zIdn X-Received: by 2002:a63:4665:: with SMTP id v37mr12798904pgk.425.1549278443998; Mon, 04 Feb 2019 03:07:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278443; cv=none; d=google.com; s=arc-20160816; b=TtP/GvVfd3kb6Zd8vh7Ag3UDWgzqYXcIFFwvEc7B8AAWCgRJ5hXRD6leJo1WsRigAR oTHTRfg3aWir4XT/7vcboQ8xWE3l7PE4kiaIf3acNn7BGqTj0yowiB40SZo/41fWhXzQ 667CQrcTBmFR8U6bdQQ26JXYZHCk7gQiI3JDUqKQLdU8MlzV7uJaxT2PTQKHkqIQNkGW qwKs4XzzabUkVo+S1yEaS8+ECWZ6ckALtYG6blq1WOpsDxc5tGDwhFhe0ba5KgLiZ8Uz rvjynJmA5lh4RvnQRYfen1PmT1s8YvvO6GJHspwbmccn0b+8F6nrA0inGaZ/0UTiujo2 KS/Q== 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=DjhSi/XaAq3G3ZIDCqu9HyB5woos7y9ANnbkOaaFMF0=; b=IL3CuZhfObSiSwljjpBg5C3EcqVhMHuUesUGUWB+tr8BVjS4JhzQNzhT6pBTkU0tKg V3G6epimVZFz7+UzwzALkNovfu464qqT2yLSl6+aA2z35sTe+81phtYGCEkOAyytwPPz l5ZgDIZ81kCu6xzIlPPvrzA8d4ztzAi6M07WE3TjfsPLoB9Fc6mmbMPR/6A1uYpXF/Ua k9hq+rDInqCX+Rc4x8QFyXyl1Dpr1zwRY7FvQwhiKavbmB9OBHHcwRasl0aM53aQLQTk jnVHzP3OuKI0j0CA0Qtcln7dJe/YlWgPZDjlQ1pXy1K9XR9qKuopM8czxl+9OVcae+0m BzIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="M/Iromn3"; 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 i36si2931189plb.210.2019.02.04.03.07.07; Mon, 04 Feb 2019 03:07:23 -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="M/Iromn3"; 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 S1730319AbfBDKnv (ORCPT + 99 others); Mon, 4 Feb 2019 05:43:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728701AbfBDKns (ORCPT ); Mon, 4 Feb 2019 05:43:48 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 C81F12087C; Mon, 4 Feb 2019 10:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549277028; bh=8rSrhPICNeOvt8wsZzv0QJ25/2RN7mBlva0/uhipqLM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/Iromn3T1Rgdl6zAyX0NlXHKGqQHposNchSWElAggsK1+RTlsRggRn/rYthDeSLg Y6cV1YJPEDp9URE2FE99D3ox8HxEPcJcT21V8oLNMDhyjIIjyN8rKde40S/u5TmVlo owYWIkHzmtUX/2tnieFfh7BYKTpG29Yaq2vzuoGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aya Levin , Eran Ben Elisha , Saeed Mahameed Subject: [PATCH 4.9 09/30] net/mlx5e: Allow MAC invalidation while spoofchk is ON Date: Mon, 4 Feb 2019 11:36:47 +0100 Message-Id: <20190204103606.962074350@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103605.271746870@linuxfoundation.org> References: <20190204103605.271746870@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aya Levin [ Upstream commit 9d2cbdc5d334967c35b5f58c7bf3208e17325647 ] Prior to this patch the driver prohibited spoof checking on invalid MAC. Now the user can set this configuration if it wishes to. This is required since libvirt might invalidate the VF Mac by setting it to zero, while spoofcheck is ON. Fixes: 1ab2068a4c66 ("net/mlx5: Implement vports admin state backup/restore") Signed-off-by: Aya Levin Reviewed-by: Eran Ben Elisha Signed-off-by: Saeed Mahameed Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c @@ -1216,14 +1216,6 @@ static int esw_vport_ingress_config(stru int err = 0; u8 *smac_v; - if (vport->info.spoofchk && !is_valid_ether_addr(vport->info.mac)) { - mlx5_core_warn(esw->dev, - "vport[%d] configure ingress rules failed, illegal mac with spoofchk\n", - vport->vport); - return -EPERM; - - } - esw_vport_cleanup_ingress_rules(esw, vport); if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) { @@ -1709,13 +1701,10 @@ int mlx5_eswitch_set_vport_mac(struct ml mutex_lock(&esw->state_lock); evport = &esw->vports[vport]; - if (evport->info.spoofchk && !is_valid_ether_addr(mac)) { + if (evport->info.spoofchk && !is_valid_ether_addr(mac)) mlx5_core_warn(esw->dev, - "MAC invalidation is not allowed when spoofchk is on, vport(%d)\n", + "Set invalid MAC while spoofchk is on, vport(%d)\n", vport); - err = -EPERM; - goto unlock; - } err = mlx5_modify_nic_vport_mac_address(esw->dev, vport, mac); if (err) { @@ -1859,6 +1848,10 @@ int mlx5_eswitch_set_vport_spoofchk(stru evport = &esw->vports[vport]; pschk = evport->info.spoofchk; evport->info.spoofchk = spoofchk; + if (pschk && !is_valid_ether_addr(evport->info.mac)) + mlx5_core_warn(esw->dev, + "Spoofchk in set while MAC is invalid, vport(%d)\n", + evport->vport); if (evport->enabled && esw->mode == SRIOV_LEGACY) err = esw_vport_ingress_config(esw, evport); if (err)